Merge branch 'v6' into feature/v6/platform

# Conflicts:
#	Bukkit/build.gradle
#	Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/listener/ChunkListener.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitRegionManager.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java
#	Bukkit/src/main/java/com/plotsquared/bukkit/uuid/SquirrelIdUUIDService.java
#	Core/build.gradle
#	Core/src/main/java/com/plotsquared/core/PlotSquared.java
#	Core/src/main/java/com/plotsquared/core/command/Claim.java
#	Core/src/main/java/com/plotsquared/core/command/Debug.java
#	Core/src/main/java/com/plotsquared/core/command/DebugExec.java
#	Core/src/main/java/com/plotsquared/core/command/Purge.java
#	Core/src/main/java/com/plotsquared/core/command/Trim.java
#	Core/src/main/java/com/plotsquared/core/components/ComponentPresetManager.java
#	Core/src/main/java/com/plotsquared/core/database/SQLManager.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridPlotWorld.java
#	Core/src/main/java/com/plotsquared/core/generator/HybridUtils.java
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotManager.java
#	Core/src/main/java/com/plotsquared/core/generator/SquarePlotWorld.java
#	Core/src/main/java/com/plotsquared/core/listener/ProcessedWEExtent.java
#	Core/src/main/java/com/plotsquared/core/player/ConsolePlayer.java
#	Core/src/main/java/com/plotsquared/core/player/PlotPlayer.java
#	Core/src/main/java/com/plotsquared/core/plot/Plot.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotArea.java
#	Core/src/main/java/com/plotsquared/core/plot/PlotInventory.java
#	Core/src/main/java/com/plotsquared/core/plot/expiration/ExpireManager.java
#	Core/src/main/java/com/plotsquared/core/plot/expiration/PlotAnalysis.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/FlagContainer.java
#	Core/src/main/java/com/plotsquared/core/plot/flag/types/BlockTypeWrapper.java
#	Core/src/main/java/com/plotsquared/core/plot/message/PlotMessage.java
#	Core/src/main/java/com/plotsquared/core/util/LegacyConverter.java
#	Core/src/main/java/com/plotsquared/core/util/MainUtil.java
#	Core/src/main/java/com/plotsquared/core/util/RegionManager.java
#	Core/src/main/java/com/plotsquared/core/util/SchematicHandler.java
#	Core/src/main/java/com/plotsquared/core/uuid/UUIDPipeline.java
This commit is contained in:
Alexander Söderberg
2020-07-14 19:05:05 +02:00
51 changed files with 673 additions and 678 deletions

View File

