Update to BRCommons 0.5.1

This commit is contained in:
Daniel Saukel 2016-05-02 21:48:39 +02:00
parent 601e0cb33e
commit bcd931c2fe
29 changed files with 153 additions and 202 deletions

View File

@ -67,7 +67,7 @@
<dependency> <dependency>
<groupId>io.github.dre2n</groupId> <groupId>io.github.dre2n</groupId>
<artifactId>commons</artifactId> <artifactId>commons</artifactId>
<version>0.5</version> <version>0.5.1</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.github.dre2n</groupId> <groupId>io.github.dre2n</groupId>

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -32,13 +31,12 @@ import org.bukkit.entity.Player;
public class BreakCommand extends BRCommand { public class BreakCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public BreakCommand() { public BreakCommand() {
setCommand("break"); setCommand("break");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_BREAK)); setHelp(DMessages.HELP_CMD_BREAK.getMessage());
setPermission(DPermissions.BREAK.getNode()); setPermission(DPermissions.BREAK.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -50,11 +48,11 @@ public class BreakCommand extends BRCommand {
if (dGlobalPlayer.isInBreakMode()) { if (dGlobalPlayer.isInBreakMode()) {
dGlobalPlayer.setInBreakMode(false); dGlobalPlayer.setInBreakMode(false);
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.CMD_BREAK_PROTECTED_MODE)); MessageUtil.sendMessage(sender, DMessages.CMD_BREAK_PROTECTED_MODE.getMessage());
} else { } else {
dGlobalPlayer.setInBreakMode(true); dGlobalPlayer.setInBreakMode(true);
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.CMD_BREAK_BREAK_MODE)); MessageUtil.sendMessage(sender, DMessages.CMD_BREAK_BREAK_MODE.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -32,13 +31,12 @@ import org.bukkit.entity.Player;
public class ChatCommand extends BRCommand { public class ChatCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public ChatCommand() { public ChatCommand() {
setCommand("chat"); setCommand("chat");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_CHAT)); setHelp(DMessages.HELP_CMD_CHAT.getMessage());
setPermission(DPermissions.CHAT.getNode()); setPermission(DPermissions.CHAT.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -49,17 +47,17 @@ public class ChatCommand extends BRCommand {
DPlayer dPlayer = DPlayer.getByPlayer(player); DPlayer dPlayer = DPlayer.getByPlayer(player);
if (dPlayer == null) { if (dPlayer == null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(player, DMessages.ERROR_JOIN_GROUP.getMessage());
return; return;
} }
if (dPlayer.isInDungeonChat()) { if (dPlayer.isInDungeonChat()) {
dPlayer.setInDungeonChat(false); dPlayer.setInDungeonChat(false);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_CHAT_NORMAL_CHAT)); MessageUtil.sendMessage(player, DMessages.CMD_CHAT_NORMAL_CHAT.getMessage());
} else { } else {
dPlayer.setInDungeonChat(true); dPlayer.setInDungeonChat(true);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_CHAT_DUNGEON_CHAT)); MessageUtil.sendMessage(player, DMessages.CMD_CHAT_DUNGEON_CHAT.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -32,13 +31,12 @@ import org.bukkit.entity.Player;
public class ChatSpyCommand extends BRCommand { public class ChatSpyCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public ChatSpyCommand() { public ChatSpyCommand() {
setCommand("chatspy"); setCommand("chatspy");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_CHATSPY)); setHelp(DMessages.HELP_CMD_CHATSPY.getMessage());
setPermission(DPermissions.CHAT_SPY.getNode()); setPermission(DPermissions.CHAT_SPY.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -50,11 +48,11 @@ public class ChatSpyCommand extends BRCommand {
if (dGlobalPlayer.isInChatSpyMode()) { if (dGlobalPlayer.isInChatSpyMode()) {
dGlobalPlayer.setInChatSpyMode(false); dGlobalPlayer.setInChatSpyMode(false);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_CHATSPY_STOPPED)); MessageUtil.sendMessage(player, DMessages.CMD_CHATSPY_STOPPED.getMessage());
} else { } else {
dGlobalPlayer.setInChatSpyMode(true); dGlobalPlayer.setInChatSpyMode(true);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_CHATSPY_START)); MessageUtil.sendMessage(player, DMessages.CMD_CHATSPY_START.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -34,13 +33,12 @@ import org.bukkit.entity.Player;
public class CreateCommand extends BRCommand { public class CreateCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public CreateCommand() { public CreateCommand() {
setMinArgs(1); setMinArgs(1);
setMaxArgs(1); setMaxArgs(1);
setCommand("create"); setCommand("create");
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_CREATE)); setHelp(DMessages.HELP_CMD_CREATE.getMessage());
setPermission(DPermissions.CREATE.getNode()); setPermission(DPermissions.CREATE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);
@ -53,8 +51,8 @@ public class CreateCommand extends BRCommand {
if (sender instanceof ConsoleCommandSender) { if (sender instanceof ConsoleCommandSender) {
if (name.length() <= 15) { if (name.length() <= 15) {
// Msg create // Msg create
MessageUtil.log(plugin, messageConfig.getMessage(DMessages.LOG_NEW_DUNGEON)); MessageUtil.log(plugin, DMessages.LOG_NEW_DUNGEON.getMessage());
MessageUtil.log(plugin, messageConfig.getMessage(DMessages.LOG_GENERATE_NEW_WORLD)); MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
// Create World // Create World
EditWorld editWorld = new EditWorld(); EditWorld editWorld = new EditWorld();
@ -64,24 +62,24 @@ public class CreateCommand extends BRCommand {
editWorld.delete(); editWorld.delete();
// MSG Done // MSG Done
MessageUtil.log(plugin, messageConfig.getMessage(DMessages.LOG_WORLD_GENERATION_FINISHED)); MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NAME_TO_LONG)); MessageUtil.sendMessage(sender, DMessages.ERROR_NAME_TO_LONG.getMessage());
} }
} else if (sender instanceof Player) { } else if (sender instanceof Player) {
Player player = (Player) sender; Player player = (Player) sender;
if (DPlayer.getByPlayer(player) != null) { if (DPlayer.getByPlayer(player) != null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }
if (name.length() <= 15) { if (name.length() <= 15) {
// Msg create // Msg create
MessageUtil.log(plugin, messageConfig.getMessage(DMessages.LOG_NEW_DUNGEON)); MessageUtil.log(plugin, DMessages.LOG_NEW_DUNGEON.getMessage());
MessageUtil.log(plugin, messageConfig.getMessage(DMessages.LOG_GENERATE_NEW_WORLD)); MessageUtil.log(plugin, DMessages.LOG_GENERATE_NEW_WORLD.getMessage());
// Create World // Create World
EditWorld editWorld = new EditWorld(); EditWorld editWorld = new EditWorld();
@ -89,13 +87,13 @@ public class CreateCommand extends BRCommand {
editWorld.setMapName(name); editWorld.setMapName(name);
// MSG Done // MSG Done
MessageUtil.log(plugin, messageConfig.getMessage(DMessages.LOG_WORLD_GENERATION_FINISHED)); MessageUtil.log(plugin, DMessages.LOG_WORLD_GENERATION_FINISHED.getMessage());
// Tp Player // Tp Player
new DPlayer(player, editWorld.getWorld(), true); new DPlayer(player, editWorld.getWorld(), true);
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NAME_TO_LONG)); MessageUtil.sendMessage(player, DMessages.ERROR_NAME_TO_LONG.getMessage());
} }
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -34,7 +33,6 @@ import org.bukkit.entity.Player;
public class DeletePortalCommand extends BRCommand { public class DeletePortalCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public DeletePortalCommand() { public DeletePortalCommand() {
setCommand("deleteportal"); setCommand("deleteportal");
@ -52,10 +50,10 @@ public class DeletePortalCommand extends BRCommand {
if (dPortal != null) { if (dPortal != null) {
dPortal.delete(); dPortal.delete();
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.PLAYER_PROTECTED_BLOCK_DELETED)); MessageUtil.sendMessage(player, DMessages.PLAYER_PROTECTED_BLOCK_DELETED.getMessage());
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NO_PROTECTED_BLOCK)); MessageUtil.sendMessage(player, DMessages.ERROR_NO_PROTECTED_BLOCK.getMessage());
} }
} }

View File

@ -17,11 +17,9 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DPlayer;
@ -35,13 +33,12 @@ import org.bukkit.entity.Player;
public class EditCommand extends BRCommand { public class EditCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public EditCommand() { public EditCommand() {
setCommand("edit"); setCommand("edit");
setMinArgs(1); setMinArgs(1);
setMaxArgs(1); setMaxArgs(1);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_EDIT)); setHelp(DMessages.HELP_CMD_EDIT.getMessage());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -55,22 +52,22 @@ public class EditCommand extends BRCommand {
DPlayer dPlayer = DPlayer.getByPlayer(player); DPlayer dPlayer = DPlayer.getByPlayer(player);
if (!(EditWorld.isInvitedPlayer(mapName, player.getUniqueId(), player.getName()) || DPermissions.hasPermission(player, DPermissions.EDIT))) { if (!(EditWorld.isInvitedPlayer(mapName, player.getUniqueId(), player.getName()) || DPermissions.hasPermission(player, DPermissions.EDIT))) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NO_PERMISSIONS)); MessageUtil.sendMessage(player, DMessages.ERROR_NO_PERMISSIONS.getMessage());
return; return;
} }
if (dPlayer != null) { if (dPlayer != null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }
if (dGroup != null) { if (dGroup != null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_GROUP)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_GROUP.getMessage());
return; return;
} }
if (editWorld == null) { if (editWorld == null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_DUNGEON_NOT_EXIST, mapName)); MessageUtil.sendMessage(player, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(mapName));
return; return;
} }

View File

@ -17,12 +17,10 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.game.Game; import io.github.dre2n.dungeonsxl.game.Game;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DPlayer;
@ -35,13 +33,12 @@ import org.bukkit.entity.Player;
public class EnterCommand extends BRCommand { public class EnterCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public EnterCommand() { public EnterCommand() {
setMinArgs(1); setMinArgs(1);
setMaxArgs(2); setMaxArgs(2);
setCommand("enter"); setCommand("enter");
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_ENTER)); setHelp(DMessages.HELP_CMD_ENTER.getMessage());
setPermission(DPermissions.ENTER.getNode()); setPermission(DPermissions.ENTER.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -55,18 +52,18 @@ public class EnterCommand extends BRCommand {
DGroup target = DGroup.getByName(targetName); DGroup target = DGroup.getByName(targetName);
if (target == null) { if (target == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_GROUP, targetName)); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage(targetName));
return; return;
} }
Game game = Game.getByDGroup(target); Game game = Game.getByDGroup(target);
if (game == null) { if (game == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_IN_GAME, targetName)); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_GAME.getMessage(targetName));
return; return;
} }
if (Game.getByDGroup(joining) != null) { if (Game.getByDGroup(joining) != null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_LEAVE_GAME)); MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GAME.getMessage());
return; return;
} }
@ -75,13 +72,13 @@ public class EnterCommand extends BRCommand {
} }
if (joining.getCaptain() != captain && !DPermissions.hasPermission(sender, DPermissions.BYPASS)) { if (joining.getCaptain() != captain && !DPermissions.hasPermission(sender, DPermissions.BYPASS)) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_CAPTAIN)); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_CAPTAIN.getMessage());
return; return;
} }
joining.setGameWorld(game.getWorld()); joining.setGameWorld(game.getWorld());
game.addDGroup(joining); game.addDGroup(joining);
joining.sendMessage(messageConfig.getMessage(DMessages.CMD_ENTER_SUCCESS, joining.getName(), targetName)); joining.sendMessage(DMessages.CMD_ENTER_SUCCESS.getMessage(joining.getName(), targetName));
for (Player player : joining.getPlayers()) { for (Player player : joining.getPlayers()) {
new DPlayer(player, game.getWorld()).ready(); new DPlayer(player, game.getWorld()).ready();

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -34,13 +33,12 @@ import org.bukkit.entity.Player;
public class EscapeCommand extends BRCommand { public class EscapeCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public EscapeCommand() { public EscapeCommand() {
setCommand("escape"); setCommand("escape");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_ESCAPE)); setHelp(DMessages.HELP_CMD_ESCAPE.getMessage());
setPermission(DPermissions.ESCAPE.getNode()); setPermission(DPermissions.ESCAPE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -52,7 +50,7 @@ public class EscapeCommand extends BRCommand {
if (dPlayer != null) { if (dPlayer != null) {
if (!dPlayer.isEditing()) { if (!dPlayer.isEditing()) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }
@ -71,10 +69,10 @@ public class EscapeCommand extends BRCommand {
DGroup dGroup = DGroup.getByPlayer(player); DGroup dGroup = DGroup.getByPlayer(player);
if (dGroup != null) { if (dGroup != null) {
dGroup.removePlayer(player); dGroup.removePlayer(player);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_LEAVE_SUCCESS)); MessageUtil.sendMessage(player, DMessages.CMD_LEAVE_SUCCESS.getMessage());
return; return;
} }
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_IN_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -34,13 +33,12 @@ import org.bukkit.entity.Player;
public class GameCommand extends BRCommand { public class GameCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public GameCommand() { public GameCommand() {
setCommand("game"); setCommand("game");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_GAME)); setHelp(DMessages.HELP_CMD_GAME.getMessage());
setPermission(DPermissions.GAME.getNode()); setPermission(DPermissions.GAME.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -50,19 +48,19 @@ public class GameCommand extends BRCommand {
Player player = (Player) sender; Player player = (Player) sender;
DGroup dGroup = DGroup.getByPlayer(player); DGroup dGroup = DGroup.getByPlayer(player);
if (dGroup == null) { if (dGroup == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
return; return;
} }
GameWorld gameWorld = dGroup.getGameWorld(); GameWorld gameWorld = dGroup.getGameWorld();
if (gameWorld == null) { if (gameWorld == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_GAME)); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_GAME.getMessage());
return; return;
} }
Game game = gameWorld.getGame(); Game game = gameWorld.getGame();
if (game == null) { if (game == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_GAME)); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_GAME.getMessage());
return; return;
} }

View File

@ -17,14 +17,12 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupDisbandEvent; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupDisbandEvent;
import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DPlayer;
@ -37,13 +35,12 @@ import org.bukkit.entity.Player;
public class GroupCommand extends BRCommand { public class GroupCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public GroupCommand() { public GroupCommand() {
setCommand("group"); setCommand("group");
setMinArgs(0); setMinArgs(0);
setMaxArgs(2); setMaxArgs(2);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_GROUP)); setHelp(DMessages.HELP_CMD_GROUP.getMessage());
setPermission(DPermissions.GROUP.getNode()); setPermission(DPermissions.GROUP.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -120,11 +117,11 @@ public class GroupCommand extends BRCommand {
dGroup = null; dGroup = null;
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.GROUP_CREATED, sender.getName(), args[2])); MessageUtil.sendMessage(sender, DMessages.GROUP_CREATED.getMessage(sender.getName(), args[2]));
} }
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_LEAVE_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GROUP.getMessage());
} }
} }
@ -134,18 +131,18 @@ public class GroupCommand extends BRCommand {
if (!event.isCancelled()) { if (!event.isCancelled()) {
dGroup.delete(); dGroup.delete();
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.GROUP_DISBANDED, sender.getName(), dGroup.getName())); MessageUtil.sendMessage(sender, DMessages.GROUP_DISBANDED.getMessage(sender.getName(), dGroup.getName()));
dGroup = null; dGroup = null;
} }
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage());
} }
} }
public void invitePlayer(DGroup dGroup) { public void invitePlayer(DGroup dGroup) {
if (dGroup == null) { if (dGroup == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
return; return;
} }
@ -155,13 +152,13 @@ public class GroupCommand extends BRCommand {
dGroup.addInvitedPlayer(toInvite, false); dGroup.addInvitedPlayer(toInvite, false);
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_PLAYER, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
} }
} }
public void uninvitePlayer(DGroup dGroup) { public void uninvitePlayer(DGroup dGroup) {
if (dGroup == null) { if (dGroup == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
return; return;
} }
@ -174,27 +171,27 @@ public class GroupCommand extends BRCommand {
dGroup.removeInvitedPlayer(toUninvite, false); dGroup.removeInvitedPlayer(toUninvite, false);
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_IN_GROUP, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_GROUP.getMessage(args[2]));
} }
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_PLAYER, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
} }
} }
public void joinGroup(DGroup dGroup) { public void joinGroup(DGroup dGroup) {
if (dGroup == null) { if (dGroup == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_GROUP, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage(args[2]));
return; return;
} }
if (DGroup.getByPlayer(player) != null) { if (DGroup.getByPlayer(player) != null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_LEAVE_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_GROUP.getMessage());
return; return;
} }
if (!dGroup.getInvitedPlayers().contains(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) { if (!dGroup.getInvitedPlayers().contains(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_INVITED, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_INVITED.getMessage(args[2]));
return; return;
} }
@ -204,7 +201,7 @@ public class GroupCommand extends BRCommand {
public void kickPlayer(DGroup dGroup) { public void kickPlayer(DGroup dGroup) {
if (dGroup == null) { if (dGroup == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
} }
Player toKick = plugin.getServer().getPlayer(args[2]); Player toKick = plugin.getServer().getPlayer(args[2]);
@ -214,25 +211,25 @@ public class GroupCommand extends BRCommand {
if (!event.isCancelled()) { if (!event.isCancelled()) {
if (dGroup.getPlayers().contains(toKick)) { if (dGroup.getPlayers().contains(toKick)) {
dGroup.removePlayer(toKick); dGroup.removePlayer(toKick);
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.GROUP_KICKED_PLAYER, sender.getName(), args[2], dGroup.getName())); MessageUtil.sendMessage(sender, DMessages.GROUP_KICKED_PLAYER.getMessage(sender.getName(), args[2], dGroup.getName()));
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_IN_GROUP, args[2], dGroup.getName())); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_GROUP.getMessage(args[2], dGroup.getName()));
} }
} }
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_PLAYER, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_PLAYER.getMessage(args[2]));
} }
} }
public void showGroup(DGroup dGroup) { public void showGroup(DGroup dGroup) {
if (dGroup == null) { if (dGroup == null) {
if (args.length == 3) { if (args.length == 3) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_SUCH_GROUP, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_SUCH_GROUP.getMessage(args[2]));
} else if (args.length == 2) { } else if (args.length == 2) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
} }
return; return;
@ -254,16 +251,16 @@ public class GroupCommand extends BRCommand {
switch (page) { switch (page) {
default: default:
MessageUtil.sendCenteredMessage(sender, "&4&l[ &61-5 &4/ &67 &4| &61 &4&l]"); MessageUtil.sendCenteredMessage(sender, "&4&l[ &61-5 &4/ &67 &4| &61 &4&l]");
MessageUtil.sendMessage(sender, "&bcreate" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_CREATE)); MessageUtil.sendMessage(sender, "&bcreate" + "&7 - " + DMessages.HELP_CMD_GROUP_CREATE.getMessage());
MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_DISBAND)); MessageUtil.sendMessage(sender, "&bdisband" + "&7 - " + DMessages.HELP_CMD_GROUP_DISBAND.getMessage());
MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_INVITE)); MessageUtil.sendMessage(sender, "&binvite" + "&7 - " + DMessages.HELP_CMD_GROUP_INVITE.getMessage());
MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_UNINVITE)); MessageUtil.sendMessage(sender, "&buninvite" + "&7 - " + DMessages.HELP_CMD_GROUP_UNINVITE.getMessage());
MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_JOIN)); MessageUtil.sendMessage(sender, "&bjoin" + "&7 - " + DMessages.HELP_CMD_GROUP_JOIN.getMessage());
break; break;
case "2": case "2":
MessageUtil.sendCenteredMessage(sender, "&4&l[ &66-10 &4/ &67 &4| &62 &4&l]"); MessageUtil.sendCenteredMessage(sender, "&4&l[ &66-10 &4/ &67 &4| &62 &4&l]");
MessageUtil.sendMessage(sender, "&bkick" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_KICK)); MessageUtil.sendMessage(sender, "&bkick" + "&7 - " + DMessages.HELP_CMD_GROUP_KICK.getMessage());
MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + messageConfig.getMessage(DMessages.HELP_CMD_GROUP_SHOW)); MessageUtil.sendMessage(sender, "&bshow" + "&7 - " + DMessages.HELP_CMD_GROUP_SHOW.getMessage());
break; break;
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.NumberUtil; import io.github.dre2n.commons.util.NumberUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
@ -33,13 +32,12 @@ import org.bukkit.command.CommandSender;
public class HelpCommand extends BRCommand { public class HelpCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public HelpCommand() { public HelpCommand() {
setCommand("help"); setCommand("help");
setMinArgs(0); setMinArgs(0);
setMaxArgs(1); setMaxArgs(1);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_HELP)); setHelp(DMessages.HELP_CMD_HELP.getMessage());
setPermission(DPermissions.HELP.getNode()); setPermission(DPermissions.HELP.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.UUIDUtil; import io.github.dre2n.commons.util.UUIDUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
@ -32,13 +31,12 @@ import org.bukkit.command.CommandSender;
public class InviteCommand extends BRCommand { public class InviteCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public InviteCommand() { public InviteCommand() {
setMinArgs(2); setMinArgs(2);
setMaxArgs(2); setMaxArgs(2);
setCommand("invite"); setCommand("invite");
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_INVITE)); setHelp(DMessages.HELP_CMD_INVITE.getMessage());
setPermission(DPermissions.INVITE.getNode()); setPermission(DPermissions.INVITE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);
@ -47,10 +45,10 @@ public class InviteCommand extends BRCommand {
@Override @Override
public void onExecute(String[] args, CommandSender sender) { public void onExecute(String[] args, CommandSender sender) {
if (EditWorld.addInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]))) { if (EditWorld.addInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]))) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.CMD_INVITE_SUCCESS, args[1], args[2])); MessageUtil.sendMessage(sender, DMessages.CMD_INVITE_SUCCESS.getMessage(args[1], args[2]));
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_DUNGEON_NOT_EXIST, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -36,13 +35,12 @@ import org.bukkit.entity.Player;
public class LeaveCommand extends BRCommand { public class LeaveCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public LeaveCommand() { public LeaveCommand() {
setCommand("leave"); setCommand("leave");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_LEAVE)); setHelp(DMessages.HELP_CMD_LEAVE.getMessage());
setPermission(DPermissions.LEAVE.getNode()); setPermission(DPermissions.LEAVE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -54,7 +52,7 @@ public class LeaveCommand extends BRCommand {
if (GameWorld.getByWorld(player.getWorld()) != null) { if (GameWorld.getByWorld(player.getWorld()) != null) {
if (GameWorld.getByWorld(player.getWorld()).isTutorial()) { if (GameWorld.getByWorld(player.getWorld()).isTutorial()) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NO_LEAVE_IN_TUTORIAL)); MessageUtil.sendMessage(player, DMessages.ERROR_NO_LEAVE_IN_TUTORIAL.getMessage());
return; return;
} }
} }
@ -70,17 +68,17 @@ public class LeaveCommand extends BRCommand {
} }
dPlayer.leave(); dPlayer.leave();
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_LEAVE_SUCCESS)); MessageUtil.sendMessage(player, DMessages.CMD_LEAVE_SUCCESS.getMessage());
} else { } else {
DGroup dGroup = DGroup.getByPlayer(player); DGroup dGroup = DGroup.getByPlayer(player);
if (dGroup != null) { if (dGroup != null) {
dGroup.removePlayer(player); dGroup.removePlayer(player);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_LEAVE_SUCCESS)); MessageUtil.sendMessage(player, DMessages.CMD_LEAVE_SUCCESS.getMessage());
return; return;
} }
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_IN_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.NumberUtil; import io.github.dre2n.commons.util.NumberUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
@ -38,13 +37,12 @@ import org.bukkit.entity.Player;
public class ListCommand extends BRCommand { public class ListCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public ListCommand() { public ListCommand() {
setCommand("list"); setCommand("list");
setMinArgs(0); setMinArgs(0);
setMaxArgs(3); setMaxArgs(3);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_LIST)); setHelp(DMessages.HELP_CMD_LIST.getMessage());
setPermission(DPermissions.LIST.getNode()); setPermission(DPermissions.LIST.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -33,13 +32,12 @@ import org.bukkit.entity.Player;
public class LivesCommand extends BRCommand { public class LivesCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public LivesCommand() { public LivesCommand() {
setCommand("lives"); setCommand("lives");
setMinArgs(0); setMinArgs(0);
setMaxArgs(1); setMaxArgs(1);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_LIVES)); setHelp(DMessages.HELP_CMD_LIVES.getMessage());
setPermission(DPermissions.LIVES.getNode()); setPermission(DPermissions.LIVES.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);
@ -58,16 +56,16 @@ public class LivesCommand extends BRCommand {
player = (Player) sender; player = (Player) sender;
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NO_CONSOLE_COMMAND, getCommand())); MessageUtil.sendMessage(sender, DMessages.ERROR_NO_CONSOLE_COMMAND.getMessage(getCommand()));
return; return;
} }
DPlayer dPlayer = DPlayer.getByPlayer(player); DPlayer dPlayer = DPlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_LIVES, player.getName(), String.valueOf(dPlayer.getLives()))); MessageUtil.sendMessage(player, DMessages.CMD_LIVES.getMessage(player.getName(), String.valueOf(dPlayer.getLives())));
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_IN_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
} }
} }

