Start CommandModules, Lang files

Still doesn't compile
This commit is contained in:
Esophose 2018-09-26 02:07:46 -06:00
parent 25e7d22110
commit febe2963d1
27 changed files with 1481 additions and 786 deletions

View file

@ -27,13 +27,12 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import com.esophose.playerparticles.command.ParticleCommandCompleter;
import com.esophose.playerparticles.command.ParticleCommandExecutor;
import com.esophose.playerparticles.command.ParticleCommandHandler;
import com.esophose.playerparticles.database.DatabaseConnector;
import com.esophose.playerparticles.database.MySqlDatabaseConnector;
import com.esophose.playerparticles.database.SqliteDatabaseConnector;
import com.esophose.playerparticles.gui.PlayerParticlesGui;
import com.esophose.playerparticles.manager.MessageManager;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.ParticleManager;
import com.esophose.playerparticles.styles.DefaultStyles;
import com.esophose.playerparticles.updater.PluginUpdateListener;
@ -67,14 +66,18 @@ public class PlayerParticles extends JavaPlugin {
*/
public void onEnable() {
pluginInstance = Bukkit.getServer().getPluginManager().getPlugin("PlayerParticles");
DefaultStyles.registerStyles();
MessageManager.setup(this.getConfig());
saveDefaultConfig();
getCommand("pp").setTabCompleter(new ParticleCommandCompleter());
getCommand("pp").setExecutor(new ParticleCommandExecutor());
LangManager.setup();
getCommand("pp").setTabCompleter(new ParticleCommandHandler());
getCommand("pp").setExecutor(new ParticleCommandHandler());
Bukkit.getPluginManager().registerEvents(new ParticleManager(), this);
Bukkit.getPluginManager().registerEvents(new PluginUpdateListener(), this);
Bukkit.getPluginManager().registerEvents(new PlayerParticlesGui(), this);
saveDefaultConfig();
double configVersion = getConfig().getDouble("version");
if (configVersion < Double.parseDouble(getDescription().getVersion())) {
File configFile = new File(getDataFolder(), "config.yml");

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class AddCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "add";
}
public String getDescription() {
return Lang.ADD_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "<effect> <style> [data]";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -1,15 +1,53 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.particles.PPlayer;
public interface CommandModule {
/**
* Called when this command gets executed
*
* @param pplayer The PPlayer who executed this command
* @param args The arguments to this command
*/
public void onCommandExecute(PPlayer pplayer, String[] args);
public void onTabComplete(PPlayer pplayer, String[] args);
/**
* Called when a player tries to tab complete this command
*
* @param pplayer The PPlayer who is tab completing this command
* @param args Arguments typed so far
*/
public List<String> onTabComplete(PPlayer pplayer, String[] args);
/**
* Gets the name of this command
*
* @return The name of this command
*/
public String getName();
/**
* Gets the description of this command
*
* @return The description of this command
*/
public String getDescription();
/**
* Gets any arguments this command has
*
* @return The arguments this command has
*/
public String getArguments();
/**
* True if this command requires the player to have any effects
*
* @return If the player must have effects to use this command
*/
public boolean requiresEffects();
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class DataCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "data";
}
public String getDescription() {
return Lang.DATA_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "<args>";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,35 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class DefaultCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
// The default command just opens the GUI, execute the GUICommandModule
ParticleCommandHandler.findMatchingCommand("gui").onCommandExecute(pplayer, args);
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "";
}
public String getDescription() {
return Lang.DEFAULT_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class EditCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "edit";
}
public String getDescription() {
return Lang.EDIT_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
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) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "effect";
}
public String getDescription() {
return Lang.EFFECT_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class EffectsCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "effects";
}
public String getDescription() {
return Lang.EFFECTS_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return false;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class FixedCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "fixed";
}
public String getDescription() {
return Lang.FIXED_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "<args>";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,65 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.gui.PlayerParticlesGui;
import com.esophose.playerparticles.gui.PlayerParticlesGui.GuiState;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class GUICommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
boolean byDefault = false;
if (args.length > 0 && args[0].equals("byDefault")) {
byDefault = true;
}
if (PlayerParticlesGui.isGuiDisabled()) {
if (byDefault) {
LangManager.sendMessage(pplayer, Lang.INVALID_ARGUMENTS);
} else {
LangManager.sendMessage(pplayer, Lang.GUI_DISABLED);
}
return;
}
if (PermissionManager.getEffectsUserHasPermissionFor(pplayer.getPlayer()).size() == 1) {
if (byDefault) {
LangManager.sendMessage(pplayer, Lang.INVALID_ARGUMENTS);
} else {
LangManager.sendMessage(pplayer, Lang.NO_PARTICLES);
}
return;
}
if (byDefault) {
LangManager.sendMessage(pplayer, Lang.GUI_BY_DEFAULT);
}
PlayerParticlesGui.changeState(pplayer, GuiState.DEFAULT);
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "gui";
}
public String getDescription() {
return Lang.GUI_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class GroupCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "group";
}
public String getDescription() {
return Lang.GROUP_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "<args>";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
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) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "help";
}
public String getDescription() {
return Lang.HELP_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return false;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class InfoCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "info";
}
public String getDescription() {
return Lang.INFO_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "<id>";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class ListCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "list";
}
public String getDescription() {
return Lang.LIST_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -1,103 +0,0 @@
/**
* Copyright Esophose 2018
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
* be distributed to any person by any means.
*/
package com.esophose.playerparticles.command;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.esophose.playerparticles.manager.MessageManager.MessageType;
import com.esophose.playerparticles.manager.DataManager;
import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleEffect;
import com.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
import com.esophose.playerparticles.util.ParticleUtils;
public class ParticleCommandCompleter implements TabCompleter {
private static final String[] COMMANDS = { "help", "gui", "effect", "effects", "style", "styles", "data", "fixed", "reset", "worlds", "version" };
private static final String[] FIXED_COMMANDS = { "create", "remove", "list", "info" };
private static final List<String> BLOCK_MATERIALS = ParticleUtils.getAllBlockMaterials();
private static final List<String> ITEM_MATERIALS = ParticleUtils.getAllItemMaterials();
/**
* Activated when a user pushes tab in chat prefixed with /pp
*
* @param sender The sender that hit tab, should always be a player
* @param cmd The command the player is executing
* @param alias The possible alias for the command
* @param args All arguments following the command
* @return A list of commands available to the sender
*/
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
if (!(sender instanceof Player)) return new ArrayList<String>();
List<String> completions = new ArrayList<String>();
if (cmd.getName().equalsIgnoreCase("pp")) {
if (args.length > 1) {
if (args[0].equalsIgnoreCase("effect") && args.length == 2) {
List<String> commands = PermissionManager.getEffectsUserHasPermissionFor((Player) sender);
StringUtil.copyPartialMatches(args[1], commands, completions);
} else if (args[0].equalsIgnoreCase("style") && args.length == 2) {
List<String> commands = PermissionManager.getStylesUserHasPermissionFor((Player) sender);
StringUtil.copyPartialMatches(args[1], commands, completions);
} else if (args[0].equalsIgnoreCase("fixed") && args.length > 1) {
if (args.length == 2) {
List<String> commands = Arrays.asList(FIXED_COMMANDS);
StringUtil.copyPartialMatches(args[1], commands, completions);
} else if (args[1].equalsIgnoreCase("create")) {
completions.add("<x> <y> <z> <effect> <style> [data]");
} else if ((args[1].equalsIgnoreCase("remove") || args[1].equalsIgnoreCase("info")) && args.length == 3) {
completions.add("<id>");
}
} else if (args[0].equalsIgnoreCase("data")) {
PPlayer pplayer = DataManager.getPPlayer(((Player) sender).getUniqueId());
if (pplayer == null) {
completions.add(ChatColor.stripColor(MessageType.NO_DATA_USAGE.getMessage()));
} else if (pplayer.getParticleEffect().hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA) && args.length == 2) {
if (pplayer.getParticleEffect() == ParticleEffect.ITEM) {
StringUtil.copyPartialMatches(args[1], ITEM_MATERIALS, completions);
} else {
StringUtil.copyPartialMatches(args[1], BLOCK_MATERIALS, completions);
}
} else if (pplayer.getParticleEffect().hasProperty(ParticleProperty.COLORABLE)) {
if (pplayer.getParticleEffect() == ParticleEffect.NOTE && args.length == 2) {
completions.add("<0-23>");
StringUtil.copyPartialMatches(args[args.length - 1], Arrays.asList(new String[] { "rainbow" }), completions);
} else if (pplayer.getParticleEffect() != ParticleEffect.NOTE && args.length > 1 && args.length < 5) {
completions.add("<0-255>");
if (args.length == 2) {
StringUtil.copyPartialMatches(args[args.length - 1], Arrays.asList(new String[] { "rainbow" }), completions);
}
}
} else if (args.length == 2) {
completions.add(ChatColor.stripColor(MessageType.NO_DATA_USAGE.getMessage()));
}
}
} else {
List<String> commands = new ArrayList<String>(Arrays.asList(COMMANDS));
StringUtil.copyPartialMatches(args[0], commands, completions);
}
}
return completions;
}
public static String[] getCommandsList() {
return COMMANDS;
}
}

View file

