Skip to content

Commit

Permalink
Changed the way the plugin debug and logs messages
Browse files Browse the repository at this point in the history
  • Loading branch information
OmerBenGera committed Oct 2, 2022
1 parent 8709940 commit 953b9f1
Show file tree
Hide file tree
Showing 172 changed files with 1,605 additions and 1,313 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.bgsoftware.superiorskyblock.api.objects.Pair;
import com.bgsoftware.superiorskyblock.core.Materials;
import com.bgsoftware.superiorskyblock.core.key.KeyImpl;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.google.common.base.Preconditions;
import gcspawners.ASAPI;
import gcspawners.AdvancedSpawnerPlaceEvent;
Expand All @@ -29,7 +30,7 @@ public SpawnersProvider_AdvancedSpawners(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new SpawnersProvider_AdvancedSpawners.StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using AdvancedSpawners as a spawners provider.");
Log.info("Using AdvancedSpawners as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
package com.bgsoftware.superiorskyblock.external.afk;

import com.Zrips.CMI.CMI;
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.hooks.AFKProvider;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.google.common.base.Preconditions;
import org.bukkit.entity.Player;

public class AFKProvider_CMI implements AFKProvider {

public AFKProvider_CMI() {
SuperiorSkyblockPlugin.log("Hooked into CMI for support of afk status of players.");
Log.info("Hooked into CMI for support of afk status of players.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.hooks.VanishProvider;
import com.bgsoftware.superiorskyblock.core.Singleton;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.listener.PlayersListener;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
Expand All @@ -29,7 +30,7 @@ public VanishProvider_CMI(SuperiorSkyblockPlugin plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}

SuperiorSkyblockPlugin.log("Hooked into CMI for support of vanish status of players.");
Log.info("Hooked into CMI for support of vanish status of players.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import com.bgsoftware.superiorskyblock.core.Materials;
import com.bgsoftware.superiorskyblock.core.formatting.Formatters;
import com.bgsoftware.superiorskyblock.core.key.ConstantKeys;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.core.messages.Message;
import com.bgsoftware.superiorskyblock.core.threads.BukkitExecutor;
import com.bgsoftware.superiorskyblock.external.spawners.SpawnersProvider_AutoDetect;
import com.google.common.base.Preconditions;
import com.songoda.epicspawners.EpicSpawners;
import com.songoda.epicspawners.api.events.SpawnerBreakEvent;
Expand All @@ -36,7 +36,7 @@ public SpawnersProvider_EpicSpawners6(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using EpicSpawners as a spawners provider.");
Log.info("Using EpicSpawners as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.bgsoftware.superiorskyblock.core.Materials;
import com.bgsoftware.superiorskyblock.core.formatting.Formatters;
import com.bgsoftware.superiorskyblock.core.key.ConstantKeys;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.core.messages.Message;
import com.bgsoftware.superiorskyblock.core.threads.BukkitExecutor;
import com.google.common.base.Preconditions;
Expand Down Expand Up @@ -37,7 +38,7 @@ public SpawnersProvider_EpicSpawners7(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new SpawnersProvider_EpicSpawners7.StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using EpicSpawners as a spawners provider.");
Log.info("Using EpicSpawners as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.bgsoftware.superiorskyblock.external.afk;

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.hooks.AFKProvider;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.earth2me.essentials.Essentials;
import com.google.common.base.Preconditions;
import org.bukkit.entity.Player;
Expand All @@ -13,7 +13,7 @@ public class AFKProvider_Essentials implements AFKProvider {

public AFKProvider_Essentials() {
instance = JavaPlugin.getPlugin(Essentials.class);
SuperiorSkyblockPlugin.log("Hooked into Essentials for support of afk status of players.");
Log.info("Hooked into Essentials for support of afk status of players.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.hooks.VanishProvider;
import com.bgsoftware.superiorskyblock.core.Singleton;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.listener.PlayersListener;
import com.earth2me.essentials.Essentials;
import net.ess3.api.events.VanishStatusChangeEvent;
Expand Down Expand Up @@ -31,7 +32,7 @@ public VanishProvider_Essentials(SuperiorSkyblockPlugin plugin) {
Bukkit.getPluginManager().registerEvents(this, plugin);
}

SuperiorSkyblockPlugin.log("Hooked into Essentials for support of vanish status of players.");
Log.info("Hooked into Essentials for support of vanish status of players.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.key.Key;
import com.bgsoftware.superiorskyblock.api.schematic.Schematic;
import com.bgsoftware.superiorskyblock.core.formatting.Formatters;
import com.bgsoftware.superiorskyblock.core.ChunkPosition;
import com.bgsoftware.superiorskyblock.core.key.KeyImpl;
import com.bgsoftware.superiorskyblock.core.logging.Debug;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.world.schematic.BaseSchematic;
import com.bgsoftware.superiorskyblock.core.debug.PluginDebugger;
import com.bgsoftware.superiorskyblock.core.ChunkPosition;
import com.boydti.fawe.object.clipboard.FaweClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.blocks.BaseBlock;
Expand Down Expand Up @@ -64,8 +64,8 @@ public void pasteSchematic(Island island, Location location, Runnable callback)
@Override
public void pasteSchematic(Island island, Location location, Runnable callback, Consumer<Throwable> onFailure) {
try {
PluginDebugger.debug("Action: Paste Schematic, Island: " + island.getOwner().getName() + ", Location: " +
Formatters.LOCATION_FORMATTER.format(location) + ", Schematic: " + name);
Log.debug(Debug.PASTE_SCHEMATIC, "WorldEditSchematic", "pasteSchematic",
this.name, island.getOwner().getName(), location);

Object _point = AT.invoke(null, location.getBlockX(), location.getBlockY(), location.getBlockZ());
EditSession editSession = PASTE.invoke(schematic, new BukkitWorld(location.getWorld()), _point, false, true, null);
Expand All @@ -76,6 +76,9 @@ public void pasteSchematic(Island island, Location location, Runnable callback,
}

editSession.addNotifyTask(() -> {
Log.debugResult(Debug.PASTE_SCHEMATIC, "WorldEditSchematic", "pasteSchematic",
"Task Finished", "");

try {
island.handleBlocksPlace(cachedCounts);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.core.Singleton;
import com.bgsoftware.superiorskyblock.core.debug.PluginDebugger;
import com.bgsoftware.superiorskyblock.core.key.KeyImpl;
import com.bgsoftware.superiorskyblock.core.logging.Debug;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.listener.BlockChangesListener;
import com.bgsoftware.superiorskyblock.listener.StackedBlocksListener;
import me.jet315.minions.events.MinerBlockBreakEvent;
Expand Down Expand Up @@ -32,7 +33,8 @@ public static void register(SuperiorSkyblockPlugin plugin) {

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onMinionBreak(MinerBlockBreakEvent e) {
PluginDebugger.debug("Action: Jets Minion Break, Block: " + e.getBlock().getLocation() + ", Type: " + e.getBlock().getType());
Log.debug(Debug.BLOCK_BREAK, "JetsMinionsHook", "onMinionBreak", e.getBlock().getLocation(),
e.getBlock().getType());
if (stackedBlocksListener.get().tryUnstack(null, e.getBlock())) {
e.setCancelled(true);
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.bgsoftware.superiorskyblock.external.permissions;

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.hooks.PermissionsProvider;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import net.luckperms.api.LuckPerms;
import net.luckperms.api.cacheddata.CachedDataManager;
import net.luckperms.api.model.user.User;
Expand All @@ -19,11 +19,10 @@ public static boolean isCompatible() {
try {
CachedDataManager.class.getMethod("getPermissionData");
luckPerms = Bukkit.getServicesManager().getRegistration(LuckPerms.class).getProvider();
SuperiorSkyblockPlugin.log("Using LuckPerms as a permissions provider.");
Log.info("Using LuckPerms as a permissions provider.");
return true;
} catch (Throwable ex) {
SuperiorSkyblockPlugin.log("&cYou are using an outdated version of LuckPerms. " +
"It's recommended to update for a more optimized experience (v5.1+).");
Log.warn("You are using an outdated version of LuckPerms. It's recommended to update for a more optimized experience (v5.1+).");
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import be.maximvdw.placeholderapi.PlaceholderAPI;
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.external.placeholders.PlaceholdersProvider;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.service.placeholders.PlaceholdersServiceImpl;
import org.bukkit.OfflinePlayer;

Expand All @@ -14,7 +14,7 @@ public class PlaceholdersProvider_MVdWPlaceholderAPI implements PlaceholdersProv
private static final Pattern BUILT_IN_NUMERIC_PLACEHOLDER = Pattern.compile("\\{(\\d)}");

public PlaceholdersProvider_MVdWPlaceholderAPI(SuperiorSkyblockPlugin plugin) {
SuperiorSkyblockPlugin.log("Using MVdWPlaceholderAPI for placeholders support.");
Log.info("Using MVdWPlaceholderAPI for placeholders support.");
PlaceholdersServiceImpl placeholdersService = (PlaceholdersServiceImpl) plugin.getServices().getPlaceholdersService();
PlaceholderAPI.registerPlaceholder(plugin, "superior_*", e ->
placeholdersService.handlePluginPlaceholder(e.getOfflinePlayer(), e.getPlaceholder().replace("superior_", "")));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.bgsoftware.superiorskyblock.api.objects.Pair;
import com.bgsoftware.superiorskyblock.core.Materials;
import com.bgsoftware.superiorskyblock.core.key.KeyImpl;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.google.common.base.Preconditions;
import com.vk2gpz.mergedspawner.api.MergedSpawnerAPI;
import com.vk2gpz.mergedspawner.event.MergedSpawnerBreakEvent;
Expand All @@ -27,7 +28,7 @@ public SpawnersProvider_MergedSpawner(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new SpawnersProvider_MergedSpawner.StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using MergedSpawner as a spawners provider.");
Log.info("Using MergedSpawner as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.bgsoftware.superiorskyblock.external.placeholders;

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.external.placeholders.PlaceholdersProvider;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.service.placeholders.PlaceholdersServiceImpl;
import me.clip.placeholderapi.PlaceholderAPI;
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
Expand All @@ -17,7 +17,7 @@ public PlaceholdersProvider_PlaceholderAPI(SuperiorSkyblockPlugin plugin) {
this.plugin = plugin;
new EZPlaceholder((PlaceholdersServiceImpl) plugin.getServices().getPlaceholdersService()).register();

SuperiorSkyblockPlugin.log("Using PlaceholderAPI for placeholders support.");
Log.info("Using PlaceholderAPI for placeholders support.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.island.Island;
import com.bgsoftware.superiorskyblock.api.objects.Pair;
import com.bgsoftware.superiorskyblock.external.spawners.SpawnersProviderItemMetaSpawnerType;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.google.common.base.Preconditions;
import org.bukkit.Bukkit;
import org.bukkit.Location;
Expand All @@ -29,7 +29,7 @@ public SpawnersProvider_PvpingSpawners(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using PvpingSpawners as a spawners provider.");
Log.info("Using PvpingSpawners as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.bgsoftware.superiorskyblock.api.key.Key;
import com.bgsoftware.superiorskyblock.api.objects.Pair;
import com.bgsoftware.superiorskyblock.core.Materials;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.google.common.base.Preconditions;
import dev.rosewood.rosestacker.api.RoseStackerAPI;
import dev.rosewood.rosestacker.event.SpawnerStackEvent;
Expand Down Expand Up @@ -34,7 +35,7 @@ public SpawnersProvider_RoseStacker(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using RoseStacker as a spawners provider.");
Log.info("Using RoseStacker as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.bgsoftware.superiorskyblock.api.objects.Pair;
import com.bgsoftware.superiorskyblock.core.ChunkPosition;
import com.bgsoftware.superiorskyblock.core.Singleton;
import com.bgsoftware.superiorskyblock.external.stackedblocks.StackedBlocksProvider_AutoDetect;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.bgsoftware.superiorskyblock.listener.ProtectionListener;
import com.google.common.base.Preconditions;
import dev.rosewood.rosestacker.api.RoseStackerAPI;
Expand Down Expand Up @@ -40,7 +40,7 @@ public StackedBlocksProvider_RoseStacker(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using RoseStacker as a stacked-blocks provider.");
Log.info("Using RoseStacker as a stacked-blocks provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.bgsoftware.superiorskyblock.api.hooks.PricesProvider;
import com.bgsoftware.superiorskyblock.api.key.Key;
import com.bgsoftware.superiorskyblock.api.key.KeyMap;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import net.brcdev.shopgui.ShopGuiPlugin;
import net.brcdev.shopgui.shop.Shop;
import net.brcdev.shopgui.shop.ShopItem;
Expand All @@ -25,7 +26,7 @@ public class PricesProvider_ShopGUIPlus implements PricesProvider {

public PricesProvider_ShopGUIPlus(SuperiorSkyblockPlugin plugin) {
this.plugin = plugin;
SuperiorSkyblockPlugin.log("Using ShopGUIPlus as a prices provider.");
Log.info("Using ShopGUIPlus as a prices provider.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.bgsoftware.superiorskyblock.api.hooks.PricesProvider;
import com.bgsoftware.superiorskyblock.api.key.Key;
import com.bgsoftware.superiorskyblock.api.key.KeyMap;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import net.brcdev.shopgui.ShopGuiPlugin;
import net.brcdev.shopgui.shop.Shop;
import net.brcdev.shopgui.shop.item.ShopItem;
Expand All @@ -19,7 +20,7 @@ public class PricesProvider_ShopGUIPlus78 implements PricesProvider {

public PricesProvider_ShopGUIPlus78(SuperiorSkyblockPlugin plugin) {
this.plugin = plugin;
SuperiorSkyblockPlugin.log("Using ShopGUIPlus as a prices provider.");
Log.info("Using ShopGUIPlus as a prices provider.");
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.bgsoftware.superiorskyblock.api.objects.Pair;
import com.bgsoftware.superiorskyblock.core.Materials;
import com.bgsoftware.superiorskyblock.core.key.KeyImpl;
import com.bgsoftware.superiorskyblock.core.logging.Log;
import com.google.common.base.Preconditions;
import de.candc.events.SpawnerBreakEvent;
import de.candc.events.SpawnerPlaceEvent;
Expand All @@ -26,7 +27,7 @@ public SpawnersProvider_SilkSpawners(SuperiorSkyblockPlugin plugin) {
if (!registered) {
Bukkit.getPluginManager().registerEvents(new SpawnersProvider_SilkSpawners.StackerListener(), plugin);
registered = true;
SuperiorSkyblockPlugin.log("Using SilkSpawners as a spawners provider.");
Log.info("Using SilkSpawners as a spawners provider.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import com.bgsoftware.common.reflection.ReflectMethod;
import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.api.wrappers.SuperiorPlayer;
import com.bgsoftware.superiorskyblock.core.debug.PluginDebugger;
import com.bgsoftware.superiorskyblock.core.threads.BukkitExecutor;
import com.mojang.authlib.properties.Property;
import net.skinsrestorer.api.SkinsRestorerAPI;
Expand Down Expand Up @@ -78,8 +77,7 @@ public Property getSkin(SuperiorPlayer superiorPlayer) {
try {
SkinStorage skinStorage = SkinsRestorer.getInstance().getSkinStorage();
return (Property) skinStorage.getOrCreateSkinForPlayer(superiorPlayer.getName(), true);
} catch (SkinRequestException | NullPointerException ex) {
PluginDebugger.debug(ex);
} catch (SkinRequestException | NullPointerException ignored) {
return null;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.bgsoftware.superiorskyblock.external;

import com.bgsoftware.superiorskyblock.SuperiorSkyblockPlugin;
import com.bgsoftware.superiorskyblock.core.debug.PluginDebugger;
import com.grinderwolf.swm.api.SlimePlugin;
import com.grinderwolf.swm.plugin.config.ConfigManager;
import com.grinderwolf.swm.plugin.config.WorldData;
Expand All @@ -28,8 +27,7 @@ private static void loadWorld(String worldName) {

try {
slimePlugin.getLoader(worldData.getDataSource()).loadWorld(worldName, false);
} catch (Exception error) {
PluginDebugger.debug(error);
} catch (Exception ignored) {
}
}

Expand Down
Loading

0 comments on commit 953b9f1

Please sign in to comment.