View File

@ -19,7 +19,6 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.compatibility.CompatibilityHandler; import io.github.dre2n.commons.compatibility.CompatibilityHandler;
import io.github.dre2n.commons.compatibility.Internals; import io.github.dre2n.commons.compatibility.Internals;
import io.github.dre2n.commons.config.MessageConfig;
import static io.github.dre2n.commons.util.messageutil.FatLetters.*; import static io.github.dre2n.commons.util.messageutil.FatLetters.*;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
@ -36,11 +35,10 @@ import org.bukkit.plugin.PluginManager;
public class MainCommand extends BRCommand { public class MainCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public MainCommand() { public MainCommand() {
setCommand("main"); setCommand("main");
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_MAIN)); setHelp(DMessages.HELP_CMD_MAIN.getMessage());
setPermission(DPermissions.MAIN.getNode()); setPermission(DPermissions.MAIN.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);
@ -69,10 +67,10 @@ public class MainCommand extends BRCommand {
MessageUtil.sendCenteredMessage(sender, "&4" + D[2] + "&f" + X[2] + L[2]); MessageUtil.sendCenteredMessage(sender, "&4" + D[2] + "&f" + X[2] + L[2]);
MessageUtil.sendCenteredMessage(sender, "&4" + D[3] + "&f" + X[3] + L[3]); MessageUtil.sendCenteredMessage(sender, "&4" + D[3] + "&f" + X[3] + L[3]);
MessageUtil.sendCenteredMessage(sender, "&4" + D[4] + "&f" + X[4] + L[4]); MessageUtil.sendCenteredMessage(sender, "&4" + D[4] + "&f" + X[4] + L[4]);
MessageUtil.sendCenteredMessage(sender, "&b&l###### " + messageConfig.getMessage(DMessages.CMD_MAIN_WELCOME) + "&7 v" + plugin.getDescription().getVersion() + " &b&l######"); MessageUtil.sendCenteredMessage(sender, "&b&l###### " + DMessages.CMD_MAIN_WELCOME.getMessage() + "&7 v" + plugin.getDescription().getVersion() + " &b&l######");
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(DMessages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players))); MessageUtil.sendCenteredMessage(sender, DMessages.CMD_MAIN_LOADED.getMessage(String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(DMessages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs)); MessageUtil.sendCenteredMessage(sender, DMessages.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, mythicMobs));
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(DMessages.CMD_MAIN_HELP)); MessageUtil.sendCenteredMessage(sender, DMessages.CMD_MAIN_HELP.getMessage());
MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2016 Frank Baumann & contributors; lcsd. under GPLv3."); MessageUtil.sendCenteredMessage(sender, "&7\u00a92012-2016 Frank Baumann & contributors; lcsd. under GPLv3.");
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.NumberUtil; import io.github.dre2n.commons.util.NumberUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
@ -36,13 +35,12 @@ import org.bukkit.entity.Player;
public class MsgCommand extends BRCommand { public class MsgCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public MsgCommand() { public MsgCommand() {
setMinArgs(-1); setMinArgs(-1);
setMaxArgs(-1); setMaxArgs(-1);
setCommand("msg"); setCommand("msg");
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_MSG)); setHelp(DMessages.HELP_CMD_MSG.getMessage());
setPermission(DPermissions.MESSAGE.getNode()); setPermission(DPermissions.MESSAGE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -53,7 +51,7 @@ public class MsgCommand extends BRCommand {
EditWorld editWorld = EditWorld.getByWorld(player.getWorld()); EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
if (editWorld == null) { if (editWorld == null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_IN_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
return; return;
} }
@ -74,7 +72,7 @@ public class MsgCommand extends BRCommand {
MessageUtil.sendMessage(player, ChatColor.WHITE + msg); MessageUtil.sendMessage(player, ChatColor.WHITE + msg);
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_MSG_ID_NOT_EXIST, "" + id)); MessageUtil.sendMessage(player, DMessages.ERROR_MSG_ID_NOT_EXIST.getMessage(String.valueOf(id)));
} }
} else { } else {
@ -93,22 +91,22 @@ public class MsgCommand extends BRCommand {
msg = splitMsg[1]; msg = splitMsg[1];
String old = confreader.getMsg(id, false); String old = confreader.getMsg(id, false);
if (old == null) { if (old == null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_MSG_ADDED, "" + id)); MessageUtil.sendMessage(player, DMessages.CMD_MSG_ADDED.getMessage(String.valueOf(id)));
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_MSG_UPDATED, "" + id)); MessageUtil.sendMessage(player, DMessages.CMD_MSG_UPDATED.getMessage(String.valueOf(id)));
} }
confreader.setMsg(msg, id); confreader.setMsg(msg, id);
confreader.save(); confreader.save();
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_MSG_FORMAT)); MessageUtil.sendMessage(player, DMessages.ERROR_MSG_FORMAT.getMessage());
} }
} }
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_MSG_NO_INT)); MessageUtil.sendMessage(player, DMessages.ERROR_MSG_NO_INT.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -25,7 +24,6 @@ import io.github.dre2n.dungeonsxl.config.DungeonConfig;
import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.WorldConfig;
import io.github.dre2n.dungeonsxl.dungeon.Dungeon; import io.github.dre2n.dungeonsxl.dungeon.Dungeon;
import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent;
import io.github.dre2n.dungeonsxl.player.DGlobalPlayer;
import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DGroup;
import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPermissions;
import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DPlayer;
@ -41,13 +39,12 @@ import org.bukkit.entity.Player;
public class PlayCommand extends BRCommand { public class PlayCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public PlayCommand() { public PlayCommand() {
setCommand("play"); setCommand("play");
setMinArgs(1); setMinArgs(1);
setMaxArgs(2); setMaxArgs(2);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_PLAY)); setHelp(DMessages.HELP_CMD_PLAY.getMessage());
setPermission(DPermissions.PLAY.getNode()); setPermission(DPermissions.PLAY.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -58,7 +55,7 @@ public class PlayCommand extends BRCommand {
DPlayer dPlayer = DPlayer.getByPlayer(player); DPlayer dPlayer = DPlayer.getByPlayer(player);
if (dPlayer != null) { if (dPlayer != null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }
@ -90,7 +87,7 @@ public class PlayCommand extends BRCommand {
} }
if (!multiFloor && !EditWorld.exists(identifier)) { if (!multiFloor && !EditWorld.exists(identifier)) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_DUNGEON_NOT_EXIST, identifier)); MessageUtil.sendMessage(player, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(identifier));
return; return;
} }
@ -101,14 +98,14 @@ public class PlayCommand extends BRCommand {
WorldConfig confReader = new WorldConfig(file); WorldConfig confReader = new WorldConfig(file);
if (confReader != null) { if (confReader != null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_COOLDOWN, "" + confReader.getTimeToNextPlay())); MessageUtil.sendMessage(player, DMessages.ERROR_COOLDOWN.getMessage(String.valueOf(confReader.getTimeToNextPlay())));
} }
} }
return; return;
} }
if (!GameWorld.checkRequirements(mapName, player)) { if (!GameWorld.checkRequirements(mapName, player)) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_REQUIREMENTS)); MessageUtil.sendMessage(player, DMessages.ERROR_REQUIREMENTS.getMessage());
return; return;
} }
@ -116,7 +113,7 @@ public class PlayCommand extends BRCommand {
if (dGroup != null) { if (dGroup != null) {
if (!dGroup.getCaptain().equals(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) { if (!dGroup.getCaptain().equals(player) && !DPermissions.hasPermission(player, DPermissions.BYPASS)) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_CAPTAIN)); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_CAPTAIN.getMessage());
} }
if (dGroup.getMapName() == null) { if (dGroup.getMapName() == null) {
@ -137,7 +134,7 @@ public class PlayCommand extends BRCommand {
} }
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_GROUP)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_GROUP.getMessage());
return; return;
} }
@ -161,7 +158,7 @@ public class PlayCommand extends BRCommand {
} }
if (dGroup.getGameWorld() == null) { if (dGroup.getGameWorld() == null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_SAVED, DGroup.getByPlayer(player).getMapName())); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_SAVED.getMessage(DGroup.getByPlayer(player).getMapName()));
dGroup.delete(); dGroup.delete();
return; return;
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -36,13 +35,12 @@ import org.bukkit.inventory.ItemStack;
public class PortalCommand extends BRCommand { public class PortalCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public PortalCommand() { public PortalCommand() {
setCommand("portal"); setCommand("portal");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_PORTAL)); setHelp(DMessages.HELP_CMD_PORTAL.getMessage());
setPermission(DPermissions.PORTAL.getNode()); setPermission(DPermissions.PORTAL.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -53,7 +51,7 @@ public class PortalCommand extends BRCommand {
DGlobalPlayer dGlobalPlayer = plugin.getDPlayers().getByPlayer(player); DGlobalPlayer dGlobalPlayer = plugin.getDPlayers().getByPlayer(player);
if (dGlobalPlayer instanceof DPlayer) { if (dGlobalPlayer instanceof DPlayer) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEAVE_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }
@ -64,12 +62,12 @@ public class PortalCommand extends BRCommand {
dGlobalPlayer.setCreatingPortal(dPortal); dGlobalPlayer.setCreatingPortal(dPortal);
dPortal.setWorld(player.getWorld()); dPortal.setWorld(player.getWorld());
player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD)); player.getInventory().setItemInHand(new ItemStack(Material.WOOD_SWORD));
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.PLAYER_PORTAL_INTRODUCTION)); MessageUtil.sendMessage(player, DMessages.PLAYER_PORTAL_INTRODUCTION.getMessage());
} else { } else {
dPortal.delete(); dPortal.delete();
dGlobalPlayer.setCreatingPortal(null); dGlobalPlayer.setCreatingPortal(null);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.PLAYER_PORTAL_ABORT)); MessageUtil.sendMessage(player, DMessages.PLAYER_PORTAL_ABORT.getMessage());
} }
} }