@ -59,9 +59,8 @@ import com.plotsquared.bukkit.uuid.SquirrelIdUUIDService;
import com.plotsquared.core.PlotPlatform;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.backup.BackupManager;
import com.plotsquared.core.command.WE_Anywhere;
import com.plotsquared.core.components.ComponentPresetManager;
import com.plotsquared.core.configuration.CaptionUtility;
import com.plotsquared.core.backup.NullBackupManager;
import com.plotsquared.core.backup.SimpleBackupManager;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.ChatFormatter;
import com.plotsquared.core.configuration.ConfigurationNode;
@ -96,6 +95,7 @@ import com.plotsquared.core.queue.GlobalBlockQueue;
import com.plotsquared.core.setup.PlotAreaBuilder;
import com.plotsquared.core.setup.SettingsNodesWrapper;
import com.plotsquared.core.util.ChatManager;
import com.plotsquared.core.util.ChunkManager;
import com.plotsquared.core.util.ConsoleColors;
import com.plotsquared.core.util.EconHandler;
import com.plotsquared.core.util.EventDispatcher;
@ -105,7 +105,6 @@ import com.plotsquared.core.util.PlatformWorldManager;
import com.plotsquared.core.util.PremiumVerification;
import com.plotsquared.core.util.ReflectionUtils;
import com.plotsquared.core.util.SetupUtils;
import com.plotsquared.core.util.StringMan;
import com.plotsquared.core.util.WorldUtil;
import com.plotsquared.core.util.task.TaskManager;
import com.plotsquared.core.uuid.CacheUUIDService;
@ -134,6 +133,8 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.File;
import java.lang.reflect.Method;
@ -160,6 +161,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused") public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPlatform<Player> {
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitMain.class.getSimpleName());
private static final int BSTATS_ID = 1404;
static {
@ -203,9 +205,6 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
} catch (NumberFormatException e) {
e.printStackTrace();
PlotSquared.debug(StringMan.getString(Bukkit.getBukkitVersion()));
PlotSquared.debug(
StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
return new int[] {1, 13, 0};
}
}
@ -246,14 +245,12 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
if (PremiumVerification.isPremium()) {
PlotSquared.log(
Captions.PREFIX + "&6PlotSquared version licensed to Spigot user " + getUserID());
PlotSquared
.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/" + getResourceID());
PlotSquared.log(Captions.PREFIX + "&6Download ID: " + getDownloadID());
PlotSquared.log(Captions.PREFIX + "&6Thanks for supporting us :)");
logger.info("[P2] PlotSquared version licensed to Spigot user {}", getUserID());
logger.info("[P2] https://www.spigotmc.org/resources/{}", getResourceID());
logger.info("[P2] Download ID: {}", getDownloadID());
logger.info("[P2] Thanks for supporting us :)");
} else {
PlotSquared.log(Captions.PREFIX + "&6Couldn't verify purchase :(");
logger.info("[P2] Couldn't verify purchase :(");
}
// Database
@ -398,7 +395,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
final OfflineModeUUIDService offlineModeUUIDService = new OfflineModeUUIDService();
this.impromptuPipeline.registerService(offlineModeUUIDService);
this.backgroundPipeline.registerService(offlineModeUUIDService);
PlotSquared.log(Captions.PREFIX + "(UUID) Using the offline mode UUID service");
logger.info("[P2] (UUID) Using the offline mode UUID service");
}
final OfflinePlayerUUIDService offlinePlayerUUIDService = new OfflinePlayerUUIDService();
@ -418,8 +415,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
final LuckPermsUUIDService luckPermsUUIDService;
if (Bukkit.getPluginManager().getPlugin("LuckPerms") != null) {
luckPermsUUIDService = new LuckPermsUUIDService();
PlotSquared
.log(Captions.PREFIX + "(UUID) Using LuckPerms as a complementary UUID service");
logger.info("[P2] (UUID) Using LuckPerms as a complementary UUID service");
} else {
luckPermsUUIDService = null;
}
@ -427,8 +423,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
final BungeePermsUUIDService bungeePermsUUIDService;
if (Bukkit.getPluginManager().getPlugin("BungeePerms") != null) {
bungeePermsUUIDService = new BungeePermsUUIDService();
PlotSquared
.log(Captions.PREFIX + "(UUID) Using BungeePerms as a complementary UUID service");
logger.info("[P2] (UUID) Using BungeePerms as a complementary UUID service");
} else {
bungeePermsUUIDService = null;
}
@ -436,8 +431,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
final EssentialsUUIDService essentialsUUIDService;
if (Bukkit.getPluginManager().getPlugin("Essentials") != null) {
essentialsUUIDService = new EssentialsUUIDService();
PlotSquared
.log(Captions.PREFIX + "(UUID) Using Essentials as a complementary UUID service");
logger.info("[P2] (UUID) Using Essentials as a complementary UUID service");
} else {
essentialsUUIDService = null;
}
@ -448,8 +442,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
final PaperUUIDService paperUUIDService = new PaperUUIDService();
this.impromptuPipeline.registerService(paperUUIDService);
this.backgroundPipeline.registerService(paperUUIDService);
PlotSquared
.log(Captions.PREFIX + "(UUID) Using Paper as a complementary UUID service");
logger.info("[P2] (UUID) Using Paper as a complementary UUID service");
}
this.impromptuPipeline.registerService(sqLiteUUIDService);
@ -505,10 +498,9 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
if (Settings.Enabled_Components.EXTERNAL_PLACEHOLDERS) {
ChatFormatter.formatters.add(getInjector().getInstance(PlaceholderFormatter.class));
}
PlotSquared.log(Captions.PREFIX + "&6PlotSquared hooked into PlaceholderAPI");
logger.info("[P2] PlotSquared hooked into PlaceholderAPI");
} else {
PlotSquared
.debug(Captions.PREFIX + "&6PlaceholderAPI is not in use. Hook deactivated.");
logger.info("[P2] PlaceholderAPI is not in use. Hook deactivated");
}
this.startMetrics();
@ -521,10 +513,6 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
}
PlotSquared.log(
Captions.PREFIX.getTranslated() + "Using platform world manager: " + this.worldManager
.getName());
// Clean up potential memory leak
Bukkit.getScheduler().runTaskTimer(this, () -> {
try {
@ -537,10 +525,6 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
getLogger().warning("Failed to clean up players: " + e.getMessage());
}
}, 100L, 100L);
PlotSquared.log(Captions.PREFIX + CaptionUtility
.format(ConsolePlayer.getConsole(), Captions.ENABLED.getTranslated(),
this.getPluginName()));
}
private void unload() {
@ -588,7 +572,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
final Chunk[] chunks = world.getLoadedChunks();
if (chunks.length == 0) {
if (!Bukkit.unloadWorld(world, true)) {
PlotSquared.debug("Failed to unload " + world.getName());
logger.warn("[P2] Failed to unload {}", world.getName());
}
return;
} else {
@ -638,8 +622,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
}
});
PlotSquared.log(Captions.PREFIX.getTranslated() + "(UUID) " + uuidQueue.size()
+ " UUIDs will be cached.");
logger.info("[P2] (UUID) {} UUIDs will be cached", uuidQueue.size());
Executors.newSingleThreadScheduledExecutor().schedule(() -> {
// Begin by reading all the SQLite cache at once
@ -647,9 +631,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
// Now fetch names for all known UUIDs
final int totalSize = uuidQueue.size();
int read = 0;
PlotSquared.log(Captions.PREFIX.getTranslated()
+ "(UUID) PlotSquared will fetch UUIDs in groups of "
+ Settings.UUID.BACKGROUND_LIMIT);
logger.info("[P2] (UUID) PlotSquared will fetch UUIDs in groups of {}", Settings.UUID.BACKGROUND_LIMIT);
final List<UUID> uuidList = new ArrayList<>(Settings.UUID.BACKGROUND_LIMIT);
// Used to indicate that the second retrieval has been attempted
@ -657,7 +639,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
while (!uuidQueue.isEmpty() || !uuidList.isEmpty()) {
if (!uuidList.isEmpty() && secondRun) {
PlotSquared.log("Giving up on last batch. Fetching new batch instead.");
logger.warn("[P2] (UUID) Giving up on last batch. Fetching new batch instead");
uuidList.clear();
}
if (uuidList.isEmpty()) {
@ -681,15 +663,14 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
uuidList.clear();
// Print progress
final double percentage = ((double) read / (double) totalSize) * 100.0D;
PlotSquared.log(Captions.PREFIX.getTranslated() + String
.format("(UUID) PlotSquared has cached %.1f%% of UUIDs", percentage));
if (Settings.DEBUG) {
logger.info("[P2] (UUID) PlotSquared has cached {} of UUIDs", String.format("%.1f%%", percentage));
}
} catch (final InterruptedException | ExecutionException e) {
PlotSquared.log("Failed to retrieve that batch. Will try again.");
e.printStackTrace();
logger.error("[P2] (UUID) Failed to retrieve last batch. Will try again", e);
}
}
PlotSquared
.log(Captions.PREFIX.getTranslated() + "(UUID) PlotSquared has cached all UUIDs");
logger.info("[P2] (UUID) PlotSquared has cached all UUIDs");
}, 10, TimeUnit.SECONDS);
}
@ -733,7 +714,7 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
}
@SuppressWarnings("deprecation") private void runEntityTask() {
PlotSquared.log(Captions.PREFIX + "KillAllEntities started.");
logger.info("[P2] KillAllEntities started");
TaskManager.runTaskRepeat(() -> this.plotAreaManager.forEachPlotArea(plotArea -> {
final World world = Bukkit.getWorld(plotArea.getWorldName());
try {
@ -1074,8 +1055,8 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
if (!this.plotAreaManager.hasPlotArea(worldName)) {
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
}
} catch (Exception e) {
PlotSquared.log("Failed to reload world: " + world + " | " + e.getMessage());
} catch (final Exception e) {
logger.error("[P2] Failed to reload world: {} | {}", world, e.getMessage());
Bukkit.getServer().unloadWorld(world, false);
return;
}

View File

@ -25,7 +25,7 @@
*/
package com.plotsquared.bukkit.entity;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Settings;
import org.bukkit.Art;
import org.bukkit.DyeColor;
import org.bukkit.Location;
@ -55,11 +55,15 @@ import org.bukkit.inventory.InventoryHolder;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.EulerAngle;
import org.bukkit.util.Vector;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
public final class ReplicatingEntityWrapper extends EntityWrapper {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ReplicatingEntityWrapper.class.getSimpleName());
private final short depth;
private final int hash;
private final EntityBaseStats base = new EntityBaseStats();
@ -331,10 +335,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
this.dataByte = (byte) 0;
}
storeLiving((LivingEntity) entity);
return;
// END LIVING //
default:
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
}
}
@ -390,7 +391,7 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
try {
entity.getInventory().setContents(this.inventory);
} catch (IllegalArgumentException e) {
PlotSquared.debug("&c[WARN] Failed to restore inventory.\n Reason: " + e.getMessage());
logger.error("[P2] Failed to restore inventory", e);
}
}
@ -736,7 +737,9 @@ public final class ReplicatingEntityWrapper extends EntityWrapper {
restoreLiving((LivingEntity) entity);
return entity;
default:
PlotSquared.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
if (Settings.DEBUG) {
logger.info("[P2] Could not identify entity: {}", entity.getType());
}
return entity;
// END LIVING
}

