Initial annotation usage cleanup + EditorConfig

This commit is contained in:
Alexander Söderberg
2021-01-09 22:28:41 +01:00
parent 8b332adbe7
commit 57fc51d013
527 changed files with 13255 additions and 7862 deletions
.editorconfig
.github
Bukkit
build.gradle.kts
src
main
java
com
plotsquared
bukkit
BukkitCommand.javaBukkitPlatform.java
entity
generator
inject
listener
managers
permissions
placeholder
player
queue
schematic
util
uuid
Core
build.gradle.kts
src
main
java
com
plotsquared
core
Platform.javaPlotAPI.javaPlotPlatform.javaPlotSquared.javaPlotVersion.java
backup
collection
command
components
configuration
database
events
generator
inject
listener
location
permissions
player
plot
BlockBucket.javaPlot.javaPlotArea.javaPlotAreaTerrainType.javaPlotAreaType.javaPlotCluster.javaPlotCommentContainer.javaPlotHandler.javaPlotId.javaPlotInventory.javaPlotItemStack.javaPlotManager.javaPlotModificationManager.javaPlotSettings.javaPlotWeather.javaPlotWorld.javaRating.java
comment
expiration
flag
FlagContainer.javaFlagParseException.javaGlobalFlagContainer.javaInternalFlag.javaPlotFlag.java
implementations
types
schematic
world
queue
services
setup
synchronization
util
uuid
resources
test
build.gradle.kts

@ -30,4 +30,5 @@ class AgeableStats {
int age;
boolean locked;
boolean adult;
}

@ -37,4 +37,5 @@ class ArmorStandStats {
boolean noPlate;
boolean invisible;
boolean small;
}

@ -34,4 +34,5 @@ class EntityBaseStats {
double vZ;
double vY;
double vX;
}

