The style 'normal' is no longer given by default

This commit is contained in:
Esophose 2020-01-05 04:22:02 -07:00
parent aac40785ce
commit 7774e500ca
28 changed files with 36 additions and 30 deletions

View file

@ -17,10 +17,17 @@
* * Changed the package names
* + Config and lang files will no longer reset every update
* + Added PlaceholderAPI support
* * The style 'normal' is no longer granted permission by default
* * Fixed an issue where 'random' data would not parse properly in preset_groups.yml
* * Fixed an issue where preset groups would not display in the GUI even if the player has permission for them
*/
/*
* Changed messages (NEEDS UPDATING IN OTHER LANGUAGES):
* Renamed command-error-no-effects to command-error-missing-effects-or-styles
* Changed message for command-error-missing-effects-or-styles
*/
package dev.esophose.playerparticles;
import dev.esophose.playerparticles.gui.hook.PlayerChatHook;

View file

@ -205,7 +205,7 @@ public class AddCommandModule implements CommandModule {
return "<effect> <style> [data]";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return true;
}

View file

@ -47,11 +47,11 @@ public interface CommandModule {
String getArguments();
/**
* True if this command requires the player to have any effects
* True if this command requires the player to have any effects and styles
*
* @return If the player must have effects to use this command
* @return If the player must have effects and styles to use this command
*/
boolean requiresEffects();
boolean requiresEffectsAndStyles();
/**
* @return true if this command can be executed from console, otherwise false

View file

@ -68,7 +68,7 @@ public class DataCommandModule implements CommandModule {
return "<effect>";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return true;
}

View file

@ -37,7 +37,7 @@ public class DefaultCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -318,7 +318,7 @@ public class EditCommandModule implements CommandModule {
return "<ID> <effect>|<style>|<data> <args>";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return true;
}

View file

@ -50,7 +50,7 @@ public class EffectsCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -807,7 +807,7 @@ public class FixedCommandModule implements CommandModule {
return "<sub-command>";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return true;
}

View file

@ -57,7 +57,7 @@ public class GUICommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -328,7 +328,7 @@ public class GroupCommandModule implements CommandModule {
return "<sub-command>";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -36,7 +36,7 @@ public class HelpCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -49,7 +49,7 @@ public class ListCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return true;
}

View file

@ -44,7 +44,7 @@ public class OtherCommandModule implements CommandModuleSecondary {
return;
}
if (commandModule.requiresEffects() && permissionManager.getEffectNamesUserHasPermissionFor(other).isEmpty()) {
if (commandModule.requiresEffectsAndStyles() && (permissionManager.getEffectNamesUserHasPermissionFor(other).isEmpty() || permissionManager.getStyleNamesUserHasPermissionFor(other).isEmpty())) {
localeManager.sendMessage(sender, "other-success", StringPlaceholders.single("player", other.getName()));
localeManager.sendMessage(sender, "command-error-no-effects");
return;

View file

@ -36,7 +36,7 @@ public class ReloadCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -128,7 +128,7 @@ public class RemoveCommandModule implements CommandModule {
return "<ID>|<effect>|<style>";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -33,7 +33,7 @@ public class ResetCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -43,7 +43,7 @@ public class StylesCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -37,7 +37,7 @@ public class ToggleCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -31,7 +31,7 @@ public class VersionCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -42,7 +42,7 @@ public class WorldsCommandModule implements CommandModule {
return "";
}
public boolean requiresEffects() {
public boolean requiresEffectsAndStyles() {
return false;
}

View file

@ -22,7 +22,7 @@ public class EnglishLocale implements Locale {
this.put("prefix", "&7[&3PlayerParticles&7] ");
this.put("#1", "Command Description Messages");
this.put("command-error-no-effects", "&cYou must have access to effects to use this command!");
this.put("command-error-missing-effects-or-styles", "&cYou must have access to effects and styles to use this command!");
this.put("command-error-unknown", "&cUnknown command, use &b/pp help &cfor a list of commands.");
this.put("command-descriptions", "&eThe following commands are available:");
this.put("command-descriptions-usage", "&e/pp %cmd% %args%");

View file

@ -22,7 +22,7 @@ public class FrenchLocale implements Locale {
this.put("prefix", "&7[&3PlayerParticles&7] ");
this.put("#1", "Command Description Messages");
this.put("command-error-no-effects", "&cVous n'avez pas la permission d'utiliser cette commande.");
this.put("command-error-missing-effects-or-styles", "&cVous n'avez pas la permission d'utiliser cette commande.");
this.put("command-error-unknown", "&cCommande inconnue, utilisez &b/pp help &cpour afficher la liste des commandes disponibles pour ce plugin.");
this.put("command-descriptions", "&eLes commandes suivantes sont disponibles :");
this.put("command-descriptions-usage", "&e/pp %cmd% %args%");

View file

@ -22,7 +22,7 @@ public class GermanLocale implements Locale {
this.put("prefix", "&7[&3PlayerParticles&7] ");
this.put("#1", "Command Description Messages");
this.put("command-error-no-effects", "&cSie müssen Zugriff auf Effekte haben, um diesen Befehl verwenden zu können!");
this.put("command-error-missing-effects-or-styles", "&cSie müssen Zugriff auf Effekte haben, um diesen Befehl verwenden zu können!");
this.put("command-error-unknown", "&cUnbekannter Befehl. Verwenden Sie &b/pp help &c, um eine Liste der Befehle anzuzeigen.");
this.put("command-descriptions", "Die folgenden Befehle stehen zur Auswahl:");
this.put("command-descriptions-usage", "&e/pp %cmd% %args%");

View file

@ -22,7 +22,7 @@ public class RussianLocale implements Locale {
this.put("prefix", "&7[&3PlayerParticles&7] ");
this.put("#1", "Command Description Messages");
this.put("command-error-no-effects", "&cВы должны иметь доступ к эффектам чтобы использовать эту команду!");
this.put("command-error-missing-effects-or-styles", "&cВы должны иметь доступ к эффектам чтобы использовать эту команду!");
this.put("command-error-unknown", "&cНеизвестная команда, напишите &b/pp help &c, чтобы узнать команды.");
this.put("command-descriptions", "&eВам доступны команды ниже:");
this.put("command-descriptions-usage", "&e/pp %cmd% %args%");

View file

@ -22,7 +22,7 @@ public class SimplifiedChineseLocale implements Locale {
this.put("prefix", "&7[&3PlayerParticles&7] ");
this.put("#1", "Command Description Messages");
this.put("command-error-no-effects", "&c你必须有权限使用特效才能使用这个指令!");
this.put("command-error-missing-effects-or-styles", "&c你必须有权限使用特效才能使用这个指令!");
this.put("command-error-unknown", "&c未知的指令 请使用 &b/pp help &c查看指令列表。");
this.put("command-descriptions", "&e你可以使用以下指令:");
this.put("command-descriptions-usage", "&e/pp %cmd% %args%");

View file

@ -22,7 +22,7 @@ public class VietnameseLocale implements Locale {
this.put("prefix", "&7[&3PlayerParticles&7] ");
this.put("#1", "Command Description Messages");
this.put("command-error-no-effects", "&cBạn phải có quyền sử dụng hiệu ứng để làm điều này!");
this.put("command-error-missing-effects-or-styles", "&cBạn phải có quyền sử dụng hiệu ứng để làm điều này!");
this.put("command-error-unknown", "&cLệnh không đúng, &6/pp help &cđể xem danh sách các câu lệnh.");
this.put("command-descriptions", "&eCác lệnh có sẵn:");
this.put("command-descriptions-usage", "&e/pp %cmd% %args%");

View file

@ -160,7 +160,8 @@ public class CommandManager extends Manager implements CommandExecutor, TabCompl
Player p = (Player) sender;
this.playerParticles.getManager(DataManager.class).getPPlayer(p.getUniqueId(), (pplayer) -> {
if (commandModule.requiresEffects() && PlayerParticles.getInstance().getManager(PermissionManager.class).getEffectNamesUserHasPermissionFor(p).isEmpty()) {
PermissionManager permissionManager = PlayerParticles.getInstance().getManager(PermissionManager.class);
if (commandModule.requiresEffectsAndStyles() && (permissionManager.getEffectNamesUserHasPermissionFor(p).isEmpty() || permissionManager.getStyleNamesUserHasPermissionFor(p).isEmpty())) {
localeManager.sendMessage(pplayer, "command-error-no-effects");
} else {
commandModule.onCommandExecute(pplayer, cmdArgs);

View file

@ -4,7 +4,6 @@ import dev.esophose.playerparticles.PlayerParticles;
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
import dev.esophose.playerparticles.particles.PPlayer;
import dev.esophose.playerparticles.particles.ParticleEffect;
import dev.esophose.playerparticles.styles.DefaultStyles;
import dev.esophose.playerparticles.styles.ParticleStyle;
import java.util.ArrayList;
import java.util.List;
@ -217,7 +216,6 @@ public class PermissionManager extends Manager {
* @return If the player has permission to use the style
*/
public boolean hasStylePermission(Player player, ParticleStyle style) {
if (style == DefaultStyles.NORMAL) return true;
if (PPermission.ALL.check(player) || PPermission.STYLE_ALL.check(player)) return true;
return PPermission.STYLE.check(player, style.getName());
}