View File

@ -54,6 +54,8 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.Method;
import java.util.HashSet;
@ -63,13 +65,15 @@ import static com.plotsquared.core.util.ReflectionUtils.getRefClass;
@SuppressWarnings("unused")
public class ChunkListener implements Listener {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ChunkListener.class.getSimpleName());
private final PlotAreaManager plotAreaManager;
private RefMethod methodGetHandleChunk;
private RefField mustSave;
private Chunk lastChunk;
private boolean ignoreUnload = false;
@Inject public ChunkListener(@Nonnull final PlotAreaManager plotAreaManager) {
this.plotAreaManager = plotAreaManager;
if (Settings.Chunk_Processor.AUTO_TRIM) {
@ -79,9 +83,6 @@ public class ChunkListener implements Listener {
this.mustSave = classChunk.getField("mustSave");
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
} catch (Throwable ignored) {
PlotSquared.debug(PlotSquared.platform().getPluginName()
+ "/Server not compatible for chunk processor trim/gc");
Settings.Chunk_Processor.AUTO_TRIM = false;
}
}
@ -257,7 +258,6 @@ public class ChunkListener implements Listener {
if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
@ -265,7 +265,6 @@ public class ChunkListener implements Listener {
if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
@ -275,7 +274,6 @@ public class ChunkListener implements Listener {
if (i >= tiles.length - Settings.Chunk_Processor.MAX_TILES) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
PlotSquared.debug("Successfully processed and unloaded chunk!");
chunk.unload(true);
return;
}
@ -302,16 +300,9 @@ public class ChunkListener implements Listener {
toRemove--;
}
}
PlotSquared.debug(
"PlotSquared detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (
chunk.getX() << 4));
}
if (tiles.length > Settings.Chunk_Processor.MAX_TILES) {
if (unload) {
PlotSquared.debug(
"PlotSquared detected unsafe chunk: " + (chunk.getX() << 4) + "," + (
chunk.getX() << 4));
cleanChunk(chunk);
return true;
}

View File

@ -1020,7 +1020,8 @@ import java.util.regex.Pattern;
player.sendMessage(spyMessage);
}
}
PlotSquared.debug(full);
// TODO: Re-implement
// PlotSquared.debug(full);
}
@EventHandler(priority = EventPriority.LOWEST) public void blockDestroy(BlockBreakEvent event) {
@ -2497,7 +2498,6 @@ import java.util.regex.Pattern;
}
Player p = event.getPlayer();
if (p == null) {
PlotSquared.debug("PlotSquared does not support HangingPlaceEvent for non-players.");
event.setCancelled(true);
return;
}

