Merge branch 'main' into chore/sqlite3.43-mitigate

This commit is contained in:
Alexander Brandes 2023-10-08 21:41:29 +02:00 committed by GitHub
commit b0823306a9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 83 additions and 28 deletions

View File

@ -33,6 +33,7 @@ import org.bukkit.entity.Ageable;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Boat;
import org.bukkit.entity.Breedable;
import org.bukkit.entity.ChestedHorse;
import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity;
@ -165,7 +166,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
//this.horse.style = horse.getStyle();
//this.horse.color = horse.getColor();
storeTameable(horse);
storeAgeable(horse);
storeBreedable(horse);
storeLiving(horse);
storeInventory(horse);
return;
@ -173,7 +174,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
// END INVENTORY HOLDER //
case "WOLF", "OCELOT" -> {
storeTameable((Tameable) entity);
storeAgeable((Ageable) entity);
storeBreedable((Breedable) entity);
storeLiving((LivingEntity) entity);
return;
}
@ -187,18 +188,18 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.dataByte = (byte) 0;
}
this.dataByte2 = sheep.getColor().getDyeData();
storeAgeable(sheep);
storeBreedable(sheep);
storeLiving(sheep);
return;
}
case "VILLAGER", "CHICKEN", "COW", "MUSHROOM_COW", "PIG", "TURTLE", "POLAR_BEAR" -> {
storeAgeable((Ageable) entity);
storeBreedable((Breedable) entity);
storeLiving((LivingEntity) entity);
return;
}
case "RABBIT" -> {
this.dataByte = getOrdinal(Rabbit.Type.values(), ((Rabbit) entity).getRabbitType());
storeAgeable((Ageable) entity);
storeBreedable((Breedable) entity);
storeLiving((LivingEntity) entity);
return;
}
@ -382,6 +383,11 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
}
}
/**
* @deprecated Use {@link #restoreBreedable(Breedable)} instead
* @since TODO
*/
@Deprecated(forRemoval = true, since = "TODO")
private void restoreAgeable(Ageable entity) {
if (!this.aged.adult) {
entity.setBaby();
@ -392,6 +398,11 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
}
}
/**
* @deprecated Use {@link #storeBreedable(Breedable)} instead
* @since TODO
*/
@Deprecated(forRemoval = true, since = "TODO")
public void storeAgeable(Ageable aged) {
this.aged = new AgeableStats();
this.aged.age = aged.getAge();
@ -399,6 +410,29 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.aged.adult = aged.isAdult();
}
/**
* @since TODO
*/
private void restoreBreedable(Breedable entity) {
if (!this.aged.adult) {
entity.setBaby();
}
entity.setAgeLock(this.aged.locked);
if (this.aged.age > 0) {
entity.setAge(this.aged.age);
}
}
/**
* @since TODO
*/
private void storeBreedable(Breedable breedable) {
this.aged = new AgeableStats();
this.aged.age = breedable.getAge();
this.aged.locked = breedable.getAgeLock();
this.aged.adult = breedable.isAdult();
}
public void storeTameable(Tameable tamed) {
this.tamed = new TameableStats();
this.tamed.owner = tamed.getOwner();
@ -502,7 +536,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
//horse.setStyle(this.horse.style);
//horse.setColor(this.horse.color);
restoreTameable(horse);
restoreAgeable(horse);
restoreBreedable(horse);
restoreLiving(horse);
restoreInventory(horse);
return entity;
@ -510,7 +544,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
// END INVENTORY HOLDER //
case "WOLF", "OCELOT" -> {
restoreTameable((Tameable) entity);
restoreAgeable((Ageable) entity);
restoreBreedable((Breedable) entity);
restoreLiving((LivingEntity) entity);
return entity;
}
@ -523,12 +557,12 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
if (this.dataByte2 != 0) {
sheep.setColor(DyeColor.getByDyeData(this.dataByte2));
}
restoreAgeable(sheep);
restoreBreedable(sheep);
restoreLiving(sheep);
return sheep;
}
case "VILLAGER", "CHICKEN", "COW", "TURTLE", "POLAR_BEAR", "MUSHROOM_COW", "PIG" -> {
restoreAgeable((Ageable) entity);
restoreBreedable((Breedable) entity);
restoreLiving((LivingEntity) entity);
return entity;
}
@ -537,7 +571,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
if (this.dataByte != 0) {
((Rabbit) entity).setRabbitType(Rabbit.Type.values()[this.dataByte]);
}
restoreAgeable((Ageable) entity);
restoreBreedable((Breedable) entity);
restoreLiving((LivingEntity) entity);
return entity;
}

View File

