mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 13:46:45 +01:00
Migrate left-overs to enhanced switches
This commit is contained in:
parent
a5fdcda673
commit
ad522358c7
@ -101,50 +101,26 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
this.noGravity = true;
|
||||
}
|
||||
switch (entity.getType().toString()) {
|
||||
case "BOAT":
|
||||
case "BOAT" -> {
|
||||
Boat boat = (Boat) entity;
|
||||
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
||||
return;
|
||||
case "ARROW":
|
||||
case "EGG":
|
||||
case "ENDER_CRYSTAL":
|
||||
case "ENDER_PEARL":
|
||||
case "ENDER_SIGNAL":
|
||||
case "EXPERIENCE_ORB":
|
||||
case "FALLING_BLOCK":
|
||||
case "FIREBALL":
|
||||
case "FIREWORK":
|
||||
case "FISHING_HOOK":
|
||||
case "LEASH_HITCH":
|
||||
case "LIGHTNING":
|
||||
case "MINECART":
|
||||
case "MINECART_COMMAND":
|
||||
case "MINECART_MOB_SPAWNER":
|
||||
case "MINECART_TNT":
|
||||
case "PLAYER":
|
||||
case "PRIMED_TNT":
|
||||
case "SLIME":
|
||||
case "SMALL_FIREBALL":
|
||||
case "SNOWBALL":
|
||||
case "MINECART_FURNACE":
|
||||
case "SPLASH_POTION":
|
||||
case "THROWN_EXP_BOTTLE":
|
||||
case "WITHER_SKULL":
|
||||
case "UNKNOWN":
|
||||
case "SPECTRAL_ARROW":
|
||||
case "SHULKER_BULLET":
|
||||
case "DRAGON_FIREBALL":
|
||||
case "AREA_EFFECT_CLOUD":
|
||||
case "TRIDENT":
|
||||
case "LLAMA_SPIT":
|
||||
}
|
||||
case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "EXPERIENCE_ORB", "FALLING_BLOCK", "FIREBALL",
|
||||
"FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND", "MINECART_MOB_SPAWNER",
|
||||
"MINECART_TNT", "PLAYER", "PRIMED_TNT", "SLIME", "SMALL_FIREBALL", "SNOWBALL", "MINECART_FURNACE", "SPLASH_POTION",
|
||||
"THROWN_EXP_BOTTLE", "WITHER_SKULL", "UNKNOWN", "SPECTRAL_ARROW", "SHULKER_BULLET", "DRAGON_FIREBALL", "AREA_EFFECT_CLOUD",
|
||||
"TRIDENT", "LLAMA_SPIT" -> {
|
||||
// Do this stuff later
|
||||
return;
|
||||
}
|
||||
// MISC //
|
||||
case "DROPPED_ITEM":
|
||||
case "DROPPED_ITEM" -> {
|
||||
Item item = (Item) entity;
|
||||
this.stack = item.getItemStack();
|
||||
return;
|
||||
case "ITEM_FRAME":
|
||||
}
|
||||
case "ITEM_FRAME" -> {
|
||||
this.x = Math.floor(this.getX());
|
||||
this.y = Math.floor(this.getY());
|
||||
this.z = Math.floor(this.getZ());
|
||||
@ -152,7 +128,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
this.dataByte = getOrdinal(Rotation.values(), itemFrame.getRotation());
|
||||
this.stack = itemFrame.getItem().clone();
|
||||
return;
|
||||
case "PAINTING":
|
||||
}
|
||||
case "PAINTING" -> {
|
||||
this.x = Math.floor(this.getX());
|
||||
this.y = Math.floor(this.getY());
|
||||
this.z = Math.floor(this.getZ());
|
||||
@ -165,20 +142,17 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
this.dataString = art.name();
|
||||
return;
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case "MINECART_CHEST":
|
||||
case "MINECART_HOPPER":
|
||||
case "MINECART_CHEST", "MINECART_HOPPER" -> {
|
||||
storeInventory((InventoryHolder) entity);
|
||||
return;
|
||||
}
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case "HORSE":
|
||||
case "DONKEY":
|
||||
case "LLAMA":
|
||||
case "MULE":
|
||||
case "SKELETON_HORSE":
|
||||
case "HORSE", "DONKEY", "LLAMA", "MULE", "SKELETON_HORSE" -> {
|
||||
AbstractHorse horse = (AbstractHorse) entity;
|
||||
this.horse = new HorseStats();
|
||||
this.horse.jump = horse.getJumpStrength();
|
||||
@ -194,16 +168,17 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
storeLiving(horse);
|
||||
storeInventory(horse);
|
||||
return;
|
||||
}
|
||||
// END INVENTORY HOLDER //
|
||||
case "WOLF":
|
||||
case "OCELOT":
|
||||
case "WOLF", "OCELOT" -> {
|
||||
storeTameable((Tameable) entity);
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
// END TAMEABLE //
|
||||
//todo fix sheep
|
||||
case "SHEEP":
|
||||
case "SHEEP" -> {
|
||||
Sheep sheep = (Sheep) entity;
|
||||
if (sheep.isSheared()) {
|
||||
this.dataByte = (byte) 1;
|
||||
@ -214,23 +189,20 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
storeAgeable(sheep);
|
||||
storeLiving(sheep);
|
||||
return;
|
||||
case "VILLAGER":
|
||||
case "CHICKEN":
|
||||
case "COW":
|
||||
case "MUSHROOM_COW":
|
||||
case "PIG":
|
||||
case "TURTLE":
|
||||
case "POLAR_BEAR":
|
||||
}
|
||||
case "VILLAGER", "CHICKEN", "COW", "MUSHROOM_COW", "PIG", "TURTLE", "POLAR_BEAR" -> {
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
case "RABBIT":
|
||||
}
|
||||
case "RABBIT" -> {
|
||||
this.dataByte = getOrdinal(Rabbit.Type.values(), ((Rabbit) entity).getRabbitType());
|
||||
storeAgeable((Ageable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
// END AGEABLE //
|
||||
case "ARMOR_STAND":
|
||||
case "ARMOR_STAND" -> {
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
this.inventory =
|
||||
new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(),
|
||||
@ -238,37 +210,30 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
stand.getBoots().clone()};
|
||||
storeLiving(stand);
|
||||
this.stand = new ArmorStandStats();
|
||||
|
||||
EulerAngle head = stand.getHeadPose();
|
||||
this.stand.head[0] = (float) head.getX();
|
||||
this.stand.head[1] = (float) head.getY();
|
||||
this.stand.head[2] = (float) head.getZ();
|
||||
|
||||
EulerAngle body = stand.getBodyPose();
|
||||
this.stand.body[0] = (float) body.getX();
|
||||
this.stand.body[1] = (float) body.getY();
|
||||
this.stand.body[2] = (float) body.getZ();
|
||||
|
||||
EulerAngle leftLeg = stand.getLeftLegPose();
|
||||
this.stand.leftLeg[0] = (float) leftLeg.getX();
|
||||
this.stand.leftLeg[1] = (float) leftLeg.getY();
|
||||
this.stand.leftLeg[2] = (float) leftLeg.getZ();
|
||||
|
||||
EulerAngle rightLeg = stand.getRightLegPose();
|
||||
this.stand.rightLeg[0] = (float) rightLeg.getX();
|
||||
this.stand.rightLeg[1] = (float) rightLeg.getY();
|
||||
this.stand.rightLeg[2] = (float) rightLeg.getZ();
|
||||
|
||||
EulerAngle leftArm = stand.getLeftArmPose();
|
||||
this.stand.leftArm[0] = (float) leftArm.getX();
|
||||
this.stand.leftArm[1] = (float) leftArm.getY();
|
||||
this.stand.leftArm[2] = (float) leftArm.getZ();
|
||||
|
||||
EulerAngle rightArm = stand.getRightArmPose();
|
||||
this.stand.rightArm[0] = (float) rightArm.getX();
|
||||
this.stand.rightArm[1] = (float) rightArm.getY();
|
||||
this.stand.rightArm[2] = (float) rightArm.getZ();
|
||||
|
||||
if (stand.hasArms()) {
|
||||
this.stand.arms = true;
|
||||
}
|
||||
@ -282,53 +247,38 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
this.stand.small = true;
|
||||
}
|
||||
return;
|
||||
case "ENDERMITE":
|
||||
}
|
||||
case "ENDERMITE" -> {
|
||||
return;
|
||||
case "BAT":
|
||||
}
|
||||
case "BAT" -> {
|
||||
if (((Bat) entity).isAwake()) {
|
||||
this.dataByte = (byte) 1;
|
||||
} else {
|
||||
this.dataByte = (byte) 0;
|
||||
}
|
||||
return;
|
||||
case "ENDER_DRAGON":
|
||||
}
|
||||
case "ENDER_DRAGON" -> {
|
||||
EnderDragon entity1 = (EnderDragon) entity;
|
||||
this.dataByte = (byte) entity1.getPhase().ordinal();
|
||||
return;
|
||||
case "SKELETON":
|
||||
case "WITHER_SKELETON":
|
||||
case "GUARDIAN":
|
||||
case "ELDER_GUARDIAN":
|
||||
case "GHAST":
|
||||
case "MAGMA_CUBE":
|
||||
case "SQUID":
|
||||
case "PIG_ZOMBIE":
|
||||
case "HOGLIN":
|
||||
case "ZOMBIFIED_PIGLIN":
|
||||
case "PIGLIN":
|
||||
case "PIGLIN_BRUTE":
|
||||
case "ZOMBIE":
|
||||
case "WITHER":
|
||||
case "WITCH":
|
||||
case "SPIDER":
|
||||
case "CAVE_SPIDER":
|
||||
case "SILVERFISH":
|
||||
case "GIANT":
|
||||
case "ENDERMAN":
|
||||
case "CREEPER":
|
||||
case "BLAZE":
|
||||
case "SHULKER":
|
||||
case "SNOWMAN":
|
||||
}
|
||||
case "SKELETON", "WITHER_SKELETON", "GUARDIAN", "ELDER_GUARDIAN", "GHAST", "MAGMA_CUBE", "SQUID", "PIG_ZOMBIE", "HOGLIN",
|
||||
"ZOMBIFIED_PIGLIN", "PIGLIN", "PIGLIN_BRUTE", "ZOMBIE", "WITHER", "WITCH", "SPIDER", "CAVE_SPIDER", "SILVERFISH",
|
||||
"GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SHULKER", "SNOWMAN" -> {
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
case "IRON_GOLEM":
|
||||
}
|
||||
case "IRON_GOLEM" -> {
|
||||
if (((IronGolem) entity).isPlayerCreated()) {
|
||||
this.dataByte = (byte) 1;
|
||||
} else {
|
||||
this.dataByte = (byte) 0;
|
||||
}
|
||||
storeLiving((LivingEntity) entity);
|
||||
// END LIVING //
|
||||
}
|
||||
// END LIVING //
|
||||
}
|
||||
}
|
||||
|
||||
@ -465,20 +415,15 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
Entity entity;
|
||||
switch (this.getType().toString()) {
|
||||
case "DROPPED_ITEM":
|
||||
case "DROPPED_ITEM" -> {
|
||||
return world.dropItem(location, this.stack);
|
||||
case "PLAYER":
|
||||
case "LEASH_HITCH":
|
||||
}
|
||||
case "PLAYER", "LEASH_HITCH" -> {
|
||||
return null;
|
||||
case "ITEM_FRAME":
|
||||
entity = world.spawn(location, ItemFrame.class);
|
||||
break;
|
||||
case "PAINTING":
|
||||
entity = world.spawn(location, Painting.class);
|
||||
break;
|
||||
default:
|
||||
entity = world.spawnEntity(location, this.getType());
|
||||
break;
|
||||
}
|
||||
case "ITEM_FRAME" -> entity = world.spawn(location, ItemFrame.class);
|
||||
case "PAINTING" -> entity = world.spawn(location, Painting.class);
|
||||
default -> entity = world.spawnEntity(location, this.getType());
|
||||
}
|
||||
if (this.depth == 0) {
|
||||
return entity;
|
||||
@ -506,72 +451,46 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
entity.setGravity(false);
|
||||
}
|
||||
switch (entity.getType().toString()) {
|
||||
case "BOAT":
|
||||
case "BOAT" -> {
|
||||
Boat boat = (Boat) entity;
|
||||
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
||||
return entity;
|
||||
case "SLIME":
|
||||
}
|
||||
case "SLIME" -> {
|
||||
((Slime) entity).setSize(this.dataByte);
|
||||
return entity;
|
||||
case "ARROW":
|
||||
case "EGG":
|
||||
case "ENDER_CRYSTAL":
|
||||
case "ENDER_PEARL":
|
||||
case "ENDER_SIGNAL":
|
||||
case "DROPPED_ITEM":
|
||||
case "EXPERIENCE_ORB":
|
||||
case "FALLING_BLOCK":
|
||||
case "FIREBALL":
|
||||
case "FIREWORK":
|
||||
case "FISHING_HOOK":
|
||||
case "LEASH_HITCH":
|
||||
case "LIGHTNING":
|
||||
case "MINECART":
|
||||
case "MINECART_COMMAND":
|
||||
case "MINECART_MOB_SPAWNER":
|
||||
case "MINECART_TNT":
|
||||
case "PLAYER":
|
||||
case "PRIMED_TNT":
|
||||
case "SMALL_FIREBALL":
|
||||
case "SNOWBALL":
|
||||
case "SPLASH_POTION":
|
||||
case "THROWN_EXP_BOTTLE":
|
||||
case "SPECTRAL_ARROW":
|
||||
case "SHULKER_BULLET":
|
||||
case "AREA_EFFECT_CLOUD":
|
||||
case "DRAGON_FIREBALL":
|
||||
case "WITHER_SKULL":
|
||||
case "MINECART_FURNACE":
|
||||
case "LLAMA_SPIT":
|
||||
case "TRIDENT":
|
||||
case "UNKNOWN":
|
||||
}
|
||||
case "ARROW", "EGG", "ENDER_CRYSTAL", "ENDER_PEARL", "ENDER_SIGNAL", "DROPPED_ITEM", "EXPERIENCE_ORB", "FALLING_BLOCK",
|
||||
"FIREBALL", "FIREWORK", "FISHING_HOOK", "LEASH_HITCH", "LIGHTNING", "MINECART", "MINECART_COMMAND",
|
||||
"MINECART_MOB_SPAWNER", "MINECART_TNT", "PLAYER", "PRIMED_TNT", "SMALL_FIREBALL", "SNOWBALL",
|
||||
"SPLASH_POTION", "THROWN_EXP_BOTTLE", "SPECTRAL_ARROW", "SHULKER_BULLET", "AREA_EFFECT_CLOUD",
|
||||
"DRAGON_FIREBALL", "WITHER_SKULL", "MINECART_FURNACE", "LLAMA_SPIT", "TRIDENT", "UNKNOWN" -> {
|
||||
// Do this stuff later
|
||||
return entity;
|
||||
}
|
||||
// MISC //
|
||||
case "ITEM_FRAME":
|
||||
case "ITEM_FRAME" -> {
|
||||
ItemFrame itemframe = (ItemFrame) entity;
|
||||
itemframe.setRotation(Rotation.values()[this.dataByte]);
|
||||
itemframe.setItem(this.stack);
|
||||
return entity;
|
||||
case "PAINTING":
|
||||
}
|
||||
case "PAINTING" -> {
|
||||
Painting painting = (Painting) entity;
|
||||
painting.setFacingDirection(BlockFace.values()[this.dataByte], true);
|
||||
painting.setArt(Art.getByName(this.dataString), true);
|
||||
return entity;
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case "MINECART_CHEST":
|
||||
case "MINECART_HOPPER":
|
||||
case "MINECART_CHEST", "MINECART_HOPPER" -> {
|
||||
restoreInventory((InventoryHolder) entity);
|
||||
return entity;
|
||||
}
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case "HORSE":
|
||||
case "LLAMA":
|
||||
case "SKELETON_HORSE":
|
||||
case "DONKEY":
|
||||
case "MULE":
|
||||
case "HORSE", "LLAMA", "SKELETON_HORSE", "DONKEY", "MULE" -> {
|
||||
AbstractHorse horse = (AbstractHorse) entity;
|
||||
horse.setJumpStrength(this.horse.jump);
|
||||
if (horse instanceof ChestedHorse) {
|
||||
@ -586,15 +505,16 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
restoreLiving(horse);
|
||||
restoreInventory(horse);
|
||||
return entity;
|
||||
}
|
||||
// END INVENTORY HOLDER //
|
||||
case "WOLF":
|
||||
case "OCELOT":
|
||||
case "WOLF", "OCELOT" -> {
|
||||
restoreTameable((Tameable) entity);
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
// END AGEABLE //
|
||||
case "SHEEP":
|
||||
case "SHEEP" -> {
|
||||
Sheep sheep = (Sheep) entity;
|
||||
if (this.dataByte == 1) {
|
||||
sheep.setSheared(true);
|
||||
@ -605,25 +525,22 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
restoreAgeable(sheep);
|
||||
restoreLiving(sheep);
|
||||
return sheep;
|
||||
case "VILLAGER":
|
||||
case "CHICKEN":
|
||||
case "COW":
|
||||
case "TURTLE":
|
||||
case "POLAR_BEAR":
|
||||
case "MUSHROOM_COW":
|
||||
case "PIG":
|
||||
}
|
||||
case "VILLAGER", "CHICKEN", "COW", "TURTLE", "POLAR_BEAR", "MUSHROOM_COW", "PIG" -> {
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
}
|
||||
// END AGEABLE //
|
||||
case "RABBIT":
|
||||
case "RABBIT" -> {
|
||||
if (this.dataByte != 0) {
|
||||
((Rabbit) entity).setRabbitType(Rabbit.Type.values()[this.dataByte]);
|
||||
}
|
||||
restoreAgeable((Ageable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
case "ARMOR_STAND":
|
||||
}
|
||||
case "ARMOR_STAND" -> {
|
||||
// CHECK positions
|
||||
ArmorStand stand = (ArmorStand) entity;
|
||||
if (this.inventory[0] != null) {
|
||||
@ -693,56 +610,38 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
restoreLiving(stand);
|
||||
return stand;
|
||||
case "BAT":
|
||||
}
|
||||
case "BAT" -> {
|
||||
if (this.dataByte != 0) {
|
||||
((Bat) entity).setAwake(true);
|
||||
}
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
case "ENDER_DRAGON":
|
||||
}
|
||||
case "ENDER_DRAGON" -> {
|
||||
if (this.dataByte != 0) {
|
||||
((EnderDragon) entity).setPhase(EnderDragon.Phase.values()[this.dataByte]);
|
||||
}
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
case "ENDERMITE":
|
||||
case "GHAST":
|
||||
case "MAGMA_CUBE":
|
||||
case "SQUID":
|
||||
case "PIG_ZOMBIE":
|
||||
case "HOGLIN":
|
||||
case "PIGLIN":
|
||||
case "ZOMBIFIED_PIGLIN":
|
||||
case "PIGLIN_BRUTE":
|
||||
case "ZOMBIE":
|
||||
case "WITHER":
|
||||
case "WITCH":
|
||||
case "SPIDER":
|
||||
case "CAVE_SPIDER":
|
||||
case "SILVERFISH":
|
||||
case "GIANT":
|
||||
case "ENDERMAN":
|
||||
case "CREEPER":
|
||||
case "BLAZE":
|
||||
case "SNOWMAN":
|
||||
case "SHULKER":
|
||||
case "GUARDIAN":
|
||||
case "ELDER_GUARDIAN":
|
||||
case "SKELETON":
|
||||
case "WITHER_SKELETON":
|
||||
}
|
||||
case "ENDERMITE", "GHAST", "MAGMA_CUBE", "SQUID", "PIG_ZOMBIE", "HOGLIN", "PIGLIN", "ZOMBIFIED_PIGLIN", "PIGLIN_BRUTE", "ZOMBIE", "WITHER", "WITCH", "SPIDER", "CAVE_SPIDER", "SILVERFISH", "GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SNOWMAN", "SHULKER", "GUARDIAN", "ELDER_GUARDIAN", "SKELETON", "WITHER_SKELETON" -> {
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
case "IRON_GOLEM":
|
||||
}
|
||||
case "IRON_GOLEM" -> {
|
||||
if (this.dataByte != 0) {
|
||||
((IronGolem) entity).setPlayerCreated(true);
|
||||
}
|
||||
restoreLiving((LivingEntity) entity);
|
||||
return entity;
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
if (Settings.DEBUG) {
|
||||
LOGGER.info("Could not identify entity: {}", entity.getType());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
// END LIVING
|
||||
}
|
||||
}
|
||||
|
@ -145,54 +145,37 @@ public class EntityEventListener implements Listener {
|
||||
}
|
||||
CreatureSpawnEvent.SpawnReason reason = event.getSpawnReason();
|
||||
switch (reason.toString()) {
|
||||
case "DISPENSE_EGG":
|
||||
case "EGG":
|
||||
case "OCELOT_BABY":
|
||||
case "SPAWNER_EGG":
|
||||
case "DISPENSE_EGG", "EGG", "OCELOT_BABY", "SPAWNER_EGG" -> {
|
||||
if (!area.isSpawnEggs()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case "REINFORCEMENTS":
|
||||
case "NATURAL":
|
||||
case "MOUNT":
|
||||
case "PATROL":
|
||||
case "RAID":
|
||||
case "SHEARED":
|
||||
case "SILVERFISH_BLOCK":
|
||||
case "ENDER_PEARL":
|
||||
case "TRAP":
|
||||
case "VILLAGE_DEFENSE":
|
||||
case "VILLAGE_INVASION":
|
||||
case "BEEHIVE":
|
||||
case "CHUNK_GEN":
|
||||
}
|
||||
case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL",
|
||||
"TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN" -> {
|
||||
if (!area.isMobSpawning()) {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
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", "BUILD_SNOWMAN", "BUILD_WITHER", "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;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Plot plot = area.getOwnedPlotAbs(location);
|
||||
if (plot == null) {
|
||||
|
@ -178,59 +178,41 @@ public class PaperListener implements Listener {
|
||||
}
|
||||
CreatureSpawnEvent.SpawnReason reason = event.getReason();
|
||||
switch (reason.toString()) {
|
||||
case "DISPENSE_EGG":
|
||||
case "EGG":
|
||||
case "OCELOT_BABY":
|
||||
case "SPAWNER_EGG":
|
||||
case "DISPENSE_EGG", "EGG", "OCELOT_BABY", "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 "SILVERFISH_BLOCK":
|
||||
case "ENDER_PEARL":
|
||||
case "TRAP":
|
||||
case "VILLAGE_DEFENSE":
|
||||
case "VILLAGE_INVASION":
|
||||
case "BEEHIVE":
|
||||
case "CHUNK_GEN":
|
||||
}
|
||||
case "REINFORCEMENTS", "NATURAL", "MOUNT", "PATROL", "RAID", "SHEARED", "SILVERFISH_BLOCK", "ENDER_PEARL", "TRAP", "VILLAGE_DEFENSE", "VILLAGE_INVASION", "BEEHIVE", "CHUNK_GEN" -> {
|
||||
if (!area.isMobSpawning()) {
|
||||
event.setShouldAbortSpawn(true);
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
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", "BUILD_SNOWMAN", "BUILD_WITHER", "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);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
Plot plot = location.getOwnedPlotAbs();
|
||||
if (plot == null) {
|
||||
|
@ -273,8 +273,7 @@ public class PlayerEventListener implements Listener {
|
||||
Plot plot = plotPlayer.getCurrentPlot();
|
||||
// Check WorldEdit
|
||||
switch (parts[0]) {
|
||||
case "up":
|
||||
case "worldedit:up":
|
||||
case "up", "worldedit:up" -> {
|
||||
if (plot == null || (!plot.isAdded(plotPlayer.getUUID()) && !plotPlayer.hasPermission(
|
||||
Permission.PERMISSION_ADMIN_BUILD_OTHER,
|
||||
true
|
||||
@ -282,6 +281,7 @@ public class PlayerEventListener implements Listener {
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (plot == null && !area.isRoadFlags()) {
|
||||
return;
|
||||
@ -1114,13 +1114,13 @@ public class PlayerEventListener implements Listener {
|
||||
Location location = BukkitUtil.adapt(block.getLocation());
|
||||
Action action = event.getAction();
|
||||
switch (action) {
|
||||
case PHYSICAL: {
|
||||
case PHYSICAL -> {
|
||||
eventType = PlayerBlockEventType.TRIGGER_PHYSICAL;
|
||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||
break;
|
||||
}
|
||||
|
||||
//todo rearrange the right click code. it is all over the place.
|
||||
case RIGHT_CLICK_BLOCK: {
|
||||
case RIGHT_CLICK_BLOCK -> {
|
||||
Material blockType = block.getType();
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||
@ -1142,21 +1142,16 @@ public class PlayerEventListener implements Listener {
|
||||
|
||||
// in the following, lb needs to have the material of the item in hand i.e. type
|
||||
switch (type.toString()) {
|
||||
case "REDSTONE":
|
||||
case "STRING":
|
||||
case "PUMPKIN_SEEDS":
|
||||
case "MELON_SEEDS":
|
||||
case "COCOA_BEANS":
|
||||
case "WHEAT_SEEDS":
|
||||
case "BEETROOT_SEEDS":
|
||||
case "SWEET_BERRIES":
|
||||
case "GLOW_BERRIES":
|
||||
case "REDSTONE", "STRING", "PUMPKIN_SEEDS", "MELON_SEEDS", "COCOA_BEANS", "WHEAT_SEEDS", "BEETROOT_SEEDS",
|
||||
"SWEET_BERRIES", "GLOW_BERRIES" -> {
|
||||
return;
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
//eventType = PlayerBlockEventType.PLACE_BLOCK;
|
||||
if (type.isBlock()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (PaperLib.isPaper()) {
|
||||
if (MaterialTags.SPAWN_EGGS.isTagged(type) || Material.EGG.equals(type)) {
|
||||
@ -1189,9 +1184,8 @@ public class PlayerEventListener implements Listener {
|
||||
eventType = PlayerBlockEventType.READ;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LEFT_CLICK_BLOCK: {
|
||||
case LEFT_CLICK_BLOCK -> {
|
||||
Material blockType = block.getType();
|
||||
|
||||
// todo: when the code above is rearranged, it would be great to beautify this as well.
|
||||
@ -1202,10 +1196,10 @@ public class PlayerEventListener implements Listener {
|
||||
|
||||
eventType = PlayerBlockEventType.INTERACT_BLOCK;
|
||||
blocktype1 = BukkitAdapter.asBlockType(block.getType());
|
||||
break;
|
||||
}
|
||||
default:
|
||||
default -> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (this.worldEdit != null && pp.getAttribute("worldedit")) {
|
||||
if (event.getMaterial() == Material.getMaterial(this.worldEdit.getConfiguration().wandItem)) {
|
||||
|
@ -77,8 +77,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
String sub = args[0].toLowerCase();
|
||||
switch (sub) {
|
||||
case "l":
|
||||
case "list": {
|
||||
case "l", "list" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LIST)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -133,8 +132,7 @@ public class Cluster extends SubCommand {
|
||||
}
|
||||
return true;
|
||||
}
|
||||
case "c":
|
||||
case "create": {
|
||||
case "c", "create" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_CREATE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -269,9 +267,7 @@ public class Cluster extends SubCommand {
|
||||
);
|
||||
return true;
|
||||
}
|
||||
case "disband":
|
||||
case "del":
|
||||
case "delete": {
|
||||
case "disband", "del", "delete" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_DELETE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -330,8 +326,7 @@ public class Cluster extends SubCommand {
|
||||
));
|
||||
return true;
|
||||
}
|
||||
case "res":
|
||||
case "resize": {
|
||||
case "res", "resize" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_RESIZE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -452,9 +447,7 @@ public class Cluster extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_resized"));
|
||||
return true;
|
||||
}
|
||||
case "add":
|
||||
case "inv":
|
||||
case "invite": {
|
||||
case "add", "inv", "invite" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INVITE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -523,9 +516,7 @@ public class Cluster extends SubCommand {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "k":
|
||||
case "remove":
|
||||
case "kick": {
|
||||
case "k", "remove", "kick" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_KICK)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -605,8 +596,7 @@ public class Cluster extends SubCommand {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "quit":
|
||||
case "leave": {
|
||||
case "quit", "leave" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_LEAVE)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -667,7 +657,7 @@ public class Cluster extends SubCommand {
|
||||
removePlayerPlots(cluster, uuid, player.getLocation().getWorldName());
|
||||
return true;
|
||||
}
|
||||
case "members": {
|
||||
case "members" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_HELPERS)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -728,9 +718,7 @@ public class Cluster extends SubCommand {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "spawn":
|
||||
case "home":
|
||||
case "tp": {
|
||||
case "spawn", "home", "tp" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_TP)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -778,10 +766,7 @@ public class Cluster extends SubCommand {
|
||||
player.sendMessage(TranslatableCaption.of("cluster.cluster_teleporting"));
|
||||
return true;
|
||||
}
|
||||
case "i":
|
||||
case "info":
|
||||
case "show":
|
||||
case "information": {
|
||||
case "i", "info", "show", "information" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_INFO)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
@ -850,9 +835,7 @@ public class Cluster extends SubCommand {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
case "sh":
|
||||
case "setspawn":
|
||||
case "sethome": {
|
||||
case "sh", "setspawn", "sethome" -> {
|
||||
if (!player.hasPermission(Permission.PERMISSION_CLUSTER_SETHOME)) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("permission.no_permission"),
|
||||
|
@ -559,9 +559,10 @@ public abstract class Command {
|
||||
|
||||
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
case 0 -> {
|
||||
return this.allCommands;
|
||||
case 1:
|
||||
}
|
||||
case 1 -> {
|
||||
String arg = args[0].toLowerCase();
|
||||
if (space) {
|
||||
Command cmd = getCommand(arg);
|
||||
@ -580,13 +581,15 @@ public abstract class Command {
|
||||
}
|
||||
return commands;
|
||||
}
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
Command cmd = getCommand(args[0]);
|
||||
if (cmd != null) {
|
||||
return cmd.tab(player, Arrays.copyOfRange(args, 1, args.length), space);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,16 +75,19 @@ public class DebugRoadRegen extends SubCommand {
|
||||
}
|
||||
String kind = args[0].toLowerCase();
|
||||
switch (kind) {
|
||||
case "plot":
|
||||
case "plot" -> {
|
||||
return regenPlot(player);
|
||||
case "region":
|
||||
}
|
||||
case "region" -> {
|
||||
return regenRegion(player, Arrays.copyOfRange(args, 1, args.length));
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("commandconfig.command_syntax"),
|
||||
TagResolver.resolver("value", Tag.inserting(Component.text(DebugRoadRegen.USAGE)))
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -60,9 +60,10 @@ public class Help extends Command {
|
||||
RunnableVal2<Command, CommandResult> whenDone
|
||||
) {
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
case 0 -> {
|
||||
return displayHelp(player, null, 0);
|
||||
case 1:
|
||||
}
|
||||
case 1 -> {
|
||||
if (MathMan.isInteger(args[0])) {
|
||||
try {
|
||||
return displayHelp(player, null, Integer.parseInt(args[0]));
|
||||
@ -72,7 +73,8 @@ public class Help extends Command {
|
||||
} else {
|
||||
return displayHelp(player, args[0], 1);
|
||||
}
|
||||
case 2:
|
||||
}
|
||||
case 2 -> {
|
||||
if (MathMan.isInteger(args[1])) {
|
||||
try {
|
||||
return displayHelp(player, args[0], Integer.parseInt(args[1]));
|
||||
@ -81,8 +83,8 @@ public class Help extends Command {
|
||||
}
|
||||
}
|
||||
return CompletableFuture.completedFuture(false);
|
||||
default:
|
||||
sendUsage(player);
|
||||
}
|
||||
default -> sendUsage(player);
|
||||
}
|
||||
return CompletableFuture.completedFuture(true);
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ public class Inbox extends SubCommand {
|
||||
final int page;
|
||||
if (args.length > 1) {
|
||||
switch (args[1].toLowerCase()) {
|
||||
case "delete":
|
||||
case "delete" -> {
|
||||
if (!inbox.canModify(plot, player)) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
return false;
|
||||
@ -225,7 +225,6 @@ public class Inbox extends SubCommand {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!inbox.getComments(plot, new RunnableVal<>() {
|
||||
@Override
|
||||
public void run(List<PlotComment> value) {
|
||||
@ -254,7 +253,8 @@ public class Inbox extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
case "clear":
|
||||
}
|
||||
case "clear" -> {
|
||||
if (!inbox.canModify(plot, player)) {
|
||||
player.sendMessage(TranslatableCaption.of("comment.no_perm_inbox_modify"));
|
||||
}
|
||||
@ -268,13 +268,15 @@ public class Inbox extends SubCommand {
|
||||
plot.getPlotCommentContainer().removeComments(comments);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
}
|
||||
default -> {
|
||||
try {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException ignored) {
|
||||
sendUsage(player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
page = 1;
|
||||
|
@ -90,12 +90,8 @@ public class Purge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
switch (split[0].toLowerCase()) {
|
||||
case "world":
|
||||
case "w":
|
||||
world = split[1];
|
||||
break;
|
||||
case "area":
|
||||
case "a":
|
||||
case "world", "w" -> world = split[1];
|
||||
case "area", "a" -> {
|
||||
area = this.plotAreaManager.getPlotAreaByString(split[1]);
|
||||
if (area == null) {
|
||||
player.sendMessage(
|
||||
@ -104,9 +100,8 @@ public class Purge extends SubCommand {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "plotid":
|
||||
case "id":
|
||||
}
|
||||
case "plotid", "id" -> {
|
||||
try {
|
||||
id = PlotId.fromString(split[1]);
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
@ -116,9 +111,8 @@ public class Purge extends SubCommand {
|
||||
);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case "owner":
|
||||
case "o":
|
||||
}
|
||||
case "owner", "o" -> {
|
||||
UUIDMapping ownerMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
|
||||
if (ownerMapping == null) {
|
||||
player.sendMessage(
|
||||
@ -128,9 +122,8 @@ public class Purge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
owner = ownerMapping.uuid();
|
||||
break;
|
||||
case "shared":
|
||||
case "s":
|
||||
}
|
||||
case "shared", "s" -> {
|
||||
UUIDMapping addedMapping = PlotSquared.get().getImpromptuUUIDPipeline().getImmediately(split[1]);
|
||||
if (addedMapping == null) {
|
||||
player.sendMessage(
|
||||
@ -140,22 +133,13 @@ public class Purge extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
added = addedMapping.uuid();
|
||||
break;
|
||||
case "clear":
|
||||
case "c":
|
||||
case "delete":
|
||||
case "d":
|
||||
case "del":
|
||||
clear = Boolean.parseBoolean(split[1]);
|
||||
break;
|
||||
case "unknown":
|
||||
case "?":
|
||||
case "u":
|
||||
unknown = Boolean.parseBoolean(split[1]);
|
||||
break;
|
||||
default:
|
||||
}
|
||||
case "clear", "c", "delete", "d", "del" -> clear = Boolean.parseBoolean(split[1]);
|
||||
case "unknown", "?", "u" -> unknown = Boolean.parseBoolean(split[1]);
|
||||
default -> {
|
||||
sendUsage(player);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
final HashSet<Plot> toDelete = new HashSet<>();
|
||||
|
@ -185,30 +185,38 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
||||
return null;
|
||||
}
|
||||
switch (hash) {
|
||||
case 8:
|
||||
case 8 -> {
|
||||
// north
|
||||
return plot.isMerged(Direction.NORTH) ? id : null;
|
||||
case 4:
|
||||
}
|
||||
case 4 -> {
|
||||
// east
|
||||
return plot.isMerged(Direction.EAST) ? id : null;
|
||||
case 2:
|
||||
}
|
||||
case 2 -> {
|
||||
// south
|
||||
return plot.isMerged(Direction.SOUTH) ? id : null;
|
||||
case 1:
|
||||
}
|
||||
case 1 -> {
|
||||
// west
|
||||
return plot.isMerged(Direction.WEST) ? id : null;
|
||||
case 12:
|
||||
}
|
||||
case 12 -> {
|
||||
// northeast
|
||||
return plot.isMerged(Direction.NORTHEAST) ? id : null;
|
||||
case 6:
|
||||
}
|
||||
case 6 -> {
|
||||
// southeast
|
||||
return plot.isMerged(Direction.SOUTHEAST) ? id : null;
|
||||
case 3:
|
||||
}
|
||||
case 3 -> {
|
||||
// southwest
|
||||
return plot.isMerged(Direction.SOUTHWEST) ? id : null;
|
||||
case 9:
|
||||
}
|
||||
case 9 -> {
|
||||
// northwest
|
||||
return plot.isMerged(Direction.NORTHWEST) ? id : null;
|
||||
}
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
LOGGER.error("Invalid plot / road width in settings.yml for world: {}", squarePlotWorld.getWorldName());
|
||||
|
@ -57,24 +57,15 @@ public class DenyTeleportFlag extends PlotFlag<DenyTeleportFlag.DeniedGroup, Den
|
||||
}
|
||||
final boolean result;
|
||||
switch (value) {
|
||||
case TRUSTED:
|
||||
result = !plot.getTrusted().contains(player.getUUID());
|
||||
break;
|
||||
case MEMBERS:
|
||||
result = !plot.getMembers().contains(player.getUUID());
|
||||
break;
|
||||
case NONMEMBERS:
|
||||
result = plot.isAdded(player.getUUID());
|
||||
break;
|
||||
case NONTRUSTED:
|
||||
result =
|
||||
plot.getTrusted().contains(player.getUUID()) || plot.isOwner(player.getUUID());
|
||||
break;
|
||||
case NONOWNERS:
|
||||
result = plot.isOwner(player.getUUID());
|
||||
break;
|
||||
default:
|
||||
case TRUSTED -> result = !plot.getTrusted().contains(player.getUUID());
|
||||
case MEMBERS -> result = !plot.getMembers().contains(player.getUUID());
|
||||
case NONMEMBERS -> result = plot.isAdded(player.getUUID());
|
||||
case NONTRUSTED -> result =
|
||||
plot.getTrusted().contains(player.getUUID()) || plot.isOwner(player.getUUID());
|
||||
case NONOWNERS -> result = plot.isOwner(player.getUUID());
|
||||
default -> {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return result || player.hasPermission("plots.admin.entry.denied");
|
||||
}
|
||||
|
@ -68,14 +68,11 @@ public class FlyFlag extends PlotFlag<FlyFlag.FlyStatus, FlyFlag> {
|
||||
|
||||
@Override
|
||||
protected FlyFlag flagOf(final @NonNull FlyStatus value) {
|
||||
switch (value) {
|
||||
case ENABLED:
|
||||
return FLIGHT_FLAG_ENABLED;
|
||||
case DISABLED:
|
||||
return FLIGHT_FLAG_DISABLED;
|
||||
default:
|
||||
return FLIGHT_FLAG_DEFAULT;
|
||||
}
|
||||
return switch (value) {
|
||||
case ENABLED -> FLIGHT_FLAG_ENABLED;
|
||||
case DISABLED -> FLIGHT_FLAG_DISABLED;
|
||||
default -> FLIGHT_FLAG_DEFAULT;
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -359,11 +359,13 @@ public class EventDispatcher {
|
||||
}
|
||||
}
|
||||
switch (type) {
|
||||
case TELEPORT_OBJECT:
|
||||
case TELEPORT_OBJECT -> {
|
||||
return false;
|
||||
case READ:
|
||||
}
|
||||
case READ -> {
|
||||
return true;
|
||||
case INTERACT_BLOCK: {
|
||||
}
|
||||
case INTERACT_BLOCK -> {
|
||||
if (plot == null) {
|
||||
final List<BlockTypeWrapper> use = area.getRoadFlag(UseFlag.class);
|
||||
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
||||
@ -398,7 +400,7 @@ public class EventDispatcher {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case TRIGGER_PHYSICAL: {
|
||||
case TRIGGER_PHYSICAL -> {
|
||||
if (plot == null) {
|
||||
final List<BlockTypeWrapper> use = area.getRoadFlag(UseFlag.class);
|
||||
for (final BlockTypeWrapper blockTypeWrapper : use) {
|
||||
@ -430,7 +432,7 @@ public class EventDispatcher {
|
||||
false
|
||||
);
|
||||
}
|
||||
case SPAWN_MOB: {
|
||||
case SPAWN_MOB -> {
|
||||
if (plot == null) {
|
||||
return player.hasPermission(
|
||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||
@ -472,7 +474,7 @@ public class EventDispatcher {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case PLACE_MISC: {
|
||||
case PLACE_MISC -> {
|
||||
if (plot == null) {
|
||||
return player.hasPermission(
|
||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||
@ -514,7 +516,7 @@ public class EventDispatcher {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
case PLACE_VEHICLE:
|
||||
case PLACE_VEHICLE -> {
|
||||
if (plot == null) {
|
||||
return player.hasPermission(
|
||||
Permission.PERMISSION_ADMIN_INTERACT_ROAD.toString(), notifyPerms
|
||||
@ -526,8 +528,9 @@ public class EventDispatcher {
|
||||
);
|
||||
}
|
||||
return plot.getFlag(VehiclePlaceFlag.class);
|
||||
default:
|
||||
break;
|
||||
}
|
||||
default -> {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user