View File

@ -27,7 +27,6 @@ package com.plotsquared.bukkit.queue;
import com.plotsquared.bukkit.schematic.StateWrapper;
import com.plotsquared.bukkit.util.BukkitBlockUtil;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.queue.BasicLocalBlockQueue;
import com.plotsquared.core.util.BlockUtil;
import com.plotsquared.core.util.MainUtil;
@ -84,8 +83,6 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
World worldObj = Bukkit.getWorld(getWorld());
if (worldObj != null) {
worldObj.refreshChunk(x, z);
} else {
PlotSquared.debug("Error Refreshing Chunk");
}
}
@ -108,8 +105,6 @@ public class BukkitLocalQueue extends BasicLocalBlockQueue {
world.regenerate(region, editSession);
}
}
} else {
PlotSquared.debug("Error Regenerating Chunk");
}
}

View File

@ -29,6 +29,7 @@ import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.plotsquared.bukkit.BukkitPlatform;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.core.generator.AugmentedUtils;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
@ -58,6 +59,8 @@ import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayDeque;
import java.util.ArrayList;
@ -78,6 +81,8 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
@Singleton public class BukkitRegionManager extends RegionManager {
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitRegionManager.class.getSimpleName());
@Inject public BukkitRegionManager(@Nonnull final ChunkManager chunkManager) {
super(chunkManager);
}
@ -97,8 +102,6 @@ import static com.plotsquared.core.util.entity.EntityCategories.CAP_VEHICLE;
} else {
final Semaphore semaphore = new Semaphore(1);
try {
PlotSquared.debug("Attempting to make an asynchronous call to getLoadedChunks."
+ " Will halt the calling thread until completed.");
semaphore.acquire();
Bukkit.getScheduler().runTask(BukkitPlatform.getPlugin(BukkitPlatform.class), () -> {
for (Chunk chunk : Objects.requireNonNull(Bukkit.getWorld(world))

View File

@ -98,6 +98,8 @@ import org.bukkit.entity.Vehicle;
import org.bukkit.entity.WaterMob;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.Collection;
@ -113,6 +115,8 @@ import java.util.stream.Stream;
@SuppressWarnings({"unused", "WeakerAccess"})
@Singleton public class BukkitUtil extends WorldUtil {
private static final Logger logger = LoggerFactory.getLogger("P2/" + BukkitUtil.class.getSimpleName());
private static String lastString = null;
private static World lastWorld = null;
@ -472,7 +476,6 @@ import java.util.stream.Stream;
block.setType(Material.valueOf("OAK_WALL_SIGN"), false);
}
if (!(block.getBlockData() instanceof WallSign)) {
PlotSquared.debug(block.getBlockData().getAsString());
throw new RuntimeException("Something went wrong generating a sign");
}
final Directional sign = (Directional) block.getBlockData();
@ -513,7 +516,7 @@ import java.util.stream.Stream;
@Nonnull final BiomeType biomeType) {
final World world = getWorld(worldName);
if (world == null) {
PlotSquared.log("An error occurred setting the biome because the world was null.");
logger.warn("[P2] An error occured while setting the biome because the world was null", new RuntimeException());
return;
}
final Biome biome = BukkitAdapter.adapt(biomeType);
@ -627,7 +630,7 @@ import java.util.stream.Stream;
}
break;
default: {
PlotSquared.log(Captions.PREFIX + "Unknown entity category requested: " + category);
logger.error("[P2] Unknown entity category requested: {}", category);
}
break;
}

View File

@ -27,7 +27,6 @@ package com.plotsquared.bukkit.util;
import com.plotsquared.bukkit.entity.EntityWrapper;
import com.plotsquared.bukkit.entity.ReplicatingEntityWrapper;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.location.PlotLoc;
import com.sk89q.worldedit.bukkit.BukkitWorld;
@ -38,6 +37,8 @@ import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.HashMap;
import java.util.HashSet;
@ -46,6 +47,8 @@ import java.util.Set;
public class ContentMap {
private static final Logger logger = LoggerFactory.getLogger("P2/" + ContentMap.class.getSimpleName());
final Set<EntityWrapper> entities;
final Map<PlotLoc, BaseBlock[]> allBlocks;
@ -123,8 +126,7 @@ public class ContentMap {
try {
entity.spawn(world, xOffset, zOffset);
} catch (Exception e) {
PlotSquared.debug("Failed to restore entity (e): " + e.toString());
e.printStackTrace();
logger.error("[P2] Failed to restore entity", e);
}
}
this.entities.clear();

View File

@ -31,12 +31,13 @@ import com.google.gson.stream.JsonReader;
import com.google.inject.Inject;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.PlotVersion;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import org.bukkit.Bukkit;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitTask;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
@ -45,6 +46,8 @@ import java.net.URL;
public class UpdateUtility implements Listener {
private static final Logger logger = LoggerFactory.getLogger("P2/" + UpdateUtility.class.getSimpleName());
public static PlotVersion internalVersion;
public static String spigotVersion;
public static boolean hasUpdate;
@ -69,26 +72,22 @@ public class UpdateUtility implements Listener {
.getAsJsonObject();
spigotVersion = result.get("current_version").getAsString();
} catch (IOException e) {
PlotSquared.log(Captions.PREFIX + "&cUnable to check for updates because: " + e);
logger.error("[P2] Unable to check for updates. Error: {}", e.getMessage());
return;
}
if (internalVersion.isLaterVersion(spigotVersion)) {
PlotSquared
.log(Captions.PREFIX + "&6There appears to be a PlotSquared update available!");
PlotSquared.log(
Captions.PREFIX + "&6You are running version " + internalVersion.versionString()
+ ", &6latest version is " + spigotVersion);
PlotSquared
.log(Captions.PREFIX + "&6https://www.spigotmc.org/resources/77506/updates");
logger.info("[P2] There appears to be a PlotSquared update available!");
logger.info("[P2] You are running version {}, the latest version is {}",
internalVersion.versionString(), spigotVersion);
logger.info("[P2] https://www.spigotmc.org/resources/77506/updates");
hasUpdate = true;
if (Settings.UpdateChecker.NOTIFY_ONCE) {
cancelTask();
}
} else if (notify) {
notify = false;
PlotSquared.log(Captions.PREFIX
+ "Congratulations! You are running the latest PlotSquared version.");
logger.info("[P2] Congratulations! You are running the latest PlotSquared version");
}
}, 0L, Settings.UpdateChecker.POLL_RATE * 60 * 20);
}

View File

@ -26,14 +26,15 @@
package com.plotsquared.bukkit.uuid;
import com.google.common.util.concurrent.RateLimiter;
import com.plotsquared.core.PlotSquared;
import com.plotsquared.core.configuration.Captions;
import com.plotsquared.core.configuration.Settings;
import com.plotsquared.core.uuid.UUIDMapping;
import com.plotsquared.core.uuid.UUIDService;
import com.sk89q.squirrelid.Profile;
import com.sk89q.squirrelid.resolver.HttpRepositoryService;
import com.sk89q.squirrelid.resolver.ProfileService;
import javax.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import java.util.ArrayList;
@ -47,6 +48,8 @@ import java.util.UUID;
@SuppressWarnings("UnstableApiUsage")
public class SquirrelIdUUIDService implements UUIDService {
private static final Logger logger = LoggerFactory.getLogger("P2/" + SquirrelIdUUIDService.class.getSimpleName());
private final ProfileService profileService;
private final RateLimiter rateLimiter;
@ -78,7 +81,9 @@ public class SquirrelIdUUIDService implements UUIDService {
// go through them one by one
//
if (uuids.size() >= 2) {
PlotSquared.debug(Captions.PREFIX + "(UUID) Found invalid UUID in batch. Will try each UUID individually.");
if (Settings.DEBUG) {
logger.info("[P2] (UUID) Found invalid UUID in batch. Will try each UUID individually.");
}
for (final UUID uuid : uuids) {
final List<UUIDMapping> result = this.getNames(Collections.singletonList(uuid));
if (result.isEmpty()) {
@ -86,8 +91,8 @@ public class SquirrelIdUUIDService implements UUIDService {
}
results.add(result.get(0));
}
} else if (uuids.size() == 1) {
PlotSquared.debug(Captions.PREFIX + "(UUID) Found invalid UUID: " + uuids.get(0));
} else if (uuids.size() == 1 && Settings.DEBUG) {
logger.info("[P2] (UUID) Found invalid UUID: {}", uuids.get(0));
}
}
} catch (IOException | InterruptedException e) {