View File

@ -19,7 +19,6 @@ package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.compatibility.CompatibilityHandler; import io.github.dre2n.commons.compatibility.CompatibilityHandler;
import io.github.dre2n.commons.compatibility.Internals; import io.github.dre2n.commons.compatibility.Internals;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -35,13 +34,12 @@ import org.bukkit.plugin.PluginManager;
public class ReloadCommand extends BRCommand { public class ReloadCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public ReloadCommand() { public ReloadCommand() {
setCommand("reload"); setCommand("reload");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_RELOAD)); setHelp(DMessages.HELP_CMD_RELOAD.getMessage());
setPermission(DPermissions.RELOAD.getNode()); setPermission(DPermissions.RELOAD.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);
@ -86,9 +84,9 @@ public class ReloadCommand extends BRCommand {
plugin.loadDungeons(); plugin.loadDungeons();
MessageUtil.sendPluginTag(sender, plugin); MessageUtil.sendPluginTag(sender, plugin);
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(DMessages.CMD_RELOAD_DONE)); MessageUtil.sendCenteredMessage(sender, DMessages.CMD_RELOAD_DONE.getMessage());
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(DMessages.CMD_MAIN_LOADED, String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players))); MessageUtil.sendCenteredMessage(sender, DMessages.CMD_MAIN_LOADED.getMessage(String.valueOf(maps), String.valueOf(dungeons), String.valueOf(loaded), String.valueOf(players)));
MessageUtil.sendCenteredMessage(sender, messageConfig.getMessage(DMessages.CMD_MAIN_COMPATIBILITY, String.valueOf(internals), vault, mythicMobs)); MessageUtil.sendCenteredMessage(sender, DMessages.CMD_MAIN_COMPATIBILITY.getMessage(String.valueOf(internals), vault, mythicMobs));
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -32,13 +31,12 @@ import org.bukkit.entity.Player;
public class SaveCommand extends BRCommand { public class SaveCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public SaveCommand() { public SaveCommand() {
setCommand("save"); setCommand("save");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_SAVE)); setHelp(DMessages.HELP_CMD_SAVE.getMessage());
setPermission(DPermissions.SAVE.getNode()); setPermission(DPermissions.SAVE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -49,10 +47,10 @@ public class SaveCommand extends BRCommand {
EditWorld editWorld = EditWorld.getByWorld(player.getWorld()); EditWorld editWorld = EditWorld.getByWorld(player.getWorld());
if (editWorld != null) { if (editWorld != null) {
editWorld.save(); editWorld.save();
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.CMD_SAVE_SUCCESS)); MessageUtil.sendMessage(player, DMessages.CMD_SAVE_SUCCESS.getMessage());
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_NOT_IN_DUNGEON)); MessageUtil.sendMessage(player, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
} }
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -36,13 +35,12 @@ import org.bukkit.entity.Player;
public class TestCommand extends BRCommand { public class TestCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public TestCommand() { public TestCommand() {
setCommand("test"); setCommand("test");
setMinArgs(0); setMinArgs(0);
setMaxArgs(0); setMaxArgs(0);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_TEST)); setHelp(DMessages.HELP_CMD_TEST.getMessage());
setPermission(DPermissions.TEST.getNode()); setPermission(DPermissions.TEST.getNode());
setPlayerCommand(true); setPlayerCommand(true);
} }
@ -53,24 +51,24 @@ public class TestCommand extends BRCommand {
DGroup dGroup = DGroup.getByPlayer(player); DGroup dGroup = DGroup.getByPlayer(player);
if (dGroup == null) { if (dGroup == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_JOIN_GROUP)); MessageUtil.sendMessage(sender, DMessages.ERROR_JOIN_GROUP.getMessage());
return; return;
} }
if (!dGroup.getCaptain().equals(player)) { if (!dGroup.getCaptain().equals(player)) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_CAPTAIN)); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_CAPTAIN.getMessage());
return; return;
} }
GameWorld gameWorld = dGroup.getGameWorld(); GameWorld gameWorld = dGroup.getGameWorld();
if (gameWorld == null) { if (gameWorld == null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_NOT_IN_DUNGEON)); MessageUtil.sendMessage(sender, DMessages.ERROR_NOT_IN_DUNGEON.getMessage());
return; return;
} }
Game game = gameWorld.getGame(); Game game = gameWorld.getGame();
if (game != null) { if (game != null) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_LEAVE_DUNGEON)); MessageUtil.sendMessage(sender, DMessages.ERROR_LEAVE_DUNGEON.getMessage());
return; return;
} }

