13
0
geforkt von Mirrors/Paper

Fix a bunch more issues arising from mutable types (#11769)

Dieser Commit ist enthalten in:
Jake Potrebic 2024-12-22 13:50:00 -08:00 committet von GitHub
Ursprung 8ad15d64f0
Commit 083c083188
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
19 geänderte Dateien mit 39 neuen und 39 gelöschten Zeilen

Datei anzeigen

@ -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();
}
/**

Datei anzeigen

@ -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();
}
/**

Datei anzeigen

@ -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;
}
/**

Datei anzeigen

@ -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();
}
/**

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -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

Datei anzeigen

@ -241,7 +241,7 @@ public class PlayerInteractEvent extends PlayerEvent implements Cancellable {
@Nullable
@Deprecated // Paper
public Vector getClickedPosition() {
return clickedPosistion;
return clickedPosistion.clone();
}
// Paper start

Datei anzeigen

@ -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

Datei anzeigen

@ -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();
}
/**

Datei anzeigen

@ -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

Datei anzeigen

@ -45,7 +45,7 @@ public class AsyncStructureSpawnEvent extends WorldEvent implements Cancellable
*/
@NotNull
public BoundingBox getBoundingBox() {
return boundingBox;
return boundingBox.clone();
}
/**

Datei anzeigen

@ -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();
}
/**

Datei anzeigen

@ -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

Datei anzeigen

@ -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