Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikh1996 committed Dec 6, 2020
1 parent 8d1b3c1 commit 5c5e718
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -925,6 +925,7 @@ private void clear(Craft c) {

private void clearAll() {
for (Craft c : clearanceSet) {
c.setTranslating(false);
c.setProcessing(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void run() {
ChunkManager.removeChunksToLoad(list);
}

}.runTaskLaterAsynchronously(Movecraft.getInstance(), 200L);
}.runTaskLater(Movecraft.getInstance(), 200L);
}

private static void removeChunksToLoad(List<MovecraftChunk> list) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ public class CraftManager implements Iterable<Craft>{
@NotNull private final ConcurrentMap<Craft, BukkitTask> releaseEvents = new ConcurrentHashMap<>();
@NotNull private Set<CraftType> craftTypes;
@NotNull private final WeakHashMap<Player, Long> overboards = new WeakHashMap<>();
private static Thread serverThread;

public static void initialize(){
ourInstance = new CraftManager();
serverThread = Thread.currentThread();
}

private CraftManager() {
Expand Down Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
6 changes: 6 additions & 0 deletions modules/api/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,12 @@
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<properties>
<junit.platform.version>1.2.0</junit.platform.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -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) {
//*******************************************
Expand Down
11 changes: 8 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@
<version>parent</version>
<dependencies>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.15-R0.1-SNAPSHOT</version>
<groupId>com.destroystokyo.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.16.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<name>Movecraft Parent Pom</name>
Expand Down Expand Up @@ -43,6 +44,10 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/groups/public/</url>
</repository>
<repository>
<id>papermc</id>
<url>https://papermc.io/repo/repository/maven-public/</url>
</repository>
</repositories>

<build>
Expand Down

0 comments on commit 5c5e718

Please sign in to comment.