@ -29,8 +29,7 @@ import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import javax.annotation.Nonnull;
import org.checkerframework.checker.nullness.qual.NonNull;
public abstract class EntityWrapper {
@ -42,7 +41,7 @@ public abstract class EntityWrapper {
public double y;
public double z;
EntityWrapper(@Nonnull final Entity entity) {
EntityWrapper(final @NonNull Entity entity) {
this.entity = entity;
this.type = entity.getType();
@ -54,7 +53,9 @@ public abstract class EntityWrapper {
this.pitch = location.getPitch();
}
@SuppressWarnings("deprecation") @Override public String toString() {
@SuppressWarnings("deprecation")
@Override
public String toString() {
return String.format("[%s, x=%s, y=%s, z=%s]", type.getName(), x, y, z);
}
@ -89,4 +90,5 @@ public abstract class EntityWrapper {
public double getZ() {
return this.z;
}
}

@ -34,4 +34,5 @@ class HorseStats {
Horse.Variant variant;
Horse.Color color;
Horse.Style style;
}

@ -50,4 +50,5 @@ class LivingEntityStats {
ItemStack chestplate;
Collection<PotionEffect> potions;
ItemStack offHand;
}

@ -241,9 +241,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
case "ARMOR_STAND":
ArmorStand stand = (ArmorStand) entity;
this.inventory =
new ItemStack[] {stand.getItemInHand().clone(), stand.getHelmet().clone(),
stand.getChestplate().clone(), stand.getLeggings().clone(),
stand.getBoots().clone()};
new ItemStack[]{stand.getItemInHand().clone(), stand.getHelmet().clone(),
stand.getChestplate().clone(), stand.getLeggings().clone(),
stand.getBoots().clone()};
storeLiving(stand);
this.stand = new ArmorStandStats();
@ -336,15 +336,17 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.dataByte = (byte) 0;
}
storeLiving((LivingEntity) entity);
// END LIVING //
// END LIVING //
}
}
@Override public boolean equals(Object obj) {
@Override
public boolean equals(Object obj) {
return this.hash == obj.hashCode();
}
@Override public int hashCode() {
@Override
public int hashCode() {
return this.hash;
}
@ -460,7 +462,8 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.tamed.tamed = tamed.isTamed();
}
@Override public Entity spawn(World world, int xOffset, int zOffset) {
@Override
public Entity spawn(World world, int xOffset, int zOffset) {
Location location = new Location(world, this.getX() + xOffset, this.getY(), this.z + zOffset);
location.setYaw(this.yaw);
location.setPitch(this.pitch);
@ -647,36 +650,40 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
}
if (this.stand.head[0] != 0 || this.stand.head[1] != 0 || this.stand.head[2] != 0) {
EulerAngle pose =
new EulerAngle(this.stand.head[0], this.stand.head[1], this.stand.head[2]);
new EulerAngle(this.stand.head[0], this.stand.head[1], this.stand.head[2]);
stand.setHeadPose(pose);
}
if (this.stand.body[0] != 0 || this.stand.body[1] != 0 || this.stand.body[2] != 0) {
EulerAngle pose =
new EulerAngle(this.stand.body[0], this.stand.body[1], this.stand.body[2]);
new EulerAngle(this.stand.body[0], this.stand.body[1], this.stand.body[2]);
stand.setBodyPose(pose);
}
if (this.stand.leftLeg[0] != 0 || this.stand.leftLeg[1] != 0
|| this.stand.leftLeg[2] != 0) {
|| this.stand.leftLeg[2] != 0) {
EulerAngle pose = new EulerAngle(this.stand.leftLeg[0], this.stand.leftLeg[1],
this.stand.leftLeg[2]);
this.stand.leftLeg[2]
);
stand.setLeftLegPose(pose);
}
if (this.stand.rightLeg[0] != 0 || this.stand.rightLeg[1] != 0
|| this.stand.rightLeg[2] != 0) {
|| this.stand.rightLeg[2] != 0) {
EulerAngle pose = new EulerAngle(this.stand.rightLeg[0], this.stand.rightLeg[1],
this.stand.rightLeg[2]);
this.stand.rightLeg[2]
);
stand.setRightLegPose(pose);
}
if (this.stand.leftArm[0] != 0 || this.stand.leftArm[1] != 0
|| this.stand.leftArm[2] != 0) {
|| this.stand.leftArm[2] != 0) {
EulerAngle pose = new EulerAngle(this.stand.leftArm[0], this.stand.leftArm[1],
this.stand.leftArm[2]);
this.stand.leftArm[2]
);
stand.setLeftArmPose(pose);
}
if (this.stand.rightArm[0] != 0 || this.stand.rightArm[1] != 0
|| this.stand.rightArm[2] != 0) {
|| this.stand.rightArm[2] != 0) {
EulerAngle pose = new EulerAngle(this.stand.rightArm[0], this.stand.rightArm[1],
this.stand.rightArm[2]);
this.stand.rightArm[2]
);
stand.setRightArmPose(pose);
}
if (this.stand.invisible) {

@ -31,4 +31,5 @@ class TameableStats {
AnimalTamer owner;
boolean tamed;
}

@ -44,7 +44,8 @@ public class TeleportEntityWrapper extends EntityWrapper {
super(entity);
}
@Override public Entity spawn(final World world, final int xOffset, final int zOffset) {
@Override
public Entity spawn(final World world, final int xOffset, final int zOffset) {
if (!getEntity().getLocation().getChunk().equals(oldLocation.getChunk())) {
final Location oldLocation = this.oldLocation.clone();
oldLocation.add(xOffset, 0, xOffset);
@ -58,7 +59,8 @@ public class TeleportEntityWrapper extends EntityWrapper {
return getEntity();
}
@Override public void saveEntity() {
@Override
public void saveEntity() {
if (getEntity().hasMetadata("ps-tmp-teleport")) {
this.oldLocation = (Location) this.getEntity().getMetadata("ps-tmp-teleport").get(0);
} else {
@ -77,11 +79,13 @@ public class TeleportEntityWrapper extends EntityWrapper {
this.getEntity().setInvulnerable(true);
this.fireTicksOld = this.getEntity().getFireTicks();
this.livingTicksOld = this.getEntity().getTicksLived();
this.getEntity().setMetadata("ps-tmp-teleport",
new FixedMetadataValue(BukkitPlatform.getPlugin(BukkitPlatform.class), oldLocation));
this.getEntity().setMetadata(
"ps-tmp-teleport",
new FixedMetadataValue(BukkitPlatform.getPlugin(BukkitPlatform.class), oldLocation)
);
final Chunk newChunk = getNewChunk();
this.getEntity().teleport(
new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4));
new Location(newChunk.getWorld(), newChunk.getX() << 4, 5000, newChunk.getZ() << 4));
}
private Chunk getNewChunk() {
@ -115,4 +119,5 @@ public class TeleportEntityWrapper extends EntityWrapper {
private Chunk getChunkRelative(final Chunk chunk, final int dx, final int dz) {
return chunk.getWorld().getChunkAt(chunk.getX() + dx, chunk.getZ() + dz);
}
}