mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-02-11 03:29:53 +00:00
'/pp help' text formatting, remove removed commands
This commit is contained in:
parent
5c2a074c4f
commit
9cd63bb878
11 changed files with 65 additions and 100 deletions
|
@ -4,7 +4,6 @@
|
|||
* + Add new style 'doubleorbit'
|
||||
* * 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
|
||||
* * 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
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package com.esophose.playerparticles.command;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import com.esophose.playerparticles.manager.LangManager;
|
||||
import com.esophose.playerparticles.manager.LangManager.Lang;
|
||||
import com.esophose.playerparticles.particles.PPlayer;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public interface CommandModule {
|
||||
|
||||
/**
|
||||
|
@ -63,8 +60,7 @@ public interface CommandModule {
|
|||
* @param command The command to display usage for
|
||||
*/
|
||||
public static void printUsage(PPlayer pplayer, CommandModule command) {
|
||||
Object[] args = new Object[] { command.getName(), command.getArguments() };
|
||||
LangManager.sendCustomMessage(pplayer, new MessageFormat(ChatColor.YELLOW + "/pp {0} {1}").format(args));
|
||||
LangManager.sendMessage(pplayer, Lang.COMMAND_DESCRIPTIONS_USAGE, command.getName(), command.getArguments());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,11 +71,9 @@ public interface CommandModule {
|
|||
*/
|
||||
public static void printUsageWithDescription(PPlayer pplayer, CommandModule command) {
|
||||
if (command.getArguments().length() == 0) {
|
||||
Object[] args = new Object[] { command.getName(), LangManager.getText(command.getDescription()) };
|
||||
LangManager.sendCustomMessage(pplayer, new MessageFormat(ChatColor.YELLOW + "/pp {0} - {1}").format(args));
|
||||
LangManager.sendSimpleMessage(pplayer, Lang.COMMAND_DESCRIPTIONS_HELP_1, command.getName(), LangManager.getText(command.getDescription()));
|
||||
} else {
|
||||
Object[] args = new Object[] { command.getName(), command.getArguments(), LangManager.getText(command.getDescription()) };
|
||||
LangManager.sendCustomMessage(pplayer, new MessageFormat(ChatColor.YELLOW + "/pp {0} {1} - {2}").format(args));
|
||||
LangManager.sendSimpleMessage(pplayer, Lang.COMMAND_DESCRIPTIONS_HELP_2, command.getName(), command.getArguments(), LangManager.getText(command.getDescription()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,17 +3,18 @@ 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 HelpCommandModule implements CommandModule {
|
||||
|
||||
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();
|
||||
for (CommandModule cmd : cmds) {
|
||||
CommandModule.printUsageWithDescription(pplayer, cmd);
|
||||
}
|
||||
for (CommandModule cmd : cmds)
|
||||
if (!(cmd instanceof DefaultCommandModule))
|
||||
CommandModule.printUsageWithDescription(pplayer, cmd);
|
||||
}
|
||||
|
||||
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
|
||||
|
|
|
@ -29,7 +29,6 @@ public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
|
|||
commands.add(new DataCommandModule());
|
||||
commands.add(new DefaultCommandModule());
|
||||
commands.add(new EditCommandModule());
|
||||
commands.add(new EffectCommandModule());
|
||||
commands.add(new EffectsCommandModule());
|
||||
commands.add(new FixedCommandModule());
|
||||
commands.add(new GroupCommandModule());
|
||||
|
@ -39,7 +38,6 @@ public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
|
|||
commands.add(new ReloadCommandModule());
|
||||
commands.add(new RemoveCommandModule());
|
||||
commands.add(new ResetCommandModule());
|
||||
commands.add(new StyleCommandModule());
|
||||
commands.add(new StylesCommandModule());
|
||||
commands.add(new ToggleCommandModule());
|
||||
commands.add(new VersionCommandModule());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
|
@ -27,11 +27,14 @@ public class LangManager {
|
|||
COMMAND_ERROR_UNKNOWN,
|
||||
|
||||
// Command Descriptions
|
||||
COMMAND_DESCRIPTIONS,
|
||||
COMMAND_DESCRIPTIONS_USAGE,
|
||||
COMMAND_DESCRIPTIONS_HELP_1,
|
||||
COMMAND_DESCRIPTIONS_HELP_2,
|
||||
COMMAND_DESCRIPTION_ADD,
|
||||
COMMAND_DESCRIPTION_DATA,
|
||||
COMMAND_DESCRIPTION_DEFAULT,
|
||||
COMMAND_DESCRIPTION_EDIT,
|
||||
COMMAND_DESCRIPTION_EFFECT,
|
||||
COMMAND_DESCRIPTION_EFFECTS,
|
||||
COMMAND_DESCRIPTION_FIXED,
|
||||
COMMAND_DESCRIPTION_GROUP,
|
||||
|
@ -42,7 +45,6 @@ public class LangManager {
|
|||
COMMAND_DESCRIPTION_RELOAD,
|
||||
COMMAND_DESCRIPTION_REMOVE,
|
||||
COMMAND_DESCRIPTION_RESET,
|
||||
COMMAND_DESCRIPTION_STYLE,
|
||||
COMMAND_DESCRIPTION_STYLES,
|
||||
COMMAND_DESCRIPTION_TOGGLE,
|
||||
COMMAND_DESCRIPTION_VERSION,
|
||||
|
@ -419,13 +421,14 @@ public class LangManager {
|
|||
public static void sendMessage(PPlayer pplayer, Lang messageType, Object... replacements) {
|
||||
sendMessage(pplayer.getPlayer(), messageType, replacements);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sends a custom message to a player
|
||||
* Used in cases of string building
|
||||
*
|
||||
* @param player The player to send the message to
|
||||
* @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) {
|
||||
if (!PSetting.MESSAGES_ENABLED.getBoolean()) return;
|
||||
|
@ -449,6 +452,36 @@ public class LangManager {
|
|||
public static void sendCustomMessage(PPlayer pplayer, String 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
|
||||
|
|
|
@ -21,7 +21,7 @@ public class PluginUpdateListener implements Listener {
|
|||
if (PlayerParticles.updateVersion != null) { // @formatter:off
|
||||
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 +
|
||||
". https://dev.bukkit.org/projects/playerparticles");
|
||||
". https://www.spigotmc.org/resources/playerparticles.40261/");
|
||||
} // @formatter:on
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,3 +35,13 @@ rainbows:
|
|||
effect: 'entity_effect'
|
||||
style: 'feet'
|
||||
data: 'rainbow'
|
||||
angel:
|
||||
icon: 'ENDER_CHEST'
|
||||
1:
|
||||
effect: 'dust'
|
||||
style: 'wings'
|
||||
data: '255 255 255'
|
||||
2:
|
||||
effect: 'dust'
|
||||
style: 'halo'
|
||||
data: '255 255 0'
|
|
@ -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 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-default: 'The main command. By default, opens the GUI'
|
||||
command-description-edit: 'Edit the effect, style, or data of an active particle'
|
||||
command-description-effect: '&cThis command has been removed, use &b/pp help &cto find new commands'
|
||||
command-description-edit: 'Edit a particle'
|
||||
command-description-effects: 'Display a list of effects you can use'
|
||||
command-description-fixed: 'Create, edit, and remove fixed particle effects'
|
||||
command-description-group: 'Save, load, and remove particle groups'
|
||||
command-description-fixed: 'Manage your fixed effects'
|
||||
command-description-group: 'Manage your groups'
|
||||
command-description-gui: 'Display the GUI for easy editing of particles'
|
||||
command-description-help: 'Displays the help menu... You have arrived'
|
||||
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-remove: 'Removes one of 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-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'
|
||||
|
||||
# Sub-Command Usage
|
||||
|
|
|
@ -4,7 +4,7 @@ version: 6.0
|
|||
api-version: 1.13
|
||||
description: Display particles around your player using customized styles and data!
|
||||
author: Esophose
|
||||
website: https://dev.bukkit.org/projects/playerparticles
|
||||
website: https://www.spigotmc.org/resources/playerparticles.40261/
|
||||
commands:
|
||||
pp:
|
||||
description: The main PlayerParticles command. By default, opens the GUI.
|
||||
|
|
Loading…
Reference in a new issue