Removed nickname map
Huh Squashed with a test commit
This commit is contained in:
parent
991ca23918
commit
0c768b95e8
2 changed files with 10 additions and 14 deletions
|
@ -41,7 +41,7 @@ public class TownColorCommand extends UCommandBase {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (args.length > ColorCount) {
|
if (args.length > ColorCount) {
|
||||||
player.sendMessage("You can only use " + ColorCount + " color" + (ColorCount > 1 ? "(s)" : "") + ".");
|
player.sendMessage("You can only use " + ColorCount + " color" + (ColorCount > 1 ? "s" : "") + ".");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
String[] a = new String[args.length + 1];
|
String[] a = new String[args.length + 1];
|
||||||
|
|
|
@ -12,12 +12,11 @@ import buttondevteam.lib.chat.TBMCChatAPI;
|
||||||
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
import buttondevteam.lib.player.ChromaGamerBase.InfoTarget;
|
||||||
import buttondevteam.lib.player.TBMCPlayer;
|
import buttondevteam.lib.player.TBMCPlayer;
|
||||||
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
import buttondevteam.lib.player.TBMCPlayerGetInfoEvent;
|
||||||
import com.google.common.collect.BiMap;
|
|
||||||
import com.google.common.collect.HashBiMap;
|
|
||||||
import com.vexsoftware.votifier.model.Vote;
|
import com.vexsoftware.votifier.model.Vote;
|
||||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||||
import net.ess3.api.events.NickChangeEvent;
|
import net.ess3.api.events.NickChangeEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
@ -31,17 +30,14 @@ import org.bukkit.help.HelpTopic;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
import java.util.Map.Entry;
|
import java.util.Random;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
public class PlayerListener implements Listener {
|
public class PlayerListener implements Listener {
|
||||||
/**
|
|
||||||
* Does not contain format codes
|
|
||||||
*/
|
|
||||||
public static BiMap<String, UUID> nicknames = HashBiMap.create();
|
|
||||||
|
|
||||||
public static boolean Enable = false;
|
public static boolean Enable = false;
|
||||||
|
|
||||||
public static int LoginWarningCountTotal = 5;
|
public static int LoginWarningCountTotal = 5;
|
||||||
|
@ -168,9 +164,10 @@ public class PlayerListener implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onTabComplete(PlayerChatTabCompleteEvent e) {
|
public void onTabComplete(PlayerChatTabCompleteEvent e) {
|
||||||
String name = e.getLastToken();
|
String name = e.getLastToken();
|
||||||
for (Entry<String, UUID> nicknamekv : nicknames.entrySet()) {
|
for (Player p : Bukkit.getOnlinePlayers()) {
|
||||||
if (nicknamekv.getKey().startsWith(name))
|
String displayName = ChatColor.stripColor(p.getDisplayName());
|
||||||
e.getTabCompletions().add(nicknamekv.getKey());
|
if (displayName.startsWith(name))
|
||||||
|
e.getTabCompletions().add(displayName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +288,6 @@ public class PlayerListener implements Listener {
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onNickChange(NickChangeEvent e) {
|
public void onNickChange(NickChangeEvent e) {
|
||||||
nicknames.inverse().put(e.getAffected().getBase().getUniqueId(), e.getValue());
|
|
||||||
//PlayerJoinLeaveListener.updatePlayerColors(e.getAffected().getBase()); //Won't fire this event again
|
//PlayerJoinLeaveListener.updatePlayerColors(e.getAffected().getBase()); //Won't fire this event again
|
||||||
|
|
||||||
Bukkit.getScheduler().runTaskLater(PluginMain.Instance, () -> {
|
Bukkit.getScheduler().runTaskLater(PluginMain.Instance, () -> {
|
||||||
|
|
Loading…
Reference in a new issue