diff --git a/src/main/java/org/aubrithehuman/entitybingo/EntityBingo.java b/src/main/java/org/aubrithehuman/entitybingo/EntityBingo.java index 25a4ad2..286716a 100644 --- a/src/main/java/org/aubrithehuman/entitybingo/EntityBingo.java +++ b/src/main/java/org/aubrithehuman/entitybingo/EntityBingo.java @@ -2,12 +2,8 @@ package org.aubrithehuman.entitybingo; import org.aubrithehuman.entitybingo.command.EntityBingoCommand; import org.aubrithehuman.entitybingo.listeners.ChatListener; -import org.aubrithehuman.entitybingo.listeners.EntityClearEventListener; -import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; -import javax.swing.text.html.parser.Entity; - public final class EntityBingo extends JavaPlugin { static EntityBingo instance; @@ -26,7 +22,6 @@ public final class EntityBingo extends JavaPlugin { this.saveDefaultConfig(); this.getServer().getPluginManager().registerEvents(new ChatListener(), this); - this.getServer().getPluginManager().registerEvents(new EntityClearEventListener(), this); DataManager.init(); diff --git a/src/main/java/org/aubrithehuman/entitybingo/command/EntityBingoCommand.java b/src/main/java/org/aubrithehuman/entitybingo/command/EntityBingoCommand.java index c319679..57d4240 100644 --- a/src/main/java/org/aubrithehuman/entitybingo/command/EntityBingoCommand.java +++ b/src/main/java/org/aubrithehuman/entitybingo/command/EntityBingoCommand.java @@ -33,7 +33,11 @@ public class EntityBingoCommand implements CommandExecutor, TabCompleter { @Override public List onTabComplete(CommandSender sender, Command command, String label, String[] args) { if(args.length >= 1) { - return options; + if(args.length >= 2) { + return null; + } else { + return options; + } } return null; } diff --git a/src/main/java/org/aubrithehuman/entitybingo/listeners/ChatListener.java b/src/main/java/org/aubrithehuman/entitybingo/listeners/ChatListener.java index b77e488..6964205 100644 --- a/src/main/java/org/aubrithehuman/entitybingo/listeners/ChatListener.java +++ b/src/main/java/org/aubrithehuman/entitybingo/listeners/ChatListener.java @@ -22,25 +22,31 @@ import java.util.regex.Pattern; public class ChatListener implements Listener { @EventHandler(priority = EventPriority.MONITOR) - public void onChat(BroadcastMessageEvent e) { - Bukkit.getLogger().info(e.getMessage()); - Pattern pattern = Pattern.compile("[ClearLag] Warning Ground items will be removed in 60 seconds", Pattern.CASE_INSENSITIVE); - Matcher matcher = pattern.matcher(e.getMessage()); - boolean matchFound = matcher.find(); + public void onBroadcast(BroadcastMessageEvent e) { + Bukkit.getLogger().info(chatLabel() + "comparing: " + e.getMessage()); +// Pattern pattern = Pattern.compile("", Pattern.CASE_INSENSITIVE); +// Matcher matcher = pattern.matcher(e.getMessage()); + boolean matchFound = e.getMessage().equals("§4[ClearLag] §cWarning Ground items will be removed in §760 §cseconds!"); + boolean matchFound2 = false; if(matchFound) { Bukkit.getLogger().info("Match found"); } else { - Bukkit.getLogger().info("Match not found"); + Bukkit.getLogger().info("Match not found, checking endpoint"); + + String check = "§6[ClearLag] §aRemoved "; + if(e.getMessage().length() >= 23) { + String p1 = e.getMessage().substring(0, 23); + matchFound2 = p1.equals(check); + if(matchFound2) { + Bukkit.getLogger().info("Match found"); + } else { + Bukkit.getLogger().info("Match not found"); + } + } } - Pattern pattern2 = Pattern.compile("[ClearLag] Removed Entities!", Pattern.CASE_INSENSITIVE); - Matcher matcher2 = pattern2.matcher(e.getMessage()); - boolean matchFound2 = matcher2.find(); - if(matchFound2) { - Bukkit.getLogger().info("Match found"); - } else { - Bukkit.getLogger().info("Match not found"); - } + + //TODO start event if(matchFound) { @@ -78,6 +84,7 @@ public class ChatListener implements Listener { } } + EntityBingo.setCurrrentEvent(null); } } } @@ -87,7 +94,7 @@ public class ChatListener implements Listener { @EventHandler(priority = EventPriority.MONITOR) public void onChat(AsyncPlayerChatEvent e) { //Entry detection - Bukkit.getLogger().info(e.getMessage()); + Bukkit.getLogger().info(chatLabel() + "comparing: " + e.getMessage()); if (EntityBingo.getCurrrentEvent() != null) { String str = e.getMessage(); String numberOnly = str.replaceAll("[^0-9]", "");