Fix gradle setup and replace all debug calls

This commit is contained in:
Alexander Söderberg
2020-07-13 22:51:57 +02:00
parent b109b76120
commit a1f262b5b2
46 changed files with 308 additions and 317 deletions

View File

@ -38,9 +38,7 @@ dependencies {
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false }
// logging
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3')
implementation('org.apache.logging.log4j:log4j-core:2.13.3')
implementation('org.apache.logging.log4j:log4j-api:2.13.3')
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.8.1')
}
sourceCompatibility = 1.8
@ -99,19 +97,18 @@ shadowJar {
include(dependency("org.bstats:bstats-bukkit:1.7"))
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
include(dependency("com.sk89q:squirrelid:1.0.0-SNAPSHOT"))
include(dependency("org.slf4j:slf4j-jdk14:2.0.0-alpha1"))
include(dependency('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'))
include(dependency('org.apache.logging.log4j:log4j-core:2.13.3'))
include(dependency('org.apache.logging.log4j:log4j-api:2.13.3'))
include(dependency('org.slf4j:slf4j-api:1.7.26'))
include(dependency('org.apache.logging.log4j:log4j-slf4j-impl'))
include(dependency('org.slf4j:slf4j-api'))
}
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
relocate("org.bstats", "com.plotsquared.metrics")
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
relocate('org.khelekore.prtree', 'com.plotsquared.prtree')
// relocate('org.apache.logging', 'com.plotsquared.logging.apache')
// relocate('org.slf4j', 'com.plotsquared.logging.slf4j')
relocate('org.apache.logging.slf4j', 'com.plotsquared.logging.apache')
relocate('org.slf4j', 'com.plotsquared.logging.slf4j')
archiveFileName = "${project.name}-${parent.version}.jar"
destinationDirectory = file "../target"
}

View File

@ -167,19 +167,7 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>2.13.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<version>2.13.3</version>
<version>2.8.1</version>
<scope>runtime</scope>
</dependency>
<dependency>

View File

@ -101,7 +101,6 @@ import com.plotsquared.core.util.ReflectionUtils;
import com.plotsquared.core.util.RegionManager;
import com.plotsquared.core.util.SchematicHandler;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.CacheUUIDService;
@ -161,7 +160,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<Player> {
private static final Logger logger = LoggerFactory.getLogger(BukkitMain.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitMain.class.getSimpleName());
private static final int BSTATS_ID = 1404;
@Getter private static WorldEdit worldEdit;
@ -195,8 +194,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
}
} catch (NumberFormatException e) {
e.printStackTrace();
logger.debug(StringMan.getString(Bukkit.getBukkitVersion()));
logger.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
return new int[] {1, 13, 0};
}
}
@ -445,7 +442,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
final Chunk[] chunks = world.getLoadedChunks();
if (chunks.length == 0) {
if (!Bukkit.unloadWorld(world, true)) {
logger.debug("Failed to unload {}", world.getName());
logger.warn("Failed to unload {}", world.getName());
}
return;
} else {
@ -536,7 +533,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
uuidList.clear();
// Print progress
final double percentage = ((double) read / (double) totalSize) * 100.0D;
logger.debug("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
if (Settings.DEBUG) {
logger.info("(UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
}
} catch (final InterruptedException | ExecutionException e) {
logger.error("(UUID) Failed to retrieve last batch. Will try again", e);
e.printStackTrace();
@ -897,7 +896,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
return econ;
}
} catch (Throwable ignored) {
logger.debug("No economy handler detected");
}
return null;
}

View File

@ -25,6 +25,7 @@
*/
package com.plotsquared.bukkit.entity;
import com.plotsquared.core.configuration.Settings;
import org.bukkit.Art;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -61,7 +62,7 @@ import java.util.List;
public final class ReplicatingEntityWrapper extends EntityWrapper {
private static final Logger logger = LoggerFactory.getLogger(ReplicatingEntityWrapper.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + ReplicatingEntityWrapper.class.getSimpleName());
private final short depth;
private final int hash;
@ -331,10 +332,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.dataByte = (byte) 0;
}
storeLiving((LivingEntity) entity);
return;
// END LIVING //
default:
logger.debug("Could not identify entity: {}", entity.getType());
}
}
@ -733,7 +731,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
restoreLiving((LivingEntity) entity);
return entity;
default:
logger.debug("Could not identify entity: {}", entity.getType());
if (Settings.DEBUG) {
logger.info("Could not identify entity: {}", entity.getType());
}
return entity;
// END LIVING
}

View File

@ -62,7 +62,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused")
public class ChunkListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger(ChunkListener.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + ChunkListener.class.getSimpleName());
private RefMethod methodGetHandleChunk;
private RefField mustSave;
@ -294,12 +294,9 @@ public class ChunkListener implements Listener {
toRemove--;
}
}
logger.debug("PlotSquared detected chunk and processed it: {},{}", chunk.getX() << 4, chunk.getZ() << 4);
}
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) {
logger.debug("PlotSquared detected chunk: {},{}", chunk.getX() << 4, chunk.getZ() << 4);
cleanChunk(chunk);
return true;
}

View File

@ -76,7 +76,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
public class BukkitRegionManager extends RegionManager {
private static final Logger logger = LoggerFactory.getLogger(BukkitRegionManager.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitRegionManager.class.getSimpleName());
public static boolean isIn(CuboidRegion region, int x, int z) {
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
@ -93,8 +93,6 @@ public class BukkitRegionManager extends RegionManager {
} else {
final Semaphore semaphore = new Semaphore(1);
try {
logger.debug("Attempting to make an asynchronous call to getLoadedChunks."
+ " Will halt the calling thread until completed.");
semaphore.acquire();
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> {
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))

View File

@ -112,7 +112,7 @@ import java.util.stream.Stream;
@SuppressWarnings({"unused", "WeakerAccess"})
public class BukkitUtil extends WorldUtil {
private static final Logger logger = LoggerFactory.getLogger(BukkitUtil.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
private static String lastString = null;
private static World lastWorld = null;

View File

@ -47,7 +47,7 @@ import java.util.Set;
public class ContentMap {
private static final Logger logger = LoggerFactory.getLogger(ContentMap.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + ContentMap.class.getSimpleName());
final Set<EntityWrapper> entities;
final Map<PlotLoc, BaseBlock[]> allBlocks;

View File

@ -45,7 +45,7 @@ import java.net.URL;
public class UpdateUtility implements Listener {
private static final Logger logger = LoggerFactory.getLogger(UpdateUtility.class);
private static final Logger logger = LoggerFactory.getLogger("P2/" + UpdateUtility.class.getSimpleName());
public static PlotVersion internalVersion;
public static String spigotVersion;