diff --git a/src/main/java/rip/tilly/bedwars/generators/Generator.java b/src/main/java/rip/tilly/bedwars/generators/Generator.java index 5c7c755..f501783 100644 --- a/src/main/java/rip/tilly/bedwars/generators/Generator.java +++ b/src/main/java/rip/tilly/bedwars/generators/Generator.java @@ -12,11 +12,11 @@ import rip.tilly.bedwars.utils.CC; public class Generator { - private BedWars main = BedWars.getInstance(); + private final BedWars main = BedWars.getInstance(); - private Location location; - private GeneratorType generatorType; - private boolean isIslandGenerator; + private final Location location; + private final GeneratorType generatorType; + private final boolean isIslandGenerator; private GeneratorTier generatorTier; private ArmorStand indictatorArmorStand = null; private ArmorStand generatorTypeArmorStand = null; @@ -24,7 +24,7 @@ public class Generator { private BukkitTask rotateIndicatorTask = null; private int secondsSinceActivation; private boolean activated; - + private final Game game; public Generator(Location location, GeneratorType generatorType, boolean isIslandGenerator, Game game) { @@ -127,12 +127,13 @@ public class Generator { return; } - Material generatorTypeMaterial = Material.STONE; - + Material generatorTypeMaterial; if (this.generatorType == GeneratorType.DIAMOND) { generatorTypeMaterial = Material.DIAMOND_BLOCK; } else if (this.generatorType == GeneratorType.EMERALD) { generatorTypeMaterial = Material.EMERALD_BLOCK; + } else { + generatorTypeMaterial = Material.STONE; } this.indictatorArmorStand = this.location.getWorld().spawn(this.location.clone().add(0.0D, 0.5D, 0.0D), ArmorStand.class); diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java index 1aa37b0..ec78a67 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java @@ -7,7 +7,6 @@ import org.bukkit.inventory.ItemStack; import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.events.GameStartEvent; import rip.tilly.bedwars.game.Game; -import rip.tilly.bedwars.game.GameType; import rip.tilly.bedwars.game.arena.CopiedArena; import rip.tilly.bedwars.generators.Generator; import rip.tilly.bedwars.generators.GeneratorType; @@ -23,12 +22,11 @@ import java.util.Set; public class GameStartListener implements Listener { - private BedWars plugin = BedWars.getInstance(); + private final BedWars plugin = BedWars.getInstance(); @EventHandler public void onGameStart(GameStartEvent event) { Game game = event.getGame(); - GameType gameType = game.getGameType(); if (game.getArena().getAvailableArenas().size() > 0) { game.setCopiedArena(game.getArena().getAvailableArena()); diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java index 98bd0f1..ab71dc4 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/WorldListener.java @@ -20,8 +20,6 @@ import rip.tilly.bedwars.game.GameTeam; import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; -import java.util.Objects; - public class WorldListener implements Listener { private final BedWars plugin = BedWars.getInstance(); @@ -72,6 +70,7 @@ public class WorldListener implements Listener { event.setCancelled(true); return; } + event.setCancelled(true); block.setType(Material.AIR); @@ -215,10 +214,12 @@ public class WorldListener implements Listener { return; } - if (game.getDroppedItems().contains(event.getItem().getItemStack())) { - game.getDroppedItems().remove(event.getItem().getItemStack()); - game.removeEntityToRemove(event.getItem()); + if (!game.getDroppedItems().contains(event.getItem().getItemStack())) { + event.setCancelled(true); return; } + + game.getDroppedItems().remove(event.getItem().getItemStack()); + game.removeEntityToRemove(event.getItem()); } } diff --git a/src/main/java/rip/tilly/bedwars/managers/GameManager.java b/src/main/java/rip/tilly/bedwars/managers/GameManager.java index 5ced080..dbc0a4e 100644 --- a/src/main/java/rip/tilly/bedwars/managers/GameManager.java +++ b/src/main/java/rip/tilly/bedwars/managers/GameManager.java @@ -14,7 +14,7 @@ import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.events.GameEndEvent; import rip.tilly.bedwars.events.GameStartEvent; import rip.tilly.bedwars.managers.hotbar.impl.HotbarItem; -import rip.tilly.bedwars.playerdata.PlayerCurrentGameData; +import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; import rip.tilly.bedwars.utils.ItemBuilder; diff --git a/src/main/java/rip/tilly/bedwars/menus/shop/ShopType.java b/src/main/java/rip/tilly/bedwars/menus/shop/ShopType.java index cf96628..e73db4c 100644 --- a/src/main/java/rip/tilly/bedwars/menus/shop/ShopType.java +++ b/src/main/java/rip/tilly/bedwars/menus/shop/ShopType.java @@ -1,20 +1,21 @@ -//package rip.tilly.bedwars.menus.shop; -// -//import lombok.RequiredArgsConstructor; -//import org.bukkit.Material; -// -//@RequiredArgsConstructor -//public enum ShopType { -// -// QUICK("Quick Buy"), -// BLOCKS("Blocks"), -// ARMOR("Armor"), -// TOOLS("Tools"), -// WEAPONS("Weapons"), -// RANGED("Ranged"), -// POTIONS("Potions"), -// UTILITY("Utility"); -// -// private final String name; -// private final Material material; -//} +package rip.tilly.bedwars.menus.shop; + +import lombok.RequiredArgsConstructor; +import org.bukkit.Material; + +@RequiredArgsConstructor +public enum ShopType { + + QUICK("Quick Buy", Material.NETHER_STAR, 0), + BLOCKS("Blocks", Material.STAINED_CLAY, 0), + ARMOR("Armor"), + TOOLS("Tools"), + WEAPONS("Weapons"), + RANGED("Ranged"), + POTIONS("Potions"), + UTILITY("Utility"); + + private final String name; + private final Material material; + private final int data; +} diff --git a/src/main/java/rip/tilly/bedwars/menus/shop/blocks/BlocksMenu.java b/src/main/java/rip/tilly/bedwars/menus/shop/blocks/BlocksMenu.java index 2113445..94a782b 100644 --- a/src/main/java/rip/tilly/bedwars/menus/shop/blocks/BlocksMenu.java +++ b/src/main/java/rip/tilly/bedwars/menus/shop/blocks/BlocksMenu.java @@ -1,29 +1,29 @@ -//package rip.tilly.bedwars.menus.shop.blocks; -// -//import org.bukkit.entity.Player; -//import rip.tilly.bedwars.utils.CC; -//import rip.tilly.bedwars.utils.menu.Button; -//import rip.tilly.bedwars.utils.menu.Menu; -// -//import java.util.HashMap; -//import java.util.Map; -// -//public class BlocksMenu extends Menu { -// -// @Override -// public boolean isUpdateAfterClick() { -// return true; -// } -// -// @Override -// public String getTitle(Player player) { -// return CC.translate("&eBlocks"); -// } -// -// @Override -// public Map getButtons(Player player) { -// Map buttons = new HashMap<>(); -// -// -// } -//} +package rip.tilly.bedwars.menus.shop.blocks; + +import org.bukkit.entity.Player; +import rip.tilly.bedwars.utils.CC; +import rip.tilly.bedwars.utils.menu.Button; +import rip.tilly.bedwars.utils.menu.Menu; + +import java.util.HashMap; +import java.util.Map; + +public class BlocksMenu extends Menu { + + @Override + public boolean isUpdateAfterClick() { + return true; + } + + @Override + public String getTitle(Player player) { + return CC.translate("&eBlocks"); + } + + @Override + public Map getButtons(Player player) { + Map buttons = new HashMap<>(); + + return buttons; + } +} diff --git a/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java b/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java index 76cf2a2..e8b6ebd 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/PlayerData.java @@ -5,6 +5,7 @@ import lombok.Setter; import org.bukkit.entity.Player; import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.managers.PlayerDataManager; +import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.utils.CC; import java.util.UUID; diff --git a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java new file mode 100644 index 0000000..c0d548a --- /dev/null +++ b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/ArmorType.java @@ -0,0 +1,10 @@ +package rip.tilly.bedwars.playerdata.currentgame; + +public enum ArmorType { + + LEATHER, + CHAIN, + IRON, + DIAMOND + +} diff --git a/src/main/java/rip/tilly/bedwars/playerdata/PlayerCurrentGameData.java b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java similarity index 68% rename from src/main/java/rip/tilly/bedwars/playerdata/PlayerCurrentGameData.java rename to src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java index 67cedfb..084e132 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/PlayerCurrentGameData.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java @@ -1,4 +1,4 @@ -package rip.tilly.bedwars.playerdata; +package rip.tilly.bedwars.playerdata.currentgame; import lombok.Data; @@ -11,4 +11,6 @@ public class PlayerCurrentGameData { private int pickaxeLevel = 0; private int axeLevel = 0; private boolean shears = false; + + private ArmorType armorType = ArmorType.LEATHER; } diff --git a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java index 95954b2..a329b22 100644 --- a/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java +++ b/src/main/java/rip/tilly/bedwars/providers/scoreboard/ScoreboardProvider.java @@ -156,9 +156,8 @@ public class ScoreboardProvider implements BoardAdapter { lines.add(CC.scoreboardBar); - if (this.plugin.getPartyManager().getParty(playerData.getUniqueId()) != null) { - Party party = this.plugin.getPartyManager().getParty(playerData.getUniqueId()); - + Party party = this.plugin.getPartyManager().getParty(playerData.getUniqueId()); + if (party != null) { lines.add("&9Party Leader: &d" + Bukkit.getPlayer(party.getLeader()).getName()); lines.add("&9Party Members: &d" + party.getMembers().size() + "&7/&d" + party.getLimit()); lines.add(CC.scoreboardBar);