mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 12:35:15 +01:00
use strings for spawn reasons to be safe
This commit is contained in:
parent
729469e030
commit
daee26681a
@ -157,53 +157,53 @@ public class PaperListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreatureSpawnEvent.SpawnReason reason = event.getReason();
|
CreatureSpawnEvent.SpawnReason reason = event.getReason();
|
||||||
switch (reason) {
|
switch (reason.toString()) {
|
||||||
case DISPENSE_EGG:
|
case "DISPENSE_EGG":
|
||||||
case EGG:
|
case "EGG":
|
||||||
case OCELOT_BABY:
|
case "OCELOT_BABY":
|
||||||
case SPAWNER_EGG:
|
case "SPAWNER_EGG":
|
||||||
if (!area.isSpawnEggs()) {
|
if (!area.isSpawnEggs()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REINFORCEMENTS:
|
case "REINFORCEMENTS":
|
||||||
case NATURAL:
|
case "NATURAL":
|
||||||
case MOUNT:
|
case "MOUNT":
|
||||||
case PATROL:
|
case "PATROL":
|
||||||
case RAID:
|
case "RAID":
|
||||||
case SHEARED:
|
case "SHEARED":
|
||||||
case SHOULDER_ENTITY:
|
case "SHOULDER_ENTITY":
|
||||||
case SILVERFISH_BLOCK:
|
case "SILVERFISH_BLOCK":
|
||||||
case TRAP:
|
case "TRAP":
|
||||||
case VILLAGE_DEFENSE:
|
case "VILLAGE_DEFENSE":
|
||||||
case VILLAGE_INVASION:
|
case "VILLAGE_INVASION":
|
||||||
case BEEHIVE:
|
case "BEEHIVE":
|
||||||
case CHUNK_GEN:
|
case "CHUNK_GEN":
|
||||||
if (!area.isMobSpawning()) {
|
if (!area.isMobSpawning()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case BREEDING:
|
case "BREEDING":
|
||||||
if (!area.isSpawnBreeding()) {
|
if (!area.isSpawnBreeding()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUILD_IRONGOLEM:
|
case "BUILD_IRONGOLEM":
|
||||||
case BUILD_SNOWMAN:
|
case "BUILD_SNOWMAN":
|
||||||
case BUILD_WITHER:
|
case "BUILD_WITHER":
|
||||||
case CUSTOM:
|
case "CUSTOM":
|
||||||
if (!area.isSpawnCustom() && event.getType() != EntityType.ARMOR_STAND) {
|
if (!area.isSpawnCustom() && event.getType() != EntityType.ARMOR_STAND) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPAWNER:
|
case "SPAWNER":
|
||||||
if (!area.isMobSpawnerSpawning()) {
|
if (!area.isMobSpawnerSpawning()) {
|
||||||
event.setShouldAbortSpawn(true);
|
event.setShouldAbortSpawn(true);
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -2024,49 +2024,49 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
||||||
switch (reason) {
|
switch (reason.toString()) {
|
||||||
case DISPENSE_EGG:
|
case "DISPENSE_EGG":
|
||||||
case EGG:
|
case "EGG":
|
||||||
case OCELOT_BABY:
|
case "OCELOT_BABY":
|
||||||
case SPAWNER_EGG:
|
case "SPAWNER_EGG":
|
||||||
if (!area.isSpawnEggs()) {
|
if (!area.isSpawnEggs()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case REINFORCEMENTS:
|
case "REINFORCEMENTS":
|
||||||
case NATURAL:
|
case "NATURAL":
|
||||||
case MOUNT:
|
case "MOUNT":
|
||||||
case PATROL:
|
case "PATROL":
|
||||||
case RAID:
|
case "RAID":
|
||||||
case SHEARED:
|
case "SHEARED":
|
||||||
case SHOULDER_ENTITY:
|
case "SHOULDER_ENTITY":
|
||||||
case SILVERFISH_BLOCK:
|
case "SILVERFISH_BLOCK":
|
||||||
case TRAP:
|
case "TRAP":
|
||||||
case VILLAGE_DEFENSE:
|
case "VILLAGE_DEFENSE":
|
||||||
case VILLAGE_INVASION:
|
case "VILLAGE_INVASION":
|
||||||
case BEEHIVE:
|
case "BEEHIVE":
|
||||||
case CHUNK_GEN:
|
case "CHUNK_GEN":
|
||||||
if (!area.isMobSpawning()) {
|
if (!area.isMobSpawning()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case BREEDING:
|
case "BREEDING":
|
||||||
if (!area.isSpawnBreeding()) {
|
if (!area.isSpawnBreeding()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BUILD_IRONGOLEM:
|
case "BUILD_IRONGOLEM":
|
||||||
case BUILD_SNOWMAN:
|
case "BUILD_SNOWMAN":
|
||||||
case BUILD_WITHER:
|
case "BUILD_WITHER":
|
||||||
case CUSTOM:
|
case "CUSTOM":
|
||||||
if (!area.isSpawnCustom() && entity.getType() != EntityType.ARMOR_STAND) {
|
if (!area.isSpawnCustom() && entity.getType() != EntityType.ARMOR_STAND) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case SPAWNER:
|
case "SPAWNER":
|
||||||
if (!area.isMobSpawnerSpawning()) {
|
if (!area.isMobSpawnerSpawning()) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user