mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 03:30:10 +00:00
Add collection sizes to debug command
This commit is contained in:
parent
80ef1ba645
commit
e27356eba0
2 changed files with 35 additions and 4 deletions
BIN
lib/guava-18.0.jar
Normal file
BIN
lib/guava-18.0.jar
Normal file
Binary file not shown.
|
@ -12,6 +12,7 @@ import java.io.IOException;
|
|||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.PrintWriter;
|
||||
import java.lang.reflect.Field;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
|
@ -25,10 +26,16 @@ import java.util.HashMap;
|
|||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
|
||||
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
|
@ -56,6 +63,7 @@ import org.bukkit.plugin.PluginManager;
|
|||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import com.google.common.reflect.ClassPath;
|
||||
import com.griefcraft.lwc.LWC;
|
||||
import com.griefcraft.lwc.LWCPlugin;
|
||||
import com.griefcraft.model.Protection;
|
||||
|
@ -122,10 +130,6 @@ import com.sk89q.worldguard.protection.flags.DefaultFlag;
|
|||
|
||||
import fr.neatmonster.nocheatplus.checks.CheckType;
|
||||
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
|
||||
import me.ryanhamshire.GriefPrevention.Claim;
|
||||
import me.ryanhamshire.GriefPrevention.GriefPrevention;
|
||||
import net.sacredlabyrinth.Phaed.PreciousStones.FieldFlag;
|
||||
import net.sacredlabyrinth.Phaed.PreciousStones.PreciousStones;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class GeneralMethods {
|
||||
|
@ -1829,6 +1833,33 @@ public class GeneralMethods {
|
|||
writeToDebug(plugin.getDescription().getName() + " v" + plugin.getDescription().getVersion());
|
||||
}
|
||||
}
|
||||
|
||||
writeToDebug("");
|
||||
writeToDebug("Collection Sizes");
|
||||
writeToDebug("====================");
|
||||
ClassLoader loader = ProjectKorra.class.getClassLoader();
|
||||
try {
|
||||
for (final ClassPath.ClassInfo info : ClassPath.from(loader).getTopLevelClasses()) {
|
||||
if (info.getName().startsWith("com.projectkorra.")) {
|
||||
final Class<?> clazz = info.load();
|
||||
for (Field field : clazz.getFields()) {
|
||||
String simpleName = clazz.getSimpleName();
|
||||
try {
|
||||
Object obj = field.get(null);
|
||||
if (obj instanceof Collection) {
|
||||
writeToDebug(simpleName + ": " + field.getName() + " size=" + ((Collection<?>) obj).size());
|
||||
} else if (obj instanceof Map) {
|
||||
writeToDebug(simpleName + ": " + field.getName() + " size=" + ((Map<?,?>) obj).size());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static void saveAbility(BendingPlayer bPlayer, int slot, String ability) {
|
||||
|
|
Loading…
Reference in a new issue