From d56379b5235ef0e5cdae0a7ce00d4002d89ff2d7 Mon Sep 17 00:00:00 2001 From: Daniel Saukel Date: Thu, 8 Oct 2020 20:54:43 +0200 Subject: [PATCH] Update NMS --- .../de/erethon/dungeonsxxl/util/GlowUtil.java | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/addon/core/src/main/java/de/erethon/dungeonsxxl/util/GlowUtil.java b/addon/core/src/main/java/de/erethon/dungeonsxxl/util/GlowUtil.java index aa363768..9d808747 100644 --- a/addon/core/src/main/java/de/erethon/dungeonsxxl/util/GlowUtil.java +++ b/addon/core/src/main/java/de/erethon/dungeonsxxl/util/GlowUtil.java @@ -9,17 +9,17 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; import java.util.Random; -import net.minecraft.server.v1_16_R1.EntityShulker; -import net.minecraft.server.v1_16_R1.EntityTypes; -import net.minecraft.server.v1_16_R1.Packet; -import net.minecraft.server.v1_16_R1.PacketPlayOutEntityDestroy; -import net.minecraft.server.v1_16_R1.PacketPlayOutSpawnEntityLiving; +import net.minecraft.server.v1_16_R2.EntityShulker; +import net.minecraft.server.v1_16_R2.EntityTypes; +import net.minecraft.server.v1_16_R2.Packet; +import net.minecraft.server.v1_16_R2.PacketPlayOutEntityDestroy; +import net.minecraft.server.v1_16_R2.PacketPlayOutSpawnEntityLiving; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.block.Block; -import org.bukkit.craftbukkit.v1_16_R1.CraftWorld; -import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer; +import org.bukkit.craftbukkit.v1_16_R2.CraftWorld; +import org.bukkit.craftbukkit.v1_16_R2.entity.CraftPlayer; import org.bukkit.entity.Player; import org.bukkit.entity.Shulker; import org.bukkit.event.EventHandler; @@ -41,7 +41,7 @@ public class GlowUtil implements Listener { private Map teams = new HashMap<>(); private GlowData glowingBlocks = new GlowData<>(); - private Map> playerGlows = new HashMap<>(); + private Map> playerGlows = new HashMap<>(); private GlowRunnable runnable = new GlowRunnable(); public GlowUtil(Plugin plugin) { @@ -177,8 +177,8 @@ public class GlowUtil implements Listener { runnable.removeEntity(bukkitEntity); } - for (Entry> entry : playerGlows.entrySet()) { - net.minecraft.server.v1_16_R1.Entity nmsEntity = entry.getValue().get(block); + for (Entry> entry : playerGlows.entrySet()) { + net.minecraft.server.v1_16_R2.Entity nmsEntity = entry.getValue().get(block); if (nmsEntity != null) { sendPacket(entry.getKey(), new PacketPlayOutEntityDestroy(nmsEntity.getId())); runnable.removeEntity(nmsEntity); @@ -203,7 +203,7 @@ public class GlowUtil implements Listener { * @param entity an NMS Entity * @param color the glow color */ - public void addGlow(net.minecraft.server.v1_16_R1.Entity entity, ChatColor color) { + public void addGlow(net.minecraft.server.v1_16_R2.Entity entity, ChatColor color) { getTeam(color).addEntry(asEntry(entity)); entity.setFlag(6, true); } @@ -233,7 +233,7 @@ public class GlowUtil implements Listener { * * @param entity an NMS Entity */ - public void addRainbowGlow(net.minecraft.server.v1_16_R1.Entity entity) { + public void addRainbowGlow(net.minecraft.server.v1_16_R2.Entity entity) { addRainbowGlow(entity, null); } @@ -243,7 +243,7 @@ public class GlowUtil implements Listener { * @param entity an NMS Entity * @param cancelTime the time in milliseconds until the glow effect shall end; null = forever */ - public void addRainbowGlow(net.minecraft.server.v1_16_R1.Entity entity, Long cancelTime) { + public void addRainbowGlow(net.minecraft.server.v1_16_R2.Entity entity, Long cancelTime) { entity.setFlag(6, true); runnable.addEntity(entity, cancelTime != null ? System.currentTimeMillis() + cancelTime : null); } @@ -264,7 +264,7 @@ public class GlowUtil implements Listener { * * @param entity an NMS Entity */ - public void removeGlow(net.minecraft.server.v1_16_R1.Entity entity) { + public void removeGlow(net.minecraft.server.v1_16_R2.Entity entity) { entity.setFlag(6, false); teams.values().forEach(t -> t.removeEntry(asEntry(entity))); runnable.removeEntity(entity); @@ -274,7 +274,7 @@ public class GlowUtil implements Listener { return entity instanceof Player ? entity.getName() : entity.getUniqueId().toString(); } - private static String asEntry(net.minecraft.server.v1_16_R1.Entity entity) { + private static String asEntry(net.minecraft.server.v1_16_R2.Entity entity) { return entity instanceof Player ? entity.getName() : entity.getUniqueID().toString(); } @@ -311,8 +311,8 @@ public class GlowUtil implements Listener { for (Entry entry : entities.entrySet().toArray(new Entry[entities.size()])) { if (entry.getKey() instanceof org.bukkit.entity.Entity) { run((org.bukkit.entity.Entity) entry.getKey(), entry.getValue()); - } else if (entry.getKey() instanceof net.minecraft.server.v1_16_R1.Entity) { - run((net.minecraft.server.v1_16_R1.Entity) entry.getKey(), entry.getValue()); + } else if (entry.getKey() instanceof net.minecraft.server.v1_16_R2.Entity) { + run((net.minecraft.server.v1_16_R2.Entity) entry.getKey(), entry.getValue()); } } } @@ -332,11 +332,11 @@ public class GlowUtil implements Listener { getTeam(color).addEntry(asEntry(entity)); } - private void run(net.minecraft.server.v1_16_R1.Entity entity, Long cancelTime) { + private void run(net.minecraft.server.v1_16_R2.Entity entity, Long cancelTime) { getTeam(color).removeEntry(asEntry(entity)); if (cancelTime != null && System.currentTimeMillis() >= cancelTime) { entities.remove(entity); - for (Entry> entry : playerGlows.entrySet()) { + for (Entry> entry : playerGlows.entrySet()) { if (!entry.getValue().glowingBlocks.containsValue(entity)) { continue; }