mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-16 07:35:32 +01:00
Prevent chunk load respawning with SpawnReason.PLUGIN
This commit is contained in:
parent
12b796afa3
commit
675eaffad5
@ -415,8 +415,8 @@ public class EventListen implements Listener {
|
|||||||
|| event.getReason() == DespawnReason.RELOAD) {
|
|| event.getReason() == DespawnReason.RELOAD) {
|
||||||
if (event.getNPC().getStoredLocation() != null) {
|
if (event.getNPC().getStoredLocation() != null) {
|
||||||
ChunkCoord coord = new ChunkCoord(event.getNPC().getStoredLocation());
|
ChunkCoord coord = new ChunkCoord(event.getNPC().getStoredLocation());
|
||||||
Messaging.debug("Preventing further respawns of " + event.getNPC().getId() + " at [" + coord.x + ","
|
Messaging.debug("Preventing further respawns of", event.getNPC().getId(), "at", coord,
|
||||||
+ coord.z + "] due to DespawnReason." + event.getReason());
|
"due to DespawnReason." + event.getReason());
|
||||||
toRespawn.remove(coord, event.getNPC());
|
toRespawn.remove(coord, event.getNPC());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -447,6 +447,11 @@ public class EventListen implements Listener {
|
|||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onNPCSpawn(NPCSpawnEvent event) {
|
public void onNPCSpawn(NPCSpawnEvent event) {
|
||||||
skinUpdateTracker.onNPCSpawn(event.getNPC());
|
skinUpdateTracker.onNPCSpawn(event.getNPC());
|
||||||
|
Location location = event.getNPC().getStoredLocation();
|
||||||
|
if (location == null) {
|
||||||
|
location = event.getLocation();
|
||||||
|
}
|
||||||
|
toRespawn.remove(new ChunkCoord(location), event.getNPC());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(ignoreCancelled = true)
|
@EventHandler(ignoreCancelled = true)
|
||||||
|
Loading…
Reference in New Issue
Block a user