diff --git a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java
index 365b5cd6..a61cad7b 100644
--- a/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java
+++ b/src/main/java/io/github/dre2n/dungeonsxl/DungeonsXL.java
@@ -84,7 +84,7 @@ public class DungeonsXL extends BRPlugin {
private MainConfig mainConfig;
private MessageConfig messageConfig;
- private BRCommands dCommands;
+ private DCommands dCommands;
private DSignTypes dSigns;
private GameTypes gameTypes;
private RequirementTypes requirementTypes;
@@ -347,10 +347,10 @@ public class DungeonsXL extends BRPlugin {
}
/**
- * @return the loaded instance of BRCommands
+ * @return the loaded instance of DCommands
*/
@Override
- public BRCommands getCommands() {
+ public DCommands getCommands() {
return dCommands;
}
@@ -358,37 +358,7 @@ public class DungeonsXL extends BRPlugin {
* load / reload a new instance of DCommands
*/
public void loadDCommands() {
- dCommands = new BRCommands(
- "dungeonsxl",
- this,
- new HelpCommand(),
- new BreakCommand(),
- new ChatCommand(),
- new ChatSpyCommand(),
- new CreateCommand(),
- new EditCommand(),
- new EscapeCommand(),
- new GameCommand(),
- new GroupCommand(),
- new ImportCommand(),
- new InviteCommand(),
- new JoinCommand(),
- new EnterCommand(),
- new LeaveCommand(),
- new ListCommand(),
- new LivesCommand(),
- new MainCommand(),
- new UninviteCommand(),
- new MsgCommand(),
- new PlayCommand(),
- new PortalCommand(),
- new DeletePortalCommand(),
- new ReloadCommand(),
- new SaveCommand(),
- new StatusCommand(),
- new TestCommand()
- );
-
+ dCommands = new DCommands(this);
dCommands.register(this);
}
diff --git a/src/main/java/io/github/dre2n/dungeonsxl/command/DCommands.java b/src/main/java/io/github/dre2n/dungeonsxl/command/DCommands.java
new file mode 100644
index 00000000..471990c8
--- /dev/null
+++ b/src/main/java/io/github/dre2n/dungeonsxl/command/DCommands.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (C) 2012-2016 Frank Baumann
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package io.github.dre2n.dungeonsxl.command;
+
+import io.github.dre2n.commons.command.BRCommands;
+import io.github.dre2n.commons.javaplugin.BRPlugin;
+
+/**
+ * An enumeration of all command instances.
+ *
+ * @author Daniel Saukel
+ */
+public class DCommands extends BRCommands {
+
+ public static BreakCommand BREAK = new BreakCommand();
+ public static ChatCommand CHAT = new ChatCommand();
+ public static ChatSpyCommand CHAT_SPY = new ChatSpyCommand();
+ public static CreateCommand CREATE = new CreateCommand();
+ public static EditCommand EDIT = new EditCommand();
+ public static EnterCommand ENTER = new EnterCommand();
+ public static EscapeCommand ESCAPE = new EscapeCommand();
+ public static GameCommand GAME = new GameCommand();
+ public static GroupCommand GROUP = new GroupCommand();
+ public static HelpCommand HELP = new HelpCommand();
+ public static ImportCommand IMPORT = new ImportCommand();
+ public static InviteCommand INVITE = new InviteCommand();
+ public static JoinCommand JOIN = new JoinCommand();
+ public static KickCommand KICK = new KickCommand();
+ public static LeaveCommand LEAVE = new LeaveCommand();
+ public static ListCommand LIST = new ListCommand();
+ public static LivesCommand LIVES = new LivesCommand();
+ public static MainCommand MAIN = new MainCommand();
+ public static MsgCommand MESSAGE = new MsgCommand();
+ public static PlayCommand PLAY = new PlayCommand();
+ public static PortalCommand PORTAL = new PortalCommand();
+ public static ReloadCommand RELOAD = new ReloadCommand();
+ public static SaveCommand SAVE = new SaveCommand();
+ public static StatusCommand STATUS = new StatusCommand();
+ public static TestCommand TEST = new TestCommand();
+ public static UninviteCommand UNINVITE = new UninviteCommand();
+
+ public DCommands(BRPlugin plugin) {
+ super("dungeonsxl", plugin,
+ BREAK,
+ CHAT,
+ CHAT_SPY,
+ CREATE,
+ EDIT,
+ ENTER,
+ ESCAPE,
+ GAME,
+ GROUP,
+ HELP,
+ IMPORT,
+ INVITE,
+ JOIN,
+ KICK,
+ LEAVE,
+ LIST,
+ LIVES,
+ MAIN,
+ MESSAGE,
+ PLAY,
+ PORTAL,
+ RELOAD,
+ SAVE,
+ STATUS,
+ TEST,
+ UNINVITE,
+ new DeletePortalCommand()
+ );
+ }
+
+}
diff --git a/src/main/java/io/github/dre2n/dungeonsxl/command/KickCommand.java b/src/main/java/io/github/dre2n/dungeonsxl/command/KickCommand.java
new file mode 100644
index 00000000..53e9256e
--- /dev/null
+++ b/src/main/java/io/github/dre2n/dungeonsxl/command/KickCommand.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012-2016 Frank Baumann
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+package io.github.dre2n.dungeonsxl.command;
+
+import io.github.dre2n.commons.command.BRCommand;
+import io.github.dre2n.commons.util.messageutil.MessageUtil;
+import io.github.dre2n.dungeonsxl.DungeonsXL;
+import static io.github.dre2n.dungeonsxl.command.DCommands.LEAVE;
+import io.github.dre2n.dungeonsxl.config.DMessages;
+import io.github.dre2n.dungeonsxl.player.DPermissions;
+import org.bukkit.Bukkit;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Player;
+
+/**
+ * @author Frank Baumann, Daniel Saukel
+ */
+public class KickCommand extends BRCommand {
+
+ DungeonsXL plugin = DungeonsXL.getInstance();
+
+ public KickCommand() {
+ setCommand("kick");
+ setMinArgs(1);
+ setMaxArgs(1);
+ setHelp(DMessages.HELP_CMD_KICK.getMessage());
+ setPermission(DPermissions.LEAVE.getNode());
+ setPlayerCommand(true);
+ }
+
+ @Override
+ public void onExecute(String[] args, CommandSender sender) {
+ Player player = Bukkit.getPlayer(args[1]);
+
+ if (player != null) {
+ LEAVE.onExecute(new String[]{LEAVE.getCommand()}, player);
+ MessageUtil.sendMessage(sender, DMessages.CMD_KICK_SUCCESS.getMessage(player.getName()));
+
+ } else {
+ MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[1]));
+ }
+ }
+
+}
diff --git a/src/main/java/io/github/dre2n/dungeonsxl/config/DMessages.java b/src/main/java/io/github/dre2n/dungeonsxl/config/DMessages.java
index 5f110688..1e850c9f 100644
--- a/src/main/java/io/github/dre2n/dungeonsxl/config/DMessages.java
+++ b/src/main/java/io/github/dre2n/dungeonsxl/config/DMessages.java
@@ -39,6 +39,7 @@ public enum DMessages implements Messages {
CMD_ENTER_SUCCESS("Cmd_Enter", "&6The group &4&v1 &6successfully entered the game of the group &4&v2&6."),
CMD_IMPORT_SUCCESS("Cmd_Import", "&6Successfully imported the world &4&v1&6."),
CMD_INVITE_SUCCESS("Cmd_Invite_Success", "&6Player &4&v1&6 was successfully invited to edit the map &4&v2&6."),
+ CMD_KICK_SUCCESS("Cmd_Kick_Success", "&6Successfully attempted to kick &4&v1&6."),
CMD_LEAVE_SUCCESS("Cmd_Leave_Success", "&6You have successfully left your group!"),
CMD_LIVES("Cmd_Lives", "&4&v1&6 has &4&v2 &6lives left."),
CMD_MAIN_WELCOME("Cmd_Main_Welcome", "&7Welcome to &4Dungeons&fXL"),
@@ -96,6 +97,7 @@ public enum DMessages implements Messages {
HELP_CMD_CHATSPY("Help_Cmd_Chatspy", "/dxl chatspy - Dis/enables the spymode"),
HELP_CMD_CREATE("Help_Cmd_Create", "/dxl create [name] - Creates a new dungeon map"),
HELP_CMD_EDIT("Help_Cmd_Edit", "/dxl edit [map] - Edit an existing dungeon map"),
+ HELP_CMD_ENTER("Help_Cmd_Enter", "/dxl enter ([joining group]) [target group] - Let the joining group enter the game of the target group"),
HELP_CMD_ESCAPE("Help_Cmd_Escape", "/dxl escape - Leaves the current edit world without saving"),
HELP_CMD_GAME("Help_Cmd_Game", "/dxl game - Shows information about the current game session"),
HELP_CMD_GROUP("Help_Cmd_Group", "/dxl group - Shows group command help"),
@@ -107,10 +109,10 @@ public enum DMessages implements Messages {
HELP_CMD_GROUP_KICK("Help_Cmd_GroupKick", "/dxl group kick [player] - Kicks a player"),
HELP_CMD_GROUP_SHOW("Help_Cmd_GroupShow", "/dxl group show [group] - Shows a group"),
HELP_CMD_HELP("Help_Cmd_Help", "/dxl help [page] - Shows the help page"),
- HELP_CMD_IMPORT("Help_Cmd_Import", "/dxl import [world] - Imports a world from the world container as a dungeon map."),
+ HELP_CMD_IMPORT("Help_Cmd_Import", "/dxl import [world] - Imports a world from the world container as a dungeon map"),
HELP_CMD_INVITE("Help_Cmd_Invite", "/dxl invite [player] [dungeon] - Invite a player to edit a dungeon"),
HELP_CMD_JOIN("Help_Cmd_Join", "/dxl join [announcement] - Opens the GUI to join a group in an upcoming game"),
- HELP_CMD_ENTER("Help_Cmd_Enter", "/dxl enter ([joining group]) [target group] - Let the joining group enter the game of the target group"),
+ HELP_CMD_KICK("Help_Cmd_Kick", "/dxl kick [player] - Kicks the player out of his group and dungeon"),
HELP_CMD_LEAVE("Help_Cmd_Leave", "/dxl leave - Leaves the current group and dungeon or edit world"),
HELP_CMD_LIST("Help_Cmd_List", "/dxl list ([dungeon|map|loaded]) ([dungeon]) - Lists all dungeons"),
HELP_CMD_LIVES("Help_Cmd_Lives", "/dxl lives [player] - Shows the lives a player has left"),