Address style violations

This commit is contained in:
NotMyFault 2021-08-18 11:58:18 +02:00
parent 252d6a2866
commit 2988ad6b11
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
99 changed files with 494 additions and 345 deletions

View File

@ -9,9 +9,9 @@ jobs:
- name: "Checkout Repository"
uses: "actions/checkout@v2.3.4"
- name: "Setup JDK 16"
uses: "actions/setup-java@v2.1.0"
uses: "actions/setup-java@v2.2.0"
with:
distribution: "adopt"
distribution: "temurin"
java-version: "16"
- name: "Clean Build"
run: "./gradlew clean build"

View File

@ -120,6 +120,8 @@ import io.papermc.lib.PaperLib;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bstats.bukkit.Metrics;
import org.bstats.charts.DrilldownPie;
import org.bstats.charts.SimplePie;
@ -140,8 +142,6 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.incendo.serverlib.ServerLib;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.lang.reflect.Method;
@ -274,7 +274,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
// We create the injector after PlotSquared has been initialized, so that we have access
// to generated instances and settings
this.injector = Guice
.createInjector(Stage.PRODUCTION,
.createInjector(
Stage.PRODUCTION,
new PermissionModule(),
new WorldManagerModule(),
new PlotSquaredModule(),
@ -991,10 +992,11 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
@Override
public @Nullable final ChunkGenerator getDefaultWorldGenerator(
public @Nullable
final ChunkGenerator getDefaultWorldGenerator(
final @NonNull String worldName,
final @Nullable String id)
{
final @Nullable String id
) {
final IndependentPlotGenerator result;
if (id != null && id.equalsIgnoreCase("single")) {
result = injector().getInstance(SingleWorldGenerator.class);
@ -1023,7 +1025,8 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl
}
return new BukkitPlotGenerator(world, gen, this.plotAreaManager);
} else {
return new BukkitPlotGenerator(world,
return new BukkitPlotGenerator(
world,
injector().getInstance(Key.get(IndependentPlotGenerator.class, DefaultGenerator.class)),
this.plotAreaManager
);

View File

@ -26,6 +26,8 @@
package com.plotsquared.bukkit.entity;
import com.plotsquared.core.configuration.Settings;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.Art;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -55,8 +57,6 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.List;

View File

@ -1209,4 +1209,5 @@ public class BlockEventListener implements Listener {
event.setCancelled(true);
}
}
}

View File

@ -349,7 +349,8 @@ public class EntityEventListener implements Listener {
// trampling farmland
BlockType blockType = BukkitAdapter.asBlockType(type);
if (!this.eventDispatcher.checkPlayerBlockEvent(pp,
PlayerBlockEventType.TRIGGER_PHYSICAL, location, blockType, true)) {
PlayerBlockEventType.TRIGGER_PHYSICAL, location, blockType, true
)) {
event.setCancelled(true);
}
return;

View File

@ -711,7 +711,8 @@ public class PlayerEventListener extends PlotListener implements Listener {
// allowing colour.
if (plotPlayer.hasPermission("plots.chat.color")) {
msgTemplate = Template
.of("msg",
.of(
"msg",
BukkitUtil.LEGACY_COMPONENT_SERIALIZER.deserialize(ChatColor.translateAlternateColorCodes(
'&',
message
@ -1116,7 +1117,9 @@ public class PlayerEventListener extends PlotListener implements Listener {
// todo: when the code above is rearranged, it would be great to beautify this as well.
// will code this as a temporary, specific bug fix (for dragon eggs)
if (blockType != Material.DRAGON_EGG) return;
if (blockType != Material.DRAGON_EGG) {
return;
}
eventType = PlayerBlockEventType.INTERACT_BLOCK;
blocktype1 = BukkitAdapter.asBlockType(block.getType());

View File

@ -34,6 +34,7 @@ import org.checkerframework.checker.nullness.qual.Nullable;
/**
* Multiverse specific manager that informs Multiverse of
* world creation by executing a console command
*
* @deprecated Deprecated and scheduled for removal without replacement
* in favor of the build in setup wizard.
*/

View File

@ -88,8 +88,10 @@ public class BukkitOfflinePlayer implements OfflinePlotPlayer {
final @NonNull String stub,
final @NonNull String key
) {
return this.permissionProfile.hasPermission(world, stub + "." + key) || this.permissionProfile.hasPermission(world,
stub + ".*");
return this.permissionProfile.hasPermission(world, stub + "." + key) || this.permissionProfile.hasPermission(
world,
stub + ".*"
);
}
}

View File

@ -55,6 +55,8 @@ import net.kyori.adventure.platform.bukkit.BukkitAudiences;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
@ -98,8 +100,6 @@ import org.bukkit.entity.WaterMob;
import org.checkerframework.checker.index.qual.NonNegative;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.Collection;
import java.util.HashSet;
@ -140,7 +140,8 @@ public class BukkitUtil extends WorldUtil {
*/
public static @NonNull Location adapt(final org.bukkit.@NonNull Location location) {
return Location
.at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()),
.at(
com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()),
MathMan.roundInt(location.getX()),
MathMan.roundInt(location.getY()),
MathMan.roundInt(location.getZ())
@ -156,7 +157,8 @@ public class BukkitUtil extends WorldUtil {
*/
public static @NonNull Location adaptComplete(final org.bukkit.@NonNull Location location) {
return Location
.at(com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()),
.at(
com.plotsquared.bukkit.util.BukkitWorld.of(location.getWorld()),
MathMan.roundInt(location.getX()),
MathMan.roundInt(location.getY()),
MathMan.roundInt(location.getZ()),
@ -516,7 +518,8 @@ public class BukkitUtil extends WorldUtil {
tileEntityTypes.addAll(BlockCategories.FLOWER_POTS.getAll());
// Individual Types
// Add these from strings
Stream.of("barrel",
Stream.of(
"barrel",
"beacon",
"beehive",
"bee_nest",

View File

@ -33,12 +33,12 @@ import com.sk89q.worldedit.bukkit.BukkitWorld;
import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.block.BaseBlock;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -32,12 +32,12 @@ import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.PlotVersion;
import com.plotsquared.core.configuration.Settings;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;

View File

@ -32,9 +32,9 @@ import com.plotsquared.core.uuid.UUIDService;
import com.sk89q.squirrelid.Profile;
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
import com.sk89q.squirrelid.resolver.ProfileService;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.IOException;
import java.util.ArrayList;

View File

@ -152,7 +152,8 @@ public class PlotAPI {
*/
public void sendConsoleMessage(
final @NonNull String message,
final @NonNull Template @NonNull... replacements) {
final @NonNull Template @NonNull ... replacements
) {
ConsolePlayer.getConsole().sendMessage(StaticCaption.of(message), replacements);
}
@ -164,7 +165,7 @@ public class PlotAPI {
*/
public void sendConsoleMessage(
final @NonNull Caption caption,
final @NonNull Template @NonNull... replacements
final @NonNull Template @NonNull ... replacements
) {
ConsolePlayer.getConsole().sendMessage(caption, replacements);
}

View File

@ -73,11 +73,11 @@ import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDPipeline;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.math.BlockVector2;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.MonotonicNonNull;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.BufferedReader;
import java.io.File;
@ -135,8 +135,8 @@ public class PlotSquared {
new UUIDPipeline(Executors.newSingleThreadExecutor());
// Localization
private final Map<String, CaptionMap> captionMaps = new HashMap<>();
private CaptionLoader captionLoader;
public HashMap<String, HashMap<PlotId, Plot>> plots_tmp;
private CaptionLoader captionLoader;
// WorldEdit instance
private WorldEdit worldedit;
private File configFile;
@ -556,7 +556,7 @@ public class PlotSquared {
*
* @param input an array of plots to sort
*/
private void sortPlotsByHash(final @NonNull Plot @NonNull[] input) {
private void sortPlotsByHash(final @NonNull Plot @NonNull [] input) {
List<Plot>[] bucket = new ArrayList[32];
Arrays.fill(bucket, new ArrayList<>());
boolean maxLength = false;

View File

@ -66,6 +66,7 @@ public class PlayerBackupProfile implements BackupProfile {
private final SchematicHandler schematicHandler;
private final Object backupLock = new Object();
private volatile List<Backup> backupCache;
@Inject
public PlayerBackupProfile(
@Assisted final @NonNull UUID owner, @Assisted final @NonNull Plot plot,

View File

@ -718,8 +718,8 @@ public class Area extends SubCommand {
generatorTemplate
));
Template tooltipTemplate = Template.of("hover_info", tooltip);
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area.toString());
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area.toString());
Template visitcmdTemplate = Template.of("command_tp", "/plot area tp " + area);
Template infocmdTemplate = Template.of("command_info", "/plot area info " + area);
Template numberTemplate = Template.of("number", String.valueOf(i));
Template nameTemplate = Template.of("area_name", name);
Template typeTemplate = Template.of("area_type", area.getType().name());

View File

@ -316,8 +316,10 @@ public final class Backup extends Command {
if (number < 1 || number > backups.size()) {
player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player))
Template.of(
"plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)
)
);
} else {
final com.plotsquared.core.backup.Backup backup =
@ -326,7 +328,10 @@ public final class Backup extends Command {
.exists(backup.getFile())) {
player.sendMessage(
TranslatableCaption.of("backups.backup_impossible"),
Template.of("plot", TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player))
Template.of(
"plot",
TranslatableCaption.of("generic.generic_invalid_choice").getComponent(player)
)
);
} else {
CmdConfirm.addPending(player, "/plot backup load " + number,

View File

@ -97,7 +97,8 @@ public class Buy extends Command {
if (price <= 0) {
throw new CommandException(TranslatableCaption.of("economy.not_for_sale"));
}
checkTrue(this.econHandler.isSupported(),
checkTrue(
this.econHandler.isSupported(),
TranslatableCaption.of("economy.vault_or_consumer_null")
);
checkTrue(

View File

@ -89,7 +89,9 @@ public class Caps extends SubCommand {
final int current = countedEntities[type];
final int max = plot.getFlag(capFlag);
final String percentage = String.format("%.1f", 100 * ((float) current / max));
String maxBeautified = max >= Integer.MAX_VALUE ? TranslatableCaption.of("info.infinite").getComponent(player) : String.valueOf(max);
String maxBeautified = max >= Integer.MAX_VALUE
? TranslatableCaption.of("info.infinite").getComponent(player)
: String.valueOf(max);
player.sendMessage(
TranslatableCaption.of("info.plot_caps_format"),
Template.of("cap", name),

View File

@ -46,9 +46,9 @@ import com.plotsquared.core.util.Permissions;
import com.plotsquared.core.util.PlotExpression;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
@CommandDeclaration(
command = "claim",

View File

@ -67,8 +67,12 @@ public class Cluster extends SubCommand {
// list, create, delete, resize, invite, kick, leave, helpers, tp, sethome
if (args.length == 0) {
// return arguments
player.sendMessage(TranslatableCaption.of("cluster.cluster_available_args"),
Template.of("list", "<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>")
player.sendMessage(
TranslatableCaption.of("cluster.cluster_available_args"),
Template.of(
"list",
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
)
);
return false;
}
@ -102,7 +106,7 @@ public class Cluster extends SubCommand {
);
for (PlotCluster cluster : clusters) {
// Ignore unmanaged clusters
String name = "'" + cluster.getName() + "' : " + cluster.toString();
String name = "'" + cluster.getName() + "' : " + cluster;
if (player.getUUID().equals(cluster.owner)) {
player.sendMessage(
TranslatableCaption.of("cluster.cluster_list_element_owner"),
@ -852,8 +856,12 @@ public class Cluster extends SubCommand {
return true;
}
}
player.sendMessage(TranslatableCaption.of("cluster.cluster_available_args"),
Template.of("list", "<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>")
player.sendMessage(
TranslatableCaption.of("cluster.cluster_available_args"),
Template.of(
"list",
"<dark_aqua>list</dark_aqua><gray>, </gray><dark_aqua>create</dark_aqua><gray>, </gray><dark_aqua>delete</dark_aqua><gray>, </gray><dark_aqua>resize</dark_aqua><gray>, </gray><dark_aqua>invite</dark_aqua><gray>, </gray><dark_aqua>kick</dark_aqua><gray>, </gray><dark_aqua>leave</dark_aqua><gray>, </gray><dark_aqua>members</dark_aqua><gray>, </gray><dark_aqua>info</dark_aqua><gray>, </gray><dark_aqua>tp</dark_aqua><gray>, </gray><dark_aqua>sethome</dark_aqua>"
)
);
return false;
}

View File

@ -88,7 +88,7 @@ public class Condense extends SubCommand {
if (args.length == 2) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot condense" + area.toString() + " start <radius>")
Template.of("value", "/plot condense" + area + " start <radius>")
);
return false;
}
@ -229,7 +229,7 @@ public class Condense extends SubCommand {
if (args.length == 2) {
player.sendMessage(
TranslatableCaption.of("commandconfig.command_syntax"),
Template.of("value", "/plot condense " + area.toString() + " info <radius>")
Template.of("value", "/plot condense " + area + " info <radius>")
);
return false;
}

View File

@ -77,7 +77,8 @@ public class Copy extends SubCommand {
plot1.getPlotModificationManager().copy(plot2, player).thenAccept(result -> {
if (result) {
player.sendMessage(TranslatableCaption.of("move.copy_success"), Template.of("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)));
Template.of("target", String.valueOf(plot2))
);
} else {
player.sendMessage(TranslatableCaption.of("move.requires_unowned"));
}

View File

@ -125,7 +125,7 @@ public class Debug extends SubCommand {
for (final EntityType entityType : category.getAll()) {
builder.append(entityType.getId()).append(" ");
}
player.sendMessage(StaticCaption.of("<prefix>" + builder.toString()));
player.sendMessage(StaticCaption.of("<prefix>" + builder));
});
EntityType.REGISTRY.values().stream().sorted(Comparator.comparing(EntityType::getId))
.forEach(entityType -> {

View File

@ -80,7 +80,8 @@ public class DebugExec extends SubCommand {
@Override
public boolean onCommand(final PlotPlayer<?> player, String[] args) {
List<String> allowedParams = Arrays
.asList("analyze",
.asList(
"analyze",
"calibrate-analysis",
"start-expire",
"stop-expire",

View File

@ -363,7 +363,8 @@ public final class FlagCommand extends Command {
}
plot.setFlag(parsed);
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
Template.of("value", String.valueOf(parsed)));
Template.of("value", String.valueOf(parsed))
);
}
@CommandDeclaration(command = "add",
@ -430,7 +431,8 @@ public final class FlagCommand extends Command {
return;
}
player.sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", String.valueOf(args[0])),
Template.of("value", String.valueOf(parsed)));
Template.of("value", String.valueOf(parsed))
);
}
@CommandDeclaration(command = "remove",
@ -539,7 +541,8 @@ public final class FlagCommand extends Command {
return;
}
}
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of("value",
player.sendMessage(TranslatableCaption.of("flag.flag_removed"), Template.of("flag", args[0]), Template.of(
"value",
String.valueOf(flag)
));
}
@ -582,7 +585,8 @@ public final class FlagCommand extends Command {
while (flagIterator.hasNext()) {
final String flag = flagIterator.next();
builder.append(MINI_MESSAGE
.parse(TranslatableCaption.of("flag.flag_list_flag").getComponent(player),
.parse(
TranslatableCaption.of("flag.flag_list_flag").getComponent(player),
Template.of("command", "/plot flag info " + flag),
Template.of("flag", flag),
Template.of("suffix", flagIterator.hasNext() ? ", " : "")

View File

@ -120,14 +120,16 @@ public class Help extends Command {
builder.append(MINI_MESSAGE.parse(TranslatableCaption.of("help.help_header").getComponent(player)));
for (CommandCategory c : CommandCategory.values()) {
builder.append(Component.newline()).append(MINI_MESSAGE
.parse(TranslatableCaption.of("help.help_info_item").getComponent(player),
.parse(
TranslatableCaption.of("help.help_info_item").getComponent(player),
Template.of("command", "/plot help"),
Template.of("category", c.name().toLowerCase()),
Template.of("category_desc", c.getComponent(player))
));
}
builder.append(Component.newline()).append(MINI_MESSAGE
.parse(TranslatableCaption.of("help.help_info_item").getComponent(player),
.parse(
TranslatableCaption.of("help.help_info_item").getComponent(player),
Template.of("command", "/plot help"),
Template.of("category", "all"),
Template.of("category_desc", "Display all commands")
@ -151,7 +153,8 @@ public class Help extends Command {
@Override
public Collection<Command> tab(PlotPlayer<?> player, String[] args, boolean space) {
return Stream.of("claiming", "teleport", "settings", "chat", "schematic", "appearance", "info", "debug",
"administration", "all")
"administration", "all"
)
.filter(value -> value.startsWith(args[0].toLowerCase(Locale.ENGLISH)))
.map(value -> new Command(null, false, value, "", RequiredType.NONE, null) {
}).collect(Collectors.toList());

View File

@ -150,7 +150,7 @@ public class Inbox extends SubCommand {
if (total != 0) {
player.sendMessage(
TranslatableCaption.of("comment.inbox_item"),
Template.of("value", inbox.toString() + " (" + total + '/' + unread + ')')
Template.of("value", inbox + " (" + total + '/' + unread + ')')
);
return;
}
@ -179,7 +179,7 @@ public class Inbox extends SubCommand {
return false;
}
final MetaDataKey<Long> metaDataKey = MetaDataKey.of(
String.format("inbox:%s", inbox.toString()),
String.format("inbox:%s", inbox),
new TypeLiteral<>() {
}
);

View File

@ -44,7 +44,6 @@ import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.Template;
import javax.annotation.Nullable;
import java.util.Arrays;
import java.util.Collection;
import java.util.Locale;
@ -85,7 +84,12 @@ public class Music extends SubCommand {
);
return true;
}
PlotInventory inv = new PlotInventory(this.inventoryUtil, player, 2, TranslatableCaption.of("plotjukebox.jukebox_header").getComponent(player)) {
PlotInventory inv = new PlotInventory(
this.inventoryUtil,
player,
2,
TranslatableCaption.of("plotjukebox.jukebox_header").getComponent(player)
) {
@Override
public boolean onClick(int index) {
PlotItemStack item = getItem(index);
@ -104,7 +108,8 @@ public class Music extends SubCommand {
return true;
}
plot.removeFlag(event.getFlag());
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_removed"),
getPlayer().sendMessage(
TranslatableCaption.of("flag.flag_removed"),
Template.of("flag", "music"),
Template.of("value", "music_disc")
);
@ -121,7 +126,8 @@ public class Music extends SubCommand {
}
plot.setFlag(event.getFlag());
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_added"), Template.of("flag", "music"),
Template.of("value", String.valueOf(event.getFlag().getValue())));
Template.of("value", String.valueOf(event.getFlag().getValue()))
);
} else {
getPlayer().sendMessage(TranslatableCaption.of("flag.flag_not_added"));
}

View File

@ -87,7 +87,8 @@ public class Owner extends SetCommand {
);
return;
}
PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(player,
PlotChangeOwnerEvent event = this.eventDispatcher.callOwnerChange(
player,
plot,
plot.hasOwner() ? plot.getOwnerAbs() : null,
uuid,

View File

@ -40,9 +40,9 @@ import com.plotsquared.core.util.query.PlotQuery;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.UUIDMapping;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.HashMap;
import java.util.HashSet;

View File

@ -86,7 +86,8 @@ public class Swap extends SubCommand {
}, true).thenApply(result -> {
if (result) {
player.sendMessage(TranslatableCaption.of("swap.swap_success"), Template.of("origin", String.valueOf(plot1)),
Template.of("target", String.valueOf(plot2)));
Template.of("target", String.valueOf(plot2))
);
return true;
} else {
player.sendMessage(TranslatableCaption.of("swap.swap_overlap"));

View File

@ -46,9 +46,9 @@ import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.util.task.TaskTime;
import com.sk89q.worldedit.math.BlockVector2;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.HashSet;
import java.util.Iterator;

View File

@ -47,10 +47,10 @@ import com.sk89q.worldedit.function.pattern.Pattern;
import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.io.File;
import java.io.IOException;
@ -123,7 +123,8 @@ public class ComponentPresetManager {
.collect(Collectors.toList());
} else {
final List<ComponentPreset> defaultPreset = Collections.singletonList(
new ComponentPreset(ClassicPlotManagerComponent.FLOOR,
new ComponentPreset(
ClassicPlotManagerComponent.FLOOR,
"##wool",
0,
"",
@ -160,7 +161,10 @@ public class ComponentPresetManager {
} else if (!plot.hasOwner()) {
player.sendMessage(TranslatableCaption.of("info.plot_unowned"));
return null;
} else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission(player, Permission.PERMISSION_ADMIN_COMPONENTS_OTHER)) {
} else if (!plot.isOwner(player.getUUID()) && !plot.getTrusted().contains(player.getUUID()) && !Permissions.hasPermission(
player,
Permission.PERMISSION_ADMIN_COMPONENTS_OTHER
)) {
player.sendMessage(TranslatableCaption.of("permission.no_plot_perms"));
return null;
} else if (plot.getVolume() > Integer.MAX_VALUE) {

View File

@ -792,6 +792,7 @@ public class Settings extends Config {
);
@Comment("Whether PlotSquared should hook into MvDWPlaceholderAPI or not")
public static boolean USE_MVDWAPI = true;
}
}

View File

@ -31,7 +31,6 @@ import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.DescriptionFlag;
import com.plotsquared.core.plot.flag.implementations.FarewellFlag;
import com.plotsquared.core.plot.flag.implementations.GreetingFlag;
import com.plotsquared.core.plot.flag.types.StringFlag;
import com.plotsquared.core.plot.flag.implementations.PlotTitleFlag;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.event.ClickEvent;
@ -103,7 +102,6 @@ public class CaptionUtility {
*
* @param miniMessageString the message from which the specified click events should be removed from.
* @return the string without the click events that are configured to be removed.
*
* @see Settings.Chat#CLICK_EVENT_ACTIONS_TO_REMOVE
*/
public static String stripClickEvents(final @NonNull String miniMessageString) {
@ -122,7 +120,6 @@ public class CaptionUtility {
* @param flag the flag the message is targeted for.
* @param miniMessageString the message from which the specified click events should be removed from.
* @return the string without the click events that are configured to be removed.
*
* @see Settings.Chat#CLICK_EVENT_ACTIONS_TO_REMOVE
* @see #stripClickEvents(String)
*/

View File

@ -49,7 +49,6 @@ public interface ChatFormatter {
private final PlotPlayer<?> recipient;
private final boolean rawOutput;
;
private String message;
/**

View File

@ -34,6 +34,7 @@ import java.util.EnumSet;
import java.util.Set;
final class ClickStripTransform implements ComponentTransform {
private final Set<ClickEvent.@NotNull Action> actionsToStrip;
public ClickStripTransform(final Set<ClickEvent.@NotNull Action> actionsToStrip) {
@ -43,7 +44,9 @@ final class ClickStripTransform implements ComponentTransform {
@Override
public @NonNull Component transform(@NonNull final Component original) {
var clickEvent = original.clickEvent();
if (clickEvent == null || !actionsToStrip.contains(clickEvent.action())) return original;
if (clickEvent == null || !actionsToStrip.contains(clickEvent.action())) {
return original;
}
return original.clickEvent(null); // remove it
}

View File

@ -25,8 +25,6 @@
*/
package com.plotsquared.core.configuration.caption;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import net.kyori.adventure.text.Component;
import org.checkerframework.checker.nullness.qual.NonNull;
@ -37,6 +35,7 @@ import java.util.stream.Collectors;
* A transform that applies a nested transform on all child components and the component itself.
*/
final class NestedComponentTransform implements ComponentTransform {
private final ComponentTransform transform;
public NestedComponentTransform(final ComponentTransform transform) {
@ -51,4 +50,5 @@ final class NestedComponentTransform implements ComponentTransform {
private List<Component> transformChildren(List<Component> children) {
return children.stream().map(this::transform).collect(Collectors.toList());
}
}

View File

@ -215,7 +215,8 @@ public final class CaptionLoader {
return new LocalizedCaptionMap(locale, map.entrySet().stream()
.collect(Collectors.toMap(
entry -> TranslatableCaption.of(this.namespace, entry.getKey()),
Map.Entry::getValue)
Map.Entry::getValue
)
));
}
}

View File

@ -25,10 +25,10 @@
*/
package com.plotsquared.core.configuration.caption.load;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.io.BufferedReader;
import java.io.IOException;

View File

@ -63,7 +63,7 @@ public interface DefaultCaptionProvider {
final @NonNull ClassLoader classLoader,
final @NonNull String toFormat
) {
return forClassLoader(classLoader, locale -> String.format(toFormat, locale.toString()));
return forClassLoader(classLoader, locale -> String.format(toFormat, locale));
}
/**

View File

@ -231,7 +231,7 @@ public class ConfigurationSerialization {
if (result == null) {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(
Level.SEVERE,
"Could not call method '" + method.toString() + "' of " + this.clazz
"Could not call method '" + method + "' of " + this.clazz
+ " for deserialization: method returned null"
);
} else {
@ -240,12 +240,12 @@ public class ConfigurationSerialization {
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) {
if (ex instanceof InvocationTargetException) {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
"Could not call method '" + method.toString() + "' of " + this.clazz
"Could not call method '" + method + "' of " + this.clazz
+ " for deserialization", ex.getCause()
);
} else {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
"Could not call method '" + method.toString() + "' of " + this.clazz
"Could not call method '" + method + "' of " + this.clazz
+ " for deserialization", ex
);
}
@ -262,12 +262,12 @@ public class ConfigurationSerialization {
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) {
if (ex instanceof InvocationTargetException) {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
"Could not call constructor '" + ctor.toString() + "' of " + this.clazz
"Could not call constructor '" + ctor + "' of " + this.clazz
+ " for deserialization", ex.getCause()
);
} else {
Logger.getLogger(ConfigurationSerialization.class.getName()).log(Level.SEVERE,
"Could not call constructor '" + ctor.toString() + "' of " + this.clazz
"Could not call constructor '" + ctor + "' of " + this.clazz
+ " for deserialization", ex
);
}

View File

@ -51,9 +51,9 @@ import com.plotsquared.core.util.HashUtil;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.task.RunnableVal;
import com.plotsquared.core.util.task.TaskManager;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
@ -3390,22 +3390,19 @@ public class SQLManager implements AbstractDB {
.toString() + "' WHERE `owner` = '" + old.toString() + '\'');
stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "cluster_helpers` SET `user_uuid` = '"
+ now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
+ now + "' WHERE `user_uuid` = '" + old + '\'');
stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "cluster_invited` SET `user_uuid` = '"
+ now.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
+ now + "' WHERE `user_uuid` = '" + old + '\'');
stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now.toString()
+ "' WHERE `owner` = '" + old.toString() + '\'');
"UPDATE `" + SQLManager.this.prefix + "plot` SET `owner` = '" + now
+ "' WHERE `owner` = '" + old + '\'');
stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" + now
.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
"UPDATE `" + SQLManager.this.prefix + "plot_denied` SET `user_uuid` = '" + now + "' WHERE `user_uuid` = '" + old + '\'');
stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" + now
.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
"UPDATE `" + SQLManager.this.prefix + "plot_helpers` SET `user_uuid` = '" + now + "' WHERE `user_uuid` = '" + old + '\'');
stmt.executeUpdate(
"UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" + now
.toString() + "' WHERE `user_uuid` = '" + old.toString() + '\'');
"UPDATE `" + SQLManager.this.prefix + "plot_trusted` SET `user_uuid` = '" + now + "' WHERE `user_uuid` = '" + old + '\'');
} catch (SQLException e) {
e.printStackTrace();
}

View File

@ -37,9 +37,9 @@ public class PlotChangeOwnerEvent extends PlotEvent implements CancellablePlotEv
private final PlotPlayer<?> initiator;
@Nullable
private final UUID oldOwner;
private final boolean hasOldOwner;
@Nullable
private UUID newOwner;
private final boolean hasOldOwner;
private Result eventResult;
/**

View File

@ -37,10 +37,10 @@ import org.checkerframework.checker.nullness.qual.NonNull;
public final class PlotMergeEvent extends PlotPlayerEvent implements CancellablePlotEvent {
private final String world;
private final PlotPlayer<?> player;
private Direction dir;
private int max;
private Result eventResult;
private final PlotPlayer<?> player;
/**
* PlotMergeEvent: Called when plots are merged

View File

@ -511,32 +511,38 @@ public class ClassicPlotManager extends SquarePlotManager {
),
Location.at(classicPlotWorld.getWorldName(), ex, maxY, ez - 1), BlockTypes.AIR.getDefaultState()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, 0, ez - 1),
BlockUtil.get((short) 7, (byte) 0)
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()
);
if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.WALL_HEIGHT + 1, ez - 1),
classicPlotWorld.WALL_BLOCK.toPattern()
);
}
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), ex, 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), ex, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT, ez - 1),
classicPlotWorld.WALL_FILLING.toPattern()
);
if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.WALL_HEIGHT + 1, ez - 1),
classicPlotWorld.WALL_BLOCK.toPattern()
);
}
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1),
classicPlotWorld.ROAD_BLOCK.toPattern()
);
@ -568,32 +574,38 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
BlockTypes.AIR.getDefaultState()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz),
Location.at(classicPlotWorld.getWorldName(), ex - 1, 0, ez),
BlockUtil.get((short) 7, (byte) 0)
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, sz),
classicPlotWorld.WALL_FILLING.toPattern()
);
if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, sz),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, sz),
classicPlotWorld.WALL_BLOCK.toPattern()
);
}
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, ez),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, ez),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT, ez),
classicPlotWorld.WALL_FILLING.toPattern()
);
if (classicPlotWorld.PLACE_TOP_BLOCK) {
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.WALL_HEIGHT + 1, ez),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.WALL_HEIGHT + 1, ez),
classicPlotWorld.WALL_BLOCK.toPattern()
);
}
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1),
classicPlotWorld.ROAD_BLOCK.toPattern()
);
@ -623,7 +635,8 @@ public class ClassicPlotManager extends SquarePlotManager {
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 0, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex - 1, 0, ez - 1), BlockUtil.get((short) 7, (byte) 0)
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.ROAD_HEIGHT, ez - 1),
classicPlotWorld.ROAD_BLOCK.toPattern()
);
@ -656,11 +669,13 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
BlockTypes.AIR.getDefaultState()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT - 1, ez - 1),
classicPlotWorld.MAIN_BLOCK.toPattern()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz + 1),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz + 1),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT, ez - 1),
classicPlotWorld.TOP_BLOCK.toPattern()
);
@ -694,11 +709,13 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
BlockTypes.AIR.getDefaultState()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, 1, sz),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT - 1, ez),
classicPlotWorld.MAIN_BLOCK.toPattern()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.PLOT_HEIGHT, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx + 1, classicPlotWorld.PLOT_HEIGHT, sz),
Location.at(classicPlotWorld.getWorldName(), ex - 1, classicPlotWorld.PLOT_HEIGHT, ez),
classicPlotWorld.TOP_BLOCK.toPattern()
);
@ -731,11 +748,13 @@ public class ClassicPlotManager extends SquarePlotManager {
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.getPlotManager().getWorldHeight(), ez),
BlockTypes.AIR.getDefaultState()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, 1, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, 1, sz),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT - 1, ez),
classicPlotWorld.MAIN_BLOCK.toPattern()
);
queue.setCuboid(Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz),
queue.setCuboid(
Location.at(classicPlotWorld.getWorldName(), sx, classicPlotWorld.PLOT_HEIGHT, sz),
Location.at(classicPlotWorld.getWorldName(), ex, classicPlotWorld.PLOT_HEIGHT, ez),
classicPlotWorld.TOP_BLOCK.toPattern()
);

View File

@ -55,13 +55,11 @@ import com.sk89q.worldedit.math.transform.AffineTransform;
import com.sk89q.worldedit.util.Direction;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.lang.reflect.Field;
import java.util.HashMap;

View File

@ -61,9 +61,9 @@ import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockType;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.io.File;
import java.util.ArrayDeque;
@ -482,7 +482,8 @@ public class HybridUtils {
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
BlockVector2 loc = iterator.next();
iterator.remove();
LOGGER.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)",
LOGGER.error(
"Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)",
area.getWorldHash(),
loc.getX(),
loc.getZ()
@ -626,7 +627,8 @@ public class HybridUtils {
int maxY = Math.max(extend, blocks.length);
for (int y = 0; y < maxY; y++) {
if (y > blocks.length - 1) {
queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X,
queue.setBlock(
finalX + X + plotWorld.ROAD_OFFSET_X,
minY + y,
finalZ + Z + plotWorld.ROAD_OFFSET_Z,
WEExtent.AIRBASE
@ -641,7 +643,8 @@ public class HybridUtils {
block
);
} else {
queue.setBlock(finalX + X + plotWorld.ROAD_OFFSET_X,
queue.setBlock(
finalX + X + plotWorld.ROAD_OFFSET_X,
minY + y,
finalZ + Z + plotWorld.ROAD_OFFSET_Z,
WEExtent.AIRBASE

View File

@ -35,10 +35,10 @@ import com.plotsquared.core.queue.QueueCoordinator;
import com.plotsquared.core.util.HashUtil;
import com.plotsquared.core.util.RegionManager;
import com.sk89q.worldedit.regions.CuboidRegion;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.Iterator;
import java.util.Set;

View File

@ -31,10 +31,10 @@ import com.plotsquared.core.configuration.file.YamlConfiguration;
import com.plotsquared.core.inject.annotations.WorldConfig;
import com.plotsquared.core.plot.PlotId;
import com.plotsquared.core.queue.GlobalBlockQueue;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
public abstract class SquarePlotWorld extends GridPlotWorld {

View File

@ -42,9 +42,9 @@ import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockState;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.lang.reflect.Field;
import java.util.HashMap;
@ -59,12 +59,11 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
private final String world;
private final int max;
private final WorldUtil worldUtil;
private final Map<Long, Integer[]> tileEntityCount = new HashMap<>();
int Ecount = 0;
boolean Eblocked = false;
private int count;
private Extent parent;
private final Map<Long, Integer[]> tileEntityCount = new HashMap<>();
public ProcessedWEExtent(
String world,

View File

@ -213,7 +213,8 @@ public enum Permission {
this.text = text;
}
@Override public String toString() {
@Override
public String toString() {
return this.text;
}

View File

@ -71,7 +71,8 @@ public abstract class MetaDataAccess<T> implements AutoCloseable {
*
* @return Old value, or {@code null}
*/
public @Nullable abstract T remove();
public @Nullable
abstract T remove();
/**
* Set the meta data value
@ -85,7 +86,8 @@ public abstract class MetaDataAccess<T> implements AutoCloseable {
*
* @return Stored value, or {@link Optional#empty()}
*/
public @NonNull abstract Optional<T> get();
public @NonNull
abstract Optional<T> get();
@Override
public final void close() {

View File

@ -38,20 +38,39 @@ import java.util.List;
public final class PlayerMetaDataKeys {
//@formatter:off
public static final MetaDataKey<Boolean> PERSISTENT_FLIGHT = MetaDataKey.of("flight", new TypeLiteral<>() {});
public static final MetaDataKey<Integer> PERSISTENT_GRANTED_PLOTS = MetaDataKey.of("grantedPlots", new TypeLiteral<>() {});
public static final MetaDataKey<Boolean> PERSISTENT_FLIGHT = MetaDataKey.of("flight", new TypeLiteral<>() {
});
public static final MetaDataKey<Integer> PERSISTENT_GRANTED_PLOTS = MetaDataKey.of("grantedPlots", new TypeLiteral<>() {
});
public static final MetaDataKey<Plot> TEMPORARY_LAST_PLOT = MetaDataKey.of("lastplot", new TypeLiteral<>() {});
public static final MetaDataKey<Location> TEMPORARY_MUSIC = MetaDataKey.of("music", new TypeLiteral<>() {});
public static final MetaDataKey<Boolean> TEMPORARY_KICK = MetaDataKey.of("kick", new TypeLiteral<>() {});
public static final MetaDataKey<SetupProcess> TEMPORARY_SETUP = MetaDataKey.of("setup", new TypeLiteral<>() {});
public static final MetaDataKey<PlotInventory> TEMPORARY_INVENTORY = MetaDataKey.of("inventory", new TypeLiteral<>() {});
public static final MetaDataKey<Boolean> TEMPORARY_IGNORE_EXPIRE_TASK = MetaDataKey.of("ignoreExpireTask", new TypeLiteral<>() {});
public static final MetaDataKey<Plot> TEMPORARY_WORLD_EDIT_REGION_PLOT = MetaDataKey.of("WorldEditRegionPlot", new TypeLiteral<>() {});
public static final MetaDataKey<Boolean> TEMPORARY_AUTO = MetaDataKey.of(Auto.class.getName(), new TypeLiteral<>() {});
public static final MetaDataKey<List<String>> TEMPORARY_SCHEMATICS = MetaDataKey.of("plot_schematics", new TypeLiteral<>() {});
public static final MetaDataKey<Location> TEMPORARY_LOCATION = MetaDataKey.of("location", new TypeLiteral<>() {});
public static final MetaDataKey<CmdInstance> TEMPORARY_CONFIRM = MetaDataKey.of("cmdConfirm", new TypeLiteral<>() {});
public static final MetaDataKey<Plot> TEMPORARY_LAST_PLOT = MetaDataKey.of("lastplot", new TypeLiteral<>() {
});
public static final MetaDataKey<Location> TEMPORARY_MUSIC = MetaDataKey.of("music", new TypeLiteral<>() {
});
public static final MetaDataKey<Boolean> TEMPORARY_KICK = MetaDataKey.of("kick", new TypeLiteral<>() {
});
public static final MetaDataKey<SetupProcess> TEMPORARY_SETUP = MetaDataKey.of("setup", new TypeLiteral<>() {
});
public static final MetaDataKey<PlotInventory> TEMPORARY_INVENTORY = MetaDataKey.of("inventory", new TypeLiteral<>() {
});
public static final MetaDataKey<Boolean> TEMPORARY_IGNORE_EXPIRE_TASK = MetaDataKey.of(
"ignoreExpireTask",
new TypeLiteral<>() {
}
);
public static final MetaDataKey<Plot> TEMPORARY_WORLD_EDIT_REGION_PLOT = MetaDataKey.of(
"WorldEditRegionPlot",
new TypeLiteral<>() {
}
);
public static final MetaDataKey<Boolean> TEMPORARY_AUTO = MetaDataKey.of(Auto.class.getName(), new TypeLiteral<>() {
});
public static final MetaDataKey<List<String>> TEMPORARY_SCHEMATICS = MetaDataKey.of("plot_schematics", new TypeLiteral<>() {
});
public static final MetaDataKey<Location> TEMPORARY_LOCATION = MetaDataKey.of("location", new TypeLiteral<>() {
});
public static final MetaDataKey<CmdInstance> TEMPORARY_CONFIRM = MetaDataKey.of("cmdConfirm", new TypeLiteral<>() {
});
//@formatter:on
private PlayerMetaDataKeys() {

View File

@ -437,16 +437,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
* @return UUID
*/
@Override
public @NonNull abstract UUID getUUID();
public @NonNull
abstract UUID getUUID();
public boolean canTeleport(final @NonNull Location location) {
Preconditions.checkNotNull(location, "Specified location cannot be null");
final Location current = getLocationFull();
teleport(location);
boolean result = true;
if (!getLocation().equals(location)) {
result = false;
}
boolean result = getLocation().equals(location);
teleport(current);
return result;
}
@ -803,7 +801,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
} else if (key.getType().getRawType().equals(Boolean.class)) {
this.setPersistentMeta(key.toString(), ByteArrayUtilities.booleanToBytes((boolean) rawValue));
} else {
throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType().toString()));
throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType()));
}
}
@ -818,7 +816,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
} else if (key.getType().getRawType().equals(Boolean.class)) {
returnValue = ByteArrayUtilities.bytesToBoolean(value);
} else {
throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType().toString()));
throw new IllegalArgumentException(String.format("Unknown meta data type '%s'", key.getType()));
}
return (T) returnValue;
}
@ -843,7 +841,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
final @NonNull Caption title, final @NonNull Caption subtitle,
final @NonNull Template... replacements
) {
sendTitle(title, subtitle, Settings.Titles.TITLES_FADE_IN, Settings.Titles.TITLES_STAY, Settings.Titles.TITLES_FADE_OUT, replacements);
sendTitle(
title,
subtitle,
Settings.Titles.TITLES_FADE_IN,
Settings.Titles.TITLES_STAY,
Settings.Titles.TITLES_FADE_OUT,
replacements
);
}
/**
@ -1001,7 +1006,8 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
*
* @return Player audience
*/
public @NonNull abstract Audience getAudience();
public @NonNull
abstract Audience getAudience();
/**
* Get this player's {@link LockRepository}

View File

@ -52,8 +52,8 @@ public final class BlockBucket implements ConfigurationSerializable {
private static final java.util.regex.Pattern regex = java.util.regex.Pattern.compile(
"((?<namespace>[A-Za-z_]+):)?(?<block>([A-Za-z_]+(\\[?[\\S\\s]+\\])?))(:(?<chance>[0-9]{1,3}))?");
private boolean compiled;
private final StringBuilder input;
private boolean compiled;
private BlockState single;
private Pattern pattern;
@ -105,7 +105,7 @@ public final class BlockBucket implements ConfigurationSerializable {
chance = 1;
}
String prefix = input.length() == 0 ? "" : ",";
input.append(prefix).append(block.toString()).append(":").append(chance);
input.append(prefix).append(block).append(":").append(chance);
this.compiled = false;
}

View File

@ -80,10 +80,10 @@ import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.lang.ref.Cleaner;
import java.text.DecimalFormat;
@ -1301,7 +1301,8 @@ public class Plot {
Location[] corners = getCorners();
Location top = corners[0];
Location bot = corners[1];
Location location = Location.at(this.getWorldName(),
Location location = Location.at(
this.getWorldName(),
MathMan.average(bot.getX(), top.getX()),
MathMan.average(bot.getY(), top.getY()),
MathMan.average(bot.getZ(), top.getZ())
@ -1332,7 +1333,8 @@ public class Plot {
0
);
}
Location location = Location.at(this.getWorldName(),
Location location = Location.at(
this.getWorldName(),
MathMan.average(bot.getX(), top.getX()),
MathMan.average(bot.getY(), top.getY()),
MathMan.average(bot.getZ(), top.getZ())
@ -1407,7 +1409,8 @@ public class Plot {
);
}
Location location = Location
.at(bottom.getWorldName(),
.at(
bottom.getWorldName(),
bottom.getX() + home.getX(),
bottom.getY() + home.getY(),
bottom.getZ() + home.getZ(),
@ -1447,7 +1450,8 @@ public class Plot {
}
Location bottom = this.getBottomAbs();
Location location = Location
.at(bottom.getWorldName(),
.at(
bottom.getWorldName(),
bottom.getX() + home.getX(),
bottom.getY() + home.getY(),
bottom.getZ() + home.getZ(),
@ -1898,7 +1902,7 @@ public class Plot {
if (this.settings != null && this.settings.getAlias().length() > 1) {
return this.settings.getAlias();
}
return this.area + ";" + this.id.toString();
return this.area + ";" + this.id;
}
/**
@ -2806,7 +2810,8 @@ public class Plot {
} else {
value = flag.toString();
}
Component snip = MINI_MESSAGE.parse(prefix + CaptionUtility.format(
Component snip = MINI_MESSAGE.parse(
prefix + CaptionUtility.format(
player,
TranslatableCaption.of("info.plot_flag_list").getComponent(player)
),
@ -2905,7 +2910,8 @@ public class Plot {
}
}
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
.parse(iInfo.getComponent(player),
.parse(
iInfo.getComponent(player),
headerTemplate,
areaTemplate,
idTemplate,
@ -2930,7 +2936,8 @@ public class Plot {
return;
}
future.complete(StaticCaption.of(MINI_MESSAGE.serialize(MINI_MESSAGE
.parse(iInfo.getComponent(player),
.parse(
iInfo.getComponent(player),
headerTemplate,
areaTemplate,
idTemplate,

View File

@ -70,10 +70,10 @@ import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.text.DecimalFormat;
import java.util.ArrayList;
@ -147,7 +147,7 @@ public abstract class PlotArea {
private GameMode gameMode = GameModes.CREATIVE;
private Map<String, PlotExpression> prices = new HashMap<>();
private List<String> schematics = new ArrayList<>();
private boolean roadFlags = false;
private final boolean roadFlags = false;
private boolean worldBorder = false;
private boolean useEconomy = false;
private int hash;

View File

@ -52,10 +52,10 @@ import com.sk89q.worldedit.regions.CuboidRegion;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BlockTypes;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -175,7 +175,7 @@ public final class PlotModificationManager {
return;
}
CuboidRegion region = regions.poll();
Location[] corners = plot.getCorners(plot.getWorldName(), region);
Location[] corners = Plot.getCorners(plot.getWorldName(), region);
Location pos1 = corners[0];
Location pos2 = corners[1];
Location newPos = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
@ -239,7 +239,7 @@ public final class PlotModificationManager {
if (queue.isEmpty()) {
Runnable run = () -> {
for (CuboidRegion region : regions) {
Location[] corners = plot.getCorners(plot.getWorldName(), region);
Location[] corners = Plot.getCorners(plot.getWorldName(), region);
PlotSquared.platform().regionManager().clearAllEntities(corners[0], corners[1]);
}
TaskManager.runTask(whenDone);
@ -731,7 +731,7 @@ public final class PlotModificationManager {
TaskManager.runTask(whenDone);
} else {
CuboidRegion region = regions.poll();
Location[] corners = plot.getCorners(plot.getWorldName(), region);
Location[] corners = Plot.getCorners(plot.getWorldName(), region);
Location pos1 = corners[0];
Location pos2 = corners[1];
Location pos3 = pos1.add(offsetX, 0, offsetZ).withWorld(destination.getWorldName());
@ -770,7 +770,7 @@ public final class PlotModificationManager {
}
final Runnable task = this;
CuboidRegion region = regions.poll();
Location[] corners = PlotModificationManager.this.plot.getCorners(
Location[] corners = Plot.getCorners(
PlotModificationManager.this.plot.getWorldName(),
region
);

View File

@ -46,4 +46,5 @@ public class PlotTitle {
public String subtitle() {
return subtitle;
}
}

View File

@ -56,14 +56,16 @@ public abstract class PlotWorld {
* @param location Location
* @return Containing plot area, or null
*/
public @Nullable abstract PlotArea getArea(final @NonNull Location location);
public @Nullable
abstract PlotArea getArea(final @NonNull Location location);
/**
* Get all plot areas in the world
*
* @return All plot areas in the world
*/
public @NonNull abstract Collection<PlotArea> getAreas();
public @NonNull
abstract Collection<PlotArea> getAreas();
/**
* Get all plot areas in a specified region
@ -71,7 +73,8 @@ public abstract class PlotWorld {
* @param region Region
* @return All areas in the region
*/
public @NonNull abstract Collection<PlotArea> getAreasInRegion(
public @NonNull
abstract Collection<PlotArea> getAreasInRegion(
final @NonNull CuboidRegion region
);

View File

@ -44,9 +44,9 @@ public abstract class CommentInbox {
* @return the inbox, otherwise {@code false} false
*/
public boolean canRead(Plot plot, PlotPlayer<?> player) {
if (Permissions.hasPermission(player, "plots.inbox.read." + toString(), true)) {
if (Permissions.hasPermission(player, "plots.inbox.read." + this, true)) {
return plot.isOwner(player.getUUID()) || Permissions
.hasPermission(player, "plots.inbox.read." + toString() + ".other", true);
.hasPermission(player, "plots.inbox.read." + this + ".other", true);
}
return false;
}

View File

@ -236,8 +236,10 @@ public class PlotAnalysis {
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
LOGGER.info("- Calculating rank correlation: ");
LOGGER.info("- The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
LOGGER.info("- The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
LOGGER.info(
"- The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
LOGGER.info(
"- The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
Settings.Auto_Clear settings = new Settings.Auto_Clear();

View File

@ -52,8 +52,8 @@ public class FlagContainer {
private final Map<Class<?>, PlotFlag<?, ?>> flagMap = new HashMap<>();
private final PlotFlagUpdateHandler plotFlagUpdateHandler;
private final Collection<PlotFlagUpdateHandler> updateSubscribers = new HashSet<>();
private FlagContainer parentContainer;
private final PlotFlagUpdateHandler unknownsRef;
private FlagContainer parentContainer;
/**
* Construct a new flag container with an optional parent container and update handler.

View File

@ -95,7 +95,8 @@ public abstract class PlotFlag<T, F extends PlotFlag<T, F>> {
*
* @return Non-nullable flag value
*/
public @NonNull final T getValue() {
public @NonNull
final T getValue() {
return this.value;
}

View File

@ -41,7 +41,11 @@ public class PlotTitleFlag extends PlotFlag<PlotTitle, PlotTitleFlag> {
* @param value Flag value
*/
protected PlotTitleFlag(PlotTitle value) {
super(value, TranslatableCaption.of("flags.flag_category_string"), TranslatableCaption.of("flags.flag_description_title"));
super(
value,
TranslatableCaption.of("flags.flag_category_string"),
TranslatableCaption.of("flags.flag_description_title")
);
}
@Override

View File

@ -31,10 +31,10 @@ import com.plotsquared.core.configuration.Settings;
import com.sk89q.worldedit.world.block.BlockCategory;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockType;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.HashMap;
import java.util.Map;

View File

@ -182,7 +182,12 @@ public class SinglePlotArea extends GridPlotWorld {
@Override
public ConfigurationNode[] getSettingNodes() {
return new ConfigurationNode[]{
new ConfigurationNode("void", this.VOID, TranslatableCaption.of("setup.singleplotarea_void_world"), ConfigurationUtil.BOOLEAN)};
new ConfigurationNode(
"void",
this.VOID,
TranslatableCaption.of("setup.singleplotarea_void_world"),
ConfigurationUtil.BOOLEAN
)};
}
@Nullable

View File

@ -271,7 +271,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
}
@Override
public @Nullable final Consumer<BlockVector2> getChunkConsumer() {
public @Nullable
final Consumer<BlockVector2> getChunkConsumer() {
return this.consumer;
}
@ -293,7 +294,8 @@ public abstract class BasicQueueCoordinator extends QueueCoordinator {
}
@Override
public @NonNull final LightingMode getLightingMode() {
public @NonNull
final LightingMode getLightingMode() {
if (lightingMode == null) {
return LightingMode.valueOf(Settings.QUEUE.LIGHTING_MODE);
}

View File

@ -218,7 +218,8 @@ public class ChunkCoordinatorBuilder {
Preconditions.checkNotNull(this.whenDone, "No final action was supplied");
Preconditions.checkNotNull(this.throwableConsumer, "No throwable consumer was supplied");
return chunkCoordinatorFactory
.create(this.maxIterationTime,
.create(
this.maxIterationTime,
this.initialBatchSize,
this.chunkConsumer,
this.world,

View File

@ -190,7 +190,8 @@ public abstract class QueueCoordinator {
* @param z block z
* @return WorldEdit BlockState
*/
public @Nullable abstract BlockState getBlock(int x, int y, int z);
public @Nullable
abstract BlockState getBlock(int x, int y, int z);
/**
* Set a biome in XZ. This will likely set to the whole column
@ -199,7 +200,6 @@ public abstract class QueueCoordinator {
* @param z z coordinate
* @param biome biome
* @return success or not
*
* @deprecated Biomes now take XYZ, see {@link #setBiome(int, int, int, BiomeType)}
* <br>
* Scheduled for removal once we drop the support for versions not supporting 3D biomes.
@ -249,7 +249,8 @@ public abstract class QueueCoordinator {
*
* @return list of BlockVector2 of chunks that are to be "read"
*/
public @NonNull abstract List<BlockVector2> getReadChunks();
public @NonNull
abstract List<BlockVector2> getReadChunks();
/**
* Add a set of {@link BlockVector2} Chunk coordinates to the Read Chunks list
@ -284,7 +285,8 @@ public abstract class QueueCoordinator {
*
* @return CuboidRegion to regenerate
*/
public @Nullable abstract CuboidRegion getRegenRegion();
public @Nullable
abstract CuboidRegion getRegenRegion();
/**
* Set the {@link CuboidRegion} designated for direct regeneration
@ -306,7 +308,8 @@ public abstract class QueueCoordinator {
*
* @return world of the queue
*/
public @Nullable abstract World getWorld();
public @Nullable
abstract World getWorld();
/**
* Set the queue as having been modified now
@ -353,7 +356,8 @@ public abstract class QueueCoordinator {
*
* @return Consumer to be executed on each chunk in queue
*/
public @Nullable abstract Consumer<BlockVector2> getChunkConsumer();
public @Nullable
abstract Consumer<BlockVector2> getChunkConsumer();
/**
* Set the Consumer that will be executed on each chunk in queue
@ -370,7 +374,8 @@ public abstract class QueueCoordinator {
/**
* Get the {@link LightingMode} to be used when setting blocks
*/
public @NonNull abstract LightingMode getLightingMode();
public @NonNull
abstract LightingMode getLightingMode();
/**
* Set the {@link LightingMode} to be used when setting blocks

View File

@ -27,9 +27,9 @@ package com.plotsquared.core.queue;
import com.plotsquared.core.PlotSquared;
import com.sk89q.worldedit.world.World;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
public abstract class QueueProvider {

View File

@ -41,7 +41,6 @@ import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import javax.annotation.Nullable;
import java.util.concurrent.atomic.AtomicBoolean;
/**

View File

@ -278,7 +278,9 @@ public enum CommonSetupSteps implements SetupStep {
}
private static boolean isValidWorldName(String s) {
return s.chars().allMatch((i) -> i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 65 && i <= 90 || i >= 48 && i <= 57 || i == 46);
return s
.chars()
.allMatch((i) -> i == 95 || i == 45 || i >= 97 && i <= 122 || i >= 65 && i <= 90 || i >= 48 && i <= 57 || i == 46);
}
@Override

View File

@ -92,12 +92,12 @@ public final class BlockUtil {
}
String mutableId = id;
mutableId = id.toLowerCase();
BlockType type = BlockTypes.get(mutableId );
BlockType type = BlockTypes.get(mutableId);
if (type != null) {
return type.getDefaultState();
}
if (Character.isDigit(mutableId .charAt(0))) {
String[] split = mutableId .split(":");
if (Character.isDigit(mutableId.charAt(0))) {
String[] split = mutableId.split(":");
if (MathMan.isInteger(split[0])) {
if (split.length == 2) {
if (MathMan.isInteger(split[1])) {

View File

@ -32,9 +32,9 @@ import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.plot.BlockBucket;
import com.sk89q.worldedit.world.block.BlockState;
import net.kyori.adventure.text.minimessage.Template;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import java.util.Collection;
import java.util.HashMap;
@ -117,7 +117,8 @@ public final class LegacyConverter {
) {
final BlockBucket bucket = this.blockToBucket(block);
this.setString(section, key, bucket);
ConsolePlayer.getConsole().sendMessage(TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
ConsolePlayer.getConsole().sendMessage(
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
Template.of("value1", block),
Template.of("value2", bucket.toString())
);
@ -132,7 +133,8 @@ public final class LegacyConverter {
final BlockBucket bucket = this.blockListToBucket(blocks);
this.setString(section, key, bucket);
ConsolePlayer.getConsole()
.sendMessage(TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
.sendMessage(
TranslatableCaption.of("legacyconfig.legacy_config_replaced"),
Template.of("value1", plotBlockArrayString(blocks)),
Template.of("value2", bucket.toString())
);

View File

@ -257,7 +257,8 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param object Platform player object
* @return Player object
*/
public @NonNull abstract P getPlayer(final @NonNull T object);
public @NonNull
abstract P getPlayer(final @NonNull T object);
/**
* Get a plot player from a UUID. This method requires
@ -280,7 +281,8 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
}
}
public @NonNull abstract P createPlayer(final @NonNull UUID uuid);
public @NonNull
abstract P createPlayer(final @NonNull UUID uuid);
/**
* Get an an offline player object from the player's UUID
@ -288,7 +290,8 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param uuid Player UUID
* @return Offline player object
*/
public @Nullable abstract OfflinePlotPlayer getOfflinePlayer(final @Nullable UUID uuid);
public @Nullable
abstract OfflinePlotPlayer getOfflinePlayer(final @Nullable UUID uuid);
/**
* Get an offline player object from the player's username
@ -296,7 +299,8 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
* @param username Player name
* @return Offline player object
*/
public @Nullable abstract OfflinePlotPlayer getOfflinePlayer(final @NonNull String username);
public @Nullable
abstract OfflinePlotPlayer getOfflinePlayer(final @NonNull String username);
/**
* Get all online players
@ -311,7 +315,7 @@ public abstract class PlayerManager<P extends PlotPlayer<? extends T>, T> {
public static final class NoSuchPlayerException extends IllegalArgumentException {
public NoSuchPlayerException(final @NonNull UUID uuid) {
super(String.format("There is no online player with UUID '%s'", uuid.toString()));
super(String.format("There is no online player with UUID '%s'", uuid));
}
}

View File

@ -33,10 +33,10 @@ import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.plot.Plot;
import com.sk89q.jnbt.CompoundTag;
import com.sk89q.jnbt.NBTOutputStream;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.io.IOException;
import java.io.OutputStream;

View File

@ -71,10 +71,10 @@ import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.biome.BiomeType;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockTypes;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.io.BufferedReader;
import java.io.ByteArrayOutputStream;

View File

@ -35,10 +35,10 @@ import java.util.function.Function;
*/
public class StringComparison<T> {
private final Function<T, String> toString;
private T bestMatch;
private double match = Integer.MAX_VALUE;
private T bestMatchObject;
private final Function<T, String> toString;
/**
* Constructor

View File

@ -100,7 +100,8 @@ public abstract class WorldUtil {
* @deprecated May result in synchronous chunk loading
*/
@Deprecated
public @NonNull abstract String[] getSignSynchronous(@NonNull Location location);
public @NonNull
abstract String[] getSignSynchronous(@NonNull Location location);
/**
* Get the world spawn location
@ -108,7 +109,8 @@ public abstract class WorldUtil {
* @param world World name
* @return World spawn location
*/
public @NonNull abstract Location getSpawn(@NonNull String world);
public @NonNull
abstract Location getSpawn(@NonNull String world);
/**
* Set the world spawn location
@ -130,7 +132,8 @@ public abstract class WorldUtil {
* @param name Block name
* @return Comparison result containing the closets matching block
*/
public @NonNull abstract StringComparison<BlockState>.ComparisonResult getClosestBlock(@NonNull String name);
public @NonNull
abstract StringComparison<BlockState>.ComparisonResult getClosestBlock(@NonNull String name);
/**
* Set the block at the specified location to a sign, with given text
@ -165,7 +168,8 @@ public abstract class WorldUtil {
* @deprecated Use {@link #getBiome(String, int, int, Consumer)}
*/
@Deprecated
public @NonNull abstract BiomeType getBiomeSynchronous(@NonNull String world, int x, int z);
public @NonNull
abstract BiomeType getBiomeSynchronous(@NonNull String world, int x, int z);
/**
* Get the block at a given location (asynchronously)
@ -183,7 +187,8 @@ public abstract class WorldUtil {
* @deprecated Use {@link #getBlock(Location, Consumer)}
*/
@Deprecated
public @NonNull abstract BlockState getBlockSynchronous(@NonNull Location location);
public @NonNull
abstract BlockState getBlockSynchronous(@NonNull Location location);
/**
* Get the Y coordinate of the highest non-air block in the world, asynchronously
@ -398,14 +403,16 @@ public abstract class WorldUtil {
* @param category Entity category
* @return Set containing all entities belonging to the given category
*/
public @NonNull abstract Set<EntityType> getTypesInCategory(@NonNull String category);
public @NonNull
abstract Set<EntityType> getTypesInCategory(@NonNull String category);
/**
* Get all recognized tile entity types
*
* @return Collection containing all known tile entity types
*/
public @NonNull abstract Collection<BlockType> getTileEntityTypes();
public @NonNull
abstract Collection<BlockType> getTileEntityTypes();
/**
* Get the tile entity count in a chunk

View File

@ -46,14 +46,16 @@ public abstract class Placeholder {
* @param player Player
* @return Placeholder value. Return {@code ""} if no placeholder value can be returned
*/
public @NonNull abstract String getValue(final @NonNull PlotPlayer<?> player);
public @NonNull
abstract String getValue(final @NonNull PlotPlayer<?> player);
/**
* Get the placeholder key
*
* @return Placeholder key
*/
public @NonNull final String getKey() {
public @NonNull
final String getKey() {
return this.key;
}

View File

@ -39,7 +39,8 @@ public abstract class PlotSpecificPlaceholder extends Placeholder {
}
@Override
public @NonNull final String getValue(final @NonNull PlotPlayer<?> player) {
public @NonNull
final String getValue(final @NonNull PlotPlayer<?> player) {
final Plot plot = player.getCurrentPlot();
if (plot == null) {
return "";
@ -54,7 +55,8 @@ public abstract class PlotSpecificPlaceholder extends Placeholder {
* @param plot Plot that the player is in
* @return Placeholder value, or {@code ""} if the placeholder does not apply
*/
public @NonNull abstract String getValue(
public @NonNull
abstract String getValue(
final @NonNull PlotPlayer<?> player,
final @NonNull Plot plot
);

View File

@ -52,5 +52,5 @@ public enum SortingStrategy {
/**
* Sort using a comparator
*/
COMPARATOR;
COMPARATOR
}

View File

@ -33,10 +33,10 @@ import com.plotsquared.core.player.ConsolePlayer;
import com.plotsquared.core.util.ThreadUtils;
import com.plotsquared.core.util.task.TaskManager;
import net.kyori.adventure.text.minimessage.MiniMessage;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.ArrayList;
import java.util.Collection;
@ -427,7 +427,8 @@ public class UUIDPipeline {
*
* @return All mappings that could be provided immediately
*/
public @NonNull final Collection<@NonNull UUIDMapping> getAllImmediately() {
public @NonNull
final Collection<@NonNull UUIDMapping> getAllImmediately() {
final Set<UUIDMapping> mappings = new LinkedHashSet<>();
for (final UUIDService service : this.getServiceListInstance()) {
mappings.addAll(service.getImmediately());
@ -441,7 +442,8 @@ public class UUIDPipeline {
* @param object Username ({@link String}) or {@link UUID}
* @return Mapping, if it could be found immediately
*/
public @Nullable final UUIDMapping getImmediately(final @NonNull Object object) {
public @Nullable
final UUIDMapping getImmediately(final @NonNull Object object) {
for (final UUIDService uuidService : this.getServiceListInstance()) {
final UUIDMapping mapping = uuidService.getImmediately(object);
if (mapping != null) {

View File

@ -30,10 +30,10 @@ import com.plotsquared.core.database.DBFunc;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.plot.flag.implementations.UseFlag;
import com.sk89q.worldedit.world.item.ItemType;
import org.junit.Before;
import org.junit.Test;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Before;
import org.junit.Test;
import static org.junit.Assert.assertEquals;

View File

@ -26,9 +26,9 @@
package com.plotsquared.core.plot;
import com.plotsquared.core.PlotVersion;
import org.junit.Test;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.junit.Test;
public class PlotVersionTest {