Refactor: Moved debug handling from Settings into separate package.
parent
0d07847990
commit
4e51fcb374
|
@ -35,6 +35,8 @@ import com.nisovin.shopkeepers.compat.NMSManager;
|
|||
import com.nisovin.shopkeepers.config.ConfigLoadException;
|
||||
import com.nisovin.shopkeepers.container.protection.ProtectedContainers;
|
||||
import com.nisovin.shopkeepers.container.protection.RemoveShopOnContainerBreak;
|
||||
import com.nisovin.shopkeepers.debug.Debug;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.itemconversion.ItemConversions;
|
||||
import com.nisovin.shopkeepers.metrics.CitizensChart;
|
||||
import com.nisovin.shopkeepers.metrics.FeaturesChart;
|
||||
|
@ -390,8 +392,8 @@ public class SKShopkeepersPlugin extends JavaPlugin implements ShopkeepersPlugin
|
|||
// Register debug listener:
|
||||
// Run delayed to also catch events / event listeners of other plugins.
|
||||
Bukkit.getScheduler().runTaskLater(this, () -> {
|
||||
boolean logAllEvent = Settings.debugOptions.contains(Settings.DebugOptions.logAllEvents);
|
||||
boolean printListeners = Settings.debugOptions.contains(Settings.DebugOptions.printListeners);
|
||||
boolean logAllEvent = Debug.isDebugging(DebugOptions.logAllEvents);
|
||||
boolean printListeners = Debug.isDebugging(DebugOptions.printListeners);
|
||||
if (logAllEvent || printListeners) {
|
||||
DebugListener.register(logAllEvent, printListeners);
|
||||
}
|
||||
|
@ -702,7 +704,7 @@ public class SKShopkeepersPlugin extends JavaPlugin implements ShopkeepersPlugin
|
|||
|
||||
// Updates owner names for the shopkeepers of the specified player:
|
||||
private void updateShopkeepersForPlayer(UUID playerUUID, String playerName) {
|
||||
Log.debug(Settings.DebugOptions.ownerNameUpdates,
|
||||
Log.debug(DebugOptions.ownerNameUpdates,
|
||||
() -> "Updating shopkeepers for: " + TextUtils.getPlayerString(playerName, playerUUID)
|
||||
);
|
||||
boolean dirty = false;
|
||||
|
@ -715,7 +717,7 @@ public class SKShopkeepersPlugin extends JavaPlugin implements ShopkeepersPlugin
|
|||
if (ownerUUID.equals(playerUUID)) {
|
||||
if (!ownerName.equals(playerName)) {
|
||||
// Update the stored name, because the player must have changed it:
|
||||
Log.debug(Settings.DebugOptions.ownerNameUpdates,
|
||||
Log.debug(DebugOptions.ownerNameUpdates,
|
||||
() -> " Updating owner name ('" + ownerName + "') of shopkeeper " + shopkeeper.getId() + "."
|
||||
);
|
||||
playerShop.setOwner(playerUUID, playerName);
|
||||
|
@ -724,7 +726,7 @@ public class SKShopkeepersPlugin extends JavaPlugin implements ShopkeepersPlugin
|
|||
// The stored owner name matches the player's current name.
|
||||
// Assumption: The stored owner names among all shops are consistent.
|
||||
// We can therefore abort checking the other shops here.
|
||||
Log.debug(Settings.DebugOptions.ownerNameUpdates,
|
||||
Log.debug(DebugOptions.ownerNameUpdates,
|
||||
() -> " The stored owner name of shopkeeper " + shopkeeper.getId()
|
||||
+ " matches the current player name. Skipping checking of further shops."
|
||||
);
|
||||
|
|
|
@ -9,7 +9,6 @@ import java.util.Set;
|
|||
import java.util.regex.Pattern;
|
||||
import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
@ -238,45 +237,6 @@ public class Settings extends Config {
|
|||
public static int highCurrencyValue = 9;
|
||||
public static int highCurrencyMinCost = 20;
|
||||
|
||||
///// DEBUGGING
|
||||
|
||||
public static final class DebugOptions {
|
||||
private DebugOptions() {
|
||||
}
|
||||
|
||||
// Logs details of the server version dependent capabilities.
|
||||
public static final String capabilities = "capabilities";
|
||||
// Logs all events (spams!). Starts slightly delayed. Subsequent calls of the same event get combined into a
|
||||
// single logging entry to slightly reduce spam.
|
||||
public static final String logAllEvents = "log-all-events";
|
||||
// Prints the registered listeners for the first call of each event.
|
||||
public static final String printListeners = "print-listeners";
|
||||
// Enables debugging output related to shopkeeper activation.
|
||||
public static final String shopkeeperActivation = "shopkeeper-activation";
|
||||
// Enables additional commands related debugging output.
|
||||
public static final String commands = "commands";
|
||||
// Logs information when updating stored shop owner names.
|
||||
public static final String ownerNameUpdates = "owner-name-updates";
|
||||
// Logs whenever a shopkeeper performs item migrations (eg. for trading offers).
|
||||
public static final String itemMigrations = "item-migrations";
|
||||
// Logs whenever we explicitly convert items to Spigot's data format. Note that this does not log when items get
|
||||
// implicitly converted, which may happen under various circumstances.
|
||||
public static final String itemConversions = "item-conversions";
|
||||
}
|
||||
|
||||
public static boolean isDebugging() {
|
||||
return isDebugging(null);
|
||||
}
|
||||
|
||||
public static boolean isDebugging(String option) {
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
return Settings.debug && (option == null || Settings.debugOptions.contains(option));
|
||||
} else {
|
||||
AsyncSettings async = Settings.async();
|
||||
return async.debug && (option == null || async.debugOptions.contains(option));
|
||||
}
|
||||
}
|
||||
|
||||
///// DERIVED SETTINGS
|
||||
|
||||
public static class MaxShopsPermission implements Comparable<MaxShopsPermission> {
|
||||
|
|
|
@ -13,8 +13,8 @@ import org.bukkit.ChatColor;
|
|||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.nisovin.shopkeepers.Messages;
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
import com.nisovin.shopkeepers.commands.lib.arguments.FallbackArgument;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.text.Text;
|
||||
import com.nisovin.shopkeepers.util.Log;
|
||||
import com.nisovin.shopkeepers.util.MapUtils;
|
||||
|
@ -464,11 +464,11 @@ public abstract class Command {
|
|||
ArgumentsReader argsReader = new ArgumentsReader(input);
|
||||
try {
|
||||
this.processCommand(input, context, argsReader);
|
||||
Log.debug(Settings.DebugOptions.commands, () -> "Command succeeded. Context: " + context.toString());
|
||||
Log.debug(DebugOptions.commands, () -> "Command succeeded. Context: " + context.toString());
|
||||
} catch (CommandException e) {
|
||||
TextUtils.sendMessage(sender, e.getMessageText());
|
||||
|
||||
Log.debug(Settings.DebugOptions.commands, () -> {
|
||||
Log.debug(DebugOptions.commands, () -> {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("Command failed. Argument chain: ");
|
||||
CommandArgument<?> argument = null;
|
||||
|
@ -478,8 +478,8 @@ public abstract class Command {
|
|||
sb.append(this.getArgumentChain(argument));
|
||||
return sb.toString();
|
||||
});
|
||||
Log.debug(Settings.DebugOptions.commands, () -> "Context: " + context.toString());
|
||||
Log.debug(Settings.DebugOptions.commands, () -> "Arguments reader: " + argsReader.toString());
|
||||
Log.debug(DebugOptions.commands, () -> "Context: " + context.toString());
|
||||
Log.debug(DebugOptions.commands, () -> "Arguments reader: " + argsReader.toString());
|
||||
} catch (Exception e) {
|
||||
// An unexpected exception was caught:
|
||||
TextUtils.sendMessage(sender, Text.color(ChatColor.RED).text("An error occurred during command handling! Check the console log."));
|
||||
|
@ -717,7 +717,7 @@ public abstract class Command {
|
|||
// On success this stores any parsed values inside the context:
|
||||
argument.parse(parsingContext.input, context, argsReader);
|
||||
} catch (FallbackArgumentException e) {
|
||||
Log.debug(Settings.DebugOptions.commands, () -> "Fallback for argument '" + argument.getName() + "': " + e.getMessage());
|
||||
Log.debug(DebugOptions.commands, () -> "Fallback for argument '" + argument.getName() + "': " + e.getMessage());
|
||||
argsReader.setState(argsReaderState); // Restore previous args reader state
|
||||
|
||||
// Keep track of context changes while continuing with the pending fallback:
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.inventory.ItemStack;
|
|||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import com.nisovin.shopkeepers.Messages;
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
import com.nisovin.shopkeepers.api.ShopkeepersPlugin;
|
||||
import com.nisovin.shopkeepers.commands.lib.Command;
|
||||
import com.nisovin.shopkeepers.commands.lib.CommandContextView;
|
||||
|
@ -18,6 +17,7 @@ import com.nisovin.shopkeepers.commands.lib.arguments.LiteralArgument;
|
|||
import com.nisovin.shopkeepers.commands.lib.arguments.OptionalArgument;
|
||||
import com.nisovin.shopkeepers.commands.lib.arguments.PlayerArgument;
|
||||
import com.nisovin.shopkeepers.commands.lib.arguments.SenderPlayerFallback;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.util.ItemUtils;
|
||||
import com.nisovin.shopkeepers.util.Log;
|
||||
import com.nisovin.shopkeepers.util.PermissionUtils;
|
||||
|
@ -78,7 +78,7 @@ class CommandConvertItems extends Command {
|
|||
final int finalConvertedStacks = convertedStacks;
|
||||
// Note: The conversion always has some performance impact, even if no items got actually converted. We
|
||||
// therefore always print the debug messages to allow debugging the item conversion times.
|
||||
Log.debug(Settings.DebugOptions.itemConversions,
|
||||
Log.debug(DebugOptions.itemConversions,
|
||||
() -> "Converted " + finalConvertedStacks + " item stacks in the inventory of player '"
|
||||
+ targetPlayer.getName() + "' (took " + durationMillis + " ms)."
|
||||
);
|
||||
|
@ -96,7 +96,7 @@ class CommandConvertItems extends Command {
|
|||
}
|
||||
// Note: The conversion always has some performance impact, even if no items got actually converted. We
|
||||
// therefore always print the debug messages to allow debugging the item conversion times.
|
||||
Log.debug(Settings.DebugOptions.itemConversions,
|
||||
Log.debug(DebugOptions.itemConversions,
|
||||
() -> "Converted the held item stack of player '" + targetPlayer.getName()
|
||||
+ "' (took " + durationMillis + " ms)."
|
||||
);
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.nisovin.shopkeepers.compat;
|
|||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.util.Log;
|
||||
|
||||
// TODO This can be removed once we only support Bukkit 1.16.1 upwards.
|
||||
|
@ -49,10 +49,10 @@ public class MC_1_16_Utils {
|
|||
private static EntityType getEntityType(String name) {
|
||||
try {
|
||||
EntityType entityType = EntityType.valueOf(name); // not null
|
||||
Log.debug(Settings.DebugOptions.capabilities, "Server knows EntityType '" + name + "'.");
|
||||
Log.debug(DebugOptions.capabilities, "Server knows EntityType '" + name + "'.");
|
||||
return entityType;
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.debug(Settings.DebugOptions.capabilities, "Server does not know EntityType '" + name + "'.");
|
||||
Log.debug(DebugOptions.capabilities, "Server does not know EntityType '" + name + "'.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -60,10 +60,10 @@ public class MC_1_16_Utils {
|
|||
private static Material getMaterial(String name) {
|
||||
try {
|
||||
Material material = Material.valueOf(name); // not null
|
||||
Log.debug(Settings.DebugOptions.capabilities, "Server knows Material '" + name + "'.");
|
||||
Log.debug(DebugOptions.capabilities, "Server knows Material '" + name + "'.");
|
||||
return material;
|
||||
} catch (IllegalArgumentException e) {
|
||||
Log.debug(Settings.DebugOptions.capabilities, "Server does not know Material '" + name + "'.");
|
||||
Log.debug(DebugOptions.capabilities, "Server does not know Material '" + name + "'.");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.nisovin.shopkeepers.debug;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
|
||||
public class Debug {
|
||||
|
||||
public static boolean isDebugging() {
|
||||
return isDebugging(null);
|
||||
}
|
||||
|
||||
public static boolean isDebugging(String option) {
|
||||
if (Bukkit.isPrimaryThread()) {
|
||||
return Settings.debug && (option == null || Settings.debugOptions.contains(option));
|
||||
} else {
|
||||
Settings.AsyncSettings async = Settings.async();
|
||||
return async.debug && (option == null || async.debugOptions.contains(option));
|
||||
}
|
||||
}
|
||||
|
||||
private Debug() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
package com.nisovin.shopkeepers.debug;
|
||||
|
||||
public final class DebugOptions {
|
||||
|
||||
// Logs details of the server version dependent capabilities.
|
||||
public static final String capabilities = "capabilities";
|
||||
// Logs all events (spams!). Starts slightly delayed. Subsequent calls of the same event get combined into a
|
||||
// single logging entry to slightly reduce spam.
|
||||
public static final String logAllEvents = "log-all-events";
|
||||
// Prints the registered listeners for the first call of each event.
|
||||
public static final String printListeners = "print-listeners";
|
||||
// Enables debugging output related to shopkeeper activation.
|
||||
public static final String shopkeeperActivation = "shopkeeper-activation";
|
||||
// Enables additional commands related debugging output.
|
||||
public static final String commands = "commands";
|
||||
// Logs information when updating stored shop owner names.
|
||||
public static final String ownerNameUpdates = "owner-name-updates";
|
||||
// Logs whenever a shopkeeper performs item migrations (eg. for trading offers).
|
||||
public static final String itemMigrations = "item-migrations";
|
||||
// Logs whenever we explicitly convert items to Spigot's data format. Note that this does not log when items get
|
||||
// implicitly converted, which may happen under various circumstances.
|
||||
public static final String itemConversions = "item-conversions";
|
||||
|
||||
private DebugOptions() {
|
||||
}
|
||||
}
|
|
@ -15,6 +15,7 @@ import com.nisovin.shopkeepers.api.ShopkeepersPlugin;
|
|||
import com.nisovin.shopkeepers.api.shopkeeper.Shopkeeper;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopkeeper;
|
||||
import com.nisovin.shopkeepers.container.ShopContainers;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.util.ItemUtils;
|
||||
import com.nisovin.shopkeepers.util.Log;
|
||||
import com.nisovin.shopkeepers.util.TextUtils;
|
||||
|
@ -83,7 +84,7 @@ public class ItemConversions {
|
|||
long durationMillis = (System.nanoTime() - start) / 1000000L;
|
||||
// Note: The conversion always has some performance impact, even if no items got actually converted. We
|
||||
// therefore always print the debug messages to allow debugging the item conversion times.
|
||||
Log.debug(Settings.DebugOptions.itemConversions,
|
||||
Log.debug(DebugOptions.itemConversions,
|
||||
() -> "Converted " + convertedContainerStacks + " affected item stacks in the container of shopkeeper "
|
||||
+ shopkeeper.getId() + ", triggered by player '" + player.getName()
|
||||
+ "' (took " + durationMillis + " ms)."
|
||||
|
@ -110,7 +111,7 @@ public class ItemConversions {
|
|||
long durationMillis = (System.nanoTime() - start) / 1000000L;
|
||||
// Note: The conversion always has some performance impact, even if no items got actually converted. We
|
||||
// therefore always print the debug messages to allow debugging the item conversion times.
|
||||
Log.debug(Settings.DebugOptions.itemConversions,
|
||||
Log.debug(DebugOptions.itemConversions,
|
||||
() -> "Converted " + convertedStacks + " affected item stacks in the inventory of player '"
|
||||
+ player.getName() + "' (took " + durationMillis + " ms)."
|
||||
);
|
||||
|
|
|
@ -35,6 +35,7 @@ import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopkeeper;
|
|||
import com.nisovin.shopkeepers.api.shopobjects.ShopObject;
|
||||
import com.nisovin.shopkeepers.api.shopobjects.ShopObjectType;
|
||||
import com.nisovin.shopkeepers.api.util.ChunkCoords;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.shopkeeper.player.AbstractPlayerShopkeeper;
|
||||
import com.nisovin.shopkeepers.shopobjects.AbstractShopObject;
|
||||
import com.nisovin.shopkeepers.shopobjects.block.AbstractBlockShopObjectType;
|
||||
|
@ -483,7 +484,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
// Spawn shopkeeper in active chunk:
|
||||
this.spawnShopkeeper(shopkeeper);
|
||||
} else {
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Skipping spawning of shopkeeper at " + shopkeeper.getPositionString() + " due to pending respawn after world save."
|
||||
);
|
||||
}
|
||||
|
@ -606,12 +607,12 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
// Chunk is not expected to already be active or pending activation (if chunk loading and unloading events are
|
||||
// consistently ordered and correctly handled by us):
|
||||
if (chunkEntry.active) {
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Detected chunk load for already active chunk: " + TextUtils.getChunkString(chunkCoords)
|
||||
);
|
||||
return;
|
||||
} else if (chunkEntry.isActivationPending()) {
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Detected chunk load for already pending chunk activation: " + TextUtils.getChunkString(chunkCoords)
|
||||
);
|
||||
return;
|
||||
|
@ -649,14 +650,14 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
if (shopkeepers.isEmpty()) return;
|
||||
|
||||
if (chunkEntry.worldEntry.isWorldSaveRespawnPending()) {
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Skipping spawning of " + shopkeepers.size() + " shopkeepers in chunk " + TextUtils.getChunkString(chunkEntry.chunkCoords)
|
||||
+ ": Respawn pending after world save."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Spawning " + shopkeepers.size() + " shopkeepers in chunk " + TextUtils.getChunkString(chunkEntry.chunkCoords)
|
||||
+ (worldSavingFinished ? " (world saving finished)" : "")
|
||||
);
|
||||
|
@ -711,7 +712,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
Collection<? extends AbstractShopkeeper> shopkeepers = chunkEntry.shopkeepers;
|
||||
if (shopkeepers.isEmpty()) return;
|
||||
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Despawning " + shopkeepers.size() + " shopkeepers in chunk " + TextUtils.getChunkString(chunkEntry.chunkCoords)
|
||||
+ (worldSaving ? " (world saving)" : "")
|
||||
);
|
||||
|
@ -753,7 +754,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
WorldShopkeepers worldEntry = shopkeepersByWorld.get(worldName);
|
||||
if (worldEntry == null) return; // There are no shopkeepers in this world
|
||||
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Spawning " + worldEntry.shopkeeperCount + " shopkeepers in world '" + worldName + "'"
|
||||
);
|
||||
|
||||
|
@ -790,7 +791,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
WorldShopkeepers worldEntry = shopkeepersByWorld.get(worldName);
|
||||
if (worldEntry == null) return; // There are no shopkeepers in this world
|
||||
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Despawning " + worldEntry.shopkeeperCount + " shopkeepers in world '" + worldName + "'"
|
||||
);
|
||||
|
||||
|
@ -812,7 +813,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
|
||||
if (worldEntry.isWorldSaveRespawnPending()) {
|
||||
// Already despawned the shopkeepers due to another world save just recently.
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Detected another world save while shopkeepers were already despawned due to a previous world save: " + worldName
|
||||
);
|
||||
return;
|
||||
|
@ -829,7 +830,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
|
||||
private void despawnShopkeepersInWorld(WorldShopkeepers worldEntry, boolean worldSaving) {
|
||||
assert worldEntry != null;
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Despawning " + worldEntry.shopkeeperCount + " shopkeepers in world '" + worldEntry.worldName + "'"
|
||||
+ (worldSaving ? " (world saving)" : "")
|
||||
);
|
||||
|
@ -842,7 +843,7 @@ public class SKShopkeeperRegistry implements ShopkeeperRegistry {
|
|||
|
||||
private void spawnShopkeepersInWorld(WorldShopkeepers worldEntry, boolean worldSavingFinished) {
|
||||
assert worldEntry != null;
|
||||
Log.debug(Settings.DebugOptions.shopkeeperActivation,
|
||||
Log.debug(DebugOptions.shopkeeperActivation,
|
||||
() -> "Spawning " + worldEntry.shopkeeperCount + " shopkeepers in world '" + worldEntry.worldName + "'"
|
||||
+ (worldSavingFinished ? " (world saving finished)" : "")
|
||||
);
|
||||
|
|
|
@ -7,7 +7,6 @@ import java.util.List;
|
|||
import org.bukkit.configuration.ConfigurationSection;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
import com.nisovin.shopkeepers.api.ShopkeepersAPI;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.ShopCreationData;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.ShopkeeperCreateException;
|
||||
|
@ -15,6 +14,7 @@ import com.nisovin.shopkeepers.api.shopkeeper.TradingRecipe;
|
|||
import com.nisovin.shopkeepers.api.shopkeeper.admin.regular.RegularAdminShopkeeper;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.offers.TradingOffer;
|
||||
import com.nisovin.shopkeepers.api.ui.DefaultUITypes;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.shopkeeper.AbstractShopkeeper;
|
||||
import com.nisovin.shopkeepers.shopkeeper.SKDefaultShopTypes;
|
||||
import com.nisovin.shopkeepers.shopkeeper.admin.AbstractAdminShopkeeper;
|
||||
|
@ -69,7 +69,7 @@ public class SKRegularAdminShopkeeper extends AbstractAdminShopkeeper implements
|
|||
List<SKTradingOffer> offers = SKTradingOffer.loadFromConfig(configSection, "recipes", "Shopkeeper " + this.getId());
|
||||
List<SKTradingOffer> migratedOffers = SKTradingOffer.migrateItems(offers, "Shopkeeper " + this.getId());
|
||||
if (offers != migratedOffers) {
|
||||
Log.debug(Settings.DebugOptions.itemMigrations,
|
||||
Log.debug(DebugOptions.itemMigrations,
|
||||
() -> "Shopkeeper " + this.getId() + ": Migrated trading offer items."
|
||||
);
|
||||
this.markDirty();
|
||||
|
|
|
@ -29,6 +29,7 @@ import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopkeeper;
|
|||
import com.nisovin.shopkeepers.api.shopobjects.DefaultShopObjectTypes;
|
||||
import com.nisovin.shopkeepers.api.ui.DefaultUITypes;
|
||||
import com.nisovin.shopkeepers.container.ShopContainers;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.shopkeeper.AbstractShopkeeper;
|
||||
import com.nisovin.shopkeepers.shopobjects.citizens.SKCitizensShopObject;
|
||||
import com.nisovin.shopkeepers.shopobjects.sign.SKSignShopObject;
|
||||
|
@ -132,7 +133,7 @@ public abstract class AbstractPlayerShopkeeper extends AbstractShopkeeper implem
|
|||
hireCost = null;
|
||||
} else {
|
||||
hireCost = migratedHireCost;
|
||||
Log.debug(Settings.DebugOptions.itemMigrations,
|
||||
Log.debug(DebugOptions.itemMigrations,
|
||||
() -> "Shopkeeper " + this.getId() + ": Migrated hire cost item."
|
||||
);
|
||||
}
|
||||
|
|
|
@ -17,6 +17,7 @@ import com.nisovin.shopkeepers.api.shopkeeper.offers.PriceOffer;
|
|||
import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopCreationData;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.player.buy.BuyingPlayerShopkeeper;
|
||||
import com.nisovin.shopkeepers.api.ui.DefaultUITypes;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.shopkeeper.AbstractShopkeeper;
|
||||
import com.nisovin.shopkeepers.shopkeeper.SKDefaultShopTypes;
|
||||
import com.nisovin.shopkeepers.shopkeeper.offers.SKPriceOffer;
|
||||
|
@ -80,7 +81,7 @@ public class SKBuyingPlayerShopkeeper extends AbstractPlayerShopkeeper implement
|
|||
List<SKPriceOffer> offers = SKPriceOffer.loadFromConfig(configSection, "offers", "Shopkeeper " + this.getId());
|
||||
List<SKPriceOffer> migratedOffers = SKPriceOffer.migrateItems(offers, "Shopkeeper " + this.getId());
|
||||
if (offers != migratedOffers) {
|
||||
Log.debug(Settings.DebugOptions.itemMigrations,
|
||||
Log.debug(DebugOptions.itemMigrations,
|
||||
() -> "Shopkeeper " + this.getId() + ": Migrated trading offer items."
|
||||
);
|
||||
this.markDirty();
|
||||
|
|
|
@ -16,6 +16,7 @@ import com.nisovin.shopkeepers.api.shopkeeper.offers.PriceOffer;
|
|||
import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopCreationData;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.player.sell.SellingPlayerShopkeeper;
|
||||
import com.nisovin.shopkeepers.api.ui.DefaultUITypes;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.shopkeeper.AbstractShopkeeper;
|
||||
import com.nisovin.shopkeepers.shopkeeper.SKDefaultShopTypes;
|
||||
import com.nisovin.shopkeepers.shopkeeper.offers.SKPriceOffer;
|
||||
|
@ -77,7 +78,7 @@ public class SKSellingPlayerShopkeeper extends AbstractPlayerShopkeeper implemen
|
|||
List<SKPriceOffer> offers = SKPriceOffer.loadFromConfig(configSection, "offers", "Shopkeeper " + this.getId());
|
||||
List<SKPriceOffer> migratedOffers = SKPriceOffer.migrateItems(offers, "Shopkeeper " + this.getId());
|
||||
if (offers != migratedOffers) {
|
||||
Log.debug(Settings.DebugOptions.itemMigrations,
|
||||
Log.debug(DebugOptions.itemMigrations,
|
||||
() -> "Shopkeeper " + this.getId() + ": Migrated trading offer items."
|
||||
);
|
||||
this.markDirty();
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
import com.nisovin.shopkeepers.api.ShopkeepersAPI;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.ShopkeeperCreateException;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.TradingRecipe;
|
||||
|
@ -16,6 +15,7 @@ import com.nisovin.shopkeepers.api.shopkeeper.offers.TradingOffer;
|
|||
import com.nisovin.shopkeepers.api.shopkeeper.player.PlayerShopCreationData;
|
||||
import com.nisovin.shopkeepers.api.shopkeeper.player.trade.TradingPlayerShopkeeper;
|
||||
import com.nisovin.shopkeepers.api.ui.DefaultUITypes;
|
||||
import com.nisovin.shopkeepers.debug.DebugOptions;
|
||||
import com.nisovin.shopkeepers.shopkeeper.AbstractShopkeeper;
|
||||
import com.nisovin.shopkeepers.shopkeeper.SKDefaultShopTypes;
|
||||
import com.nisovin.shopkeepers.shopkeeper.offers.SKTradingOffer;
|
||||
|
@ -70,7 +70,7 @@ public class SKTradingPlayerShopkeeper extends AbstractPlayerShopkeeper implemen
|
|||
List<SKTradingOffer> offers = SKTradingOffer.loadFromConfig(configSection, "offers", "Shopkeeper " + this.getId());
|
||||
List<SKTradingOffer> migratedOffers = SKTradingOffer.migrateItems(offers, "Shopkeeper " + this.getId());
|
||||
if (offers != migratedOffers) {
|
||||
Log.debug(Settings.DebugOptions.itemMigrations,
|
||||
Log.debug(DebugOptions.itemMigrations,
|
||||
() -> "Shopkeeper " + this.getId() + ": Migrated trading offer items."
|
||||
);
|
||||
this.markDirty();
|
||||
|
|
|
@ -4,7 +4,7 @@ import java.util.function.Supplier;
|
|||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.nisovin.shopkeepers.Settings;
|
||||
import com.nisovin.shopkeepers.debug.Debug;
|
||||
|
||||
public final class Log {
|
||||
|
||||
|
@ -40,13 +40,13 @@ public final class Log {
|
|||
}
|
||||
|
||||
public static void debug(String debugOption, String message) {
|
||||
if (Settings.isDebugging(debugOption)) {
|
||||
if (Debug.isDebugging(debugOption)) {
|
||||
info(message);
|
||||
}
|
||||
}
|
||||
|
||||
public static void debug(String debugOption, Supplier<String> msgSupplier) {
|
||||
if (Settings.isDebugging(debugOption)) {
|
||||
if (Debug.isDebugging(debugOption)) {
|
||||
info(msgSupplier);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue