mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +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;
|
||||
}
|
||||
CreatureSpawnEvent.SpawnReason reason = event.getReason();
|
||||
switch (reason) {
|
||||
case DISPENSE_EGG:
|
||||
case EGG:
|
||||
case OCELOT_BABY:
|
||||
case SPAWNER_EGG:
|
||||
switch (reason.toString()) {
|
||||
case "DISPENSE_EGG":
|
||||
case "EGG":
|
||||
case "OCELOT_BABY":
|
||||
case "SPAWNER_EGG":
|
||||
if (!area.isSpawnEggs()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case REINFORCEMENTS:
|
||||
case NATURAL:
|
||||
case MOUNT:
|
||||
case PATROL:
|
||||
case RAID:
|
||||
case SHEARED:
|
||||
case SHOULDER_ENTITY:
|
||||
case SILVERFISH_BLOCK:
|
||||
case TRAP:
|
||||
case VILLAGE_DEFENSE:
|
||||
case VILLAGE_INVASION:
|
||||
case BEEHIVE:
|
||||
case CHUNK_GEN:
|
||||
case "REINFORCEMENTS":
|
||||
case "NATURAL":
|
||||
case "MOUNT":
|
||||
case "PATROL":
|
||||
case "RAID":
|
||||
case "SHEARED":
|
||||
case "SHOULDER_ENTITY":
|
||||
case "SILVERFISH_BLOCK":
|
||||
case "TRAP":
|
||||
case "VILLAGE_DEFENSE":
|
||||
case "VILLAGE_INVASION":
|
||||
case "BEEHIVE":
|
||||
case "CHUNK_GEN":
|
||||
if (!area.isMobSpawning()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
case BREEDING:
|
||||
case "BREEDING":
|
||||
if (!area.isSpawnBreeding()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case BUILD_IRONGOLEM:
|
||||
case BUILD_SNOWMAN:
|
||||
case BUILD_WITHER:
|
||||
case CUSTOM:
|
||||
case "BUILD_IRONGOLEM":
|
||||
case "BUILD_SNOWMAN":
|
||||
case "BUILD_WITHER":
|
||||
case "CUSTOM":
|
||||
if (!area.isSpawnCustom() && event.getType() != EntityType.ARMOR_STAND) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SPAWNER:
|
||||
case "SPAWNER":
|
||||
if (!area.isMobSpawnerSpawning()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
|
@ -2024,49 +2024,49 @@ public class PlayerEvents extends PlotListener implements Listener {
|
||||
return;
|
||||
}
|
||||
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
||||
switch (reason) {
|
||||
case DISPENSE_EGG:
|
||||
case EGG:
|
||||
case OCELOT_BABY:
|
||||
case SPAWNER_EGG:
|
||||
switch (reason.toString()) {
|
||||
case "DISPENSE_EGG":
|
||||
case "EGG":
|
||||
case "OCELOT_BABY":
|
||||
case "SPAWNER_EGG":
|
||||
if (!area.isSpawnEggs()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case REINFORCEMENTS:
|
||||
case NATURAL:
|
||||
case MOUNT:
|
||||
case PATROL:
|
||||
case RAID:
|
||||
case SHEARED:
|
||||
case SHOULDER_ENTITY:
|
||||
case SILVERFISH_BLOCK:
|
||||
case TRAP:
|
||||
case VILLAGE_DEFENSE:
|
||||
case VILLAGE_INVASION:
|
||||
case BEEHIVE:
|
||||
case CHUNK_GEN:
|
||||
case "REINFORCEMENTS":
|
||||
case "NATURAL":
|
||||
case "MOUNT":
|
||||
case "PATROL":
|
||||
case "RAID":
|
||||
case "SHEARED":
|
||||
case "SHOULDER_ENTITY":
|
||||
case "SILVERFISH_BLOCK":
|
||||
case "TRAP":
|
||||
case "VILLAGE_DEFENSE":
|
||||
case "VILLAGE_INVASION":
|
||||
case "BEEHIVE":
|
||||
case "CHUNK_GEN":
|
||||
if (!area.isMobSpawning()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
case BREEDING:
|
||||
case "BREEDING":
|
||||
if (!area.isSpawnBreeding()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case BUILD_IRONGOLEM:
|
||||
case BUILD_SNOWMAN:
|
||||
case BUILD_WITHER:
|
||||
case CUSTOM:
|
||||
case "BUILD_IRONGOLEM":
|
||||
case "BUILD_SNOWMAN":
|
||||
case "BUILD_WITHER":
|
||||
case "CUSTOM":
|
||||
if (!area.isSpawnCustom() && entity.getType() != EntityType.ARMOR_STAND) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case SPAWNER:
|
||||
case "SPAWNER":
|
||||
if (!area.isMobSpawnerSpawning()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user