mirror of
https://github.com/DRE2N/DungeonsXL.git
synced 2024-11-28 13:36:33 +01:00
Update to 1.16.1
This commit is contained in:
parent
5017f572b9
commit
5086bf2531
@ -9,17 +9,17 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import net.minecraft.server.v1_15_R1.EntityShulker;
|
import net.minecraft.server.v1_16_R1.EntityShulker;
|
||||||
import net.minecraft.server.v1_15_R1.EntityTypes;
|
import net.minecraft.server.v1_16_R1.EntityTypes;
|
||||||
import net.minecraft.server.v1_15_R1.Packet;
|
import net.minecraft.server.v1_16_R1.Packet;
|
||||||
import net.minecraft.server.v1_15_R1.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_16_R1.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_15_R1.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_16_R1.PacketPlayOutSpawnEntityLiving;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_16_R1.CraftWorld;
|
||||||
import org.bukkit.craftbukkit.v1_15_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_16_R1.entity.CraftPlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Shulker;
|
import org.bukkit.entity.Shulker;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@ -41,7 +41,7 @@ public class GlowUtil implements Listener {
|
|||||||
|
|
||||||
private Map<ChatColor, Team> teams = new HashMap<>();
|
private Map<ChatColor, Team> teams = new HashMap<>();
|
||||||
private GlowData<org.bukkit.entity.Entity> glowingBlocks = new GlowData<>();
|
private GlowData<org.bukkit.entity.Entity> glowingBlocks = new GlowData<>();
|
||||||
private Map<Player, GlowData<net.minecraft.server.v1_15_R1.Entity>> playerGlows = new HashMap<>();
|
private Map<Player, GlowData<net.minecraft.server.v1_16_R1.Entity>> playerGlows = new HashMap<>();
|
||||||
private GlowRunnable runnable = new GlowRunnable();
|
private GlowRunnable runnable = new GlowRunnable();
|
||||||
|
|
||||||
public GlowUtil(Plugin plugin) {
|
public GlowUtil(Plugin plugin) {
|
||||||
@ -71,7 +71,7 @@ public class GlowUtil implements Listener {
|
|||||||
public org.bukkit.entity.Entity addBlockGlow(Block block, ChatColor color) {
|
public org.bukkit.entity.Entity addBlockGlow(Block block, ChatColor color) {
|
||||||
Shulker entity = block.getWorld().spawn(new Location(block.getWorld(), block.getX() + .5, block.getY(), block.getZ() + .5), Shulker.class);
|
Shulker entity = block.getWorld().spawn(new Location(block.getWorld(), block.getX() + .5, block.getY(), block.getZ() + .5), Shulker.class);
|
||||||
entity.setAI(false);
|
entity.setAI(false);
|
||||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0), true);
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
|
||||||
entity.setInvulnerable(true);
|
entity.setInvulnerable(true);
|
||||||
addGlow(entity, color);
|
addGlow(entity, color);
|
||||||
glowingBlocks.put(block, entity);
|
glowingBlocks.put(block, entity);
|
||||||
@ -121,7 +121,7 @@ public class GlowUtil implements Listener {
|
|||||||
public org.bukkit.entity.Entity addRainbowBlockGlow(Block block, Long cancelTime) {
|
public org.bukkit.entity.Entity addRainbowBlockGlow(Block block, Long cancelTime) {
|
||||||
Shulker entity = block.getWorld().spawn(new Location(block.getWorld(), block.getX() + .5, block.getY(), block.getZ() + .5), Shulker.class);
|
Shulker entity = block.getWorld().spawn(new Location(block.getWorld(), block.getX() + .5, block.getY(), block.getZ() + .5), Shulker.class);
|
||||||
entity.setAI(false);
|
entity.setAI(false);
|
||||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0), true);
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
|
||||||
entity.setInvulnerable(true);
|
entity.setInvulnerable(true);
|
||||||
glowingBlocks.put(block, entity);
|
glowingBlocks.put(block, entity);
|
||||||
addRainbowGlow(entity, cancelTime);
|
addRainbowGlow(entity, cancelTime);
|
||||||
@ -177,8 +177,8 @@ public class GlowUtil implements Listener {
|
|||||||
runnable.removeEntity(bukkitEntity);
|
runnable.removeEntity(bukkitEntity);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Entry<Player, GlowData<net.minecraft.server.v1_15_R1.Entity>> entry : playerGlows.entrySet()) {
|
for (Entry<Player, GlowData<net.minecraft.server.v1_16_R1.Entity>> entry : playerGlows.entrySet()) {
|
||||||
net.minecraft.server.v1_15_R1.Entity nmsEntity = entry.getValue().get(block);
|
net.minecraft.server.v1_16_R1.Entity nmsEntity = entry.getValue().get(block);
|
||||||
if (nmsEntity != null) {
|
if (nmsEntity != null) {
|
||||||
sendPacket(entry.getKey(), new PacketPlayOutEntityDestroy(nmsEntity.getId()));
|
sendPacket(entry.getKey(), new PacketPlayOutEntityDestroy(nmsEntity.getId()));
|
||||||
runnable.removeEntity(nmsEntity);
|
runnable.removeEntity(nmsEntity);
|
||||||
@ -203,7 +203,7 @@ public class GlowUtil implements Listener {
|
|||||||
* @param entity an NMS Entity
|
* @param entity an NMS Entity
|
||||||
* @param color the glow color
|
* @param color the glow color
|
||||||
*/
|
*/
|
||||||
public void addGlow(net.minecraft.server.v1_15_R1.Entity entity, ChatColor color) {
|
public void addGlow(net.minecraft.server.v1_16_R1.Entity entity, ChatColor color) {
|
||||||
getTeam(color).addEntry(asEntry(entity));
|
getTeam(color).addEntry(asEntry(entity));
|
||||||
entity.setFlag(6, true);
|
entity.setFlag(6, true);
|
||||||
}
|
}
|
||||||
@ -233,7 +233,7 @@ public class GlowUtil implements Listener {
|
|||||||
*
|
*
|
||||||
* @param entity an NMS Entity
|
* @param entity an NMS Entity
|
||||||
*/
|
*/
|
||||||
public void addRainbowGlow(net.minecraft.server.v1_15_R1.Entity entity) {
|
public void addRainbowGlow(net.minecraft.server.v1_16_R1.Entity entity) {
|
||||||
addRainbowGlow(entity, null);
|
addRainbowGlow(entity, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,7 +243,7 @@ public class GlowUtil implements Listener {
|
|||||||
* @param entity an NMS Entity
|
* @param entity an NMS Entity
|
||||||
* @param cancelTime the time in milliseconds until the glow effect shall end; null = forever
|
* @param cancelTime the time in milliseconds until the glow effect shall end; null = forever
|
||||||
*/
|
*/
|
||||||
public void addRainbowGlow(net.minecraft.server.v1_15_R1.Entity entity, Long cancelTime) {
|
public void addRainbowGlow(net.minecraft.server.v1_16_R1.Entity entity, Long cancelTime) {
|
||||||
entity.setFlag(6, true);
|
entity.setFlag(6, true);
|
||||||
runnable.addEntity(entity, cancelTime != null ? System.currentTimeMillis() + cancelTime : null);
|
runnable.addEntity(entity, cancelTime != null ? System.currentTimeMillis() + cancelTime : null);
|
||||||
}
|
}
|
||||||
@ -264,7 +264,7 @@ public class GlowUtil implements Listener {
|
|||||||
*
|
*
|
||||||
* @param entity an NMS Entity
|
* @param entity an NMS Entity
|
||||||
*/
|
*/
|
||||||
public void removeGlow(net.minecraft.server.v1_15_R1.Entity entity) {
|
public void removeGlow(net.minecraft.server.v1_16_R1.Entity entity) {
|
||||||
entity.setFlag(6, false);
|
entity.setFlag(6, false);
|
||||||
teams.values().forEach(t -> t.removeEntry(asEntry(entity)));
|
teams.values().forEach(t -> t.removeEntry(asEntry(entity)));
|
||||||
runnable.removeEntity(entity);
|
runnable.removeEntity(entity);
|
||||||
@ -274,7 +274,7 @@ public class GlowUtil implements Listener {
|
|||||||
return entity instanceof Player ? entity.getName() : entity.getUniqueId().toString();
|
return entity instanceof Player ? entity.getName() : entity.getUniqueId().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String asEntry(net.minecraft.server.v1_15_R1.Entity entity) {
|
private static String asEntry(net.minecraft.server.v1_16_R1.Entity entity) {
|
||||||
return entity instanceof Player ? entity.getName() : entity.getUniqueID().toString();
|
return entity instanceof Player ? entity.getName() : entity.getUniqueID().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -311,8 +311,8 @@ public class GlowUtil implements Listener {
|
|||||||
for (Entry<Object, Long> entry : entities.entrySet().toArray(new Entry[entities.size()])) {
|
for (Entry<Object, Long> entry : entities.entrySet().toArray(new Entry[entities.size()])) {
|
||||||
if (entry.getKey() instanceof org.bukkit.entity.Entity) {
|
if (entry.getKey() instanceof org.bukkit.entity.Entity) {
|
||||||
run((org.bukkit.entity.Entity) entry.getKey(), entry.getValue());
|
run((org.bukkit.entity.Entity) entry.getKey(), entry.getValue());
|
||||||
} else if (entry.getKey() instanceof net.minecraft.server.v1_15_R1.Entity) {
|
} else if (entry.getKey() instanceof net.minecraft.server.v1_16_R1.Entity) {
|
||||||
run((net.minecraft.server.v1_15_R1.Entity) entry.getKey(), entry.getValue());
|
run((net.minecraft.server.v1_16_R1.Entity) entry.getKey(), entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -332,11 +332,11 @@ public class GlowUtil implements Listener {
|
|||||||
getTeam(color).addEntry(asEntry(entity));
|
getTeam(color).addEntry(asEntry(entity));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void run(net.minecraft.server.v1_15_R1.Entity entity, Long cancelTime) {
|
private void run(net.minecraft.server.v1_16_R1.Entity entity, Long cancelTime) {
|
||||||
getTeam(color).removeEntry(asEntry(entity));
|
getTeam(color).removeEntry(asEntry(entity));
|
||||||
if (cancelTime != null && System.currentTimeMillis() >= cancelTime) {
|
if (cancelTime != null && System.currentTimeMillis() >= cancelTime) {
|
||||||
entities.remove(entity);
|
entities.remove(entity);
|
||||||
for (Entry<Player, GlowData<net.minecraft.server.v1_15_R1.Entity>> entry : playerGlows.entrySet()) {
|
for (Entry<Player, GlowData<net.minecraft.server.v1_16_R1.Entity>> entry : playerGlows.entrySet()) {
|
||||||
if (!entry.getValue().glowingBlocks.containsValue(entity)) {
|
if (!entry.getValue().glowingBlocks.containsValue(entity)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.2.1</version>
|
<version>3.2.4</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
4
pom.xml
4
pom.xml
@ -21,13 +21,13 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.source>1.8</maven.compiler.source>
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
<maven.compiler.target>1.8</maven.compiler.target>
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
<spigotVersion.latest>1.15.2-R0.1-SNAPSHOT</spigotVersion.latest>
|
<spigotVersion.latest>1.16.1-R0.1-SNAPSHOT</spigotVersion.latest>
|
||||||
</properties>
|
</properties>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>de.erethon.commons</groupId>
|
<groupId>de.erethon.commons</groupId>
|
||||||
<artifactId>commons-dist</artifactId>
|
<artifactId>commons-dist</artifactId>
|
||||||
<version>6.1.4</version>
|
<version>6.2</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
Loading…
Reference in New Issue
Block a user