@ -21,17 +21,20 @@ import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import org.bukkit.util.StringUtil;
import com.esophose.playerparticles.PlayerParticles;
import com.esophose.playerparticles.gui.PlayerParticlesGui;
import com.esophose.playerparticles.gui.PlayerParticlesGui.GuiState;
import com.esophose.playerparticles.manager.DataManager;
import com.esophose.playerparticles.manager.MessageManager;
import com.esophose.playerparticles.manager.MessageManager.MessageType;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.manager.ParticleManager;
import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.particles.FixedParticleEffect;
import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleEffect;
import com.esophose.playerparticles.particles.ParticleEffect.NoteColor;
import com.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
@ -41,102 +44,71 @@ import com.esophose.playerparticles.styles.api.ParticleStyle;
import com.esophose.playerparticles.styles.api.ParticleStyleManager;
import com.esophose.playerparticles.util.ParticleUtils;
public class ParticleCommandExecutor implements CommandExecutor {
public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
/**
* A list of all valid commands
* A list of all commands
*/
private static List<String> validCommands;
private static List<CommandModule> commands;
static {
validCommands = new ArrayList<String>();
validCommands.addAll(Arrays.asList(ParticleCommandCompleter.getCommandsList()));
commands.add(new AddCommandModule());
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());
commands.add(new GUICommandModule());
commands.add(new HelpCommandModule());
commands.add(new InfoCommandModule());
commands.add(new ListCommandModule());
commands.add(new RemoveCommandModule());
commands.add(new ResetCommandModule());
commands.add(new StyleCommandModule());
commands.add(new StylesCommandModule());
commands.add(new VersionCommandModule());
commands.add(new WorldsCommandModule());
}
public static CommandModule findMatchingCommand(String commandName) {
for (CommandModule commandModule : commands)
if (commandModule.getName().equalsIgnoreCase(commandName))
return commandModule;
return null;
}
/**
* Called when a player executes a /pp command
* Checks what /pp command it is and calls the correct method
* Checks what /pp command it is and calls the corresponding module
*
* @param sender Who executed the command
* @param cmd The command
* @param label The command label
* @param args The arguments following the command
* @return True if everything went as planned (should always be true)
* @return true
*/
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) return true;
Player p = (Player) sender;
if (args.length == 0) {
onGUI(p, true);
return true;
}
DataManager.getPPlayer(p.getUniqueId(), (pplayer) -> {
String commandName = args.length > 0 ? args[0] : "";
CommandModule commandModule = findMatchingCommand(commandName);
if (!validCommands.contains(args[0].toLowerCase())) {
MessageManager.sendMessage(p, MessageType.INVALID_ARGUMENTS);
return true;
}
String[] cmdArgs = new String[0];
if (args.length >= 2) cmdArgs = Arrays.copyOfRange(args, 1, args.length);
// Commands that don't require access to any effects
switch (args[0].toLowerCase()) {
case "help":
onHelp(p);
return true;
case "worlds":
onWorlds(p);
return true;
case "version":
onVersion(p);
return true;
case "effects":
onEffects(p);
return true;
case "styles":
onStyles(p);
return true;
case "style":
onStyle(p, cmdArgs);
return true;
}
// Commands that require access to effects
if (PermissionManager.getEffectsUserHasPermissionFor(p).size() != 1) {
final String[] f_cmdArgs = cmdArgs;
DataManager.getInstance().getPPlayer(p.getUniqueId(), (pplayer) -> { // The PPlayer MUST be loaded before we can execute any of these commands
// If the player no longer has permission for their effect, remove it
if (!PermissionManager.hasEffectPermission(p, pplayer.getParticleEffect())) {
DataManager.getInstance().savePPlayer(pplayer.getUniqueId(), ParticleEffect.NONE);
}
// If the player no longer has permission for their style, default to none
if (!PermissionManager.hasStylePermission(p, pplayer.getParticleStyle())) {
DataManager.getInstance().savePPlayer(pplayer.getUniqueId(), DefaultStyles.NONE);
}
switch (args[0].toLowerCase()) {
case "effect":
onEffect(p, f_cmdArgs);
break;
case "data":
onData(p, f_cmdArgs);
break;
case "fixed":
onFixed(p, f_cmdArgs);
break;
case "reset":
onReset(p, f_cmdArgs);
break;
case "gui":
onGUI(p, false);
break;
}
});
} else {
MessageManager.sendMessage(p, MessageType.NO_PARTICLES);
}
if (commandModule != null) {
if (commandModule.requiresEffects() && PermissionManager.getEffectsUserHasPermissionFor(p).size() == 1) {
LangManager.sendMessage(p, Lang.NO_PARTICLES); // TODO: Rename to NO_EFFECTS
} else {
String[] cmdArgs = new String[0];
if (args.length > 1) cmdArgs = Arrays.copyOfRange(args, 1, args.length);
commandModule.onCommandExecute(pplayer, cmdArgs);
}
} else {
LangManager.sendMessage(p, Lang.INVALID_ARGUMENTS); // TODO: Rename to UNKNOWN_COMMAND
}
});
return true;
}
@ -159,38 +131,8 @@ public class ParticleCommandExecutor implements CommandExecutor {
* @param p The player who used the command
*/
private void onHelp(Player p) {
MessageManager.sendMessage(p, MessageType.AVAILABLE_COMMANDS);
MessageManager.sendMessage(p, MessageType.COMMAND_USAGE);
}
/**
* Called when a player uses /pp worlds
*
* @param p The player who used the command
*/
private void onWorlds(Player p) {
if (DataManager.getInstance().getDisabledWorlds() == null || DataManager.getInstance().getDisabledWorlds().isEmpty()) {
MessageManager.sendMessage(p, MessageType.DISABLED_WORLDS_NONE);
return;
}
String worlds = "";
for (String s : DataManager.getInstance().getDisabledWorlds()) {
worlds += s + ", ";
}
if (worlds.length() > 2) worlds = worlds.substring(0, worlds.length() - 2);
MessageManager.sendCustomMessage(p, MessageType.DISABLED_WORLDS.getMessage() + " " + worlds);
}
/**
* Called when a player uses /pp version
*
* @param p The player who used the command
*/
private void onVersion(Player p) {
MessageManager.sendCustomMessage(p, ChatColor.GOLD + "Running PlayerParticles v" + PlayerParticles.getPlugin().getDescription().getVersion());
MessageManager.sendCustomMessage(p, ChatColor.GOLD + "Plugin created by: Esophose");
LangManager.sendMessage(p, Lang.AVAILABLE_COMMANDS);
LangManager.sendMessage(p, Lang.COMMAND_USAGE);
}
/**
@ -204,22 +146,22 @@ public class ParticleCommandExecutor implements CommandExecutor {
if ((!effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA) && !effect.hasProperty(ParticleProperty.COLORABLE)) || args.length == 0) {
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
if (effect == ParticleEffect.NOTE) {
MessageManager.sendMessage(p, MessageType.DATA_USAGE, "note");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.NOTE_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_USAGE, "note");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.NOTE_DATA_USAGE.get());
} else {
MessageManager.sendMessage(p, MessageType.DATA_USAGE, "color");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.COLOR_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_USAGE, "color");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.COLOR_DATA_USAGE.get());
}
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
if (effect == ParticleEffect.ITEM) {
MessageManager.sendMessage(p, MessageType.DATA_USAGE, "item");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.ITEM_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_USAGE, "item");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.ITEM_DATA_USAGE.get());
} else {
MessageManager.sendMessage(p, MessageType.DATA_USAGE, "block");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.BLOCK_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_USAGE, "block");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.BLOCK_DATA_USAGE.get());
}
} else {
MessageManager.sendMessage(p, MessageType.NO_DATA_USAGE);
LangManager.sendMessage(p, Lang.NO_DATA_USAGE);
}
return;
}
@ -227,7 +169,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
if (effect == ParticleEffect.NOTE) {
if (args[0].equalsIgnoreCase("rainbow")) {
DataManager.getInstance().savePPlayer(p.getUniqueId(), new NoteColor(99));
MessageManager.sendMessage(p, MessageType.DATA_APPLIED, "note");
LangManager.sendMessage(p, Lang.DATA_APPLIED, "note");
return;
}
@ -235,23 +177,23 @@ public class ParticleCommandExecutor implements CommandExecutor {
try {
note = Integer.parseInt(args[0]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.DATA_INVALID_ARGUMENTS, "note");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.NOTE_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_INVALID_ARGUMENTS, "note");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.NOTE_DATA_USAGE.get());
return;
}
if (note < 0 || note > 23) {
MessageManager.sendMessage(p, MessageType.DATA_INVALID_ARGUMENTS, "note");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.NOTE_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_INVALID_ARGUMENTS, "note");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.NOTE_DATA_USAGE.get());
return;
}
DataManager.getInstance().savePPlayer(p.getUniqueId(), new NoteColor(note));
MessageManager.sendMessage(p, MessageType.DATA_APPLIED, "note");
LangManager.sendMessage(p, Lang.DATA_APPLIED, "note");
} else {
if (args[0].equalsIgnoreCase("rainbow")) {
DataManager.getInstance().savePPlayer(p.getUniqueId(), new OrdinaryColor(999, 999, 999));
MessageManager.sendMessage(p, MessageType.DATA_APPLIED, "color");
LangManager.sendMessage(p, Lang.DATA_APPLIED, "color");
} else if (args.length >= 3) {
int r = -1;
int g = -1;
@ -262,22 +204,22 @@ public class ParticleCommandExecutor implements CommandExecutor {
g = Integer.parseInt(args[1]);
b = Integer.parseInt(args[2]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.DATA_INVALID_ARGUMENTS, "color");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.COLOR_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_INVALID_ARGUMENTS, "color");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.COLOR_DATA_USAGE.get());
return;
}
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {
MessageManager.sendMessage(p, MessageType.DATA_INVALID_ARGUMENTS, "color");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.COLOR_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_INVALID_ARGUMENTS, "color");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.COLOR_DATA_USAGE.get());
return;
}
DataManager.getInstance().savePPlayer(p.getUniqueId(), new OrdinaryColor(r, g, b));
MessageManager.sendMessage(p, MessageType.DATA_APPLIED, "color");
LangManager.sendMessage(p, Lang.DATA_APPLIED, "color");
} else {
MessageManager.sendMessage(p, MessageType.DATA_INVALID_ARGUMENTS, "color");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.COLOR_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_INVALID_ARGUMENTS, "color");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.COLOR_DATA_USAGE.get());
}
}
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
@ -288,19 +230,19 @@ public class ParticleCommandExecutor implements CommandExecutor {
if (material == null) material = Material.matchMaterial(args[0]);
if (material == null) throw new Exception();
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.DATA_MATERIAL_UNKNOWN, "item");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.ITEM_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_MATERIAL_UNKNOWN, "item");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.ITEM_DATA_USAGE.get());
return;
}
if (material.isBlock()) {
MessageManager.sendMessage(p, MessageType.DATA_MATERIAL_MISMATCH, "item");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.ITEM_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_MATERIAL_MISMATCH, "item");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.ITEM_DATA_USAGE.get());
return;
}
DataManager.getInstance().savePPlayer(p.getUniqueId(), new ItemData(material));
MessageManager.sendMessage(p, MessageType.DATA_APPLIED, "item");
LangManager.sendMessage(p, Lang.DATA_APPLIED, "item");
} else {
Material material = null;
try {
@ -308,19 +250,19 @@ public class ParticleCommandExecutor implements CommandExecutor {
if (material == null) material = Material.matchMaterial(args[0]);
if (material == null) throw new Exception();
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.DATA_MATERIAL_UNKNOWN, "block");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.BLOCK_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_MATERIAL_UNKNOWN, "block");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.BLOCK_DATA_USAGE.get());
return;
}
if (!material.isBlock()) {
MessageManager.sendMessage(p, MessageType.DATA_MATERIAL_MISMATCH, "block");
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.BLOCK_DATA_USAGE.getMessage());
LangManager.sendMessage(p, Lang.DATA_MATERIAL_MISMATCH, "block");
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.BLOCK_DATA_USAGE.get());
return;
}
DataManager.getInstance().savePPlayer(p.getUniqueId(), new BlockData(material));
MessageManager.sendMessage(p, MessageType.DATA_APPLIED, "block");
LangManager.sendMessage(p, Lang.DATA_APPLIED, "block");
}
}
}
@ -336,21 +278,21 @@ public class ParticleCommandExecutor implements CommandExecutor {
if (args.length >= 1) {
String altPlayerName = args[0];
if (!PermissionManager.canUseForceReset(p)) {
MessageManager.sendMessage(p, MessageType.FAILED_EXECUTE_NO_PERMISSION, altPlayerName);
LangManager.sendMessage(p, Lang.FAILED_EXECUTE_NO_PERMISSION, altPlayerName);
} else {
Player altPlayer = getOnlinePlayerByName(altPlayerName);
if (altPlayer == null) {
MessageManager.sendMessage(p, MessageType.FAILED_EXECUTE_NOT_FOUND, altPlayerName);
LangManager.sendMessage(p, Lang.FAILED_EXECUTE_NOT_FOUND, altPlayerName);
} else {
DataManager.getInstance().resetPPlayer(altPlayer.getUniqueId());
MessageManager.sendMessage(altPlayer, MessageType.RESET);
LangManager.sendMessage(altPlayer, Lang.RESET);
MessageManager.sendMessage(p, MessageType.EXECUTED_FOR_PLAYER, altPlayer.getName());
LangManager.sendMessage(p, Lang.EXECUTED_FOR_PLAYER, altPlayer.getName());
}
}
} else {
DataManager.getInstance().resetPPlayer(p.getUniqueId());
MessageManager.sendMessage(p, MessageType.RESET);
LangManager.sendMessage(p, Lang.RESET);
}
}
@ -362,25 +304,25 @@ public class ParticleCommandExecutor implements CommandExecutor {
*/
private void onEffect(Player p, String[] args) {
if (args.length == 0) {
MessageManager.sendMessage(p, MessageType.INVALID_TYPE);
LangManager.sendMessage(p, Lang.INVALID_TYPE);
return;
}
String argument = args[0];
if (ParticleManager.effectFromString(argument) != null) {
ParticleEffect effect = ParticleManager.effectFromString(argument);
if (!PermissionManager.hasEffectPermission(p, effect)) {
MessageManager.sendMessage(p, MessageType.NO_PERMISSION, effect.getName());
LangManager.sendMessage(p, Lang.NO_PERMISSION, effect.getName());
return;
}
DataManager.getInstance().savePPlayer(p.getUniqueId(), effect);
if (effect != ParticleEffect.NONE) {
MessageManager.sendMessage(p, MessageType.NOW_USING, effect.getName());
LangManager.sendMessage(p, Lang.NOW_USING, effect.getName());
} else {
MessageManager.sendMessage(p, MessageType.CLEARED_PARTICLES);
LangManager.sendMessage(p, Lang.CLEARED_PARTICLES);
}
return;
}
MessageManager.sendMessage(p, MessageType.INVALID_TYPE);
LangManager.sendMessage(p, Lang.INVALID_TYPE);
}
/**
@ -390,11 +332,11 @@ public class ParticleCommandExecutor implements CommandExecutor {
*/
private void onEffects(Player p) {
if (PermissionManager.getEffectsUserHasPermissionFor(p).size() == 1) {
MessageManager.sendMessage(p, MessageType.NO_PARTICLES);
LangManager.sendMessage(p, Lang.NO_PARTICLES);
return;
}
String toSend = MessageType.USE.getMessage() + " ";
String toSend = Lang.USE.get() + " ";
for (ParticleEffect effect : ParticleEffect.getSupportedEffects()) {
if (PermissionManager.hasEffectPermission(p, effect)) {
toSend += effect.getName() + ", ";
@ -405,8 +347,8 @@ public class ParticleCommandExecutor implements CommandExecutor {
toSend = toSend.substring(0, toSend.length() - 2);
}
MessageManager.sendCustomMessage(p, toSend);
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.PARTICLE_USAGE.getMessage());
LangManager.sendCustomMessage(p, toSend);
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.PARTICLE_USAGE.get());
}
/**
@ -417,29 +359,29 @@ public class ParticleCommandExecutor implements CommandExecutor {
*/
private void onStyle(Player p, String[] args) {
if (PermissionManager.getStylesUserHasPermissionFor(p).size() == 1) {
MessageManager.sendMessage(p, MessageType.NO_STYLES);
LangManager.sendMessage(p, Lang.NO_STYLES);
return;
}
if (args.length == 0) {
MessageManager.sendMessage(p, MessageType.INVALID_TYPE_STYLE);
LangManager.sendMessage(p, Lang.INVALID_TYPE_STYLE);
return;
}
String argument = args[0];
if (ParticleStyleManager.styleFromString(argument) != null) {
ParticleStyle style = ParticleStyleManager.styleFromString(argument);
if (!PermissionManager.hasStylePermission(p, style)) {
MessageManager.sendMessage(p, MessageType.NO_PERMISSION_STYLE, style.getName());
LangManager.sendMessage(p, Lang.NO_PERMISSION_STYLE, style.getName());
return;
}
DataManager.getInstance().savePPlayer(p.getUniqueId(), style);
if (style != DefaultStyles.NONE) {
MessageManager.sendMessage(p, MessageType.NOW_USING_STYLE, style.getName());
LangManager.sendMessage(p, Lang.NOW_USING_STYLE, style.getName());
} else {
MessageManager.sendMessage(p, MessageType.CLEARED_STYLE);
LangManager.sendMessage(p, Lang.CLEARED_STYLE);
}
return;
}
MessageManager.sendMessage(p, MessageType.INVALID_TYPE_STYLE);
LangManager.sendMessage(p, Lang.INVALID_TYPE_STYLE);
}
/**
@ -449,11 +391,11 @@ public class ParticleCommandExecutor implements CommandExecutor {
*/
private void onStyles(Player p) {
if (PermissionManager.getStylesUserHasPermissionFor(p).size() == 1) {
MessageManager.sendMessage(p, MessageType.NO_STYLES);
LangManager.sendMessage(p, Lang.NO_STYLES);
return;
}
String toSend = MessageType.USE.getMessage() + " ";
String toSend = Lang.USE.get() + " ";
for (ParticleStyle style : ParticleStyleManager.getStyles()) {
if (PermissionManager.hasStylePermission(p, style)) {
toSend += style.getName();
@ -464,8 +406,8 @@ public class ParticleCommandExecutor implements CommandExecutor {
toSend = toSend.substring(0, toSend.length() - 2);
}
MessageManager.sendCustomMessage(p, toSend);
MessageManager.sendCustomMessage(p, MessageType.USAGE.getMessage() + " " + MessageType.STYLE_USAGE.getMessage());
LangManager.sendCustomMessage(p, toSend);
LangManager.sendCustomMessage(p, Lang.USAGE.get() + " " + Lang.STYLE_USAGE.get());
}
/**
@ -476,17 +418,17 @@ public class ParticleCommandExecutor implements CommandExecutor {
*/
private void onFixed(Player p, String[] args) {
if (!PermissionManager.canUseFixedEffects(p)) {
MessageManager.sendMessage(p, MessageType.NO_PERMISSION_FIXED);
LangManager.sendMessage(p, Lang.NO_PERMISSION_FIXED);
return;
}
if (args.length == 0) { // General information on command
MessageManager.sendMessage(p, MessageType.INVALID_FIXED_COMMAND);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_CREATE);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_REMOVE);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_LIST);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_INFO);
if (p.hasPermission("playerparticles.fixed.clear")) MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_CLEAR);
LangManager.sendMessage(p, Lang.INVALID_FIXED_COMMAND);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CREATE);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_REMOVE);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_LIST);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_INFO);
if (p.hasPermission("playerparticles.fixed.clear")) LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CLEAR);
return;
}
@ -502,12 +444,12 @@ public class ParticleCommandExecutor implements CommandExecutor {
final String[] f_args = args;
DataManager.getInstance().hasPlayerReachedMaxFixedEffects(p.getUniqueId(), (reachedMax) -> {
if (reachedMax) {
MessageManager.sendMessage(p, MessageType.MAX_FIXED_EFFECTS_REACHED);
LangManager.sendMessage(p, Lang.MAX_FIXED_EFFECTS_REACHED);
return;
}
if (f_args.length < 5) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_MISSING_ARGS, (5 - f_args.length) + "");
LangManager.sendMessage(p, Lang.CREATE_FIXED_MISSING_ARGS, (5 - f_args.length) + "");
return;
}
@ -534,37 +476,37 @@ public class ParticleCommandExecutor implements CommandExecutor {
zPos = Double.parseDouble(f_args[2]);
}
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_INVALID_COORDS);
LangManager.sendMessage(p, Lang.CREATE_FIXED_INVALID_COORDS);
return;
}
double distanceFromEffect = p.getLocation().distance(new Location(p.getWorld(), xPos, yPos, zPos));
int maxCreationDistance = DataManager.getInstance().getMaxFixedEffectCreationDistance();
if (maxCreationDistance != 0 && distanceFromEffect > maxCreationDistance) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_OUT_OF_RANGE, maxCreationDistance + "");
LangManager.sendMessage(p, Lang.CREATE_FIXED_OUT_OF_RANGE, maxCreationDistance + "");
return;
}
ParticleEffect effect = ParticleManager.effectFromString(f_args[3]);
if (effect == null) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_INVALID_EFFECT, f_args[3]);
LangManager.sendMessage(p, Lang.CREATE_FIXED_INVALID_EFFECT, f_args[3]);
return;
} else if (!PermissionManager.hasEffectPermission(p, effect)) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_NO_PERMISSION_EFFECT, effect.getName());
LangManager.sendMessage(p, Lang.CREATE_FIXED_NO_PERMISSION_EFFECT, effect.getName());
return;
}
ParticleStyle style = ParticleStyleManager.styleFromString(f_args[4]);
if (style == null) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_INVALID_STYLE, f_args[4]);
LangManager.sendMessage(p, Lang.CREATE_FIXED_INVALID_STYLE, f_args[4]);
return;
} else if (!PermissionManager.hasStylePermission(p, style)) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_NO_PERMISSION_STYLE, f_args[4]);
LangManager.sendMessage(p, Lang.CREATE_FIXED_NO_PERMISSION_STYLE, f_args[4]);
return;
}
if (!style.canBeFixed()) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_NON_FIXABLE_STYLE, style.getName());
LangManager.sendMessage(p, Lang.CREATE_FIXED_NON_FIXABLE_STYLE, style.getName());
return;
}
@ -583,12 +525,12 @@ public class ParticleCommandExecutor implements CommandExecutor {
try {
note = Integer.parseInt(f_args[5]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "note");
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "note");
return;
}
if (note < 0 || note > 23) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "note");
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "note");
return;
}
@ -607,12 +549,12 @@ public class ParticleCommandExecutor implements CommandExecutor {
g = Integer.parseInt(f_args[6]);
b = Integer.parseInt(f_args[7]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "color");
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "color");
return;
}
if (r < 0 || r > 255 || g < 0 || g > 255 || b < 0 || b > 255) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "color");
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "color");
return;
}
@ -627,7 +569,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
if (material == null) material = Material.matchMaterial(f_args[5]);
if (material == null) throw new Exception();
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "block");
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "block");
return;
}
@ -639,7 +581,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
if (material == null) material = Material.matchMaterial(f_args[5]);
if (material == null) throw new Exception();
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "item");
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "item");
return;
}
@ -661,13 +603,13 @@ public class ParticleCommandExecutor implements CommandExecutor {
p.getLocation().getWorld().getName(), f_xPos, f_yPos, f_zPos,
effect, style, f_itemData, f_blockData, f_colorData, f_noteData); // @formatter:on
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_SUCCESS);
LangManager.sendMessage(p, Lang.CREATE_FIXED_SUCCESS);
DataManager.getInstance().saveFixedEffect(fixedEffect);
});
});
} else if (cmd.equalsIgnoreCase("remove")) {
if (args.length < 1) {
MessageManager.sendMessage(p, MessageType.REMOVE_FIXED_NO_ARGS);
LangManager.sendMessage(p, Lang.REMOVE_FIXED_NO_ARGS);
return;
}
@ -675,16 +617,16 @@ public class ParticleCommandExecutor implements CommandExecutor {
try {
id = Integer.parseInt(args[0]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.REMOVE_FIXED_INVALID_ARGS);
LangManager.sendMessage(p, Lang.REMOVE_FIXED_INVALID_ARGS);
return;
}
final int f_id = id;
DataManager.getInstance().removeFixedEffect(p.getUniqueId(), id, (successful) -> {
if (successful) {
MessageManager.sendMessage(p, MessageType.REMOVE_FIXED_SUCCESS, f_id + "");
LangManager.sendMessage(p, Lang.REMOVE_FIXED_SUCCESS, f_id + "");
} else {
MessageManager.sendMessage(p, MessageType.REMOVE_FIXED_NONEXISTANT, f_id + "");
LangManager.sendMessage(p, Lang.REMOVE_FIXED_NONEXISTANT, f_id + "");
}
});
} else if (cmd.equalsIgnoreCase("list")) {
@ -692,11 +634,11 @@ public class ParticleCommandExecutor implements CommandExecutor {
Collections.sort(ids);
if (ids.isEmpty()) {
MessageManager.sendMessage(p, MessageType.LIST_FIXED_NONE);
LangManager.sendMessage(p, Lang.LIST_FIXED_NONE);
return;
}
String msg = MessageType.LIST_FIXED_SUCCESS.getMessage();
String msg = Lang.LIST_FIXED_SUCCESS.get();
boolean first = true;
for (int id : ids) {
if (!first) msg += ", ";
@ -704,11 +646,11 @@ public class ParticleCommandExecutor implements CommandExecutor {
msg += id;
}
MessageManager.sendCustomMessage(p, msg);
LangManager.sendCustomMessage(p, msg);
});
} else if (cmd.equalsIgnoreCase("info")) {
if (args.length < 1) {
MessageManager.sendMessage(p, MessageType.INFO_FIXED_NO_ARGS);
LangManager.sendMessage(p, Lang.INFO_FIXED_NO_ARGS);
return;
}
@ -716,7 +658,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
try {
id = Integer.parseInt(args[0]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.INFO_FIXED_INVALID_ARGS);
LangManager.sendMessage(p, Lang.INFO_FIXED_INVALID_ARGS);
return;
}
@ -724,12 +666,12 @@ public class ParticleCommandExecutor implements CommandExecutor {
final int f_id = id;
DataManager.getInstance().getFixedEffectForPlayerById(p.getUniqueId(), id, (fixedEffect) -> {
if (fixedEffect == null) {
MessageManager.sendMessage(p, MessageType.INFO_FIXED_NONEXISTANT, f_id + "");
LangManager.sendMessage(p, Lang.INFO_FIXED_NONEXISTANT, f_id + "");
return;
}
DecimalFormat df = new DecimalFormat("0.##"); // Decimal formatter so the coords aren't super long
String listMessage = MessageType.INFO_FIXED_INFO.getMessage() // @formatter:off
String listMessage = Lang.INFO_FIXED_INFO.get() // @formatter:off
.replaceAll("\\{0\\}", fixedEffect.getId() + "")
.replaceAll("\\{1\\}", fixedEffect.getLocation().getWorld().getName())
.replaceAll("\\{2\\}", df.format(fixedEffect.getLocation().getX()) + "")
@ -738,16 +680,16 @@ public class ParticleCommandExecutor implements CommandExecutor {
.replaceAll("\\{5\\}", fixedEffect.getParticleEffect().getName())
.replaceAll("\\{6\\}", fixedEffect.getParticleStyle().getName())
.replaceAll("\\{7\\}", fixedEffect.getDataString()); // @formatter:on
MessageManager.sendCustomMessage(p, listMessage);
LangManager.sendCustomMessage(p, listMessage);
});
} else if (cmd.equalsIgnoreCase("clear")) {
if (!p.hasPermission("playerparticles.fixed.clear")) {
MessageManager.sendMessage(p, MessageType.CLEAR_FIXED_NO_PERMISSION);
LangManager.sendMessage(p, Lang.CLEAR_FIXED_NO_PERMISSION);
return;
}
if (args.length < 1) {
MessageManager.sendMessage(p, MessageType.CLEAR_FIXED_NO_ARGS);
LangManager.sendMessage(p, Lang.CLEAR_FIXED_NO_ARGS);
return;
}
@ -755,7 +697,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
try {
radius = Math.abs(Integer.parseInt(args[0]));
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CLEAR_FIXED_INVALID_ARGS);
LangManager.sendMessage(p, Lang.CLEAR_FIXED_INVALID_ARGS);
return;
}
@ -768,47 +710,96 @@ public class ParticleCommandExecutor implements CommandExecutor {
for (FixedParticleEffect fixedEffect : fixedEffectsToRemove)
DataManager.getInstance().removeFixedEffect(fixedEffect.getOwnerUniqueId(), fixedEffect.getId(), (successful) -> { });
String clearMessage = MessageType.CLEAR_FIXED_SUCCESS.getMessage() // @formatter:off
String clearMessage = Lang.CLEAR_FIXED_SUCCESS.get() // @formatter:off
.replaceAll("\\{0\\}", fixedEffectsToRemove.size() + "")
.replaceAll("\\{1\\}", radius + ""); // @formatter:on
MessageManager.sendCustomMessage(p, clearMessage);
LangManager.sendCustomMessage(p, clearMessage);
return;
} else {
MessageManager.sendMessage(p, MessageType.INVALID_FIXED_COMMAND);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_CREATE);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_REMOVE);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_LIST);
MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_INFO);
if (p.hasPermission("playerparticles.fixed.clear")) MessageManager.sendMessage(p, MessageType.FIXED_COMMAND_DESC_CLEAR);
LangManager.sendMessage(p, Lang.INVALID_FIXED_COMMAND);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CREATE);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_REMOVE);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_LIST);
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_INFO);
if (p.hasPermission("playerparticles.fixed.clear")) LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CLEAR);
}
}
private void onGUI(Player p, boolean byDefault) {
if (PlayerParticlesGui.isGuiDisabled()) {
if (byDefault) {
onHelp(p);
private static final String[] COMMANDS = { "help", "gui", "effect", "effects", "style", "styles", "data", "fixed", "reset", "worlds", "version" };
private static final String[] FIXED_COMMANDS = { "create", "remove", "list", "info" };
private static final List<String> BLOCK_MATERIALS = ParticleUtils.getAllBlockMaterials();
private static final List<String> ITEM_MATERIALS = ParticleUtils.getAllItemMaterials();
/**
* Activated when a user pushes tab in chat prefixed with /pp
*
* @param sender The sender that hit tab, should always be a player
* @param cmd The command the player is executing
* @param alias The possible alias for the command
* @param args All arguments following the command
* @return A list of commands available to the sender
*/
public List<String> onTabComplete(CommandSender sender, Command cmd, String alias, String[] args) {
if (!(sender instanceof Player)) return new ArrayList<String>();
if (cmd.getName().equalsIgnoreCase("pp")) {
if (args.length > 1) {
CommandModule commandModule = findMatchingCommand(args[0]);
if (commandModule != null) {
String[] cmdArgs = Arrays.copyOfRange(args, 1, args.length);
return commandModule.onTabComplete(DataManager.getPPlayer(((Player) sender).getUniqueId()), cmdArgs);
}
// TODO: Move to correct CommandModules
if (args[0].equalsIgnoreCase("effect") && args.length == 2) {
List<String> commands = PermissionManager.getEffectsUserHasPermissionFor((Player) sender);
StringUtil.copyPartialMatches(args[1], commands, completions);
} else if (args[0].equalsIgnoreCase("style") && args.length == 2) {
List<String> commands = PermissionManager.getStylesUserHasPermissionFor((Player) sender);
StringUtil.copyPartialMatches(args[1], commands, completions);
} else if (args[0].equalsIgnoreCase("fixed") && args.length > 1) {
if (args.length == 2) {
List<String> commands = Arrays.asList(FIXED_COMMANDS);
StringUtil.copyPartialMatches(args[1], commands, completions);
} else if (args[1].equalsIgnoreCase("create")) {
completions.add("<x> <y> <z> <effect> <style> [data]");
} else if ((args[1].equalsIgnoreCase("remove") || args[1].equalsIgnoreCase("info")) && args.length == 3) {
completions.add("<id>");
}
} else if (args[0].equalsIgnoreCase("data")) {
PPlayer pplayer = DataManager.getPPlayer(((Player) sender).getUniqueId());
if (pplayer == null) {
completions.add(ChatColor.stripColor(Lang.NO_DATA_USAGE.get()));
} else if (pplayer.getParticleEffect().hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA) && args.length == 2) {
if (pplayer.getParticleEffect() == ParticleEffect.ITEM) {
StringUtil.copyPartialMatches(args[1], ITEM_MATERIALS, completions);
} else {
StringUtil.copyPartialMatches(args[1], BLOCK_MATERIALS, completions);
}
} else if (pplayer.getParticleEffect().hasProperty(ParticleProperty.COLORABLE)) {
if (pplayer.getParticleEffect() == ParticleEffect.NOTE && args.length == 2) {
completions.add("<0-23>");
StringUtil.copyPartialMatches(args[args.length - 1], Arrays.asList(new String[] { "rainbow" }), completions);
} else if (pplayer.getParticleEffect() != ParticleEffect.NOTE && args.length > 1 && args.length < 5) {
completions.add("<0-255>");
if (args.length == 2) {
StringUtil.copyPartialMatches(args[args.length - 1], Arrays.asList(new String[] { "rainbow" }), completions);
}
}
} else if (args.length == 2) {
completions.add(ChatColor.stripColor(Lang.NO_DATA_USAGE.get()));
}
}
} else {
MessageManager.sendMessage(p, MessageType.GUI_DISABLED);
List<String> commands = new ArrayList<String>(Arrays.asList(COMMANDS));
StringUtil.copyPartialMatches(args[0], commands, completions);
}
return;
}
return null;
}
if (PermissionManager.getEffectsUserHasPermissionFor(p).size() == 1) {
if (byDefault) {
onHelp(p);
} else {
MessageManager.sendMessage(p, MessageType.NO_PARTICLES);
}
return;
}
if (byDefault) {
MessageManager.sendMessage(p, MessageType.GUI_BY_DEFAULT);
}
DataManager.getInstance().getPPlayer(p.getUniqueId(), (pplayer) -> {
PlayerParticlesGui.changeState(pplayer, GuiState.DEFAULT);
});
public static String[] getCommandsList() {
return COMMANDS;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class RemoveCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "remove";
}
public String getDescription() {
return Lang.REMOVE_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "<id>";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class ResetCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "reset";
}
public String getDescription() {
return Lang.RESET_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return false;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
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) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "style";
}
public String getDescription() {
return Lang.STYLE_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return true;
}
}

