Debug debug

This commit is contained in:
tastybento 2024-04-21 13:30:03 -07:00
parent fd12ef9fe7
commit 5b4ecd5293
2 changed files with 8 additions and 3 deletions

View File

@ -384,6 +384,7 @@ public class Flag implements Comparable<Flag> {
*/
@Nullable
public PanelItem toPanelItem(BentoBox plugin, User user, World world, @Nullable Island island, boolean invisible) {
// TODO: Why is this taking long
long m = System.currentTimeMillis();
// Invisibility
if (!user.isOp() && invisible) {
@ -435,9 +436,11 @@ public class Flag implements Comparable<Flag> {
BentoBox.getInstance().logDebug("Protection flag");
if (island != null) {
int y = island.getFlag(this);
BentoBox.getInstance().logDebug("Protection flag getFlag time " + (System.currentTimeMillis() - m));
// Protection flag
pib.description(user.getTranslation("protection.panel.flag-item.description-layout",
TextVariables.DESCRIPTION, user.getTranslation(getDescriptionReference())));
BentoBox.getInstance().logDebug("Protection flag description time " + (System.currentTimeMillis() - m));
RanksManager.getInstance().getRanks().forEach((reference, score) -> {
if (score > RanksManager.BANNED_RANK && score < y) {
pib.description(user.getTranslation("protection.panel.flag-item.blocked-rank") + user.getTranslation(reference));
@ -448,7 +451,7 @@ public class Flag implements Comparable<Flag> {
}
});
}
BentoBox.getInstance().logDebug("Protection flag " + (System.currentTimeMillis() - m));
BentoBox.getInstance().logDebug("Protection flag time " + (System.currentTimeMillis() - m));
return pib;
}

View File

@ -123,16 +123,18 @@ public class SettingsTab implements Tab, ClickHandler {
@Override
@NonNull
public List<@Nullable PanelItem> getPanelItems() {
long m = System.currentTimeMillis();
BentoBox.getInstance().logDebug("Get panel items");
List<Flag> flags = getFlags();
BentoBox.getInstance().logDebug("Time for getFlags = " + (System.currentTimeMillis() - m));
int i = 0;
// Jump past empty tabs
while (flags.isEmpty() && i++ < Flag.Mode.values().length) {
currentMode.put(user.getUniqueId(), currentMode.getOrDefault(user.getUniqueId(), Mode.BASIC).getNext());
flags = getFlags();
}
long m = System.currentTimeMillis();
// TODO This is taking too long!!!
List<@Nullable PanelItem> result = new ArrayList<>();
for (Flag f : flags) {