Overhaul menu system and simplify it heavily, separating Pageable Menus and regular Menus into two different implementations

This commit is contained in:
Taah
2023-09-02 10:14:10 -07:00
parent 28c57f3a52
commit 2364ab33ff
18 changed files with 609 additions and 563 deletions

View File

@ -4,6 +4,7 @@ import com.google.common.collect.ImmutableList;
import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.menu.impl.MaterialMenu;
import dev.plex.util.GameRuleUtil;
import dev.plex.util.PlexLog;
import dev.plex.util.PlexUtils;
@ -20,6 +21,7 @@ import org.jetbrains.annotations.Nullable;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.concurrent.CompletableFuture;
@CommandParameters(name = "pdebug", description = "Plex's debug command", usage = "/<command> <aliases <command> | redis-reset <player> | gamerules>")
@CommandPermissions(permission = "plex.debug")
@ -76,6 +78,15 @@ public class DebugCMD extends PlexCommand
return mmString("<aqua>Aliases for " + commandName + " are: " + Arrays.toString(command.getAliases().toArray(new String[0])));
}
}
if (args[0].equalsIgnoreCase("pagination"))
{
if (playerSender == null)
{
return messageComponent("noPermissionConsole");
}
new MaterialMenu().open(playerSender);
return null;
}
return usage();
}

View File

@ -5,8 +5,8 @@ import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.menu.PunishmentMenu;
import dev.plex.menu.impl.PunishmentMenu;
import dev.plex.util.PlexUtils;
import net.kyori.adventure.text.Component;
import org.bukkit.command.CommandSender;
@ -23,7 +23,7 @@ public class PunishmentsCMD extends PlexCommand
@Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
{
new PunishmentMenu().openInv(playerSender, 0);
new PunishmentMenu().open(playerSender);
return null;
}

View File

@ -5,7 +5,7 @@ import dev.plex.command.PlexCommand;
import dev.plex.command.annotation.CommandParameters;
import dev.plex.command.annotation.CommandPermissions;
import dev.plex.command.source.RequiredCommandSource;
import dev.plex.menu.ToggleMenu;
import dev.plex.menu.impl.ToggleMenu;
import dev.plex.util.PlexUtils;
import net.kyori.adventure.text.Component;
@ -59,7 +59,7 @@ public class ToggleCMD extends PlexCommand
}
}
}
new ToggleMenu().openInv(playerSender, 0);
new ToggleMenu().open(playerSender);
return null;
}