View file

@ -0,0 +1,34 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class StylesCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "styles";
}
public String getDescription() {
return Lang.STYLES_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return false;
}
}

View file

@ -0,0 +1,39 @@
package com.esophose.playerparticles.command;
import java.util.List;
import org.bukkit.ChatColor;
import com.esophose.playerparticles.PlayerParticles;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class VersionCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
LangManager.sendCustomMessage(pplayer, ChatColor.GOLD + "Running PlayerParticles v" + PlayerParticles.getPlugin().getDescription().getVersion());
LangManager.sendCustomMessage(pplayer, ChatColor.GOLD + "Plugin created by: Esophose");
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "version";
}
public String getDescription() {
return Lang.VERSION_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return false;
}
}

View file

@ -0,0 +1,47 @@
package com.esophose.playerparticles.command;
import java.util.List;
import com.esophose.playerparticles.manager.DataManager;
import com.esophose.playerparticles.manager.LangManager;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
public class WorldsCommandModule implements CommandModule {
public void onCommandExecute(PPlayer pplayer, String[] args) {
if (DataManager.getDisabledWorlds() == null || DataManager.getDisabledWorlds().isEmpty()) {
LangManager.sendMessage(pplayer, Lang.DISABLED_WORLDS_NONE);
return;
}
String worlds = "";
for (String s : DataManager.getDisabledWorlds()) {
worlds += s + ", ";
}
if (worlds.length() > 2) worlds = worlds.substring(0, worlds.length() - 2);
LangManager.sendCustomMessage(pplayer, Lang.DISABLED_WORLDS.get() + " " + worlds);
}
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
return null;
}
public String getName() {
return "worlds";
}
public String getDescription() {
return Lang.WORLDS_COMMAND_DESCRIPTION.get();
}
public String getArguments() {
return "";
}
public boolean requiresEffects() {
return false;
}
}

