'/pp help' text formatting, remove removed commands

This commit is contained in:
Esophose 2018-11-28 23:26:20 -07:00
parent 5c2a074c4f
commit 9cd63bb878
11 changed files with 65 additions and 100 deletions

View file

@ -4,7 +4,6 @@
* + Add new style 'doubleorbit' * + Add new style 'doubleorbit'
* * Adjust style positioning around central point based on if they are being spawned for a player or fixed effect * * Adjust style positioning around central point based on if they are being spawned for a player or fixed effect
* * Write a class called ConfigManager which manages updating the config.yml between versions so it doesn't have to be deleted every time * * Write a class called ConfigManager which manages updating the config.yml between versions so it doesn't have to be deleted every time
* * Clean up the '/pp help' menu and command descriptions so each command fits on one line
* * Display a note in the GUI under event-based styles * * Display a note in the GUI under event-based styles
*/ */

View file

@ -1,14 +1,11 @@
package com.esophose.playerparticles.command; package com.esophose.playerparticles.command;
import java.text.MessageFormat;
import java.util.List; import java.util.List;
import com.esophose.playerparticles.manager.LangManager; import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang; import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer; import com.esophose.playerparticles.particles.PPlayer;
import net.md_5.bungee.api.ChatColor;
public interface CommandModule { public interface CommandModule {
/** /**
@ -63,8 +60,7 @@ public interface CommandModule {
* @param command The command to display usage for * @param command The command to display usage for
*/ */
public static void printUsage(PPlayer pplayer, CommandModule command) { public static void printUsage(PPlayer pplayer, CommandModule command) {
Object[] args = new Object[] { command.getName(), command.getArguments() }; LangManager.sendMessage(pplayer, Lang.COMMAND_DESCRIPTIONS_USAGE, command.getName(), command.getArguments());
LangManager.sendCustomMessage(pplayer, new MessageFormat(ChatColor.YELLOW + "/pp {0} {1}").format(args));
} }
/** /**
@ -75,11 +71,9 @@ public interface CommandModule {
*/ */
public static void printUsageWithDescription(PPlayer pplayer, CommandModule command) { public static void printUsageWithDescription(PPlayer pplayer, CommandModule command) {
if (command.getArguments().length() == 0) { if (command.getArguments().length() == 0) {
Object[] args = new Object[] { command.getName(), LangManager.getText(command.getDescription()) }; LangManager.sendSimpleMessage(pplayer, Lang.COMMAND_DESCRIPTIONS_HELP_1, command.getName(), LangManager.getText(command.getDescription()));
LangManager.sendCustomMessage(pplayer, new MessageFormat(ChatColor.YELLOW + "/pp {0} - {1}").format(args));
} else { } else {
Object[] args = new Object[] { command.getName(), command.getArguments(), LangManager.getText(command.getDescription()) }; LangManager.sendSimpleMessage(pplayer, Lang.COMMAND_DESCRIPTIONS_HELP_2, command.getName(), command.getArguments(), LangManager.getText(command.getDescription()));
LangManager.sendCustomMessage(pplayer, new MessageFormat(ChatColor.YELLOW + "/pp {0} {1} - {2}").format(args));
} }
} }

View file

@ -1,36 +0,0 @@
package com.esophose.playerparticles.command;
import java.util.ArrayList;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class EffectCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
LangManager.sendMessage(pplayer, Lang.COMMAND_DESCRIPTION_EFFECT);
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return new ArrayList<String>();
}
public String getName() {
return "effect";
}
public Lang getDescription() {
return Lang.COMMAND_DESCRIPTION_EFFECT;
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -3,18 +3,19 @@ package com.esophose.playerparticles.command;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang; import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer; import com.esophose.playerparticles.particles.PPlayer;
public class HelpCommandModule implements CommandModule { public class HelpCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) { public void onCommandExecute(PPlayer pplayer, String[] args) {
// TODO: Add pages, there are a lot of commands LangManager.sendMessage(pplayer, Lang.COMMAND_DESCRIPTIONS);
List<CommandModule> cmds = ParticleCommandHandler.getCommands(); List<CommandModule> cmds = ParticleCommandHandler.getCommands();
for (CommandModule cmd : cmds) { for (CommandModule cmd : cmds)
if (!(cmd instanceof DefaultCommandModule))
CommandModule.printUsageWithDescription(pplayer, cmd); CommandModule.printUsageWithDescription(pplayer, cmd);
} }
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) { public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return new ArrayList<String>(); return new ArrayList<String>();

View file

@ -29,7 +29,6 @@ public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
commands.add(new DataCommandModule()); commands.add(new DataCommandModule());
commands.add(new DefaultCommandModule()); commands.add(new DefaultCommandModule());
commands.add(new EditCommandModule()); commands.add(new EditCommandModule());
commands.add(new EffectCommandModule());
commands.add(new EffectsCommandModule()); commands.add(new EffectsCommandModule());
commands.add(new FixedCommandModule()); commands.add(new FixedCommandModule());
commands.add(new GroupCommandModule()); commands.add(new GroupCommandModule());
@ -39,7 +38,6 @@ public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
commands.add(new ReloadCommandModule()); commands.add(new ReloadCommandModule());
commands.add(new RemoveCommandModule()); commands.add(new RemoveCommandModule());
commands.add(new ResetCommandModule()); commands.add(new ResetCommandModule());
commands.add(new StyleCommandModule());
commands.add(new StylesCommandModule()); commands.add(new StylesCommandModule());
commands.add(new ToggleCommandModule()); commands.add(new ToggleCommandModule());
commands.add(new VersionCommandModule()); commands.add(new VersionCommandModule());

View file

@ -1,36 +0,0 @@
package com.esophose.playerparticles.command;
import java.util.ArrayList;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class StyleCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
LangManager.sendMessage(pplayer, Lang.COMMAND_DESCRIPTION_STYLE);
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return new ArrayList<String>();
}
public String getName() {
return "style";
}
public Lang getDescription() {
return Lang.COMMAND_DESCRIPTION_STYLE;
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -27,11 +27,14 @@ public class LangManager {
COMMAND_ERROR_UNKNOWN, COMMAND_ERROR_UNKNOWN,
// Command Descriptions // Command Descriptions
COMMAND_DESCRIPTIONS,
COMMAND_DESCRIPTIONS_USAGE,
COMMAND_DESCRIPTIONS_HELP_1,
COMMAND_DESCRIPTIONS_HELP_2,
COMMAND_DESCRIPTION_ADD, COMMAND_DESCRIPTION_ADD,
COMMAND_DESCRIPTION_DATA, COMMAND_DESCRIPTION_DATA,
COMMAND_DESCRIPTION_DEFAULT, COMMAND_DESCRIPTION_DEFAULT,
COMMAND_DESCRIPTION_EDIT, COMMAND_DESCRIPTION_EDIT,
COMMAND_DESCRIPTION_EFFECT,
COMMAND_DESCRIPTION_EFFECTS, COMMAND_DESCRIPTION_EFFECTS,
COMMAND_DESCRIPTION_FIXED, COMMAND_DESCRIPTION_FIXED,
COMMAND_DESCRIPTION_GROUP, COMMAND_DESCRIPTION_GROUP,
@ -42,7 +45,6 @@ public class LangManager {
COMMAND_DESCRIPTION_RELOAD, COMMAND_DESCRIPTION_RELOAD,
COMMAND_DESCRIPTION_REMOVE, COMMAND_DESCRIPTION_REMOVE,
COMMAND_DESCRIPTION_RESET, COMMAND_DESCRIPTION_RESET,
COMMAND_DESCRIPTION_STYLE,
COMMAND_DESCRIPTION_STYLES, COMMAND_DESCRIPTION_STYLES,
COMMAND_DESCRIPTION_TOGGLE, COMMAND_DESCRIPTION_TOGGLE,
COMMAND_DESCRIPTION_VERSION, COMMAND_DESCRIPTION_VERSION,
@ -426,6 +428,7 @@ public class LangManager {
* *
* @param player The player to send the message to * @param player The player to send the message to
* @param message The message to send to the player * @param message The message to send to the player
* @param includePrefix If the prefix should be included
*/ */
public static void sendCustomMessage(Player player, String message) { public static void sendCustomMessage(Player player, String message) {
if (!PSetting.MESSAGES_ENABLED.getBoolean()) return; if (!PSetting.MESSAGES_ENABLED.getBoolean()) return;
@ -450,6 +453,36 @@ public class LangManager {
sendCustomMessage(pplayer.getPlayer(), message); sendCustomMessage(pplayer.getPlayer(), message);
} }
/**
* Sends a message to a Player without the prefix
*
* @param player The plaeyr to send the message to
* @param messageType The message type to send the player
* @param replacements The replacements for the message
*/
public static void sendSimpleMessage(Player player, Lang messageType, Object... replacements) {
if (!PSetting.MESSAGES_ENABLED.getBoolean()) return;
String message = messageType.get(replacements);
if (message.length() == 0) return;
if (message.trim().equals("")) return;
player.sendMessage(message);
}
/**
* Sends a message to a PPlayer without the prefix
*
* @param player The plaeyr to send the message to
* @param messageType The message type to send the player
* @param replacements The replacements for the message
*/
public static void sendSimpleMessage(PPlayer pplayer, Lang messageType, Object... replacements) {
sendSimpleMessage(pplayer.getPlayer(), messageType, replacements);
}
/** /**
* Translates all ampersand symbols into the Minecraft chat color symbol * Translates all ampersand symbols into the Minecraft chat color symbol
* *

View file

@ -21,7 +21,7 @@ public class PluginUpdateListener implements Listener {
if (PlayerParticles.updateVersion != null) { // @formatter:off if (PlayerParticles.updateVersion != null) { // @formatter:off
LangManager.sendCustomMessage(e.getPlayer(), ChatColor.YELLOW + "An update (" + ChatColor.AQUA + "v" + PlayerParticles.updateVersion + ChatColor.YELLOW + ") is available! " + LangManager.sendCustomMessage(e.getPlayer(), ChatColor.YELLOW + "An update (" + ChatColor.AQUA + "v" + PlayerParticles.updateVersion + ChatColor.YELLOW + ") is available! " +
"You are running " + ChatColor.AQUA + "v" + PlayerParticles.getPlugin().getDescription().getVersion() + ChatColor.YELLOW + "You are running " + ChatColor.AQUA + "v" + PlayerParticles.getPlugin().getDescription().getVersion() + ChatColor.YELLOW +
". https://dev.bukkit.org/projects/playerparticles"); ". https://www.spigotmc.org/resources/playerparticles.40261/");
} // @formatter:on } // @formatter:on
} }
} }

View file

@ -35,3 +35,13 @@ rainbows:
effect: 'entity_effect' effect: 'entity_effect'
style: 'feet' style: 'feet'
data: 'rainbow' data: 'rainbow'
angel:
icon: 'ENDER_CHEST'
1:
effect: 'dust'
style: 'wings'
data: '255 255 255'
2:
effect: 'dust'
style: 'halo'
data: '255 255 0'

View file

@ -13,14 +13,17 @@ command-error-no-effects: '&cYou must have access to effects to use this command
command-error-unknown: '&cUnknown command, use &b/pp help &cfor a list of commands.' command-error-unknown: '&cUnknown command, use &b/pp help &cfor a list of commands.'
# Command Descriptions # Command Descriptions
command-description-add: 'Add a particle to your active particles' command-descriptions: '&eThe following commands are available:'
command-descriptions-usage: '&e/pp {0} {1}'
command-descriptions-help-1: '&7> &b/pp {0} &e- {1}'
command-descriptions-help-2: '&7> &b/pp {0} {1} &e- {2}'
command-description-add: 'Add a new particle'
command-description-data: 'Check what type of data an effect uses' command-description-data: 'Check what type of data an effect uses'
command-description-default: 'The main command. By default, opens the GUI' command-description-default: 'The main command. By default, opens the GUI'
command-description-edit: 'Edit the effect, style, or data of an active particle' command-description-edit: 'Edit a particle'
command-description-effect: '&cThis command has been removed, use &b/pp help &cto find new commands'
command-description-effects: 'Display a list of effects you can use' command-description-effects: 'Display a list of effects you can use'
command-description-fixed: 'Create, edit, and remove fixed particle effects' command-description-fixed: 'Manage your fixed effects'
command-description-group: 'Save, load, and remove particle groups' command-description-group: 'Manage your groups'
command-description-gui: 'Display the GUI for easy editing of particles' command-description-gui: 'Display the GUI for easy editing of particles'
command-description-help: 'Displays the help menu... You have arrived' command-description-help: 'Displays the help menu... You have arrived'
command-description-info: 'Gets the description of one of your active particles' command-description-info: 'Gets the description of one of your active particles'
@ -28,10 +31,9 @@ command-description-list: 'Lists the IDs of your active particles'
command-description-reload: 'Reloads the config.yml and lang file' command-description-reload: 'Reloads the config.yml and lang file'
command-description-remove: 'Removes one of your active particles' command-description-remove: 'Removes one of your active particles'
command-description-reset: 'Removes all your active particles' command-description-reset: 'Removes all your active particles'
command-description-style: '&cThis command has been removed, use &b/pp help &cto find new commands'
command-description-styles: 'Display a list of styles you can use' command-description-styles: 'Display a list of styles you can use'
command-description-toggle: 'Toggles particle visibility on/off' command-description-toggle: 'Toggles particle visibility on/off'
command-description-version: 'Display the current version of the plugin and the author' command-description-version: 'Display the plugin version and author'
command-description-worlds: 'Find out what worlds particles are disabled in' command-description-worlds: 'Find out what worlds particles are disabled in'
# Sub-Command Usage # Sub-Command Usage

View file

@ -4,7 +4,7 @@ version: 6.0
api-version: 1.13 api-version: 1.13
description: Display particles around your player using customized styles and data! description: Display particles around your player using customized styles and data!
author: Esophose author: Esophose
website: https://dev.bukkit.org/projects/playerparticles website: https://www.spigotmc.org/resources/playerparticles.40261/
commands: commands:
pp: pp:
description: The main PlayerParticles command. By default, opens the GUI. description: The main PlayerParticles command. By default, opens the GUI.