mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-08-02 18:45:56 +00:00
Add setting for opening gui with no effects/styles, fix gui pages bug
This commit is contained in:
parent
b2549bed16
commit
9ebff20618
6 changed files with 8 additions and 5 deletions
|
@ -27,7 +27,7 @@ dependencies {
|
||||||
shadow 'org.jetbrains:annotations:16.0.2'
|
shadow 'org.jetbrains:annotations:16.0.2'
|
||||||
shadow 'me.clip:placeholderapi:2.10.4'
|
shadow 'me.clip:placeholderapi:2.10.4'
|
||||||
shadow 'org.xerial:sqlite-jdbc:3.23.1'
|
shadow 'org.xerial:sqlite-jdbc:3.23.1'
|
||||||
shadow 'org.spigotmc:spigot-api:1.15-R0.1-SNAPSHOT'
|
shadow 'org.spigotmc:spigot-api:1.15.2-R0.1-SNAPSHOT'
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
|
|
@ -18,7 +18,8 @@ public class DefaultCommandModule implements CommandModule {
|
||||||
List<String> matches = new ArrayList<>();
|
List<String> matches = new ArrayList<>();
|
||||||
List<String> commandNames = PlayerParticles.getInstance().getManager(CommandManager.class).getCommandNames();
|
List<String> commandNames = PlayerParticles.getInstance().getManager(CommandManager.class).getCommandNames();
|
||||||
|
|
||||||
if (args.length == 0) return commandNames;
|
if (args.length == 0)
|
||||||
|
return commandNames;
|
||||||
|
|
||||||
StringUtil.copyPartialMatches(args[0], commandNames, matches);
|
StringUtil.copyPartialMatches(args[0], commandNames, matches);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,8 @@ public class GUICommandModule implements CommandModule {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Setting.GUI_PRESETS_ONLY.getBoolean() && (permissionManager.getEffectsUserHasPermissionFor(pplayer).isEmpty() || permissionManager.getStylesUserHasPermissionFor(pplayer).isEmpty())) {
|
boolean hasEffectsAndStyles = permissionManager.getEffectsUserHasPermissionFor(pplayer).isEmpty() || permissionManager.getStylesUserHasPermissionFor(pplayer).isEmpty();
|
||||||
|
if (!Setting.GUI_PRESETS_ONLY.getBoolean() && (Setting.GUI_REQUIRE_EFFECTS_AND_STYLES.getBoolean() && !hasEffectsAndStyles)) {
|
||||||
if (byDefault) {
|
if (byDefault) {
|
||||||
localeManager.sendMessage(pplayer, "command-error-missing-effects-or-styles");
|
localeManager.sendMessage(pplayer, "command-error-missing-effects-or-styles");
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class GuiInventoryEditEffect extends GuiInventory {
|
||||||
List<ParticleEffect> effectsUserHasPermissionFor = PlayerParticles.getInstance().getManager(PermissionManager.class).getEffectsUserHasPermissionFor(pplayer);
|
List<ParticleEffect> effectsUserHasPermissionFor = PlayerParticles.getInstance().getManager(PermissionManager.class).getEffectsUserHasPermissionFor(pplayer);
|
||||||
int numberOfItems = effectsUserHasPermissionFor.size();
|
int numberOfItems = effectsUserHasPermissionFor.size();
|
||||||
int itemsPerPage = 28;
|
int itemsPerPage = 28;
|
||||||
int maxPages = (int) Math.ceil((double) numberOfItems / itemsPerPage);
|
int maxPages = (int) Math.max(1, Math.ceil((double) numberOfItems / itemsPerPage));
|
||||||
int slot = 10;
|
int slot = 10;
|
||||||
int nextWrap = 17;
|
int nextWrap = 17;
|
||||||
int maxSlot = 43;
|
int maxSlot = 43;
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class GuiInventoryEditStyle extends GuiInventory {
|
||||||
List<ParticleStyle> stylesUserHasPermissionFor = PlayerParticles.getInstance().getManager(PermissionManager.class).getStylesUserHasPermissionFor(pplayer);
|
List<ParticleStyle> stylesUserHasPermissionFor = PlayerParticles.getInstance().getManager(PermissionManager.class).getStylesUserHasPermissionFor(pplayer);
|
||||||
int numberOfItems = stylesUserHasPermissionFor.size();
|
int numberOfItems = stylesUserHasPermissionFor.size();
|
||||||
int itemsPerPage = 28;
|
int itemsPerPage = 28;
|
||||||
int maxPages = (int) Math.ceil((double) numberOfItems / itemsPerPage);
|
int maxPages = (int) Math.max(1, Math.ceil((double) numberOfItems / itemsPerPage));
|
||||||
int slot = 10;
|
int slot = 10;
|
||||||
int nextWrap = 17;
|
int nextWrap = 17;
|
||||||
int maxSlot = 43;
|
int maxSlot = 43;
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ConfigurationManager extends Manager {
|
||||||
USE_MESSAGE_PREFIX("use-message-prefix", true, "Whether or not to use the message-prefix field when displaying messages"),
|
USE_MESSAGE_PREFIX("use-message-prefix", true, "Whether or not to use the message-prefix field when displaying messages"),
|
||||||
GUI_ENABLED("gui-enabled", true, "If the command /pp gui is enabled", "Disable this if you have your own custom GUI through another plugin"),
|
GUI_ENABLED("gui-enabled", true, "If the command /pp gui is enabled", "Disable this if you have your own custom GUI through another plugin"),
|
||||||
GUI_REQUIRE_PERMISSION("gui-require-permission", false, "If the GUI should require the permission playerparticles.gui to open"),
|
GUI_REQUIRE_PERMISSION("gui-require-permission", false, "If the GUI should require the permission playerparticles.gui to open"),
|
||||||
|
GUI_REQUIRE_EFFECTS_AND_STYLES("gui-require-effects-and-styles", true, "If the GUI should require the player to have permission for at least", "one effect and one style to be able to open the GUI"),
|
||||||
GUI_PRESETS_ONLY("gui-presets-only", false, "If true, only the preset groups will be available in the GUI", "Permissions to open the GUI will change to only open if the user has any preset groups available"),
|
GUI_PRESETS_ONLY("gui-presets-only", false, "If true, only the preset groups will be available in the GUI", "Permissions to open the GUI will change to only open if the user has any preset groups available"),
|
||||||
GUI_CLOSE_AFTER_GROUP_SELECTED("gui-close-after-group-selected", true, "If true, the GUI will close after selecting a group (either saved or preset)"),
|
GUI_CLOSE_AFTER_GROUP_SELECTED("gui-close-after-group-selected", true, "If true, the GUI will close after selecting a group (either saved or preset)"),
|
||||||
GUI_BUTTON_SOUND("gui-button-sound", true, "If clicking a GUI button should make a noise"),
|
GUI_BUTTON_SOUND("gui-button-sound", true, "If clicking a GUI button should make a noise"),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue