This commit is contained in:
Luca 2021-11-24 16:59:55 +01:00
parent 14253308c5
commit e27dc75b18
5 changed files with 8 additions and 54 deletions

View File

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

View File

@ -3,19 +3,16 @@ package rip.tilly.bedwars.game;
import io.netty.util.internal.ConcurrentSet; import io.netty.util.internal.ConcurrentSet;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
import net.minecraft.server.v1_8_R3.WorldServer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import org.github.paperspigot.Title; import org.github.paperspigot.Title;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.customvillager.CustomVillager;
import rip.tilly.bedwars.game.arena.Arena; import rip.tilly.bedwars.game.arena.Arena;
import rip.tilly.bedwars.game.arena.CopiedArena; import rip.tilly.bedwars.game.arena.CopiedArena;
import rip.tilly.bedwars.generators.Generator; import rip.tilly.bedwars.generators.Generator;

View File

@ -5,7 +5,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.github.paperspigot.Title; import org.github.paperspigot.Title;
import rip.tilly.bedwars.BedWars; import rip.tilly.bedwars.BedWars;
import rip.tilly.bedwars.customvillager.CustomVillager;
import rip.tilly.bedwars.events.GameEndEvent; import rip.tilly.bedwars.events.GameEndEvent;
import rip.tilly.bedwars.game.Game; import rip.tilly.bedwars.game.Game;
import rip.tilly.bedwars.game.GameState; import rip.tilly.bedwars.game.GameState;

View File

@ -12,6 +12,7 @@ import rip.tilly.bedwars.generators.Generator;
import rip.tilly.bedwars.generators.GeneratorType; import rip.tilly.bedwars.generators.GeneratorType;
import rip.tilly.bedwars.playerdata.PlayerData; import rip.tilly.bedwars.playerdata.PlayerData;
import rip.tilly.bedwars.playerdata.PlayerState; import rip.tilly.bedwars.playerdata.PlayerState;
import rip.tilly.bedwars.playerdata.currentgame.PlayerCurrentGameData;
import rip.tilly.bedwars.runnables.GameRunnable; import rip.tilly.bedwars.runnables.GameRunnable;
import rip.tilly.bedwars.utils.CC; import rip.tilly.bedwars.utils.CC;
import rip.tilly.bedwars.utils.CustomLocation; import rip.tilly.bedwars.utils.CustomLocation;
@ -79,6 +80,9 @@ public class GameStartListener implements Listener {
playerData.setTeamId(team.getId()); playerData.setTeamId(team.getId());
playerData.setPlayerTeam(team.getPlayerTeam()); playerData.setPlayerTeam(team.getPlayerTeam());
PlayerCurrentGameData playerCurrentGameData = playerData.getCurrentGameData();
playerCurrentGameData.setTeamId(team.getId());
playerData.setPlayerState(PlayerState.PLAYING); playerData.setPlayerState(PlayerState.PLAYING);
CustomLocation locationA = game.getCopiedArena().getA(); CustomLocation locationA = game.getCopiedArena().getA();

View File

@ -34,6 +34,8 @@ public class PlayerCurrentGameData {
private int axeLevel = 0; private int axeLevel = 0;
private boolean shears = false; private boolean shears = false;
private int teamId;
private ArmorType armorType = ArmorType.LEATHER; private ArmorType armorType = ArmorType.LEATHER;
private Map<UUID, ArmorType> armor = new HashMap<UUID, ArmorType>(); private Map<UUID, ArmorType> armor = new HashMap<UUID, ArmorType>();
@ -53,14 +55,12 @@ public class PlayerCurrentGameData {
int level = this.upgrades.get(upgrade); int level = this.upgrades.get(upgrade);
PlayerData playerData = this.main.getPlayerDataManager().getPlayerData(player.getUniqueId()); GameTeam gameTeam = game.getTeams().get(this.teamId);
GameTeam gameTeam = game.getTeams().get(playerData.getTeamId());
game.getTeams().stream().filter(team -> team == gameTeam).forEach(team -> team.playingPlayers().forEach(teamMember -> { 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))); teamMember.sendMessage(CC.translate("&6" + player.getName() + " upgraded " + upgrade.getFormattedName() + " to &cTier " + upgrade.getNumberToRomanNumeral(level)));
// System.out.println("11111111111111111111111 - " + player.getName()); // System.out.println("11111111111111111111111 - " + player.getName());
playerData.getCurrentGameData().giveTeamArmor(player, this); this.giveTeamArmor(player, this);
int upgradeLevel = 0; int upgradeLevel = 0;