@ -72,7 +72,8 @@ tasks {
opt.links("https://jd.advntr.dev/text-minimessage/4.14.0/")
opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
opt.links("https://checkerframework.org/api/")
opt.links("https://javadocs.dev/com.intellectualsites.informative-annotations/informative-annotations/latest")
opt.links("https://javadocs.dev/com.intellectualsites.informative-annotations/informative-annotations/"
+ libs.informativeAnnotations.get().versionConstraint.toString())
opt.isLinkSource = true
opt.bottom(File("$rootDir/javadocfooter.html").readText())
opt.isUse = true

View File

@ -51,6 +51,8 @@ import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.RegionUtil;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
@ -391,6 +393,28 @@ public abstract class PlotArea implements ComponentLike {
}
}
this.spawnEggs = config.getBoolean("event.spawn.egg");
this.spawnCustom = config.getBoolean("event.spawn.custom");
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
if (PlotSquared.get().isWeInitialised()) {
loadFlags(config);
} else {
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.delaying_loading_area_flags"),
TagResolver.resolver("area", Tag.inserting(Component.text(this.id == null ? this.worldName : this.id)))
);
TaskManager.runTaskLater(() -> loadFlags(config), TaskTime.ticks(1));
}
loadConfiguration(config);
}
private void loadFlags(ConfigurationSection config) {
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.loading_area_flags"),
TagResolver.resolver("area", Tag.inserting(Component.text(this.id == null ? this.worldName : this.id)))
);
List<String> flags = config.getStringList("flags.default");
if (flags.isEmpty()) {
flags = config.getStringList("flags");
@ -411,10 +435,6 @@ public abstract class PlotArea implements ComponentLike {
TagResolver.resolver("flags", Tag.inserting(Component.text(flags.toString())))
);
this.spawnEggs = config.getBoolean("event.spawn.egg");
this.spawnCustom = config.getBoolean("event.spawn.custom");
this.spawnBreeding = config.getBoolean("event.spawn.breeding");
List<String> roadflags = config.getStringList("road.flags");
if (roadflags.isEmpty()) {
roadflags = new ArrayList<>();
@ -426,14 +446,12 @@ public abstract class PlotArea implements ComponentLike {
}
}
}
this.roadFlags = roadflags.size() > 0;
this.roadFlags = !roadflags.isEmpty();
parseFlags(this.getRoadFlagContainer(), roadflags);
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("flags.road_flags"),
TagResolver.resolver("flags", Tag.inserting(Component.text(roadflags.toString())))
);
loadConfiguration(config);
}
public abstract void loadConfiguration(ConfigurationSection config);

View File

@ -632,6 +632,8 @@
"flags.flag_error_double": "Flag value must be a decimal number.",
"flags.flag_error_music": "Flag value must be a valid music disc ID.",
"flags.flag_error_title": "Flag value must be in the format </red><grey>\"A title\" \"The subtitle\"</grey><red>.",
"flags.delaying_loading_area_flags": "<prefix><gray>Delaying loading flags for area `</gray><dark_aqua><area></dark_aqua><gray>` as WorldEdit is not initialised yet.</gray>",
"flags.loading_area_flags": "<prefix><gray>Loading flags for area: </gray><dark_aqua><area></dark_aqua>",
"flags.area_flags": "<prefix><gray>Area flags: </gray><dark_aqua><flags></dark_aqua>",
"flags.road_flags": "<prefix><gray>Road flags: </gray><dark_aqua><flags></dark_aqua>",
"commands.description.add": "<gray>Allow a user to build in a plot while the plot owner is online.</gray>",

View File

@ -3,7 +3,7 @@
paper = "1.20.2-R0.1-SNAPSHOT"
guice = "7.0.0"
spotbugs = "4.7.3"
checkerqual = "3.38.0"
checkerqual = "3.39.0"
gson = "2.10"
guava = "31.1-jre"
snakeyaml = "2.0"
@ -28,7 +28,7 @@ squirrelid = "0.3.2"
paster = "1.1.5"
bstats = "3.0.2"
paperlib = "1.0.8"
informative-annotations = "1.3"
informative-annotations = "1.4"
vault = "1.7.1"
serverlib = "2.3.4"

View File

@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME

14
gradlew vendored
View File

@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
# shellcheck disable=SC2039,SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
@ -202,11 +202,11 @@ fi
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Collect all arguments for the java command;
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
# shell script including quotes and variable substitutions, so put them in
# double quotes to make sure that they get re-expanded; and
# * put everything else in single quotes, so that it's not re-expanded.
# Collect all arguments for the java command:
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
# and any embedded shellness will be escaped.
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
# treated as '${Hostname}' itself on the command line.
set -- \
"-Dorg.gradle.appname=$APP_BASE_NAME" \