mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Manually fix some merge conflicts
This commit is contained in:
parent
198bcfdf4d
commit
b68d7150f1
@ -43,15 +43,6 @@ import com.plotsquared.bukkit.listener.WorldEvents;
|
||||
import com.plotsquared.bukkit.placeholder.PlaceholderFormatter;
|
||||
import com.plotsquared.bukkit.placeholder.Placeholders;
|
||||
import com.plotsquared.bukkit.player.BukkitPlayerManager;
|
||||
import com.plotsquared.bukkit.queue.BukkitLocalQueue;
|
||||
import com.plotsquared.bukkit.schematic.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitChunkManager;
|
||||
import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitPermHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitRegionManager;
|
||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||
import com.plotsquared.bukkit.util.BukkitChatManager;
|
||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitWorld;
|
||||
@ -94,15 +85,12 @@ import com.plotsquared.core.plot.PlotAreaTerrainType;
|
||||
import com.plotsquared.core.plot.PlotAreaType;
|
||||
import com.plotsquared.core.plot.PlotId;
|
||||
import com.plotsquared.core.plot.comment.CommentManager;
|
||||
import com.plotsquared.core.plot.message.PlainChatManager;
|
||||
import com.plotsquared.core.plot.world.PlotAreaManager;
|
||||
import com.plotsquared.core.plot.world.SinglePlotArea;
|
||||
import com.plotsquared.core.plot.world.SinglePlotAreaManager;
|
||||
import com.plotsquared.core.queue.GlobalBlockQueue;
|
||||
import com.plotsquared.core.setup.PlotAreaBuilder;
|
||||
import com.plotsquared.core.setup.SettingsNodesWrapper;
|
||||
import com.plotsquared.core.util.ChunkManager;
|
||||
import com.plotsquared.core.util.ChatManager;
|
||||
import com.plotsquared.core.util.ConsoleColors;
|
||||
import com.plotsquared.core.util.EconHandler;
|
||||
import com.plotsquared.core.util.EventDispatcher;
|
||||
@ -120,7 +108,6 @@ import com.plotsquared.core.uuid.offline.OfflineModeUUIDService;
|
||||
import com.sk89q.worldedit.WorldEdit;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import lombok.Getter;
|
||||
import lombok.NonNull;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import org.bstats.bukkit.Metrics;
|
||||
import org.bukkit.Bukkit;
|
||||
@ -285,9 +272,6 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
|
||||
plotSquared.startExpiryTasks();
|
||||
|
||||
// This is getting removed so I won't even bother migrating it
|
||||
ChatManager.manager = this.initChatManager();
|
||||
|
||||
// Do stuff that was previously done in PlotSquared
|
||||
// Kill entities
|
||||
if (Settings.Enabled_Components.KILL_ROAD_MOBS
|
||||
@ -1135,7 +1119,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
||||
return BukkitWorld.of(worldName);
|
||||
}
|
||||
|
||||
@Override @NotNull public Audience getConsoleAudience() {
|
||||
@Override @Nonnull public Audience getConsoleAudience() {
|
||||
return BukkitUtil.BUKKIT_AUDIENCES.audience(Bukkit.getConsoleSender());
|
||||
}
|
||||
|
||||
|
@ -161,7 +161,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override public boolean hasPermission(@NotNull final String permission) {
|
||||
@Override public boolean hasPermission(@Nonnull final String permission) {
|
||||
if (this.offline && this.econHandler != null) {
|
||||
return this.econHandler.hasPermission(getName(), permission);
|
||||
}
|
||||
@ -228,7 +228,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
return max;
|
||||
}
|
||||
|
||||
@Override public boolean isPermissionSet(@NotNull final String permission) {
|
||||
@Override public boolean isPermissionSet(@Nonnull final String permission) {
|
||||
return this.player.isPermissionSet(permission);
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ public class BukkitPlayer extends PlotPlayer<Player> {
|
||||
return this.player.isBanned();
|
||||
}
|
||||
|
||||
@Override @NotNull public Audience getAudience() {
|
||||
@Override @Nonnull public Audience getAudience() {
|
||||
return BukkitUtil.BUKKIT_AUDIENCES.player(this.player);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
package com.plotsquared.bukkit.queue;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.plotsquared.bukkit.BukkitMain;
|
||||
import com.plotsquared.bukkit.BukkitPlatform;
|
||||
import com.sk89q.worldedit.math.BlockVector2;
|
||||
import io.papermc.lib.PaperLib;
|
||||
import org.bukkit.Chunk;
|
||||
@ -34,8 +34,8 @@ import org.bukkit.World;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
@ -87,9 +87,9 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
private int batchSize;
|
||||
|
||||
private ChunkCoordinator(final long maxIterationTime, final int initialBatchSize,
|
||||
@NotNull final Consumer<Chunk> chunkConsumer, @NotNull final World world,
|
||||
@NotNull final Collection<BlockVector2> requestedChunks, @NotNull final Runnable whenDone,
|
||||
@NotNull final Consumer<Throwable> throwableConsumer) {
|
||||
@Nonnull final Consumer<Chunk> chunkConsumer, @Nonnull final World world,
|
||||
@Nonnull final Collection<BlockVector2> requestedChunks, @Nonnull final Runnable whenDone,
|
||||
@Nonnull final Consumer<Throwable> throwableConsumer) {
|
||||
this.requestedChunks = new LinkedBlockingQueue<>(requestedChunks);
|
||||
this.availableChunks = new LinkedBlockingQueue<>();
|
||||
this.totalSize = requestedChunks.size();
|
||||
@ -100,7 +100,7 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
this.maxIterationTime = maxIterationTime;
|
||||
this.whenDone = whenDone;
|
||||
this.throwableConsumer = throwableConsumer;
|
||||
this.plugin = JavaPlugin.getPlugin(BukkitMain.class);
|
||||
this.plugin = JavaPlugin.getPlugin(BukkitPlatform.class);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -108,7 +108,7 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
*
|
||||
* @return Coordinator builder instance
|
||||
*/
|
||||
@NotNull public static ChunkCoordinatorBuilder builder() {
|
||||
@Nonnull public static ChunkCoordinatorBuilder builder() {
|
||||
return new ChunkCoordinatorBuilder();
|
||||
}
|
||||
|
||||
@ -186,7 +186,7 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
}
|
||||
}
|
||||
|
||||
private void processChunk(@NotNull final Chunk chunk) {
|
||||
private void processChunk(@Nonnull final Chunk chunk) {
|
||||
if (!chunk.isLoaded()) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Chunk %d;%d is is not loaded", chunk.getX(), chunk.getZ()));
|
||||
@ -195,7 +195,7 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
this.availableChunks.add(chunk);
|
||||
}
|
||||
|
||||
private void freeChunk(@NotNull final Chunk chunk) {
|
||||
private void freeChunk(@Nonnull final Chunk chunk) {
|
||||
if (!chunk.isLoaded()) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Chunk %d;%d is is not loaded", chunk.getX(), chunk.getZ()));
|
||||
@ -226,7 +226,7 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
*
|
||||
* @param subscriber Subscriber
|
||||
*/
|
||||
public void subscribeToProgress(@NotNull final ChunkCoordinator.ProgressSubscriber subscriber) {
|
||||
public void subscribeToProgress(@Nonnull final ChunkCoordinator.ProgressSubscriber subscriber) {
|
||||
this.progressSubscribers.add(subscriber);
|
||||
}
|
||||
|
||||
@ -240,7 +240,7 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
* @param coordinator Coordinator instance that triggered the notification
|
||||
* @param progress Progress in the range [0, 1]
|
||||
*/
|
||||
void notifyProgress(@NotNull final ChunkCoordinator coordinator, final float progress);
|
||||
void notifyProgress(@Nonnull final ChunkCoordinator coordinator, final float progress);
|
||||
|
||||
}
|
||||
|
||||
@ -259,58 +259,58 @@ public final class ChunkCoordinator extends BukkitRunnable {
|
||||
private ChunkCoordinatorBuilder() {
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinatorBuilder inWorld(@NotNull final World world) {
|
||||
@Nonnull public ChunkCoordinatorBuilder inWorld(@Nonnull final World world) {
|
||||
this.world = Preconditions.checkNotNull(world, "World may not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ChunkCoordinatorBuilder withChunk(@NotNull final BlockVector2 chunkLocation) {
|
||||
@Nonnull
|
||||
public ChunkCoordinatorBuilder withChunk(@Nonnull final BlockVector2 chunkLocation) {
|
||||
this.requestedChunks
|
||||
.add(Preconditions.checkNotNull(chunkLocation, "Chunk location may not be null"));
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinatorBuilder withChunks(
|
||||
@NotNull final Collection<BlockVector2> chunkLocations) {
|
||||
@Nonnull public ChunkCoordinatorBuilder withChunks(
|
||||
@Nonnull final Collection<BlockVector2> chunkLocations) {
|
||||
chunkLocations.forEach(this::withChunk);
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public ChunkCoordinatorBuilder withConsumer(@NotNull final Consumer<Chunk> chunkConsumer) {
|
||||
@Nonnull
|
||||
public ChunkCoordinatorBuilder withConsumer(@Nonnull final Consumer<Chunk> chunkConsumer) {
|
||||
this.chunkConsumer =
|
||||
Preconditions.checkNotNull(chunkConsumer, "Chunk consumer may not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinatorBuilder withFinalAction(@NotNull final Runnable whenDone) {
|
||||
@Nonnull public ChunkCoordinatorBuilder withFinalAction(@Nonnull final Runnable whenDone) {
|
||||
this.whenDone = Preconditions.checkNotNull(whenDone, "Final action may not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinatorBuilder withMaxIterationTime(final long maxIterationTime) {
|
||||
@Nonnull public ChunkCoordinatorBuilder withMaxIterationTime(final long maxIterationTime) {
|
||||
Preconditions
|
||||
.checkArgument(maxIterationTime > 0, "Max iteration time must be positive");
|
||||
this.maxIterationTime = maxIterationTime;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinatorBuilder withInitialBatchSize(final int initialBatchSize) {
|
||||
@Nonnull public ChunkCoordinatorBuilder withInitialBatchSize(final int initialBatchSize) {
|
||||
Preconditions
|
||||
.checkArgument(initialBatchSize > 0, "Initial batch size must be positive");
|
||||
this.initialBatchSize = initialBatchSize;
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinatorBuilder withThrowableConsumer(
|
||||
@NotNull final Consumer<Throwable> throwableConsumer) {
|
||||
@Nonnull public ChunkCoordinatorBuilder withThrowableConsumer(
|
||||
@Nonnull final Consumer<Throwable> throwableConsumer) {
|
||||
this.throwableConsumer =
|
||||
Preconditions.checkNotNull(throwableConsumer, "Throwable consumer may not be null");
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull public ChunkCoordinator build() {
|
||||
@Nonnull public ChunkCoordinator build() {
|
||||
Preconditions.checkNotNull(this.world, "No world was supplied");
|
||||
Preconditions.checkNotNull(this.chunkConsumer, "No chunk consumer was supplied");
|
||||
Preconditions.checkNotNull(this.whenDone, "No final action was supplied");
|
||||
|
@ -43,14 +43,10 @@ import com.plotsquared.core.util.RegionManager;
|
||||
import com.plotsquared.core.util.SetupUtils;
|
||||
import com.plotsquared.core.util.WorldUtil;
|
||||
import com.plotsquared.core.util.logger.ILogger;
|
||||
import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -117,100 +113,6 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*/
|
||||
String getNMSPackage();
|
||||
|
||||
/**
|
||||
* Gets the schematic handler.
|
||||
*
|
||||
* @return The {@link SchematicHandler}
|
||||
*/
|
||||
SchematicHandler initSchematicHandler();
|
||||
|
||||
/**
|
||||
* The task manager will run and manage Minecraft tasks.
|
||||
*
|
||||
* @return the PlotSquared task manager
|
||||
*/
|
||||
TaskManager getTaskManager();
|
||||
|
||||
/**
|
||||
* Run the task that will kill road mobs.
|
||||
*/
|
||||
void runEntityTask();
|
||||
|
||||
/**
|
||||
* Registerss the implementation specific commands.
|
||||
*/
|
||||
void registerCommands();
|
||||
|
||||
/**
|
||||
* Register the protection system.
|
||||
*/
|
||||
void registerPlayerEvents();
|
||||
|
||||
/**
|
||||
* Register force field events.
|
||||
*/
|
||||
void registerForceFieldEvents();
|
||||
|
||||
/**
|
||||
* Registers the WorldEdit hook.
|
||||
*/
|
||||
boolean initWorldEdit();
|
||||
|
||||
/**
|
||||
* Gets the economy provider, if there is one
|
||||
*
|
||||
* @return the PlotSquared economy manager
|
||||
*/
|
||||
@Nullable EconHandler getEconomyHandler();
|
||||
|
||||
/**
|
||||
* Gets the permission provider, if there is one
|
||||
*
|
||||
* @return the PlotSquared permission manager
|
||||
*/
|
||||
@Nullable PermHandler getPermissionHandler();
|
||||
|
||||
/**
|
||||
* Gets the {@link QueueProvider} class.
|
||||
*/
|
||||
QueueProvider initBlockQueue();
|
||||
|
||||
/**
|
||||
* Gets the {@link WorldUtil} class.
|
||||
*/
|
||||
WorldUtil initWorldUtil();
|
||||
|
||||
/**
|
||||
* Gets the chunk manager.
|
||||
*
|
||||
* @return the PlotSquared chunk manager
|
||||
*/
|
||||
ChunkManager initChunkManager();
|
||||
|
||||
/**
|
||||
* Gets the region manager.
|
||||
*
|
||||
* @return the PlotSquared region manager
|
||||
*/
|
||||
RegionManager initRegionManager();
|
||||
|
||||
/**
|
||||
* Gets the {@link SetupUtils} class.
|
||||
*/
|
||||
SetupUtils initSetupUtils();
|
||||
|
||||
/**
|
||||
* Gets {@link HybridUtils} class.
|
||||
*/
|
||||
HybridUtils initHybridUtils();
|
||||
|
||||
/**
|
||||
* Starts the {@link ChatManager}.
|
||||
*
|
||||
* @return the ChatManager
|
||||
*/
|
||||
ChatManager initChatManager();
|
||||
|
||||
/**
|
||||
* Start Metrics.
|
||||
*/
|
||||
@ -285,7 +187,7 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
* @param worldName World name
|
||||
* @return Platform world wrapper
|
||||
*/
|
||||
@Nonnull World<?> getPlatformWorld(@Nonnull final String worldName);
|
||||
@Nullable World<?> getPlatformWorld(@Nonnull final String worldName);
|
||||
|
||||
/**
|
||||
* Get the {@link com.google.inject.Injector} instance used by PlotSquared
|
||||
@ -362,6 +264,6 @@ public interface PlotPlatform<P> extends ILogger {
|
||||
*
|
||||
* @return Console audience
|
||||
*/
|
||||
@NotNull Audience getConsoleAudience();
|
||||
@Nonnull Audience getConsoleAudience();
|
||||
|
||||
}
|
||||
|
@ -27,7 +27,8 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Any entity that is able to execute commands, receive messages & and have
|
||||
@ -41,14 +42,14 @@ public interface CommandCaller {
|
||||
* @param caption Caption to send
|
||||
* @param replacements Variable replacements
|
||||
*/
|
||||
void sendMessage(@NotNull Caption caption, @NotNull Template... replacements);
|
||||
void sendMessage(@Nonnull Caption caption, @Nonnull Template... replacements);
|
||||
|
||||
/**
|
||||
* Check the player's permissions. <i>Will be cached if permission caching is enabled.</i>
|
||||
*
|
||||
* @param permission the name of the permission
|
||||
*/
|
||||
boolean hasPermission(@NotNull String permission);
|
||||
boolean hasPermission(@Nonnull String permission);
|
||||
|
||||
/**
|
||||
* Checks if this object contains an override for the specified
|
||||
@ -57,13 +58,13 @@ public interface CommandCaller {
|
||||
* @param permission Name of the permission
|
||||
* @return true if the permission is set, otherwise false
|
||||
*/
|
||||
boolean isPermissionSet(@NotNull String permission);
|
||||
boolean isPermissionSet(@Nonnull String permission);
|
||||
|
||||
/**
|
||||
* Get the type of the caller
|
||||
*
|
||||
* @return Caller type
|
||||
*/
|
||||
@NotNull RequiredType getSuperCaller();
|
||||
@Nonnull RequiredType getSuperCaller();
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ package com.plotsquared.core.command;
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import com.plotsquared.core.configuration.StaticCaption;
|
||||
import com.plotsquared.core.configuration.caption.TranslatableCaption;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
public enum RequiredType {
|
||||
CONSOLE(TranslatableCaption.of("console.is_console")),
|
||||
@ -48,7 +49,7 @@ public enum RequiredType {
|
||||
return this == player.getSuperCaller();
|
||||
}
|
||||
|
||||
@NotNull public Caption getErrorMessage() {
|
||||
@Nonnull public Caption getErrorMessage() {
|
||||
return this.caption;
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,8 @@
|
||||
package com.plotsquared.core.configuration;
|
||||
|
||||
import com.plotsquared.core.configuration.caption.LocaleHolder;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Any message that can be sent to a player, the console, etc.
|
||||
@ -39,6 +40,6 @@ public interface Caption {
|
||||
* @param localeHolder Locale holder
|
||||
* @return Message
|
||||
*/
|
||||
@NotNull String getComponent(@NotNull LocaleHolder localeHolder);
|
||||
@Nonnull String getComponent(@Nonnull LocaleHolder localeHolder);
|
||||
|
||||
}
|
||||
|
@ -28,7 +28,8 @@ package com.plotsquared.core.configuration;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.plotsquared.core.configuration.caption.LocaleHolder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
public final class StaticCaption implements Caption {
|
||||
@ -49,12 +50,12 @@ public final class StaticCaption implements Caption {
|
||||
* @param text Text
|
||||
* @return Created caption
|
||||
*/
|
||||
@NotNull public static StaticCaption of(@NotNull final String text) {
|
||||
@Nonnull public static StaticCaption of(@Nonnull final String text) {
|
||||
return new StaticCaption(Preconditions.checkNotNull(text, "Text may not be null"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull String getComponent(@NotNull LocaleHolder localeHolder) {
|
||||
public @Nonnull String getComponent(@Nonnull LocaleHolder localeHolder) {
|
||||
return this.value; // can't be translated
|
||||
}
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
@ -52,7 +52,7 @@ public final class CaptionLoader {
|
||||
private CaptionLoader() {
|
||||
}
|
||||
|
||||
public static CaptionMap loadAll(@NotNull final Path directory) throws IOException {
|
||||
public static CaptionMap loadAll(@Nonnull final Path directory) throws IOException {
|
||||
final Map<Locale, CaptionMap> localeMaps = new HashMap<>();
|
||||
try (Stream<Path> files = Files.list(directory)) {
|
||||
List<Path> captionFiles = files.filter(Files::isRegularFile).collect(Collectors.toList());
|
||||
@ -64,7 +64,7 @@ public final class CaptionLoader {
|
||||
}
|
||||
}
|
||||
|
||||
public static CaptionMap loadSingle(@NotNull final Path file) throws IOException {
|
||||
public static CaptionMap loadSingle(@Nonnull final Path file) throws IOException {
|
||||
final String fileName = file.getFileName().toString();
|
||||
final Matcher matcher = FILE_NAME_PATTERN.matcher(fileName);
|
||||
final Locale locale;
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.configuration.caption;
|
||||
|
||||
import net.kyori.text.Component;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -43,7 +43,7 @@ public interface CaptionMap {
|
||||
* @return Component
|
||||
* @throws NoSuchCaptionException if no caption with the given key exists
|
||||
*/
|
||||
@NotNull String getMessage(@NotNull TranslatableCaption caption) throws NoSuchCaptionException;
|
||||
@Nonnull String getMessage(@Nonnull TranslatableCaption caption) throws NoSuchCaptionException;
|
||||
|
||||
/**
|
||||
* Get a message using a specific locale
|
||||
@ -53,7 +53,7 @@ public interface CaptionMap {
|
||||
* @return Component
|
||||
* @throws NoSuchCaptionException if no caption with the given key exists
|
||||
*/
|
||||
String getMessage(@NotNull TranslatableCaption caption, @NotNull LocaleHolder localeHolder) throws NoSuchCaptionException;
|
||||
String getMessage(@Nonnull TranslatableCaption caption, @Nonnull LocaleHolder localeHolder) throws NoSuchCaptionException;
|
||||
|
||||
/**
|
||||
* Check if the map supports a given locale
|
||||
@ -61,18 +61,18 @@ public interface CaptionMap {
|
||||
* @param locale Locale
|
||||
* @return True if the map supports the locale
|
||||
*/
|
||||
boolean supportsLocale(@NotNull Locale locale);
|
||||
boolean supportsLocale(@Nonnull Locale locale);
|
||||
|
||||
/**
|
||||
* Get the locale of the messages stored in the map
|
||||
*
|
||||
* @return Message locale
|
||||
*/
|
||||
@NotNull Locale getLocale();
|
||||
@Nonnull Locale getLocale();
|
||||
|
||||
class NoSuchCaptionException extends IllegalArgumentException {
|
||||
|
||||
public NoSuchCaptionException(@NotNull final KeyedCaption caption) {
|
||||
public NoSuchCaptionException(@Nonnull final KeyedCaption caption) {
|
||||
super(String.format("No caption with the key '%s' exists in the map", caption.getKey()));
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@
|
||||
package com.plotsquared.core.configuration.caption;
|
||||
|
||||
import com.plotsquared.core.configuration.Caption;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
|
||||
/**
|
||||
* A {@link com.plotsquared.core.configuration.Caption} that can be identified by a key
|
||||
@ -38,6 +38,6 @@ public interface KeyedCaption extends Caption {
|
||||
*
|
||||
* @return Caption key
|
||||
*/
|
||||
@NotNull String getKey();
|
||||
@NonNull String getKey();
|
||||
|
||||
}
|
||||
|
@ -26,8 +26,8 @@
|
||||
package com.plotsquared.core.configuration.caption;
|
||||
|
||||
import com.plotsquared.core.player.ConsolePlayer;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -41,7 +41,7 @@ public interface LocaleHolder {
|
||||
* @return Console locale holder
|
||||
* @see ConsolePlayer#getConsole() for direct access to the {@link ConsolePlayer}
|
||||
*/
|
||||
@NotNull static LocaleHolder console() {
|
||||
@Nonnull static LocaleHolder console() {
|
||||
return ConsolePlayer.getConsole();
|
||||
}
|
||||
|
||||
@ -50,13 +50,13 @@ public interface LocaleHolder {
|
||||
*
|
||||
* @return Locale
|
||||
*/
|
||||
@NotNull Locale getLocale();
|
||||
@Nonnull Locale getLocale();
|
||||
|
||||
/**
|
||||
* Set the locale for the holder
|
||||
*
|
||||
* @param locale New locale
|
||||
*/
|
||||
void setLocale(@NotNull Locale locale);
|
||||
void setLocale(@Nonnull Locale locale);
|
||||
|
||||
}
|
||||
|
@ -25,8 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.configuration.caption;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
@ -40,19 +39,19 @@ public class LocalizedCaptionMap implements CaptionMap {
|
||||
this.captions = captions;
|
||||
}
|
||||
|
||||
@Override @NotNull public String getMessage(@NotNull final TranslatableCaption caption) {
|
||||
@Override @Nonnull public String getMessage(@Nonnull final TranslatableCaption caption) {
|
||||
return this.captions.get(caption);
|
||||
}
|
||||
|
||||
@Override @NotNull public String getMessage(@NotNull final TranslatableCaption caption, @NotNull final LocaleHolder localeHolder) {
|
||||
@Override @Nonnull public String getMessage(@Nonnull final TranslatableCaption caption, @Nonnull final LocaleHolder localeHolder) {
|
||||
return getMessage(caption); // use the translation of this locale
|
||||
}
|
||||
|
||||
@Override public boolean supportsLocale(@NotNull final Locale locale) {
|
||||
@Override public boolean supportsLocale(@Nonnull final Locale locale) {
|
||||
return this.locale.equals(locale);
|
||||
}
|
||||
|
||||
@Override @NotNull public Locale getLocale() {
|
||||
@Override @Nonnull public Locale getLocale() {
|
||||
return this.locale;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,7 @@
|
||||
*/
|
||||
package com.plotsquared.core.configuration.caption;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Collections;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
@ -40,13 +39,13 @@ public class PerUserLocaleCaptionMap extends LocalizedCaptionMap {
|
||||
this.localeMap = localeMap;
|
||||
}
|
||||
|
||||
@Override @NotNull public String getMessage(@NotNull final TranslatableCaption caption,
|
||||
@NotNull final LocaleHolder localeHolder) throws NoSuchCaptionException {
|
||||
@Override @Nonnull public String getMessage(@Nonnull final TranslatableCaption caption,
|
||||
@Nonnull final LocaleHolder localeHolder) throws NoSuchCaptionException {
|
||||
return this.localeMap.get(localeHolder.getLocale()).getMessage(caption);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsLocale(@NotNull final Locale locale) {
|
||||
public boolean supportsLocale(@Nonnull final Locale locale) {
|
||||
return this.localeMap.containsKey(locale);
|
||||
}
|
||||
|
||||
|
@ -31,8 +31,8 @@ import com.plotsquared.core.util.MainUtil;
|
||||
import lombok.experimental.UtilityClass;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@ -52,10 +52,10 @@ public class Templates {
|
||||
* @param replacements Replacements
|
||||
* @return Generated template
|
||||
*/
|
||||
@NotNull public Template of(@NotNull final LocaleHolder localeHolder,
|
||||
@NotNull final String key,
|
||||
@NotNull final Caption caption,
|
||||
@NotNull final Template... replacements) {
|
||||
@Nonnull public Template of(@Nonnull final LocaleHolder localeHolder,
|
||||
@Nonnull final String key,
|
||||
@Nonnull final Caption caption,
|
||||
@Nonnull final Template... replacements) {
|
||||
return Template.of(key, MINI_MESSAGE.parse(caption.getComponent(localeHolder), replacements));
|
||||
}
|
||||
|
||||
@ -66,8 +66,8 @@ public class Templates {
|
||||
* @param uuid Player UUID
|
||||
* @return Generated template
|
||||
*/
|
||||
@NotNull public Template of(@NotNull final String key,
|
||||
@NotNull final UUID uuid) {
|
||||
@Nonnull public Template of(@Nonnull final String key,
|
||||
@Nonnull final UUID uuid) {
|
||||
final String username = MainUtil.getName(uuid);
|
||||
return Template.of(key, username);
|
||||
}
|
||||
@ -79,8 +79,8 @@ public class Templates {
|
||||
* @param value Template value
|
||||
* @return Generated template
|
||||
*/
|
||||
@NotNull public Template of(@NotNull final String key,
|
||||
@NotNull final String value) {
|
||||
@Nonnull public Template of(@Nonnull final String key,
|
||||
@Nonnull final String value) {
|
||||
return Template.of(key, value);
|
||||
}
|
||||
|
||||
@ -91,8 +91,8 @@ public class Templates {
|
||||
* @param area Plot area
|
||||
* @return Generated template
|
||||
*/
|
||||
@NotNull public Template of(@NotNull final String key,
|
||||
@NotNull final PlotArea area) {
|
||||
@Nonnull public Template of(@Nonnull final String key,
|
||||
@Nonnull final PlotArea area) {
|
||||
return Template.of(key, area.toString());
|
||||
}
|
||||
|
||||
@ -103,8 +103,8 @@ public class Templates {
|
||||
* @param number Number
|
||||
* @return Generated template
|
||||
*/
|
||||
@NotNull public Template of(@NotNull final String key,
|
||||
@NotNull final Number number) {
|
||||
@Nonnull public Template of(@Nonnull final String key,
|
||||
@Nonnull final Number number) {
|
||||
return Template.of(key, number.toString());
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ package com.plotsquared.core.configuration.caption;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import lombok.Getter;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
@ -38,7 +38,7 @@ public final class TranslatableCaption implements KeyedCaption {
|
||||
|
||||
@Getter private final String key;
|
||||
|
||||
private TranslatableCaption(@NotNull final String key) {
|
||||
private TranslatableCaption(@Nonnull final String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@ -48,11 +48,11 @@ public final class TranslatableCaption implements KeyedCaption {
|
||||
* @param key Caption key
|
||||
* @return Caption instance
|
||||
*/
|
||||
@NotNull public static TranslatableCaption of(@NotNull final String key) {
|
||||
@Nonnull public static TranslatableCaption of(@Nonnull final String key) {
|
||||
return new TranslatableCaption(key.toLowerCase(Locale.ENGLISH));
|
||||
}
|
||||
|
||||
@Override @NotNull public String getComponent(@NotNull final LocaleHolder localeHolder) {
|
||||
@Override @Nonnull public String getComponent(@Nonnull final LocaleHolder localeHolder) {
|
||||
return PlotSquared.get().getCaptionMap().getMessage(this, localeHolder);
|
||||
}
|
||||
|
||||
|
@ -47,12 +47,11 @@ import com.sk89q.worldedit.world.item.ItemType;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import net.kyori.adventure.text.minimessage.Template;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
@ -111,8 +110,8 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendTitle(@NotNull final Caption title, @NotNull final Caption subtitle,
|
||||
final int fadeIn, final int stay, final int fadeOut, @NotNull final Template... replacements) {
|
||||
public void sendTitle(@Nonnull final Caption title, @Nonnull final Caption subtitle,
|
||||
final int fadeIn, final int stay, final int fadeOut, @Nonnull final Template... replacements) {
|
||||
}
|
||||
|
||||
@Nonnull @Override public Location getLocation() {
|
||||
@ -131,15 +130,16 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override public boolean hasPermission(@NotNull String permission) {
|
||||
@Override public boolean hasPermission(@Nonnull String permission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public boolean isPermissionSet(@NotNull String permission) {
|
||||
@Override public boolean isPermissionSet(@Nonnull String permission) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override public void sendMessage(@NotNull final Caption caption, @NotNull final Template... replacements) {
|
||||
@Override public void sendMessage(@Nonnull final Caption caption,
|
||||
@Nonnull final Template... replacements) {
|
||||
final String message = caption.getComponent(this);
|
||||
if (message.isEmpty()) {
|
||||
return;
|
||||
@ -149,7 +149,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
templates.add(Template.of("prefix", MINI_MESSAGE.parse(
|
||||
TranslatableCaption.of("core.prefix").getComponent(this))));
|
||||
// Parse the message
|
||||
PlotSquared.imp().getConsoleAudience().sendMessage(MINI_MESSAGE.parse(message, templates));
|
||||
PlotSquared.platform().getConsoleAudience().sendMessage(MINI_MESSAGE.parse(message, templates));
|
||||
}
|
||||
|
||||
@Override public void teleport(Location location, TeleportCause cause) {
|
||||
@ -178,7 +178,7 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
@Override public void removeAttribute(String key) {
|
||||
}
|
||||
|
||||
@Override @NotNull public RequiredType getSuperCaller() {
|
||||
@Override @Nonnull public RequiredType getSuperCaller() {
|
||||
return RequiredType.CONSOLE;
|
||||
}
|
||||
|
||||
@ -215,8 +215,8 @@ public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override @NotNull public Audience getAudience() {
|
||||
return PlotSquared.imp().getConsoleAudience();
|
||||
@Override @Nonnull public Audience getAudience() {
|
||||
return PlotSquared.platform().getConsoleAudience();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -59,8 +59,6 @@ import com.plotsquared.core.util.task.TaskManager;
|
||||
import com.sk89q.worldedit.extension.platform.Actor;
|
||||
import com.sk89q.worldedit.world.gamemode.GameMode;
|
||||
import com.sk89q.worldedit.world.item.ItemType;
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import net.kyori.adventure.audience.Audience;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
@ -69,6 +67,8 @@ import net.kyori.adventure.title.Title;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.time.Duration;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
@ -390,7 +390,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
||||
return this.plotAreaManager.getApplicablePlotArea(getLocation());
|
||||
}
|
||||
|
||||
@Override @NotNull public RequiredType getSuperCaller() {
|
||||
@Override @Nonnull public RequiredType getSuperCaller() {
|
||||
return RequiredType.PLAYER;
|
||||
}
|
||||
|
||||
@ -758,8 +758,8 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
||||
* @param subtitle Subtitle text
|
||||
* @param replacements Variable replacements
|
||||
*/
|
||||
public void sendTitle(@NotNull final Caption title, @NotNull final Caption subtitle,
|
||||
@NotNull final Template... replacements) {
|
||||
public void sendTitle(@Nonnull final Caption title, @Nonnull final Caption subtitle,
|
||||
@Nonnull final Template... replacements) {
|
||||
sendTitle(title, subtitle, 10, 50, 20, replacements);
|
||||
}
|
||||
|
||||
@ -773,9 +773,9 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
||||
* @param fadeOut Fade out time (in ticks)
|
||||
* @param replacements Variable replacements
|
||||
*/
|
||||
public void sendTitle(@NotNull final Caption title, @NotNull final Caption subtitle,
|
||||
public void sendTitle(@Nonnull final Caption title, @Nonnull final Caption subtitle,
|
||||
final int fadeIn, final int stay, final int fadeOut,
|
||||
@NotNull final Template... replacements) {
|
||||
@Nonnull final Template... replacements) {
|
||||
final Component titleComponent = MINI_MESSAGE.parse(title.getComponent(this), replacements);
|
||||
final Component subtitleComponent =
|
||||
MINI_MESSAGE.parse(subtitle.getComponent(this), replacements);
|
||||
@ -785,8 +785,8 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
||||
Duration.of(fadeOut * 50, ChronoUnit.MILLIS)));
|
||||
}
|
||||
|
||||
@Override public void sendMessage(@NotNull final Caption caption,
|
||||
@NotNull final Template... replacements) {
|
||||
@Override public void sendMessage(@Nonnull final Caption caption,
|
||||
@Nonnull final Template... replacements) {
|
||||
String message;
|
||||
try {
|
||||
message = caption.getComponent(this);
|
||||
@ -822,14 +822,14 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
||||
return this.getAttribute("debug");
|
||||
}
|
||||
|
||||
@NotNull @Override public Locale getLocale() {
|
||||
@Nonnull @Override public Locale getLocale() {
|
||||
if (this.locale == null) {
|
||||
this.locale = Locale.forLanguageTag(Settings.Enabled_Components.DEFAULT_LOCALE);
|
||||
}
|
||||
return this.locale;
|
||||
}
|
||||
|
||||
@Override public void setLocale(@NotNull final Locale locale) {
|
||||
@Override public void setLocale(@Nonnull final Locale locale) {
|
||||
if (!PlotSquared.get().getCaptionMap().supportsLocale(locale)) {
|
||||
this.locale = Locale.forLanguageTag(Settings.Enabled_Components.DEFAULT_LOCALE);
|
||||
} else {
|
||||
@ -857,7 +857,7 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer,
|
||||
*
|
||||
* @return Player audience
|
||||
*/
|
||||
@NotNull public abstract Audience getAudience();
|
||||
@Nonnull public abstract Audience getAudience();
|
||||
|
||||
/**
|
||||
* The amount of money this Player has.
|
||||
|
@ -121,8 +121,9 @@ public abstract class WorldUtil {
|
||||
* @param lines Sign text
|
||||
* @param replacements Text replacements
|
||||
*/
|
||||
public abstract void setSign(@NotNull Location location, @NotNull Caption[] lines,
|
||||
@NotNull Template ... replacements);
|
||||
public abstract void setSign(@Nonnull Location location,
|
||||
@Nonnull Caption[] lines,
|
||||
@Nonnull Template ... replacements);
|
||||
|
||||
public abstract void setBiomes(String world, CuboidRegion region, BiomeType biome);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user