diff options
Diffstat (limited to 'src/main/java/dev/mayaqq/ygasi/events')
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java | 2 | ||||
-rw-r--r-- | src/main/java/dev/mayaqq/ygasi/events/TickEvent.java (renamed from src/main/java/dev/mayaqq/ygasi/events/ClickEvent.java) | 9 |
2 files changed, 7 insertions, 4 deletions
diff --git a/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java b/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java index 6723d01..19649cc 100644 --- a/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java +++ b/src/main/java/dev/mayaqq/ygasi/events/PlayerConnectEvent.java @@ -8,6 +8,7 @@ import net.minecraft.item.ItemStack; import java.util.UUID; import static dev.mayaqq.ygasi.abilities.mercenary.Offence2.playerSwords; +import static dev.mayaqq.ygasi.events.TickEvent.swords; import static dev.mayaqq.ygasi.registry.ItemRegistry.SKILL_BOOK; public class PlayerConnectEvent { @@ -28,6 +29,7 @@ public class PlayerConnectEvent { sword.remove(Entity.RemovalReason.DISCARDED); }); playerSwords.remove(handler.player.getUuidAsString()); + swords.remove(handler.player.getUuidAsString()); } }); } diff --git a/src/main/java/dev/mayaqq/ygasi/events/ClickEvent.java b/src/main/java/dev/mayaqq/ygasi/events/TickEvent.java index c735fa4..ae6fc76 100644 --- a/src/main/java/dev/mayaqq/ygasi/events/ClickEvent.java +++ b/src/main/java/dev/mayaqq/ygasi/events/TickEvent.java @@ -15,8 +15,9 @@ import java.util.UUID; import static dev.mayaqq.ygasi.Ygasi.LOGGER; import static dev.mayaqq.ygasi.abilities.mercenary.Offence2.playerSwords; +import static dev.mayaqq.ygasi.abilities.mercenary.Offence2.playerSwordsBlacklist; -public class ClickEvent { +public class TickEvent { public static Map<String, Integer> playerCharge = new HashMap<>(); public static Map<String, Integer> swords = new HashMap<>(); private static Integer tick = 0; @@ -24,9 +25,9 @@ public class ClickEvent { ServerTickEvents.END_SERVER_TICK.register(server -> { tick++; server.getPlayerManager().getPlayerList().forEach(player -> { - if (playerSwords.get(player.getUuidAsString()) != null && player.getWorld().getEntity(UUID.fromString(playerSwords.get(player.getUuidAsString()).get(0))) != null) { + if (playerSwords.get(player.getUuidAsString()) != null && playerSwordsBlacklist.get(player.getUuidAsString()) == null) { playerSwords.get(player.getUuidAsString()).forEach(uuid -> { - player.getWorld().getEntity(UUID.fromString(uuid)).setPos(player.getX(), player.getY(), player.getZ()); + player.getWorld().getEntity(UUID.fromString(uuid)).setPos(player.getX(), player.getY() + 2, player.getZ()); }); } if (tick == 20) { @@ -38,7 +39,7 @@ public class ClickEvent { playerCharge.remove(player.getUuidAsString()); swords.put(player.getUuidAsString(), swords.getOrDefault(player.getUuidAsString(), 0) + 1); - Offence2.summonStand((ServerPlayerEntity) player, swords.get(player.getUuidAsString())); + Offence2.summonStand(player, swords.get(player.getUuidAsString())); player.playSound(SoundEvent.of(new Identifier("entity.experience_orb.pickup")), SoundCategory.PLAYERS, 1.0F, 1.0F); LOGGER.info("Sword charge: " + swords.get(player.getUuidAsString())); } else { |