Fix Catchers.java

This commit is contained in:
坏黑 2019-07-21 14:30:51 +08:00
parent 4149b5719e
commit 8172dbc3d9

View File

@ -1,18 +1,21 @@
package io.izzel.taboolib.util.lite; package io.izzel.taboolib.util.lite;
import io.izzel.taboolib.TabooLib; import io.izzel.taboolib.TabooLib;
import io.izzel.taboolib.module.inject.PlayerContainer;
import io.izzel.taboolib.module.inject.TListener;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
@TListener
public class Catchers implements Listener { public class Catchers implements Listener {
@PlayerContainer
private static HashMap<String, LinkedList<Catcher>> playerdata = new HashMap<>(); private static HashMap<String, LinkedList<Catcher>> playerdata = new HashMap<>();
public static HashMap<String, LinkedList<Catcher>> getPlayerdata() { public static HashMap<String, LinkedList<Catcher>> getPlayerdata() {
@ -30,11 +33,6 @@ public class Catchers implements Listener {
playerdata.get(player.getName()).add(catcher.before()); playerdata.get(player.getName()).add(catcher.before());
} }
@EventHandler
public void quit(PlayerQuitEvent e) {
playerdata.remove(e.getPlayer().getName());
}
@EventHandler @EventHandler
public void chat(AsyncPlayerChatEvent e) { public void chat(AsyncPlayerChatEvent e) {
if (playerdata.containsKey(e.getPlayer().getName()) && contains(e.getPlayer())) { if (playerdata.containsKey(e.getPlayer().getName()) && contains(e.getPlayer())) {