diff --git a/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java b/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java index 2fb49d6b..a8c4a555 100644 --- a/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java +++ b/2006Scape Server/src/main/java/com/rs2/ConfigLoader.java @@ -73,7 +73,7 @@ public class ConfigLoader { } public static void loadSecrets() throws IOException { - if (!new File("data/Secrets.json").exists()) { + if (!new File("data/secrets.json").exists()) { initialize(); System.out.println("Please open \"data/secrets.json\" file and enter your discord token bot there!"); System.out.println("Please open \"data/secrets.json\" file and enter your Website Password there!"); diff --git a/2006Scape Server/src/main/java/com/rs2/integrations/discord/JavaCord.java b/2006Scape Server/src/main/java/com/rs2/integrations/discord/JavaCord.java index 403c2e09..fa1fd083 100644 --- a/2006Scape Server/src/main/java/com/rs2/integrations/discord/JavaCord.java +++ b/2006Scape Server/src/main/java/com/rs2/integrations/discord/JavaCord.java @@ -1,6 +1,9 @@ package com.rs2.integrations.discord; import com.rs2.GameConstants; +import com.rs2.game.players.Client; +import com.rs2.game.players.Player; +import com.rs2.game.players.PlayerHandler; import org.javacord.api.DiscordApi; import org.javacord.api.DiscordApiBuilder; import org.javacord.api.entity.channel.TextChannel; @@ -39,12 +42,22 @@ public class JavaCord { } api.addMessageCreateListener(event -> { - if (event.getMessageContent().startsWith("::w" + GameConstants.WORLD + " movehome")) { + if (event.getMessageContent().startsWith("::w" + GameConstants.WORLD + " kick")) { if (event.getMessageAuthor().isServerAdmin()) { - System.out.println("perms"); - event.getChannel().sendMessage("perms"); + String playerToKick = event.getMessageContent().replace("::w" + GameConstants.WORLD + " kick ", ""); + for (Player player2 : PlayerHandler.players) { + if (player2 != null) { + if (player2.playerName.equalsIgnoreCase(playerToKick)) { + Client c2 = (Client) player2; + event.getChannel().sendMessage("You have kicked " + playerToKick + "."); + c2.disconnected = true; + c2.logout(true); + break; + } + } + } } else { - event.getChannel().sendMessage("You do not have permission to preform this command"); + event.getChannel().sendMessage("You do not have permission to perform this command"); } } });