From e0459fa36fdc5a5ed1dc0d43434ec5a37ad84919 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Sat, 9 Sep 2017 22:03:45 +0200 Subject: [PATCH] Removed check at tabcomplete because it errored once --- .../chat/listener/PlayerJoinLeaveListener.java | 13 +------------ .../buttondevteam/chat/listener/PlayerListener.java | 3 +-- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java b/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java index aa96a2b..69e338b 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerJoinLeaveListener.java @@ -1,8 +1,6 @@ package buttondevteam.chat.listener; import java.util.Timer; -import java.util.UUID; - import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.entity.Player; @@ -100,16 +98,7 @@ public class PlayerJoinLeaveListener implements Listener { @EventHandler public void onPlayerLeave(PlayerQuitEvent event) { - String deletenick = null; - for (String nickname : PlayerListener.nicknames.keySet()) { - UUID uuid = PlayerListener.nicknames.get(nickname); - if (event.getPlayer().getUniqueId().equals(uuid)) { - deletenick = nickname; - break; - } - } - if (deletenick != null) - PlayerListener.nicknames.remove(deletenick); + PlayerListener.nicknames.inverse().remove(event.getPlayer().getUniqueId()); UnlolCommand.Lastlol.values().removeIf(lld -> lld.getLolowner().equals(event.getPlayer())); } diff --git a/src/main/java/buttondevteam/chat/listener/PlayerListener.java b/src/main/java/buttondevteam/chat/listener/PlayerListener.java index 0e8bb55..3cb70a2 100644 --- a/src/main/java/buttondevteam/chat/listener/PlayerListener.java +++ b/src/main/java/buttondevteam/chat/listener/PlayerListener.java @@ -155,8 +155,7 @@ public class PlayerListener implements Listener { public void onTabComplete(PlayerChatTabCompleteEvent e) { String name = e.getLastToken(); for (Entry nicknamekv : nicknames.entrySet()) { - if (nicknamekv.getKey().startsWith(name) - && !nicknamekv.getKey().equals(Bukkit.getPlayer(nicknamekv.getValue()).getName())) + if (nicknamekv.getKey().startsWith(name)) e.getTabCompletions().add(nicknamekv.getKey()); } }