View File

@ -17,7 +17,6 @@
package io.github.dre2n.dungeonsxl.command; package io.github.dre2n.dungeonsxl.command;
import io.github.dre2n.commons.command.BRCommand; import io.github.dre2n.commons.command.BRCommand;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.UUIDUtil; import io.github.dre2n.commons.util.UUIDUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
@ -32,13 +31,12 @@ import org.bukkit.command.CommandSender;
public class UninviteCommand extends BRCommand { public class UninviteCommand extends BRCommand {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
public UninviteCommand() { public UninviteCommand() {
setCommand("uninvite"); setCommand("uninvite");
setMinArgs(2); setMinArgs(2);
setMaxArgs(2); setMaxArgs(2);
setHelp(messageConfig.getMessage(DMessages.HELP_CMD_UNINVITE)); setHelp(DMessages.HELP_CMD_UNINVITE.getMessage());
setPermission(DPermissions.UNINVITE.getNode()); setPermission(DPermissions.UNINVITE.getNode());
setPlayerCommand(true); setPlayerCommand(true);
setConsoleCommand(true); setConsoleCommand(true);
@ -47,10 +45,10 @@ public class UninviteCommand extends BRCommand {
@Override @Override
public void onExecute(String[] args, CommandSender sender) { public void onExecute(String[] args, CommandSender sender) {
if (EditWorld.removeInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]), args[1])) { if (EditWorld.removeInvitedPlayer(args[2], UUIDUtil.getUniqueIdFromName(args[1]), args[1])) {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.CMD_UNINVITE_SUCCESS, args[1], args[2])); MessageUtil.sendMessage(sender, DMessages.CMD_UNINVITE_SUCCESS.getMessage(args[1], args[2]));
} else { } else {
MessageUtil.sendMessage(sender, messageConfig.getMessage(DMessages.ERROR_DUNGEON_NOT_EXIST, args[2])); MessageUtil.sendMessage(sender, DMessages.ERROR_DUNGEON_NOT_EXIST.getMessage(args[2]));
} }
} }

