Update Listeners.java

This commit is contained in:
tmantti 2020-07-16 12:41:28 +03:00 committed by GitHub
parent 1cba807351
commit 77096a931c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -89,7 +89,20 @@ public class Listeners implements Listener {
@EventHandler
public void onJoinEvent(PlayerJoinEvent event) {
Portal.joinCooldown.put(event.getPlayer().getName(), System.currentTimeMillis());
Player player = event.getPlayer();
Portal.joinCooldown.put(player.getName(), System.currentTimeMillis());
String uuid = player.getUniqueId().toString();
if (plugin.PlayerDestiMap.containsKey(uuid)) {
plugin.getServer().getScheduler().scheduleSyncDelayedTask(plugin, () -> {
Destination.warp(player, plugin.PlayerDestiMap.get(uuid), false, true);
plugin.PlayerDestiMap.remove(uuid);
}, 1L);
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)