diff --git a/paper-api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java b/paper-api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java index 122ccdef02..78084f4c90 100644 --- a/paper-api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java +++ b/paper-api/src/main/java/com/destroystokyo/paper/event/block/BlockDestroyEvent.java @@ -55,7 +55,7 @@ public class BlockDestroyEvent extends BlockExpEvent implements Cancellable { * @param effectBlock block effect */ public void setEffectBlock(final BlockData effectBlock) { - this.effectBlock = effectBlock; + this.effectBlock = effectBlock.clone(); } /** diff --git a/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java b/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java index 1d07c3d6bf..e3d4c3f912 100644 --- a/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java +++ b/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerJumpEvent.java @@ -79,7 +79,7 @@ public class PlayerJumpEvent extends PlayerEvent implements Cancellable { public void setFrom(final Location from) { Preconditions.checkArgument(from != null, "Cannot use null from location!"); Preconditions.checkArgument(from.getWorld() != null, "Cannot use from location with null world!"); - this.from = from; + this.from = from.clone(); } /** diff --git a/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java b/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java index 41d42d73cf..1688c2c4ee 100644 --- a/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java +++ b/paper-api/src/main/java/com/destroystokyo/paper/event/player/PlayerSetSpawnEvent.java @@ -66,7 +66,7 @@ public class PlayerSetSpawnEvent extends PlayerEvent implements Cancellable { * @param location the spawn location, or {@code null} to remove the spawn location */ public void setLocation(final @Nullable Location location) { - this.location = location; + this.location = location != null ? location.clone() : null; } /** diff --git a/paper-api/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java b/paper-api/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java index 49ace39539..00fef88d56 100644 --- a/paper-api/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java +++ b/paper-api/src/main/java/io/papermc/paper/event/entity/EntityMoveEvent.java @@ -53,7 +53,7 @@ public class EntityMoveEvent extends EntityEvent implements Cancellable { */ public void setFrom(final Location from) { this.validateLocation(from); - this.from = from; + this.from = from.clone(); } /** @@ -72,7 +72,7 @@ public class EntityMoveEvent extends EntityEvent implements Cancellable { */ public void setTo(final Location to) { this.validateLocation(to); - this.to = to; + this.to = to.clone(); } /** diff --git a/paper-api/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java b/paper-api/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java index 74fe5ad505..5f43aefe7a 100644 --- a/paper-api/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java +++ b/paper-api/src/main/java/io/papermc/paper/event/world/border/WorldBorderCenterChangeEvent.java @@ -52,7 +52,7 @@ public class WorldBorderCenterChangeEvent extends WorldBorderEvent implements Ca * @param newCenter the new center */ public void setNewCenter(final Location newCenter) { - this.newCenter = newCenter; + this.newCenter = newCenter.clone(); } @Override diff --git a/paper-api/src/main/java/io/papermc/paper/potion/PotionMix.java b/paper-api/src/main/java/io/papermc/paper/potion/PotionMix.java index 01b2a7c7a6..41152c98c0 100644 --- a/paper-api/src/main/java/io/papermc/paper/potion/PotionMix.java +++ b/paper-api/src/main/java/io/papermc/paper/potion/PotionMix.java @@ -30,9 +30,9 @@ public final class PotionMix implements Keyed { */ public PotionMix(final NamespacedKey key, final ItemStack result, final RecipeChoice input, final RecipeChoice ingredient) { this.key = key; - this.result = result; - this.input = input; - this.ingredient = ingredient; + this.result = result.clone(); + this.input = input.clone(); + this.ingredient = ingredient.clone(); } /** @@ -58,7 +58,7 @@ public final class PotionMix implements Keyed { * @return the result itemstack */ public ItemStack getResult() { - return this.result; + return this.result.clone(); } /** @@ -67,7 +67,7 @@ public final class PotionMix implements Keyed { * @return the bottom 3 slot ingredients */ public RecipeChoice getInput() { - return this.input; + return this.input.clone(); } /** @@ -76,7 +76,7 @@ public final class PotionMix implements Keyed { * @return the top slot input */ public RecipeChoice getIngredient() { - return this.ingredient; + return this.ingredient.clone(); } @Override diff --git a/paper-api/src/main/java/org/bukkit/Vibration.java b/paper-api/src/main/java/org/bukkit/Vibration.java index bbc01e7c19..2c0e18e8dd 100644 --- a/paper-api/src/main/java/org/bukkit/Vibration.java +++ b/paper-api/src/main/java/org/bukkit/Vibration.java @@ -79,7 +79,7 @@ public class Vibration { private final Location block; public BlockDestination(@NotNull Location block) { - this.block = block; + this.block = block.clone(); } public BlockDestination(@NotNull Block block) { @@ -88,7 +88,7 @@ public class Vibration { @NotNull public Location getLocation() { - return block; + return block.clone(); } @NotNull diff --git a/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java b/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java index 14d1eb5d93..e8ed75ba7d 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/BlockDispenseEvent.java @@ -65,7 +65,7 @@ public class BlockDispenseEvent extends BlockEvent implements Cancellable { * @param vel the velocity of the item being dispensed */ public void setVelocity(@NotNull Vector vel) { - velocity = vel; + velocity = vel.clone(); } @Override diff --git a/paper-api/src/main/java/org/bukkit/event/block/FluidLevelChangeEvent.java b/paper-api/src/main/java/org/bukkit/event/block/FluidLevelChangeEvent.java index 9bd0440c37..c61f6b1bd5 100644 --- a/paper-api/src/main/java/org/bukkit/event/block/FluidLevelChangeEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/block/FluidLevelChangeEvent.java @@ -43,7 +43,7 @@ public class FluidLevelChangeEvent extends BlockEvent implements Cancellable { Preconditions.checkArgument(newData != null, "newData null"); Preconditions.checkArgument(this.newData.getMaterial().equals(newData.getMaterial()), "Cannot change fluid type"); - this.newData = newData; + this.newData = newData.clone(); } @Override diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java index 0d465629ec..6c0c2f78de 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityKnockbackEvent.java @@ -99,7 +99,7 @@ public class EntityKnockbackEvent extends EntityEvent implements Cancellable { public void setFinalKnockback(@NotNull Vector knockback) { Preconditions.checkArgument(knockback != null, "Knockback cannot be null"); - this.knockback = knockback; + this.knockback = knockback.clone(); } @Override diff --git a/paper-api/src/main/java/org/bukkit/event/entity/EntityTeleportEvent.java b/paper-api/src/main/java/org/bukkit/event/entity/EntityTeleportEvent.java index a7918049ae..bffad21c02 100644 --- a/paper-api/src/main/java/org/bukkit/event/entity/EntityTeleportEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/entity/EntityTeleportEvent.java @@ -52,7 +52,7 @@ public class EntityTeleportEvent extends EntityEvent implements Cancellable { * @param from New location this entity moved from */ public void setFrom(@NotNull Location from) { - this.from = from; + this.from = from.clone(); } /** @@ -71,7 +71,7 @@ public class EntityTeleportEvent extends EntityEvent implements Cancellable { * @param to New Location this entity moved to */ public void setTo(@Nullable Location to) { - this.to = to; + this.to = to != null ? to.clone() : null; } @NotNull diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java index 69c800d367..5e52f4dc26 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerInteractEvent.java @@ -241,7 +241,7 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable { @Nullable @Deprecated // Paper public Vector getClickedPosition() { - return clickedPosistion; + return clickedPosistion.clone(); } // Paper start diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java index b484abf3b0..237d654773 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerMoveEvent.java @@ -70,7 +70,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable { */ public void setFrom(@NotNull Location from) { validateLocation(from); - this.from = from; + this.from = from.clone(); } /** @@ -90,7 +90,7 @@ public class PlayerMoveEvent extends PlayerEvent implements Cancellable { */ public void setTo(@NotNull Location to) { validateLocation(to); - this.to = to; + this.to = to.clone(); } // Paper start - PlayerMoveEvent improvements diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java index 4d925774f7..d1dd5cf0ad 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerRespawnEvent.java @@ -69,7 +69,7 @@ public class PlayerRespawnEvent extends PlayerEvent { Preconditions.checkArgument(respawnLocation != null, "Respawn location can not be null"); Preconditions.checkArgument(respawnLocation.getWorld() != null, "Respawn world can not be null"); - this.respawnLocation = respawnLocation; + this.respawnLocation = respawnLocation.clone(); } /** diff --git a/paper-api/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java b/paper-api/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java index 61e098d94a..87b15dcabf 100644 --- a/paper-api/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/player/PlayerVelocityEvent.java @@ -45,7 +45,7 @@ public class PlayerVelocityEvent extends PlayerEvent implements Cancellable { * @param velocity The velocity vector that will be sent to the player */ public void setVelocity(@NotNull Vector velocity) { - this.velocity = velocity; + this.velocity = velocity.clone(); } @NotNull diff --git a/paper-api/src/main/java/org/bukkit/event/world/AsyncStructureSpawnEvent.java b/paper-api/src/main/java/org/bukkit/event/world/AsyncStructureSpawnEvent.java index 5f05b32bdf..978790b97b 100644 --- a/paper-api/src/main/java/org/bukkit/event/world/AsyncStructureSpawnEvent.java +++ b/paper-api/src/main/java/org/bukkit/event/world/AsyncStructureSpawnEvent.java @@ -45,7 +45,7 @@ public class AsyncStructureSpawnEvent extends WorldEvent implements Cancellable */ @NotNull public BoundingBox getBoundingBox() { - return boundingBox; + return boundingBox.clone(); } /** diff --git a/paper-api/src/main/java/org/bukkit/loot/LootContext.java b/paper-api/src/main/java/org/bukkit/loot/LootContext.java index 4a8b2538a8..470f712e8d 100644 --- a/paper-api/src/main/java/org/bukkit/loot/LootContext.java +++ b/paper-api/src/main/java/org/bukkit/loot/LootContext.java @@ -24,7 +24,7 @@ public final class LootContext { private LootContext(@NotNull Location location, float luck, int lootingModifier, @Nullable Entity lootedEntity, @Nullable HumanEntity killer) { Preconditions.checkArgument(location != null, "LootContext location cannot be null"); Preconditions.checkArgument(location.getWorld() != null, "LootContext World cannot be null"); - this.location = location; + this.location = location.clone(); this.luck = luck; this.lootingModifier = lootingModifier; this.lootedEntity = lootedEntity; @@ -38,7 +38,7 @@ public final class LootContext { */ @NotNull public Location getLocation() { - return location; + return location.clone(); } /** @@ -110,7 +110,7 @@ public final class LootContext { * @param location the location the LootContext should use */ public Builder(@NotNull Location location) { - this.location = location; + this.location = location.clone(); } /** diff --git a/paper-api/src/main/java/org/bukkit/util/Transformation.java b/paper-api/src/main/java/org/bukkit/util/Transformation.java index 39f9e50c7d..a23ed4193b 100644 --- a/paper-api/src/main/java/org/bukkit/util/Transformation.java +++ b/paper-api/src/main/java/org/bukkit/util/Transformation.java @@ -27,9 +27,9 @@ public class Transformation { Preconditions.checkArgument(scale != null, "scale cannot be null"); Preconditions.checkArgument(rightRotation != null, "rightRotation cannot be null"); - this.translation = translation; + this.translation = new Vector3f(translation); this.leftRotation = new Quaternionf(leftRotation); - this.scale = scale; + this.scale = new Vector3f(scale); this.rightRotation = new Quaternionf(rightRotation); } @@ -39,10 +39,10 @@ public class Transformation { Preconditions.checkArgument(scale != null, "scale cannot be null"); Preconditions.checkArgument(rightRotation != null, "rightRotation cannot be null"); - this.translation = translation; - this.leftRotation = leftRotation; - this.scale = scale; - this.rightRotation = rightRotation; + this.translation = new Vector3f(translation); + this.leftRotation = new Quaternionf(leftRotation); + this.scale = new Vector3f(scale); + this.rightRotation = new Quaternionf(rightRotation); } /** @@ -52,7 +52,7 @@ public class Transformation { */ @NotNull public Vector3f getTranslation() { - return this.translation; + return new Vector3f(this.translation); } /** @@ -62,7 +62,7 @@ public class Transformation { */ @NotNull public Quaternionf getLeftRotation() { - return this.leftRotation; + return new Quaternionf(this.leftRotation); } /** @@ -72,7 +72,7 @@ public class Transformation { */ @NotNull public Vector3f getScale() { - return this.scale; + return new Vector3f(this.scale); } /** @@ -82,7 +82,7 @@ public class Transformation { */ @NotNull public Quaternionf getRightRotation() { - return this.rightRotation; + return new Quaternionf(this.rightRotation); } @Override diff --git a/paper-api/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java b/paper-api/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java index 2515887c20..eeedfedc47 100644 --- a/paper-api/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java +++ b/paper-api/src/main/java/org/spigotmc/event/player/PlayerSpawnLocationEvent.java @@ -37,7 +37,7 @@ public class PlayerSpawnLocationEvent extends PlayerEvent { * @param location the spawn location */ public void setSpawnLocation(@NotNull Location location) { - this.spawnLocation = location; + this.spawnLocation = location.clone(); } @NotNull