From 1118901ca2de68644e3cf5ef2b01ac13060c6967 Mon Sep 17 00:00:00 2001 From: MattBDev <4009945+MattBDev@users.noreply.github.com> Date: Tue, 23 Apr 2019 13:45:24 -0400 Subject: [PATCH] Initial 1.14 Update --- Bukkit/build.gradle | 3 +- .../plotsquared/bukkit/BukkitMain.java | 11 +++---- .../bukkit/listeners/ChunkListener.java | 10 +++---- .../bukkit/listeners/PlayerEvents.java | 8 ++--- .../entity/ReplicatingEntityWrapper.java | 29 +++++++++---------- .../bukkit/util/BukkitChunkManager.java | 11 ++++--- .../bukkit/util/BukkitHybridUtils.java | 2 +- .../bukkit/util/BukkitSetupUtils.java | 4 +-- .../plotsquared/bukkit/util/BukkitUtil.java | 4 +-- .../plotsquared/bukkit/util/SendChunk.java | 2 +- 10 files changed, 37 insertions(+), 47 deletions(-) diff --git a/Bukkit/build.gradle b/Bukkit/build.gradle index b7c87d99c..c22f4d681 100644 --- a/Bukkit/build.gradle +++ b/Bukkit/build.gradle @@ -9,7 +9,7 @@ repositories { dependencies { implementation project(':Core') compile project(':Core') - compile 'org.spigotmc:spigot-api:1.13.2-R0.1-SNAPSHOT' + compile 'org.spigotmc:spigot-api:1.14-pre5-SNAPSHOT' compile(group: 'com.sk89q.worldedit', name: 'worldedit-bukkit', version: '7.0.0-SNAPSHOT') compile(group: 'org.bstats', name: 'bstats-bukkit', version: '1.4') compile("net.milkbowl.vault:VaultAPI:1.7") { @@ -43,7 +43,6 @@ shadowJar { include(dependency('com.squareup.okio:okio:2.2.2')) include(dependency('org.jetbrains.kotlin:kotlin-stdlib:1.3.21')) } - // relocate('org.mcstats', 'com.plotsquared.stats') archiveName = "${parent.name}-${project.name}-${parent.version}.jar" destinationDir = file '../target' } diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java index 340197c5a..93ee1c8ac 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/BukkitMain.java @@ -247,7 +247,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain } } else { result = world - .unloadChunk(chunkI.getX(), chunkI.getZ(), true, false); + .unloadChunk(chunkI.getX(), chunkI.getZ(), true); } if (!result) { continue outer; @@ -332,15 +332,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain Entity entity = iterator.next(); switch (entity.getType()) { case EGG: - case COMPLEX_PART: case FISHING_HOOK: case ENDER_SIGNAL: - case LINGERING_POTION: case AREA_EFFECT_CLOUD: case EXPERIENCE_ORB: case LEASH_HITCH: case FIREWORK: - case WEATHER: case LIGHTNING: case WITHER_SKULL: case UNKNOWN: @@ -352,7 +349,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain case SNOWBALL: case SHULKER_BULLET: case SPECTRAL_ARROW: - case TIPPED_ARROW: case ENDER_PEARL: case ARROW: case LLAMA_SPIT: @@ -421,12 +417,12 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain if (Settings.Enabled_Components.KILL_ROAD_MOBS) { LivingEntity livingEntity = (LivingEntity) entity; List meta = entity.getMetadata("plot"); - if (meta != null && !meta.isEmpty()) { + if (!meta.isEmpty()) { if (livingEntity.isLeashed()) { continue; } List keep = entity.getMetadata("keep"); - if (keep != null && !keep.isEmpty()) { + if (!keep.isEmpty()) { continue; } @@ -774,6 +770,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain return; } } + assert world != null; ChunkGenerator gen = world.getGenerator(); if (gen instanceof BukkitPlotGenerator) { PlotSquared.get().loadWorld(worldName, (BukkitPlotGenerator) gen); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java index 902aa86b5..82dd29531 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/ChunkListener.java @@ -94,7 +94,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils if (System.currentTimeMillis() - start > 5) { return; } - chunk.unload(true, false); + chunk.unload(true); } } catch (Throwable e) { e.printStackTrace(); @@ -112,7 +112,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils field.set(false); if (chunk.isLoaded()) { ignoreUnload = true; - chunk.unload(false, false); + chunk.unload(false); ignoreUnload = false; } } @@ -225,7 +225,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils TaskManager.tasks.remove(currentIndex); PlotSquared .debug(Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); - chunk.unload(true, true); + chunk.unload(true); return; } BlockState[] tiles = chunk.getTileEntities(); @@ -234,7 +234,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils TaskManager.tasks.remove(currentIndex); PlotSquared .debug(Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); - chunk.unload(true, true); + chunk.unload(true); return; } long start = System.currentTimeMillis(); @@ -245,7 +245,7 @@ import static com.github.intellectualsites.plotsquared.plot.util.ReflectionUtils TaskManager.tasks.remove(currentIndex); PlotSquared.debug( Captions.PREFIX.s() + "&aSuccessfully processed and unloaded chunk!"); - chunk.unload(true, true); + chunk.unload(true); return; } tiles[i].getBlock().setType(Material.AIR, false); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java index 33e0093f8..c611e80f4 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/listeners/PlayerEvents.java @@ -108,7 +108,6 @@ import java.util.regex.Pattern; case EGG: case ENDER_PEARL: case FIREBALL: - case LINGERING_POTION: case LLAMA_SPIT: case SHULKER_BULLET: case SMALL_FIREBALL: @@ -116,13 +115,11 @@ import java.util.regex.Pattern; case SPECTRAL_ARROW: case SPLASH_POTION: case THROWN_EXP_BOTTLE: - case TIPPED_ARROW: // projectile case FALLING_BLOCK: case PRIMED_TNT: // Block entities case AREA_EFFECT_CLOUD: - case COMPLEX_PART: case ENDER_CRYSTAL: case ENDER_SIGNAL: case EVOKER_FANGS: @@ -132,7 +129,6 @@ import java.util.regex.Pattern; case LEASH_HITCH: case LIGHTNING: case UNKNOWN: - case WEATHER: case WITHER_SKULL: // non moving / unmovable return EntityUtil.checkEntity(plot, Flags.ENTITY_CAP); @@ -1956,8 +1952,8 @@ import java.util.regex.Pattern; case CHAIN_COMMAND_BLOCK: case REPEATING_COMMAND_BLOCK: - case SIGN: - case WALL_SIGN: + case LEGACY_SIGN: + case LEGACY_WALL_SIGN: case REDSTONE_TORCH: case REDSTONE_WALL_TORCH: diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java index f05555947..b569e6577 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/object/entity/ReplicatingEntityWrapper.java @@ -63,7 +63,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType()); return; case ARROW: - case COMPLEX_PART: case EGG: case ENDER_CRYSTAL: case ENDER_PEARL: @@ -87,14 +86,11 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { case MINECART_FURNACE: case SPLASH_POTION: case THROWN_EXP_BOTTLE: - case WEATHER: case WITHER_SKULL: case UNKNOWN: - case TIPPED_ARROW: case SPECTRAL_ARROW: case SHULKER_BULLET: case DRAGON_FIREBALL: - case LINGERING_POTION: case AREA_EFFECT_CLOUD: case TRIDENT: case LLAMA_SPIT: @@ -164,9 +160,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { storeLiving((LivingEntity) entity); return; // END TAMEABLE // + //todo fix sheep case SHEEP: Sheep sheep = (Sheep) entity; - this.dataByte = (byte) (sheep.isSheared() ? 1 : 0); + if (sheep.isSheared()) { + this.dataByte = (byte) 1; + } else { + this.dataByte = (byte) 0; + } this.dataByte2 = sheep.getColor().getDyeData(); storeAgeable(sheep); storeLiving(sheep); @@ -324,12 +325,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { void restoreEquipment(LivingEntity entity) { EntityEquipment equipment = entity.getEquipment(); - equipment.setItemInMainHand(this.lived.mainHand); - equipment.setItemInOffHand(this.lived.offHand); - equipment.setHelmet(this.lived.helmet); - equipment.setChestplate(this.lived.chestplate); - equipment.setLeggings(this.lived.leggings); - equipment.setBoots(this.lived.boots); + if (equipment != null) { + equipment.setItemInMainHand(this.lived.mainHand); + equipment.setItemInOffHand(this.lived.offHand); + equipment.setHelmet(this.lived.helmet); + equipment.setChestplate(this.lived.chestplate); + equipment.setLeggings(this.lived.leggings); + equipment.setBoots(this.lived.boots); + } } private void restoreInventory(InventoryHolder entity) { @@ -462,7 +465,6 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { ((Slime) entity).setSize(this.dataByte); return entity; case ARROW: - case COMPLEX_PART: case EGG: case ENDER_CRYSTAL: case ENDER_PEARL: @@ -485,11 +487,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper { case SNOWBALL: case SPLASH_POTION: case THROWN_EXP_BOTTLE: - case WEATHER: - case TIPPED_ARROW: case SPECTRAL_ARROW: case SHULKER_BULLET: - case LINGERING_POTION: case AREA_EFFECT_CLOUD: case DRAGON_FIREBALL: case WITHER_SKULL: diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java index 02c24362a..099b5b3fc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitChunkManager.java @@ -395,9 +395,9 @@ public class BukkitChunkManager extends ChunkManager { final boolean safe) { if (!PlotSquared.get().isMainThread(Thread.currentThread())) { TaskManager - .runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe)); + .runTask(() -> BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save)); } else { - BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe); + BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save); } } @@ -466,7 +466,6 @@ public class BukkitChunkManager extends ChunkManager { case ENDER_PEARL: case ARROW: case TRIDENT: - case TIPPED_ARROW: case SHULKER_BULLET: case SPECTRAL_ARROW: case DRAGON_FIREBALL: @@ -476,18 +475,15 @@ public class BukkitChunkManager extends ChunkManager { case FALLING_BLOCK: // Block entities case ENDER_CRYSTAL: - case COMPLEX_PART: case FISHING_HOOK: case ENDER_SIGNAL: case EXPERIENCE_ORB: case LEASH_HITCH: case FIREWORK: - case WEATHER: case LIGHTNING: case WITHER_SKULL: case UNKNOWN: case AREA_EFFECT_CLOUD: - case LINGERING_POTION: case EVOKER_FANGS: // non moving / unremovable break; @@ -534,6 +530,9 @@ public class BukkitChunkManager extends ChunkManager { case SALMON: case PUFFERFISH: case TROPICAL_FISH: + case CAT: + case FOX: + case PANDA: // animal count[3]++; count[1]++; diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java index dace8ab26..fb0d20fbc 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitHybridUtils.java @@ -304,7 +304,7 @@ public class BukkitHybridUtils extends HybridUtils { } } } - worldObj.unloadChunkRequest(X, Z, true); + worldObj.unloadChunkRequest(X, Z); } }, () -> TaskManager.runTaskAsync(run), 5); }); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java index ad3de7cd3..8309203ef 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitSetupUtils.java @@ -61,11 +61,11 @@ public class BukkitSetupUtils extends SetupUtils { } if (save) { for (Chunk chunk : world.getLoadedChunks()) { - chunk.unload(true, false); + chunk.unload(true); } } else { for (Chunk chunk : world.getLoadedChunks()) { - chunk.unload(false, false); + chunk.unload(false); } } Bukkit.unloadWorld(world, false); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java index a1a358737..8b6ea0ec8 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/BukkitUtil.java @@ -331,7 +331,7 @@ import java.util.*; final Block block = world.getBlockAt(x, y, z); // block.setType(Material.AIR); final Material type = block.getType(); - if (type != Material.SIGN && type != Material.WALL_SIGN) { + if (type != Material.LEGACY_SIGN && type != Material.LEGACY_WALL_SIGN) { BlockFace facing = BlockFace.EAST; if (world.getBlockAt(x, y, z + 1).getType().isSolid()) { facing = BlockFace.NORTH; @@ -340,7 +340,7 @@ import java.util.*; } else if (world.getBlockAt(x, y, z - 1).getType().isSolid()) { facing = BlockFace.SOUTH; } - block.setType(Material.WALL_SIGN, false); + block.setType(Material.LEGACY_WALL_SIGN, false); final WallSign sign = (WallSign) block.getBlockData(); sign.setFacing(facing); block.setBlockData(sign, false); diff --git a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java index cecea15ff..62d82cedb 100644 --- a/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java +++ b/Bukkit/src/main/java/com/github/intellectualsites/plotsquared/bukkit/util/SendChunk.java @@ -116,7 +116,7 @@ public class SendChunk { for (final Chunk chunk : chunks) { TaskManager.runTask(() -> { try { - chunk.unload(true, false); + chunk.unload(true); } catch (Throwable ignored) { String worldName = chunk.getWorld().getName(); PlotSquared.debug(