diff --git a/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java b/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java index bd2b1cfd..adcc1f34 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/listener/PlayerListener.java @@ -24,7 +24,6 @@ import io.github.dre2n.dungeonsxl.config.WorldConfig; 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.global.DPortal; import io.github.dre2n.dungeonsxl.global.GameSign; import io.github.dre2n.dungeonsxl.global.GlobalProtection; @@ -37,6 +36,7 @@ import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.player.DPlayers; import io.github.dre2n.dungeonsxl.player.DSavePlayer; import io.github.dre2n.dungeonsxl.reward.DLootInventory; +import io.github.dre2n.dungeonsxl.reward.RewardChest; import io.github.dre2n.dungeonsxl.task.RespawnTask; import io.github.dre2n.dungeonsxl.trigger.InteractTrigger; import io.github.dre2n.dungeonsxl.trigger.UseItemTrigger; @@ -613,7 +613,7 @@ public class PlayerListener implements Listener { return; } - GameChest.onOpenInventory(event); + RewardChest.onOpenInventory(event); if (!plugin.getMainConfig().getOpenInventories() && !DPermissions.hasPermission(event.getPlayer(), DPermissions.INSECURE)) { World world = event.getPlayer().getWorld(); diff --git a/src/main/java/io/github/dre2n/dungeonsxl/game/GameChest.java b/src/main/java/io/github/dre2n/dungeonsxl/reward/RewardChest.java similarity index 89% rename from src/main/java/io/github/dre2n/dungeonsxl/game/GameChest.java rename to src/main/java/io/github/dre2n/dungeonsxl/reward/RewardChest.java index 1c4ad832..29053821 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/game/GameChest.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/reward/RewardChest.java @@ -14,17 +14,13 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package io.github.dre2n.dungeonsxl.game; +package io.github.dre2n.dungeonsxl.reward; import io.github.dre2n.commons.util.messageutil.MessageUtil; import io.github.dre2n.dungeonsxl.DungeonsXL; import io.github.dre2n.dungeonsxl.config.DMessages; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPlayer; -import io.github.dre2n.dungeonsxl.reward.LevelReward; -import io.github.dre2n.dungeonsxl.reward.MoneyReward; -import io.github.dre2n.dungeonsxl.reward.Reward; -import io.github.dre2n.dungeonsxl.reward.RewardTypeDefault; import io.github.dre2n.dungeonsxl.world.GameWorld; import net.milkbowl.vault.item.ItemInfo; import net.milkbowl.vault.item.Items; @@ -40,7 +36,7 @@ import org.bukkit.inventory.ItemStack; /** * @author Frank Baumann, Daniel Saukel */ -public class GameChest { +public class RewardChest { protected static DungeonsXL plugin = DungeonsXL.getInstance(); @@ -51,7 +47,7 @@ public class GameChest { private double moneyReward; private int levelReward; - public GameChest(Block chest, GameWorld gameWorld, double moneyReward, int levelReward) { + public RewardChest(Block chest, GameWorld gameWorld, double moneyReward, int levelReward) { if (!(chest.getState() instanceof Chest)) { return; } @@ -61,11 +57,11 @@ public class GameChest { this.moneyReward = moneyReward; this.levelReward = levelReward; - gameWorld.getGameChests().add(this); + gameWorld.getRewardChests().add(this); } /** - * @return if the GameChest is used + * @return if the RewardChest is used */ public boolean isUsed() { return used; @@ -243,20 +239,20 @@ public class GameChest { Chest chest = (Chest) inventory.getTopInventory().getHolder(); - for (GameChest gameChest : gameWorld.getGameChests()) { - if (!gameChest.chest.equals(chest)) { + for (RewardChest rewardChest : gameWorld.getRewardChests()) { + if (!rewardChest.chest.equals(chest)) { continue; } - if (gameChest.used) { + if (rewardChest.used) { MessageUtil.sendMessage(plugin.getServer().getPlayer(event.getPlayer().getUniqueId()), plugin.getMessageConfig().getMessage(DMessages.ERROR_CHEST_IS_OPENED)); event.setCancelled(true); continue; } - if (gameChest.chest.getLocation().distance(chest.getLocation()) < 1) { - gameChest.addTreasure(DGroup.getByPlayer((Player) event.getPlayer())); - gameChest.used = true; + if (rewardChest.chest.getLocation().distance(chest.getLocation()) < 1) { + rewardChest.addTreasure(DGroup.getByPlayer((Player) event.getPlayer())); + rewardChest.used = true; event.setCancelled(true); } } diff --git a/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java b/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java index da9e685f..17d6f5c2 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/sign/ChestSign.java @@ -17,7 +17,7 @@ package io.github.dre2n.dungeonsxl.sign; import io.github.dre2n.commons.util.NumberUtil; -import io.github.dre2n.dungeonsxl.game.GameChest; +import io.github.dre2n.dungeonsxl.reward.RewardChest; import io.github.dre2n.dungeonsxl.world.GameWorld; import org.bukkit.Material; import org.bukkit.block.Sign; @@ -57,15 +57,15 @@ public class ChestSign extends DSign { for (int i = -1; i <= 1; i++) { if (getSign().getBlock().getRelative(i, 0, 0).getType() == Material.CHEST) { - new GameChest(getSign().getBlock().getRelative(i, 0, 0), getGameWorld(), moneyReward, levelReward); + new RewardChest(getSign().getBlock().getRelative(i, 0, 0), getGameWorld(), moneyReward, levelReward); } if (getSign().getBlock().getRelative(0, 0, i).getType() == Material.CHEST) { - new GameChest(getSign().getBlock().getRelative(0, 0, i), getGameWorld(), moneyReward, levelReward); + new RewardChest(getSign().getBlock().getRelative(0, 0, i), getGameWorld(), moneyReward, levelReward); } if (getSign().getBlock().getRelative(0, i, 0).getType() == Material.CHEST) { - new GameChest(getSign().getBlock().getRelative(0, i, 0), getGameWorld(), moneyReward, levelReward); + new RewardChest(getSign().getBlock().getRelative(0, i, 0), getGameWorld(), moneyReward, levelReward); } } diff --git a/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java b/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java index d2cb9531..388016dd 100644 --- a/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java +++ b/src/main/java/io/github/dre2n/dungeonsxl/world/GameWorld.java @@ -27,13 +27,13 @@ import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldStartGameEvent; import io.github.dre2n.dungeonsxl.event.gameworld.GameWorldUnloadEvent; import io.github.dre2n.dungeonsxl.event.requirement.RequirementCheckEvent; import io.github.dre2n.dungeonsxl.game.Game; -import io.github.dre2n.dungeonsxl.game.GameChest; import io.github.dre2n.dungeonsxl.game.GamePlaceableBlock; import io.github.dre2n.dungeonsxl.mob.DMob; import io.github.dre2n.dungeonsxl.player.DGroup; import io.github.dre2n.dungeonsxl.player.DPermissions; import io.github.dre2n.dungeonsxl.player.DPlayer; import io.github.dre2n.dungeonsxl.requirement.Requirement; +import io.github.dre2n.dungeonsxl.reward.RewardChest; import io.github.dre2n.dungeonsxl.sign.DSign; import io.github.dre2n.dungeonsxl.sign.MobSign; import io.github.dre2n.dungeonsxl.trigger.RedstoneTrigger; @@ -82,7 +82,7 @@ public class GameWorld { private CopyOnWriteArrayList signClass = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList dMobs = new CopyOnWriteArrayList<>(); // TODO: Killed mobs - private CopyOnWriteArrayList gameChests = new CopyOnWriteArrayList<>(); + private CopyOnWriteArrayList rewardChests = new CopyOnWriteArrayList<>(); private CopyOnWriteArrayList dSigns = new CopyOnWriteArrayList<>(); private WorldConfig worldConfig; @@ -310,18 +310,18 @@ public class GameWorld { } /** - * @return the gameChests + * @return the rewardChests */ - public CopyOnWriteArrayList getGameChests() { - return gameChests; + public CopyOnWriteArrayList getRewardChests() { + return rewardChests; } /** - * @param gameChests - * the gameChests to set + * @param rewardChests + * the rewardChests to set */ - public void setGameChests(CopyOnWriteArrayList gameChests) { - this.gameChests = gameChests; + public void setRewardChests(CopyOnWriteArrayList rewardChests) { + this.rewardChests = rewardChests; } /**