Compare commits

..

8 Commits

Author SHA1 Message Date
03aa60b05d Always call plot events through the event dispatcher 2022-01-28 08:13:15 +01:00
126aa53b61 build: Back to snapshot for development 2022-01-27 14:00:51 +01:00
ac71046feb build: Release 6.4.0 2022-01-27 13:49:17 +01:00
7c290e6bd0 Align plugin's java version with API java version - Java 17 (#3468)
* refactor!: Align plugin's java version with API java version

* fix: Bump Guice to fix private injection on Java 17
2022-01-27 13:26:58 +01:00
4d297cc829 Separate linked javadocs per module (#3476)
* docs: Separate javadocs per module

* docs: Read javadoc version from Gradle version catalog
2022-01-27 13:26:27 +01:00
5ab410a5c5 fix: Don't ommit flag int input in no permission message (#3466) 2022-01-27 12:14:39 +01:00
1f28bac955 Fix: Plot#getOwner can be nullable, and redstone may be present on unowned plots (#3472) 2022-01-27 12:14:16 +01:00
92c54de5e9 fix: run whenDone on empty queue (#3474) 2022-01-27 12:13:55 +01:00
14 changed files with 47 additions and 31 deletions

View File

@ -96,10 +96,10 @@ tasks {
withType<Javadoc> { withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions val opt = options as StandardJavadocDocletOptions
opt.links("https://papermc.io/javadocs/paper/1.18/") opt.links("https://papermc.io/javadocs/paper/1.18/")
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/7.2.8/") opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-bukkit/" + libs.worldeditBukkit.get().versionConstraint.toString())
opt.links("https://javadoc.io/doc/com.plotsquared/PlotSquared-Core/latest/") opt.links("https://javadoc.io/doc/com.plotsquared/PlotSquared-Core/latest/")
opt.links("https://jd.adventure.kyori.net/api/4.9.3/") opt.links("https://jd.adventure.kyori.net/api/" + libs.adventure.get().versionConstraint.toString())
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/") opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
opt.links("https://checkerframework.org/api/") opt.links("https://checkerframework.org/api/")
} }
} }

View File

