mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2024-12-29 02:44:17 +00:00
Allow directly opening two more gui pages
This commit is contained in:
parent
28665d548e
commit
34ae6f1928
2 changed files with 40 additions and 5 deletions
|
@ -7,7 +7,7 @@ import dev.esophose.playerparticles.manager.LocaleManager;
|
|||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
|
@ -47,10 +47,23 @@ public class GUICommandModule implements CommandModule {
|
|||
return;
|
||||
}
|
||||
|
||||
if (args.length > 0 && args[0].equalsIgnoreCase("presets")) {
|
||||
guiManager.openPresetGroups(pplayer);
|
||||
} else {
|
||||
if (args.length == 0) {
|
||||
guiManager.openDefault(pplayer);
|
||||
} else {
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "presets":
|
||||
guiManager.openPresetGroups(pplayer);
|
||||
break;
|
||||
case "groups":
|
||||
guiManager.openGroups(pplayer);
|
||||
break;
|
||||
case "particles":
|
||||
guiManager.openParticles(pplayer);
|
||||
break;
|
||||
default:
|
||||
guiManager.openDefault(pplayer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -58,7 +71,7 @@ public class GUICommandModule implements CommandModule {
|
|||
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
|
||||
List<String> completions = new ArrayList<>();
|
||||
if (args.length == 1) {
|
||||
List<String> possibilities = Collections.singletonList("presets");
|
||||
List<String> possibilities = Arrays.asList("presets", "groups", "particles");
|
||||
StringUtil.copyPartialMatches(args[0], possibilities, completions);
|
||||
}
|
||||
return completions;
|
||||
|
|
|
@ -4,6 +4,8 @@ import dev.esophose.playerparticles.PlayerParticles;
|
|||
import dev.esophose.playerparticles.gui.GuiInventory;
|
||||
import dev.esophose.playerparticles.gui.GuiInventoryDefault;
|
||||
import dev.esophose.playerparticles.gui.GuiInventoryLoadPresetGroups;
|
||||
import dev.esophose.playerparticles.gui.GuiInventoryManageGroups;
|
||||
import dev.esophose.playerparticles.gui.GuiInventoryManageParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import java.util.ArrayList;
|
||||
|
@ -128,6 +130,26 @@ public class GuiManager extends Manager implements Listener, Runnable {
|
|||
this.openGui(pplayer, new GuiInventoryLoadPresetGroups(pplayer, true, 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the groups GUI screen for a player
|
||||
*
|
||||
* @param pplayer The PPlayer to open the GUI screen for
|
||||
*/
|
||||
public void openGroups(PPlayer pplayer) {
|
||||
Bukkit.getScheduler().runTask(this.playerParticles, () ->
|
||||
this.openGui(pplayer, new GuiInventoryManageGroups(pplayer, 1)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens the edit particles GUI screen for a player
|
||||
*
|
||||
* @param pplayer The PPlayer to open the GUI screen for
|
||||
*/
|
||||
public void openParticles(PPlayer pplayer) {
|
||||
Bukkit.getScheduler().runTask(this.playerParticles, () ->
|
||||
this.openGui(pplayer, new GuiInventoryManageParticles(pplayer)));
|
||||
}
|
||||
|
||||
/**
|
||||
* Opens a GUI screen for a player
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue