Manually fix some merge conflicts

This commit is contained in:
Alexander Söderberg
2020-07-14 19:34:44 +02:00
parent 198bcfdf4d
commit b68d7150f1
19 changed files with 115 additions and 226 deletions

View File

@ -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();
}

View File

@ -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 &amp; 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();
}

View File

@ -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;
}
}

View File

@ -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);
}

View File

@ -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
}
}

View File

@ -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;

View File

@ -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()));
}

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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;
}

View File

@ -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);
}

View File

@ -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());
}

View File

@ -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);
}

View File

@ -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();
}
}

View File

@ -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.

View File

@ -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);