View File

@ -17,6 +17,7 @@
package io.github.dre2n.dungeonsxl.config; package io.github.dre2n.dungeonsxl.config;
import io.github.dre2n.commons.config.Messages; import io.github.dre2n.commons.config.Messages;
import io.github.dre2n.dungeonsxl.DungeonsXL;
import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.configuration.file.YamlConfiguration;
@ -173,6 +174,11 @@ public enum DMessages implements Messages {
return message; return message;
} }
@Override
public String getMessage(String... args) {
return DungeonsXL.getInstance().getMessageConfig().getMessage(this, args);
}
@Override @Override
public void setMessage(String message) { public void setMessage(String message) {
this.message = message; this.message = message;

View File

@ -16,7 +16,6 @@
*/ */
package io.github.dre2n.dungeonsxl.listener; package io.github.dre2n.dungeonsxl.listener;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -78,7 +77,7 @@ import org.bukkit.inventory.meta.BookMeta;
public class PlayerListener implements Listener { public class PlayerListener implements Listener {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
protected static DPlayers dPlayers = plugin.getDPlayers(); protected static DPlayers dPlayers = plugin.getDPlayers();
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
@ -114,7 +113,7 @@ public class PlayerListener implements Listener {
dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives()); dPlayer.setLives(dPlayer.getLives() - dPlayerDeathEvent.getLostLives());
if (dPlayer.getLives() != -1) { if (dPlayer.getLives() != -1) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.PLAYER_DEATH, String.valueOf(dPlayer.getLives()))); MessageUtil.sendMessage(player, DMessages.PLAYER_DEATH.getMessage(String.valueOf(dPlayer.getLives())));
if (dConfig != null) { if (dConfig != null) {
if (dConfig.getKeepInventoryOnDeath()) { if (dConfig.getKeepInventoryOnDeath()) {
@ -132,7 +131,7 @@ public class PlayerListener implements Listener {
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.DEATH); DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.DEATH);
if (!dPlayerKickEvent.isCancelled()) { if (!dPlayerKickEvent.isCancelled()) {
MessageUtil.broadcastMessage(messageConfig.getMessage(DMessages.PLAYER_DEATH_KICK, player.getName())); MessageUtil.broadcastMessage(DMessages.PLAYER_DEATH_KICK.getMessage(player.getName()));
dPlayer.leave(); dPlayer.leave();
if (gameWorld.getConfig().getKeepInventoryOnEscape()) { if (gameWorld.getConfig().getKeepInventoryOnEscape()) {
dPlayer.applyRespawnInventory(); dPlayer.applyRespawnInventory();
@ -157,13 +156,13 @@ public class PlayerListener implements Listener {
if (event.getAction() != Action.LEFT_CLICK_BLOCK) { if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
if (clickedBlock.getType() == Material.ENDER_CHEST) { if (clickedBlock.getType() == Material.ENDER_CHEST) {
if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) { if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_ENDERCHEST)); MessageUtil.sendMessage(player, DMessages.ERROR_ENDERCHEST.getMessage());
event.setCancelled(true); event.setCancelled(true);
} }
} else if (clickedBlock.getType() == Material.BED_BLOCK) { } else if (clickedBlock.getType() == Material.BED_BLOCK) {
if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) { if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_BED)); MessageUtil.sendMessage(player, DMessages.ERROR_BED.getMessage());
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -175,7 +174,7 @@ public class PlayerListener implements Listener {
if (event.getAction() != Action.LEFT_CLICK_BLOCK) { if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
if (clickedBlock.getType() == Material.DISPENSER) { if (clickedBlock.getType() == Material.DISPENSER) {
if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) { if (!DPermissions.hasPermission(player, DPermissions.BYPASS)) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_DISPENSER)); MessageUtil.sendMessage(player, DMessages.ERROR_DISPENSER.getMessage());
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -196,13 +195,13 @@ public class PlayerListener implements Listener {
if (dPortal == dGlobalPlayer.getPortal()) { if (dPortal == dGlobalPlayer.getPortal()) {
if (dPortal.getBlock1() == null) { if (dPortal.getBlock1() == null) {
dPortal.setBlock1(event.getClickedBlock()); dPortal.setBlock1(event.getClickedBlock());
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.PLAYER_PORTAL_PROGRESS)); MessageUtil.sendMessage(player, DMessages.PLAYER_PORTAL_PROGRESS.getMessage());
} else if (dPortal.getBlock2() == null) { } else if (dPortal.getBlock2() == null) {
dPortal.setBlock2(event.getClickedBlock()); dPortal.setBlock2(event.getClickedBlock());
dPortal.setActive(true); dPortal.setActive(true);
dPortal.create(); dPortal.create();
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.PLAYER_PORTAL_CREATED)); MessageUtil.sendMessage(player, DMessages.PLAYER_PORTAL_CREATED.getMessage());
} }
event.setCancelled(true); event.setCancelled(true);
} }
@ -288,7 +287,7 @@ public class PlayerListener implements Listener {
if (event.getAction() == Action.LEFT_CLICK_BLOCK) { if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
trigger.onTrigger(player); trigger.onTrigger(player);
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEFT_CLICK)); MessageUtil.sendMessage(player, DMessages.ERROR_LEFT_CLICK.getMessage());
} }
} }
@ -299,7 +298,7 @@ public class PlayerListener implements Listener {
if (event.getAction() == Action.LEFT_CLICK_BLOCK) { if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
dPlayer.setDClass(ChatColor.stripColor(classSign.getLine(1))); dPlayer.setDClass(ChatColor.stripColor(classSign.getLine(1)));
} else { } else {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_LEFT_CLICK)); MessageUtil.sendMessage(player, DMessages.ERROR_LEFT_CLICK.getMessage());
} }
return; return;
} }
@ -344,7 +343,7 @@ public class PlayerListener implements Listener {
for (Material material : gameWorld.getConfig().getSecureObjects()) { for (Material material : gameWorld.getConfig().getSecureObjects()) {
if (material == event.getItemDrop().getItemStack().getType()) { if (material == event.getItemDrop().getItemStack().getType()) {
event.setCancelled(true); event.setCancelled(true);
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_DROP)); MessageUtil.sendMessage(player, DMessages.ERROR_DROP.getMessage());
return; return;
} }
} }
@ -466,11 +465,11 @@ public class PlayerListener implements Listener {
dPlayer.leave(); dPlayer.leave();
} else if (timeUntilKickOfflinePlayer > 0) { } else if (timeUntilKickOfflinePlayer > 0) {
dGroup.sendMessage(messageConfig.getMessage(DMessages.PLAYER_OFFLINE, dPlayer.getPlayer().getName(), "" + timeUntilKickOfflinePlayer), player); dGroup.sendMessage(DMessages.PLAYER_OFFLINE.getMessage(dPlayer.getPlayer().getName(), String.valueOf(timeUntilKickOfflinePlayer)), player);
dPlayer.setOfflineTime(System.currentTimeMillis() + timeUntilKickOfflinePlayer * 1000); dPlayer.setOfflineTime(System.currentTimeMillis() + timeUntilKickOfflinePlayer * 1000);
} else { } else {
dGroup.sendMessage(messageConfig.getMessage(DMessages.PLAYER_OFFLINE_NEVER, dPlayer.getPlayer().getName()), player); dGroup.sendMessage(DMessages.PLAYER_OFFLINE_NEVER.getMessage(dPlayer.getPlayer().getName()), player);
} }
} else if (dPlayer.isEditing()) { } else if (dPlayer.isEditing()) {
@ -550,7 +549,7 @@ public class PlayerListener implements Listener {
} }
if (dGroup.getGameWorld() == null) { if (dGroup.getGameWorld() == null) {
MessageUtil.sendMessage(player, messageConfig.getMessage(DMessages.ERROR_TUTORIAL_NOT_EXIST)); MessageUtil.sendMessage(player, DMessages.ERROR_TUTORIAL_NOT_EXIST.getMessage());
continue; continue;
} }
@ -602,7 +601,7 @@ public class PlayerListener implements Listener {
} }
if (event.isCancelled()) { if (event.isCancelled()) {
MessageUtil.sendMessage(event.getPlayer(), messageConfig.getMessage(DMessages.ERROR_CMD)); MessageUtil.sendMessage(event.getPlayer(), DMessages.ERROR_CMD.getMessage());
} }
} }

