mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-09-28 15:17:43 +02:00
Work around chunk unload change
This commit is contained in:
parent
b7d43bf13b
commit
ca8d9c41ea
@ -146,7 +146,7 @@ public class EventListen implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onChunkUnload(ChunkUnloadEvent event) {
|
public void onChunkUnload(final ChunkUnloadEvent event) {
|
||||||
ChunkCoord coord = toCoord(event.getChunk());
|
ChunkCoord coord = toCoord(event.getChunk());
|
||||||
Location loc = new Location(null, 0, 0, 0);
|
Location loc = new Location(null, 0, 0, 0);
|
||||||
for (NPC npc : getAllNPCs()) {
|
for (NPC npc : getAllNPCs()) {
|
||||||
@ -160,7 +160,17 @@ public class EventListen implements Listener {
|
|||||||
try {
|
try {
|
||||||
((Cancellable) event).setCancelled(true);
|
((Cancellable) event).setCancelled(true);
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
// TODO: event.getChunk().setForceLoaded(true);
|
// TODO: event.getChunk().setForceLoaded(true); ?
|
||||||
|
toRespawn.put(coord, npc);
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (!event.getChunk().isLoaded()) {
|
||||||
|
event.getChunk().load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, 10);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
if (Messaging.isDebugging()) {
|
if (Messaging.isDebugging()) {
|
||||||
Messaging.debug("Cancelled chunk unload at [" + coord.x + "," + coord.z + "]");
|
Messaging.debug("Cancelled chunk unload at [" + coord.x + "," + coord.z + "]");
|
||||||
|
@ -187,7 +187,6 @@ public class SkinPacketTracker {
|
|||||||
|
|
||||||
if (location.distanceSquared(CACHE_LOCATION) > radius)
|
if (location.distanceSquared(CACHE_LOCATION) > radius)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
updateViewer(player);
|
updateViewer(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user