Added some debug messages

This commit is contained in:
Teriuihi 2021-12-23 03:14:08 +01:00
parent 9ece3e6d5d
commit bf43f88d9b
3 changed files with 14 additions and 0 deletions

View File

@ -57,6 +57,8 @@ public class VillagerUI extends JavaPlugin {
new BukkitRunnable() { new BukkitRunnable() {
@Override @Override
public void run() { public void run() {
if (Config.DEBUG)
Logger.info("Syncing users.");
EconUser.getEconUsers().forEach(econUser -> { EconUser.getEconUsers().forEach(econUser -> {
econUser.removePoints(); econUser.removePoints();
econUser.syncPoints(); econUser.syncPoints();

View File

@ -90,6 +90,7 @@ public final class Config extends AbstractConfig {
public static String NOT_ENOUGH_ITEMS = "<red>You only have don't have enough <type> you need at least <amount>.</red>"; public static String NOT_ENOUGH_ITEMS = "<red>You only have don't have enough <type> you need at least <amount>.</red>";
public static String PURCHASED_ITEM = "<green>You bought <amount> <item> for <price>!</green>"; public static String PURCHASED_ITEM = "<green>You bought <amount> <item> for <price>!</green>";
public static String SOLD_ITEM = "<green>You sold <amount> <item> for <price>!</green>"; public static String SOLD_ITEM = "<green>You sold <amount> <item> for <price>!</green>";
private static void loadMessages() { private static void loadMessages() {
NOT_ENOUGH_MONEY = config.getString("messages.not-enough-money", NOT_ENOUGH_MONEY); NOT_ENOUGH_MONEY = config.getString("messages.not-enough-money", NOT_ENOUGH_MONEY);
NOT_ENOUGH_ITEMS = config.getString("messages.not-enough-items", NOT_ENOUGH_ITEMS); NOT_ENOUGH_ITEMS = config.getString("messages.not-enough-items", NOT_ENOUGH_ITEMS);
@ -97,6 +98,12 @@ public final class Config extends AbstractConfig {
SOLD_ITEM = config.getString("messages.sold-item", SOLD_ITEM); SOLD_ITEM = config.getString("messages.sold-item", SOLD_ITEM);
} }
public static boolean DEBUG = false;
private static void loadSettings() {
DEBUG = config.getBoolean("settings.debug", DEBUG);
}
private static void loadVillagerTypes() { private static void loadVillagerTypes() {
VillagerType.clearVillagerTypes(); VillagerType.clearVillagerTypes();
ConfigurationSection configurationSection = config.getConfigurationSection("villager-types"); ConfigurationSection configurationSection = config.getConfigurationSection("villager-types");

View File

@ -1,8 +1,10 @@
package com.alttd.events; package com.alttd.events;
import com.alttd.VillagerUI; import com.alttd.VillagerUI;
import com.alttd.config.Config;
import com.alttd.database.Queries; import com.alttd.database.Queries;
import com.alttd.objects.EconUser; import com.alttd.objects.EconUser;
import com.alttd.util.Logger;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
@ -21,6 +23,9 @@ public class LoginEvent implements Listener {
int minutes = Queries.getMinutesSinceUpdated(uuid); int minutes = Queries.getMinutesSinceUpdated(uuid);
user.removePoints(minutes * 2); user.removePoints(minutes * 2);
if (Config.DEBUG)
Logger.info("Loaded EconUser for % and removed % points",
event.getPlayer().getName(), String.valueOf(minutes * 2));
} }
}.runTask(VillagerUI.getInstance()); }.runTask(VillagerUI.getInstance());
} }