mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-10 09:34:43 +02:00
1.21.4 (#4582)
* chore: bump api to 1.21.4 * fix: replace (removed) constants with backwards compatible alternatives * chore: cleanup import * chore: update javadoc link for paper * chore: i like this more * fix: check for vehicle * chore: compile against 1.20.4 again * chore: add 1.21.4 to bug report issue template * chore: add 1.21.4 to runServer supported versions array * chore: update entity type enum name switch * chore: remove 1.18 from supportedVersions for runServer task * fix: attempt to update ReplicatingEntityWrapper * fix/chore: missing boat handling on spawn * chore: cleanup imports
This commit is contained in:

committed by
GitHub

parent
4e2ea67992
commit
d4f10422e3
@ -25,7 +25,6 @@ import org.bukkit.Art;
|
||||
import org.bukkit.DyeColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Rotation;
|
||||
import org.bukkit.TreeSpecies;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.AbstractHorse;
|
||||
@ -34,6 +33,7 @@ import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Bat;
|
||||
import org.bukkit.entity.Boat;
|
||||
import org.bukkit.entity.Breedable;
|
||||
import org.bukkit.entity.ChestBoat;
|
||||
import org.bukkit.entity.ChestedHorse;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
@ -44,7 +44,6 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.entity.Rabbit;
|
||||
import org.bukkit.entity.Sheep;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Tameable;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
@ -103,11 +102,19 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
this.noGravity = true;
|
||||
}
|
||||
switch (entity.getType().toString()) {
|
||||
case "BOAT" -> {
|
||||
case "BOAT", "ACACIA_BOAT", "BIRCH_BOAT", "CHERRY_BOAT", "DARK_OAK_BOAT", "JUNGLE_BOAT", "MANGROVE_BOAT",
|
||||
"OAK_BOAT", "PALE_OAK_BOAT", "SPRUCE_BOAT", "BAMBOO_RAFT" -> {
|
||||
Boat boat = (Boat) entity;
|
||||
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
|
||||
this.dataByte = getOrdinal(Boat.Type.values(), boat.getBoatType());
|
||||
return;
|
||||
}
|
||||
case "ACACIA_CHEST_BOAT", "BIRCH_CHEST_BOAT", "CHERRY_CHEST_BOAT", "DARK_OAK_CHEST_BOAT",
|
||||
"JUNGLE_CHEST_BOAT", "MANGROVE_CHEST_BOAT", "OAK_CHEST_BOAT", "PALE_OAK_CHEST_BOAT",
|
||||
"SPRUCE_CHEST_BOAT", "BAMBOO_CHEST_RAFT" -> {
|
||||
ChestBoat boat = (ChestBoat) entity;
|
||||
this.dataByte = getOrdinal(Boat.Type.values(), boat.getBoatType());
|
||||
storeInventory(boat);
|
||||
}
|
||||
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",
|
||||
@ -117,7 +124,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
return;
|
||||
}
|
||||
// MISC //
|
||||
case "DROPPED_ITEM" -> {
|
||||
case "DROPPED_ITEM", "ITEM" -> {
|
||||
Item item = (Item) entity;
|
||||
this.stack = item.getItemStack();
|
||||
return;
|
||||
@ -147,14 +154,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case "MINECART_CHEST", "MINECART_HOPPER" -> {
|
||||
case "MINECART_CHEST", "CHEST_MINECART", "MINECART_HOPPER", "HOPPER_MINECART" -> {
|
||||
storeInventory((InventoryHolder) entity);
|
||||
return;
|
||||
}
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case "HORSE", "DONKEY", "LLAMA", "MULE", "SKELETON_HORSE" -> {
|
||||
case "CAMEL", "HORSE", "DONKEY", "LLAMA", "TRADER_LLAMA", "MULE", "SKELETON_HORSE", "ZOMBIE_HORSE" -> {
|
||||
AbstractHorse horse = (AbstractHorse) entity;
|
||||
this.horse = new HorseStats();
|
||||
this.horse.jump = horse.getJumpStrength();
|
||||
@ -172,14 +179,13 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
return;
|
||||
}
|
||||
// END INVENTORY HOLDER //
|
||||
case "WOLF", "OCELOT" -> {
|
||||
case "WOLF", "OCELOT", "CAT", "PARROT" -> {
|
||||
storeTameable((Tameable) entity);
|
||||
storeBreedable((Breedable) entity);
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
// END TAMEABLE //
|
||||
//todo fix sheep
|
||||
case "SHEEP" -> {
|
||||
Sheep sheep = (Sheep) entity;
|
||||
if (sheep.isSheared()) {
|
||||
@ -187,7 +193,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
} else {
|
||||
this.dataByte = (byte) 0;
|
||||
}
|
||||
this.dataByte2 = sheep.getColor().getDyeData();
|
||||
this.dataByte2 = getOrdinal(DyeColor.values(), sheep.getColor());
|
||||
storeBreedable(sheep);
|
||||
storeLiving(sheep);
|
||||
return;
|
||||
@ -268,7 +274,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
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" -> {
|
||||
"GIANT", "ENDERMAN", "CREEPER", "BLAZE", "SHULKER", "SNOWMAN", "SNOW_GOLEM" -> {
|
||||
storeLiving((LivingEntity) entity);
|
||||
return;
|
||||
}
|
||||
@ -450,7 +456,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
Entity entity;
|
||||
switch (this.getType().toString()) {
|
||||
case "DROPPED_ITEM" -> {
|
||||
case "DROPPED_ITEM", "ITEM" -> {
|
||||
return world.dropItem(location, this.stack);
|
||||
}
|
||||
case "PLAYER", "LEASH_HITCH" -> {
|
||||
@ -486,15 +492,25 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
entity.setGravity(false);
|
||||
}
|
||||
switch (entity.getType().toString()) {
|
||||
case "BOAT" -> {
|
||||
case "BOAT", "ACACIA_BOAT", "BIRCH_BOAT", "CHERRY_BOAT", "DARK_OAK_BOAT", "JUNGLE_BOAT", "MANGROVE_BOAT",
|
||||
"OAK_BOAT", "PALE_OAK_BOAT", "SPRUCE_BOAT", "BAMBOO_RAFT" -> {
|
||||
Boat boat = (Boat) entity;
|
||||
boat.setWoodType(TreeSpecies.values()[dataByte]);
|
||||
boat.setBoatType(Boat.Type.values()[dataByte]);
|
||||
return entity;
|
||||
}
|
||||
case "SLIME" -> {
|
||||
case "ACACIA_CHEST_BOAT", "BIRCH_CHEST_BOAT", "CHERRY_CHEST_BOAT", "DARK_OAK_CHEST_BOAT",
|
||||
"JUNGLE_CHEST_BOAT", "MANGROVE_CHEST_BOAT", "OAK_CHEST_BOAT", "PALE_OAK_CHEST_BOAT",
|
||||
"SPRUCE_CHEST_BOAT", "BAMBOO_CHEST_RAFT" -> {
|
||||
ChestBoat boat = (ChestBoat) entity;
|
||||
boat.setBoatType(Boat.Type.values()[dataByte]);
|
||||
restoreInventory(boat);
|
||||
return entity;
|
||||
}
|
||||
// SLIME is not even stored
|
||||
/* case "SLIME" -> {
|
||||
((Slime) entity).setSize(this.dataByte);
|
||||
return entity;
|
||||
}
|
||||
} */
|
||||
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",
|
||||
@ -518,14 +534,14 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
}
|
||||
// END MISC //
|
||||
// INVENTORY HOLDER //
|
||||
case "MINECART_CHEST", "MINECART_HOPPER" -> {
|
||||
case "MINECART_CHEST", "CHEST_MINECART", "MINECART_HOPPER", "HOPPER_MINECART" -> {
|
||||
restoreInventory((InventoryHolder) entity);
|
||||
return entity;
|
||||
}
|
||||
// START LIVING ENTITY //
|
||||
// START AGEABLE //
|
||||
// START TAMEABLE //
|
||||
case "HORSE", "LLAMA", "SKELETON_HORSE", "DONKEY", "MULE" -> {
|
||||
case "CAMEL", "HORSE", "DONKEY", "LLAMA", "TRADER_LLAMA", "MULE", "SKELETON_HORSE", "ZOMBIE_HORSE" -> {
|
||||
AbstractHorse horse = (AbstractHorse) entity;
|
||||
horse.setJumpStrength(this.horse.jump);
|
||||
if (horse instanceof ChestedHorse) {
|
||||
@ -542,7 +558,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
return entity;
|
||||
}
|
||||
// END INVENTORY HOLDER //
|
||||
case "WOLF", "OCELOT" -> {
|
||||
case "WOLF", "OCELOT", "CAT", "PARROT" -> {
|
||||
restoreTameable((Tameable) entity);
|
||||
restoreBreedable((Breedable) entity);
|
||||
restoreLiving((LivingEntity) entity);
|
||||
@ -555,7 +571,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
||||
sheep.setSheared(true);
|
||||
}
|
||||
if (this.dataByte2 != 0) {
|
||||
sheep.setColor(DyeColor.getByDyeData(this.dataByte2));
|
||||
sheep.setColor(DyeColor.values()[this.dataByte2]);
|
||||
}
|
||||
restoreBreedable(sheep);
|
||||
restoreLiving(sheep);
|
||||
|
Reference in New Issue
Block a user