This commit is contained in:
Luca 2021-11-23 14:21:51 +01:00
parent 937dc73782
commit 6bff218f16
10 changed files with 82 additions and 69 deletions

View File

@ -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);

View File

@ -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());

View File

@ -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());
}
}

View File

@ -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;

View File

@ -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;
}

View File

@ -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<Integer, Button> getButtons(Player player) {
// Map<Integer, Button> 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<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = new HashMap<>();
return buttons;
}
}

View File

@ -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;

View File

@ -0,0 +1,10 @@
package rip.tilly.bedwars.playerdata.currentgame;
public enum ArmorType {
LEATHER,
CHAIN,
IRON,
DIAMOND
}

View File

@ -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;
}

View File

@ -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);