mirror of
https://github.com/craftaro/EpicSpawners.git
synced 2025-01-08 11:37:51 +08:00
Fixes some NPEs
This commit is contained in:
parent
420d6038ad
commit
60849751a8
@ -209,7 +209,7 @@ public class InteractListeners implements Listener {
|
||||
if (isSpawner && item != null && XMaterial.SPAWNER == XMaterial.matchXMaterial(item)) {
|
||||
PlacedSpawner spawner = this.plugin.getSpawnerManager().getSpawnerFromWorld(location);
|
||||
|
||||
if (spawner.getPlacedBy() == null && Settings.DISABLE_NATURAL_SPAWNERS.getBoolean()) {
|
||||
if (spawner == null || (spawner.getPlacedBy() == null && Settings.DISABLE_NATURAL_SPAWNERS.getBoolean())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -609,7 +609,8 @@ public class PlacedSpawnerImpl implements PlacedSpawner {
|
||||
public Data deserialize(Map<String, Object> map) {
|
||||
int id = (int) map.get("id");
|
||||
int spawnCount = (int) map.get("spawn_count");
|
||||
UUID placedBy = UUID.fromString((String) map.get("placed_by"));
|
||||
String placedByString = (String) map.get("placed_by");
|
||||
UUID placedBy = placedByString != null ? UUID.fromString(placedByString) : null;
|
||||
Location location = SerializedLocation.of(map);
|
||||
return new PlacedSpawnerImpl(id, spawnCount, placedBy, location);
|
||||
}
|
||||
|
@ -89,6 +89,7 @@ public class SpawnerManagerImpl implements SpawnerManager {
|
||||
|
||||
@Override
|
||||
public SpawnerData getSpawnerData(EntityType type) {
|
||||
if (type == null) return null; //TODO fix this. Not sure why this is happening.
|
||||
return getSpawnerData(type.name());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user