Temp fix for new 1.14 builds

This commit is contained in:
fullwall 2019-04-26 23:39:15 +08:00
parent 53efb60b68
commit cf874bd301
2 changed files with 16 additions and 1 deletions

View File

@ -15,6 +15,7 @@ import org.bukkit.entity.FishHook;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Minecart;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
@ -156,7 +157,11 @@ public class EventListen implements Listener {
if (!sameChunkCoordinates || !event.getWorld().equals(loc.getWorld()))
continue;
if (!npc.despawn(DespawnReason.CHUNK_UNLOAD)) {
event.setCancelled(true);
try {
((Cancellable) event).setCancelled(true);
} catch (Throwable e) {
// TODO: event.getChunk().setForceLoaded(true);
}
if (Messaging.isDebugging()) {
Messaging.debug("Cancelled chunk unload at [" + coord.x + "," + coord.z + "]");
}

View File

@ -1,6 +1,8 @@
package net.citizensnpcs.commands;
import org.bukkit.ChunkSnapshot;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import net.citizensnpcs.Citizens;
import net.citizensnpcs.api.command.Command;
@ -28,6 +30,14 @@ public class AdminCommands {
Messaging.send(sender, " <7>-- <c>Written by fullwall and aPunch");
Messaging.send(sender, " <7>-- <c>Source Code: http://github.com/CitizensDev");
Messaging.send(sender, " <7>-- <c>Website: " + plugin.getDescription().getWebsite());
ChunkSnapshot cs = ((Player) sender).getLocation().getChunk().getChunkSnapshot();
for (int y = 79; y < 79 + 16; y++) {
for (int x = 0; x < 16; x++) {
for (int z = 0; z < 16; z++) {
System.out.println(x + " " + y + " " + z + " " + cs.getBlockType(x, y, z));
}
}
}
}
@Command(