mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 13:16:45 +01:00
Fix gradle setup and replace all debug calls
This commit is contained in:
parent
b109b76120
commit
a1f262b5b2
@ -38,9 +38,7 @@ dependencies {
|
|||||||
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
|
compile("se.hyperver.hyperverse:Core:0.6.0-SNAPSHOT"){ transitive = false }
|
||||||
compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false }
|
compile('com.sk89q:squirrelid:1.0.0-SNAPSHOT'){ transitive = false }
|
||||||
// logging
|
// logging
|
||||||
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3')
|
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.8.1')
|
||||||
implementation('org.apache.logging.log4j:log4j-core:2.13.3')
|
|
||||||
implementation('org.apache.logging.log4j:log4j-api:2.13.3')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
@ -99,19 +97,18 @@ shadowJar {
|
|||||||
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
include(dependency("org.bstats:bstats-bukkit:1.7"))
|
||||||
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
|
include(dependency("org.khelekore:prtree:1.7.0-SNAPSHOT"))
|
||||||
include(dependency("com.sk89q:squirrelid:1.0.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'))
|
||||||
include(dependency('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3'))
|
include(dependency('org.slf4j:slf4j-api'))
|
||||||
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'))
|
|
||||||
}
|
}
|
||||||
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
relocate('net.kyori.text', 'com.plotsquared.formatting.text')
|
||||||
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
relocate("io.papermc.lib", "com.plotsquared.bukkit.paperlib")
|
||||||
relocate("org.bstats", "com.plotsquared.metrics")
|
relocate("org.bstats", "com.plotsquared.metrics")
|
||||||
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
relocate('com.sk89q.squirrelid', 'com.plotsquared.squirrelid')
|
||||||
relocate('org.khelekore.prtree', 'com.plotsquared.prtree')
|
relocate('org.khelekore.prtree', 'com.plotsquared.prtree')
|
||||||
// relocate('org.apache.logging', 'com.plotsquared.logging.apache')
|
relocate('org.apache.logging.slf4j', 'com.plotsquared.logging.apache')
|
||||||
// relocate('org.slf4j', 'com.plotsquared.logging.slf4j')
|
relocate('org.slf4j', 'com.plotsquared.logging.slf4j')
|
||||||
|
|
||||||
|
|
||||||
archiveFileName = "${project.name}-${parent.version}.jar"
|
archiveFileName = "${project.name}-${parent.version}.jar"
|
||||||
destinationDirectory = file "../target"
|
destinationDirectory = file "../target"
|
||||||
}
|
}
|
||||||
|
@ -167,19 +167,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-slf4j-impl</artifactId>
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
<version>2.13.3</version>
|
<version>2.8.1</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>
|
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -101,7 +101,6 @@ import com.plotsquared.core.util.ReflectionUtils;
|
|||||||
import com.plotsquared.core.util.RegionManager;
|
import com.plotsquared.core.util.RegionManager;
|
||||||
import com.plotsquared.core.util.SchematicHandler;
|
import com.plotsquared.core.util.SchematicHandler;
|
||||||
import com.plotsquared.core.util.SetupUtils;
|
import com.plotsquared.core.util.SetupUtils;
|
||||||
import com.plotsquared.core.util.StringMan;
|
|
||||||
import com.plotsquared.core.util.WorldUtil;
|
import com.plotsquared.core.util.WorldUtil;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
import com.plotsquared.core.uuid.CacheUUIDService;
|
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> {
|
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;
|
private static final int BSTATS_ID = 1404;
|
||||||
@Getter private static WorldEdit worldEdit;
|
@Getter private static WorldEdit worldEdit;
|
||||||
@ -195,8 +194,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
|
|||||||
}
|
}
|
||||||
} catch (NumberFormatException e) {
|
} catch (NumberFormatException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug(StringMan.getString(Bukkit.getBukkitVersion()));
|
|
||||||
logger.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
|
|
||||||
return new int[] {1, 13, 0};
|
return new int[] {1, 13, 0};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -445,7 +442,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
|
|||||||
final Chunk[] chunks = world.getLoadedChunks();
|
final Chunk[] chunks = world.getLoadedChunks();
|
||||||
if (chunks.length == 0) {
|
if (chunks.length == 0) {
|
||||||
if (!Bukkit.unloadWorld(world, true)) {
|
if (!Bukkit.unloadWorld(world, true)) {
|
||||||
logger.debug("Failed to unload {}", world.getName());
|
logger.warn("Failed to unload {}", world.getName());
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
@ -536,7 +533,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
|
|||||||
uuidList.clear();
|
uuidList.clear();
|
||||||
// Print progress
|
// Print progress
|
||||||
final double percentage = ((double) read / (double) totalSize) * 100.0D;
|
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) {
|
} catch (final InterruptedException | ExecutionException e) {
|
||||||
logger.error("(UUID) Failed to retrieve last batch. Will try again", e);
|
logger.error("(UUID) Failed to retrieve last batch. Will try again", e);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -897,7 +896,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain<
|
|||||||
return econ;
|
return econ;
|
||||||
}
|
}
|
||||||
} catch (Throwable ignored) {
|
} catch (Throwable ignored) {
|
||||||
logger.debug("No economy handler detected");
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.bukkit.entity;
|
package com.plotsquared.bukkit.entity;
|
||||||
|
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import org.bukkit.Art;
|
import org.bukkit.Art;
|
||||||
import org.bukkit.DyeColor;
|
import org.bukkit.DyeColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -61,7 +62,7 @@ import java.util.List;
|
|||||||
|
|
||||||
public final class ReplicatingEntityWrapper extends EntityWrapper {
|
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 short depth;
|
||||||
private final int hash;
|
private final int hash;
|
||||||
@ -331,10 +332,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
this.dataByte = (byte) 0;
|
this.dataByte = (byte) 0;
|
||||||
}
|
}
|
||||||
storeLiving((LivingEntity) entity);
|
storeLiving((LivingEntity) entity);
|
||||||
return;
|
|
||||||
// END LIVING //
|
// END LIVING //
|
||||||
default:
|
|
||||||
logger.debug("Could not identify entity: {}", entity.getType());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -733,7 +731,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
|
|||||||
restoreLiving((LivingEntity) entity);
|
restoreLiving((LivingEntity) entity);
|
||||||
return entity;
|
return entity;
|
||||||
default:
|
default:
|
||||||
logger.debug("Could not identify entity: {}", entity.getType());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Could not identify entity: {}", entity.getType());
|
||||||
|
}
|
||||||
return entity;
|
return entity;
|
||||||
// END LIVING
|
// END LIVING
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class ChunkListener implements Listener {
|
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 RefMethod methodGetHandleChunk;
|
||||||
private RefField mustSave;
|
private RefField mustSave;
|
||||||
@ -294,12 +294,9 @@ public class ChunkListener implements Listener {
|
|||||||
toRemove--;
|
toRemove--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("PlotSquared detected chunk and processed it: {},{}", chunk.getX() << 4, chunk.getZ() << 4);
|
|
||||||
}
|
}
|
||||||
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
|
||||||
if (unload) {
|
if (unload) {
|
||||||
logger.debug("PlotSquared detected chunk: {},{}", chunk.getX() << 4, chunk.getZ() << 4);
|
|
||||||
cleanChunk(chunk);
|
cleanChunk(chunk);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
|||||||
|
|
||||||
public class BukkitRegionManager extends RegionManager {
|
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) {
|
public static boolean isIn(CuboidRegion region, int x, int z) {
|
||||||
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
|
return x >= region.getMinimumPoint().getX() && x <= region.getMaximumPoint().getX()
|
||||||
@ -93,8 +93,6 @@ public class BukkitRegionManager extends RegionManager {
|
|||||||
} else {
|
} else {
|
||||||
final Semaphore semaphore = new Semaphore(1);
|
final Semaphore semaphore = new Semaphore(1);
|
||||||
try {
|
try {
|
||||||
logger.debug("Attempting to make an asynchronous call to getLoadedChunks."
|
|
||||||
+ " Will halt the calling thread until completed.");
|
|
||||||
semaphore.acquire();
|
semaphore.acquire();
|
||||||
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> {
|
Bukkit.getScheduler().runTask(BukkitMain.getPlugin(BukkitMain.class), () -> {
|
||||||
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))
|
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))
|
||||||
|
@ -112,7 +112,7 @@ import java.util.stream.Stream;
|
|||||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||||
public class BukkitUtil extends WorldUtil {
|
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 String lastString = null;
|
||||||
private static World lastWorld = null;
|
private static World lastWorld = null;
|
||||||
|
@ -47,7 +47,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ContentMap {
|
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 Set<EntityWrapper> entities;
|
||||||
final Map<PlotLoc, BaseBlock[]> allBlocks;
|
final Map<PlotLoc, BaseBlock[]> allBlocks;
|
||||||
|
@ -45,7 +45,7 @@ import java.net.URL;
|
|||||||
|
|
||||||
public class UpdateUtility implements Listener {
|
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 PlotVersion internalVersion;
|
||||||
public static String spigotVersion;
|
public static String spigotVersion;
|
||||||
|
@ -19,9 +19,7 @@ dependencies {
|
|||||||
implementation("org.jetbrains:annotations:19.0.0")
|
implementation("org.jetbrains:annotations:19.0.0")
|
||||||
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
implementation("org.khelekore:prtree:1.7.0-SNAPSHOT")
|
||||||
// logging
|
// logging
|
||||||
implementation('org.apache.logging.log4j:log4j-slf4j-impl:2.13.3')
|
implementation("org.apache.logging.log4j:log4j-slf4j-impl:2.8.1")
|
||||||
implementation('org.apache.logging.log4j:log4j-core:2.13.3')
|
|
||||||
implementation('org.apache.logging.log4j:log4j-api:2.13.3')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sourceCompatibility = 1.8
|
sourceCompatibility = 1.8
|
||||||
|
14
Core/pom.xml
14
Core/pom.xml
@ -101,19 +101,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.logging.log4j</groupId>
|
<groupId>org.apache.logging.log4j</groupId>
|
||||||
<artifactId>log4j-slf4j-impl</artifactId>
|
<artifactId>log4j-slf4j-impl</artifactId>
|
||||||
<version>2.13.3</version>
|
<version>2.8.1</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>
|
|
||||||
<scope>runtime</scope>
|
<scope>runtime</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
|
@ -27,7 +27,6 @@ package com.plotsquared.core;
|
|||||||
|
|
||||||
import com.plotsquared.core.command.WE_Anywhere;
|
import com.plotsquared.core.command.WE_Anywhere;
|
||||||
import com.plotsquared.core.components.ComponentPresetManager;
|
import com.plotsquared.core.components.ComponentPresetManager;
|
||||||
import com.plotsquared.core.configuration.Caption;
|
|
||||||
import com.plotsquared.core.configuration.Captions;
|
import com.plotsquared.core.configuration.Captions;
|
||||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||||
import com.plotsquared.core.configuration.ConfigurationUtil;
|
import com.plotsquared.core.configuration.ConfigurationUtil;
|
||||||
@ -137,7 +136,8 @@ import java.util.zip.ZipInputStream;
|
|||||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||||
public class PlotSquared {
|
public class PlotSquared {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PlotSquared.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotSquared.class.getSimpleName());
|
||||||
|
|
||||||
private static final Set<Plot> EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet());
|
private static final Set<Plot> EMPTY_SET = Collections.unmodifiableSet(Collections.emptySet());
|
||||||
private static PlotSquared instance;
|
private static PlotSquared instance;
|
||||||
// Implementation
|
// Implementation
|
||||||
@ -196,9 +196,9 @@ public class PlotSquared {
|
|||||||
try {
|
try {
|
||||||
new ReflectionUtils(this.IMP.getNMSPackage());
|
new ReflectionUtils(this.IMP.getNMSPackage());
|
||||||
try {
|
try {
|
||||||
URL url = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
URL logurl = PlotSquared.class.getProtectionDomain().getCodeSource().getLocation();
|
||||||
this.jarFile = new File(
|
this.jarFile = new File(
|
||||||
new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
new URL(logurl.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file"))
|
||||||
.toURI().getPath());
|
.toURI().getPath());
|
||||||
} catch (MalformedURLException | URISyntaxException | SecurityException e) {
|
} catch (MalformedURLException | URISyntaxException | SecurityException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -329,11 +329,11 @@ public class PlotSquared {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) {
|
if (!WorldUtil.IMP.isWorld(world) && !world.equals("*")) {
|
||||||
logger.debug("`{}` was not properly loaded - {} will now try to load it properly",
|
logger.warn("`{}` was not properly loaded - {} will now try to load it properly",
|
||||||
world, imp().getPluginName());
|
world, imp().getPluginName());
|
||||||
logger.debug(" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
logger.warn(" - Are you trying to delete this world? Remember to remove it from the worlds.yml, bukkit.yml and multiverse worlds.yml");
|
||||||
logger.debug(" - Your world management plugin may be faulty (or non existent)");
|
logger.warn(" - Your world management plugin may be faulty (or non existent)");
|
||||||
logger.debug(" This message may also be a false positive and could be ignored.");
|
logger.warn(" This message may also be a false positive and could be ignored.");
|
||||||
PlotSquared.this.IMP.setGenerator(world);
|
PlotSquared.this.IMP.setGenerator(world);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -364,7 +364,6 @@ public class PlotSquared {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("{} is now enabled!", imp().getPluginName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -511,8 +510,8 @@ public class PlotSquared {
|
|||||||
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
chunkInts.forEach(l -> chunks.add(BlockVector2.at(l[0], l[1])));
|
||||||
int height = (int) list.get(2);
|
int height = (int) list.get(2);
|
||||||
logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
|
logger.info("Incomplete road regeneration found. Restarting in world {} with height {}", plotArea.getWorldName(), height);
|
||||||
logger.debug(" Regions: {}", regions.size());
|
logger.info(" - Regions: {}", regions.size());
|
||||||
logger.debug(" Chunks: {}", chunks.size());
|
logger.info(" - Chunks: {}", chunks.size());
|
||||||
HybridUtils.UPDATE = true;
|
HybridUtils.UPDATE = true;
|
||||||
HybridUtils.manager.scheduleRoadUpdate(plotArea, regions, height, chunks);
|
HybridUtils.manager.scheduleRoadUpdate(plotArea, regions, height, chunks);
|
||||||
} catch (IOException | ClassNotFoundException e) {
|
} catch (IOException | ClassNotFoundException e) {
|
||||||
@ -1079,7 +1078,6 @@ public class PlotSquared {
|
|||||||
}
|
}
|
||||||
if (type == PlotAreaType.NORMAL) {
|
if (type == PlotAreaType.NORMAL) {
|
||||||
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||||
logger.debug("Would possibly already loaded: {}", world);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
IndependentPlotGenerator plotGenerator;
|
IndependentPlotGenerator plotGenerator;
|
||||||
@ -1132,7 +1130,6 @@ public class PlotSquared {
|
|||||||
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
|
||||||
if (areasSection == null) {
|
if (areasSection == null) {
|
||||||
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
if (plotAreaManager.getPlotAreas(world, null).length != 0) {
|
||||||
logger.debug("World possibly already loaded: {}", world);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
logger.info("Detected world load for '{}'", world);
|
logger.info("Detected world load for '{}'", world);
|
||||||
@ -1765,7 +1762,7 @@ public class PlotSquared {
|
|||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
Map<String, Object> components = Settings.getFields(Settings.Enabled_Components.class);
|
||||||
for (Entry<String, Object> component : components.entrySet()) {
|
for (Entry<String, Object> component : components.entrySet()) {
|
||||||
logger.debug("Key: {} | Value: {}", component.getKey(), component.getValue());
|
logger.info("Key: {} | Value: {}", component.getKey(), component.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
usage = "/plot claim")
|
usage = "/plot claim")
|
||||||
public class Claim extends SubCommand {
|
public class Claim extends SubCommand {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Claim.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Claim.class.getSimpleName());
|
||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
String schematic = null;
|
String schematic = null;
|
||||||
|
@ -50,7 +50,7 @@ import java.util.Map;
|
|||||||
permission = "plots.admin")
|
permission = "plots.admin")
|
||||||
public class Debug extends SubCommand {
|
public class Debug extends SubCommand {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Debug.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Debug.class.getSimpleName());
|
||||||
|
|
||||||
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
@ -84,7 +84,7 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
category = CommandCategory.DEBUG)
|
category = CommandCategory.DEBUG)
|
||||||
public class DebugExec extends SubCommand {
|
public class DebugExec extends SubCommand {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(DebugExec.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + DebugExec.class.getSimpleName());
|
||||||
|
|
||||||
private ScriptEngine engine;
|
private ScriptEngine engine;
|
||||||
private Bindings scope;
|
private Bindings scope;
|
||||||
|
@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
confirmation = true)
|
confirmation = true)
|
||||||
public class Purge extends SubCommand {
|
public class Purge extends SubCommand {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Purge.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Purge.class.getSimpleName());
|
||||||
|
|
||||||
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
@Override public boolean onCommand(final PlotPlayer<?> player, String[] args) {
|
||||||
if (args.length == 0) {
|
if (args.length == 0) {
|
||||||
@ -174,7 +174,9 @@ public class Purge extends SubCommand {
|
|||||||
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
"/plot purge " + StringMan.join(args, " ") + " (" + toDelete.size() + " plots)";
|
||||||
boolean finalClear = clear;
|
boolean finalClear = clear;
|
||||||
Runnable run = () -> {
|
Runnable run = () -> {
|
||||||
logger.debug("Calculating plots to purge, please wait...");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Calculating plots to purge, please wait...");
|
||||||
|
}
|
||||||
HashSet<Integer> ids = new HashSet<>();
|
HashSet<Integer> ids = new HashSet<>();
|
||||||
Iterator<Plot> iterator = toDelete.iterator();
|
Iterator<Plot> iterator = toDelete.iterator();
|
||||||
AtomicBoolean cleared = new AtomicBoolean(true);
|
AtomicBoolean cleared = new AtomicBoolean(true);
|
||||||
@ -187,8 +189,11 @@ public class Purge extends SubCommand {
|
|||||||
try {
|
try {
|
||||||
ids.add(plot.temp);
|
ids.add(plot.temp);
|
||||||
if (finalClear) {
|
if (finalClear) {
|
||||||
plot.clear(false, true, () ->
|
plot.clear(false, true, () -> {
|
||||||
logger.debug("Plot {} cleared by purge", plot.getId()));
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Plot {} cleared by purge", plot.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
plot.removeSign();
|
plot.removeSign();
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ import java.util.Set;
|
|||||||
category = CommandCategory.ADMINISTRATION)
|
category = CommandCategory.ADMINISTRATION)
|
||||||
public class Trim extends SubCommand {
|
public class Trim extends SubCommand {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Trim.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Trim.class.getSimpleName());
|
||||||
public static ArrayList<Plot> expired = null;
|
public static ArrayList<Plot> expired = null;
|
||||||
private static volatile boolean TASK = false;
|
private static volatile boolean TASK = false;
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
public class ComponentPresetManager {
|
public class ComponentPresetManager {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ComponentPresetManager.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + ComponentPresetManager.class.getSimpleName());
|
||||||
|
|
||||||
private final List<ComponentPreset> presets;
|
private final List<ComponentPreset> presets;
|
||||||
private final String guiName;
|
private final String guiName;
|
||||||
|
@ -47,7 +47,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
public class Config {
|
public class Config {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Config.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Config.class.getSimpleName());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the value for a node<br>
|
* Get the value for a node<br>
|
||||||
@ -71,7 +71,6 @@ public class Config {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.debug("Failed to get config option: {}", key);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -99,12 +98,12 @@ public class Config {
|
|||||||
field.set(instance, value);
|
field.set(instance, value);
|
||||||
return;
|
return;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
logger.debug("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
|
logger.error("Invalid configuration value '{}: {}' in {}", key, value, root.getSimpleName());
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.debug("Failed to set config option '{}: {}' | {}", key, value, instance);
|
logger.error("Failed to set config option '{}: {}' | {}", key, value, instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean load(File file, Class<? extends Config> root) {
|
public static boolean load(File file, Class<? extends Config> root) {
|
||||||
@ -290,7 +289,7 @@ public class Config {
|
|||||||
setAccessible(field);
|
setAccessible(field);
|
||||||
return field;
|
return field;
|
||||||
} catch (final Throwable e) {
|
} catch (final Throwable e) {
|
||||||
logger.debug("Invalid config field: {} for {}",
|
logger.error("Invalid config field: {} for {}",
|
||||||
StringMan.join(split, "."), toNodeName(instance.getClass().getSimpleName()));
|
StringMan.join(split, "."), toNodeName(instance.getClass().getSimpleName()));
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
|
@ -25,10 +25,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.configuration.file;
|
package com.plotsquared.core.configuration.file;
|
||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
|
||||||
import com.plotsquared.core.configuration.Configuration;
|
import com.plotsquared.core.configuration.Configuration;
|
||||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||||
import com.plotsquared.core.configuration.InvalidConfigurationException;
|
import com.plotsquared.core.configuration.InvalidConfigurationException;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.yaml.snakeyaml.DumperOptions;
|
import org.yaml.snakeyaml.DumperOptions;
|
||||||
@ -48,7 +48,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class YamlConfiguration extends FileConfiguration {
|
public class YamlConfiguration extends FileConfiguration {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(YamlConfiguration.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + YamlConfiguration.class.getSimpleName());
|
||||||
|
|
||||||
private static final String COMMENT_PREFIX = "# ";
|
private static final String COMMENT_PREFIX = "# ";
|
||||||
private static final String BLANK_CONFIG = "{}\n";
|
private static final String BLANK_CONFIG = "{}\n";
|
||||||
@ -81,11 +81,13 @@ public class YamlConfiguration extends FileConfiguration {
|
|||||||
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
|
||||||
}
|
}
|
||||||
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
Files.copy(file.toPath(), dest.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||||
logger.debug("Could not read: {}", file);
|
if (Settings.DEBUG) {
|
||||||
logger.debug("Renamed to: {}", file);
|
logger.error("Could not read: {}", file);
|
||||||
logger.debug("============ Full stacktrace ============");
|
logger.error("Renamed to: {}", file);
|
||||||
ex.printStackTrace();
|
logger.error("============ Full stacktrace ============");
|
||||||
logger.debug("=========================================");
|
ex.printStackTrace();
|
||||||
|
logger.error("=========================================");
|
||||||
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
@SuppressWarnings("SqlDialectInspection")
|
@SuppressWarnings("SqlDialectInspection")
|
||||||
public class SQLManager implements AbstractDB {
|
public class SQLManager implements AbstractDB {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SQLManager.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + SQLManager.class.getSimpleName());
|
||||||
|
|
||||||
// Public final
|
// Public final
|
||||||
public final String SET_OWNER;
|
public final String SET_OWNER;
|
||||||
@ -358,12 +358,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
task.run();
|
task.run();
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("============ DATABASE ERROR ============");
|
logger.error("============ DATABASE ERROR ============");
|
||||||
logger.debug("============ DATABASE ERROR ============");
|
logger.error("============ DATABASE ERROR ============");
|
||||||
logger.debug("There was an error updating the database.");
|
logger.error("There was an error updating the database.");
|
||||||
logger.debug(" - It will be corrected on shutdown");
|
logger.error(" - It will be corrected on shutdown");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
commit();
|
commit();
|
||||||
@ -413,12 +413,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("============ DATABASE ERROR ============");
|
logger.error("============ DATABASE ERROR ============");
|
||||||
logger.debug("There was an error updating the database.");
|
logger.error("There was an error updating the database.");
|
||||||
logger.debug(" - It will be corrected on shutdown");
|
logger.error(" - It will be corrected on shutdown");
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -458,12 +458,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("============ DATABASE ERROR ============");
|
logger.error("============ DATABASE ERROR ============");
|
||||||
logger.debug("There was an error updating the database.");
|
logger.error("There was an error updating the database.");
|
||||||
logger.debug(" - It will be corrected on shutdown");
|
logger.error(" - It will be corrected on shutdown");
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -504,12 +504,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
lastTask = task;
|
lastTask = task;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("============ DATABASE ERROR ============");
|
logger.error("============ DATABASE ERROR ============");
|
||||||
logger.debug("There was an error updating the database.");
|
logger.error("There was an error updating the database.");
|
||||||
logger.debug(" - It will be corrected on shutdown");
|
logger.error(" - It will be corrected on shutdown");
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (statement != null && task != null) {
|
if (statement != null && task != null) {
|
||||||
@ -533,12 +533,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
this.plotTasks.clear();
|
this.plotTasks.clear();
|
||||||
}
|
}
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.debug("============ DATABASE ERROR ============");
|
logger.error("============ DATABASE ERROR ============");
|
||||||
logger.debug("There was an error updating the database.");
|
logger.error("There was an error updating the database.");
|
||||||
logger.debug(" - It will be corrected on shutdown");
|
logger.error(" - It will be corrected on shutdown");
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug("========================================");
|
logger.error("========================================");
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -626,7 +626,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
})))));
|
})))));
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to set all flags and member tiers for plots", e);
|
logger.warn("Failed to set all flags and member tiers for plots", e);
|
||||||
try {
|
try {
|
||||||
SQLManager.this.connection.commit();
|
SQLManager.this.connection.commit();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -635,7 +635,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.debug("Warning! Failed to set all helper for plots", e);
|
logger.warn("Warning! Failed to set all helper for plots", e);
|
||||||
try {
|
try {
|
||||||
SQLManager.this.connection.commit();
|
SQLManager.this.connection.commit();
|
||||||
} catch (SQLException e1) {
|
} catch (SQLException e1) {
|
||||||
@ -704,10 +704,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
try {
|
try {
|
||||||
preparedStatement.executeBatch();
|
preparedStatement.executeBatch();
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to store flag values for plot with entry ID: {}", e);
|
logger.error("Failed to store flag values for plot with entry ID: {}", plot);
|
||||||
|
e.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
logger.debug("- Finished converting flag values for plot with entry ID: {}", plot.getId());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- Finished converting flag values for plot with entry ID: {}",
|
||||||
|
plot.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to store flag values", e);
|
logger.error("Failed to store flag values", e);
|
||||||
@ -820,7 +824,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
last = subList.size();
|
last = subList.size();
|
||||||
preparedStmt.addBatch();
|
preparedStmt.addBatch();
|
||||||
}
|
}
|
||||||
logger.debug("Batch 1: {} | {}", count, objList.get(0).getClass().getCanonicalName());
|
|
||||||
preparedStmt.executeBatch();
|
preparedStmt.executeBatch();
|
||||||
preparedStmt.clearParameters();
|
preparedStmt.clearParameters();
|
||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
@ -863,7 +866,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
last = subList.size();
|
last = subList.size();
|
||||||
preparedStmt.addBatch();
|
preparedStmt.addBatch();
|
||||||
}
|
}
|
||||||
logger.debug("Batch 2: {} | {}", count, objList.get(0).getClass().getCanonicalName());
|
|
||||||
preparedStmt.executeBatch();
|
preparedStmt.executeBatch();
|
||||||
preparedStmt.clearParameters();
|
preparedStmt.clearParameters();
|
||||||
preparedStmt.close();
|
preparedStmt.close();
|
||||||
@ -877,7 +879,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
mod.setSQL(preparedStmt, obj);
|
mod.setSQL(preparedStmt, obj);
|
||||||
preparedStmt.addBatch();
|
preparedStmt.addBatch();
|
||||||
}
|
}
|
||||||
logger.debug("Batch 3");
|
|
||||||
preparedStmt.executeBatch();
|
preparedStmt.executeBatch();
|
||||||
} catch (SQLException e3) {
|
} catch (SQLException e3) {
|
||||||
logger.error("Failed to save all", e);
|
logger.error("Failed to save all", e);
|
||||||
@ -1129,7 +1130,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
boolean addConstraint = create == tables.length;
|
boolean addConstraint = create == tables.length;
|
||||||
logger.debug("Creating tables");
|
|
||||||
try (Statement stmt = this.connection.createStatement()) {
|
try (Statement stmt = this.connection.createStatement()) {
|
||||||
if (this.mySQL) {
|
if (this.mySQL) {
|
||||||
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` ("
|
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` ("
|
||||||
@ -1369,8 +1369,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@Override public void delete(final Plot plot) {
|
@Override public void delete(final Plot plot) {
|
||||||
logger.debug("Deleting plot. ID: {} | World: {} | Owner: {} | Index: {}",
|
|
||||||
plot.getId(), plot.getWorldName(), plot.getOwnerAbs(), plot.temp);
|
|
||||||
deleteSettings(plot);
|
deleteSettings(plot);
|
||||||
deleteDenied(plot);
|
deleteDenied(plot);
|
||||||
deleteHelpers(plot);
|
deleteHelpers(plot);
|
||||||
@ -1396,8 +1394,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
* @param plot
|
* @param plot
|
||||||
*/
|
*/
|
||||||
@Override public void createPlotSettings(final int id, Plot plot) {
|
@Override public void createPlotSettings(final int id, Plot plot) {
|
||||||
logger.debug("Creating plot plot. ID: {} | World: {} | Owner: {} | Index: {}",
|
|
||||||
plot.getId(), plot.getWorldName(), plot.getOwnerAbs(), plot.temp);
|
|
||||||
addPlotTask(plot, new UniqueStatement("createPlotSettings") {
|
addPlotTask(plot, new UniqueStatement("createPlotSettings") {
|
||||||
@Override public void set(PreparedStatement statement) throws SQLException {
|
@Override public void set(PreparedStatement statement) throws SQLException {
|
||||||
statement.setInt(1, id);
|
statement.setInt(1, id);
|
||||||
@ -1555,7 +1551,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
"SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table
|
"SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table
|
||||||
+ " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
|
+ " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
|
||||||
if (result.next()) {
|
if (result.next()) {
|
||||||
logger.debug("Backing up {}", this.prefix + table);
|
|
||||||
result.close();
|
result.close();
|
||||||
statement.executeUpdate(
|
statement.executeUpdate(
|
||||||
"CREATE TABLE " + this.prefix + table + "_tmp AS SELECT * FROM "
|
"CREATE TABLE " + this.prefix + table + "_tmp AS SELECT * FROM "
|
||||||
@ -1565,7 +1560,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
"CREATE TABLE " + this.prefix + table + " AS SELECT * FROM "
|
"CREATE TABLE " + this.prefix + table + " AS SELECT * FROM "
|
||||||
+ this.prefix + table + "_tmp");
|
+ this.prefix + table + "_tmp");
|
||||||
statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
|
statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
|
||||||
logger.debug("Restoring {}", this.prefix + table);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SQLException e2) {
|
} catch (SQLException e2) {
|
||||||
@ -1682,7 +1676,10 @@ public class SQLManager implements AbstractDB {
|
|||||||
String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100));
|
String.format("%.1f", ((float) flagsProcessed / totalFlags) * 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("- Finished converting flags for plot with entry ID: {}", plotFlagEntry.getKey());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- Finished converting flags for plot with entry ID: {}",
|
||||||
|
plotFlagEntry.getKey());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.error("Failed to store flag values", e);
|
logger.error("Failed to store flag values", e);
|
||||||
@ -1791,8 +1788,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (last != null) {
|
if (last != null) {
|
||||||
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(last.temp);
|
toDelete.add(last.temp);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Plot #{}({}) in `{}plot` is a duplicate."
|
logger.info("Plot #{}({}) in `{}plot` is a duplicate."
|
||||||
+ " Delete this plot or set `database-purger: true` in the settings.yml", id, last, this.prefix);
|
+ " Delete this plot or set `database-purger: true` in the settings.yml", id, last, this.prefix);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1823,8 +1820,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
plot.getSettings().getRatings().put(user, r.getInt("rating"));
|
plot.getSettings().getRatings().put(user, r.getInt("rating"));
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Entry #{}({}) in `plot_rating` does not exist."
|
logger.info("Entry #{}({}) in `plot_rating` does not exist."
|
||||||
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1851,8 +1848,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
plot.getTrusted().add(user);
|
plot.getTrusted().add(user);
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Entry #{}({}) in `plot_helpers` does not exist."
|
logger.info("Entry #{}({}) in `plot_helpers` does not exist."
|
||||||
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1878,8 +1875,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
plot.getMembers().add(user);
|
plot.getMembers().add(user);
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Entry #{}({}) in `plot_trusted` does not exist."
|
logger.info("Entry #{}({}) in `plot_trusted` does not exist."
|
||||||
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1905,8 +1902,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
plot.getDenied().add(user);
|
plot.getDenied().add(user);
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Entry #{}({}) in `plot_denied` does not exist."
|
logger.info("Entry #{}({}) in `plot_denied` does not exist."
|
||||||
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1928,15 +1925,14 @@ public class SQLManager implements AbstractDB {
|
|||||||
final PlotFlag<?, ?> plotFlag =
|
final PlotFlag<?, ?> plotFlag =
|
||||||
GlobalFlagContainer.getInstance().getFlagFromString(flag);
|
GlobalFlagContainer.getInstance().getFlagFromString(flag);
|
||||||
if (plotFlag == null) {
|
if (plotFlag == null) {
|
||||||
logger.debug("Adding unknown flag {} to plot with ID {}", flag, id);
|
|
||||||
plot.getFlagContainer().addUnknownFlag(flag, value);
|
plot.getFlagContainer().addUnknownFlag(flag, value);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
plot.getFlagContainer().addFlag(plotFlag.parse(value));
|
plot.getFlagContainer().addFlag(plotFlag.parse(value));
|
||||||
} catch (final FlagParseException e) {
|
} catch (final FlagParseException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
logger.debug("Plot with ID {} has an invalid value:", id);
|
logger.error("Plot with ID {} has an invalid value:", id);
|
||||||
logger.debug("Failed to parse flag '{}', value '{}': {}",
|
logger.error("Failed to parse flag '{}', value '{}': {}",
|
||||||
plotFlag.getName(), e.getValue(), e.getErrorMessage());
|
plotFlag.getName(), e.getValue(), e.getErrorMessage());
|
||||||
if (!invalidFlags.containsKey(plot)) {
|
if (!invalidFlags.containsKey(plot)) {
|
||||||
invalidFlags.put(plot, new ArrayList<>());
|
invalidFlags.put(plot, new ArrayList<>());
|
||||||
@ -1946,8 +1942,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Entry #{}({}) in `plot_flags` does not exist."
|
logger.info("Entry #{}({}) in `plot_flags` does not exist."
|
||||||
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1957,8 +1953,11 @@ public class SQLManager implements AbstractDB {
|
|||||||
for (final Map.Entry<Plot, Collection<PlotFlag<?, ?>>> plotFlagEntry : invalidFlags
|
for (final Map.Entry<Plot, Collection<PlotFlag<?, ?>>> plotFlagEntry : invalidFlags
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
for (final PlotFlag<?, ?> flag : plotFlagEntry.getValue()) {
|
for (final PlotFlag<?, ?> flag : plotFlagEntry.getValue()) {
|
||||||
logger.debug("Plot {} has an invalid flag ({}). A fix has been attempted",
|
if (Settings.DEBUG) {
|
||||||
plotFlagEntry.getKey(), flag.getName());
|
logger.info(
|
||||||
|
"Plot {} has an invalid flag ({}). A fix has been attempted",
|
||||||
|
plotFlagEntry.getKey(), flag.getName());
|
||||||
|
}
|
||||||
removeFlag(plotFlagEntry.getKey(), flag);
|
removeFlag(plotFlagEntry.getKey(), flag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1999,8 +1998,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
plot.getSettings().setMerged(merged);
|
plot.getSettings().setMerged(merged);
|
||||||
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
} else if (Settings.Enabled_Components.DATABASE_PURGER) {
|
||||||
toDelete.add(id);
|
toDelete.add(id);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Entry #{}({}) in `plot_settings` does not exist."
|
logger.info("Entry #{}({}) in `plot_settings` does not exist."
|
||||||
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
+ " Create this plot or set `database-purger: true` in settings.yml", id, plot);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2017,11 +2016,13 @@ public class SQLManager implements AbstractDB {
|
|||||||
for (Entry<String, AtomicInteger> entry : noExist.entrySet()) {
|
for (Entry<String, AtomicInteger> entry : noExist.entrySet()) {
|
||||||
String worldName = entry.getKey();
|
String worldName = entry.getKey();
|
||||||
invalidPlot = true;
|
invalidPlot = true;
|
||||||
logger.debug("Warning! Found {} plots in DB for non existent world: '{}'",
|
if (Settings.DEBUG) {
|
||||||
entry.getValue().intValue(), worldName);
|
logger.info("Warning! Found {} plots in DB for non existent world: '{}'",
|
||||||
|
entry.getValue().intValue(), worldName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (invalidPlot) {
|
if (invalidPlot && Settings.DEBUG) {
|
||||||
logger.debug("Warning! Please create the world(s) or remove the plots using the purge command");
|
logger.info("Warning! Please create the world(s) or remove the plots using the purge command");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to load plots", e);
|
logger.error("Failed to load plots", e);
|
||||||
@ -2163,8 +2164,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
int count = 0;
|
int count = 0;
|
||||||
int last = -1;
|
int last = -1;
|
||||||
for (int j = 0; j <= amount; j++) {
|
for (int j = 0; j <= amount; j++) {
|
||||||
int purging = Math.max(j * packet, size);
|
|
||||||
logger.debug("Purging {}/{}", purging, size);
|
|
||||||
List<Integer> subList =
|
List<Integer> subList =
|
||||||
uniqueIdsList.subList(j * packet, Math.min(size, (j + 1) * packet));
|
uniqueIdsList.subList(j * packet, Math.min(size, (j + 1) * packet));
|
||||||
if (subList.isEmpty()) {
|
if (subList.isEmpty()) {
|
||||||
@ -2214,7 +2213,9 @@ public class SQLManager implements AbstractDB {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.debug("Successfully purged {} plots", uniqueIds.size());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Successfully purged {} plots", uniqueIds.size());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2714,8 +2715,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
cluster = clusters.get(id);
|
cluster = clusters.get(id);
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.helpers.add(user);
|
cluster.helpers.add(user);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Cluster #{}({}) in cluster_helpers does not exist."
|
logger.warn("Cluster #{}({}) in cluster_helpers does not exist."
|
||||||
+ " Please create the cluster or remove this entry", id, cluster);
|
+ " Please create the cluster or remove this entry", id, cluster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2733,8 +2734,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
cluster = clusters.get(id);
|
cluster = clusters.get(id);
|
||||||
if (cluster != null) {
|
if (cluster != null) {
|
||||||
cluster.invited.add(user);
|
cluster.invited.add(user);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Cluster #{}({}) in cluster_helpers does not exist."
|
logger.warn("Cluster #{}({}) in cluster_helpers does not exist."
|
||||||
+ " Please create the cluster or remove this entry", id, cluster);
|
+ " Please create the cluster or remove this entry", id, cluster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2768,8 +2769,8 @@ public class SQLManager implements AbstractDB {
|
|||||||
merged[3 - i] = (m & 1 << i) != 0;
|
merged[3 - i] = (m & 1 << i) != 0;
|
||||||
}
|
}
|
||||||
cluster.settings.setMerged(merged);
|
cluster.settings.setMerged(merged);
|
||||||
} else {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("Cluster #{}({}) in cluster_helpers does not exist."
|
logger.warn("Cluster #{}({}) in cluster_helpers does not exist."
|
||||||
+ " Please create the cluster or remove this entry", id, cluster);
|
+ " Please create the cluster or remove this entry", id, cluster);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2779,10 +2780,10 @@ public class SQLManager implements AbstractDB {
|
|||||||
for (Entry<String, Integer> entry : noExist.entrySet()) {
|
for (Entry<String, Integer> entry : noExist.entrySet()) {
|
||||||
String a = entry.getKey();
|
String a = entry.getKey();
|
||||||
invalidPlot = true;
|
invalidPlot = true;
|
||||||
logger.debug("Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a);
|
logger.warn("Warning! Found {} clusters in DB for non existent area; '{}'", noExist.get(a), a);
|
||||||
}
|
}
|
||||||
if (invalidPlot) {
|
if (invalidPlot) {
|
||||||
logger.debug("Warning! Please create the world(s) or remove the clusters using the purge command");
|
logger.warn("Warning! Please create the world(s) or remove the clusters using the purge command");
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.error("Failed to load clusters", e);
|
logger.error("Failed to load clusters", e);
|
||||||
@ -2977,7 +2978,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
if (!isValid()) {
|
if (!isValid()) {
|
||||||
reconnect();
|
reconnect();
|
||||||
}
|
}
|
||||||
logger.debug("All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
|
logger.info("All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
|
||||||
commit();
|
commit();
|
||||||
while (true) {
|
while (true) {
|
||||||
if (!sendBatch()) {
|
if (!sendBatch()) {
|
||||||
@ -3009,19 +3010,16 @@ public class SQLManager implements AbstractDB {
|
|||||||
}
|
}
|
||||||
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
HashMap<PlotId, Plot> worldPlots = database.get(plot.getArea().toString());
|
||||||
if (worldPlots == null) {
|
if (worldPlots == null) {
|
||||||
logger.debug(" - Creating plot (1): {}", plot);
|
|
||||||
toCreate.add(plot);
|
toCreate.add(plot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
Plot dataPlot = worldPlots.remove(plot.getId());
|
Plot dataPlot = worldPlots.remove(plot.getId());
|
||||||
if (dataPlot == null) {
|
if (dataPlot == null) {
|
||||||
logger.debug(" - Creating plot (2): {}", plot);
|
|
||||||
toCreate.add(plot);
|
toCreate.add(plot);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// owner
|
// owner
|
||||||
if (!plot.getOwnerAbs().equals(dataPlot.getOwnerAbs())) {
|
if (!plot.getOwnerAbs().equals(dataPlot.getOwnerAbs())) {
|
||||||
logger.debug(" - Setting owner: {} -> {}", plot, MainUtil.getName(plot.getOwnerAbs()));
|
|
||||||
setOwner(plot, plot.getOwnerAbs());
|
setOwner(plot, plot.getOwnerAbs());
|
||||||
}
|
}
|
||||||
// trusted
|
// trusted
|
||||||
@ -3030,7 +3028,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getTrusted().clone();
|
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getTrusted().clone();
|
||||||
toRemove.removeAll(plot.getTrusted());
|
toRemove.removeAll(plot.getTrusted());
|
||||||
toAdd.removeAll(dataPlot.getTrusted());
|
toAdd.removeAll(dataPlot.getTrusted());
|
||||||
logger.debug(" - Correcting {} trusted for: {}", toAdd.size() + toRemove.size(), plot);
|
|
||||||
if (!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
for (UUID uuid : toRemove) {
|
for (UUID uuid : toRemove) {
|
||||||
removeTrusted(plot, uuid);
|
removeTrusted(plot, uuid);
|
||||||
@ -3047,7 +3044,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getMembers().clone();
|
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getMembers().clone();
|
||||||
toRemove.removeAll(plot.getMembers());
|
toRemove.removeAll(plot.getMembers());
|
||||||
toAdd.removeAll(dataPlot.getMembers());
|
toAdd.removeAll(dataPlot.getMembers());
|
||||||
logger.debug(" - Correcting {} members for: {}", toAdd.size() + toRemove.size());
|
|
||||||
if (!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
for (UUID uuid : toRemove) {
|
for (UUID uuid : toRemove) {
|
||||||
removeMember(plot, uuid);
|
removeMember(plot, uuid);
|
||||||
@ -3064,7 +3060,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getDenied().clone();
|
HashSet<UUID> toRemove = (HashSet<UUID>) dataPlot.getDenied().clone();
|
||||||
toRemove.removeAll(plot.getDenied());
|
toRemove.removeAll(plot.getDenied());
|
||||||
toAdd.removeAll(dataPlot.getDenied());
|
toAdd.removeAll(dataPlot.getDenied());
|
||||||
logger.debug(" - Correcting {} denied for: {}", toAdd.size() + toRemove.size());
|
|
||||||
if (!toRemove.isEmpty()) {
|
if (!toRemove.isEmpty()) {
|
||||||
for (UUID uuid : toRemove) {
|
for (UUID uuid : toRemove) {
|
||||||
removeDenied(plot, uuid);
|
removeDenied(plot, uuid);
|
||||||
@ -3079,7 +3074,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
boolean[] pm = plot.getMerged();
|
boolean[] pm = plot.getMerged();
|
||||||
boolean[] dm = dataPlot.getMerged();
|
boolean[] dm = dataPlot.getMerged();
|
||||||
if (pm[0] != dm[0] || pm[1] != dm[1]) {
|
if (pm[0] != dm[0] || pm[1] != dm[1]) {
|
||||||
logger.debug(" - Correcting merge for: {}", plot);
|
|
||||||
setMerged(dataPlot, plot.getMerged());
|
setMerged(dataPlot, plot.getMerged());
|
||||||
}
|
}
|
||||||
Set<PlotFlag<?, ?>> pf = plot.getFlags();
|
Set<PlotFlag<?, ?>> pf = plot.getFlags();
|
||||||
|
@ -42,7 +42,7 @@ import java.sql.Statement;
|
|||||||
*/
|
*/
|
||||||
public class SQLite extends Database {
|
public class SQLite extends Database {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SQLite.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + SQLite.class.getSimpleName());
|
||||||
|
|
||||||
private final String dbLocation;
|
private final String dbLocation;
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
@ -60,7 +60,7 @@ import java.util.Locale;
|
|||||||
|
|
||||||
public class HybridPlotWorld extends ClassicPlotWorld {
|
public class HybridPlotWorld extends ClassicPlotWorld {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(HybridPlotWorld.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + HybridPlotWorld.class.getSimpleName());
|
||||||
private static final AffineTransform transform = new AffineTransform().rotateY(90);
|
private static final AffineTransform transform = new AffineTransform().rotateY(90);
|
||||||
public boolean ROAD_SCHEMATIC_ENABLED;
|
public boolean ROAD_SCHEMATIC_ENABLED;
|
||||||
public boolean PLOT_SCHEMATIC = false;
|
public boolean PLOT_SCHEMATIC = false;
|
||||||
@ -160,12 +160,11 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
setupSchematics();
|
setupSchematics();
|
||||||
} catch (Exception event) {
|
} catch (Exception event) {
|
||||||
event.printStackTrace();
|
event.printStackTrace();
|
||||||
logger.debug("- road schematics are disabled for this world");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dump world settings
|
// Dump world settings
|
||||||
if (Settings.DEBUG) {
|
if (Settings.DEBUG) {
|
||||||
logger.debug("- Dumping settings for ClassicPlotWorld with name {}", this.getWorldName());
|
logger.info("- Dumping settings for ClassicPlotWorld with name {}", this.getWorldName());
|
||||||
final Field[] fields = this.getClass().getFields();
|
final Field[] fields = this.getClass().getFields();
|
||||||
for (final Field field : fields) {
|
for (final Field field : fields) {
|
||||||
final String name = field.getName().toLowerCase(Locale.ENGLISH);
|
final String name = field.getName().toLowerCase(Locale.ENGLISH);
|
||||||
@ -181,7 +180,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
} catch (final IllegalAccessException e) {
|
} catch (final IllegalAccessException e) {
|
||||||
value = String.format("Failed to parse: %s", e.getMessage());
|
value = String.format("Failed to parse: %s", e.getMessage());
|
||||||
}
|
}
|
||||||
logger.debug("-- {} = {}", name, value);
|
logger.info("-- {} = {}", name, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -282,10 +281,14 @@ public class HybridPlotWorld extends ClassicPlotWorld {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(" - plot schematic: {}", schematic3File.getPath());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - plot schematic: {}", schematic3File.getPath());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
if (schematic1 == null || schematic2 == null || this.ROAD_WIDTH == 0) {
|
||||||
logger.debug(" - schematic: false");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - schematic: false");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.ROAD_SCHEMATIC_ENABLED = true;
|
this.ROAD_SCHEMATIC_ENABLED = true;
|
||||||
|
@ -78,7 +78,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public abstract class HybridUtils {
|
public abstract class HybridUtils {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(HybridUtils.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + HybridUtils.class.getSimpleName());
|
||||||
|
|
||||||
public static HybridUtils manager;
|
public static HybridUtils manager;
|
||||||
public static Set<BlockVector2> regions;
|
public static Set<BlockVector2> regions;
|
||||||
@ -412,12 +412,14 @@ public abstract class HybridUtils {
|
|||||||
BlockVector2 chunk = iter.next();
|
BlockVector2 chunk = iter.next();
|
||||||
iter.remove();
|
iter.remove();
|
||||||
boolean regenedRoad = regenerateRoad(area, chunk, extend);
|
boolean regenedRoad = regenerateRoad(area, chunk, extend);
|
||||||
if (!regenedRoad) {
|
if (!regenedRoad && Settings.DEBUG) {
|
||||||
logger.debug("Failed to regenerate roads");
|
logger.info("Failed to regenerate roads");
|
||||||
}
|
}
|
||||||
ChunkManager.manager.unloadChunk(area.getWorldName(), chunk, true);
|
ChunkManager.manager.unloadChunk(area.getWorldName(), chunk, true);
|
||||||
}
|
}
|
||||||
logger.debug("Cancelled road task");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Cancelled road task");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
count.incrementAndGet();
|
count.incrementAndGet();
|
||||||
@ -425,7 +427,6 @@ public abstract class HybridUtils {
|
|||||||
logger.info("Progress: {}%", 100 * (2048 - chunks.size()) / 2048);
|
logger.info("Progress: {}%", 100 * (2048 - chunks.size()) / 2048);
|
||||||
}
|
}
|
||||||
if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) {
|
if (HybridUtils.regions.isEmpty() && chunks.isEmpty()) {
|
||||||
logger.debug("Regenerating plot walls");
|
|
||||||
regeneratePlotWalls(area);
|
regeneratePlotWalls(area);
|
||||||
|
|
||||||
HybridUtils.UPDATE = false;
|
HybridUtils.UPDATE = false;
|
||||||
@ -441,8 +442,11 @@ public abstract class HybridUtils {
|
|||||||
HybridUtils.regions.iterator();
|
HybridUtils.regions.iterator();
|
||||||
BlockVector2 loc = iterator.next();
|
BlockVector2 loc = iterator.next();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
logger.debug("Updating .mcr: {}, {} (approx 1024 chunks)", loc.getX(), loc.getZ());
|
if (Settings.DEBUG) {
|
||||||
logger.debug("- Remaining: {}", HybridUtils.regions.size());
|
logger.info("Updating .mcr: {}, {} (approx 1024 chunks)",
|
||||||
|
loc.getX(), loc.getZ());
|
||||||
|
logger.info("- Remaining: {}", HybridUtils.regions.size());
|
||||||
|
}
|
||||||
chunks.addAll(getChunks(loc));
|
chunks.addAll(getChunks(loc));
|
||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
@ -458,8 +462,8 @@ public abstract class HybridUtils {
|
|||||||
iterator.remove();
|
iterator.remove();
|
||||||
boolean regenedRoads =
|
boolean regenedRoads =
|
||||||
regenerateRoad(area, chunk, extend);
|
regenerateRoad(area, chunk, extend);
|
||||||
if (!regenedRoads) {
|
if (!regenedRoads && Settings.DEBUG) {
|
||||||
logger.debug("Failed to regenerate road");
|
logger.info("Failed to regenerate road");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -470,7 +474,7 @@ public abstract class HybridUtils {
|
|||||||
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
Iterator<BlockVector2> iterator = HybridUtils.regions.iterator();
|
||||||
BlockVector2 loc = iterator.next();
|
BlockVector2 loc = iterator.next();
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
logger.debug("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)",
|
logger.error("Error! Could not update '{}/region/r.{}.{}.mca' (Corrupt chunk?)",
|
||||||
area.getWorldHash(), loc.getX(), loc.getZ());
|
area.getWorldHash(), loc.getX(), loc.getZ());
|
||||||
int sx = loc.getX() << 5;
|
int sx = loc.getX() << 5;
|
||||||
int sz = loc.getZ() << 5;
|
int sz = loc.getZ() << 5;
|
||||||
@ -481,7 +485,6 @@ public abstract class HybridUtils {
|
|||||||
true);
|
true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.debug("- Potentially skipping 1024 chunks");
|
|
||||||
}
|
}
|
||||||
GlobalBlockQueue.IMP.addEmptyTask(() -> TaskManager.runTaskLater(task, 20));
|
GlobalBlockQueue.IMP.addEmptyTask(() -> TaskManager.runTaskLater(task, 20));
|
||||||
});
|
});
|
||||||
|
@ -44,7 +44,7 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
public abstract class SquarePlotManager extends GridPlotManager {
|
public abstract class SquarePlotManager extends GridPlotManager {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SquarePlotManager.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquarePlotManager.class.getSimpleName());
|
||||||
|
|
||||||
private final SquarePlotWorld squarePlotWorld;
|
private final SquarePlotWorld squarePlotWorld;
|
||||||
|
|
||||||
@ -229,7 +229,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
|
|||||||
return plot.getMerged(Direction.NORTHWEST) ? id : null;
|
return plot.getMerged(Direction.NORTHWEST) ? id : null;
|
||||||
}
|
}
|
||||||
} catch (Exception ignored) {
|
} catch (Exception ignored) {
|
||||||
logger.debug( "Invalid plot / road width in settings.yml for world: {}", squarePlotWorld
|
logger.error( "Invalid plot / road width in settings.yml for world: {}", squarePlotWorld
|
||||||
.getWorldName());
|
.getWorldName());
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
package com.plotsquared.core.generator;
|
package com.plotsquared.core.generator;
|
||||||
|
|
||||||
import com.plotsquared.core.configuration.ConfigurationSection;
|
import com.plotsquared.core.configuration.ConfigurationSection;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.plotsquared.core.plot.PlotId;
|
import com.plotsquared.core.plot.PlotId;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -33,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
public abstract class SquarePlotWorld extends GridPlotWorld {
|
public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SquarePlotWorld.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquarePlotWorld.class.getSimpleName());
|
||||||
|
|
||||||
public int PLOT_WIDTH = 42;
|
public int PLOT_WIDTH = 42;
|
||||||
public int ROAD_WIDTH = 7;
|
public int ROAD_WIDTH = 7;
|
||||||
@ -47,7 +48,10 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
|||||||
|
|
||||||
@Override public void loadConfiguration(ConfigurationSection config) {
|
@Override public void loadConfiguration(ConfigurationSection config) {
|
||||||
if (!config.contains("plot.height")) {
|
if (!config.contains("plot.height")) {
|
||||||
logger.debug(" - Configuration is null? ({})", config.getCurrentPath());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - Configuration is null? ({})", config.getCurrentPath());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
this.PLOT_WIDTH = config.getInt("plot.size");
|
this.PLOT_WIDTH = config.getInt("plot.size");
|
||||||
this.ROAD_WIDTH = config.getInt("road.width");
|
this.ROAD_WIDTH = config.getInt("road.width");
|
||||||
|
@ -52,7 +52,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public class ProcessedWEExtent extends AbstractDelegateExtent {
|
public class ProcessedWEExtent extends AbstractDelegateExtent {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ProcessedWEExtent.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + ProcessedWEExtent.class.getSimpleName());
|
||||||
|
|
||||||
private final Set<CuboidRegion> mask;
|
private final Set<CuboidRegion> mask;
|
||||||
private final String world;
|
private final String world;
|
||||||
@ -103,7 +103,6 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
tileEntityCount[0]++;
|
tileEntityCount[0]++;
|
||||||
logger.debug("Detected unsafe WorldEdit: {},{},{}", location.getX(), location.getY(), location.getZ());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
|
if (WEManager.maskContains(this.mask, location.getX(), location.getY(), location.getZ())) {
|
||||||
@ -134,7 +133,6 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
|
|||||||
this.Ecount++;
|
this.Ecount++;
|
||||||
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
if (this.Ecount > Settings.Chunk_Processor.MAX_ENTITIES) {
|
||||||
this.Eblocked = true;
|
this.Eblocked = true;
|
||||||
logger.debug("Detected unsafe WorldEdit: {},{},{}", location.getX(), location.getY(), location.getZ());
|
|
||||||
}
|
}
|
||||||
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
if (WEManager.maskContains(this.mask, location.getBlockX(), location.getBlockY(),
|
||||||
location.getBlockZ())) {
|
location.getBlockZ())) {
|
||||||
|
@ -45,7 +45,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
public class ConsolePlayer extends PlotPlayer<Actor> {
|
public class ConsolePlayer extends PlotPlayer<Actor> {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ConsolePlayer.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + ConsolePlayer.class.getSimpleName());
|
||||||
private static ConsolePlayer instance;
|
private static ConsolePlayer instance;
|
||||||
|
|
||||||
private ConsolePlayer() {
|
private ConsolePlayer() {
|
||||||
|
@ -75,7 +75,7 @@ import java.util.stream.Collectors;
|
|||||||
*/
|
*/
|
||||||
public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer {
|
public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PlotPlayer.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotPlayer.class.getSimpleName());
|
||||||
|
|
||||||
public static final String META_LAST_PLOT = "lastplot";
|
public static final String META_LAST_PLOT = "lastplot";
|
||||||
public static final String META_LOCATION = "location";
|
public static final String META_LOCATION = "location";
|
||||||
@ -584,8 +584,9 @@ public abstract class PlotPlayer<P> implements CommandCaller, OfflinePlotPlayer
|
|||||||
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
|
if (Settings.Enabled_Components.BAN_DELETER && isBanned()) {
|
||||||
for (Plot owned : getPlots()) {
|
for (Plot owned : getPlots()) {
|
||||||
owned.deletePlot(null);
|
owned.deletePlot(null);
|
||||||
logger.debug("Plot {} was deleted + cleared due to {} getting banned",
|
if (Settings.DEBUG) {
|
||||||
owned.getId(), getName());
|
logger.info("Plot {} was deleted + cleared due to {} getting banned", owned.getId(), getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ExpireManager.IMP != null) {
|
if (ExpireManager.IMP != null) {
|
||||||
|
@ -119,7 +119,7 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
|
|||||||
*/
|
*/
|
||||||
public class Plot {
|
public class Plot {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Plot.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Plot.class.getSimpleName());
|
||||||
|
|
||||||
public static final int MAX_HEIGHT = 256;
|
public static final int MAX_HEIGHT = 256;
|
||||||
|
|
||||||
@ -1735,8 +1735,6 @@ public class Plot {
|
|||||||
|
|
||||||
public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic) {
|
public boolean claim(@NotNull final PlotPlayer player, boolean teleport, String schematic) {
|
||||||
if (!canClaim(player)) {
|
if (!canClaim(player)) {
|
||||||
logger.debug("Player {} attempted to claim plot {}, but was not allowed",
|
|
||||||
player.getName(), this.getId().toCommaSeparatedString());
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return claim(player, teleport, schematic, true);
|
return claim(player, teleport, schematic, true);
|
||||||
@ -1747,7 +1745,7 @@ public class Plot {
|
|||||||
|
|
||||||
if (updateDB) {
|
if (updateDB) {
|
||||||
if (!create(player.getUUID(), true)) {
|
if (!create(player.getUUID(), true)) {
|
||||||
logger.debug("Player {} attempted to claim plot {}, but the database failed to update",
|
logger.error("Player {} attempted to claim plot {}, but the database failed to update",
|
||||||
player.getName(), this.getId().toCommaSeparatedString());
|
player.getName(), this.getId().toCommaSeparatedString());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1934,12 +1932,10 @@ public class Plot {
|
|||||||
*/
|
*/
|
||||||
public boolean moveData(Plot plot, Runnable whenDone) {
|
public boolean moveData(Plot plot, Runnable whenDone) {
|
||||||
if (!this.hasOwner()) {
|
if (!this.hasOwner()) {
|
||||||
logger.debug("{} is unowned (single)", plot);
|
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (plot.hasOwner()) {
|
if (plot.hasOwner()) {
|
||||||
logger.debug("{} is unowned (multi)", plot);
|
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2647,7 +2643,6 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
|
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.NORTH));
|
||||||
if (!tmp.getMerged(Direction.SOUTH)) {
|
if (!tmp.getMerged(Direction.SOUTH)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.debug("Fixing invalid merge: {}", this);
|
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.SOUTH, true);
|
tmp.getSettings().setMerged(Direction.SOUTH, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2664,7 +2659,6 @@ public class Plot {
|
|||||||
assert tmp != null;
|
assert tmp != null;
|
||||||
if (!tmp.getMerged(Direction.WEST)) {
|
if (!tmp.getMerged(Direction.WEST)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.debug("Fixing invalid merge: {}", this);
|
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.WEST, true);
|
tmp.getSettings().setMerged(Direction.WEST, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2681,7 +2675,6 @@ public class Plot {
|
|||||||
assert tmp != null;
|
assert tmp != null;
|
||||||
if (!tmp.getMerged(Direction.NORTH)) {
|
if (!tmp.getMerged(Direction.NORTH)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.debug("Fixing invalid merge: {}", this);
|
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.NORTH, true);
|
tmp.getSettings().setMerged(Direction.NORTH, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2697,7 +2690,6 @@ public class Plot {
|
|||||||
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.WEST));
|
tmp = this.area.getPlotAbs(this.id.getRelative(Direction.WEST));
|
||||||
if (!tmp.getMerged(Direction.EAST)) {
|
if (!tmp.getMerged(Direction.EAST)) {
|
||||||
// invalid merge
|
// invalid merge
|
||||||
logger.debug("Fixing invalid merge: {}", this);
|
|
||||||
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
if (tmp.isOwnerAbs(this.getOwnerAbs())) {
|
||||||
tmp.getSettings().setMerged(Direction.EAST, true);
|
tmp.getSettings().setMerged(Direction.EAST, true);
|
||||||
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
DBFunc.setMerged(tmp, tmp.getSettings().getMerged());
|
||||||
@ -2712,7 +2704,6 @@ public class Plot {
|
|||||||
Plot current;
|
Plot current;
|
||||||
while ((current = frontier.poll()) != null) {
|
while ((current = frontier.poll()) != null) {
|
||||||
if (!current.hasOwner() || current.settings == null) {
|
if (!current.hasOwner() || current.settings == null) {
|
||||||
logger.debug("Ignoring invalid merged plot: {} | {}", current, current.getOwnerAbs());
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmpSet.add(current);
|
tmpSet.add(current);
|
||||||
|
@ -87,7 +87,7 @@ import java.util.function.Consumer;
|
|||||||
*/
|
*/
|
||||||
public abstract class PlotArea {
|
public abstract class PlotArea {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PlotArea.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotArea.class.getSimpleName());
|
||||||
|
|
||||||
protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
|
protected final ConcurrentHashMap<PlotId, Plot> plots = new ConcurrentHashMap<>();
|
||||||
@Getter @NotNull private final String worldName;
|
@Getter @NotNull private final String worldName;
|
||||||
|
@ -25,7 +25,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.plot;
|
package com.plotsquared.core.plot;
|
||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
|
||||||
import com.plotsquared.core.player.PlotPlayer;
|
import com.plotsquared.core.player.PlotPlayer;
|
||||||
import com.plotsquared.core.util.InventoryUtil;
|
import com.plotsquared.core.util.InventoryUtil;
|
||||||
import lombok.NonNull;
|
import lombok.NonNull;
|
||||||
@ -34,7 +33,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
public class PlotInventory {
|
public class PlotInventory {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PlotInventory.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotInventory.class.getSimpleName());
|
||||||
|
|
||||||
private static final String META_KEY = "inventory";
|
private static final String META_KEY = "inventory";
|
||||||
public final PlotPlayer<?> player;
|
public final PlotPlayer<?> player;
|
||||||
@ -82,10 +81,7 @@ public class PlotInventory {
|
|||||||
if (this.title == null) {
|
if (this.title == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (hasPlotInventoryOpen(player)) {
|
if (!hasPlotInventoryOpen(player)) {
|
||||||
logger.debug("Failed to open plot inventory for {} because"
|
|
||||||
+ " the player already has an open plot inventory", player.getName());
|
|
||||||
} else {
|
|
||||||
this.open = true;
|
this.open = true;
|
||||||
setPlotInventoryOpen(player, this);
|
setPlotInventoryOpen(player, this);
|
||||||
InventoryUtil.manager.open(this);
|
InventoryUtil.manager.open(this);
|
||||||
|
@ -43,7 +43,6 @@ import com.plotsquared.core.plot.flag.implementations.AnalysisFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.KeepFlag;
|
import com.plotsquared.core.plot.flag.implementations.KeepFlag;
|
||||||
import com.plotsquared.core.plot.message.PlotMessage;
|
import com.plotsquared.core.plot.message.PlotMessage;
|
||||||
import com.plotsquared.core.util.MainUtil;
|
import com.plotsquared.core.util.MainUtil;
|
||||||
import com.plotsquared.core.util.StringMan;
|
|
||||||
import com.plotsquared.core.util.task.RunnableVal;
|
import com.plotsquared.core.util.task.RunnableVal;
|
||||||
import com.plotsquared.core.util.task.RunnableVal3;
|
import com.plotsquared.core.util.task.RunnableVal3;
|
||||||
import com.plotsquared.core.util.task.TaskManager;
|
import com.plotsquared.core.util.task.TaskManager;
|
||||||
@ -57,14 +56,13 @@ import java.util.Collections;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||||
|
|
||||||
public class ExpireManager {
|
public class ExpireManager {
|
||||||
|
|
||||||
private final Logger logger = LoggerFactory.getLogger(ExpireManager.class);
|
private final Logger logger = LoggerFactory.getLogger("P2/" + ExpireManager.class);
|
||||||
|
|
||||||
public static ExpireManager IMP;
|
public static ExpireManager IMP;
|
||||||
private final ConcurrentHashMap<UUID, Long> dates_cache;
|
private final ConcurrentHashMap<UUID, Long> dates_cache;
|
||||||
@ -83,7 +81,6 @@ public class ExpireManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addTask(ExpiryTask task) {
|
public void addTask(ExpiryTask task) {
|
||||||
logger.debug("Adding new expiry task!");
|
|
||||||
this.tasks.add(task);
|
this.tasks.add(task);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,19 +421,7 @@ public class ExpireManager {
|
|||||||
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
|
MainUtil.sendMessage(player, Captions.PLOT_REMOVED_USER, plot.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Set<Plot> plots = plot.getConnectedPlots();
|
|
||||||
plot.deletePlot(whenDone);
|
plot.deletePlot(whenDone);
|
||||||
PlotAnalysis changed = plot.getComplexity(null);
|
|
||||||
int changes = changed == null ? 0 : changed.changes_sd;
|
|
||||||
int modified = changed == null ? 0 : changed.changes;
|
|
||||||
logger.debug("Deleted expired plot: {} | User: {} | Delta: {}/{} | Connected: {}",
|
|
||||||
plot, plot.getOwner(), changes, modified, StringMan.getString(plots));
|
|
||||||
logger.debug(" - Area: {}", plot.getArea());
|
|
||||||
if (plot.hasOwner()) {
|
|
||||||
logger.debug(" - Owner: {}", plot.getOwner());
|
|
||||||
} else {
|
|
||||||
logger.debug(" - Owner: Unowned");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAge(UUID uuid) {
|
public long getAge(UUID uuid) {
|
||||||
|
@ -46,7 +46,7 @@ import java.util.concurrent.atomic.AtomicInteger;
|
|||||||
|
|
||||||
public class PlotAnalysis {
|
public class PlotAnalysis {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PlotAnalysis.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotAnalysis.class.getSimpleName());
|
||||||
|
|
||||||
public static boolean running = false;
|
public static boolean running = false;
|
||||||
public int changes;
|
public int changes;
|
||||||
@ -96,20 +96,26 @@ public class PlotAnalysis {
|
|||||||
*/
|
*/
|
||||||
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
|
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
|
||||||
if (running) {
|
if (running) {
|
||||||
logger.debug("Calibration task already in progress!");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Calibration task already in progress!");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (threshold <= 0 || threshold >= 1) {
|
if (threshold <= 0 || threshold >= 1) {
|
||||||
logger.debug("Invalid threshold provided! (Cannot be 0 or 100 as then there's no point in calibrating)");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(
|
||||||
|
"Invalid threshold provided! (Cannot be 0 or 100 as then there's no point in calibrating)");
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
running = true;
|
running = true;
|
||||||
logger.debug("- Fetching all plots");
|
|
||||||
final ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
|
final ArrayList<Plot> plots = new ArrayList<>(PlotSquared.get().getPlots());
|
||||||
TaskManager.runTaskAsync(new Runnable() {
|
TaskManager.runTaskAsync(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
Iterator<Plot> iterator = plots.iterator();
|
Iterator<Plot> iterator = plots.iterator();
|
||||||
logger.debug("- Reducing {} plots to those with sufficient data", plots.size());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- Reducing {} plots to those with sufficient data", plots.size());
|
||||||
|
}
|
||||||
while (iterator.hasNext()) {
|
while (iterator.hasNext()) {
|
||||||
Plot plot = iterator.next();
|
Plot plot = iterator.next();
|
||||||
if (plot.getSettings().getRatings() == null || plot.getSettings().getRatings()
|
if (plot.getSettings().getRatings() == null || plot.getSettings().getRatings()
|
||||||
@ -119,10 +125,12 @@ public class PlotAnalysis {
|
|||||||
plot.addRunning();
|
plot.addRunning();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
logger.debug("- | Reduced to {} plots", plots.size());
|
|
||||||
|
|
||||||
if (plots.size() < 3) {
|
if (plots.size() < 3) {
|
||||||
logger.debug("Calibration cancelled due to insufficient comparison data, please try again later");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(
|
||||||
|
"Calibration cancelled due to insufficient comparison data, please try again later");
|
||||||
|
}
|
||||||
running = false;
|
running = false;
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
@ -130,7 +138,9 @@ public class PlotAnalysis {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug("- Analyzing plot contents (this may take a while)");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- Analyzing plot contents (this may take a while)");
|
||||||
|
}
|
||||||
|
|
||||||
int[] changes = new int[plots.size()];
|
int[] changes = new int[plots.size()];
|
||||||
int[] faces = new int[plots.size()];
|
int[] faces = new int[plots.size()];
|
||||||
@ -156,7 +166,9 @@ public class PlotAnalysis {
|
|||||||
ratings[i] = (int) (
|
ratings[i] = (int) (
|
||||||
(plot.getAverageRating() + plot.getSettings().getRatings().size())
|
(plot.getAverageRating() + plot.getSettings().getRatings().size())
|
||||||
* 100);
|
* 100);
|
||||||
logger.debug(" | {} (rating) {}", plot, ratings[i]);
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" | {} (rating) {}", plot, ratings[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -168,7 +180,9 @@ public class PlotAnalysis {
|
|||||||
if (queuePlot == null) {
|
if (queuePlot == null) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
logger.debug(" | {}", queuePlot);
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" | {}", queuePlot);
|
||||||
|
}
|
||||||
final Object lock = new Object();
|
final Object lock = new Object();
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override public void run() {
|
@Override public void run() {
|
||||||
@ -198,7 +212,9 @@ public class PlotAnalysis {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(" - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - Waiting on plot rating thread: {}%", mi.intValue() * 100 / plots.size());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
ratingAnalysis.join();
|
ratingAnalysis.join();
|
||||||
@ -206,10 +222,15 @@ public class PlotAnalysis {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(" - Processing and grouping single plot analysis for bulk processing");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(
|
||||||
|
" - Processing and grouping single plot analysis for bulk processing");
|
||||||
|
}
|
||||||
for (int i = 0; i < plots.size(); i++) {
|
for (int i = 0; i < plots.size(); i++) {
|
||||||
Plot plot = plots.get(i);
|
Plot plot = plots.get(i);
|
||||||
logger.debug(" | {}", plot);
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" | {}", plot);
|
||||||
|
}
|
||||||
PlotAnalysis analysis = plot.getComplexity(null);
|
PlotAnalysis analysis = plot.getComplexity(null);
|
||||||
|
|
||||||
changes[i] = analysis.changes;
|
changes[i] = analysis.changes;
|
||||||
@ -225,16 +246,22 @@ public class PlotAnalysis {
|
|||||||
variety_sd[i] = analysis.variety_sd;
|
variety_sd[i] = analysis.variety_sd;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.debug(" - Calculating rankings");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - Calculating rankings");
|
||||||
|
}
|
||||||
|
|
||||||
int[] rankRatings = rank(ratings);
|
int[] rankRatings = rank(ratings);
|
||||||
int n = rankRatings.length;
|
int n = rankRatings.length;
|
||||||
|
|
||||||
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
|
int optimalIndex = (int) Math.round((1 - threshold) * (n - 1));
|
||||||
|
|
||||||
logger.debug(" - Calculating rank correlation: ");
|
if (Settings.DEBUG) {
|
||||||
logger.debug(" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
|
logger.info(" - Calculating rank correlation: ");
|
||||||
logger.debug(" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
|
logger.info(
|
||||||
|
" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
|
||||||
|
logger.info(
|
||||||
|
" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
|
||||||
|
}
|
||||||
|
|
||||||
Settings.Auto_Clear settings = new Settings.Auto_Clear();
|
Settings.Auto_Clear settings = new Settings.Auto_Clear();
|
||||||
|
|
||||||
@ -246,7 +273,10 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.CHANGES = factorChanges == 1 ?
|
settings.CALIBRATION.CHANGES = factorChanges == 1 ?
|
||||||
0 :
|
0 :
|
||||||
(int) (factorChanges * 1000 / MathMan.getMean(changes));
|
(int) (factorChanges * 1000 / MathMan.getMean(changes));
|
||||||
logger.debug(" - | changes {}", factorChanges);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | changes {}", factorChanges);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rankFaces = rank(faces);
|
int[] rankFaces = rank(faces);
|
||||||
int[] sdFaces = getSD(rankFaces, rankRatings);
|
int[] sdFaces = getSD(rankFaces, rankRatings);
|
||||||
@ -255,7 +285,10 @@ public class PlotAnalysis {
|
|||||||
double factorFaces = getCC(n, sumFaces);
|
double factorFaces = getCC(n, sumFaces);
|
||||||
settings.CALIBRATION.FACES =
|
settings.CALIBRATION.FACES =
|
||||||
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
|
factorFaces == 1 ? 0 : (int) (factorFaces * 1000 / MathMan.getMean(faces));
|
||||||
logger.debug(" - | faces {}", factorFaces);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | faces {}", factorFaces);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rankData = rank(data);
|
int[] rankData = rank(data);
|
||||||
int[] sdData = getSD(rankData, rankRatings);
|
int[] sdData = getSD(rankData, rankRatings);
|
||||||
@ -264,7 +297,10 @@ public class PlotAnalysis {
|
|||||||
double factor_data = getCC(n, sum_data);
|
double factor_data = getCC(n, sum_data);
|
||||||
settings.CALIBRATION.DATA =
|
settings.CALIBRATION.DATA =
|
||||||
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
|
factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
|
||||||
logger.debug(" - | data {}", factor_data);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | data {}", factor_data);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_air = rank(air);
|
int[] rank_air = rank(air);
|
||||||
int[] sd_air = getSD(rank_air, rankRatings);
|
int[] sd_air = getSD(rank_air, rankRatings);
|
||||||
@ -273,7 +309,10 @@ public class PlotAnalysis {
|
|||||||
double factor_air = getCC(n, sum_air);
|
double factor_air = getCC(n, sum_air);
|
||||||
settings.CALIBRATION.AIR =
|
settings.CALIBRATION.AIR =
|
||||||
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
|
factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
|
||||||
logger.debug("- | air {}", factor_air);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- | air {}", factor_air);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_variety = rank(variety);
|
int[] rank_variety = rank(variety);
|
||||||
int[] sd_variety = getSD(rank_variety, rankRatings);
|
int[] sd_variety = getSD(rank_variety, rankRatings);
|
||||||
@ -283,7 +322,10 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.VARIETY = factor_variety == 1 ?
|
settings.CALIBRATION.VARIETY = factor_variety == 1 ?
|
||||||
0 :
|
0 :
|
||||||
(int) (factor_variety * 1000 / MathMan.getMean(variety));
|
(int) (factor_variety * 1000 / MathMan.getMean(variety));
|
||||||
logger.debug("- | variety {}", factor_variety);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- | variety {}", factor_variety);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_changes_sd = rank(changes_sd);
|
int[] rank_changes_sd = rank(changes_sd);
|
||||||
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
|
int[] sd_changes_sd = getSD(rank_changes_sd, rankRatings);
|
||||||
@ -293,7 +335,10 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.CHANGES_SD = factor_changes_sd == 1 ?
|
settings.CALIBRATION.CHANGES_SD = factor_changes_sd == 1 ?
|
||||||
0 :
|
0 :
|
||||||
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
|
(int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
|
||||||
logger.debug(" - | changed_sd {}", factor_changes_sd);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | changed_sd {}", factor_changes_sd);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_faces_sd = rank(faces_sd);
|
int[] rank_faces_sd = rank(faces_sd);
|
||||||
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
|
int[] sd_faces_sd = getSD(rank_faces_sd, rankRatings);
|
||||||
@ -303,7 +348,10 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.FACES_SD = factor_faces_sd == 1 ?
|
settings.CALIBRATION.FACES_SD = factor_faces_sd == 1 ?
|
||||||
0 :
|
0 :
|
||||||
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
|
(int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
|
||||||
logger.debug(" - | faced_sd {}", factor_faces_sd);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | faced_sd {}", factor_faces_sd);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_data_sd = rank(data_sd);
|
int[] rank_data_sd = rank(data_sd);
|
||||||
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
|
int[] sd_data_sd = getSD(rank_data_sd, rankRatings);
|
||||||
@ -313,7 +361,10 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.DATA_SD = factor_data_sd == 1 ?
|
settings.CALIBRATION.DATA_SD = factor_data_sd == 1 ?
|
||||||
0 :
|
0 :
|
||||||
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
|
(int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
|
||||||
logger.debug(" - | data_sd {}", factor_data_sd);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | data_sd {}", factor_data_sd);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_air_sd = rank(air_sd);
|
int[] rank_air_sd = rank(air_sd);
|
||||||
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
|
int[] sd_air_sd = getSD(rank_air_sd, rankRatings);
|
||||||
@ -322,7 +373,10 @@ public class PlotAnalysis {
|
|||||||
double factor_air_sd = getCC(n, sum_air_sd);
|
double factor_air_sd = getCC(n, sum_air_sd);
|
||||||
settings.CALIBRATION.AIR_SD =
|
settings.CALIBRATION.AIR_SD =
|
||||||
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
|
factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
|
||||||
logger.debug(" - | air_sd {}", factor_air_sd);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | air_sd {}", factor_air_sd);
|
||||||
|
}
|
||||||
|
|
||||||
int[] rank_variety_sd = rank(variety_sd);
|
int[] rank_variety_sd = rank(variety_sd);
|
||||||
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
|
int[] sd_variety_sd = getSD(rank_variety_sd, rankRatings);
|
||||||
@ -332,11 +386,17 @@ public class PlotAnalysis {
|
|||||||
settings.CALIBRATION.VARIETY_SD = factor_variety_sd == 1 ?
|
settings.CALIBRATION.VARIETY_SD = factor_variety_sd == 1 ?
|
||||||
0 :
|
0 :
|
||||||
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
|
(int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
|
||||||
logger.debug(" - | variety_sd {}", factor_variety_sd);
|
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" - | variety_sd {}", factor_variety_sd);
|
||||||
|
}
|
||||||
|
|
||||||
int[] complexity = new int[n];
|
int[] complexity = new int[n];
|
||||||
|
|
||||||
logger.debug(" Calculating threshold");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" Calculating threshold");
|
||||||
|
}
|
||||||
|
|
||||||
int max = 0;
|
int max = 0;
|
||||||
int min = 0;
|
int min = 0;
|
||||||
for (int i = 0; i < n; i++) {
|
for (int i = 0; i < n; i++) {
|
||||||
@ -365,7 +425,10 @@ public class PlotAnalysis {
|
|||||||
logln("Correlation: ");
|
logln("Correlation: ");
|
||||||
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
|
logln(getCC(n, sum(square(getSD(rankComplexity, rankRatings)))));
|
||||||
if (optimalComplexity == Integer.MAX_VALUE) {
|
if (optimalComplexity == Integer.MAX_VALUE) {
|
||||||
logger.debug("Insufficient data to determine correlation! {} | {}", optimalIndex, n);
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Insufficient data to determine correlation! {} | {}",
|
||||||
|
optimalIndex, n);
|
||||||
|
}
|
||||||
running = false;
|
running = false;
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
@ -383,21 +446,27 @@ public class PlotAnalysis {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Save calibration
|
// Save calibration
|
||||||
logger.debug(" Saving calibration");
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" Saving calibration");
|
||||||
|
}
|
||||||
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
|
Settings.AUTO_CLEAR.put("auto-calibrated", settings);
|
||||||
Settings.save(PlotSquared.get().worldsFile);
|
Settings.save(PlotSquared.get().worldsFile);
|
||||||
logger.debug("Done!");
|
|
||||||
running = false;
|
running = false;
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
}
|
}
|
||||||
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(" Done!");
|
||||||
|
}
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void logln(Object obj) {
|
public static void logln(Object obj) {
|
||||||
logger.debug(log(obj));
|
if (Settings.DEBUG) {
|
||||||
|
logger.info(log(obj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String log(Object obj) {
|
public static String log(Object obj) {
|
||||||
|
@ -45,7 +45,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
@EqualsAndHashCode(of = "flagMap") public class FlagContainer {
|
@EqualsAndHashCode(of = "flagMap") public class FlagContainer {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(FlagContainer.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + FlagContainer.class.getSimpleName());
|
||||||
|
|
||||||
private final Map<String, String> unknownFlags = new HashMap<>();
|
private final Map<String, String> unknownFlags = new HashMap<>();
|
||||||
private final Map<Class<?>, PlotFlag<?, ?>> flagMap = new HashMap<>();
|
private final Map<Class<?>, PlotFlag<?, ?>> flagMap = new HashMap<>();
|
||||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.plot.flag.types;
|
|||||||
|
|
||||||
import com.google.common.base.Objects;
|
import com.google.common.base.Objects;
|
||||||
import com.google.common.base.Preconditions;
|
import com.google.common.base.Preconditions;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import com.sk89q.worldedit.world.block.BlockCategory;
|
import com.sk89q.worldedit.world.block.BlockCategory;
|
||||||
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
import com.sk89q.worldedit.world.block.BlockStateHolder;
|
||||||
import com.sk89q.worldedit.world.block.BlockType;
|
import com.sk89q.worldedit.world.block.BlockType;
|
||||||
@ -45,7 +46,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class BlockTypeWrapper {
|
public class BlockTypeWrapper {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(BlockTypeWrapper.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + BlockTypeWrapper.class.getSimpleName());
|
||||||
|
|
||||||
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
private static final Map<BlockType, BlockTypeWrapper> blockTypes = new HashMap<>();
|
||||||
private static final Map<String, BlockTypeWrapper> blockCategories = new HashMap<>();
|
private static final Map<String, BlockTypeWrapper> blockCategories = new HashMap<>();
|
||||||
@ -132,7 +133,9 @@ public class BlockTypeWrapper {
|
|||||||
&& this.blockCategoryId != null) { // only if name is available
|
&& this.blockCategoryId != null) { // only if name is available
|
||||||
this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId);
|
this.blockCategory = BlockCategory.REGISTRY.get(this.blockCategoryId);
|
||||||
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
|
if (this.blockCategory == null && !BlockCategory.REGISTRY.values().isEmpty()) {
|
||||||
logger.debug("- Block category #{} does not exist", this.blockCategoryId);
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("- Block category #{} does not exist", this.blockCategoryId);
|
||||||
|
}
|
||||||
this.blockCategory = new NullBlockCategory(this.blockCategoryId);
|
this.blockCategory = new NullBlockCategory(this.blockCategoryId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@ import org.slf4j.LoggerFactory;
|
|||||||
|
|
||||||
public class PlotMessage {
|
public class PlotMessage {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(PlotMessage.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + PlotMessage.class.getSimpleName());
|
||||||
|
|
||||||
private Object builder;
|
private Object builder;
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ import javax.annotation.Nullable;
|
|||||||
|
|
||||||
public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQueue {
|
public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQueue {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(LocationOffsetDelegateLocalBlockQueue.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + LocationOffsetDelegateLocalBlockQueue.class.getSimpleName());
|
||||||
|
|
||||||
private final boolean[][] canPlace;
|
private final boolean[][] canPlace;
|
||||||
private final int blockX;
|
private final int blockX;
|
||||||
@ -64,9 +64,6 @@ public class LocationOffsetDelegateLocalBlockQueue extends DelegateLocalBlockQue
|
|||||||
return super.setBlock(x, y, z, id);
|
return super.setBlock(x, y, z, id);
|
||||||
}
|
}
|
||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
logger.debug("Failed set block at {},{},{} (to = {}) with offset {};{}. Translated to: {}, {}",
|
|
||||||
x, y, z, id, blockX, blockZ, x - blockX,
|
|
||||||
z - blockZ);
|
|
||||||
throw e;
|
throw e;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -25,9 +25,9 @@
|
|||||||
*/
|
*/
|
||||||
package com.plotsquared.core.util;
|
package com.plotsquared.core.util;
|
||||||
|
|
||||||
import com.plotsquared.core.PlotSquared;
|
|
||||||
import com.plotsquared.core.command.DebugExec;
|
import com.plotsquared.core.command.DebugExec;
|
||||||
import com.plotsquared.core.command.MainCommand;
|
import com.plotsquared.core.command.MainCommand;
|
||||||
|
import com.plotsquared.core.configuration.Settings;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@ -35,7 +35,7 @@ import javax.script.ScriptException;
|
|||||||
|
|
||||||
public abstract class Expression<T> {
|
public abstract class Expression<T> {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(Expression.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + Expression.class.getSimpleName());
|
||||||
|
|
||||||
public static <U> Expression<U> constant(final U value) {
|
public static <U> Expression<U> constant(final U value) {
|
||||||
return new Expression<U>() {
|
return new Expression<U>() {
|
||||||
@ -71,7 +71,9 @@ public abstract class Expression<T> {
|
|||||||
try {
|
try {
|
||||||
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
|
return (Double) exec.getEngine().eval(expression.replace("{arg}", "" + arg));
|
||||||
} catch (ScriptException e) {
|
} catch (ScriptException e) {
|
||||||
logger.debug("Invalid expression: {}", expression);
|
if (Settings.DEBUG) {
|
||||||
|
logger.info("Invalid expression: {}", expression);
|
||||||
|
}
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return 0d;
|
return 0d;
|
||||||
|
@ -46,7 +46,7 @@ import java.util.Map;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public final class LegacyConverter {
|
public final class LegacyConverter {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(LegacyConverter.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + LegacyConverter.class.getSimpleName());
|
||||||
public static final String CONFIGURATION_VERSION = "post_flattening";
|
public static final String CONFIGURATION_VERSION = "post_flattening";
|
||||||
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
|
private static final HashMap<String, ConfigurationType> TYPE_MAP = new HashMap<>();
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ import java.util.stream.IntStream;
|
|||||||
*/
|
*/
|
||||||
public class MainUtil {
|
public class MainUtil {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(MainUtil.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + MainUtil.class.getSimpleName());
|
||||||
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
private static final DecimalFormat FLAG_DECIMAL_FORMAT = new DecimalFormat("0");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@ -156,7 +156,6 @@ public class MainUtil {
|
|||||||
public static void upload(UUID uuid, String file, String extension,
|
public static void upload(UUID uuid, String file, String extension,
|
||||||
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
|
final RunnableVal<OutputStream> writeTask, final RunnableVal<URL> whenDone) {
|
||||||
if (writeTask == null) {
|
if (writeTask == null) {
|
||||||
logger.debug("Write task cannot be null");
|
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -897,8 +896,6 @@ public class MainUtil {
|
|||||||
for (File file : files) {
|
for (File file : files) {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
deleteDirectory(file);
|
deleteDirectory(file);
|
||||||
} else {
|
|
||||||
logger.debug("Deleting file: {} | {}", file, file.delete());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ import java.util.Set;
|
|||||||
|
|
||||||
public abstract class RegionManager {
|
public abstract class RegionManager {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(RegionManager.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + RegionManager.class.getSimpleName());
|
||||||
|
|
||||||
public static RegionManager manager = null;
|
public static RegionManager manager = null;
|
||||||
|
|
||||||
|
@ -96,7 +96,7 @@ import java.util.zip.GZIPOutputStream;
|
|||||||
|
|
||||||
public abstract class SchematicHandler {
|
public abstract class SchematicHandler {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(SchematicHandler.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + SchematicHandler.class.getSimpleName());
|
||||||
public static SchematicHandler manager;
|
public static SchematicHandler manager;
|
||||||
|
|
||||||
private boolean exportAll = false;
|
private boolean exportAll = false;
|
||||||
@ -151,17 +151,12 @@ public abstract class SchematicHandler {
|
|||||||
final Runnable THIS = this;
|
final Runnable THIS = this;
|
||||||
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
SchematicHandler.manager.getCompoundTag(plot, new RunnableVal<CompoundTag>() {
|
||||||
@Override public void run(final CompoundTag value) {
|
@Override public void run(final CompoundTag value) {
|
||||||
if (value == null) {
|
if (value != null) {
|
||||||
logger.debug("Skipped plot {}", plot.getId());
|
|
||||||
} else {
|
|
||||||
TaskManager.runTaskAsync(() -> {
|
TaskManager.runTaskAsync(() -> {
|
||||||
logger.debug("ID: {}", plot.getId());
|
|
||||||
boolean result = SchematicHandler.manager
|
boolean result = SchematicHandler.manager
|
||||||
.save(value, directory + File.separator + name + ".schem");
|
.save(value, directory + File.separator + name + ".schem");
|
||||||
if (!result) {
|
if (!result) {
|
||||||
logger.error("Failed to save {}", plot.getId());
|
logger.error("Failed to save {}", plot.getId());
|
||||||
} else {
|
|
||||||
logger.debug("success: {}", plot.getId());
|
|
||||||
}
|
}
|
||||||
TaskManager.runTask(THIS);
|
TaskManager.runTask(THIS);
|
||||||
});
|
});
|
||||||
@ -205,7 +200,6 @@ public abstract class SchematicHandler {
|
|||||||
+ 1) < WIDTH) || (
|
+ 1) < WIDTH) || (
|
||||||
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset
|
(region.getMaximumPoint().getZ() - region.getMinimumPoint().getZ() + zOffset
|
||||||
+ 1) < LENGTH) || (HEIGHT > 256)) {
|
+ 1) < LENGTH) || (HEIGHT > 256)) {
|
||||||
logger.debug("Schematic is too large");
|
|
||||||
TaskManager.runTask(whenDone);
|
TaskManager.runTask(whenDone);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ import java.util.Locale;
|
|||||||
@SuppressWarnings({"unused", "WeakerAccess"})
|
@SuppressWarnings({"unused", "WeakerAccess"})
|
||||||
public final class IncendoPaster {
|
public final class IncendoPaster {
|
||||||
|
|
||||||
private static Logger logger = LoggerFactory.getLogger(IncendoPaster.class);
|
private static Logger logger = LoggerFactory.getLogger("P2/" + IncendoPaster.class);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Upload service URL
|
* Upload service URL
|
||||||
@ -161,7 +161,7 @@ public final class IncendoPaster {
|
|||||||
if (!httpURLConnection.getResponseMessage().contains("OK")) {
|
if (!httpURLConnection.getResponseMessage().contains("OK")) {
|
||||||
if (httpURLConnection.getResponseCode() == 413) {
|
if (httpURLConnection.getResponseCode() == 413) {
|
||||||
final long size = content.length;
|
final long size = content.length;
|
||||||
logger.debug("Paste too big > size: {}MB", size / 1_000_000);
|
logger.error("Paste too big > size: {}MB", size / 1_000_000);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(String
|
throw new IllegalStateException(String
|
||||||
.format("Server returned status: %d %s", httpURLConnection.getResponseCode(),
|
.format("Server returned status: %d %s", httpURLConnection.getResponseCode(),
|
||||||
|
@ -64,7 +64,7 @@ import java.util.function.Function;
|
|||||||
*/
|
*/
|
||||||
public class UUIDPipeline {
|
public class UUIDPipeline {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(UUIDPipeline.class);
|
private static final Logger logger = LoggerFactory.getLogger("P2/" + UUIDPipeline.class.getSimpleName());
|
||||||
|
|
||||||
private final Executor executor;
|
private final Executor executor;
|
||||||
private final List<UUIDService> serviceList;
|
private final List<UUIDService> serviceList;
|
||||||
@ -325,7 +325,7 @@ public class UUIDPipeline {
|
|||||||
this.consume(mappings);
|
this.consume(mappings);
|
||||||
return mappings;
|
return mappings;
|
||||||
} else if (Settings.DEBUG) {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("(UUID) Failed to find all usernames");
|
logger.info("(UUID) Failed to find all usernames");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
|
if (Settings.UUID.UNKNOWN_AS_DEFAULT) {
|
||||||
@ -388,7 +388,7 @@ public class UUIDPipeline {
|
|||||||
this.consume(mappings);
|
this.consume(mappings);
|
||||||
return mappings;
|
return mappings;
|
||||||
} else if (Settings.DEBUG) {
|
} else if (Settings.DEBUG) {
|
||||||
logger.debug("(UUID) Failed to find all UUIDs");
|
logger.info("(UUID) Failed to find all UUIDs");
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new ServiceError("End of pipeline");
|
throw new ServiceError("End of pipeline");
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<Configuration status="WARN" packages="com.plotsquared">
|
|
||||||
<Appenders>
|
|
||||||
<Console name="SysOut" target="SYSTEM_OUT">
|
|
||||||
<PatternLayout pattern="%highlight{[P2: %c{1.}][%d{HH:mm:ss}] [%t/%level]: %msg%n%throwable{full}}" />
|
|
||||||
</Console>
|
|
||||||
</Appenders>
|
|
||||||
<Loggers>
|
|
||||||
<Root level="info">
|
|
||||||
<AppenderRef ref="SysOut"/>
|
|
||||||
</Root>
|
|
||||||
</Loggers>
|
|
||||||
</Configuration>
|
|
Loading…
Reference in New Issue
Block a user