From 22bd2eb2380b56e4189ba00e74a025ffd0b5c43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20S=C3=B6derberg?= Date: Fri, 17 Jul 2020 18:06:38 +0200 Subject: [PATCH] Super minor issues from previous merges --- .../com/plotsquared/core/PlotPlatform.java | 3 +- .../com/plotsquared/core/PlotSquared.java | 11 ----- .../com/plotsquared/core/command/Area.java | 5 +-- .../core/util/logger/DelegateLogger.java | 43 ------------------- .../plotsquared/core/util/logger/ILogger.java | 30 ------------- .../plotsquared/core/util/task/TaskTime.java | 21 +++++++-- Core/src/main/resources/lang/messages_en.json | 1 + 7 files changed, 21 insertions(+), 93 deletions(-) delete mode 100644 Core/src/main/java/com/plotsquared/core/util/logger/DelegateLogger.java delete mode 100644 Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java diff --git a/Core/src/main/java/com/plotsquared/core/PlotPlatform.java b/Core/src/main/java/com/plotsquared/core/PlotPlatform.java index 48179f0b6..d10077a44 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotPlatform.java +++ b/Core/src/main/java/com/plotsquared/core/PlotPlatform.java @@ -42,7 +42,6 @@ import com.plotsquared.core.util.PlayerManager; 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 net.kyori.adventure.audience.Audience; import javax.annotation.Nonnull; @@ -56,7 +55,7 @@ import java.util.Map; * * @param

Player type */ -public interface PlotPlatform

extends ILogger { +public interface PlotPlatform

{ /** * Logs a message to console. diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index f79ff1d29..feac2bdf8 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -65,7 +65,6 @@ import com.plotsquared.core.util.LegacyConverter; import com.plotsquared.core.util.MainUtil; import com.plotsquared.core.util.MathMan; import com.plotsquared.core.util.ReflectionUtils; -import com.plotsquared.core.util.logger.ILogger; import com.plotsquared.core.util.query.PlotQuery; import com.plotsquared.core.util.task.TaskManager; import com.plotsquared.core.uuid.UUIDPipeline; @@ -143,8 +142,6 @@ public class PlotSquared { private YamlConfiguration config; // Localization private CaptionMap captionMap; - // Implementation logger - private ILogger logger; // Platform / Version / Update URL private PlotVersion version; // Files and configuration @@ -1475,10 +1472,6 @@ public class PlotSquared { return this.captionMap; } - public ILogger getLogger() { - return this.logger; - } - public File getJarFile() { return this.jarFile; } @@ -1491,10 +1484,6 @@ public class PlotSquared { return this.plotListener; } - public void setLogger(ILogger logger) { - this.logger = logger; - } - public enum SortType { CREATION_DATE, CREATION_DATE_TIMESTAMP, LAST_MODIFIED, DISTANCE_FROM_ORIGIN } diff --git a/Core/src/main/java/com/plotsquared/core/command/Area.java b/Core/src/main/java/com/plotsquared/core/command/Area.java index f811daed1..705b3917c 100644 --- a/Core/src/main/java/com/plotsquared/core/command/Area.java +++ b/Core/src/main/java/com/plotsquared/core/command/Area.java @@ -244,9 +244,8 @@ public class Area extends SubCommand { PlotSquared.get().loadWorld(world, null); player.sendMessage(TranslatableCaption.of("single.single_area_created")); } else { - MainUtil.sendMessage(player, - "An error occurred while creating the world: " + hybridPlotWorld - .getWorldName()); + player.sendMessage(TranslatableCaption.of("errors.error_create", + Template.of("world", hybridPlotWorld.getWorldName()))); } }; singleRun.run(); diff --git a/Core/src/main/java/com/plotsquared/core/util/logger/DelegateLogger.java b/Core/src/main/java/com/plotsquared/core/util/logger/DelegateLogger.java deleted file mode 100644 index 81e11cada..000000000 --- a/Core/src/main/java/com/plotsquared/core/util/logger/DelegateLogger.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * _____ _ _ _____ _ - * | __ \| | | | / ____| | | - * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| | - * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` | - * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| | - * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_| - * | | - * |_| - * PlotSquared plot management system for Minecraft - * Copyright (C) 2020 IntellectualSites - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.plotsquared.core.util.logger; - -public class DelegateLogger implements ILogger { - - private final ILogger parent; - - public DelegateLogger(ILogger parent) { - this.parent = parent; - } - - public ILogger getParent() { - return parent; - } - - @Override public void log(String message) { - parent.log(message); - } -} diff --git a/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java b/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java deleted file mode 100644 index c5e145812..000000000 --- a/Core/src/main/java/com/plotsquared/core/util/logger/ILogger.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * _____ _ _ _____ _ - * | __ \| | | | / ____| | | - * | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| | - * | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` | - * | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| | - * |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_| - * | | - * |_| - * PlotSquared plot management system for Minecraft - * Copyright (C) 2020 IntellectualSites - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ -package com.plotsquared.core.util.logger; - -@Deprecated public interface ILogger { - @Deprecated void log(String message); -} diff --git a/Core/src/main/java/com/plotsquared/core/util/task/TaskTime.java b/Core/src/main/java/com/plotsquared/core/util/task/TaskTime.java index d11a0b111..54e873626 100644 --- a/Core/src/main/java/com/plotsquared/core/util/task/TaskTime.java +++ b/Core/src/main/java/com/plotsquared/core/util/task/TaskTime.java @@ -25,8 +25,7 @@ */ package com.plotsquared.core.util.task; -import lombok.EqualsAndHashCode; -import lombok.ToString; +import com.google.common.base.Objects; import javax.annotation.Nonnegative; import javax.annotation.Nonnull; @@ -34,7 +33,6 @@ import javax.annotation.Nonnull; /** * Task timings */ -@EqualsAndHashCode @ToString @SuppressWarnings("unused") public final class TaskTime { private final long time; @@ -93,7 +91,22 @@ public final class TaskTime { return this.unit; } - + @Override public boolean equals(final Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + final TaskTime taskTime = (TaskTime) o; + return getTime() == taskTime.getTime() && getUnit() == taskTime.getUnit(); + } + + @Override public int hashCode() { + return Objects.hashCode(getTime(), getUnit()); + } + + public enum TaskUnit { TICKS, MILLISECONDS } diff --git a/Core/src/main/resources/lang/messages_en.json b/Core/src/main/resources/lang/messages_en.json index 1678cd1c3..19445d541 100644 --- a/Core/src/main/resources/lang/messages_en.json +++ b/Core/src/main/resources/lang/messages_en.json @@ -226,6 +226,7 @@ "errors.invalid_player_offline": "The player must be online: .", "errors.invalid_command_flag": "Invalid command flag: ", "errors.error": "An error occurred: ", + "errors.error_create": "An error occurred while creating the world: ", "errors.error_console": "An error occurred. See the console for more information.", "errors.command_went_wrong": "Something went wrong when executing that command...", "errors.no_free_plots": "There are no free plots available.",