add warning if ajqueue is running on spigot without a proxy
This commit is contained in:
@@ -33,6 +33,10 @@ public class EventHandlerImpl implements EventHandler {
|
|||||||
try {
|
try {
|
||||||
String subchannel = in.readUTF();
|
String subchannel = in.readUTF();
|
||||||
|
|
||||||
|
if(subchannel.equals("ack")) {
|
||||||
|
main.getPlatformMethods().sendPluginMessage(recievingPlayer, "ack", "yes, im here");
|
||||||
|
}
|
||||||
|
|
||||||
if(subchannel.equals("queue")) {
|
if(subchannel.equals("queue")) {
|
||||||
String rawData = in.readUTF();
|
String rawData = in.readUTF();
|
||||||
String[] args = new String[1];
|
String[] args = new String[1];
|
||||||
|
|||||||
@@ -17,6 +17,10 @@ public class Commands implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
|
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;
|
Player player = null;
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
player = (Player) sender;
|
player = (Player) sender;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.Listener;
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.server.ServerListPingEvent;
|
import org.bukkit.event.server.ServerListPingEvent;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@@ -27,6 +28,8 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
|
|||||||
|
|
||||||
ConfigFile config;
|
ConfigFile config;
|
||||||
|
|
||||||
|
boolean hasProxy = false;
|
||||||
|
|
||||||
@SuppressWarnings("ConstantConditions")
|
@SuppressWarnings("ConstantConditions")
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
getServer().getMessenger().registerIncomingPluginChannel(this, "ajqueue:tospigot", this);
|
getServer().getMessenger().registerIncomingPluginChannel(this, "ajqueue:tospigot", this);
|
||||||
@@ -75,6 +78,10 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
|
|||||||
getLogger().info("Spigot side enabled! v"+getDescription().getVersion());
|
getLogger().info("Spigot side enabled! v"+getDescription().getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasProxy() {
|
||||||
|
return hasProxy;
|
||||||
|
}
|
||||||
|
|
||||||
final HashMap<Player, String> queuebatch = new HashMap<>();
|
final HashMap<Player, String> queuebatch = new HashMap<>();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -85,6 +92,10 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
|
|||||||
|
|
||||||
String subchannel = in.readUTF();
|
String subchannel = in.readUTF();
|
||||||
|
|
||||||
|
if(subchannel.equals("ack")) {
|
||||||
|
hasProxy = true;
|
||||||
|
}
|
||||||
|
|
||||||
if(subchannel.equals("inqueueevent")) {
|
if(subchannel.equals("inqueueevent")) {
|
||||||
String playername = in.readUTF();
|
String playername = in.readUTF();
|
||||||
Player p = Bukkit.getPlayer(playername);
|
Player p = Bukkit.getPlayer(playername);
|
||||||
@@ -180,6 +191,14 @@ public class SpigotMain extends JavaPlugin implements PluginMessageListener,List
|
|||||||
placeholders.cleanCache();
|
placeholders.cleanCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onJoin(PlayerJoinEvent e) {
|
||||||
|
if(hasProxy) return;
|
||||||
|
Bukkit.getScheduler().runTask(this, () -> {
|
||||||
|
sendMessage(e.getPlayer(), "ack", "");
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onServerPing(ServerListPingEvent e) {
|
public void onServerPing(ServerListPingEvent e) {
|
||||||
if(!config.getBoolean("take-over-motd-for-whitelist")) return;
|
if(!config.getBoolean("take-over-motd-for-whitelist")) return;
|
||||||
|
|||||||
Reference in New Issue
Block a user