diff --git a/common/src/main/java/us/ajg0702/queue/common/EventHandlerImpl.java b/common/src/main/java/us/ajg0702/queue/common/EventHandlerImpl.java index aac4a69..238baa9 100644 --- a/common/src/main/java/us/ajg0702/queue/common/EventHandlerImpl.java +++ b/common/src/main/java/us/ajg0702/queue/common/EventHandlerImpl.java @@ -33,6 +33,10 @@ public class EventHandlerImpl implements EventHandler { try { String subchannel = in.readUTF(); + if(subchannel.equals("ack")) { + main.getPlatformMethods().sendPluginMessage(recievingPlayer, "ack", "yes, im here"); + } + if(subchannel.equals("queue")) { String rawData = in.readUTF(); String[] args = new String[1]; diff --git a/spigot/src/main/java/us/ajg0702/queue/spigot/Commands.java b/spigot/src/main/java/us/ajg0702/queue/spigot/Commands.java index c4a0368..cbd9460 100644 --- a/spigot/src/main/java/us/ajg0702/queue/spigot/Commands.java +++ b/spigot/src/main/java/us/ajg0702/queue/spigot/Commands.java @@ -17,6 +17,10 @@ public class Commands implements CommandExecutor { @Override public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) { + if(!pl.hasProxy()) { + sender.sendMessage(color("&cajQueue must also be installed on the proxy!&7 If it has been installed on the proxy, make sure it loaded correctly and try relogging.")); + return true; + } Player player = null; if(sender instanceof Player) { player = (Player) sender; diff --git a/spigot/src/main/java/us/ajg0702/queue/spigot/SpigotMain.java b/spigot/src/main/java/us/ajg0702/queue/spigot/SpigotMain.java index 76eb6fb..78124c9 100644 --- a/spigot/src/main/java/us/ajg0702/queue/spigot/SpigotMain.java +++ b/spigot/src/main/java/us/ajg0702/queue/spigot/SpigotMain.java @@ -9,6 +9,7 @@ import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -26,6 +27,8 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List Placeholders placeholders; ConfigFile config; + + boolean hasProxy = false; @SuppressWarnings("ConstantConditions") public void onEnable() { @@ -74,7 +77,11 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List getLogger().info("Spigot side enabled! v"+getDescription().getVersion()); } - + + public boolean hasProxy() { + return hasProxy; + } + final HashMap queuebatch = new HashMap<>(); @Override @@ -85,6 +92,10 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List String subchannel = in.readUTF(); + if(subchannel.equals("ack")) { + hasProxy = true; + } + if(subchannel.equals("inqueueevent")) { String playername = in.readUTF(); Player p = Bukkit.getPlayer(playername); @@ -180,6 +191,14 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List placeholders.cleanCache(); } + @EventHandler + public void onJoin(PlayerJoinEvent e) { + if(hasProxy) return; + Bukkit.getScheduler().runTask(this, () -> { + sendMessage(e.getPlayer(), "ack", ""); + }); + } + @EventHandler(priority = EventPriority.HIGH) public void onServerPing(ServerListPingEvent e) { if(!config.getBoolean("take-over-motd-for-whitelist")) return;