From 4635772b231e77cfdbeeaf44a7414f4f32e8dcaa Mon Sep 17 00:00:00 2001 From: Lixfel Date: Sat, 8 Jan 2022 12:20:47 +0100 Subject: [PATCH] Fix usage of deprecated api Signed-off-by: Lixfel --- .../steamwar/fightsystem/utils/CraftbukkitWrapper10.java | 5 ----- .../steamwar/fightsystem/utils/CraftbukkitWrapper12.java | 5 ----- .../steamwar/fightsystem/utils/CraftbukkitWrapper14.java | 5 ----- .../steamwar/fightsystem/utils/CraftbukkitWrapper15.java | 5 ----- .../steamwar/fightsystem/utils/CraftbukkitWrapper8.java | 5 ----- .../steamwar/fightsystem/utils/CraftbukkitWrapper9.java | 5 ----- .../src/de/steamwar/fightsystem/fight/FightWorld.java | 8 +++++++- .../src/de/steamwar/fightsystem/utils/TechHider.java | 4 ++-- 8 files changed, 9 insertions(+), 33 deletions(-) diff --git a/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java b/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java index 3e20fe9..722eba4 100644 --- a/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java +++ b/FightSystem_10/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper10.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_10_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_10_R1.CraftWorld; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftEntity; @@ -50,9 +48,6 @@ public class CraftbukkitWrapper10 implements CraftbukkitWrapper.ICraftbukkitWrap } chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java b/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java index 1c03c20..37b70a5 100644 --- a/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java +++ b/FightSystem_12/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper12.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_12_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_12_R1.CraftWorld; import org.bukkit.craftbukkit.v1_12_R1.entity.CraftEntity; @@ -50,9 +48,6 @@ public class CraftbukkitWrapper12 implements CraftbukkitWrapper.ICraftbukkitWrap } chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java b/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java index 14c5989..5c74382 100644 --- a/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java +++ b/FightSystem_14/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper14.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_14_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_14_R1.CraftWorld; import org.bukkit.craftbukkit.v1_14_R1.entity.CraftEntity; @@ -51,9 +49,6 @@ public class CraftbukkitWrapper14 implements CraftbukkitWrapper.ICraftbukkitWrap chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.heightMap.clear(); chunk.heightMap.putAll(backupChunk.heightMap); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java b/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java index 8d55c47..03f40d6 100644 --- a/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java +++ b/FightSystem_15/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper15.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_15_R1.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_15_R1.CraftWorld; import org.bukkit.craftbukkit.v1_15_R1.entity.CraftEntity; @@ -51,9 +49,6 @@ public class CraftbukkitWrapper15 implements CraftbukkitWrapper.ICraftbukkitWrap chunk.tileEntities.putAll(backupChunk.tileEntities); chunk.heightMap.clear(); chunk.heightMap.putAll(backupChunk.heightMap); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java b/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java index 3eb750e..f79dc0e 100644 --- a/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java +++ b/FightSystem_8/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper8.java @@ -19,9 +19,7 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import net.minecraft.server.v1_8_R3.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity; @@ -47,9 +45,6 @@ public class CraftbukkitWrapper8 implements CraftbukkitWrapper.ICraftbukkitWrapp w.tileEntityList.removeAll(chunk.tileEntities.values()); chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java b/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java index bb13e18..4a2cc0b 100644 --- a/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java +++ b/FightSystem_9/src/de/steamwar/fightsystem/utils/CraftbukkitWrapper9.java @@ -19,10 +19,8 @@ package de.steamwar.fightsystem.utils; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.fight.FightWorld; import net.minecraft.server.v1_9_R2.Chunk; -import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.craftbukkit.v1_9_R2.CraftWorld; import org.bukkit.craftbukkit.v1_9_R2.entity.CraftEntity; @@ -50,9 +48,6 @@ public class CraftbukkitWrapper9 implements CraftbukkitWrapper.ICraftbukkitWrapp } chunk.tileEntities.clear(); chunk.tileEntities.putAll(backupChunk.tileEntities); - for(Player p : Bukkit.getOnlinePlayers()){ - ChunkListener.sendChunk(p, x, z); - } } @Override diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java index b3cacb5..3914143 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/fight/FightWorld.java @@ -30,6 +30,7 @@ import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; public class FightWorld extends StateDependent { @@ -72,7 +73,12 @@ public class FightWorld extends StateDependent { World backup = new WorldCreator(world.getName() + "/backup").createWorld(); assert backup != null; - Config.ArenaRegion.forEachChunk((x, z) -> CraftbukkitWrapper.impl.resetChunk(world, backup, x, z)); + Config.ArenaRegion.forEachChunk((x, z) -> { + CraftbukkitWrapper.impl.resetChunk(world, backup, x, z); + for(Player p : Bukkit.getOnlinePlayers()) { + de.steamwar.core.CraftbukkitWrapper.impl.sendChunk(p, x, z); + } + }); Bukkit.unloadWorld(backup, false); } } \ No newline at end of file diff --git a/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java b/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java index 61d9085..5427fc5 100644 --- a/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java +++ b/FightSystem_Core/src/de/steamwar/fightsystem/utils/TechHider.java @@ -22,8 +22,8 @@ package de.steamwar.fightsystem.utils; import com.comphenix.tinyprotocol.Reflection; import com.google.common.primitives.Bytes; import de.steamwar.core.Core; +import de.steamwar.core.CraftbukkitWrapper; import de.steamwar.core.VersionDependent; -import de.steamwar.core.events.ChunkListener; import de.steamwar.fightsystem.Config; import de.steamwar.fightsystem.FightSystem; import de.steamwar.fightsystem.fight.Fight; @@ -234,7 +234,7 @@ public class TechHider extends StateDependent { Bukkit.getScheduler().runTaskLater(FightSystem.getPlugin(), () -> { for(ChunkPos chunk : chunksToReload){ if(bypass(p, chunk.x(), chunk.z()) != hide) - ChunkListener.sendChunk(p, chunk.x(), chunk.z()); + CraftbukkitWrapper.impl.sendChunk(p, chunk.x(), chunk.z()); } }, 40); }