mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Don't try to remove players. Fixes #2742.
This commit is contained in:
parent
7841ee3dcc
commit
e4a6bd0ca5
@ -39,7 +39,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
private static boolean hasPlotArea = false;
|
private static boolean hasPlotArea = false;
|
||||||
private static String areaName = null;
|
private static String areaName = null;
|
||||||
|
|
||||||
public static void testNether(Entity entity) {
|
public static void testNether(final Entity entity) {
|
||||||
@NotNull World world = entity.getWorld();
|
@NotNull World world = entity.getWorld();
|
||||||
if (world.getEnvironment() != World.Environment.NETHER
|
if (world.getEnvironment() != World.Environment.NETHER
|
||||||
&& world.getEnvironment() != World.Environment.THE_END) {
|
&& world.getEnvironment() != World.Environment.THE_END) {
|
||||||
@ -48,15 +48,15 @@ public class EntitySpawnListener implements Listener {
|
|||||||
test(entity);
|
test(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void testCreate(Entity entity) {
|
public static void testCreate(final Entity entity) {
|
||||||
@NotNull World world = entity.getWorld();
|
@NotNull World world = entity.getWorld();
|
||||||
if (areaName == world.getName()) {
|
if (!areaName.equals(world.getName())) {
|
||||||
} else {
|
|
||||||
areaName = world.getName();
|
areaName = world.getName();
|
||||||
hasPlotArea = PlotSquared.get().hasPlotArea(areaName);
|
hasPlotArea = PlotSquared.get().hasPlotArea(areaName);
|
||||||
}
|
}
|
||||||
if (!hasPlotArea)
|
if (!hasPlotArea) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
test(entity);
|
test(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,15 +76,21 @@ public class EntitySpawnListener implements Listener {
|
|||||||
if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) {
|
if (!world.getName().equalsIgnoreCase(originWorld + "_the_end")) {
|
||||||
try {
|
try {
|
||||||
ignoreTP = true;
|
ignoreTP = true;
|
||||||
PaperLib.teleportAsync(entity,origin);
|
PaperLib.teleportAsync(entity, origin);
|
||||||
} finally {
|
} finally {
|
||||||
ignoreTP = false;
|
ignoreTP = false;
|
||||||
}
|
}
|
||||||
|
if (entity.getType() == EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (entity.getLocation().getWorld().equals(world)) {
|
if (entity.getLocation().getWorld().equals(world)) {
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (entity.getType() == EntityType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
entity.remove();
|
entity.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -136,7 +142,7 @@ public class EntitySpawnListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler public void onChunkLoad(ChunkLoadEvent event) {
|
@EventHandler public void onChunkLoad(ChunkLoadEvent event) {
|
||||||
@NotNull Chunk chunk = event.getChunk();
|
@NotNull Chunk chunk = event.getChunk();
|
||||||
for (Entity entity : chunk.getEntities()) {
|
for (final Entity entity : chunk.getEntities()) {
|
||||||
testCreate(entity);
|
testCreate(entity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user