From 0d89125a8e5f4fe269b7918853a4011ced503e02 Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Thu, 8 Oct 2020 20:52:02 +0200 Subject: [PATCH] Replace sys out with logger factory --- .../main/java/com/plotsquared/bukkit/BukkitPlatform.java | 6 +++--- Core/src/main/java/com/plotsquared/core/PlotSquared.java | 1 - .../src/test/java/com/plotsquared/core/plot/FlagTest.java | 8 ++++++-- .../java/com/plotsquared/core/plot/PlotVersionTest.java | 6 +++++- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index bdad258d7..720602f72 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -236,9 +236,9 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl final PlotSquared plotSquared = new PlotSquared(this, "Bukkit"); if (PlotSquared.platform().getServerVersion()[1] < 13) { - System.out.println("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); - System.out.println("Please check the download page for the link to the legacy versions."); - System.out.println("The server will now be shutdown to prevent any corruption."); + logger.info("You can't use this version of PlotSquared on a server less than Minecraft 1.13.2."); + logger.info("Please check the download page for the link to the legacy versions."); + logger.info("The server will now be shutdown to prevent any corruption."); Bukkit.shutdown(); return; } diff --git a/Core/src/main/java/com/plotsquared/core/PlotSquared.java b/Core/src/main/java/com/plotsquared/core/PlotSquared.java index 3cc968a1e..ebc6ccad2 100644 --- a/Core/src/main/java/com/plotsquared/core/PlotSquared.java +++ b/Core/src/main/java/com/plotsquared/core/PlotSquared.java @@ -1300,7 +1300,6 @@ public class PlotSquared { String commitString = br.readLine(); String dateString = br.readLine(); this.version = PlotVersion.tryParse(versionString, commitString, dateString); - System.out.println("Version is " + this.version); } } catch (IOException throwable) { throwable.printStackTrace(); diff --git a/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java b/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java index 7d6e8f7a5..1ef3e116f 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/FlagTest.java @@ -32,11 +32,15 @@ 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.slf4j.Logger; +import org.slf4j.LoggerFactory; import static org.junit.Assert.assertEquals; public class FlagTest { + private static final Logger logger = LoggerFactory.getLogger("P2/" + FlagTest.class.getSimpleName()); + private ItemType testBlock; @Before public void setUp() throws Exception { @@ -50,11 +54,11 @@ public class FlagTest { // //plot.setFlag(use, use.parseValue("33,33:1,6:4")); //TODO fix this so FlagTest will run during compile // Optional flag = plot.getFlag(use); // if (flag.isPresent()) { -// System.out.println(Flags.USE.valueToString(flag.get())); +// logger.info(Flags.USE.valueToString(flag.get())); // testBlock = ItemTypes.BONE_BLOCK; // flag.get().add(testBlock); // } -// flag.ifPresent(collection -> System.out.println(Flags.USE.valueToString(collection))); +// flag.ifPresent(collection -> logger.info(Flags.USE.valueToString(collection))); // Optional> flag2 = plot.getFlag(Flags.USE); // if (flag2.isPresent()) { // // assertThat(flag2.get(), (Matcher>) IsCollectionContaining.hasItem(testBlock)); diff --git a/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java b/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java index 26ddf72cc..be0b43e41 100644 --- a/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java +++ b/Core/src/test/java/com/plotsquared/core/plot/PlotVersionTest.java @@ -27,13 +27,17 @@ package com.plotsquared.core.plot; import com.plotsquared.core.PlotVersion; import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class PlotVersionTest { + private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotVersionTest.class.getSimpleName()); + @Test public void tryParse() { //These are all random values chosen to form the test class. PlotVersion version = new PlotVersion("4.340", "f06903f", "19.08.05"); - System.out.println(version.versionString); + logger.info(version.versionString); } }