View File

@ -16,7 +16,6 @@
*/ */
package io.github.dre2n.dungeonsxl.player; package io.github.dre2n.dungeonsxl.player;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.DungeonsXL;
import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.config.DMessages;
@ -49,7 +48,6 @@ import org.bukkit.scheduler.BukkitTask;
public class DGroup { public class DGroup {
protected static DungeonsXL plugin = DungeonsXL.getInstance(); protected static DungeonsXL plugin = DungeonsXL.getInstance();
protected static MessageConfig messageConfig = plugin.getMessageConfig();
private String name; private String name;
private Player captain; private Player captain;

View File

@ -18,7 +18,6 @@ package io.github.dre2n.dungeonsxl.player;
import io.github.dre2n.commons.compatibility.CompatibilityHandler; import io.github.dre2n.commons.compatibility.CompatibilityHandler;
import io.github.dre2n.commons.compatibility.Version; import io.github.dre2n.commons.compatibility.Version;
import io.github.dre2n.commons.config.MessageConfig;
import io.github.dre2n.commons.util.NumberUtil; import io.github.dre2n.commons.util.NumberUtil;
import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.commons.util.messageutil.MessageUtil;
import io.github.dre2n.commons.util.playerutil.PlayerUtil; import io.github.dre2n.commons.util.playerutil.PlayerUtil;
@ -67,8 +66,6 @@ import org.bukkit.potion.PotionEffect;
*/ */
public class DPlayer extends DGlobalPlayer { public class DPlayer extends DGlobalPlayer {
protected static MessageConfig messageConfig = plugin.getMessageConfig();
// Variables // Variables
private World world; private World world;
@ -86,7 +83,7 @@ public class DPlayer extends DGlobalPlayer {
private long offlineTime; private long offlineTime;
private String[] linesCopy; private String[] linesCopy;
private Inventory treasureInv = plugin.getServer().createInventory(getPlayer(), 45, messageConfig.getMessage(DMessages.PLAYER_TREASURES)); private Inventory treasureInv = plugin.getServer().createInventory(getPlayer(), 45, DMessages.PLAYER_TREASURES.getMessage());
private int initialLives = -1; private int initialLives = -1;
private int lives; private int lives;
@ -580,7 +577,7 @@ public class DPlayer extends DGlobalPlayer {
// Captain here! // Captain here!
Player newCaptain = dGroup.getPlayers().get(0); Player newCaptain = dGroup.getPlayers().get(0);
dGroup.setCaptain(newCaptain); dGroup.setCaptain(newCaptain);
MessageUtil.sendMessage(newCaptain, messageConfig.getMessage(DMessages.PLAYER_NEW_CAPTAIN)); MessageUtil.sendMessage(newCaptain, DMessages.PLAYER_NEW_CAPTAIN.getMessage());
// ...*flies away* // ...*flies away*
} }
} }
@ -649,7 +646,7 @@ public class DPlayer extends DGlobalPlayer {
} }
public void finishFloor(String specifiedFloor) { public void finishFloor(String specifiedFloor) {
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(DMessages.PLAYER_FINISHED_DUNGEON)); MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_FINISHED_DUNGEON.getMessage());
finished = true; finished = true;
DGroup dGroup = DGroup.getByPlayer(getPlayer()); DGroup dGroup = DGroup.getByPlayer(getPlayer());
@ -664,7 +661,7 @@ public class DPlayer extends DGlobalPlayer {
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
DPlayer dPlayer = getByPlayer(player); DPlayer dPlayer = getByPlayer(player);
if (!dPlayer.finished) { if (!dPlayer.finished) {
MessageUtil.sendMessage(this.getPlayer(), messageConfig.getMessage(DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS)); MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
return; return;
} }
} }
@ -729,7 +726,7 @@ public class DPlayer extends DGlobalPlayer {
public void finish(boolean message) { public void finish(boolean message) {
if (message) { if (message) {
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(DMessages.PLAYER_FINISHED_DUNGEON)); MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_FINISHED_DUNGEON.getMessage());
} }
finished = true; finished = true;
@ -749,7 +746,7 @@ public class DPlayer extends DGlobalPlayer {
DPlayer dPlayer = getByPlayer(player); DPlayer dPlayer = getByPlayer(player);
if (!dPlayer.finished) { if (!dPlayer.finished) {
if (message) { if (message) {
MessageUtil.sendMessage(this.getPlayer(), messageConfig.getMessage(DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS)); MessageUtil.sendMessage(this.getPlayer(), DMessages.PLAYER_WAIT_FOR_OTHER_PLAYERS.getMessage());
} }
hasToWait = true; hasToWait = true;
@ -830,14 +827,14 @@ public class DPlayer extends DGlobalPlayer {
} }
} else { } else {
linesCopy = lines; linesCopy = lines;
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(DMessages.PLAYER_SIGN_COPIED)); MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_SIGN_COPIED.getMessage());
} }
} else { } else {
String info = "" + block.getType(); String info = "" + block.getType();
if (block.getData() != 0) { if (block.getData() != 0) {
info = info + "," + block.getData(); info = info + "," + block.getData();
} }
MessageUtil.sendMessage(getPlayer(), messageConfig.getMessage(DMessages.PLAYER_BLOCK_INFO, info)); MessageUtil.sendMessage(getPlayer(), DMessages.PLAYER_BLOCK_INFO.getMessage(info));
} }
} }

View File

@ -58,7 +58,7 @@ public class TimeIsRunningTask extends BukkitRunnable {
} finally { } finally {
for (Player player : dGroup.getPlayers()) { for (Player player : dGroup.getPlayers()) {
MessageUtil.sendActionBarMessage(player, messageConfig.getMessage(DMessages.PLAYER_TIME_LEFT, color, String.valueOf(timeLeft))); MessageUtil.sendActionBarMessage(player, DMessages.PLAYER_TIME_LEFT.getMessage(color, String.valueOf(timeLeft)));
DPlayer dPlayer = DPlayer.getByPlayer(player); DPlayer dPlayer = DPlayer.getByPlayer(player);
if (timeLeft > 0) { if (timeLeft > 0) {
@ -68,7 +68,7 @@ public class TimeIsRunningTask extends BukkitRunnable {
DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.TIME_EXPIRED); DPlayerKickEvent dPlayerKickEvent = new DPlayerKickEvent(dPlayer, DPlayerKickEvent.Cause.TIME_EXPIRED);
if (!dPlayerKickEvent.isCancelled()) { if (!dPlayerKickEvent.isCancelled()) {
MessageUtil.broadcastMessage(messageConfig.getMessage(DMessages.PLAYER_TIME_KICK, player.getName())); MessageUtil.broadcastMessage(DMessages.PLAYER_TIME_KICK.getMessage(player.getName()));
dPlayer.leave(); dPlayer.leave();
if (dGroup.getGameWorld().getConfig().getKeepInventoryOnEscape()) { if (dGroup.getGameWorld().getConfig().getKeepInventoryOnEscape()) {
dPlayer.applyRespawnInventory(); dPlayer.applyRespawnInventory();
@ -80,4 +80,5 @@ public class TimeIsRunningTask extends BukkitRunnable {
} }
} }
} }