View file

@ -40,7 +40,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.esophose.playerparticles.PlayerParticles;
import com.esophose.playerparticles.manager.DataManager;
import com.esophose.playerparticles.manager.MessageManager.MessageType;
import com.esophose.playerparticles.manager.LangManager.Lang;
import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleEffect;
import com.esophose.playerparticles.particles.ParticleEffect.NoteColor;
@ -337,18 +337,18 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
ItemStack effectIcon = new ItemStack(defaultMenuIcons[0], 1);
ItemMeta effectIconMeta = effectIcon.getItemMeta();
effectIconMeta.setDisplayName(ChatColor.GREEN + "Effect");
effectIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SET_YOUR.getMessageReplaced("effect")));
effectIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SET_YOUR.getMessageReplaced("effect")));
if (PermissionManager.getEffectsUserHasPermissionFor(player).size() == 1) { // Always has access to NONE
effectIconMeta.setLore(Arrays.asList(MessageType.GUI_NO_ACCESS_TO.getMessageReplaced("effects")));
effectIconMeta.setLore(Arrays.asList(Lang.GUI_NO_ACCESS_TO.getMessageReplaced("effects")));
}
effectIcon.setItemMeta(effectIconMeta);
ItemStack styleIcon = new ItemStack(defaultMenuIcons[1], 1);
ItemMeta styleIconMeta = styleIcon.getItemMeta();
styleIconMeta.setDisplayName(ChatColor.GREEN + "Style");
styleIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SET_YOUR.getMessageReplaced("style")));
styleIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SET_YOUR.getMessageReplaced("style")));
if (PermissionManager.getStylesUserHasPermissionFor(player).size() == 1) { // Always has access to NONE
styleIconMeta.setLore(Arrays.asList(MessageType.GUI_NO_ACCESS_TO.getMessageReplaced("styles")));
styleIconMeta.setLore(Arrays.asList(Lang.GUI_NO_ACCESS_TO.getMessageReplaced("styles")));
}
styleIcon.setItemMeta(styleIconMeta);
@ -362,9 +362,9 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
else dataType = "color " + dataType;
else if (pe.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) if (pe == ParticleEffect.ITEM) dataType = "item " + dataType;
else dataType = "block " + dataType; // @formatter:on
dataIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SET_YOUR.getMessageReplaced(dataType)));
dataIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SET_YOUR.getMessageReplaced(dataType)));
if (p.getSpawnMaterial() == null && p.getSpawnColor() == null) {
dataIconMeta.setLore(Arrays.asList(MessageType.GUI_NO_DATA.getMessage()));
dataIconMeta.setLore(Arrays.asList(Lang.GUI_NO_DATA.get()));
}
dataIcon.setItemMeta(dataIconMeta);
@ -559,7 +559,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
if (clicked == null || clicked.getType() == Material.AIR) return; // Clicked on an empty slot, do nothing
// Check back button. This is common for most menus
if (clicked.getItemMeta().getDisplayName().equals(MessageType.GUI_BACK_BUTTON.getMessage())) {
if (clicked.getItemMeta().getDisplayName().equals(Lang.GUI_BACK_BUTTON.get())) {
changeState(pplayer, GuiState.DEFAULT);
return;
}
@ -628,11 +628,11 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
ItemStack icon = new ItemStack(effectIcons.get(effect.name()), 1);
ItemMeta iconMeta = icon.getItemMeta();
iconMeta.setDisplayName(MessageType.GUI_ICON_NAME_COLOR.getMessage() + effect.getName());
iconMeta.setDisplayName(Lang.GUI_ICON_NAME_COLOR.get() + effect.getName());
if (!isActive) {
iconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("effect") + effect.getName()));
iconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("effect") + effect.getName()));
} else {
iconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("effect") + effect.getName(), MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("effect")));
iconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("effect") + effect.getName(), Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("effect")));
iconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
iconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
@ -651,11 +651,11 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
ItemStack icon = new ItemStack(styleIcons.get(style.getName().toUpperCase()), 1);
ItemMeta iconMeta = icon.getItemMeta();
iconMeta.setDisplayName(MessageType.GUI_ICON_NAME_COLOR.getMessage() + style.getName());
iconMeta.setDisplayName(Lang.GUI_ICON_NAME_COLOR.get() + style.getName());
if (!isActive) {
iconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("style") + style.getName()));
iconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("style") + style.getName()));
} else {
iconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("style") + style.getName(), MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("style")));
iconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("style") + style.getName(), Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("style")));
iconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
iconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
@ -676,11 +676,11 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
ItemStack materialIcon = new ItemStack(material, 1);
ItemMeta materialIconMeta = materialIcon.getItemMeta();
materialIconMeta.setDisplayName(MessageType.GUI_ICON_NAME_COLOR.getMessage() + material.name().toLowerCase());
materialIconMeta.setDisplayName(Lang.GUI_ICON_NAME_COLOR.get() + material.name().toLowerCase());
if (currentMaterial != material) {
materialIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced(dataType + " data") + material.name().toLowerCase()));
materialIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced(dataType + " data") + material.name().toLowerCase()));
} else {
materialIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced(dataType + " data") + material.name().toLowerCase(), MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced(dataType + " data")));
materialIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced(dataType + " data") + material.name().toLowerCase(), Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced(dataType + " data")));
materialIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
materialIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
@ -710,9 +710,9 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
colorIconMeta.setDisplayName(colorData.getName());
if (!currentColor.equals(colorData.getOrdinaryColor())) {
colorIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("color data") + formattedDisplayColor));
colorIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("color data") + formattedDisplayColor));
} else {
colorIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("color data") + formattedDisplayColor, MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("color data")));
colorIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("color data") + formattedDisplayColor, Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("color data")));
colorIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
colorIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
@ -732,11 +732,11 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
ItemStack noteIcon = new ItemStack(Material.NOTE_BLOCK, noteIndex + 1);
ItemMeta noteIconMeta = noteIcon.getItemMeta();
noteIconMeta.setDisplayName(MessageType.GUI_ICON_NAME_COLOR.getMessage() + "note #" + noteIndex);
noteIconMeta.setDisplayName(Lang.GUI_ICON_NAME_COLOR.get() + "note #" + noteIndex);
if (currentNote.getValueX() * 24 != noteIndex) {
noteIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("note data") + "note #" + noteIndex));
noteIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("note data") + "note #" + noteIndex));
} else {
noteIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("note data") + "note #" + noteIndex, MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("note data")));
noteIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("note data") + "note #" + noteIndex, Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("note data")));
noteIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
noteIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
}
@ -762,11 +762,11 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
rainbowIconMeta.setDisplayName(rainbowName);
if (currentColor.getRed() == 999 && currentColor.getGreen() == 999 && currentColor.getBlue() == 999) {
rainbowIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("color data") + rainbowName, MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("color data")));
rainbowIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("color data") + rainbowName, Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("color data")));
rainbowIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
rainbowIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
} else {
rainbowIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("color data") + rainbowName));
rainbowIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("color data") + rainbowName));
}
rainbowIcon.setItemMeta(rainbowIconMeta);
@ -790,11 +790,11 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
rainbowIconMeta.setDisplayName(rainbowName);
if (currentColor.getValueX() * 24 == 99) {
rainbowIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("note data") + rainbowName, MessageType.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("note data")));
rainbowIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("note data") + rainbowName, Lang.GUI_ICON_CURRENT_ACTIVE.getMessageReplaced("note data")));
rainbowIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
rainbowIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
} else {
rainbowIconMeta.setLore(Arrays.asList(MessageType.GUI_ICON_SETS_TO.getMessageReplaced("note data") + rainbowName));
rainbowIconMeta.setLore(Arrays.asList(Lang.GUI_ICON_SETS_TO.getMessageReplaced("note data") + rainbowName));
}
rainbowIcon.setItemMeta(rainbowIconMeta);
@ -809,7 +809,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
private static ItemStack getItemForBack() {
ItemStack icon = new ItemStack(Material.ARROW, 1);
ItemMeta iconMeta = icon.getItemMeta();
iconMeta.setDisplayName(MessageType.GUI_BACK_BUTTON.getMessage());
iconMeta.setDisplayName(Lang.GUI_BACK_BUTTON.get());
icon.setItemMeta(iconMeta);
return icon;

View file

@ -8,19 +8,46 @@
package com.esophose.playerparticles.manager;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.bukkit.ChatColor;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import com.esophose.playerparticles.PlayerParticles;
import com.esophose.playerparticles.particles.PPlayer;
public class MessageManager {
public class LangManager {
/**
* Contains the location in the config of every chat message
* TODO: Implement .lang files
* Contains the location in the .lang file of every chat message
*/
public static enum MessageType {
public static enum Lang {
// Command Descriptions
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("effect-command-description"),
EFFECTS_COMMAND_DESCRIPTION("effects-command-description"),
FIXED_COMMAND_DESCRIPTION("fixed-command-description"),
GROUP_COMMAND_DESCRIPTION("group-command-description"),
GUI_COMMAND_DESCRIPTION("gui-command-description"),
HELP_COMMAND_DESCRIPTION("help-command-description"),
INFO_COMMAND_DESCRIPTION("info-command-description"),
LIST_COMMAND_DESCRIPTION("list-command-description"),
REMOVE_COMMAND_DESCRIPTION("remove-command-description"),
RESET_COMMAND_DESCRIPTION("reset-command-description"),
STYLE_COMMAND_DESCRIPTION("style-command-description"),
STYLES_COMMAND_DESCRIPTION("styles-command-description"),
VERSION_COMMAND_DESCRIPTION("version-command-description"),
WORLDS_COMMAND_DESCRIPTION("worlds-command-description"),
// Particles
NO_PERMISSION("message-no-permission"),
@ -110,25 +137,25 @@ public class MessageManager {
FAILED_EXECUTE_NOT_FOUND("message-failed-execute-not-found"),
FAILED_EXECUTE_NO_PERMISSION("message-failed-execute-no-permission");
private String configLocation;
private String fileLocation;
private String message;
MessageType(String configLocation) {
this.configLocation = configLocation;
Lang(String fileLocation) {
this.fileLocation = fileLocation;
}
/**
* Sets the message from the config
* Sets the message from the lang file
*
* @param config The config to pull the message from
* @param langFile The lang file to pull the message from
*/
protected void setMessage(FileConfiguration config) {
String messageFromConfig = config.getString(configLocation);
if (messageFromConfig == null) {
messageFromConfig = "&cMissing message in config.yml. Contact a server administrator.";
PlayerParticles.getPlugin().getLogger().warning("Missing message in config.yml: " + this.configLocation);
protected void setMessage(YamlConfiguration langFile) {
String langMessage = langFile.getString(this.fileLocation);
if (langMessage == null) {
langMessage = "&cMissing message in " + langFileName + ": " + this.fileLocation + ". Contact a server administrator.";
PlayerParticles.getPlugin().getLogger().warning("Missing message in " + langFileName + ": " + this.fileLocation);
}
this.message = parseColors(messageFromConfig);
this.message = parseColors(langMessage);
}
/**
@ -136,7 +163,7 @@ public class MessageManager {
*
* @return The message
*/
public String getMessage() {
public String get() {
return this.message;
}
@ -159,20 +186,61 @@ public class MessageManager {
* The prefix to place before all sent messages contained in the config
*/
private static String messagePrefix;
/**
* The current lang file name
*/
private static String langFileName;
/**
* Used to set up the MessageManager
* Used to set up the LangManager
* This should only get called once by the PlayerParticles class, however
* calling it multiple times wont affect anything negatively
*/
public static void setup(FileConfiguration config) {
public static void setup() {
FileConfiguration config = PlayerParticles.getPlugin().getConfig();
messagesEnabled = config.getBoolean("messages-enabled");
prefixEnabled = config.getBoolean("use-message-prefix");
messagePrefix = parseColors(config.getString("message-prefix"));
for (MessageType messageType : MessageType.values()) {
messageType.setMessage(config);
}
YamlConfiguration lang = configureLangFile(config);
if (lang == null) {
messagesEnabled = false;
} else {
for (Lang messageType : Lang.values())
messageType.setMessage(lang);
}
}
/**
* Loads the target .lang file as defined in the config and grabs its YamlConfiguration
* If it doesn't exist, default to en_US.lang
* If en_US.lang doesn't exist, copy the file from this .jar to the target directory
*
* @param config The plugin's configuration file
* @return The YamlConfiguration of the target .lang file
*/
private static YamlConfiguration configureLangFile(FileConfiguration config) {
File pluginDataFolder = PlayerParticles.getPlugin().getDataFolder();
langFileName = config.getString("lang-file");
File targetLangFile = new File(pluginDataFolder.getAbsolutePath() + File.pathSeparator + "lang" + File.pathSeparator + langFileName);
if (!targetLangFile.exists()) { // Target .lang file didn't exist, default to en_US.lang
PlayerParticles.getPlugin().getLogger().warning("Couldn't find lang file '" + langFileName + "', defaulting to en_US.lang");
langFileName = "en_US.lang";
targetLangFile = new File(pluginDataFolder.getAbsolutePath() + File.pathSeparator + "lang" + File.pathSeparator + langFileName);
if (!targetLangFile.exists()) { // en_US.lang didn't exist, create it
try (InputStream stream = PlayerParticles.getPlugin().getResource("lang/en_US.lang")) {
Files.copy(stream, Paths.get(targetLangFile.getAbsolutePath()));
return YamlConfiguration.loadConfiguration(targetLangFile);
} catch (IOException ex) {
ex.printStackTrace();
PlayerParticles.getPlugin().getLogger().severe("Unable to write en_US.lang to disk! All messages for the plugin have been disabled until this is fixed!");
return null;
}
}
}
return YamlConfiguration.loadConfiguration(targetLangFile);
}
/**
@ -181,10 +249,10 @@ public class MessageManager {
* @param player The player to send the message to
* @param messageType The message to send to the player
*/
public static void sendMessage(Player player, MessageType messageType) {
public static void sendMessage(Player player, Lang messageType) {
if (!messagesEnabled) return;
String message = messageType.getMessage();
String message = messageType.get();
if (message.length() == 0) return;
if (prefixEnabled) {
@ -196,6 +264,16 @@ public class MessageManager {
player.sendMessage(message);
}
/**
* Sends a message to the given PPlayer
*
* @param pplayer The player to send the message to
* @param messageType The message to send to the player
*/
public static void sendMessage(PPlayer pplayer, Lang messageType) {
sendMessage(pplayer.getPlayer(), messageType);
}
/**
* Sends a message to the given player and allows for replacing {TYPE}
*
@ -203,7 +281,7 @@ public class MessageManager {
* @param messageType The message to send to the player
* @param typeReplacement What {TYPE} should be replaced with
*/
public static void sendMessage(Player player, MessageType messageType, String typeReplacement) {
public static void sendMessage(Player player, Lang messageType, String typeReplacement) {
if (!messagesEnabled) return;
String message = messageType.getMessageReplaced(typeReplacement);
@ -217,7 +295,18 @@ public class MessageManager {
}
/**
* Sends a custom message
* Sends a message to the given PPlayer and allows for replacing {TYPE}
*
* @param pplayer The player to send the message to
* @param messageType The message to send to the player
* @param typeReplacement What {TYPE} should be replaced with
*/
public static void sendMessage(PPlayer pplayer, Lang messageType, String typeReplacement) {
sendMessage(pplayer.getPlayer(), messageType, typeReplacement);
}
/**
* Sends a custom message to a player
* Used in cases of string building
*
* @param player The player to send the message to
@ -235,6 +324,17 @@ public class MessageManager {
player.sendMessage(message);
}
/**
* Sends a custom message to a PPlayer
* Used in cases of string building
*
* @param pplayer The player to send the message to
* @param message The message to send to the player
*/
public static void sendCustomMessage(PPlayer pplayer, String message) {
sendCustomMessage(pplayer.getPlayer(), message);
}
/**
* Translates all ampersand symbols into the Minecraft chat color symbol
*

View file

@ -14,7 +14,7 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import com.esophose.playerparticles.PlayerParticles;
import com.esophose.playerparticles.manager.MessageManager;
import com.esophose.playerparticles.manager.LangManager;
public class PluginUpdateListener implements Listener {
@ -27,7 +27,7 @@ public class PluginUpdateListener implements Listener {
public void onPlayerJoin(PlayerJoinEvent e) {
if (e.getPlayer().isOp()) {
if (PlayerParticles.updateVersion != null) { // @formatter:off
MessageManager.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 +
". https://dev.bukkit.org/projects/playerparticles");
} // @formatter:on

View file

@ -10,16 +10,32 @@
# Welcome to the beginning #
# ==================================================== #
# This value is the version of the plugin that last modified the config file
# Changing this value will reset your config on the next server reload / restart.
# I don't recommend changing it
# NOTE: Updating to a new version of the plugin will change this number and delete your config.
# Make sure you create a backup each time before you update!
version: 5.3
# Check for new versions of the plugin
# Default: true
check-updates: true
# The .lang file to use in the ./lang/ folder
# Default: 'en_US.lang'
lang-file: 'en_US.lang'
# If you're using other plugins to execute commands you may wish to turn off messages
# Default: true
messages-enabled: true
# Whether or not to use the message-prefix field when displaying messages
# Default: true
use-message-prefix: true
# The prefix to use for all PlayerParticle messages
# This is useless if use-message-prefix is set to false
# Default: '&7[&3PlayerParticles&7]'
message-prefix: '&7[&3PlayerParticles&7]'
# If the command /pp gui is enabled
# Disable this if you have your own custom GUI through another plugin
# Default: true
@ -50,388 +66,6 @@ max-fixed-effect-creation-distance: 128
# Default: 1
ticks-per-particle: 1
# ================================================================ #
# MESSAGE CONFIGURATION #
# Important Notes: #
# * You can use the & symbol to color the messages #
# * {TYPE} Will be replaced with whatever that message requires #
# * You cannot use the apostrophe character! ( ' ) #
# ================================================================ #
# If you're using other plugins to execute commands you may wish to turn off messages
# Default: true
messages-enabled: true
# Whether or not to use the message-prefix field when displaying messages
# Default: true
use-message-prefix: true
# The prefix to use for all PlayerParticle messages
# This is useless if use-message-prefix is set to false
# Default: '&7[&3PlayerParticles&7]'
message-prefix: '&7[&3PlayerParticles&7]'
# ------------- #
# Particles #
# ------------- #
# No Particle Permission
# Default: '&cYou do not have permission to use &b{TYPE} &cparticles!'
message-no-permission: '&cYou do not have permission to use &b{TYPE} &cparticles!'
# /pp list No Particles
# Default: '&cYou do not have permission to use any particles!'
message-no-particles: '&cYou do not have permission to use any particles!'
# Now Using Particles
# Default: '&aNow using &b{TYPE} &aparticles!'
message-now-using: '&aNow using &b{TYPE} &aparticles!'
# Cleared Particles
# Default: '&aYour particles have been cleared!'
message-cleared-particles: '&aYour particles have been cleared!'
# Invalid Particle Type
# Default: '&cInvalid particle type! &b/pp effects'
message-invalid-type: '&cInvalid particle type! &b/pp effects &c| &b/pp effect <type>'
# Particle Command Usage
# You should not change the text here, only the coloring
# Default: '&b/pp effect <type>'
message-particle-usage: '&b/pp effect <type>'
# -------------- #
# Styles #
# -------------- #
# No Style Permission
# Default: '&cYou do not have permission to use the style type &b{TYPE}&c!'
message-no-permission-style: '&cYou do not have permission to use the style type &b{TYPE}&c!'
# /pp styles No Styles
# Default: '&cYou do not have permission to use any styles!'
message-no-styles: '&cYou do not have permission to use any styles!'
# Now Using Style
# Default: '&aNow using the style type &b{TYPE}&a!'
message-now-using-style: '&aNow using the style type &b{TYPE}&a!'
# Cleared Style
# Default: '&aYour style has been cleared!'
message-cleared-style: '&aYour style has been cleared!'
# Invalid Style Type
# Default: '&cInvalid style type! &b/pp styles &c| &b/pp style <type>'
message-invalid-type-style: '&cInvalid style type! &b/pp styles &c| &b/pp style <type>'
# Style Command Usage
# You should not change the text here, only the coloring
# Default: '&b/pp style <type>'
message-style-usage: '&b/pp style <type>'
# ------------ #
# Data #
# ------------ #
# Data Usage
# Default: '&eYour current effect requires &b{TYPE} &edata!'
message-data-usage: '&eYour current effect requires &b{TYPE} &edata!'
# No Data Required
# Default: '&eYour current effect does not use any data!'
message-no-data-usage: '&eYour current effect does not use any data!'
# Data Applied
# Default: '&aYour &b{TYPE} &adata has been applied!'
message-data-applied: '&aYour &b{TYPE} &adata has been applied!'
# Invalid Data Arguments
# Default: '&cInvalid &b{TYPE} &cdata arguments!'
message-data-invalid-arguments: '&cInvalid &b{TYPE} &cdata arguments!'
# Unknown Material
# Default: '&cThe {TYPE} name you supplied is invalid!'
message-data-material-unknown: '&cThe &b{TYPE} &cname you supplied is invalid!'
# Mismatched Material
# Default: '&cThe material supplied is not of type &b{TYPE}&c!'
message-data-material-mismatch: '&cThe material supplied is not of type &b{TYPE}&c!'
# Note Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data [<0-23>]|[rainbow]'
message-note-data-usage: '&b/pp data [<0-23>]|[rainbow]'
# Color Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data [<0-255> <0-255> <0-255>]|[rainbow]'
message-color-data-usage: '&b/pp data [<0-255> <0-255> <0-255>]|[rainbow]'
# Item Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data <itemName/ID>'
message-item-data-usage: '&b/pp data <itemName>'
# Block Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data <blockName/ID>'
message-block-data-usage: '&b/pp data <blockName>'
# ---------------- #
# Prefixes #
# ---------------- #
# You Can Use Particles
# Default: '&eYou can use:'
message-use: '&eYou can use:&b'
# Usage
# Default: '&eUsage:'
message-usage: '&eUsage:'
# Available Commands
# Default: '&eAvailable commands: &beffect, effects, style, styles, data, fixed, reset, gui, worlds, version, help'
message-available-commands: '&eAvailable commands: &beffect, effects, style, styles, data, fixed, reset, gui, worlds, version, help'
# Disabled Worlds
# Default: '&eParticles are disabled in these worlds:&b'
message-disabled-worlds: '&eParticles are disabled in these worlds:&b'
# ------------------ #
# Alt. Execution
# ------------------ #
# Executed For Player
# Default: '&aCommand executed for &b{TYPE}'
message-executed-for-player: '&aCommand executed for &b{TYPE}'
# Failed Execute Not Found
# Default: '&cFailed to execute command for &b{TYPE}&c! Player not found!'
message-failed-execute-not-found: '&cFailed to execute command for &b{TYPE}&c! Player not found!'
# Failed Execute No Permission
# Default: '&cFailed to execute command for &b{TYPE}&c! You do not have permission!'
message-failed-execute-no-permission: '&cFailed to execute command for &b{TYPE}&c! You do not have permission!'
# ----------------- #
# Fixed Effects
# ----------------- #
# -- Create -- #
# Missing Creation Arguments
# Default: '&cUnable to create fixed effect, you are missing &b{TYPE} &crequired arguments!'
message-create-fixed-missing-args: '&cUnable to create fixed effect, you are missing &b{TYPE} &crequired arguments!'
# Invalid Coordinates
# Default: '&cUnable to create fixed effect, one or more coordinates you entered is invalid!'
message-create-fixed-invalid-coords: '&cUnable to create fixed effect, one or more coordinates you entered is invalid!'
# Coords Out Of Range
# Default: '&cUnable to create fixed effect, you must be within &b{TYPE}&c blocks of your desired location!'
message-create-fixed-out-of-range: '&cUnable to create fixed effect, you must be within &b{TYPE}&c blocks of your desired location!'
# Invalid Effect
# Default: '&cUnable to create fixed effect, an effect with the name &b{TYPE} &cdoes not exist!'
message-create-fixed-invalid-effect: '&cUnable to create fixed effect, an effect with the name &b{TYPE} &cdoes not exist!'
# No Permission Effect
# Default: '&cUnable to create fixed effect, you do not have permission to use the effect &b{TYPE}&c!'
message-create-fixed-no-permission-effect: '&cUnable to create fixed effect, you do not have permission to use the effect &b{TYPE}&c!'
# Invalid Style
# Default: '&cUnable to create fixed effect, a style with the name &b{TYPE} &cdoes not exist!'
message-create-fixed-invalid-style: '&cUnable to create fixed effect, a style with the name &b{TYPE} &cdoes not exist!'
# No Permission Style
# Default: '&cUnable to create fixed effect, you do not have permission to use the style &b{TYPE}&c!'
message-create-fixed-no-permission-style: '&cUnable to create fixed effect, you do not have permission to use the style &b{TYPE}&c!'
# Style Not Fixable
# Default: '&cThe style &b{TYPE} &cprovided can not be used in fixed effects!'
message-create-fixed-non-fixable-style: '&cThe style &b{TYPE} &ccan not be used in fixed effects!'
# Data Error
# Default: '&cUnable to create fixed effect, the data provided is not correct! This effect requires &b{TYPE}&c!'
message-create-fixed-data-error: '&cUnable to create fixed effect, the data provided is not correct! This effect requires &b{TYPE}&c data!'
# Creation Success
# Default: '&aYour fixed effect has been created!'
message-create-fixed-success: '&aYour fixed effect has been created!'
# -- Remove -- #
# Could Not Remove
# Default: '&cUnable to remove, you do not have a fixed effect with the id of &b{TYPE}&c!'
message-remove-fixed-nonexistant: '&cUnable to remove, you do not have a fixed effect with the id of &b{TYPE}&c!'
# No Args Remove
# Default: '&cYou did not specify an id to remove!'
message-remove-fixed-no-args: '&cYou did not specify an id to remove!'
# Invalid Args Remove
# Default: '&cUnable to remove, the id specified must be a number!'
message-remove-fixed-invalid-args: '&cUnable to remove, the id specified must be a number!'
# Effect Removed
# Default: '&aYour fixed effect with the id &b{TYPE}&a has been removed!'
message-remove-fixed-success: '&aYour fixed effect with the id &b{TYPE}&a has been removed!'
# -- List -- #
# List Success
# Default: '&eYou have fixed effects with these ids: &b'
message-list-fixed-success: '&eYou have fixed effects with these ids: &b'
# List None
# Default: '&eYou do not have any fixed effects!'
message-list-fixed-none: '&eYou do not have any fixed effects!'
# -- Info -- #
# Could Not Get Info
# Default: '&cUnable to get info, you do not have a fixed effect with the id of &b{TYPE}&c!'
message-info-fixed-nonexistant: '&cUnable to get info, you do not have a fixed effect with the id of &b{TYPE}&c!'
# No Args Info
# Default: '&cYou did not specify an id to display info for!'
message-info-fixed-no-args: '&cYou did not specify an id to display info for!'
# Invalid Args Info
# Default: '&cUnable to get info, the id specified must be a number!'
message-info-fixed-invalid-args: '&cUnable to get info, the id specified must be a number!'
# Fixed Effect Info
# Key:
# {0} = ID
# {1} = World Name
# {2} = World X Position
# {3} = World Y Position
# {4} = World Z Position
# {5} = Effect Name
# {6} = Style Name
# {7} = Data
# Default: '&eID: &b{0} &eWorld: &b{1} &eX: &b{2} &eY: &b{3} &eZ: &b{4} &eEffect: &b{5} &eStyle: &b{6} &eData: &b{7}'
message-info-fixed-info: '&eID: &b{0} &eWorld: &b{1} &eX: &b{2} &eY: &b{3} &eZ: &b{4} &eEffect: &b{5} &eStyle: &b{6} &eData: &b{7}'
# -- Clear -- #
# No Permission Clear
# Default: '&cYou do not have permission to clear fixed effects of other players!'
message-clear-no-permission: '&cYou do not have permission to clear fixed effects of other players!'
# No Arguments Clear
# Default: '&cYou did not provide a radius to clear fixed effects for!'
message-clear-no-args: '&cYou did not provide a radius to clear fixed effects for!'
# Invalid Arguments Clear
# Default: '&cThe radius you provided is invalid. Make sure it is a positive whole number!'
message-clear-invalid-args: '&cThe radius you provided is invalid. Make sure it is a positive whole number!'
# Successfully Cleared
# Key:
# {0} = Number of effects cleared
# {1} = The provided radius
# Default: '&aCleared &b{0} &afixed effects within &b{1} &ablocks of your location!'
message-clear-success: '&aCleared &b{0} &afixed effects within &b{1} &ablocks of your location!'
# -- Other -- #
# No Permission Fixed
# Default: '&cYou do not have permission to use fixed effects!'
message-no-permission-fixed: '&cYou do not have permission to use fixed effects!'
# Reached Max Allowed
# Default: '&cYou have reached the maximum allowed fixed effects!'
message-max-fixed-effects-reached: '&cYou have reached the maximum allowed fixed effects!'
# Invalid Fixed Command
# Default: '&cInvalid sub-command for &b/pp fixed&c!'
message-invalid-fixed-command: '&cInvalid subcommand for &b/pp fixed&c! &eCommands: '
# -- Command Descriptions -- #
# Fixed Command Description For Create
# Default '&e/pp fixed create <x> <y> <z> <effect> <style> [data]'
message-fixed-command-desc-create: '&e/pp fixed create <x> <y> <z> <effect> <style> [data] - Creates a new fixed effect'
# Fixed Command Description For Remove
# Default: '&e/pp fixed remove <id>'
message-fixed-command-desc-remove: '&e/pp fixed remove <id> - Removes a fixed effect by its id'
# Fixed Command Description For List
# Default: '&e/pp fixed list - Lists all ids of your fixed effects'
message-fixed-command-desc-list: '&e/pp fixed list - Lists all ids of your fixed effects'
# Fixed Command Description For Information
# Default: '&e/pp fixed info <id> - Gets info on one of your fixed effects'
message-fixed-command-desc-info: '&e/pp fixed info <id> - Gets info on one of your fixed effects'
# Fixed Command Description For Clear
# Default: '&e/pp fixed clear <radius> - Clears all fixed effects of all players within the given radius'
message-fixed-command-desc-clear: '&e/pp fixed clear <radius> - Clears all fixed effects of all players within the given radius'
# ------------- #
# GUI #
# ------------- #
# Disabled
# Default: '&cThe server administrator has disabled the GUI.'
message-gui-disabled: '&cThe server administrator has disabled the GUI.'
# Opened By Default
# Default: '&eWe opened the GUI for you because you did not specify a command. View other commands with &b/pp help&e or use &b/pp gui&e to avoid this message.'
message-gui-by-default: '&eWe opened the GUI for you because you did not specify a command. View other commands with &b/pp help&e or use &b/pp gui&e to avoid this message.'
# Back Button
# Default: '&eGo Back'
message-gui-back-button: '&eGo Back'
# Icon Name Color
# Default: '&a'
message-gui-icon-name-color: '&a'
# Currently Active Effect/Style
# Default: '&d- Your current {TYPE} -'
message-gui-icon-current-active: '&d- Your current {TYPE} -'
# Sets your style/effect to {effect name}
# The effect/style name will be added to the end
# Default: '&eSets your {TYPE} to '
message-gui-icon-sets-to: '&eSets your {TYPE} to &b'
# Select Your
# Default: '&eSelect your {TYPE}'
message-gui-icon-set-your: '&eSelect your {TYPE}'
# No Access To
# Default: '&cYou have no access to any {TYPE}!'
message-gui-no-access-to: '&cYou have no access to any {TYPE}!'
# No Data
# Default: '&cYour effect does not use any data!'
message-gui-no-data: '&cYour effect does not use any data!'
# ------------- #
# Other #
# ------------- #
# Reset
# Default: '&aYour effect, style, and data have all been reset!'
message-reset: '&aYour effect, style, and data have all been reset!'
# Invalid Arguments
# Default: '&cInvalid arguments! &a/pp help'
message-invalid-arguments: '&cInvalid arguments! &b/pp help'
# Disabled Worlds None
# Default: '&eParticles are not disabled in any worlds!'
message-disabled-worlds-none: '&eParticles are not disabled in any worlds!'
# Command Usage
# Default: '&eCommand Usage: /pp <command>'
message-command-usage: '&eCommand Usage: &b/pp <command>'
# ================================================================ #
# DATABASE CONFIGURATION #
# Information: #

370
src/lang/en_US.lang Normal file
View file

@ -0,0 +1,370 @@
# ================================================================ #
# en_US.lang MESSAGE CONFIGURATION #
# Important Notes: #
# * You can use the & symbol to color the messages #
# * {TYPE} Will be replaced with whatever that message requires #
# * You cannot use the apostrophe character! ( ' ) #
# * PLEASE MAKE YOUR OWN .lang FILE IF YOU WANT CUSTOM MESSAGES! #
# * This file will be overridden almost every plugin update! #
# ================================================================ #
# ------------- #
# Particles #
# ------------- #
# No Particle Permission
# Default: '&cYou do not have permission to use &b{TYPE} &cparticles!'
message-no-permission: '&cYou do not have permission to use &b{TYPE} &cparticles!'
# /pp list No Particles
# Default: '&cYou do not have permission to use any particles!'
message-no-particles: '&cYou do not have permission to use any particles!'
# Now Using Particles
# Default: '&aNow using &b{TYPE} &aparticles!'
message-now-using: '&aNow using &b{TYPE} &aparticles!'
# Cleared Particles
# Default: '&aYour particles have been cleared!'
message-cleared-particles: '&aYour particles have been cleared!'
# Invalid Particle Type
# Default: '&cInvalid particle type! &b/pp effects'
message-invalid-type: '&cInvalid particle type! &b/pp effects &c| &b/pp effect <type>'
# Particle Command Usage
# You should not change the text here, only the coloring
# Default: '&b/pp effect <type>'
message-particle-usage: '&b/pp effect <type>'
# -------------- #
# Styles #
# -------------- #
# No Style Permission
# Default: '&cYou do not have permission to use the style type &b{TYPE}&c!'
message-no-permission-style: '&cYou do not have permission to use the style type &b{TYPE}&c!'
# /pp styles No Styles
# Default: '&cYou do not have permission to use any styles!'
message-no-styles: '&cYou do not have permission to use any styles!'
# Now Using Style
# Default: '&aNow using the style type &b{TYPE}&a!'
message-now-using-style: '&aNow using the style type &b{TYPE}&a!'
# Cleared Style
# Default: '&aYour style has been cleared!'
message-cleared-style: '&aYour style has been cleared!'
# Invalid Style Type
# Default: '&cInvalid style type! &b/pp styles &c| &b/pp style <type>'
message-invalid-type-style: '&cInvalid style type! &b/pp styles &c| &b/pp style <type>'
# Style Command Usage
# You should not change the text here, only the coloring
# Default: '&b/pp style <type>'
message-style-usage: '&b/pp style <type>'
# ------------ #
# Data #
# ------------ #
# Data Usage
# Default: '&eYour current effect requires &b{TYPE} &edata!'
message-data-usage: '&eYour current effect requires &b{TYPE} &edata!'
# No Data Required
# Default: '&eYour current effect does not use any data!'
message-no-data-usage: '&eYour current effect does not use any data!'
# Data Applied
# Default: '&aYour &b{TYPE} &adata has been applied!'
message-data-applied: '&aYour &b{TYPE} &adata has been applied!'
# Invalid Data Arguments
# Default: '&cInvalid &b{TYPE} &cdata arguments!'
message-data-invalid-arguments: '&cInvalid &b{TYPE} &cdata arguments!'
# Unknown Material
# Default: '&cThe {TYPE} name you supplied is invalid!'
message-data-material-unknown: '&cThe &b{TYPE} &cname you supplied is invalid!'
# Mismatched Material
# Default: '&cThe material supplied is not of type &b{TYPE}&c!'
message-data-material-mismatch: '&cThe material supplied is not of type &b{TYPE}&c!'
# Note Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data [<0-23>]|[rainbow]'
message-note-data-usage: '&b/pp data [<0-23>]|[rainbow]'
# Color Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data [<0-255> <0-255> <0-255>]|[rainbow]'
message-color-data-usage: '&b/pp data [<0-255> <0-255> <0-255>]|[rainbow]'
# Item Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data <itemName/ID>'
message-item-data-usage: '&b/pp data <itemName>'
# Block Data Usage
# You should not change the text here, only the coloring
# Default: '&b/pp data <blockName/ID>'
message-block-data-usage: '&b/pp data <blockName>'
# ---------------- #
# Prefixes #
# ---------------- #
# You Can Use Particles
# Default: '&eYou can use:'
message-use: '&eYou can use:&b'
# Usage
# Default: '&eUsage:'
message-usage: '&eUsage:'
# Available Commands
# Default: '&eAvailable commands: &beffect, effects, style, styles, data, fixed, reset, gui, worlds, version, help'
message-available-commands: '&eAvailable commands: &beffect, effects, style, styles, data, fixed, reset, gui, worlds, version, help'
# Disabled Worlds
# Default: '&eParticles are disabled in these worlds:&b'
message-disabled-worlds: '&eParticles are disabled in these worlds:&b'
# ------------------ #
# Alt. Execution
# ------------------ #
# Executed For Player
# Default: '&aCommand executed for &b{TYPE}'
message-executed-for-player: '&aCommand executed for &b{TYPE}'
# Failed Execute Not Found
# Default: '&cFailed to execute command for &b{TYPE}&c! Player not found!'
message-failed-execute-not-found: '&cFailed to execute command for &b{TYPE}&c! Player not found!'
# Failed Execute No Permission
# Default: '&cFailed to execute command for &b{TYPE}&c! You do not have permission!'
message-failed-execute-no-permission: '&cFailed to execute command for &b{TYPE}&c! You do not have permission!'
# ----------------- #
# Fixed Effects
# ----------------- #
# -- Create -- #
# Missing Creation Arguments
# Default: '&cUnable to create fixed effect, you are missing &b{TYPE} &crequired arguments!'
message-create-fixed-missing-args: '&cUnable to create fixed effect, you are missing &b{TYPE} &crequired arguments!'
# Invalid Coordinates
# Default: '&cUnable to create fixed effect, one or more coordinates you entered is invalid!'
message-create-fixed-invalid-coords: '&cUnable to create fixed effect, one or more coordinates you entered is invalid!'
# Coords Out Of Range
# Default: '&cUnable to create fixed effect, you must be within &b{TYPE}&c blocks of your desired location!'
message-create-fixed-out-of-range: '&cUnable to create fixed effect, you must be within &b{TYPE}&c blocks of your desired location!'
# Invalid Effect
# Default: '&cUnable to create fixed effect, an effect with the name &b{TYPE} &cdoes not exist!'
message-create-fixed-invalid-effect: '&cUnable to create fixed effect, an effect with the name &b{TYPE} &cdoes not exist!'
# No Permission Effect
# Default: '&cUnable to create fixed effect, you do not have permission to use the effect &b{TYPE}&c!'
message-create-fixed-no-permission-effect: '&cUnable to create fixed effect, you do not have permission to use the effect &b{TYPE}&c!'
# Invalid Style
# Default: '&cUnable to create fixed effect, a style with the name &b{TYPE} &cdoes not exist!'
message-create-fixed-invalid-style: '&cUnable to create fixed effect, a style with the name &b{TYPE} &cdoes not exist!'
# No Permission Style
# Default: '&cUnable to create fixed effect, you do not have permission to use the style &b{TYPE}&c!'
message-create-fixed-no-permission-style: '&cUnable to create fixed effect, you do not have permission to use the style &b{TYPE}&c!'
# Style Not Fixable
# Default: '&cThe style &b{TYPE} &cprovided can not be used in fixed effects!'
message-create-fixed-non-fixable-style: '&cThe style &b{TYPE} &ccan not be used in fixed effects!'
# Data Error
# Default: '&cUnable to create fixed effect, the data provided is not correct! This effect requires &b{TYPE}&c!'
message-create-fixed-data-error: '&cUnable to create fixed effect, the data provided is not correct! This effect requires &b{TYPE}&c data!'
# Creation Success
# Default: '&aYour fixed effect has been created!'
message-create-fixed-success: '&aYour fixed effect has been created!'
# -- Remove -- #
# Could Not Remove
# Default: '&cUnable to remove, you do not have a fixed effect with the id of &b{TYPE}&c!'
message-remove-fixed-nonexistant: '&cUnable to remove, you do not have a fixed effect with the id of &b{TYPE}&c!'
# No Args Remove
# Default: '&cYou did not specify an id to remove!'
message-remove-fixed-no-args: '&cYou did not specify an id to remove!'
# Invalid Args Remove
# Default: '&cUnable to remove, the id specified must be a number!'
message-remove-fixed-invalid-args: '&cUnable to remove, the id specified must be a number!'
# Effect Removed
# Default: '&aYour fixed effect with the id &b{TYPE}&a has been removed!'
message-remove-fixed-success: '&aYour fixed effect with the id &b{TYPE}&a has been removed!'
# -- List -- #
# List Success
# Default: '&eYou have fixed effects with these ids: &b'
message-list-fixed-success: '&eYou have fixed effects with these ids: &b'
# List None
# Default: '&eYou do not have any fixed effects!'
message-list-fixed-none: '&eYou do not have any fixed effects!'
# -- Info -- #
# Could Not Get Info
# Default: '&cUnable to get info, you do not have a fixed effect with the id of &b{TYPE}&c!'
message-info-fixed-nonexistant: '&cUnable to get info, you do not have a fixed effect with the id of &b{TYPE}&c!'
# No Args Info
# Default: '&cYou did not specify an id to display info for!'
message-info-fixed-no-args: '&cYou did not specify an id to display info for!'
# Invalid Args Info
# Default: '&cUnable to get info, the id specified must be a number!'
message-info-fixed-invalid-args: '&cUnable to get info, the id specified must be a number!'
# Fixed Effect Info
# Key:
# {0} = ID
# {1} = World Name
# {2} = World X Position
# {3} = World Y Position
# {4} = World Z Position
# {5} = Effect Name
# {6} = Style Name
# {7} = Data
# Default: '&eID: &b{0} &eWorld: &b{1} &eX: &b{2} &eY: &b{3} &eZ: &b{4} &eEffect: &b{5} &eStyle: &b{6} &eData: &b{7}'
message-info-fixed-info: '&eID: &b{0} &eWorld: &b{1} &eX: &b{2} &eY: &b{3} &eZ: &b{4} &eEffect: &b{5} &eStyle: &b{6} &eData: &b{7}'
# -- Clear -- #
# No Permission Clear
# Default: '&cYou do not have permission to clear fixed effects of other players!'
message-clear-no-permission: '&cYou do not have permission to clear fixed effects of other players!'
# No Arguments Clear
# Default: '&cYou did not provide a radius to clear fixed effects for!'
message-clear-no-args: '&cYou did not provide a radius to clear fixed effects for!'
# Invalid Arguments Clear
# Default: '&cThe radius you provided is invalid. Make sure it is a positive whole number!'
message-clear-invalid-args: '&cThe radius you provided is invalid. Make sure it is a positive whole number!'
# Successfully Cleared
# Key:
# {0} = Number of effects cleared
# {1} = The provided radius
# Default: '&aCleared &b{0} &afixed effects within &b{1} &ablocks of your location!'
message-clear-success: '&aCleared &b{0} &afixed effects within &b{1} &ablocks of your location!'
# -- Other -- #
# No Permission Fixed
# Default: '&cYou do not have permission to use fixed effects!'
message-no-permission-fixed: '&cYou do not have permission to use fixed effects!'
# Reached Max Allowed
# Default: '&cYou have reached the maximum allowed fixed effects!'
message-max-fixed-effects-reached: '&cYou have reached the maximum allowed fixed effects!'
# Invalid Fixed Command
# Default: '&cInvalid sub-command for &b/pp fixed&c!'
message-invalid-fixed-command: '&cInvalid subcommand for &b/pp fixed&c! &eCommands: '
# -- Command Descriptions -- #
# Fixed Command Description For Create
# Default '&e/pp fixed create <x> <y> <z> <effect> <style> [data]'
message-fixed-command-desc-create: '&e/pp fixed create <x> <y> <z> <effect> <style> [data] - Creates a new fixed effect'
# Fixed Command Description For Remove
# Default: '&e/pp fixed remove <id>'
message-fixed-command-desc-remove: '&e/pp fixed remove <id> - Removes a fixed effect by its id'
# Fixed Command Description For List
# Default: '&e/pp fixed list - Lists all ids of your fixed effects'
message-fixed-command-desc-list: '&e/pp fixed list - Lists all ids of your fixed effects'
# Fixed Command Description For Information
# Default: '&e/pp fixed info <id> - Gets info on one of your fixed effects'
message-fixed-command-desc-info: '&e/pp fixed info <id> - Gets info on one of your fixed effects'
# Fixed Command Description For Clear
# Default: '&e/pp fixed clear <radius> - Clears all fixed effects of all players within the given radius'
message-fixed-command-desc-clear: '&e/pp fixed clear <radius> - Clears all fixed effects of all players within the given radius'
# ------------- #
# GUI #
# ------------- #
# Disabled
# Default: '&cThe server administrator has disabled the GUI.'
message-gui-disabled: '&cThe server administrator has disabled the GUI.'
# Opened By Default
# Default: '&eWe opened the GUI for you because you did not specify a command. View other commands with &b/pp help&e or use &b/pp gui&e to avoid this message.'
message-gui-by-default: '&eWe opened the GUI for you because you did not specify a command. View other commands with &b/pp help&e or use &b/pp gui&e to avoid this message.'
# Back Button
# Default: '&eGo Back'
message-gui-back-button: '&eGo Back'
# Icon Name Color
# Default: '&a'
message-gui-icon-name-color: '&a'
# Currently Active Effect/Style
# Default: '&d- Your current {TYPE} -'
message-gui-icon-current-active: '&d- Your current {TYPE} -'
# Sets your style/effect to {effect name}
# The effect/style name will be added to the end
# Default: '&eSets your {TYPE} to '
message-gui-icon-sets-to: '&eSets your {TYPE} to &b'
# Select Your
# Default: '&eSelect your {TYPE}'
message-gui-icon-set-your: '&eSelect your {TYPE}'
# No Access To
# Default: '&cYou have no access to any {TYPE}!'
message-gui-no-access-to: '&cYou have no access to any {TYPE}!'
# No Data
# Default: '&cYour effect does not use any data!'
message-gui-no-data: '&cYour effect does not use any data!'
# ------------- #
# Other #
# ------------- #
# Reset
# Default: '&aYour effect, style, and data have all been reset!'
message-reset: '&aYour effect, style, and data have all been reset!'
# Invalid Arguments
# Default: '&cInvalid arguments! &a/pp help'
message-invalid-arguments: '&cInvalid arguments! &b/pp help'
# Disabled Worlds None
# Default: '&eParticles are not disabled in any worlds!'
message-disabled-worlds-none: '&eParticles are not disabled in any worlds!'
# Command Usage
# Default: '&eCommand Usage: /pp <command>'
message-command-usage: '&eCommand Usage: &b/pp <command>'