Bug fixes

This commit is contained in:
Esophose 2020-01-17 03:53:54 -07:00
parent 1751b243e5
commit 932ae61733
10 changed files with 27 additions and 27 deletions

View file

@ -73,7 +73,7 @@ public class DataCommandModule implements CommandModule {
}
public boolean canConsoleExecute() {
return false;
return true;
}
}

View file

@ -17,7 +17,7 @@ public class GUICommandModule implements CommandModule {
GuiManager guiManager = PlayerParticles.getInstance().getManager(GuiManager.class);
if (!permissionManager.canOpenGui(pplayer)) {
localeManager.sendMessage(pplayer, "command-no-permission");
localeManager.sendMessage(pplayer, "gui-no-permission");
return;
}

View file

@ -41,7 +41,7 @@ public class HelpCommandModule implements CommandModule {
}
public boolean canConsoleExecute() {
return false;
return true;
}
}

View file

@ -36,7 +36,7 @@ public class VersionCommandModule implements CommandModule {
}
public boolean canConsoleExecute() {
return false;
return true;
}
}

View file

@ -4,6 +4,7 @@ import dev.esophose.playerparticles.PlayerParticles;
import dev.esophose.playerparticles.manager.LocaleManager;
import dev.esophose.playerparticles.manager.PermissionManager;
import dev.esophose.playerparticles.particles.PPlayer;
import dev.esophose.playerparticles.util.StringPlaceholders;
import java.util.ArrayList;
import java.util.List;
@ -21,9 +22,10 @@ public class WorldsCommandModule implements CommandModule {
for (String s : permissionManager.getDisabledWorlds()) {
worlds.append(s).append(", ");
}
if (worlds.length() > 2) worlds = new StringBuilder(worlds.substring(0, worlds.length() - 2));
if (worlds.length() > 2)
worlds = new StringBuilder(worlds.substring(0, worlds.length() - 2));
localeManager.sendCustomMessage(pplayer, localeManager.getLocaleMessage("disabled-worlds") + " " + worlds);
localeManager.sendCustomMessage(pplayer, localeManager.getLocaleMessage("disabled-worlds", StringPlaceholders.single("worlds", worlds)));
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
@ -47,7 +49,7 @@ public class WorldsCommandModule implements CommandModule {
}
public boolean canConsoleExecute() {
return false;
return true;
}
}

View file

@ -63,20 +63,17 @@ public class ConfigurationManager extends Manager {
MYSQL_USER_PASSWORD("mysql-settings.user-password", "", "MySQL Database User Password"),
MYSQL_USE_SSL("mysql-settings.use-ssl", false, "If the database connection should use SSL", "You should enable this if your database supports SSL"),
GUI_ICON("gui-icon", null, "=================================================================== #",
" GUI ICON SETTINGS #",
"This configuration option allows you to change any of the GUI #",
"icons to whatever block/item you want. #",
" #",
"Important Notes: #",
"* If any of the block/item names are invalid the icon in the GUI #",
" will be the barrier icon to show that it failed to load. #",
"* Do NOT change the particle/style name #",
"* You MUST use the Spigot-given name for it to work. You can see #",
" all the Spigot-given names at the link below: #",
" https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html #",
"* If two icons are listed, the second one is used for below MC 1.13 #",
"=================================================================== #"),
GUI_ICON("gui-icon", null,
"This configuration option allows you to change any of the GUI",
"icons to whatever block/item you want.",
"Notes: If any of the block/item names are invalid the icon in the GUI",
"will be the barrier icon to show that it failed to load.",
"Do NOT change the particle/style name",
"You MUST use the Spigot-given name for it to work. You can see",
"all the Spigot-given names at the link below:",
"https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Material.html",
"If two icons are listed, the second one is used for below MC 1.13"
),
GUI_ICON_MISC("gui-icon.misc", null),
GUI_ICON_MISC_PARTICLES("gui-icon.misc.particles", Collections.singletonList("BLAZE_POWDER")),
GUI_ICON_MISC_GROUPS("gui-icon.misc.groups", Collections.singletonList("CHEST")),

View file

@ -107,7 +107,7 @@ public class LocaleManager extends Manager {
public String getLocaleMessage(String messageKey, StringPlaceholders stringPlaceholders) {
String message = this.locale.getString(messageKey);
if (message == null)
return "null";
return ChatColor.RED + "Missing message in locale file: " + messageKey;
return ChatColor.translateAlternateColorCodes('&', stringPlaceholders.apply(message));
}

View file

@ -172,7 +172,10 @@ public class ParticleGroupPresetManager extends Manager {
* @return a List of preset ParticleGroups the player can use
*/
public List<ParticleGroupPreset> getPresetGroupsForPlayer(PPlayer player) {
return this.presetGroups.stream().filter(x -> x.canPlayerUse(player)).sorted(Comparator.comparing(ParticleGroupPreset::getDisplayName)).collect(Collectors.toList());
return this.presetGroups.stream()
.filter(x -> x.canPlayerUse(player))
.sorted(Comparator.comparing(ParticleGroupPreset::getDisplayName))
.collect(Collectors.toList());
}
/**

View file

@ -44,8 +44,7 @@ public class ParticleGroupPreset {
*/
public boolean canPlayerUse(PPlayer player) {
// If this particle group has a permission, does the player have it?
if (!this.permission.isEmpty())
if (!player.getPlayer().hasPermission(this.permission))
if (!this.permission.isEmpty() && !player.getPlayer().hasPermission(this.permission))
return false;
// If allowPermissionOverride is true, always let the player apply this group

View file

@ -11,4 +11,3 @@ commands:
description: The main PlayerParticles command. By default, opens the GUI.
ppo:
description: Allows executing a /pp command for another player.
permission: playerparticles.override