diff --git a/src/io/github/dre2n/dungeonsxl/DungeonsXL.java b/src/io/github/dre2n/dungeonsxl/DungeonsXL.java index c8a5df80..8fe3a967 100644 --- a/src/io/github/dre2n/dungeonsxl/DungeonsXL.java +++ b/src/io/github/dre2n/dungeonsxl/DungeonsXL.java @@ -7,7 +7,8 @@ import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.dungeon.DLootInventory; import io.github.dre2n.dungeonsxl.dungeon.Dungeons; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameTypes; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.global.DPortal; import io.github.dre2n.dungeonsxl.global.GroupSign; import io.github.dre2n.dungeonsxl.global.LeaveSign; @@ -20,8 +21,8 @@ import io.github.dre2n.dungeonsxl.listener.WorldListener; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DSavePlayer; -import io.github.dre2n.dungeonsxl.requirement.Requirements; -import io.github.dre2n.dungeonsxl.reward.Rewards; +import io.github.dre2n.dungeonsxl.requirement.RequirementTypes; +import io.github.dre2n.dungeonsxl.reward.RewardTypes; import io.github.dre2n.dungeonsxl.sign.DSigns; import io.github.dre2n.dungeonsxl.task.LazyUpdateTask; import io.github.dre2n.dungeonsxl.task.UpdateTask; @@ -49,6 +50,7 @@ import org.bukkit.scheduler.BukkitTask; public class DungeonsXL extends JavaPlugin { private static DungeonsXL plugin; + private Economy economyProvider; private Permission permissionProvider; @@ -59,8 +61,9 @@ public class DungeonsXL extends JavaPlugin { private DCommands dCommands; private DSigns dSigns; - private Requirements requirements; - private Rewards rewards; + private GameTypes gameTypes; + private RequirementTypes requirementTypes; + private RewardTypes rewardTypes; private Triggers triggers; private Dungeons dungeons; @@ -94,8 +97,9 @@ public class DungeonsXL extends JavaPlugin { loadMessageConfig(new File(plugin.getDataFolder(), "languages/" + mainConfig.getLanguage() + ".yml")); loadVersionUtil(); loadDCommands(); - loadRequirements(); - loadRewards(); + loadGameTypes(); + loadRequirementTypes(); + loadRewardTypes(); loadTriggers(); loadDSigns(); loadDungeons(); @@ -135,8 +139,8 @@ public class DungeonsXL extends JavaPlugin { messageConfig.save(); // DPlayer leaves World - for (DPlayer dplayer : dPlayers) { - dplayer.leave(); + for (DPlayer dPlayer : dPlayers) { + dPlayer.leave(); } // Delete all Data @@ -195,8 +199,8 @@ public class DungeonsXL extends JavaPlugin { try { configFile.save(file); - } catch (IOException e) { - e.printStackTrace(); + } catch (IOException exception) { + exception.printStackTrace(); } } @@ -377,31 +381,45 @@ public class DungeonsXL extends JavaPlugin { } /** - * @return the requirements + * @return the game types */ - public Requirements getRequirements() { - return requirements; + public GameTypes getGameTypes() { + return gameTypes; } /** - * load / reload a new instance of Requirements + * load / reload a new instance of GameTypes */ - public void loadRequirements() { - requirements = new Requirements(); + public void loadGameTypes() { + gameTypes = new GameTypes(); } /** - * @return the rewards + * @return the requirement types */ - public Rewards getRewards() { - return rewards; + public RequirementTypes getRequirementTypes() { + return requirementTypes; } /** - * load / reload a new instance of Rewards + * load / reload a new instance of RequirementTypes */ - public void loadRewards() { - rewards = new Rewards(); + public void loadRequirementTypes() { + requirementTypes = new RequirementTypes(); + } + + /** + * @return the reward types + */ + public RewardTypes getRewardTypes() { + return rewardTypes; + } + + /** + * load / reload a new instance of RewardTypes + */ + public void loadRewardTypes() { + rewardTypes = new RewardTypes(); } /** diff --git a/src/io/github/dre2n/dungeonsxl/command/DCommand.java b/src/io/github/dre2n/dungeonsxl/command/DCommand.java index 58816397..ed9a6369 100644 --- a/src/io/github/dre2n/dungeonsxl/command/DCommand.java +++ b/src/io/github/dre2n/dungeonsxl/command/DCommand.java @@ -11,7 +11,7 @@ import org.bukkit.entity.Player; public abstract class DCommand { static DungeonsXL plugin = DungeonsXL.getPlugin(); - MessageConfig messageConfig = plugin.getMessageConfig(); + static MessageConfig messageConfig = plugin.getMessageConfig(); public boolean costsMoney; private String command; diff --git a/src/io/github/dre2n/dungeonsxl/command/DCommands.java b/src/io/github/dre2n/dungeonsxl/command/DCommands.java index 8044e1a1..627bd3d7 100644 --- a/src/io/github/dre2n/dungeonsxl/command/DCommands.java +++ b/src/io/github/dre2n/dungeonsxl/command/DCommands.java @@ -17,6 +17,7 @@ public class DCommands { dCommands.add(new CreateCommand()); dCommands.add(new EditCommand()); dCommands.add(new EscapeCommand()); + dCommands.add(new GameCommand()); dCommands.add(new GroupCommand()); dCommands.add(new InviteCommand()); dCommands.add(new LeaveCommand()); diff --git a/src/io/github/dre2n/dungeonsxl/command/GameCommand.java b/src/io/github/dre2n/dungeonsxl/command/GameCommand.java new file mode 100644 index 00000000..9874e108 --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/command/GameCommand.java @@ -0,0 +1,55 @@ +package io.github.dre2n.dungeonsxl.command; + +import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; +import io.github.dre2n.dungeonsxl.game.Game; +import io.github.dre2n.dungeonsxl.game.GameWorld; +import io.github.dre2n.dungeonsxl.player.DGroup; +import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class GameCommand extends DCommand { + + public GameCommand() { + setCommand("game"); + setMinArgs(0); + setMaxArgs(0); + setHelp(messageConfig.getMessage(Messages.HELP_CMD_GAME)); + setPermission("dxl.game"); + setPlayerCommand(true); + } + + @Override + public void onExecute(String[] args, CommandSender sender) { + Player player = (Player) sender; + DGroup dGroup = DGroup.getByPlayer(player); + if (dGroup == null) { + MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_JOIN_GROUP)); + return; + } + + GameWorld gameWorld = dGroup.getGameWorld(); + if (gameWorld == null) { + MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_GAME)); + return; + } + + Game game = gameWorld.getGame(); + if (game == null) { + MessageUtil.sendMessage(sender, messageConfig.getMessage(Messages.ERROR_NO_GAME)); + return; + } + + MessageUtil.sendCenteredMessage(sender, "&4&l[ &6Game &4&l]"); + String groups = ""; + for (DGroup group : game.getDGroups()) { + groups += (group == game.getDGroups().get(0) ? "" : "&b, &e") + group.getName(); + } + MessageUtil.sendMessage(sender, "&bGroups: &e" + groups); + MessageUtil.sendMessage(sender, "&bGame type: &e" + game.getType()); + MessageUtil.sendMessage(sender, "&bDungeon: &e" + (dGroup.getDungeonName() == null ? "N/A" : dGroup.getDungeonName())); + MessageUtil.sendMessage(sender, "&bMap: &e" + (dGroup.getMapName() == null ? "N/A" : dGroup.getMapName())); + } + +} diff --git a/src/io/github/dre2n/dungeonsxl/command/GroupCommand.java b/src/io/github/dre2n/dungeonsxl/command/GroupCommand.java index 7951f8a5..7371c8d2 100644 --- a/src/io/github/dre2n/dungeonsxl/command/GroupCommand.java +++ b/src/io/github/dre2n/dungeonsxl/command/GroupCommand.java @@ -215,7 +215,7 @@ public class GroupCommand extends DCommand { MessageUtil.sendCenteredMessage(sender, "&4&l[ &6" + dGroup.getName() + " &4&l]"); MessageUtil.sendMessage(sender, "&bCaptain: &e" + dGroup.getCaptain().getName()); - String players = "&e"; + String players = ""; for (Player player : dGroup.getPlayers()) { players += (player == dGroup.getPlayers().get(0) ? "" : "&b, &e") + player.getName(); } diff --git a/src/io/github/dre2n/dungeonsxl/command/LeaveCommand.java b/src/io/github/dre2n/dungeonsxl/command/LeaveCommand.java index d076de40..25736e3e 100644 --- a/src/io/github/dre2n/dungeonsxl/command/LeaveCommand.java +++ b/src/io/github/dre2n/dungeonsxl/command/LeaveCommand.java @@ -1,8 +1,8 @@ package io.github.dre2n.dungeonsxl.command; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/command/ListCommand.java b/src/io/github/dre2n/dungeonsxl/command/ListCommand.java index 6edc1f99..f05e9eb1 100644 --- a/src/io/github/dre2n/dungeonsxl/command/ListCommand.java +++ b/src/io/github/dre2n/dungeonsxl/command/ListCommand.java @@ -5,7 +5,7 @@ import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.Dungeon; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.util.NumberUtil; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/command/PlayCommand.java b/src/io/github/dre2n/dungeonsxl/command/PlayCommand.java index 1dedc491..f29b45fd 100644 --- a/src/io/github/dre2n/dungeonsxl/command/PlayCommand.java +++ b/src/io/github/dre2n/dungeonsxl/command/PlayCommand.java @@ -5,8 +5,8 @@ import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.Dungeon; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/command/TestCommand.java b/src/io/github/dre2n/dungeonsxl/command/TestCommand.java index c716d009..c6fba40f 100644 --- a/src/io/github/dre2n/dungeonsxl/command/TestCommand.java +++ b/src/io/github/dre2n/dungeonsxl/command/TestCommand.java @@ -4,8 +4,8 @@ import io.github.dre2n.dungeonsxl.config.DungeonConfig; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.Dungeon; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/config/MessageConfig.java b/src/io/github/dre2n/dungeonsxl/config/MessageConfig.java index 81462371..7ca7df45 100644 --- a/src/io/github/dre2n/dungeonsxl/config/MessageConfig.java +++ b/src/io/github/dre2n/dungeonsxl/config/MessageConfig.java @@ -74,7 +74,7 @@ public class MessageConfig { ERROR_CHEST_IS_OPENED("Error_ChestIsOpened", "&4This chest has already been opened."), ERROR_CMD("Error_Cmd", "&4Commands are not allowed while in a dungeon!"), ERROR_CMD_NOT_EXIST_1("Error_CmdNotExist1", "&4Command &6&v1&4 does not exist!"), - ERROR_CMD_NOT_EXIST_2("Error_CmdNotExist2", "&4Pleaser enter &6/dxl help&4 for help!"), + ERROR_CMD_NOT_EXIST_2("Error_CmdNotExist2", "&4Please enter &6/dxl help&4 for help!"), ERROR_COOLDOWN("Error_Cooldown", "&4You can only enter this Dungeon every &6&v1&4 hours!"), ERROR_DISPENSER("Error_Dispenser", "&4You cannot access this dispenser!"), ERROR_DROP("Error_Drop", "&4You cannot drop safe items"), @@ -90,6 +90,7 @@ public class MessageConfig { ERROR_MSG_NO_INT("Error_MsgNoInt", "&4Argument has to include a number!"), ERROR_NAME_TO_LONG("Error_NameToLong", "&4The name may not be longer than 15 characters!"), ERROR_NO_CONSOLE_COMMAND("Error_NoConsoleCommand", "&6/dxl &v1&4 cannot be executed as console!"), + ERROR_NO_GAME("Error_NoGame", "&4You currently do not take part in a game."), ERROR_NO_LEAVE_IN_TUTORIAL("Error_NoLeaveInTutorial", "&4You cannot use this command in the tutorial!"), ERROR_NO_PERMISSIONS("Error_NoPermissions", "&4You have no permission to do this!"), ERROR_NO_PLAYER_COMMAND("Error_NoPlayerCommand", "&6/dxl &v1&4 cannot be executed as player!"), @@ -112,6 +113,7 @@ public class MessageConfig { HELP_CMD_CREATE("Help_Cmd_Create", "/dxl create - Creates a new dungeon"), HELP_CMD_EDIT("Help_Cmd_Edit", "/dxl edit - Edit an existing dungeon"), HELP_CMD_ESCAPE("Help_Cmd_Escape", "/dxl escape - Leaves the current dungeon, 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"), HELP_CMD_GROUP_CREATE("Help_Cmd_GroupCreate", "/dxl group create [group] - Creates a new group"), HELP_CMD_GROUP_DISBAND("Help_Cmd_GroupDisband", "/dxl group disband ([group]) - Disbands a group"), diff --git a/src/io/github/dre2n/dungeonsxl/config/WorldConfig.java b/src/io/github/dre2n/dungeonsxl/config/WorldConfig.java index de9e8308..3ed4c4b0 100644 --- a/src/io/github/dre2n/dungeonsxl/config/WorldConfig.java +++ b/src/io/github/dre2n/dungeonsxl/config/WorldConfig.java @@ -1,6 +1,7 @@ package io.github.dre2n.dungeonsxl.config; import io.github.dre2n.dungeonsxl.DungeonsXL; +import io.github.dre2n.dungeonsxl.game.GameType; import io.github.dre2n.dungeonsxl.mob.DMobType; import io.github.dre2n.dungeonsxl.player.DClass; import io.github.dre2n.dungeonsxl.requirement.FeeRequirement; @@ -70,6 +71,8 @@ public class WorldConfig { private List finishedAll; private int timeLastPlayed = 0; + private GameType forcedGameType; + // MobTypes private Set mobTypes = new HashSet(); @@ -286,7 +289,7 @@ public class WorldConfig { /* Dungeon Requirements */ if (configFile.contains("requirements")) { for (String identifier : configFile.getConfigurationSection("requirements").getKeys(false)) { - Requirement requirement = Requirement.create(plugin.getRequirements().getByIdentifier(identifier)); + Requirement requirement = Requirement.create(plugin.getRequirementTypes().getByIdentifier(identifier)); // Check for built-in requirements if (requirement instanceof FeeRequirement) { @@ -321,6 +324,18 @@ public class WorldConfig { if (configFile.contains("gameCommandWhitelist")) { gameCommandWhitelist = configFile.getStringList("gameCommandWhitelist"); + } else { + gameCommandWhitelist = plugin.getDefaultConfig().gameCommandWhitelist; + } + + if (configFile.contains("forcedGameType")) { + GameType gameType = plugin.getGameTypes().getByName(configFile.getString("forcedGameType")); + if (gameType != null) { + forcedGameType = gameType; + + } else { + forcedGameType = null; + } } } @@ -601,4 +616,19 @@ public class WorldConfig { return gameCommandWhitelist; } + /** + * @return the forcedGameType + */ + public GameType getForcedGameType() { + return forcedGameType; + } + + /** + * @param forcedGameType + * the forcedGameType to set + */ + public void setForcedGameType(GameType forcedGameType) { + this.forcedGameType = forcedGameType; + } + } diff --git a/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupFinishFloorEvent.java b/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupFinishFloorEvent.java index aca7d75b..e82036b6 100644 --- a/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupFinishFloorEvent.java +++ b/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupFinishFloorEvent.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.event.dgroup; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import org.bukkit.event.Cancellable; diff --git a/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupStartFloorEvent.java b/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupStartFloorEvent.java index 1dc9d1c0..5687a68f 100644 --- a/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupStartFloorEvent.java +++ b/src/io/github/dre2n/dungeonsxl/event/dgroup/DGroupStartFloorEvent.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.event.dgroup; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import org.bukkit.event.Cancellable; diff --git a/src/io/github/dre2n/dungeonsxl/event/dsign/DSignRegistrationEvent.java b/src/io/github/dre2n/dungeonsxl/event/dsign/DSignRegistrationEvent.java index 660aa8f9..45111cce 100644 --- a/src/io/github/dre2n/dungeonsxl/event/dsign/DSignRegistrationEvent.java +++ b/src/io/github/dre2n/dungeonsxl/event/dsign/DSignRegistrationEvent.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.event.dsign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.sign.DSign; import org.bukkit.block.Sign; diff --git a/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldEvent.java b/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldEvent.java index c98e9d44..f5870e95 100644 --- a/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldEvent.java +++ b/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldEvent.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.event.gameworld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.event.Event; diff --git a/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java b/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java index b9331ec0..42bb2f12 100644 --- a/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java +++ b/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldStartGameEvent.java @@ -1,6 +1,7 @@ package io.github.dre2n.dungeonsxl.event.gameworld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.Game; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; @@ -8,11 +9,28 @@ import org.bukkit.event.HandlerList; public class GameWorldStartGameEvent extends GameWorldEvent implements Cancellable { private static final HandlerList handlers = new HandlerList(); - private boolean cancelled; - public GameWorldStartGameEvent(GameWorld gameWorld) { + private Game game; + + public GameWorldStartGameEvent(GameWorld gameWorld, Game game) { super(gameWorld); + this.game = game; + } + + /** + * @return the game + */ + public Game getGame() { + return game; + } + + /** + * @param game + * the game to set + */ + public void setGame(Game game) { + this.game = game; } @Override diff --git a/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldUnloadEvent.java b/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldUnloadEvent.java index 6c09a9fc..b141b9ac 100644 --- a/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldUnloadEvent.java +++ b/src/io/github/dre2n/dungeonsxl/event/gameworld/GameWorldUnloadEvent.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.event.gameworld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.event.Cancellable; import org.bukkit.event.HandlerList; diff --git a/src/io/github/dre2n/dungeonsxl/game/Game.java b/src/io/github/dre2n/dungeonsxl/game/Game.java new file mode 100644 index 00000000..2b0064e6 --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/game/Game.java @@ -0,0 +1,61 @@ +package io.github.dre2n.dungeonsxl.game; + +import io.github.dre2n.dungeonsxl.player.DGroup; + +import java.util.ArrayList; +import java.util.List; + +public class Game { + + private List dGroups = new ArrayList(); + private GameType type; + + public Game(DGroup dGroup) { + this.dGroups.add(dGroup); + this.type = GameTypeDefault.DEFAULT; + } + + public Game(DGroup dGroup, GameType type) { + this.dGroups.add(dGroup); + this.type = type; + } + + /** + * @return the dGroups + */ + public List getDGroups() { + return dGroups; + } + + /** + * @param dGroup + * the dGroups to add + */ + public void addDGroup(DGroup dGroup) { + dGroups.add(dGroup); + } + + /** + * @param dGroup + * the dGroups to remove + */ + public void removeDGroup(DGroup dGroup) { + dGroups.remove(dGroup); + } + + /** + * @return the type + */ + public GameType getType() { + return type; + } + + /** + * @param type + * the type to set + */ + public void setType(GameType type) { + this.type = type; + } + +} diff --git a/src/io/github/dre2n/dungeonsxl/dungeon/game/GameChest.java b/src/io/github/dre2n/dungeonsxl/game/GameChest.java similarity index 99% rename from src/io/github/dre2n/dungeonsxl/dungeon/game/GameChest.java rename to src/io/github/dre2n/dungeonsxl/game/GameChest.java index 21d2387f..6ef0ae4e 100644 --- a/src/io/github/dre2n/dungeonsxl/dungeon/game/GameChest.java +++ b/src/io/github/dre2n/dungeonsxl/game/GameChest.java @@ -1,4 +1,4 @@ -package io.github.dre2n.dungeonsxl.dungeon.game; +package io.github.dre2n.dungeonsxl.game; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; diff --git a/src/io/github/dre2n/dungeonsxl/dungeon/game/GamePlaceableBlock.java b/src/io/github/dre2n/dungeonsxl/game/GamePlaceableBlock.java similarity index 99% rename from src/io/github/dre2n/dungeonsxl/dungeon/game/GamePlaceableBlock.java rename to src/io/github/dre2n/dungeonsxl/game/GamePlaceableBlock.java index dce9a2ad..7a7654aa 100644 --- a/src/io/github/dre2n/dungeonsxl/dungeon/game/GamePlaceableBlock.java +++ b/src/io/github/dre2n/dungeonsxl/game/GamePlaceableBlock.java @@ -1,4 +1,4 @@ -package io.github.dre2n.dungeonsxl.dungeon.game; +package io.github.dre2n.dungeonsxl.game; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/game/GameType.java b/src/io/github/dre2n/dungeonsxl/game/GameType.java new file mode 100644 index 00000000..4169522c --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/game/GameType.java @@ -0,0 +1,95 @@ +package io.github.dre2n.dungeonsxl.game; + +import org.bukkit.GameMode; + +public interface GameType { + + /** + * @return the displayName + */ + public String getDisplayName(); + + /** + * @param displayName + * the displayName to set + */ + public void setDisplayName(String displayName); + + /** + * @return the signName + */ + public String getSignName(); + + /** + * @param signName + * the signName to set + */ + public void setSignName(String signName); + + /** + * @return the playerVersusPlayer + */ + public boolean isPlayerVersusPlayer(); + + /** + * @param playerVersusPlayer + * the playerVersusPlayer to set + */ + public void setPlayerVersusPlayer(boolean playerVersusPlayer); + + /** + * @return the mobWaves + */ + public boolean hasMobWaves(); + + /** + * @param mobWaves + * the mobWaves to set + */ + public void setMobWaves(boolean mobWaves); + + /** + * @return the rewards + */ + public boolean hasRewards(); + + /** + * @param rewards + * the rewards to set + */ + public void setRewards(boolean rewards); + + /** + * @return the showTime + */ + public boolean getShowTime(); + + /** + * @param showTime + * the showTime to set + */ + public void setShowTime(boolean showTime); + + /** + * @return the build + */ + public boolean canBuild(); + + /** + * @param build + * the build to set + */ + public void setBuild(boolean build); + + /** + * @return the gameMode + */ + public GameMode getGameMode(); + + /** + * @param gameMode + * the gameMode to set + */ + public void setGameMode(GameMode gameMode); + +} diff --git a/src/io/github/dre2n/dungeonsxl/game/GameTypeDefault.java b/src/io/github/dre2n/dungeonsxl/game/GameTypeDefault.java new file mode 100644 index 00000000..f3da82c6 --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/game/GameTypeDefault.java @@ -0,0 +1,128 @@ +package io.github.dre2n.dungeonsxl.game; + +import org.bukkit.GameMode; + +public enum GameTypeDefault implements GameType { + + ADVENTURE("Adventure", "Adventure", false, false, true, false, true, GameMode.ADVENTURE), + ADVENTURE_TIME_IS_RUNNING("Adventure - Time is Running", "Adventure TiR", false, false, true, true, true, GameMode.ADVENTURE), + APOCALYPSE_LAST_MAN_STANDING("Apocalypse", "Apocalypse LMS", true, true, true, false, false, GameMode.SURVIVAL), + APOCALYPSE_LIMITED_MOBS("Apocalypse - Limited Mobs", "Apc Limited", true, true, true, false, false, GameMode.SURVIVAL), + APOCALYPSE_TIME_IS_RUNNING("Apocalypse - Time is Running", "Apocalypse TiR", true, true, true, true, false, GameMode.SURVIVAL), + PVE_LAST_MAN_STANDING("Player versus Environment - Last Man Standing", "PvE LMS", false, true, true, false, false, GameMode.SURVIVAL), + PVE_LIMITED_MOBS("Player versus Environment - Limited Mobs", "PvE Limited", false, true, true, false, false, GameMode.SURVIVAL), + PVE_TIME_IS_RUNNING("Player versus Environment - Time is Running", "PvE TiR", false, true, true, true, false, GameMode.SURVIVAL), + PVP_FACTIONS_BATTLEFIELD("Player versus Player - Factions Battlefield", "FactionsPvP", true, false, false, false, false, GameMode.SURVIVAL), + PVP_LAST_MAN_STANDING("Player versus Player - Last Man Standing", "PvP LMS", true, false, false, false, false, GameMode.SURVIVAL), + QUEST("Quest", "Quest", false, false, true, false, false, GameMode.SURVIVAL), + QUEST_TIME_IS_RUNNING("Quest - Time is Running", "Quest TiR", false, false, true, true, false, GameMode.SURVIVAL), + TEST("Test", "Test", false, false, false, true, true, GameMode.SURVIVAL), + TUTORIAL("Tutorial", "Tutorial", false, false, true, false, false, GameMode.SURVIVAL), + DEFAULT("Default", "Default"); + + private String displayName; + private String signName; + private boolean playerVersusPlayer; + private boolean mobWaves; + private boolean rewards; + private boolean showTime; + private boolean build; + private GameMode gameMode; + + GameTypeDefault(String displayName, String signName) { + this.displayName = displayName; + this.signName = signName; + } + + GameTypeDefault(String displayName, String signName, boolean playerVersusPlayer, boolean mobWaves, boolean rewards, boolean showTime, boolean build, GameMode gameMode) { + this.displayName = displayName; + this.signName = signName; + this.playerVersusPlayer = playerVersusPlayer; + this.mobWaves = mobWaves; + this.rewards = rewards; + this.showTime = showTime; + this.build = build; + this.gameMode = gameMode; + } + + @Override + public String getDisplayName() { + return displayName; + } + + @Override + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + + @Override + public String getSignName() { + return signName; + } + + @Override + public void setSignName(String signName) { + this.signName = signName; + } + + @Override + public boolean isPlayerVersusPlayer() { + return playerVersusPlayer; + } + + @Override + public void setPlayerVersusPlayer(boolean playerVersusPlayer) { + this.playerVersusPlayer = playerVersusPlayer; + } + + @Override + public boolean hasMobWaves() { + return mobWaves; + } + + @Override + public void setMobWaves(boolean mobWaves) { + this.mobWaves = mobWaves; + } + + @Override + public boolean hasRewards() { + return rewards; + } + + @Override + public void setRewards(boolean rewards) { + this.rewards = rewards; + } + + @Override + public boolean getShowTime() { + return showTime; + } + + @Override + public void setShowTime(boolean showTime) { + this.showTime = showTime; + } + + @Override + public boolean canBuild() { + return build; + } + + @Override + public void setBuild(boolean build) { + this.build = build; + } + + @Override + public GameMode getGameMode() { + return gameMode; + } + + @Override + public void setGameMode(GameMode gameMode) { + this.gameMode = gameMode; + } + +} diff --git a/src/io/github/dre2n/dungeonsxl/game/GameTypes.java b/src/io/github/dre2n/dungeonsxl/game/GameTypes.java new file mode 100644 index 00000000..88cf9686 --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/game/GameTypes.java @@ -0,0 +1,83 @@ +package io.github.dre2n.dungeonsxl.game; + +import io.github.dre2n.dungeonsxl.DungeonsXL; +import io.github.dre2n.dungeonsxl.game.GameType; +import io.github.dre2n.dungeonsxl.game.GameTypeDefault; + +import java.util.ArrayList; +import java.util.List; + +import org.bukkit.block.Sign; + +public class GameTypes { + + private List types = new ArrayList(); + + public GameTypes() { + for (GameType type : GameTypeDefault.values()) { + if (type == GameTypeDefault.PVP_FACTIONS_BATTLEFIELD) { + try { + Class.forName("com.massivecraft.factions.Patch"); + + } catch (ClassNotFoundException exception) { + DungeonsXL.getPlugin().getLogger().info("Could not find compatible Factions plugin. The game type PVP_FACTIONS_BATTLEFIELD will not get enabled..."); + continue; + } + } + + types.add(type); + } + } + + /** + * @return the game type which has the enum value name + */ + public GameType getByName(String name) { + for (GameType type : types) { + if (type.toString().equals(name)) { + return type; + } + } + + return null; + } + + /** + * @return the game type which has the enum value sign text in the second line of the sign + */ + public GameType getBySign(Sign sign) { + String[] lines = sign.getLines(); + + for (GameType type : types) { + if (type.getSignName().equals(lines[1])) { + return type; + } + } + + return null; + } + + /** + * @return the game types + */ + public List getGameTypes() { + return types; + } + + /** + * @param type + * the game type to add + */ + public void addGameType(GameType type) { + types.add(type); + } + + /** + * @param game + * the game to remove + */ + public void removeGameType(GameType type) { + types.remove(type); + } + +} diff --git a/src/io/github/dre2n/dungeonsxl/dungeon/game/GameWorld.java b/src/io/github/dre2n/dungeonsxl/game/GameWorld.java similarity index 98% rename from src/io/github/dre2n/dungeonsxl/dungeon/game/GameWorld.java rename to src/io/github/dre2n/dungeonsxl/game/GameWorld.java index f09542a4..df7fe1ea 100644 --- a/src/io/github/dre2n/dungeonsxl/dungeon/game/GameWorld.java +++ b/src/io/github/dre2n/dungeonsxl/game/GameWorld.java @@ -1,4 +1,4 @@ -package io.github.dre2n.dungeonsxl.dungeon.game; +package io.github.dre2n.dungeonsxl.game; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.DungeonConfig; @@ -43,7 +43,9 @@ public class GameWorld { static DungeonsXL plugin = DungeonsXL.getPlugin(); - // Variables placeable + // Variables + private Game game; + private boolean tutorial; private CopyOnWriteArrayList placeableBlocks = new CopyOnWriteArrayList(); @@ -83,6 +85,21 @@ public class GameWorld { } } + /** + * @return the game + */ + public Game getGame() { + return game; + } + + /** + * @param game + * the game to set + */ + public void setGame(Game game) { + this.game = game; + } + /** * @return the tutorial */ @@ -330,7 +347,7 @@ public class GameWorld { } public void startGame() { - GameWorldStartGameEvent event = new GameWorldStartGameEvent(this); + GameWorldStartGameEvent event = new GameWorldStartGameEvent(this, game); if (event.isCancelled()) { return; diff --git a/src/io/github/dre2n/dungeonsxl/global/DPortal.java b/src/io/github/dre2n/dungeonsxl/global/DPortal.java index d59d1f26..3be39efb 100644 --- a/src/io/github/dre2n/dungeonsxl/global/DPortal.java +++ b/src/io/github/dre2n/dungeonsxl/global/DPortal.java @@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.global; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/global/GroupSign.java b/src/io/github/dre2n/dungeonsxl/global/GroupSign.java index 3003ff6f..d73f4cf7 100644 --- a/src/io/github/dre2n/dungeonsxl/global/GroupSign.java +++ b/src/io/github/dre2n/dungeonsxl/global/GroupSign.java @@ -4,7 +4,7 @@ import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.Dungeon; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/listener/BlockListener.java b/src/io/github/dre2n/dungeonsxl/listener/BlockListener.java index 4a20d2e4..a3eab2ee 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/BlockListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/BlockListener.java @@ -3,8 +3,8 @@ package io.github.dre2n.dungeonsxl.listener; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GamePlaceableBlock; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GamePlaceableBlock; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.global.DPortal; import io.github.dre2n.dungeonsxl.global.GroupSign; import io.github.dre2n.dungeonsxl.global.LeaveSign; @@ -30,7 +30,7 @@ import org.bukkit.event.block.SignChangeEvent; public class BlockListener implements Listener { - static DungeonsXL plugin = DungeonsXL.getPlugin(); + DungeonsXL plugin = DungeonsXL.getPlugin(); @EventHandler(priority = EventPriority.HIGH) public void onPhysics(BlockPhysicsEvent event) { diff --git a/src/io/github/dre2n/dungeonsxl/listener/CommandListener.java b/src/io/github/dre2n/dungeonsxl/listener/CommandListener.java index e783f167..83b5aa06 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/CommandListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/CommandListener.java @@ -14,10 +14,10 @@ import org.bukkit.entity.Player; public class CommandListener implements CommandExecutor { + static DungeonsXL plugin = DungeonsXL.getPlugin(); + @Override public boolean onCommand(CommandSender sender, Command cmd_notused, String arg, String[] args) { - DungeonsXL plugin = DungeonsXL.getPlugin(); - if (args.length > 0) { MessageConfig MessageConfig = plugin.getMessageConfig(); DCommand dCommand = plugin.getDCommands().getDCommand(args[0]); diff --git a/src/io/github/dre2n/dungeonsxl/listener/EntityListener.java b/src/io/github/dre2n/dungeonsxl/listener/EntityListener.java index 92ce4d0c..dc78eb3f 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/EntityListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/EntityListener.java @@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.listener; import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.global.DPortal; import io.github.dre2n.dungeonsxl.global.GroupSign; import io.github.dre2n.dungeonsxl.mob.DMob; diff --git a/src/io/github/dre2n/dungeonsxl/listener/HangingListener.java b/src/io/github/dre2n/dungeonsxl/listener/HangingListener.java index a3400aff..e554c008 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/HangingListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/HangingListener.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.listener; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; diff --git a/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java b/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java index 28d026c9..1c9a711e 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/PlayerListener.java @@ -8,11 +8,11 @@ import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.DLootInventory; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameChest; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupCreateEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerDeathEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent; +import io.github.dre2n.dungeonsxl.game.GameChest; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.global.DPortal; import io.github.dre2n.dungeonsxl.global.GroupSign; import io.github.dre2n.dungeonsxl.global.LeaveSign; @@ -52,7 +52,7 @@ import org.bukkit.inventory.meta.BookMeta; public class PlayerListener implements Listener { static DungeonsXL plugin = DungeonsXL.getPlugin(); - MessageConfig messageConfig = plugin.getMessageConfig(); + static MessageConfig messageConfig = plugin.getMessageConfig(); @EventHandler(priority = EventPriority.HIGH) public void onDeath(PlayerDeathEvent event) { diff --git a/src/io/github/dre2n/dungeonsxl/listener/WorldListener.java b/src/io/github/dre2n/dungeonsxl/listener/WorldListener.java index b3cb13bc..4171e56a 100644 --- a/src/io/github/dre2n/dungeonsxl/listener/WorldListener.java +++ b/src/io/github/dre2n/dungeonsxl/listener/WorldListener.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.listener; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; diff --git a/src/io/github/dre2n/dungeonsxl/mob/DMob.java b/src/io/github/dre2n/dungeonsxl/mob/DMob.java index 7f534acc..fdf3da8c 100644 --- a/src/io/github/dre2n/dungeonsxl/mob/DMob.java +++ b/src/io/github/dre2n/dungeonsxl/mob/DMob.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.mob; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dmob.DMobDeathEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.trigger.MobTrigger; import java.util.Random; diff --git a/src/io/github/dre2n/dungeonsxl/mob/DMobType.java b/src/io/github/dre2n/dungeonsxl/mob/DMobType.java index 28dfe12a..f4234913 100644 --- a/src/io/github/dre2n/dungeonsxl/mob/DMobType.java +++ b/src/io/github/dre2n/dungeonsxl/mob/DMobType.java @@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.mob; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.util.NumberUtil; import java.util.Arrays; diff --git a/src/io/github/dre2n/dungeonsxl/player/DGroup.java b/src/io/github/dre2n/dungeonsxl/player/DGroup.java index ba3799bd..4d4ccc36 100644 --- a/src/io/github/dre2n/dungeonsxl/player/DGroup.java +++ b/src/io/github/dre2n/dungeonsxl/player/DGroup.java @@ -3,10 +3,11 @@ package io.github.dre2n.dungeonsxl.player; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.Dungeon; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupStartFloorEvent; import io.github.dre2n.dungeonsxl.event.requirement.RequirementDemandEvent; import io.github.dre2n.dungeonsxl.event.reward.RewardAdditionEvent; +import io.github.dre2n.dungeonsxl.game.Game; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.global.GroupSign; import io.github.dre2n.dungeonsxl.requirement.Requirement; import io.github.dre2n.dungeonsxl.reward.Reward; @@ -15,6 +16,7 @@ import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; import java.util.ArrayList; import java.util.List; import java.util.UUID; +import java.util.concurrent.CopyOnWriteArrayList; import org.bukkit.entity.Player; @@ -24,7 +26,7 @@ public class DGroup { private String name; private Player captain; - private List players = new ArrayList(); + private List players = new CopyOnWriteArrayList(); private List invitedPlayers = new ArrayList(); private String dungeonName; private String mapName; @@ -414,7 +416,30 @@ public class DGroup { GroupSign.updatePerGroup(this); } - public void startGame() { + public void startGame(Game game) { + if (game == null) { + return; + } + + for (DGroup dGroup : game.getDGroups()) { + if (dGroup == null) { + continue; + } + + for (Player player : dGroup.getPlayers()) { + DPlayer dPlayer = DPlayer.getByPlayer(player); + if (dPlayer == null) { + continue; + } + + if ( !dPlayer.isReady()) { + return; + } + } + } + + gameWorld.setGame(game); + DGroupStartFloorEvent event = new DGroupStartFloorEvent(this, gameWorld); if (event.isCancelled()) { @@ -429,10 +454,10 @@ public class DGroup { DPlayer dPlayer = DPlayer.getByPlayer(player); dPlayer.respawn(); if (dungeonName != null) { - MessageUtil.sendScreenMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", "")); + MessageUtil.sendScreenMessage(player, "&b&l" + dungeonName.replaceAll("_", " "), "&4&l" + mapName.replaceAll("_", " ")); } else { - MessageUtil.sendScreenMessage(player, "&4&l" + mapName.replaceAll("_", "")); + MessageUtil.sendScreenMessage(player, "&4&l" + mapName.replaceAll("_", " ")); } for (Requirement requirement : gameWorld.getConfig().getRequirements()) { diff --git a/src/io/github/dre2n/dungeonsxl/player/DPlayer.java b/src/io/github/dre2n/dungeonsxl/player/DPlayer.java index e7779329..ecd7bb53 100644 --- a/src/io/github/dre2n/dungeonsxl/player/DPlayer.java +++ b/src/io/github/dre2n/dungeonsxl/player/DPlayer.java @@ -7,12 +7,14 @@ import io.github.dre2n.dungeonsxl.config.WorldConfig; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; import io.github.dre2n.dungeonsxl.dungeon.DLootInventory; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupFinishDungeonEvent; import io.github.dre2n.dungeonsxl.event.dgroup.DGroupFinishFloorEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerFinishEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerKickEvent; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerUpdateEvent; +import io.github.dre2n.dungeonsxl.game.Game; +import io.github.dre2n.dungeonsxl.game.GameType; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.reward.Reward; import io.github.dre2n.dungeonsxl.trigger.DistanceTrigger; import io.github.dre2n.dungeonsxl.util.NumberUtil; @@ -44,7 +46,7 @@ import org.bukkit.potion.PotionEffect; public class DPlayer { static DungeonsXL plugin = DungeonsXL.getPlugin(); - MessageConfig messageConfig = plugin.getMessageConfig(); + static MessageConfig messageConfig = plugin.getMessageConfig(); // Variables private Player player; @@ -588,17 +590,31 @@ public class DPlayer { ready = true; DGroup dGroup = DGroup.getByPlayer(getPlayer()); + + if (dGroup == null) { + return; + } + if ( !dGroup.isPlaying()) { - if (dGroup != null) { - for (Player player : dGroup.getPlayers()) { - DPlayer dPlayer = getByPlayer(player); - if ( !dPlayer.ready) { - return; - } - } - } + dGroup.startGame(new Game(dGroup)); + + } else { + respawn(); + } + } + + public void ready(GameType gameType) { + ready = true; + + DGroup dGroup = DGroup.getByPlayer(getPlayer()); + + if (dGroup == null) { + return; + } + + if ( !dGroup.isPlaying()) { + dGroup.startGame(new Game(dGroup, gameType)); - dGroup.startGame(); } else { respawn(); } @@ -685,6 +701,8 @@ public class DPlayer { return; } + Game game = dGroup.getGameWorld().getGame(); + dGroup.removeUnplayedFloor(dGroup.getMapName()); dGroup.setMapName(newFloor); GameWorld gameWorld = GameWorld.load(newFloor); @@ -697,7 +715,7 @@ public class DPlayer { dPlayer.getWolf().teleport(dPlayer.getCheckpoint()); } } - dGroup.startGame(); + dGroup.startGame(game); } public void finish() { diff --git a/src/io/github/dre2n/dungeonsxl/requirement/RequirementTypes.java b/src/io/github/dre2n/dungeonsxl/requirement/RequirementTypes.java new file mode 100644 index 00000000..c1739420 --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/requirement/RequirementTypes.java @@ -0,0 +1,52 @@ +package io.github.dre2n.dungeonsxl.requirement; + +import java.util.ArrayList; +import java.util.List; + +public class RequirementTypes { + + private List types = new ArrayList(); + + public RequirementTypes() { + for (RequirementType type : RequirementTypeDefault.values()) { + types.add(type); + } + } + + /** + * @return the requirement type which has the identifier + */ + public RequirementType getByIdentifier(String identifier) { + for (RequirementType type : types) { + if (type.getIdentifier().equals(identifier)) { + return type; + } + } + + return null; + } + + /** + * @return the requirement types + */ + public List getRequirements() { + return types; + } + + /** + * @param type + * the requirement type to add + */ + public void addRequirement(RequirementType type) { + types.add(type); + } + + /** + * @param type + * the requirement type to remove + */ + public void removeRequirement(RequirementType type) { + types.remove(type); + } + +} diff --git a/src/io/github/dre2n/dungeonsxl/requirement/Requirements.java b/src/io/github/dre2n/dungeonsxl/requirement/Requirements.java deleted file mode 100644 index 3270a8ba..00000000 --- a/src/io/github/dre2n/dungeonsxl/requirement/Requirements.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.github.dre2n.dungeonsxl.requirement; - -import java.util.ArrayList; -import java.util.List; - -public class Requirements { - - private List requirements = new ArrayList(); - - public Requirements() { - for (RequirementType type : RequirementTypeDefault.values()) { - requirements.add(type); - } - } - - /** - * @return the requirement which has the identifier - */ - public RequirementType getByIdentifier(String identifier) { - for (RequirementType requirement : requirements) { - if (requirement.getIdentifier().equals(identifier)) { - return requirement; - } - } - - return null; - } - - /** - * @return the requirements - */ - public List getRequirements() { - return requirements; - } - - /** - * @param requirement - * the requirement to add - */ - public void addRequirement(RequirementType requirement) { - requirements.add(requirement); - } - - /** - * @param requirement - * the requirement to remove - */ - public void removeRequirement(RequirementType requirement) { - requirements.remove(requirement); - } - -} diff --git a/src/io/github/dre2n/dungeonsxl/reward/RewardTypes.java b/src/io/github/dre2n/dungeonsxl/reward/RewardTypes.java new file mode 100644 index 00000000..e980c550 --- /dev/null +++ b/src/io/github/dre2n/dungeonsxl/reward/RewardTypes.java @@ -0,0 +1,52 @@ +package io.github.dre2n.dungeonsxl.reward; + +import java.util.ArrayList; +import java.util.List; + +public class RewardTypes { + + private List types = new ArrayList(); + + public RewardTypes() { + for (RewardType type : RewardTypeDefault.values()) { + types.add(type); + } + } + + /** + * @return the reward type which has the identifier + */ + public RewardType getByIdentifier(String identifier) { + for (RewardType type : types) { + if (type.getIdentifier().equals(identifier)) { + return type; + } + } + + return null; + } + + /** + * @return the reward types + */ + public List getRewards() { + return types; + } + + /** + * @param type + * the reward type to add + */ + public void addReward(RewardType type) { + types.add(type); + } + + /** + * @param type + * the reward type to remove + */ + public void removeReward(RewardType type) { + types.remove(type); + } + +} diff --git a/src/io/github/dre2n/dungeonsxl/reward/Rewards.java b/src/io/github/dre2n/dungeonsxl/reward/Rewards.java deleted file mode 100644 index cae8cfad..00000000 --- a/src/io/github/dre2n/dungeonsxl/reward/Rewards.java +++ /dev/null @@ -1,52 +0,0 @@ -package io.github.dre2n.dungeonsxl.reward; - -import java.util.ArrayList; -import java.util.List; - -public class Rewards { - - private List rewards = new ArrayList(); - - public Rewards() { - for (RewardType type : RewardTypeDefault.values()) { - rewards.add(type); - } - } - - /** - * @return the reward which has the identifier - */ - public RewardType getByIdentifier(String identifier) { - for (RewardType reward : rewards) { - if (reward.getIdentifier().equals(identifier)) { - return reward; - } - } - - return null; - } - - /** - * @return the rewards - */ - public List getRewards() { - return rewards; - } - - /** - * @param reward - * the reward to add - */ - public void addReward(RewardType reward) { - rewards.add(reward); - } - - /** - * @param reward - * the reward to remove - */ - public void removeReward(RewardType reward) { - rewards.remove(reward); - } - -} diff --git a/src/io/github/dre2n/dungeonsxl/sign/BlockSign.java b/src/io/github/dre2n/dungeonsxl/sign/BlockSign.java index d0d9df8c..2a89be41 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/BlockSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/BlockSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.util.NumberUtil; import org.bukkit.Material; diff --git a/src/io/github/dre2n/dungeonsxl/sign/CheckpointSign.java b/src/io/github/dre2n/dungeonsxl/sign/CheckpointSign.java index c2bdea0f..876fea80 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/CheckpointSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/CheckpointSign.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/ChestSign.java b/src/io/github/dre2n/dungeonsxl/sign/ChestSign.java index 48e58fc5..e2eb6f5c 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/ChestSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/ChestSign.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameChest; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameChest; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.Material; import org.bukkit.block.Sign; diff --git a/src/io/github/dre2n/dungeonsxl/sign/ChunkUpdaterSign.java b/src/io/github/dre2n/dungeonsxl/sign/ChunkUpdaterSign.java index afbf858c..888201d4 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/ChunkUpdaterSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/ChunkUpdaterSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.util.NumberUtil; import org.bukkit.Chunk; diff --git a/src/io/github/dre2n/dungeonsxl/sign/ClassesSign.java b/src/io/github/dre2n/dungeonsxl/sign/ClassesSign.java index a40900bb..a71dbecd 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/ClassesSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/ClassesSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.global.GroupSign; import io.github.dre2n.dungeonsxl.player.DClass; diff --git a/src/io/github/dre2n/dungeonsxl/sign/CommandSign.java b/src/io/github/dre2n/dungeonsxl/sign/CommandSign.java index 7b32b2e7..6cd74b11 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/CommandSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/CommandSign.java @@ -3,7 +3,7 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.commandsxl.command.CCommand; import io.github.dre2n.commandsxl.command.CCommandExecutorTask; import io.github.dre2n.commandsxl.CommandsXL; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/DSign.java b/src/io/github/dre2n/dungeonsxl/sign/DSign.java index 07f070ed..99ab1a48 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/DSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/DSign.java @@ -1,8 +1,8 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.dungeonsxl.DungeonsXL; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dsign.DSignRegistrationEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.trigger.Trigger; import java.lang.reflect.Constructor; diff --git a/src/io/github/dre2n/dungeonsxl/sign/EndSign.java b/src/io/github/dre2n/dungeonsxl/sign/EndSign.java index f5997166..d334af36 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/EndSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/EndSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; diff --git a/src/io/github/dre2n/dungeonsxl/sign/FloorSign.java b/src/io/github/dre2n/dungeonsxl/sign/FloorSign.java index f957ea57..7d8f2702 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/FloorSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/FloorSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; diff --git a/src/io/github/dre2n/dungeonsxl/sign/InteractSign.java b/src/io/github/dre2n/dungeonsxl/sign/InteractSign.java index 1eb7b9a2..7d499c7a 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/InteractSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/InteractSign.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.task.SignUpdateTask; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/LeaveSign.java b/src/io/github/dre2n/dungeonsxl/sign/LeaveSign.java index 09e648fc..2ed70ffb 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/LeaveSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/LeaveSign.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.dplayer.DPlayerEscapeEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; diff --git a/src/io/github/dre2n/dungeonsxl/sign/LobbySign.java b/src/io/github/dre2n/dungeonsxl/sign/LobbySign.java index 6e113e0e..1df3f7d4 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/LobbySign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/LobbySign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.Material; import org.bukkit.block.Sign; diff --git a/src/io/github/dre2n/dungeonsxl/sign/MessageSign.java b/src/io/github/dre2n/dungeonsxl/sign/MessageSign.java index 791d75ba..a02a5e2b 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/MessageSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/MessageSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.util.NumberUtil; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/MobSign.java b/src/io/github/dre2n/dungeonsxl/sign/MobSign.java index 21bf0d2e..e95ccf07 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/MobSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/MobSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.task.MobSpawnTask; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/MythicMobsSign.java b/src/io/github/dre2n/dungeonsxl/sign/MythicMobsSign.java index f4b7578a..ab709268 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/MythicMobsSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/MythicMobsSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.task.MythicMobSpawnTask; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/PlaceSign.java b/src/io/github/dre2n/dungeonsxl/sign/PlaceSign.java index 3d4f147f..ecef4600 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/PlaceSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/PlaceSign.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GamePlaceableBlock; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GamePlaceableBlock; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.Material; import org.bukkit.block.Sign; diff --git a/src/io/github/dre2n/dungeonsxl/sign/ReadySign.java b/src/io/github/dre2n/dungeonsxl/sign/ReadySign.java index 537e3a52..110217af 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/ReadySign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/ReadySign.java @@ -1,7 +1,9 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.dungeonsxl.config.MessageConfig.Messages; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameType; +import io.github.dre2n.dungeonsxl.game.GameTypeDefault; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.util.messageutil.MessageUtil; @@ -15,10 +17,27 @@ public class ReadySign extends DSign { private DSignType type = DSignTypeDefault.READY; + private GameType gameType; + public ReadySign(Sign sign, GameWorld gameWorld) { super(sign, gameWorld); } + /** + * @return the gameType + */ + public GameType getGameType() { + return gameType; + } + + /** + * @param gameType + * the gameType to set + */ + public void setGameType(GameType gameType) { + this.gameType = gameType; + } + @Override public boolean check() { return true; @@ -26,6 +45,13 @@ public class ReadySign extends DSign { @Override public void onInit() { + if (plugin.getGameTypes().getBySign(getSign()) != null) { + gameType = plugin.getGameTypes().getBySign(getSign()); + + } else { + gameType = GameTypeDefault.DEFAULT; + } + if ( !getTriggers().isEmpty()) { getSign().getBlock().setType(Material.AIR); return; @@ -39,7 +65,7 @@ public class ReadySign extends DSign { getSign().setLine(0, ChatColor.DARK_BLUE + "############"); getSign().setLine(1, ChatColor.DARK_GREEN + "Ready"); - getSign().setLine(2, ""); + getSign().setLine(2, ChatColor.DARK_RED + gameType.getSignName()); getSign().setLine(3, ChatColor.DARK_BLUE + "############"); getSign().update(); } @@ -67,7 +93,7 @@ public class ReadySign extends DSign { } if (getGameWorld().getSignClass().isEmpty() || dPlayer.getDClass() != null) { - dPlayer.ready(); + dPlayer.ready(gameType); MessageUtil.sendMessage(dPlayer.getPlayer(), plugin.getMessageConfig().getMessage(Messages.PLAYER_READY)); return; diff --git a/src/io/github/dre2n/dungeonsxl/sign/RedstoneSign.java b/src/io/github/dre2n/dungeonsxl/sign/RedstoneSign.java index 2f775e35..25f043ae 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/RedstoneSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/RedstoneSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.task.DelayedPowerTask; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/sign/SoundMessageSign.java b/src/io/github/dre2n/dungeonsxl/sign/SoundMessageSign.java index 825cf5ca..d4a07aa4 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/SoundMessageSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/SoundMessageSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.util.NumberUtil; import java.util.concurrent.CopyOnWriteArrayList; diff --git a/src/io/github/dre2n/dungeonsxl/sign/StartSign.java b/src/io/github/dre2n/dungeonsxl/sign/StartSign.java index d559ac80..3c43cad5 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/StartSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/StartSign.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.sign; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import org.bukkit.Material; import org.bukkit.block.Sign; diff --git a/src/io/github/dre2n/dungeonsxl/sign/TriggerSign.java b/src/io/github/dre2n/dungeonsxl/sign/TriggerSign.java index d2ed62e5..3c7a2f05 100644 --- a/src/io/github/dre2n/dungeonsxl/sign/TriggerSign.java +++ b/src/io/github/dre2n/dungeonsxl/sign/TriggerSign.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.task.SignUpdateTask; import io.github.dre2n.dungeonsxl.trigger.SignTrigger; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/task/DelayedPowerTask.java b/src/io/github/dre2n/dungeonsxl/task/DelayedPowerTask.java index b2ae0730..0e4aa506 100644 --- a/src/io/github/dre2n/dungeonsxl/task/DelayedPowerTask.java +++ b/src/io/github/dre2n/dungeonsxl/task/DelayedPowerTask.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.task; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.sign.RedstoneSign; import org.bukkit.scheduler.BukkitRunnable; diff --git a/src/io/github/dre2n/dungeonsxl/task/LazyUpdateTask.java b/src/io/github/dre2n/dungeonsxl/task/LazyUpdateTask.java index 2388ad42..9df6d545 100644 --- a/src/io/github/dre2n/dungeonsxl/task/LazyUpdateTask.java +++ b/src/io/github/dre2n/dungeonsxl/task/LazyUpdateTask.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.task; import io.github.dre2n.dungeonsxl.DungeonsXL; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import org.bukkit.scheduler.BukkitRunnable; diff --git a/src/io/github/dre2n/dungeonsxl/task/MobSpawnTask.java b/src/io/github/dre2n/dungeonsxl/task/MobSpawnTask.java index e9616b99..e640c877 100644 --- a/src/io/github/dre2n/dungeonsxl/task/MobSpawnTask.java +++ b/src/io/github/dre2n/dungeonsxl/task/MobSpawnTask.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.task; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.mob.DMob; import io.github.dre2n.dungeonsxl.mob.DMobType; import io.github.dre2n.dungeonsxl.sign.MobSign; diff --git a/src/io/github/dre2n/dungeonsxl/task/MythicMobSpawnTask.java b/src/io/github/dre2n/dungeonsxl/task/MythicMobSpawnTask.java index 910be36a..55a6de95 100644 --- a/src/io/github/dre2n/dungeonsxl/task/MythicMobSpawnTask.java +++ b/src/io/github/dre2n/dungeonsxl/task/MythicMobSpawnTask.java @@ -1,6 +1,6 @@ package io.github.dre2n.dungeonsxl.task; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.mob.DMob; import io.github.dre2n.dungeonsxl.sign.MythicMobsSign; diff --git a/src/io/github/dre2n/dungeonsxl/task/RedstoneEventTask.java b/src/io/github/dre2n/dungeonsxl/task/RedstoneEventTask.java index 257c2051..b37c503f 100644 --- a/src/io/github/dre2n/dungeonsxl/task/RedstoneEventTask.java +++ b/src/io/github/dre2n/dungeonsxl/task/RedstoneEventTask.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.task; import io.github.dre2n.dungeonsxl.DungeonsXL; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger; import org.bukkit.block.Block; diff --git a/src/io/github/dre2n/dungeonsxl/task/WorldUnloadTask.java b/src/io/github/dre2n/dungeonsxl/task/WorldUnloadTask.java index a6687bcd..2219183d 100644 --- a/src/io/github/dre2n/dungeonsxl/task/WorldUnloadTask.java +++ b/src/io/github/dre2n/dungeonsxl/task/WorldUnloadTask.java @@ -2,7 +2,7 @@ package io.github.dre2n.dungeonsxl.task; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.dungeon.EditWorld; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.player.DPlayer; import org.bukkit.scheduler.BukkitRunnable; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java b/src/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java index d1e5c51d..98d4edc2 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/DistanceTrigger.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.trigger; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java b/src/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java index 3db6bdcf..535980da 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/InteractTrigger.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.trigger; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java b/src/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java index 8b17d54c..0b33d52a 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/MobTrigger.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.trigger; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java b/src/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java index e910dd83..7e70e06c 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/RedstoneTrigger.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.trigger; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java b/src/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java index 68ed6aee..dde90297 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/SignTrigger.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.trigger; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/Trigger.java b/src/io/github/dre2n/dungeonsxl/trigger/Trigger.java index 5036cfcb..222c2e41 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/Trigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/Trigger.java @@ -1,8 +1,8 @@ package io.github.dre2n.dungeonsxl.trigger; import io.github.dre2n.dungeonsxl.DungeonsXL; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerRegistrationEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.util.NumberUtil; diff --git a/src/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java b/src/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java index 17c72d8f..c4bc1a21 100644 --- a/src/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java +++ b/src/io/github/dre2n/dungeonsxl/trigger/UseItemTrigger.java @@ -1,7 +1,7 @@ package io.github.dre2n.dungeonsxl.trigger; -import io.github.dre2n.dungeonsxl.dungeon.game.GameWorld; import io.github.dre2n.dungeonsxl.event.trigger.TriggerActionEvent; +import io.github.dre2n.dungeonsxl.game.GameWorld; import java.util.ArrayList; import java.util.HashMap; diff --git a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R1.java b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R1.java index eb8ab911..afc41427 100644 --- a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R1.java +++ b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R1.java @@ -16,8 +16,8 @@ class v1_8_R1 { subtitle = ChatColor.translateAlternateColorCodes('&', subtitle); title = ChatColor.translateAlternateColorCodes('&', title); - IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}"); - IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}"); + IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}"); + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + title + "\"}"); PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent); PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent); diff --git a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R2.java b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R2.java index 9691a933..7632d449 100644 --- a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R2.java +++ b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R2.java @@ -16,8 +16,8 @@ class v1_8_R2 { subtitle = ChatColor.translateAlternateColorCodes('&', subtitle); title = ChatColor.translateAlternateColorCodes('&', title); - IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}"); - IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}"); + IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}"); + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + title + "\"}"); PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent); PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent); diff --git a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R3.java b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R3.java index 85a88de4..7630cb39 100644 --- a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R3.java +++ b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_8_R3.java @@ -16,8 +16,8 @@ class v1_8_R3 { subtitle = ChatColor.translateAlternateColorCodes('&', subtitle); title = ChatColor.translateAlternateColorCodes('&', title); - IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}"); - IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}"); + IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}"); + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + title + "\"}"); PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent); PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent); diff --git a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_9_R1.java b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_9_R1.java index 4be15f0c..d7fcef11 100644 --- a/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_9_R1.java +++ b/src/io/github/dre2n/dungeonsxl/util/messageutil/v1_9_R1.java @@ -16,8 +16,8 @@ class v1_9_R1 { subtitle = ChatColor.translateAlternateColorCodes('&', subtitle); title = ChatColor.translateAlternateColorCodes('&', title); - IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', subtitle) + "\"}"); - IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', title) + "\"}"); + IChatBaseComponent subtitleComponent = ChatSerializer.a("{\"text\": \"" + subtitle + "\"}"); + IChatBaseComponent titleComponent = ChatSerializer.a("{\"text\": \"" + title + "\"}"); PacketPlayOutTitle clearPacket = new PacketPlayOutTitle(EnumTitleAction.CLEAR, titleComponent); PacketPlayOutTitle resetPacket = new PacketPlayOutTitle(EnumTitleAction.RESET, titleComponent);