@ -166,7 +166,7 @@ public class BlockEventListener implements Listener {
} }
if (Settings.Redstone.DISABLE_OFFLINE) { if (Settings.Redstone.DISABLE_OFFLINE) {
boolean disable = false; boolean disable = false;
if (!plot.getOwner().equals(DBFunc.SERVER)) { if (!DBFunc.SERVER.equals(plot.getOwner())) {
if (plot.isMerged()) { if (plot.isMerged()) {
disable = true; disable = true;
for (UUID owner : plot.getOwners()) { for (UUID owner : plot.getOwners()) {

View File

@ -58,9 +58,9 @@ tasks.processResources {
tasks { tasks {
withType<Javadoc> { withType<Javadoc> {
val opt = options as StandardJavadocDocletOptions val opt = options as StandardJavadocDocletOptions
opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/7.2.8/") opt.links("https://docs.enginehub.org/javadoc/com.sk89q.worldedit/worldedit-core/" + libs.worldeditCore.get().versionConstraint.toString())
opt.links("https://jd.adventure.kyori.net/api/4.9.3/") opt.links("https://jd.adventure.kyori.net/api/" + libs.adventure.get().versionConstraint.toString())
opt.links("https://google.github.io/guice/api-docs/5.0.1/javadoc/") opt.links("https://google.github.io/guice/api-docs/" + libs.guice.get().versionConstraint.toString() + "/javadoc/")
opt.links("https://checkerframework.org/api/") opt.links("https://checkerframework.org/api/")
} }
} }

View File

@ -126,7 +126,7 @@ public class Done extends SubCommand {
long flagValue = System.currentTimeMillis() / 1000; long flagValue = System.currentTimeMillis() / 1000;
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class) PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(DoneFlag.class)
.createFlagInstance(Long.toString(flagValue)); .createFlagInstance(Long.toString(flagValue));
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = eventDispatcher.callFlagAdd(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage(TranslatableCaption.of("events.event_denied")); player.sendMessage(TranslatableCaption.of("events.event_denied"));
return; return;

View File

@ -25,6 +25,7 @@
*/ */
package com.plotsquared.core.command; package com.plotsquared.core.command;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared; import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings; import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.configuration.caption.CaptionUtility; import com.plotsquared.core.configuration.caption.CaptionUtility;
@ -44,6 +45,7 @@ import com.plotsquared.core.plot.flag.InternalFlag;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.types.IntegerFlag; import com.plotsquared.core.plot.flag.types.IntegerFlag;
import com.plotsquared.core.plot.flag.types.ListFlag; import com.plotsquared.core.plot.flag.types.ListFlag;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.StringComparison; import com.plotsquared.core.util.StringComparison;
@ -79,8 +81,12 @@ import java.util.stream.Stream;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public final class FlagCommand extends Command { public final class FlagCommand extends Command {
public FlagCommand() { private final EventDispatcher eventDispatcher;
@Inject
public FlagCommand(final @NonNull EventDispatcher eventDispatcher) {
super(MainCommand.getInstance(), true); super(MainCommand.getInstance(), true);
this.eventDispatcher = eventDispatcher;
} }
private static boolean sendMessage(PlotPlayer<?> player) { private static boolean sendMessage(PlotPlayer<?> player) {
@ -114,7 +120,7 @@ public final class FlagCommand extends Command {
TranslatableCaption.of("permission.no_permission"), TranslatableCaption.of("permission.no_permission"),
Template.of( Template.of(
"node", "node",
perm perm + "." + numeric
) )
); );
} }
@ -335,7 +341,7 @@ public final class FlagCommand extends Command {
return; return;
} }
Plot plot = player.getLocation().getPlotAbs(); Plot plot = player.getLocation().getPlotAbs();
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = eventDispatcher.callFlagAdd(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),
@ -394,7 +400,7 @@ public final class FlagCommand extends Command {
return; return;
} }
Plot plot = player.getLocation().getPlotAbs(); Plot plot = player.getLocation().getPlotAbs();
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = eventDispatcher.callFlagAdd(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),
@ -463,7 +469,7 @@ public final class FlagCommand extends Command {
return; return;
} }
final Plot plot = player.getLocation().getPlotAbs(); final Plot plot = player.getLocation().getPlotAbs();
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flag, plot); PlotFlagRemoveEvent event = eventDispatcher.callFlagRemove(flag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),
@ -516,7 +522,7 @@ public final class FlagCommand extends Command {
} }
} else { } else {
PlotFlag<?, ?> plotFlag = parsedFlag.createFlagInstance(list); PlotFlag<?, ?> plotFlag = parsedFlag.createFlagInstance(list);
PlotFlagAddEvent addEvent = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent addEvent = eventDispatcher.callFlagAdd(plotFlag, plot);
if (addEvent.getEventResult() == Result.DENY) { if (addEvent.getEventResult() == Result.DENY) {
player.sendMessage( player.sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),

View File

@ -38,10 +38,12 @@ import com.plotsquared.core.plot.PlotInventory;
import com.plotsquared.core.plot.PlotItemStack; import com.plotsquared.core.plot.PlotItemStack;
import com.plotsquared.core.plot.flag.PlotFlag; import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.MusicFlag; import com.plotsquared.core.plot.flag.implementations.MusicFlag;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.InventoryUtil; import com.plotsquared.core.util.InventoryUtil;
import com.plotsquared.core.util.Permissions; import com.plotsquared.core.util.Permissions;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.Template; import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.Arrays; import java.util.Arrays;
@ -63,10 +65,12 @@ public class Music extends SubCommand {
); );
private final InventoryUtil inventoryUtil; private final InventoryUtil inventoryUtil;
private final EventDispatcher eventDispatcher;
@Inject @Inject
public Music(final @Nullable InventoryUtil inventoryUtil) { public Music(final @Nullable InventoryUtil inventoryUtil, final @NonNull EventDispatcher eventDispatcher) {
this.inventoryUtil = inventoryUtil; this.inventoryUtil = inventoryUtil;
this.eventDispatcher = eventDispatcher;
} }
@Override @Override
@ -104,7 +108,7 @@ public class Music extends SubCommand {
if (item.getType() == ItemTypes.BEDROCK) { if (item.getType() == ItemTypes.BEDROCK) {
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class) PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
.createFlagInstance(item.getType()); .createFlagInstance(item.getType());
PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(plotFlag, plot); PlotFlagRemoveEvent event = eventDispatcher.callFlagRemove(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),
@ -121,7 +125,7 @@ public class Music extends SubCommand {
} else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) { } else if (item.getName().toLowerCase(Locale.ENGLISH).contains("disc")) {
PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class) PlotFlag<?, ?> plotFlag = plot.getFlagContainer().getFlag(MusicFlag.class)
.createFlagInstance(item.getType()); .createFlagInstance(item.getType());
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, plot); PlotFlagAddEvent event = eventDispatcher.callFlagAdd(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
getPlayer().sendMessage( getPlayer().sendMessage(
TranslatableCaption.of("events.event_denied"), TranslatableCaption.of("events.event_denied"),

View File

@ -45,6 +45,7 @@ import com.plotsquared.core.queue.ChunkQueueCoordinator;
import com.plotsquared.core.queue.GlobalBlockQueue; import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.queue.QueueCoordinator; import com.plotsquared.core.queue.QueueCoordinator;
import com.plotsquared.core.util.ChunkManager; import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.EventDispatcher;
import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.MathMan;
import com.plotsquared.core.util.RegionManager; import com.plotsquared.core.util.RegionManager;
import com.plotsquared.core.util.RegionUtil; import com.plotsquared.core.util.RegionUtil;
@ -93,6 +94,7 @@ public class HybridUtils {
private final GlobalBlockQueue blockQueue; private final GlobalBlockQueue blockQueue;
private final WorldUtil worldUtil; private final WorldUtil worldUtil;
private final SchematicHandler schematicHandler; private final SchematicHandler schematicHandler;
private final EventDispatcher eventDispatcher;
@Inject @Inject
public HybridUtils( public HybridUtils(
@ -100,13 +102,15 @@ public class HybridUtils {
final @NonNull ChunkManager chunkManager, final @NonNull ChunkManager chunkManager,
final @NonNull GlobalBlockQueue blockQueue, final @NonNull GlobalBlockQueue blockQueue,
final @NonNull WorldUtil worldUtil, final @NonNull WorldUtil worldUtil,
final @NonNull SchematicHandler schematicHandler final @NonNull SchematicHandler schematicHandler,
final @NonNull EventDispatcher eventDispatcher
) { ) {
this.plotAreaManager = plotAreaManager; this.plotAreaManager = plotAreaManager;
this.chunkManager = chunkManager; this.chunkManager = chunkManager;
this.blockQueue = blockQueue; this.blockQueue = blockQueue;
this.worldUtil = worldUtil; this.worldUtil = worldUtil;
this.schematicHandler = schematicHandler; this.schematicHandler = schematicHandler;
this.eventDispatcher = eventDispatcher;
} }
public void regeneratePlotWalls(final PlotArea area) { public void regeneratePlotWalls(final PlotArea area) {
@ -348,7 +352,7 @@ public class HybridUtils {
result.add(whenDone.value.variety_sd); result.add(whenDone.value.variety_sd);
PlotFlag<?, ?> plotFlag = GlobalFlagContainer.getInstance().getFlag(AnalysisFlag.class).createFlagInstance( PlotFlag<?, ?> plotFlag = GlobalFlagContainer.getInstance().getFlag(AnalysisFlag.class).createFlagInstance(
result); result);
PlotFlagAddEvent event = new PlotFlagAddEvent(plotFlag, origin); PlotFlagAddEvent event = eventDispatcher.callFlagAdd(plotFlag, origin);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
return; return;
} }

View File

@ -262,7 +262,9 @@ public final class PlotModificationManager {
if (queue.size() > 0) { if (queue.size() > 0) {
queue.setCompleteTask(run); queue.setCompleteTask(run);
queue.enqueue(); queue.enqueue();
return;
} }
run.run();
return; return;
} }
Plot current = queue.poll(); Plot current = queue.poll();

View File

@ -359,7 +359,7 @@ public class ExpireManager {
.getFlag(AnalysisFlag.class) .getFlag(AnalysisFlag.class)
.createFlagInstance(changed.asList()); .createFlagInstance(changed.asList());
PlotFlagAddEvent event = PlotFlagAddEvent event =
new PlotFlagAddEvent(plotFlag, newPlot); eventDispatcher.callFlagAdd(plotFlag, plot);
if (event.getEventResult() == Result.DENY) { if (event.getEventResult() == Result.DENY) {
return; return;
} }
@ -451,7 +451,7 @@ public class ExpireManager {
plot.getPlotModificationManager().deletePlot(null, whenDone); plot.getPlotModificationManager().deletePlot(null, whenDone);
} }
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.4.0")
public long getAge(UUID uuid) { public long getAge(UUID uuid) {
return getAge(uuid, false); return getAge(uuid, false);
} }
@ -462,7 +462,7 @@ public class ExpireManager {
* @param uuid the uuid of the owner to check against * @param uuid the uuid of the owner to check against
* @param shouldDeleteUnknownOwner {@code true} if an unknown player should be counted as never online * @param shouldDeleteUnknownOwner {@code true} if an unknown player should be counted as never online
* @return the millis since the player was last online, or {@link Long#MAX_VALUE} if player was never online * @return the millis since the player was last online, or {@link Long#MAX_VALUE} if player was never online
* @since TODO * @since 6.4.0
*/ */
public long getAge(UUID uuid, final boolean shouldDeleteUnknownOwner) { public long getAge(UUID uuid, final boolean shouldDeleteUnknownOwner) {
if (PlotSquared.platform().playerManager().getPlayerIfExists(uuid) != null) { if (PlotSquared.platform().playerManager().getPlayerIfExists(uuid) != null) {

View File

@ -160,7 +160,7 @@ public class ExpiryTask {
/** /**
* Returns {@code true} if this task respects unknown owners * Returns {@code true} if this task respects unknown owners
* @return {@code true} if unknown owners should be counted as never online * @return {@code true} if unknown owners should be counted as never online
* @since TODO * @since 6.4.0
*/ */
public boolean shouldDeleteForUnknownOwner() { public boolean shouldDeleteForUnknownOwner() {
return settings.DELETE_IF_OWNER_IS_UNKNOWN; return settings.DELETE_IF_OWNER_IS_UNKNOWN;

View File

@ -166,7 +166,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @return The player's name, None, Everyone or Unknown * @return The player's name, None, Everyone or Unknown
* @deprecated Use {@link #resolveName(UUID)} * @deprecated Use {@link #resolveName(UUID)}
*/ */
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.4.0")
public static @NonNull String getName(final @Nullable UUID owner) { public static @NonNull String getName(final @Nullable UUID owner) {
return getName(owner, true); return getName(owner, true);
} }
@ -179,7 +179,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @return The player's name, None, Everyone or Unknown * @return The player's name, None, Everyone or Unknown
* @deprecated Use {@link #resolveName(UUID, boolean)} * @deprecated Use {@link #resolveName(UUID, boolean)}
*/ */
@Deprecated(forRemoval = true, since = "TODO") @Deprecated(forRemoval = true, since = "6.4.0")
public static @NonNull String getName(final @Nullable UUID owner, final boolean blocking) { public static @NonNull String getName(final @Nullable UUID owner, final boolean blocking) {
if (owner == null) { if (owner == null) {
TranslatableCaption.of("info.none"); TranslatableCaption.of("info.none");
@ -217,7 +217,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param owner The UUID of the owner * @param owner The UUID of the owner
* @return A caption containing either the name, {@code None}, {@code Everyone} or {@code Unknown} * @return A caption containing either the name, {@code None}, {@code Everyone} or {@code Unknown}
* @see #resolveName(UUID, boolean) * @see #resolveName(UUID, boolean)
* @since TODO * @since 6.4.0
*/ */
public static @NonNull Caption resolveName(final @Nullable UUID owner) { public static @NonNull Caption resolveName(final @Nullable UUID owner) {
return resolveName(owner, true); return resolveName(owner, true);
@ -229,7 +229,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param owner The UUID of the owner * @param owner The UUID of the owner
* @param blocking If the operation should block the current thread for {@link Settings.UUID#BLOCKING_TIMEOUT} milliseconds * @param blocking If the operation should block the current thread for {@link Settings.UUID#BLOCKING_TIMEOUT} milliseconds
* @return A caption containing either the name, {@code None}, {@code Everyone} or {@code Unknown} * @return A caption containing either the name, {@code None}, {@code Everyone} or {@code Unknown}
* @since TODO * @since 6.4.0
*/ */
public static @NonNull Caption resolveName(final @Nullable UUID owner, final boolean blocking) { public static @NonNull Caption resolveName(final @Nullable UUID owner, final boolean blocking) {
if (owner == null) { if (owner == null) {

View File

@ -328,7 +328,7 @@ public class StringMan {
/** /**
* @param message an input string * @param message an input string
* @return a list of strings * @return a list of strings
* @since TODO * @since 6.4.0
* *
* <table border="1"> * <table border="1">
* <caption>Converts multiple quoted and single strings into a list of strings</caption> * <caption>Converts multiple quoted and single strings into a list of strings</caption>

View File

@ -18,7 +18,7 @@ plugins {
idea idea
} }
version = "6.3.1-SNAPSHOT" version = "6.4.1-SNAPSHOT"
allprojects { allprojects {
group = "com.plotsquared" group = "com.plotsquared"
@ -77,7 +77,7 @@ allprojects {
} }
tasks.compileJava.configure { tasks.compileJava.configure {
options.release.set(16) options.release.set(17)
} }
configurations.all { configurations.all {

View File

@ -7,7 +7,7 @@ guava = "31.0.1-jre" # Version set by Minecraft
# Platform expectations # Platform expectations
paper = "1.18.1-R0.1-SNAPSHOT" paper = "1.18.1-R0.1-SNAPSHOT"
checker-qual = "3.21.1" checker-qual = "3.21.1"
guice = "5.0.1" guice = "5.1.0"
findbugs = "3.0.1" findbugs = "3.0.1"
snakeyaml = "1.30" # Version set by Bukkit snakeyaml = "1.30" # Version set by Bukkit