diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java index 092c95cf..2e487b27 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/gui/editor/BauGuiEditor.java @@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.gui.editor; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.features.gui.BauGUI; import de.steamwar.bausystem.linkage.BauGuiItem; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.data.CMDs; import de.steamwar.inventory.SWItem; import de.steamwar.inventory.SWListInv; @@ -74,7 +73,7 @@ public class BauGuiEditor implements Listener { inv.setItem(mapping.getSize() + 5, new SWItem(Material.BARRIER, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH", p), Arrays.asList(BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_TRASH_LORE", p)), false, clickType -> { }).getItemStack()); - inv.setItem(mapping.getSize() + 6, new SWItem(TrickyTrialsWrapper.impl.getTurtleScute(), BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack()); + inv.setItem(mapping.getSize() + 6, new SWItem(Material.TURTLE_SCUTE, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_MORE", p)).getItemStack()); inv.setItem(mapping.getSize() + 8, new SWItem(Material.ARROW, BauSystem.MESSAGE.parse("GUI_EDITOR_ITEM_CLOSE", p)).setCustomModelData(CMDs.BACK).getItemStack()); p.openInventory(inv); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java index bfc2736a..4eb92c8e 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/loadtimer/LoadtimerListener.java @@ -20,9 +20,9 @@ package de.steamwar.bausystem.features.loadtimer; import de.steamwar.bausystem.region.Region; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.linkage.Linked; import org.bukkit.Material; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; @@ -57,7 +57,7 @@ public class LoadtimerListener implements Listener { @EventHandler public void onEntitySpawn(EntitySpawnEvent event) { - if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) { + if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) { Region r = Region.getRegion(event.getLocation()); if (hasTimer(r)) { getTimer(r).onTntSpawn(); @@ -67,7 +67,7 @@ public class LoadtimerListener implements Listener { @EventHandler public void onEntityExplode(EntityExplodeEvent event) { - if (!getTimers().isEmpty() && event.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) { + if (!getTimers().isEmpty() && event.getEntityType() == EntityType.TNT) { Region r = Region.getRegion(event.getLocation()); if (hasTimer(r)) { getTimer(r).onTntExplode(event); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java index 518adde8..deba61e7 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/region/FreezeListener.java @@ -24,7 +24,6 @@ import de.steamwar.bausystem.region.Region; import de.steamwar.bausystem.region.flags.Flag; import de.steamwar.bausystem.region.flags.FreezeMode; import de.steamwar.bausystem.utils.ScoreboardElement; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; @@ -32,6 +31,7 @@ import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.data.type.NoteBlock; import org.bukkit.block.data.type.Switch; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -59,7 +59,7 @@ public class FreezeListener implements Listener, ScoreboardElement { public void onEntitySpawn(EntitySpawnEvent e) { if (Region.getRegion(e.getLocation()).getRegionData().get(Flag.FREEZE).isWithDefault(FreezeMode.INACTIVE)) return; e.setCancelled(true); - if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) { + if (e.getEntityType() == EntityType.TNT) { Bukkit.getScheduler().runTaskLater(BauSystem.getInstance(), () -> { e.getLocation().getBlock().setType(Material.TNT, false); }, 1L); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java index 641e25f8..6265cec4 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/script/event/EventListener.java @@ -26,10 +26,10 @@ import de.steamwar.bausystem.features.script.lua.SteamWarGlobalLuaPlugin; import de.steamwar.bausystem.features.script.lua.libs.StorageLib; import de.steamwar.bausystem.region.Region; import de.steamwar.core.SWPlayer; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Material; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -141,7 +141,7 @@ public class EventListener implements Listener { @EventHandler(priority = EventPriority.HIGH) public void onEntitySpawn(EntitySpawnEvent event) { - if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) { + if (event.getEntityType() != EntityType.TNT) { return; } Region tntRegion = Region.getRegion(event.getLocation()); @@ -156,7 +156,7 @@ public class EventListener implements Listener { @EventHandler(priority = EventPriority.LOWEST) public void onEntityExplode(EntityExplodeEvent event) { - if (event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) { + if (event.getEntityType() != EntityType.TNT) { return; } Region tntRegion = Region.getRegion(event.getLocation()); diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java index 2c0d81b9..fe242037 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/team/boundary/BoundaryViewer.java @@ -22,7 +22,6 @@ package de.steamwar.bausystem.features.team.boundary; import de.steamwar.bausystem.BauSystem; import de.steamwar.bausystem.region.Point; import de.steamwar.bausystem.region.Region; -import de.steamwar.core.TrickyParticleWrapper; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; import org.bukkit.Particle; @@ -53,7 +52,7 @@ public class BoundaryViewer implements Listener { } private void showRegion(Region region, Player player) { - drawCuboid(player, TrickyParticleWrapper.impl.getVillagerHappy(), region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false)); + drawCuboid(player, Particle.HAPPY_VILLAGER, region.getArea().getMinPoint(false), region.getArea().getMaxPoint(false)); if (!region.getTestblockArea().isEmpty()) { drawCuboid(player, Particle.END_ROD, region.getTestblockArea().getMinPoint(true), region.getTestblockArea().getMaxPoint(true)); } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java index 74888bec..f737af0a 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/techhider/TechHiderCommand.java @@ -92,7 +92,7 @@ public class TechHiderCommand extends SWCommand implements Listener, ScoreboardE BauSystem.MESSAGE.sendPrefixless("TECHHIDER_ON", player, ChatMessageType.ACTION_BAR); } region.getBuildArea().forEachChunk((x, z) -> { - CraftbukkitWrapper.impl.sendChunk(player, x, z); + CraftbukkitWrapper.sendChunk(player, x, z); }); } diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java index 0c1481e6..36829c3b 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/util/NoClipCommand.java @@ -147,6 +147,6 @@ public class NoClipCommand extends SWCommand implements Listener { } private static void pseudoGameMode(Player player, GameMode gameMode) { - TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), gameMode)); + TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), gameMode)); } } \ No newline at end of file diff --git a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java index b1d100f3..c2cb9091 100644 --- a/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java +++ b/BauSystem/BauSystem_Main/src/de/steamwar/bausystem/features/xray/XrayCommand.java @@ -92,7 +92,7 @@ public class XrayCommand extends SWCommand implements Listener, ScoreboardElemen BauSystem.MESSAGE.sendPrefixless("XRAY_ON", player, ChatMessageType.ACTION_BAR); } region.getBuildArea().forEachChunk((x, z) -> { - CraftbukkitWrapper.impl.sendChunk(player, x, z); + CraftbukkitWrapper.sendChunk(player, x, z); }); } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GamemodeCommand.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GamemodeCommand.java index 02a142d0..526ce7be 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GamemodeCommand.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/commands/GamemodeCommand.java @@ -20,20 +20,22 @@ package de.steamwar.fightsystem.commands; import com.google.common.collect.ImmutableList; -import de.steamwar.core.CommandRemover; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.linkage.Linked; import net.md_5.bungee.api.ChatMessageType; +import org.bukkit.Bukkit; import org.bukkit.GameMode; +import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.command.defaults.BukkitCommand; +import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Player; import org.bukkit.util.StringUtil; import java.util.ArrayList; import java.util.List; -import java.util.logging.Level; +import java.util.Map; @Linked public class GamemodeCommand extends BukkitCommand { @@ -47,11 +49,8 @@ public class GamemodeCommand extends BukkitCommand { aliases.add("gm"); this.setAliases(aliases); - try { - CommandRemover.removeAll("gamemode"); - } catch (Exception e) { - FightSystem.getPlugin().getLogger().log(Level.SEVERE, "Failed to replace commands", e); - } + Map knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands(); + knownCommands.remove("gamemode"); Commands.injectCommand(this); } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java index 9620e594..3ec8e498 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/HellsBells.java @@ -19,7 +19,6 @@ package de.steamwar.fightsystem.event; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.countdown.Countdown; @@ -31,6 +30,7 @@ import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.fightsystem.winconditions.Winconditions; import de.steamwar.linkage.Linked; import org.bukkit.Bukkit; +import org.bukkit.entity.EntityType; import org.bukkit.scheduler.BukkitTask; import java.util.Arrays; @@ -98,13 +98,13 @@ public class HellsBells { currentDropping = Bukkit.getScheduler().runTaskTimer(FightSystem.getPlugin(), () -> { for (int w = 0; w < width; w++) { if (direction.isNorthOrWest()) { - Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType()); + Config.world.spawnEntity(redStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT); - Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType()); + Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT); } else { - Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), TrickyTrialsWrapper.impl.getTntEntityType()); + Config.world.spawnEntity(redStart.addAndToLocation(Config.world, direction.dx * length.get() + w * direction.other().dx, 0, direction.dz * length.get() + w * direction.other().dz), EntityType.TNT); - Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), TrickyTrialsWrapper.impl.getTntEntityType()); + Config.world.spawnEntity(blueStart.addAndToLocation(Config.world, -1 * (direction.dx * length.get() + w * direction.other().dx), 0, -1 * (direction.dz * length.get() + w * direction.other().dz)), EntityType.TNT); } } if (length.addAndGet(-2) <= 0) { diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java index 226caee8..14de4bb1 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/event/Meteor.java @@ -113,14 +113,12 @@ public class Meteor implements Listener { LargeFireball fireballRed = Config.world.spawn(redStart.toLocation(Config.world), LargeFireball.class); fireballRed.setDirection(vector); - fireballRed.setBounce(false); fireballRed.setIsIncendiary(false); fireballRed.setYield(current.explosionSize); LargeFireball fireballBlue = Config.world.spawn(blueStart.toLocation(Config.world), LargeFireball.class); vector.setZ(vector.getZ() * -1); fireballBlue.setDirection(vector); - fireballBlue.setBounce(false); fireballBlue.setIsIncendiary(false); fireballBlue.setYield(current.explosionSize); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java index 36a7c6fa..fc0afe9d 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java @@ -82,7 +82,7 @@ public class FightWorld extends StateDependent { Config.ArenaRegion.forEachChunk((x, z) -> { CraftbukkitWrapper.impl.resetChunk(Config.world, backup, x, z); for(Player p : Bukkit.getOnlinePlayers()) { - de.steamwar.core.CraftbukkitWrapper.impl.sendChunk(p, x, z); + de.steamwar.core.CraftbukkitWrapper.sendChunk(p, x, z); } }); Bukkit.unloadWorld(backup, false); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java index 2a7fdcae..76917e0a 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Recording.java @@ -21,7 +21,6 @@ package de.steamwar.fightsystem.listener; import com.comphenix.tinyprotocol.TinyProtocol; import de.steamwar.Reflection; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.events.TeamDeathEvent; @@ -226,7 +225,7 @@ public class Recording implements Listener { @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onTNTSpawn(EntitySpawnEvent e){ - if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) + if(e.getEntityType() != EntityType.TNT) return; GlobalRecorder.getInstance().tntSpawn(e.getEntity()); @@ -234,7 +233,7 @@ public class Recording implements Listener { @EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true) public void onExplosion(EntityExplodeEvent e){ - if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) + if(e.getEntityType() != EntityType.TNT) return; Location loc = e.getLocation(); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Spectator.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Spectator.java index f7dc3ef0..5abd8bba 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Spectator.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/Spectator.java @@ -108,6 +108,6 @@ public class Spectator implements Listener { } private static void pseudoSpectator(Player player, boolean enable) { - TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), enable ? GameMode.CREATIVE : GameMode.SPECTATOR)); + TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.GAMEMODE, new GameProfile(player.getUniqueId(), player.getName()), enable ? GameMode.CREATIVE : GameMode.SPECTATOR)); } } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java index 84d5cab2..886eec40 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/listener/WaterRemover.java @@ -19,7 +19,6 @@ package de.steamwar.fightsystem.listener; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.fightsystem.ArenaMode; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.fight.Fight; @@ -31,6 +30,7 @@ import de.steamwar.linkage.Linked; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityExplodeEvent; @@ -58,7 +58,7 @@ public class WaterRemover implements Listener { @EventHandler public void handleEntitySpawn(EntitySpawnEvent event) { - if(event.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) + if(event.getEntityType() != EntityType.TNT) return; Location location = event.getLocation(); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java index dbae1968..0ddc3ebc 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/record/PacketProcessor.java @@ -20,7 +20,6 @@ package de.steamwar.fightsystem.record; import com.sk89q.worldedit.extent.clipboard.Clipboard; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.core.WorldEditWrapper; import de.steamwar.entity.REntity; import de.steamwar.entity.REntityServer; @@ -56,6 +55,7 @@ import org.bukkit.event.EventPriority; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.inventory.EquipmentSlot; import org.bukkit.inventory.ItemStack; import org.bukkit.scheduler.BukkitTask; import org.bukkit.scoreboard.NameTagVisibility; @@ -305,7 +305,7 @@ public class PacketProcessor implements Listener { private void tntSpawn() throws IOException { int entityId = source.readInt(); - execSync(() -> addREntity(entityId, new REntity(entityServer, TrickyTrialsWrapper.impl.getTntEntityType(), Config.SpecSpawn))); + execSync(() -> addREntity(entityId, new REntity(entityServer, EntityType.TNT, Config.SpecSpawn))); } private void entityVelocity() throws IOException { @@ -332,26 +332,27 @@ public class PacketProcessor implements Listener { if(enchanted) stack.addUnsafeEnchantment(Enchantment.UNBREAKING, 1); - Object slot; + EquipmentSlot slot; switch(slotName){ case "HEAD": - slot = de.steamwar.core.ProtocolWrapper.itemSlots[5]; + slot = EquipmentSlot.HEAD; break; case "CHEST": - slot = de.steamwar.core.ProtocolWrapper.itemSlots[4]; + slot = EquipmentSlot.CHEST; break; case "LEGS": - slot = de.steamwar.core.ProtocolWrapper.itemSlots[3]; + slot = EquipmentSlot.LEGS; break; case "FEET": - slot = de.steamwar.core.ProtocolWrapper.itemSlots[2]; + slot = EquipmentSlot.FEET; break; case "OFFHAND": - slot = de.steamwar.core.ProtocolWrapper.itemSlots[1]; + slot = EquipmentSlot.OFF_HAND; break; case "MAINHAND": default: - slot = de.steamwar.core.ProtocolWrapper.itemSlots[0]; + slot = EquipmentSlot.HAND; + break; } execSync(() -> entities.get(entityId).setItem(slot, stack)); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/BlockIdWrapper.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/BlockIdWrapper.java index a91de770..8bb7fe08 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/BlockIdWrapper.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/BlockIdWrapper.java @@ -59,7 +59,7 @@ public class BlockIdWrapper { public void trackEntity(Player player, Entity entity) { if(entity instanceof Player) - TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE)); + TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE)); player.showEntity(FightSystem.getPlugin(), entity); } @@ -68,6 +68,6 @@ public class BlockIdWrapper { player.hideEntity(FightSystem.getPlugin(), entity); if(entity instanceof Player) - TinyProtocol.instance.sendPacket(player, ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE)); + TinyProtocol.instance.sendPacket(player, ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, new GameProfile(entity.getUniqueId(), entity.getName()), GameMode.CREATIVE)); } } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java index d72e6949..ceec1c5e 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHiderWrapper.java @@ -112,8 +112,9 @@ public class TechHiderWrapper extends StateDependent implements TechHider.Locati return; region.forEachChunk((chunkX, chunkZ) -> { - if(exclusion.chunkOutside(chunkX, chunkZ)) - CraftbukkitWrapper.impl.sendChunk(player, chunkX, chunkZ); + if (exclusion.chunkOutside(chunkX, chunkZ)) { + CraftbukkitWrapper.sendChunk(player, chunkX, chunkZ); + } }); } diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/WorldeditWrapper.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/WorldeditWrapper.java index 20d9b96f..835d75d3 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/WorldeditWrapper.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/utils/WorldeditWrapper.java @@ -77,9 +77,9 @@ public class WorldeditWrapper { Map replaceMap = new HashMap<>(); colorBlocks.forEach((base, postfix) -> replaceMap.put(base, Objects.requireNonNull(BlockTypes.get(c.name().toLowerCase() + postfix)).getDefaultState().toBaseBlock())); - for(int x = 0; x < clipboard.getDimensions().getX(); x++){ - for(int y = 0; y < clipboard.getDimensions().getY(); y++){ - for(int z = 0; z < clipboard.getDimensions().getZ(); z++){ + for(int x = 0; x < clipboard.getDimensions().x(); x++){ + for(int y = 0; y < clipboard.getDimensions().y(); y++){ + for(int z = 0; z < clipboard.getDimensions().z(); z++){ BlockVector3 pos = minimum.add(x, y, z); BaseBlock replacement = replaceMap.get(clipboard.getFullBlock(pos)); if(replacement != null) @@ -111,7 +111,7 @@ public class WorldeditWrapper { public Vector getDimensions(Clipboard clipboard) { BlockVector3 dims = clipboard.getDimensions(); - return new Vector(dims.getX(), dims.getY(), dims.getZ()); + return new Vector(dims.x(), dims.y(), dims.z()); } public Clipboard loadChar(String charName) throws IOException { diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java index 9e9a92a9..043161d5 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimeTechKO.java @@ -19,7 +19,6 @@ package de.steamwar.fightsystem.winconditions; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.countdown.Countdown; import de.steamwar.fightsystem.fight.Fight; @@ -32,6 +31,7 @@ import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.linkage.Linked; import org.bukkit.Location; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityExplodeEvent; @@ -72,7 +72,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener { @EventHandler public void onSpawn(EntitySpawnEvent e) { - if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) + if(e.getEntityType() != EntityType.TNT) return; Location location = e.getLocation(); @@ -86,7 +86,7 @@ public class WinconditionTimeTechKO extends Wincondition implements Listener { @EventHandler public void onExplode(EntityExplodeEvent e) { - if(e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) + if(e.getEntityType() != EntityType.TNT) return; FightTeam spawn = spawnLocations.remove(e.getEntity().getEntityId()); diff --git a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimedDamageTechKO.java b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimedDamageTechKO.java index f118a0eb..c0c0407b 100644 --- a/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimedDamageTechKO.java +++ b/FightSystem/FightSystem_Core/src/de/steamwar/fightsystem/winconditions/WinconditionTimedDamageTechKO.java @@ -19,7 +19,6 @@ package de.steamwar.fightsystem.winconditions; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.countdown.Countdown; import de.steamwar.fightsystem.fight.Fight; @@ -31,6 +30,7 @@ import de.steamwar.fightsystem.utils.Message; import de.steamwar.fightsystem.utils.SWSound; import de.steamwar.linkage.Linked; import org.bukkit.Location; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityExplodeEvent; @@ -72,7 +72,7 @@ public class WinconditionTimedDamageTechKO extends Wincondition implements Print @EventHandler public void onExplode(EntityExplodeEvent e) { - if (e.getEntityType() != TrickyTrialsWrapper.impl.getTntEntityType()) + if (e.getEntityType() != EntityType.TNT) return; Location location = e.getLocation(); diff --git a/MissileWars/src/de/steamwar/misslewars/FightWorld.java b/MissileWars/src/de/steamwar/misslewars/FightWorld.java index 501c18a2..6f2f93b7 100644 --- a/MissileWars/src/de/steamwar/misslewars/FightWorld.java +++ b/MissileWars/src/de/steamwar/misslewars/FightWorld.java @@ -84,7 +84,8 @@ public class FightWorld { worldChunk.heightmaps.clear(); worldChunk.heightmaps.putAll(backupChunk.heightmaps); - for(Player p : Bukkit.getOnlinePlayers()) - CraftbukkitWrapper.impl.sendChunk(p, x, z); + for(Player p : Bukkit.getOnlinePlayers()) { + CraftbukkitWrapper.sendChunk(p, x, z); + } } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java deleted file mode 100644 index b2baf6bf..00000000 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ChatWrapper.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import lombok.experimental.UtilityClass; -import net.minecraft.network.chat.MutableComponent; -import net.minecraft.network.chat.contents.PlainTextContents; -import net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket; -import net.minecraft.network.syncher.SynchedEntityData; - -import java.util.ArrayList; - -@UtilityClass -public class ChatWrapper { - public Object stringToChatComponent(String text) { - return MutableComponent.create(PlainTextContents.create(text)); - } - - public Object getDataWatcherPacket(int entityId, Object... dataWatcherKeyValues) { - ArrayList> nativeWatchers = new ArrayList<>(1); - for(int i = 0; i < dataWatcherKeyValues.length; i+=2) { - nativeWatchers.add(((SynchedEntityData.DataItem) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).value()); - } - - return new ClientboundSetEntityDataPacket(entityId, nativeWatchers); - } -} diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java deleted file mode 100644 index b2da8b75..00000000 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CommandRemover.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import lombok.experimental.UtilityClass; -import org.bukkit.Bukkit; -import org.bukkit.command.Command; -import org.bukkit.craftbukkit.CraftServer; - -import java.util.Map; - -@UtilityClass -public class CommandRemover { - private static final Map knownCommands = ((CraftServer) Bukkit.getServer()).getCommandMap().getKnownCommands(); - - public static void removeAll(String... cmds) { - for (String cmd : cmds) { - knownCommands.remove(cmd.toLowerCase()); - } - } -} diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java index 17efee53..ea1fc09f 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/CraftbukkitWrapper.java @@ -20,15 +20,15 @@ package de.steamwar.core; import com.comphenix.tinyprotocol.TinyProtocol; +import lombok.experimental.UtilityClass; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.chunk.status.ChunkStatus; import org.bukkit.craftbukkit.CraftChunk; import org.bukkit.entity.Player; +@UtilityClass public class CraftbukkitWrapper { - public static final CraftbukkitWrapper impl = new CraftbukkitWrapper(); - public void sendChunk(Player p, int chunkX, int chunkZ) { LevelChunk chunk = (LevelChunk) ((CraftChunk) p.getWorld().getChunkAt(chunkX, chunkZ)).getHandle(ChunkStatus.FULL); TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.level.getLightEngine(), null, null, true)); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java index 3792dc02..6d6d4d1b 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/FlatteningWrapper.java @@ -20,6 +20,8 @@ package de.steamwar.core; import lombok.experimental.UtilityClass; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.contents.PlainTextContents; import java.util.Optional; @@ -27,6 +29,6 @@ import java.util.Optional; public class FlatteningWrapper { public Object formatDisplayName(String displayName) { - return displayName != null ? Optional.of(ChatWrapper.stringToChatComponent(displayName)) : Optional.empty(); + return displayName != null ? Optional.of((Object) MutableComponent.create(PlainTextContents.create(displayName))) : Optional.empty(); } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java index 41629609..7f6c0721 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/ProtocolWrapper.java @@ -20,30 +20,22 @@ package de.steamwar.core; import com.mojang.authlib.GameProfile; -import net.minecraft.network.protocol.game.ClientboundAddEntityPacket; +import lombok.experimental.UtilityClass; import net.minecraft.network.protocol.game.ClientboundPlayerInfoRemovePacket; import net.minecraft.network.protocol.game.ClientboundPlayerInfoUpdatePacket; -import net.minecraft.world.entity.EquipmentSlot; -import net.minecraft.world.item.ItemStack; import net.minecraft.world.level.GameType; import org.bukkit.GameMode; import java.util.Collections; import java.util.EnumSet; +@UtilityClass public class ProtocolWrapper { - public static final Class itemStack = ItemStack.class; - public static final Class spawnPacket = ClientboundAddEntityPacket.class; - - // 0: hand, 1: offhand, 2: feet, 3: legs, 4: chest, 5: head - public static final EquipmentSlot[] itemSlots = EquipmentSlot.values(); - - public static final ProtocolWrapper impl = new ProtocolWrapper(); - public Object playerInfoPacketConstructor(PlayerInfoAction action, GameProfile profile, GameMode mode) { - if(action == PlayerInfoAction.REMOVE) + if(action == PlayerInfoAction.REMOVE) { return new ClientboundPlayerInfoRemovePacket(Collections.singletonList(profile.getId())); + } return new ClientboundPlayerInfoUpdatePacket(action == PlayerInfoAction.ADD ? EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE) : EnumSet.of(ClientboundPlayerInfoUpdatePacket.Action.UPDATE_GAME_MODE), diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java index 63aed6a1..a271b00b 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TPSWatcher.java @@ -68,21 +68,17 @@ public class TPSWatcher { case TEN_SECONDS: return round(tps_TenSecond.tps); case ONE_MINUTE: - return round(getSpigotTPS()[0]); + return round(MinecraftServer.getServer().tps1.getAverage()); case FIVE_MINUTES: - return round(getSpigotTPS()[1]); + return round(MinecraftServer.getServer().tps5.getAverage()); case TEN_MINUTES: - return round(getSpigotTPS()[2]); + return round(MinecraftServer.getServer().tps15.getAverage()); case ONE_SECOND: default: return round(tps_OneSecond.tps); } } - private static double[] getSpigotTPS() { - return MinecraftServer.getServer().recentTps; - } - private static double round(double d) { return Math.round(d * 10) / 10.0; } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java deleted file mode 100644 index 6ada7e0f..00000000 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyParticleWrapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import org.bukkit.Particle; - -public class TrickyParticleWrapper { - public static final TrickyParticleWrapper impl = new TrickyParticleWrapper(); - - public Particle getVillagerHappy() { - return Particle.HAPPY_VILLAGER; - } -} diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java deleted file mode 100644 index f529fe9e..00000000 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/TrickyTrialsWrapper.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * This file is a part of the SteamWar software. - * - * Copyright (C) 2025 SteamWar.de-Serverteam - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -package de.steamwar.core; - -import com.mojang.authlib.properties.Property; -import org.bukkit.Material; -import org.bukkit.enchantments.Enchantment; -import org.bukkit.entity.EntityType; - -public class TrickyTrialsWrapper { - public static final TrickyTrialsWrapper impl = new TrickyTrialsWrapper(); - - public EntityType getTntEntityType() { - return EntityType.TNT; - } - - public Enchantment getUnbreakingEnchantment() { - return Enchantment.UNBREAKING; - } - - public Material getTurtleScute() { - return Material.TURTLE_SCUTE; - } - - public String getValue(Property property) { - return property.value(); - } -} diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java index 4f2579c6..736c2f8a 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/core/WorldEditRendererFallback.java @@ -56,7 +56,7 @@ public class WorldEditRendererFallback { private void drawLine(Player player, boolean clipboard, Vector min, Vector max) { Particle particle; if (clipboard) { - particle = TrickyParticleWrapper.impl.getVillagerHappy(); + particle = Particle.HAPPY_VILLAGER; } else { particle = Particle.DRAGON_BREATH; } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java index ddabb2cf..747898ff 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/REntity.java @@ -22,9 +22,7 @@ package de.steamwar.entity; import com.mojang.datafixers.util.Pair; import de.steamwar.Reflection; import de.steamwar.core.BountifulWrapper; -import de.steamwar.core.ChatWrapper; import de.steamwar.core.FlatteningWrapper; -import de.steamwar.core.ProtocolWrapper; import it.unimi.dsi.fastutil.ints.IntArrayList; import lombok.Getter; import net.minecraft.core.registries.BuiltInRegistries; @@ -32,6 +30,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.protocol.game.*; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; +import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.Pose; @@ -249,9 +248,9 @@ public class REntity { server.updateEntity(this,getDataWatcherPacket(entityStatusWatcher,getEntityStatus())); } - private static final Function spawnPacketGenerator = entitySpawnPacketGenerator(ProtocolWrapper.spawnPacket, 2); + private static final Function spawnPacketGenerator = entitySpawnPacketGenerator(ClientboundAddEntityPacket.class, 2); - private static final Reflection.Field additionalData = Reflection.getField(ProtocolWrapper.spawnPacket, int.class, 4); + private static final Reflection.Field additionalData = Reflection.getField(ClientboundAddEntityPacket.class, int.class, 4); private Object spawnPacketGenerator() { Object packet = spawnPacketGenerator.apply(this); @@ -332,7 +331,12 @@ public class REntity { } protected Object getDataWatcherPacket(Object... dataWatcherKeyValues) { - return ChatWrapper.getDataWatcherPacket(entityId, dataWatcherKeyValues); + ArrayList> nativeWatchers = new ArrayList<>(1); + for(int i = 0; i < dataWatcherKeyValues.length; i+=2) { + nativeWatchers.add(((SynchedEntityData.DataItem) BountifulWrapper.impl.getDataWatcherItem(dataWatcherKeyValues[i], dataWatcherKeyValues[i+1])).value()); + } + + return new ClientboundSetEntityDataPacket(entityId, nativeWatchers); } private Object getTeleportPacket(){ @@ -371,7 +375,7 @@ public class REntity { return new ClientboundSetEquipmentPacket(entityId, Collections.singletonList(Pair.of((EquipmentSlot) slot, CraftItemStack.asNMSCopy(stack)))); } - private static final Reflection.Field spawnType = Reflection.getField(ProtocolWrapper.spawnPacket, net.minecraft.world.entity.EntityType.class, 0); + private static final Reflection.Field spawnType = Reflection.getField(ClientboundAddEntityPacket.class, net.minecraft.world.entity.EntityType.class, 0); private static Function entitySpawnPacketGenerator(Class spawnPacket, int posOffset) { BountifulWrapper.UUIDSetter uuid = BountifulWrapper.impl.getUUIDSetter(spawnPacket); Function packetGenerator = spawnPacketGenerator(spawnPacket, posOffset); diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RPlayer.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RPlayer.java index 873c2f85..c827525c 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RPlayer.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RPlayer.java @@ -23,7 +23,6 @@ import com.mojang.authlib.GameProfile; import com.mojang.authlib.properties.Property; import de.steamwar.core.BountifulWrapper; import de.steamwar.core.ProtocolWrapper; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.network.CoreNetworkHandler; import de.steamwar.network.NetworkSender; import de.steamwar.network.packets.common.PlayerSkinRequestPacket; @@ -61,7 +60,7 @@ public class RPlayer extends REntity { NetworkSender.sendOrQueue(new PlayerSkinRequestPacket(actualUUID)); return new Property("textures", null, null); }); - if (TrickyTrialsWrapper.impl.getValue(skinData) != null) { + if (skinData.value() != null) { GameProfile gameProfile = new GameProfile(uuid, name); gameProfile.getProperties().put("textures", skinData); return gameProfile; @@ -75,7 +74,7 @@ public class RPlayer extends REntity { @Override void list(Consumer packetSink) { saved = getGameProfile(); - packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE)); + packetSink.accept(ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.ADD, saved, GameMode.CREATIVE)); } @Override @@ -93,7 +92,7 @@ public class RPlayer extends REntity { @Override void delist(Consumer packetSink) { if (saved == null) saved = getGameProfile(); - packetSink.accept(ProtocolWrapper.impl.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, saved, GameMode.CREATIVE)); + packetSink.accept(ProtocolWrapper.playerInfoPacketConstructor(ProtocolWrapper.PlayerInfoAction.REMOVE, saved, GameMode.CREATIVE)); } private Object getNamedSpawnPacket() { diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RTextDisplay.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RTextDisplay.java index 3f50f309..16cf5951 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RTextDisplay.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/entity/RTextDisplay.java @@ -19,9 +19,10 @@ package de.steamwar.entity; -import de.steamwar.core.ChatWrapper; import lombok.Getter; import net.minecraft.network.chat.Component; +import net.minecraft.network.chat.MutableComponent; +import net.minecraft.network.chat.contents.PlainTextContents; import net.minecraft.network.syncher.EntityDataAccessor; import net.minecraft.network.syncher.EntityDataSerializers; import org.bukkit.Location; @@ -77,7 +78,7 @@ public class RTextDisplay extends RDisplay { private static final EntityDataAccessor textWatcher = new EntityDataAccessor<>(23, EntityDataSerializers.COMPONENT); private void getText(boolean ignoreDefault, BiConsumer packetSink) { if (ignoreDefault || !text.isEmpty()) { - packetSink.accept(textWatcher, ChatWrapper.stringToChatComponent(text)); + packetSink.accept(textWatcher, MutableComponent.create(PlainTextContents.create(text))); } } diff --git a/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java b/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java index 7728cec1..05741791 100644 --- a/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java +++ b/SpigotCore/SpigotCore_Main/src/de/steamwar/inventory/SWItem.java @@ -22,10 +22,10 @@ package de.steamwar.inventory; import com.destroystokyo.paper.profile.PlayerProfile; import com.google.gson.JsonArray; import com.google.gson.JsonObject; -import de.steamwar.core.TrickyTrialsWrapper; import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.OfflinePlayer; +import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemFlag; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; @@ -114,7 +114,7 @@ public class SWItem { itemMeta.setDisplayName(name); if (lore != null && !lore.isEmpty()) itemMeta.setLore(lore); - if (enchanted) itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment(), 10, true); + if (enchanted) itemMeta.addEnchant(Enchantment.UNBREAKING, 10, true); itemStack.setItemMeta(itemMeta); } callback = c; @@ -205,9 +205,9 @@ public class SWItem { public SWItem setEnchanted(boolean enchanted) { if (enchanted){ - itemMeta.addEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment() , 10, true); + itemMeta.addEnchant(Enchantment.UNBREAKING, 10, true); } else { - itemMeta.removeEnchant(TrickyTrialsWrapper.impl.getUnbreakingEnchantment()); + itemMeta.removeEnchant(Enchantment.UNBREAKING); } itemStack.setItemMeta(itemMeta); return this; diff --git a/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java b/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java index 5f9a379c..12c279c7 100644 --- a/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java +++ b/Teamserver/src/de/steamwar/teamserver/listener/FreezeListener.java @@ -19,7 +19,6 @@ package de.steamwar.teamserver.listener; -import de.steamwar.core.TrickyTrialsWrapper; import de.steamwar.linkage.Linked; import de.steamwar.teamserver.Builder; import net.md_5.bungee.api.ChatMessageType; @@ -27,6 +26,7 @@ import org.bukkit.Bukkit; import org.bukkit.Material; import org.bukkit.block.Block; import org.bukkit.block.data.type.Switch; +import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; @@ -54,7 +54,7 @@ public class FreezeListener implements Listener { public void onEntitySpawn(EntitySpawnEvent e) { if (!freeze) return; e.setCancelled(true); - if (e.getEntityType() == TrickyTrialsWrapper.impl.getTntEntityType()) { + if (e.getEntityType() == EntityType.TNT) { Bukkit.getScheduler().runTaskLater(Builder.getInstance(), () -> { e.getLocation().getBlock().setType(Material.TNT, false); }, 1L); diff --git a/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java b/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java index db2e09f9..0e548330 100644 --- a/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java +++ b/TowerRun/src/de/steamwar/towerrun/game/TowerRunGame.java @@ -192,7 +192,8 @@ public class TowerRunGame { System.arraycopy(backupChunk.getSections(), 0, chunk.getSections(), 0, chunk.getSections().length); - for (Player p : Bukkit.getOnlinePlayers()) - CraftbukkitWrapper.impl.sendChunk(p, x, z); + for (Player p : Bukkit.getOnlinePlayers()) { + CraftbukkitWrapper.sendChunk(p, x, z); + } } }