From e27dc75b187f2cb4b2393e4a413328af92786ab0 Mon Sep 17 00:00:00 2001 From: Luca Date: Wed, 24 Nov 2021 16:59:55 +0100 Subject: [PATCH] gggggggg --- .../customvillager/CustomVillager.java | 46 ------------------- .../java/rip/tilly/bedwars/game/Game.java | 3 -- .../listeners/game/GameEndListener.java | 1 - .../listeners/game/GameStartListener.java | 4 ++ .../currentgame/PlayerCurrentGameData.java | 8 ++-- 5 files changed, 8 insertions(+), 54 deletions(-) delete mode 100644 src/main/java/rip/tilly/bedwars/customvillager/CustomVillager.java diff --git a/src/main/java/rip/tilly/bedwars/customvillager/CustomVillager.java b/src/main/java/rip/tilly/bedwars/customvillager/CustomVillager.java deleted file mode 100644 index b73f5f1..0000000 --- a/src/main/java/rip/tilly/bedwars/customvillager/CustomVillager.java +++ /dev/null @@ -1,46 +0,0 @@ -package rip.tilly.bedwars.customvillager; - -import net.minecraft.server.v1_8_R3.DamageSource; -import net.minecraft.server.v1_8_R3.EntityVillager; -import net.minecraft.server.v1_8_R3.NBTTagCompound; -import net.minecraft.server.v1_8_R3.World; -import org.bukkit.craftbukkit.v1_8_R3.entity.CraftVillager; -import org.bukkit.event.entity.CreatureSpawnEvent; -import rip.tilly.bedwars.utils.CC; - -public class CustomVillager extends EntityVillager { - - public CustomVillager(World world, String name) { - super(world); - - this.setCustomName(CC.translate(name)); - this.setCustomNameVisible(true); - this.noMove(); - - this.setInvisible(false); - ((CraftVillager) this.getBukkitEntity()).getHandle().setInvisible(false); - - this.world.addEntity(this, CreatureSpawnEvent.SpawnReason.CUSTOM); - } - - public void noMove() { - NBTTagCompound tag = this.getNBTTag(); - if(tag == null) { - tag = new NBTTagCompound(); - } - - this.c(tag); - tag.setInt("NoAI", 1); - this.f(tag); - } - - @Override - public void makeSound(String s, float f, float f1) { - return; - } - - @Override - public boolean damageEntity(DamageSource source, float f) { - return false; - } -} diff --git a/src/main/java/rip/tilly/bedwars/game/Game.java b/src/main/java/rip/tilly/bedwars/game/Game.java index dc5863b..2426911 100644 --- a/src/main/java/rip/tilly/bedwars/game/Game.java +++ b/src/main/java/rip/tilly/bedwars/game/Game.java @@ -3,19 +3,16 @@ package rip.tilly.bedwars.game; import io.netty.util.internal.ConcurrentSet; import lombok.Getter; import lombok.Setter; -import net.minecraft.server.v1_8_R3.WorldServer; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.entity.Villager; import org.bukkit.inventory.ItemStack; import org.github.paperspigot.Title; import rip.tilly.bedwars.BedWars; -import rip.tilly.bedwars.customvillager.CustomVillager; import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.game.arena.CopiedArena; import rip.tilly.bedwars.generators.Generator; diff --git a/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java b/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java index 8882488..2fd6311 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/GameEndListener.java @@ -5,7 +5,6 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.github.paperspigot.Title; import rip.tilly.bedwars.BedWars; -import rip.tilly.bedwars.customvillager.CustomVillager; import rip.tilly.bedwars.events.GameEndEvent; import rip.tilly.bedwars.game.Game; import rip.tilly.bedwars.game.GameState; 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 205cf6a..52c286f 100644 --- a/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java +++ b/src/main/java/rip/tilly/bedwars/listeners/game/GameStartListener.java @@ -12,6 +12,7 @@ import rip.tilly.bedwars.generators.Generator; import rip.tilly.bedwars.generators.GeneratorType; import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerState; +import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData; import rip.tilly.bedwars.runnables.GameRunnable; import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CustomLocation; @@ -79,6 +80,9 @@ public class GameStartListener implements Listener { playerData.setTeamId(team.getId()); playerData.setPlayerTeam(team.getPlayerTeam()); + PlayerCurrentGameData playerCurrentGameData = playerData.getCurrentGameData(); + playerCurrentGameData.setTeamId(team.getId()); + playerData.setPlayerState(PlayerState.PLAYING); CustomLocation locationA = game.getCopiedArena().getA(); diff --git a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java index 5a6eddd..47b5323 100644 --- a/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java +++ b/src/main/java/rip/tilly/bedwars/playerdata/currentgame/PlayerCurrentGameData.java @@ -34,6 +34,8 @@ public class PlayerCurrentGameData { private int axeLevel = 0; private boolean shears = false; + private int teamId; + private ArmorType armorType = ArmorType.LEATHER; private Map armor = new HashMap(); @@ -53,14 +55,12 @@ public class PlayerCurrentGameData { int level = this.upgrades.get(upgrade); - PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); - - GameTeam gameTeam = game.getTeams().get(playerData.getTeamId()); + GameTeam gameTeam = game.getTeams().get(this.teamId); game.getTeams().stream().filter(team -> team == gameTeam).forEach(team -> team.playingPlayers().forEach(teamMember -> { teamMember.sendMessage(CC.translate("&6" + player.getName() + " upgraded " + upgrade.getFormattedName() + " to &cTier " + upgrade.getNumberToRomanNumeral(level))); // System.out.println("11111111111111111111111 - " + player.getName()); - playerData.getCurrentGameData().giveTeamArmor(player, this); + this.giveTeamArmor(player, this); int upgradeLevel = 0;