diff --git a/modules/Movecraft/src/main/java/net/countercraft/movecraft/async/AsyncManager.java b/modules/Movecraft/src/main/java/net/countercraft/movecraft/async/AsyncManager.java index 4677f1389..a82bd5085 100644 --- a/modules/Movecraft/src/main/java/net/countercraft/movecraft/async/AsyncManager.java +++ b/modules/Movecraft/src/main/java/net/countercraft/movecraft/async/AsyncManager.java @@ -925,6 +925,7 @@ private void clear(Craft c) { private void clearAll() { for (Craft c : clearanceSet) { + c.setTranslating(false); c.setProcessing(false); } diff --git a/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/ChunkManager.java b/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/ChunkManager.java index ef1330b0d..d0d4a6151 100644 --- a/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/ChunkManager.java +++ b/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/ChunkManager.java @@ -59,7 +59,7 @@ public void run() { ChunkManager.removeChunksToLoad(list); } - }.runTaskLaterAsynchronously(Movecraft.getInstance(), 200L); + }.runTaskLater(Movecraft.getInstance(), 200L); } private static void removeChunksToLoad(List list) { diff --git a/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java b/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java index 688a8c190..ae7d0b164 100644 --- a/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java +++ b/modules/Movecraft/src/main/java/net/countercraft/movecraft/craft/CraftManager.java @@ -47,9 +47,11 @@ public class CraftManager implements Iterable{ @NotNull private final ConcurrentMap releaseEvents = new ConcurrentHashMap<>(); @NotNull private Set craftTypes; @NotNull private final WeakHashMap overboards = new WeakHashMap<>(); + private static Thread serverThread; public static void initialize(){ ourInstance = new CraftManager(); + serverThread = Thread.currentThread(); } private CraftManager() { @@ -166,7 +168,7 @@ public void addCraft(@NotNull Craft c, @Nullable Player p) { } public void removeCraft(@NotNull Craft c, @NotNull CraftReleaseEvent.Reason reason) { - CraftReleaseEvent e = new CraftReleaseEvent(c, reason); + CraftReleaseEvent e = new CraftReleaseEvent(c, reason, serverThread != Thread.currentThread()); Bukkit.getServer().getPluginManager().callEvent(e); if (e.isCancelled()) return; diff --git a/modules/Movecraft/src/main/java/net/countercraft/movecraft/worldguard/WorldGuardCompatManager.java b/modules/Movecraft/src/main/java/net/countercraft/movecraft/worldguard/WorldGuardCompatManager.java index 7f7319bda..a79802682 100644 --- a/modules/Movecraft/src/main/java/net/countercraft/movecraft/worldguard/WorldGuardCompatManager.java +++ b/modules/Movecraft/src/main/java/net/countercraft/movecraft/worldguard/WorldGuardCompatManager.java @@ -46,13 +46,13 @@ public static void registerFlags() { flags = WorldGuard.getInstance().getFlagRegistry(); } Movecraft.getInstance().getLogger().info("Registered custom flags"); - if (flags.get("movecraft-move") != null) + if (flags.get("movecraft-move") == null) flags.register(FLAG_MOVE); - if (flags.get("movecraft-pilot") != null) + if (flags.get("movecraft-pilot") == null) flags.register(FLAG_PILOT); - if (flags.get("movecraft-rotate") != null) + if (flags.get("movecraft-rotate") == null) flags.register(FLAG_ROTATE); - if (flags.get("movecraft-sink") != null) + if (flags.get("movecraft-sink") == null) flags.register(FLAG_SINK); } diff --git a/modules/api/dependency-reduced-pom.xml b/modules/api/dependency-reduced-pom.xml index 5ac148d35..ba21c924d 100644 --- a/modules/api/dependency-reduced-pom.xml +++ b/modules/api/dependency-reduced-pom.xml @@ -159,6 +159,12 @@ + + com.destroystokyo.paper + paper-api + 1.16.4-R0.1-SNAPSHOT + provided + 1.2.0 diff --git a/modules/api/src/main/java/net/countercraft/movecraft/WorldHandler.java b/modules/api/src/main/java/net/countercraft/movecraft/WorldHandler.java index 9d49ced9a..eb57b977b 100644 --- a/modules/api/src/main/java/net/countercraft/movecraft/WorldHandler.java +++ b/modules/api/src/main/java/net/countercraft/movecraft/WorldHandler.java @@ -22,4 +22,8 @@ public void addPlayerLocation(Player player, double x, double y, double z, float player.teleport(tpLoc); player.sendBlockChange(tpLoc.subtract(0,1,0), standingOn.getType(), standingOn.getData()); } + + public void loadChunk(MovecraftChunk chunk) { + chunk.getWorld().loadChunk(chunk.getX(), chunk.getZ()); + } } diff --git a/modules/api/src/main/java/net/countercraft/movecraft/events/CraftReleaseEvent.java b/modules/api/src/main/java/net/countercraft/movecraft/events/CraftReleaseEvent.java index 768d8fb7c..ca471e882 100644 --- a/modules/api/src/main/java/net/countercraft/movecraft/events/CraftReleaseEvent.java +++ b/modules/api/src/main/java/net/countercraft/movecraft/events/CraftReleaseEvent.java @@ -20,6 +20,11 @@ public CraftReleaseEvent(@NotNull Craft craft, @NotNull Reason reason) { this.reason = reason; } + public CraftReleaseEvent(@NotNull Craft craft, @NotNull Reason reason, boolean isAsync) { + super(craft, isAsync); + this.reason = reason; + } + @NotNull public Reason getReason() { return reason; diff --git a/modules/v1_15_R1/src/main/java/net/countercraft/movecraft/compat/v1_15_R1/IWorldHandler.java b/modules/v1_15_R1/src/main/java/net/countercraft/movecraft/compat/v1_15_R1/IWorldHandler.java index 2f234520f..6d380677b 100644 --- a/modules/v1_15_R1/src/main/java/net/countercraft/movecraft/compat/v1_15_R1/IWorldHandler.java +++ b/modules/v1_15_R1/src/main/java/net/countercraft/movecraft/compat/v1_15_R1/IWorldHandler.java @@ -1,5 +1,6 @@ package net.countercraft.movecraft.compat.v1_15_R1; +import net.countercraft.movecraft.MovecraftChunk; import net.countercraft.movecraft.MovecraftLocation; import net.countercraft.movecraft.Rotation; import net.countercraft.movecraft.WorldHandler; @@ -49,6 +50,12 @@ public IWorldHandler() { } } + @Override + public void loadChunk(MovecraftChunk chunk) { + final WorldServer world = ((CraftWorld) chunk.getWorld()).getHandle(); + world.getChunkProvider().getChunkAt(chunk.getX(), chunk.getZ(), ChunkStatus.FULL, true); + } + @Override public void rotateCraft(@NotNull Craft craft, @NotNull MovecraftLocation originPoint, @NotNull Rotation rotation) { //******************************************* diff --git a/pom.xml b/pom.xml index bddb33114..ebc1673f1 100644 --- a/pom.xml +++ b/pom.xml @@ -7,9 +7,10 @@ parent - org.spigotmc - spigot-api - 1.15-R0.1-SNAPSHOT + com.destroystokyo.paper + paper-api + 1.16.4-R0.1-SNAPSHOT + provided Movecraft Parent Pom @@ -43,6 +44,10 @@ spigot-repo https://hub.spigotmc.org/nexus/content/groups/public/ + + papermc + https://papermc.io/repo/repository/maven-public/ +