mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Wrap createEntity in BukkitWorld to detect corrupt entities.
This commit is contained in:
parent
334143357a
commit
88fc1771b5
@ -111,12 +111,21 @@ public class BukkitWorld extends AbstractWorld {
|
||||
public com.sk89q.worldedit.entity.Entity createEntity(com.sk89q.worldedit.util.Location location, BaseEntity entity) {
|
||||
BukkitImplAdapter adapter = WorldEditPlugin.getInstance().getBukkitImplAdapter();
|
||||
if (adapter != null) {
|
||||
try {
|
||||
Entity createdEntity = adapter.createEntity(BukkitAdapter.adapt(getWorld(), location), entity);
|
||||
if (createdEntity != null) {
|
||||
return new BukkitEntity(createdEntity);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
logger.warning("Corrupt entity found when creating: " + entity.getType().getId());
|
||||
if (entity.getNbtData() != null) {
|
||||
logger.warning(entity.getNbtData().toString());
|
||||
}
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user