wongerlt Posted August 8, 2019 Posted August 8, 2019 (edited) missing net.sf.l2j.gameserver.handler.admincommandhandlers.AdminEventEngine; and some imports are wrong. example ....events. must be "event" and ...impl.. must be imp or vice versa. Edited August 8, 2019 by wongerlt 1 Quote
Williams Posted August 8, 2019 Author Posted August 8, 2019 (edited) 7 hours ago, StinkyMadness said: Eu não acho que os jogadores se importem com o ID de itens de recompensa, mas pelo Nome : D already changed for for (IntIntHolder reward: Config.TVT_REWARDS) World.announceToOnlinePlayers("TvT Event: Reward "+ ItemTable.getInstance().getTemplate(reward.getId()).getName() +","+ reward.getValue(), true); 4 hours ago, edusz93 said: Tem um pequeno erro no código que faz com que o tempo todo seja apenas teleportado de volta e removido do evento. Correção: already fixed Edited August 8, 2019 by Williams 1 Quote
edusz93 Posted August 9, 2019 Posted August 9, 2019 On 8/6/2019 at 9:30 PM, Williams said: about threadpool execution i don't know how i will do i will do more research on. ThreadPool.schedule(new Runnable() { @Override public void run() { "ACTION" } }, "TIME ACTION IN SECONDS"*1000); Quote
Tryskell Posted August 9, 2019 Posted August 9, 2019 (edited) ThreadPool.schedule(() -> finishChamp(), _endDate - System.currentTimeMillis()); In case you got a method to call, otherwise use following if you got some actions to do. _earthQuakeTask = ThreadPool.schedule(() -> { for (Player member : getAvailablePlayers(_party)) member.sendPacket(new Earthquake(member.getX(), member.getY(), member.getZ(), 65, 9)); }, jumpTime - 7000); As shown in last exemple, you can retain the task on a variable, in order to stop it when you want (notably used to delay a scheduled action, to avoid to get it twice). if (_earthQuakeTask != null) { _earthQuakeTask.cancel(false); _earthQuakeTask = null; } There's a huge amount of tasks here and there, simply read. Edited August 9, 2019 by Tryskell 1 Quote
edusz93 Posted August 12, 2019 Posted August 12, 2019 Estou tentando e tendo dificuldades em fazer com que o TVT fique com horário fixo. Exemplo na "events.properties": # Times TvT will occur (24h format). TvTEventInterval = 00:00,02:00,04:00,06:00,08:00,10:00,13:34,14:00,16:00,18:00,20:00,22:00 Quote
edusz93 Posted August 14, 2019 Posted August 14, 2019 On 8/12/2019 at 10:25 AM, edusz93 said: Estou tentando e tendo dificuldades em fazer com que o TVT fique com horário fixo. Exemplo na "events.properties": # Times TvT will occur (24h format). TvTEventInterval = 00:00,02:00,04:00,06:00,08:00,10:00,13:34,14:00,16:00,18:00,20:00,22:00 Consegui! 1 Quote
Williams Posted August 15, 2019 Author Posted August 15, 2019 11 hours ago, edusz93 said: Consegui! Estou sem tempo, quando estiver posto as alterações feitas. Quote
edusz93 Posted August 15, 2019 Posted August 15, 2019 1 hour ago, Williams said: Estou sem tempo, quando estiver posto as alterações feitas. Se quiser, te mando essa minha alteração e depois você posta tudo junto. Quote
Williams Posted August 16, 2019 Author Posted August 16, 2019 (edited) 12 hours ago, edusz93 said: Se quiser, te mando essa minha alteração e depois você posta tudo junto. manda em mp que faco o pacth, amanha ja posto Edited August 16, 2019 by Williams Quote
edusz93 Posted August 16, 2019 Posted August 16, 2019 3 hours ago, Williams said: manda em mp que faco o pacth, amanha ja posto Fiz uma diff improvisada no NotePad ++. https://mega.nz/#!rUpSAKII!oSvZDnktnxHMiXjSn7O8oXC_BTOG0wP-kUX6qv25KXM Quote
StinkyMadness Posted August 17, 2019 Posted August 17, 2019 Emm how about English on English section? Quote
Williams Posted August 26, 2019 Author Posted August 26, 2019 (edited) On 8/6/2019 at 5:50 PM, Tryskell said: To name few, after some look : * eventTimer(int time) should be handled with a Future<?> task and ThreadPool. * _originalCoordinates is (probably) redundant with _savedLocation, and the use of it is wrong (see _savedLocation usage to see correct) * CopyOnWriteArrayList container should be avoid for performance reason, use ConcurrentHashMap.newKeySet instead. * + if (reward == null) + continue; can never be null, since you manipulate it from A TO Z. * TVT_DOOR_LIST doesn't seem to be used and can use getProperty(final String name, final int[] defaultValue, final String delimiter) instead of self coded array manipulation. * CopyOnWriteArrayList container should be avoid for performance reason, use ConcurrentHashMap.newKeySet instead. * Hello Master, I'm studying and improving TVT, I'm tending to change the player lists. I changed to ConcurrentHashMap.newKeySet () in private List<Player> _registered = new CopyOnWriteArrayList<>(); for private Set<Player> _registered = ConcurrentHashMap.newKeySet(); I have this error I don't know if it's the correct one but I did it like this in Player player = _registered.get(Rnd.get(_registered.size())); for Player player = World.getInstance().getPlayer(Rnd.get(_registered.size())); Edited August 26, 2019 by Williams Quote
Tryskell Posted August 26, 2019 Posted August 26, 2019 A Set got no .get() method, and a Map would give you the key related value if you .get() it. I would use a ConcurrentHashMap (cause keys are probably useful anyway elsewhere), then generate a List based on values() with List<Player>registeredPlayers = new ArrayList(_registered.values()) then Collections.shuffle(registeredPlayers); Why shuffle instead of Rnd.get ? Simply because to avoid multiple Rnd.get. And in the end, .clear() the _registered, once all players are allocated (or even in the beginning, just after registeredPlayers creation). That would avoid to .remove everytime a loop is done. You .clear() only once. That would also avoid you that dangerous (while) loop (I'm not a big fan of loops). You only for loop, for the given shuffled internal List. It basically depends about what you do with leftover Players, if any. But your current writting means there is no leftover, otherwise you would end with infinite loop. 1 Quote
melron Posted August 26, 2019 Posted August 26, 2019 3 hours ago, Tryskell said: ... + public static final <T> T get(Set<T> set) + { + return get(new ArrayList<>(set)); + } Quote
Williams Posted August 26, 2019 Author Posted August 26, 2019 5 hours ago, Tryskell said: A Set got no .get() method, and a Map would give you the key related value if you .get() it. I would use a ConcurrentHashMap (cause keys are probably useful anyway elsewhere), then generate a List based on values() with List<Player>registeredPlayers = new ArrayList(_registered.values()) then Collections.shuffle(registeredPlayers); Why shuffle instead of Rnd.get ? Simply because to avoid multiple Rnd.get. And in the end, .clear() the _registered, once all players are allocated (or even in the beginning, just after registeredPlayers creation). That would avoid to .remove everytime a loop is done. You .clear() only once. That would also avoid you that dangerous (while) loop (I'm not a big fan of loops). You only for loop, for the given shuffled internal List. It basically depends about what you do with leftover Players, if any. But your current writting means there is no leftover, otherwise you would end with infinite loop. which would be better to list the players? private Map<Integer, Player> _registered = new ConcurrentHashMap<>(); or private Set<Player> _registered = ConcurrentHashMap.newKeySet(); Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.