mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-07-23 05:54:01 +00:00
Add new color/note data 'random', Apply max particle creation limit in GUI
This commit is contained in:
parent
b1e23b6812
commit
721f500d9b
15 changed files with 161 additions and 834 deletions
|
@ -3,7 +3,7 @@
|
|||
* + Add new style 'tornado'
|
||||
* + Add new style 'doubleorbit'
|
||||
* * Adjust PParticles to use a Vector instead of a Location
|
||||
* * Setting in config.yml to disable non-event styles while the player is moving
|
||||
* * Setting in config.yml to make non-event styles display particles using DefaultStyles.FEET while the player is moving
|
||||
*/
|
||||
|
||||
package com.esophose.playerparticles;
|
||||
|
|
|
@ -64,6 +64,8 @@ public class AddCommandModule implements CommandModule {
|
|||
if (effect == ParticleEffect.NOTE) {
|
||||
if (args[2].equalsIgnoreCase("rainbow")) {
|
||||
noteColorData = new NoteColor(99);
|
||||
} else if (args[2].equalsIgnoreCase("random")) {
|
||||
noteColorData = new NoteColor(98);
|
||||
} else {
|
||||
int note = -1;
|
||||
try {
|
||||
|
@ -83,6 +85,8 @@ public class AddCommandModule implements CommandModule {
|
|||
} else {
|
||||
if (args[2].equalsIgnoreCase("rainbow")) {
|
||||
colorData = new OrdinaryColor(999, 999, 999);
|
||||
} else if (args[2].equalsIgnoreCase("random")) {
|
||||
colorData = new OrdinaryColor(998, 998, 998);
|
||||
} else {
|
||||
int r = -1;
|
||||
int g = -1;
|
||||
|
@ -156,17 +160,19 @@ public class AddCommandModule implements CommandModule {
|
|||
if (args.length == 3) {
|
||||
possibleValues.add("<0-24>");
|
||||
possibleValues.add("rainbow");
|
||||
possibleValues.add("random");
|
||||
}
|
||||
} else { // Color data
|
||||
if (args.length <= 5 && !args[2].equalsIgnoreCase("rainbow")) {
|
||||
if (args.length <= 5 && !args[2].equalsIgnoreCase("rainbow") && !args[2].equalsIgnoreCase("random")) {
|
||||
possibleValues.add("<0-255>");
|
||||
}
|
||||
if (args.length <= 4 && !args[2].equalsIgnoreCase("rainbow")) {
|
||||
if (args.length <= 4 && !args[2].equalsIgnoreCase("rainbow") && !args[2].equalsIgnoreCase("random")) {
|
||||
possibleValues.add("<0-255> <0-255>");
|
||||
}
|
||||
if (args.length <= 3) {
|
||||
possibleValues.add("<0-255> <0-255> <0-255>");
|
||||
possibleValues.add("rainbow");
|
||||
possibleValues.add("random");
|
||||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
|
|
|
@ -145,6 +145,8 @@ public class EditCommandModule implements CommandModule {
|
|||
if (effect == ParticleEffect.NOTE) {
|
||||
if (args[0].equalsIgnoreCase("rainbow")) {
|
||||
noteColorData = new NoteColor(99);
|
||||
} else if (args[0].equalsIgnoreCase("random")) {
|
||||
noteColorData = new NoteColor(98);
|
||||
} else {
|
||||
int note = -1;
|
||||
try {
|
||||
|
@ -164,6 +166,8 @@ public class EditCommandModule implements CommandModule {
|
|||
} else {
|
||||
if (args[0].equalsIgnoreCase("rainbow")) {
|
||||
colorData = new OrdinaryColor(999, 999, 999);
|
||||
} else if (args[0].equalsIgnoreCase("random")) {
|
||||
colorData = new OrdinaryColor(998, 998, 998);
|
||||
} else {
|
||||
int r = -1;
|
||||
int g = -1;
|
||||
|
@ -267,17 +271,19 @@ public class EditCommandModule implements CommandModule {
|
|||
if (args.length == 3) {
|
||||
possibleValues.add("<0-24>");
|
||||
possibleValues.add("rainbow");
|
||||
possibleValues.add("random");
|
||||
}
|
||||
} else { // Color data
|
||||
if (args.length <= 5 && !args[2].equalsIgnoreCase("rainbow")) {
|
||||
if (args.length <= 5 && !args[2].equalsIgnoreCase("rainbow") && !args[2].equalsIgnoreCase("random")) {
|
||||
possibleValues.add("<0-255>");
|
||||
}
|
||||
if (args.length <= 4 && !args[2].equalsIgnoreCase("rainbow")) {
|
||||
if (args.length <= 4 && !args[2].equalsIgnoreCase("rainbow") && !args[2].equalsIgnoreCase("random")) {
|
||||
possibleValues.add("<0-255> <0-255>");
|
||||
}
|
||||
if (args.length <= 3) {
|
||||
possibleValues.add("<0-255> <0-255> <0-255>");
|
||||
possibleValues.add("rainbow");
|
||||
possibleValues.add("random");
|
||||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
|
|
|
@ -192,6 +192,8 @@ public class FixedCommandModule implements CommandModule {
|
|||
if (effect == ParticleEffect.NOTE) {
|
||||
if (args[5].equalsIgnoreCase("rainbow")) {
|
||||
noteColorData = new NoteColor(99);
|
||||
} else if (args[5].equalsIgnoreCase("random")) {
|
||||
noteColorData = new NoteColor(98);
|
||||
} else {
|
||||
int note = -1;
|
||||
try {
|
||||
|
@ -211,6 +213,8 @@ public class FixedCommandModule implements CommandModule {
|
|||
} else {
|
||||
if (args[5].equalsIgnoreCase("rainbow")) {
|
||||
colorData = new OrdinaryColor(999, 999, 999);
|
||||
} else if (args[5].equalsIgnoreCase("random")) {
|
||||
colorData = new OrdinaryColor(998, 998, 998);
|
||||
} else {
|
||||
int r = -1;
|
||||
int g = -1;
|
||||
|
@ -457,17 +461,19 @@ public class FixedCommandModule implements CommandModule {
|
|||
if (args.length == 7) {
|
||||
possibleValues.add("<0-24>");
|
||||
possibleValues.add("rainbow");
|
||||
possibleValues.add("random");
|
||||
}
|
||||
} else { // Color data
|
||||
if (args.length <= 9 && !args[2].equalsIgnoreCase("rainbow")) {
|
||||
if (args.length <= 9 && !args[2].equalsIgnoreCase("rainbow") && !args[2].equalsIgnoreCase("random")) {
|
||||
possibleValues.add("<0-255>");
|
||||
}
|
||||
if (args.length <= 8 && !args[2].equalsIgnoreCase("rainbow")) {
|
||||
if (args.length <= 8 && !args[2].equalsIgnoreCase("rainbow") && !args[2].equalsIgnoreCase("random")) {
|
||||
possibleValues.add("<0-255> <0-255>");
|
||||
}
|
||||
if (args.length <= 7) {
|
||||
possibleValues.add("<0-255> <0-255> <0-255>");
|
||||
possibleValues.add("rainbow");
|
||||
possibleValues.add("random");
|
||||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
|
|
|
@ -42,7 +42,7 @@ public class GuiActionButton {
|
|||
* Constructor for creating non-animated icons
|
||||
*
|
||||
* @param slot The slot ID of the inventory
|
||||
* @param icons The Materials that this icon will use
|
||||
* @param icon The Material that this icon will use
|
||||
* @param name The name that this icon will use
|
||||
* @param lore The lore of this icon
|
||||
* @param onClick The callback to execute when this button is clicked
|
||||
|
@ -123,6 +123,7 @@ public class GuiActionButton {
|
|||
/**
|
||||
* Executes the onClick callback passed in the constructor
|
||||
*
|
||||
* @param button The button that was clicked
|
||||
* @param isShiftClick If the player was holding shift when they clicked
|
||||
*/
|
||||
public void handleClick(GuiActionButton button, boolean isShiftClick) {
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.List;
|
|||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
@ -66,7 +67,7 @@ public class GuiHandler extends BukkitRunnable implements Listener {
|
|||
guiInventories.remove(inventory);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (!(event.getWhoClicked() instanceof Player)) return;
|
||||
Player player = (Player)event.getWhoClicked();
|
||||
|
|
|
@ -1,807 +0,0 @@
|
|||
//package com.esophose.playerparticles.gui;
|
||||
//
|
||||
//import java.util.ArrayList;
|
||||
//import java.util.Arrays;
|
||||
//import java.util.HashMap;
|
||||
//import java.util.List;
|
||||
//import java.util.Map;
|
||||
//import java.util.Random;
|
||||
//import java.util.UUID;
|
||||
//
|
||||
//import org.bukkit.Bukkit;
|
||||
//import org.bukkit.ChatColor;
|
||||
//import org.bukkit.DyeColor;
|
||||
//import org.bukkit.Material;
|
||||
//import org.bukkit.Particle;
|
||||
//import org.bukkit.SkullType;
|
||||
//import org.bukkit.configuration.file.FileConfiguration;
|
||||
//import org.bukkit.enchantments.Enchantment;
|
||||
//import org.bukkit.entity.Player;
|
||||
//import org.bukkit.event.EventHandler;
|
||||
//import org.bukkit.event.Listener;
|
||||
//import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
//import org.bukkit.inventory.Inventory;
|
||||
//import org.bukkit.inventory.InventoryView;
|
||||
//import org.bukkit.inventory.ItemFlag;
|
||||
//import org.bukkit.inventory.ItemStack;
|
||||
//import org.bukkit.inventory.meta.ItemMeta;
|
||||
//import org.bukkit.inventory.meta.SkullMeta;
|
||||
//import org.bukkit.material.Dye;
|
||||
//import org.bukkit.scheduler.BukkitRunnable;
|
||||
//
|
||||
//import com.esophose.playerparticles.PlayerParticles;
|
||||
//import com.esophose.playerparticles.manager.DataManager;
|
||||
//import com.esophose.playerparticles.manager.LangManager;
|
||||
//import com.esophose.playerparticles.manager.LangManager.Lang;
|
||||
//import com.esophose.playerparticles.manager.PermissionManager;
|
||||
//import com.esophose.playerparticles.manager.SettingManager.PSetting;
|
||||
//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;
|
||||
//import com.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
//import com.esophose.playerparticles.styles.api.ParticleStyle;
|
||||
//import com.esophose.playerparticles.styles.api.ParticleStyleManager;
|
||||
//import com.esophose.playerparticles.util.ParticleUtils;
|
||||
//
|
||||
///**
|
||||
// * This class provides a collection of static methods for modifying your
|
||||
// * particle/style/data through the use of a GUI
|
||||
// */
|
||||
//public class GuiHandlerOLD extends BukkitRunnable implements Listener {
|
||||
//
|
||||
// public static final int INVENTORY_SIZE = 54;
|
||||
// private static HashMap<PPlayer, GuiInventory> playerGuiInventories;
|
||||
//
|
||||
// /**
|
||||
// * Cached icons to prevent calling config over and over
|
||||
// */
|
||||
// private static Material[] defaultMenuIcons = new Material[3];
|
||||
// private static HashMap<String, Material> effectIcons;
|
||||
// private static HashMap<String, Material> styleIcons;
|
||||
//
|
||||
// /**
|
||||
// * Maps to convert from clicked materials to particle colors
|
||||
// */
|
||||
// private static ColorData[] colorMapping;
|
||||
//
|
||||
// /**
|
||||
// * DyeColor array in the order of the rainbow
|
||||
// * Color index for the wool color to display next
|
||||
// */
|
||||
// private static DyeColor[] rainbowColors;
|
||||
// private static int rainbowColorsIndex = 0;
|
||||
//
|
||||
// /**
|
||||
// * Cached material data
|
||||
// */
|
||||
// private static final Random RANDOM = new Random();
|
||||
// private static List<Material> BLOCK_MATERIALS = new ArrayList<Material>();
|
||||
// private static List<Material> ITEM_MATERIALS = new ArrayList<Material>();
|
||||
//
|
||||
// static { // @formatter:off
|
||||
// colorMapping = new ColorData[] {
|
||||
// new ColorData(DyeColor.RED, ParticleUtils.closestMatch("ROSE_RED"), new OrdinaryColor(255, 0, 0), ChatColor.RED + "red"),
|
||||
// new ColorData(DyeColor.ORANGE, ParticleUtils.closestMatch("ORANGE_DYE"), new OrdinaryColor(255, 140, 0), ChatColor.GOLD + "orange"),
|
||||
// new ColorData(DyeColor.YELLOW, ParticleUtils.closestMatch("DANDELION_YELLOW"), new OrdinaryColor(255, 255, 0), ChatColor.YELLOW + "yellow"),
|
||||
// new ColorData(DyeColor.LIME, ParticleUtils.closestMatch("LIME_DYE"), new OrdinaryColor(50, 205, 50), ChatColor.GREEN + "lime green"),
|
||||
// new ColorData(DyeColor.GREEN, ParticleUtils.closestMatch("CACTUS_GREEN"), new OrdinaryColor(0, 128, 0), ChatColor.DARK_GREEN + "green"),
|
||||
// new ColorData(DyeColor.BLUE, ParticleUtils.closestMatch("LAPIZ_LAZULI"), new OrdinaryColor(0, 0, 255), ChatColor.DARK_BLUE + "blue"),
|
||||
// new ColorData(DyeColor.CYAN, ParticleUtils.closestMatch("CYAN_DYE"), new OrdinaryColor(0, 139, 139), ChatColor.DARK_AQUA + "cyan"),
|
||||
// new ColorData(DyeColor.LIGHT_BLUE, ParticleUtils.closestMatch("LIGHT_BLUE_DYE"), new OrdinaryColor(173, 216, 230), ChatColor.AQUA + "light blue"),
|
||||
// new ColorData(DyeColor.PURPLE, ParticleUtils.closestMatch("PURPLE_DYE"), new OrdinaryColor(138, 43, 226), ChatColor.DARK_PURPLE + "purple"),
|
||||
// new ColorData(DyeColor.MAGENTA, ParticleUtils.closestMatch("MAGENTA_DYE"), new OrdinaryColor(202, 31, 123), ChatColor.LIGHT_PURPLE + "magenta"),
|
||||
// new ColorData(DyeColor.PINK, ParticleUtils.closestMatch("PINK_DYE"), new OrdinaryColor(255, 182, 193), ChatColor.LIGHT_PURPLE + "pink"),
|
||||
// new ColorData(DyeColor.BROWN, ParticleUtils.closestMatch("COCOA_BEANS"), new OrdinaryColor(139, 69, 19), ChatColor.GOLD + "brown"),
|
||||
// new ColorData(DyeColor.BLACK, ParticleUtils.closestMatch("INK_SAC"), new OrdinaryColor(0, 0, 0), ChatColor.DARK_GRAY + "black"),
|
||||
// new ColorData(DyeColor.GRAY, ParticleUtils.closestMatch("GRAY_DYE"), new OrdinaryColor(128, 128, 128), ChatColor.DARK_GRAY + "gray"),
|
||||
// new ColorData(DyeColor.getByDyeData((byte)7), ParticleUtils.closestMatch("LIGHT_GRAY_DYE"), new OrdinaryColor(192, 192, 192), ChatColor.GRAY + "light gray"),
|
||||
// new ColorData(DyeColor.WHITE, ParticleUtils.closestMatch("BONE_MEAL"), new OrdinaryColor(255, 255, 255), ChatColor.WHITE + "white"),
|
||||
// };
|
||||
//
|
||||
// rainbowColors = new DyeColor[] {
|
||||
// DyeColor.RED,
|
||||
// DyeColor.ORANGE,
|
||||
// DyeColor.YELLOW,
|
||||
// DyeColor.LIME,
|
||||
// DyeColor.LIGHT_BLUE,
|
||||
// DyeColor.BLUE,
|
||||
// DyeColor.PURPLE
|
||||
// };
|
||||
//
|
||||
// Inventory testingInventory = Bukkit.createInventory(null, 9);
|
||||
// for (Material mat : Material.values()) {
|
||||
// // Verify an ItemStack of the material can be placed into an inventory. In 1.12 and up this can easily be checked with mat.isItem(), but that doesn't exist pre-1.12
|
||||
// testingInventory.clear();
|
||||
// testingInventory.setItem(0, new ItemStack(mat, 1));
|
||||
// ItemStack itemStack = testingInventory.getItem(0);
|
||||
// if (itemStack != null) {
|
||||
// if (mat.isBlock()) {
|
||||
// BLOCK_MATERIALS.add(mat);
|
||||
// } else if (!mat.isBlock()) {
|
||||
// ITEM_MATERIALS.add(mat);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } // @formatter:on
|
||||
//
|
||||
// /**
|
||||
// * Initializes all the static values for this class
|
||||
// */
|
||||
// public static void setup() {
|
||||
// FileConfiguration config = PlayerParticles.getPlugin().getConfig();
|
||||
//
|
||||
// if (!PSetting.GUI_ENABLED.getBoolean()) return;
|
||||
//
|
||||
// playerGuiInventories = new HashMap<UUID, GuiInventory>();
|
||||
// effectIcons = new HashMap<String, Material>();
|
||||
// styleIcons = new HashMap<String, Material>();
|
||||
//
|
||||
// defaultMenuIcons[0] = ParticleUtils.closestMatchWithFallback(config.getString("gui-icon.main-menu.EFFECT"));
|
||||
// defaultMenuIcons[1] = ParticleUtils.closestMatchWithFallback(config.getString("gui-icon.main-menu.STYLE"));
|
||||
// defaultMenuIcons[2] = ParticleUtils.closestMatchWithFallback(config.getString("gui-icon.main-menu.DATA"));
|
||||
//
|
||||
// // Grab a different effect icon set based on if the Minecraft version is >= 1.13 or not
|
||||
// String legacy;
|
||||
// try {
|
||||
// Particle.valueOf("NAUTILUS");
|
||||
// legacy = "";
|
||||
// } catch (Exception ex) {
|
||||
// legacy = "-legacy";
|
||||
// }
|
||||
//
|
||||
// for (ParticleEffect effect : ParticleEffect.getSupportedEffects()) {
|
||||
// String effectName = effect.getName().toUpperCase();
|
||||
// Material iconMaterial = ParticleUtils.closestMatchWithFallback(config.getString("gui-icon.effect" + legacy + "." + effectName));
|
||||
// effectIcons.put(effectName, iconMaterial);
|
||||
// }
|
||||
//
|
||||
// for (ParticleStyle style : ParticleStyleManager.getStyles()) {
|
||||
// String styleName = style.getName().toUpperCase();
|
||||
// Material iconMaterial = ParticleUtils.closestMatchWithFallback(config.getString("gui-icon.style" + legacy + "." + styleName));
|
||||
// styleIcons.put(styleName, iconMaterial);
|
||||
// }
|
||||
//
|
||||
// new GuiHandlerOLD().runTaskTimer(PlayerParticles.getPlugin(), 0, 10);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Updates all color/note data inventories to display the rainbow icon
|
||||
// * Removes any players who are no longer online from playerGuiInventoriesd
|
||||
// */
|
||||
// public void run() {
|
||||
// List<UUID> toRemoveList = new ArrayList<UUID>();
|
||||
//
|
||||
// for (Map.Entry<UUID, GuiInventory> entry : playerGuiInventories.entrySet()) {
|
||||
// UUID playerUUID = entry.getKey();
|
||||
// PPlayer pplayer = DataManager.getPPlayer(playerUUID);
|
||||
// if (pplayer == null) {
|
||||
// toRemoveList.add(playerUUID);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// Player player = Bukkit.getPlayer(playerUUID);
|
||||
// if (player == null) {
|
||||
// toRemoveList.add(playerUUID);
|
||||
// continue;
|
||||
// }
|
||||
//
|
||||
// GuiInventory guiInventory = entry.getValue();
|
||||
// Inventory inventory = guiInventory.getInventory();
|
||||
//
|
||||
// if (player.getOpenInventory().getTopInventory().equals(inventory) && guiInventory.getGuiState() == GuiState.DATA && getPPlayerEffect(pplayer).hasProperty(ParticleProperty.COLORABLE)) {
|
||||
// ItemStack rainbowIcon;
|
||||
// if (getPPlayerEffect(pplayer) != ParticleEffect.NOTE) {
|
||||
// rainbowIcon = getItemForRainbowColorData(getPPlayerColor(pplayer), rainbowColors[rainbowColorsIndex]);
|
||||
// } else {
|
||||
// rainbowIcon = getItemForRainbowNoteData(getPPlayerNoteColor(pplayer), rainbowColors[rainbowColorsIndex]);
|
||||
// }
|
||||
// inventory.setItem(40, rainbowIcon);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (UUID uuid : toRemoveList)
|
||||
// playerGuiInventories.remove(uuid);
|
||||
//
|
||||
// rainbowColorsIndex++;
|
||||
// rainbowColorsIndex %= rainbowColors.length;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets if the GUI is disabled by the server owner or not
|
||||
// *
|
||||
// * @return True if the GUI is disabled
|
||||
// */
|
||||
// public static boolean isGuiDisabled() {
|
||||
// return !PSetting.GUI_ENABLED.getBoolean();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Forcefully closes all open PlayerParticles GUIs
|
||||
// * Used for when the plugin unloads so players can't take items from the GUI
|
||||
// */
|
||||
// public static void forceCloseAllOpenGUIs() {
|
||||
// for (Player p : Bukkit.getOnlinePlayers()) {
|
||||
// InventoryView openInventory = p.getOpenInventory();
|
||||
// if (openInventory == null) continue;
|
||||
// Inventory topInventory = openInventory.getTopInventory();
|
||||
// if (topInventory == null) continue;
|
||||
//
|
||||
// // Check if any of the inventories are the one the user has open, close if true
|
||||
// for (GuiInventory guiInventory : playerGuiInventories.values()) {
|
||||
// if (topInventory.equals(guiInventory.getInventory())) {
|
||||
// p.closeInventory();
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Opens the default GUI screen for a player
|
||||
// *
|
||||
// * @param pplayer The PPlayer to open the GUI screen for
|
||||
// */
|
||||
// public static void openDefault(PPlayer pplayer) {
|
||||
// if (playerGuiInventories.containsKey(pplayer)) {
|
||||
// playerGuiInventories.remove(pplayer);
|
||||
// }
|
||||
//
|
||||
// GuiInventoryDefault defaultInventory = new GuiInventoryDefault(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, "PlayerParticles"));
|
||||
// playerGuiInventories.put(pplayer, defaultInventory);
|
||||
//
|
||||
// pplayer.getPlayer().openInventory(defaultInventory.getInventory());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Changes the player's inventory to another one
|
||||
// */
|
||||
// protected static void transition(PPlayer pplayer, GuiInventory nextInventory) {
|
||||
// playerGuiInventories.replace(pplayer, nextInventory);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Changes the GUI to the indicated state
|
||||
// * If the GUI isn't open yet, it gets opened
|
||||
// *
|
||||
// * @param pplayer The pplayer
|
||||
// * @param state The new state
|
||||
// */
|
||||
// public static void changeState(PPlayer pplayer, GuiState state) {
|
||||
// Player player = pplayer.getPlayer();
|
||||
//
|
||||
// if ((state == GuiState.EFFECT && PermissionManager.getEffectsUserHasPermissionFor(player).isEmpty()) || (state == GuiState.STYLE && PermissionManager.getStylesUserHasPermissionFor(player).size() == 1) || (state == GuiState.DATA && getPPlayerSpawnMaterial(pplayer) == null && getPPlayerSpawnColor(pplayer) == null)) return;
|
||||
//
|
||||
// // Update the state and create an inventory for the player if one isn't already open for them
|
||||
// // If they have the wrong inventory open for some reason, create a new one and open it for them
|
||||
// if (playerGuiInventories.containsKey(pplayer.getUniqueId())) {
|
||||
// GuiInventory guiInventory = playerGuiInventories.get(pplayer.getUniqueId());
|
||||
// guiInventory.setGuiState(state);
|
||||
// if (!player.getOpenInventory().getTopInventory().equals(guiInventory.getInventory())) {
|
||||
// player.openInventory(guiInventory.getInventory());
|
||||
// }
|
||||
// } else {
|
||||
// Inventory ppInventory = Bukkit.createInventory(null, INVENTORY_SIZE, "PlayerParticles");
|
||||
// player.openInventory(ppInventory);
|
||||
// playerGuiInventories.put(pplayer.getUniqueId(), new GuiInventory(ppInventory, state));
|
||||
// }
|
||||
//
|
||||
// switch (state) {
|
||||
// case DEFAULT:
|
||||
// populateDefault(pplayer);
|
||||
// break;
|
||||
// case EFFECT:
|
||||
// populateEffect(pplayer);
|
||||
// break;
|
||||
// case STYLE:
|
||||
// populateStyle(pplayer);
|
||||
// break;
|
||||
// case DATA:
|
||||
// populateData(pplayer);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Opens the menu to go to other menus: effect, style, data
|
||||
// *
|
||||
// * @param pplayer The PPlayer
|
||||
// */
|
||||
// private static void populateDefault(PPlayer pplayer) {
|
||||
// Player player = pplayer.getPlayer();
|
||||
// Inventory inventory = player.getOpenInventory().getTopInventory();
|
||||
//
|
||||
// inventory.clear(); // Make sure the inventory is always empty before we start adding items
|
||||
//
|
||||
// ItemStack currentIcon;
|
||||
// Material playerHead = ParticleUtils.closestMatch("PLAYER_HEAD");
|
||||
// if (playerHead != null) {
|
||||
// currentIcon = new ItemStack(playerHead, 1);
|
||||
// } else {
|
||||
// currentIcon = new ItemStack(ParticleUtils.closestMatch("SKULL_ITEM"), 1, (short) SkullType.PLAYER.ordinal());
|
||||
// }
|
||||
//
|
||||
// SkullMeta currentIconMeta = (SkullMeta) currentIcon.getItemMeta();
|
||||
// currentIconMeta.setDisplayName(ChatColor.GREEN + player.getName());
|
||||
// String[] currentIconLore = new String[3];
|
||||
// currentIconLore[0] = ChatColor.YELLOW + "Effect: " + ChatColor.AQUA + getPPlayerEffect(pplayer).getName();
|
||||
// currentIconLore[1] = ChatColor.YELLOW + "Style: " + ChatColor.AQUA + getPPlayerStyle(pplayer).getName();
|
||||
// currentIconLore[2] = ChatColor.YELLOW + "Active Data: " + ChatColor.AQUA + getPPlayerDataString(pplayer);
|
||||
// currentIconMeta.setLore(Arrays.asList(currentIconLore));
|
||||
// currentIconMeta.setOwner(player.getName());
|
||||
// // currentIconMeta.setOwningPlayer(Bukkit.getOfflinePlayer(player.getUniqueId())); // This doesn't exist in 1.9
|
||||
// currentIcon.setItemMeta(currentIconMeta);
|
||||
//
|
||||
// ItemStack effectIcon = new ItemStack(defaultMenuIcons[0], 1);
|
||||
// ItemMeta effectIconMeta = effectIcon.getItemMeta();
|
||||
// effectIconMeta.setDisplayName(ChatColor.GREEN + "Effect");
|
||||
// effectIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SET_YOUR, "effect")));
|
||||
// if (PermissionManager.getEffectsUserHasPermissionFor(player).isEmpty()) {
|
||||
// effectIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_NO_ACCESS_TO, "effects")));
|
||||
// }
|
||||
// effectIcon.setItemMeta(effectIconMeta);
|
||||
//
|
||||
// ItemStack styleIcon = new ItemStack(defaultMenuIcons[1], 1);
|
||||
// ItemMeta styleIconMeta = styleIcon.getItemMeta();
|
||||
// styleIconMeta.setDisplayName(ChatColor.GREEN + "Style");
|
||||
// styleIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SET_YOUR, "style")));
|
||||
// if (PermissionManager.getStylesUserHasPermissionFor(player).size() == 1) { // Always has access to NORMAL
|
||||
// styleIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_NO_ACCESS_TO, "styles")));
|
||||
// }
|
||||
// styleIcon.setItemMeta(styleIconMeta);
|
||||
//
|
||||
// ItemStack dataIcon = new ItemStack(defaultMenuIcons[2], 1);
|
||||
// ItemMeta dataIconMeta = dataIcon.getItemMeta();
|
||||
// dataIconMeta.setDisplayName(ChatColor.GREEN + "Data");
|
||||
// ParticleEffect pe = getPPlayerEffect(pplayer);
|
||||
// String dataType = "data";
|
||||
// if (pe.hasProperty(ParticleProperty.COLORABLE)) // @formatter:off
|
||||
// if (pe == ParticleEffect.NOTE) dataType = "note " + dataType;
|
||||
// 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(LangManager.getText(Lang.GUI_ICON_SET_YOUR, dataType)));
|
||||
// if (getPPlayerSpawnMaterial(pplayer) == null && getPPlayerSpawnColor(pplayer) == null) {
|
||||
// dataIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_NO_DATA)));
|
||||
// }
|
||||
// dataIcon.setItemMeta(dataIconMeta);
|
||||
//
|
||||
// inventory.setItem(13, currentIcon);
|
||||
// inventory.setItem(38, effectIcon);
|
||||
// inventory.setItem(40, styleIcon);
|
||||
// inventory.setItem(42, dataIcon);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Opens the menu that allows you to select an effect you have permission for
|
||||
// *
|
||||
// * @param pplayer The PPlayer
|
||||
// */
|
||||
// private static void populateEffect(PPlayer pplayer) {
|
||||
// Player player = pplayer.getPlayer();
|
||||
// Inventory inventory = player.getOpenInventory().getTopInventory();
|
||||
// inventory.clear(); // Make sure the inventory is always empty before we start adding items
|
||||
//
|
||||
// List<String> effectsUserHasPermissionFor = PermissionManager.getEffectsUserHasPermissionFor(player);
|
||||
// for (int i = 0; i < effectsUserHasPermissionFor.size(); i++) {
|
||||
// String s = effectsUserHasPermissionFor.get(i);
|
||||
// ParticleEffect effect = ParticleEffect.fromName(s);
|
||||
// inventory.setItem(i, getItemForEffect(effect, effect == getPPlayerEffect(pplayer)));
|
||||
// }
|
||||
//
|
||||
// inventory.setItem(INVENTORY_SIZE - 1, getItemForBack());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Opens the menu that allows you to select a style you have permission for
|
||||
// *
|
||||
// * @param pplayer The PPlayer
|
||||
// */
|
||||
// private static void populateStyle(PPlayer pplayer) {
|
||||
// Player player = pplayer.getPlayer();
|
||||
// Inventory inventory = player.getOpenInventory().getTopInventory();
|
||||
//
|
||||
// inventory.clear(); // Make sure the inventory is always empty before we start adding items
|
||||
//
|
||||
// List<String> stylesUserHasPermissionFor = PermissionManager.getStylesUserHasPermissionFor(player);
|
||||
// for (int i = 0; i < stylesUserHasPermissionFor.size(); i++) {
|
||||
// String s = stylesUserHasPermissionFor.get(i);
|
||||
// ParticleStyle style = ParticleStyle.fromName(s);
|
||||
// inventory.setItem(i, getItemForStyle(style, style == getPPlayerStyle(pplayer)));
|
||||
// }
|
||||
//
|
||||
// inventory.setItem(INVENTORY_SIZE - 1, getItemForBack());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Opens the menu that allows you to select some preset data
|
||||
// *
|
||||
// * @param pplayer The PPlayer
|
||||
// */
|
||||
// private static void populateData(PPlayer pplayer) {
|
||||
// Player player = pplayer.getPlayer();
|
||||
// Inventory inventory = player.getOpenInventory().getTopInventory();
|
||||
//
|
||||
// inventory.clear(); // Make sure the inventory is always empty before we start adding items
|
||||
//
|
||||
// // There are a lot of for loops here, somebody submit a pull request if you have a better way of doing this
|
||||
// ParticleEffect pe = getPPlayerEffect(pplayer);
|
||||
// if (pe.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
// if (pe == ParticleEffect.NOTE) { // Note data
|
||||
// NoteColor currentNote = getPPlayerNoteColor(pplayer);
|
||||
// int noteIndex = 0;
|
||||
// for (int i = 1; i <= 7; i++) { // Top row
|
||||
// inventory.setItem(i, getItemForNoteData(currentNote, noteIndex));
|
||||
// noteIndex++;
|
||||
// }
|
||||
// for (int i = 10; i <= 16; i++) { // Middle 1 row
|
||||
// inventory.setItem(i, getItemForNoteData(currentNote, noteIndex));
|
||||
// noteIndex++;
|
||||
// }
|
||||
// for (int i = 19; i <= 25; i++) { // Middle 2 row
|
||||
// inventory.setItem(i, getItemForNoteData(currentNote, noteIndex));
|
||||
// noteIndex++;
|
||||
// }
|
||||
// for (int i = 28; i <= 30; i++) { // Bottom row
|
||||
// inventory.setItem(i, getItemForNoteData(currentNote, noteIndex));
|
||||
// noteIndex++;
|
||||
// }
|
||||
//
|
||||
// inventory.setItem(40, getItemForRainbowNoteData(getPPlayerNoteColor(pplayer), rainbowColors[rainbowColorsIndex]));
|
||||
// } else { // Color data
|
||||
// OrdinaryColor currentColor = getPPlayerColor(pplayer);
|
||||
// int colorIndex = 0;
|
||||
// for (int i = 10; i <= 16; i++) { // Top row
|
||||
// inventory.setItem(i, getItemForColorData(currentColor, colorIndex));
|
||||
// colorIndex++;
|
||||
// }
|
||||
// for (int i = 19; i <= 25; i++) { // Middle row
|
||||
// inventory.setItem(i, getItemForColorData(currentColor, colorIndex));
|
||||
// colorIndex++;
|
||||
// }
|
||||
// for (int i = 28; i <= 29; i++) { // Bottom row
|
||||
// inventory.setItem(i, getItemForColorData(currentColor, colorIndex));
|
||||
// colorIndex++;
|
||||
// }
|
||||
//
|
||||
// inventory.setItem(40, getItemForRainbowColorData(getPPlayerColor(pplayer), rainbowColors[rainbowColorsIndex]));
|
||||
// }
|
||||
// } else if (pe.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
// List<Material> materialBag = new ArrayList<Material>();
|
||||
// int materialIndex = 0;
|
||||
//
|
||||
// if (pe == ParticleEffect.ITEM) { // Item data
|
||||
// Material currentItemMaterial = getPPlayerItemMaterial(pplayer);
|
||||
//
|
||||
// while (materialBag.size() < 28) { // Grab 28 random materials that are an item
|
||||
// Material randomMaterial = ITEM_MATERIALS.get(RANDOM.nextInt(ITEM_MATERIALS.size()));
|
||||
// if (!materialBag.contains(randomMaterial)) materialBag.add(randomMaterial);
|
||||
// }
|
||||
//
|
||||
// for (int i = 10; i <= 16; i++) { // Top row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentItemMaterial, "item", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// for (int i = 19; i <= 25; i++) { // Middle 1 row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentItemMaterial, "item", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// for (int i = 28; i <= 34; i++) { // Middle 2 row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentItemMaterial, "item", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// for (int i = 37; i <= 43; i++) { // Bottom row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentItemMaterial, "item", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// } else { // Block data
|
||||
// Material currentBlockMaterial = getPPlayerBlockMaterial(pplayer);
|
||||
//
|
||||
// while (materialBag.size() < 28) { // Grab 28 random materials that are an item
|
||||
// Material randomMaterial = BLOCK_MATERIALS.get(RANDOM.nextInt(BLOCK_MATERIALS.size()));
|
||||
// if (!materialBag.contains(randomMaterial)) materialBag.add(randomMaterial);
|
||||
// }
|
||||
//
|
||||
// for (int i = 10; i <= 16; i++) { // Top row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentBlockMaterial, "block", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// for (int i = 19; i <= 25; i++) { // Middle 1 row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentBlockMaterial, "block", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// for (int i = 28; i <= 34; i++) { // Middle 2 row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentBlockMaterial, "block", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// for (int i = 37; i <= 43; i++) { // Bottom row
|
||||
// inventory.setItem(i, getItemForMaterialData(currentBlockMaterial, "block", materialBag.get(materialIndex)));
|
||||
// materialIndex++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// inventory.setItem(INVENTORY_SIZE - 1, getItemForBack());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Called whenever something is clicked in an inventory
|
||||
// * Will return immediately if not the particlesInventory
|
||||
// *
|
||||
// * @param e The InventoryClickEvent fired from this event
|
||||
// */
|
||||
// @EventHandler
|
||||
// public void onInventoryInteract(InventoryClickEvent e) {
|
||||
// if (isGuiDisabled()) return; // Don't worry about processing anything if the GUI is disabled
|
||||
//
|
||||
// if (!(e.getWhoClicked() instanceof Player)) return; // Not sure if I actually have to check this
|
||||
//
|
||||
// Player player = (Player) e.getWhoClicked();
|
||||
// GuiInventory guiInventory = playerGuiInventories.get(player.getUniqueId());
|
||||
//
|
||||
// if (guiInventory == null || !guiInventory.getInventory().equals(e.getView().getTopInventory())) return; // Make sure it is the right inventory
|
||||
//
|
||||
// e.setCancelled(true); // In the PlayerParticles GUI, can't let them take anything out
|
||||
//
|
||||
// if (!guiInventory.getInventory().equals(e.getClickedInventory())) return; // Clicked bottom inventory
|
||||
//
|
||||
// PPlayer pplayer = DataManager.getPPlayer(player.getUniqueId());
|
||||
// if (pplayer == null) {
|
||||
// player.closeInventory();
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// ItemStack clicked = e.getCurrentItem();
|
||||
// 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(LangManager.getText(Lang.GUI_BACK_BUTTON))) {
|
||||
// changeState(pplayer, GuiState.DEFAULT);
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// String name = ChatColor.stripColor(clicked.getItemMeta().getDisplayName());
|
||||
// switch (guiInventory.getGuiState()) {
|
||||
// case DEFAULT:
|
||||
// if (name.equals("Effect")) {
|
||||
// changeState(pplayer, GuiState.EFFECT);
|
||||
// } else if (name.equals("Style")) {
|
||||
// changeState(pplayer, GuiState.STYLE);
|
||||
// } else if (name.equals("Data")) {
|
||||
// changeState(pplayer, GuiState.DATA);
|
||||
// }
|
||||
// break;
|
||||
// case EFFECT:
|
||||
// setPPlayerEffect(pplayer, ParticleEffect.fromName(name));
|
||||
// changeState(pplayer, GuiState.DEFAULT);
|
||||
// break;
|
||||
// case STYLE:
|
||||
// setPPlayerStyle(pplayer, ParticleStyle.fromName(name));
|
||||
// changeState(pplayer, GuiState.DEFAULT);
|
||||
// break;
|
||||
// case DATA:
|
||||
// ParticleEffect pe = getPPlayerEffect(pplayer);
|
||||
// if (pe.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
// if (pe == ParticleEffect.NOTE) {
|
||||
// if (clicked.getItemMeta().getDisplayName().equals(LangManager.getText(Lang.RAINBOW))) {
|
||||
// setPPlayerNoteColor(pplayer, new NoteColor(99));
|
||||
// } else {
|
||||
// int note = Integer.parseInt(ChatColor.stripColor(clicked.getItemMeta().getDisplayName()).substring(6));
|
||||
// setPPlayerNoteColor(pplayer, new NoteColor(note));
|
||||
// }
|
||||
// } else {
|
||||
// if (clicked.getItemMeta().getDisplayName().equals(LangManager.getText(Lang.RAINBOW))) {
|
||||
// setPPlayerColor(pplayer, new OrdinaryColor(999, 999, 999));
|
||||
// } else {
|
||||
// for (int i = 0; i < colorMapping.length; i++) {
|
||||
// if (clicked.getItemMeta().getDisplayName().equals(colorMapping[i].getName())) {
|
||||
// setPPlayerColor(pplayer, colorMapping[i].getOrdinaryColor());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } else if (pe.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
// Material clickedMaterial = clicked.getType(); // All preset materials have a data value of 0
|
||||
// if (pe == ParticleEffect.ITEM) {
|
||||
// setPPlayerItemMaterial(pplayer, clickedMaterial);
|
||||
// } else {
|
||||
// setPPlayerBlockMaterial(pplayer, clickedMaterial);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// changeState(pplayer, GuiState.DEFAULT);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for a given particle effect from the config
|
||||
// *
|
||||
// * @param effect The effect
|
||||
// * @param isActive If this effect is the current one active
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForEffect(ParticleEffect effect, boolean isActive) {
|
||||
// ItemStack icon = new ItemStack(effectIcons.get(effect.name()), 1);
|
||||
// ItemMeta iconMeta = icon.getItemMeta();
|
||||
//
|
||||
// iconMeta.setDisplayName(LangManager.getText(Lang.GUI_ICON_NAME_COLOR) + effect.getName());
|
||||
// if (!isActive) {
|
||||
// iconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "effect") + effect.getName()));
|
||||
// } else {
|
||||
// iconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "effect") + effect.getName(), LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, "effect")));
|
||||
// iconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// iconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// }
|
||||
// icon.setItemMeta(iconMeta);
|
||||
//
|
||||
// return icon;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for a given particle style from the config
|
||||
// *
|
||||
// * @param style The style
|
||||
// * @param isActive If this style is the current one active
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForStyle(ParticleStyle style, boolean isActive) {
|
||||
// ItemStack icon = new ItemStack(styleIcons.get(style.getName().toUpperCase()), 1);
|
||||
// ItemMeta iconMeta = icon.getItemMeta();
|
||||
//
|
||||
// iconMeta.setDisplayName(LangManager.getText(Lang.GUI_ICON_NAME_COLOR) + style.getName());
|
||||
// if (!isActive) {
|
||||
// iconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "style") + style.getName()));
|
||||
// } else {
|
||||
// iconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "style") + style.getName(), LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, "style")));
|
||||
// iconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// iconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// }
|
||||
// icon.setItemMeta(iconMeta);
|
||||
//
|
||||
// return icon;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for a given material to be used for data
|
||||
// *
|
||||
// * @param currentMaterial What material the player is currently using
|
||||
// * @param dataType What type of data this is (block/item)
|
||||
// * @param material The material to use for the icon
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForMaterialData(Material currentMaterial, String dataType, Material material) {
|
||||
// ItemStack materialIcon = new ItemStack(material, 1);
|
||||
// ItemMeta materialIconMeta = materialIcon.getItemMeta();
|
||||
//
|
||||
// materialIconMeta.setDisplayName(LangManager.getText(Lang.GUI_ICON_NAME_COLOR) + material.name().toLowerCase());
|
||||
// if (currentMaterial != material) {
|
||||
// materialIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, dataType + " data") + material.name().toLowerCase()));
|
||||
// } else {
|
||||
// materialIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, dataType + " data") + material.name().toLowerCase(), LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, dataType + " data")));
|
||||
// materialIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// materialIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// }
|
||||
// materialIcon.setItemMeta(materialIconMeta);
|
||||
//
|
||||
// return materialIcon;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for a color to be used for data
|
||||
// *
|
||||
// * @param currentColor What color the player is currently using
|
||||
// * @param colorIndex What color to use
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForColorData(OrdinaryColor currentColor, int colorIndex) {
|
||||
// ColorData colorData = colorMapping[colorIndex];
|
||||
// String formattedDisplayColor = ChatColor.RED.toString() + colorData.getOrdinaryColor().getRed() + " " + ChatColor.GREEN + colorData.getOrdinaryColor().getGreen() + " " + ChatColor.AQUA + colorData.getOrdinaryColor().getBlue();
|
||||
//
|
||||
// ItemStack colorIcon;
|
||||
// if (colorData.getMaterial() != null) { // Use 1.13 materials
|
||||
// colorIcon = new ItemStack(colorData.getMaterial());
|
||||
// } else { // Use < 1.13 dye colors
|
||||
// colorIcon = new Dye(colorData.getDyeColor()).toItemStack(1);
|
||||
// }
|
||||
// ItemMeta colorIconMeta = colorIcon.getItemMeta();
|
||||
//
|
||||
// colorIconMeta.setDisplayName(colorData.getName());
|
||||
// if (!currentColor.equals(colorData.getOrdinaryColor())) {
|
||||
// colorIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "color data") + formattedDisplayColor));
|
||||
// } else {
|
||||
// colorIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "color data") + formattedDisplayColor, LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, "color data")));
|
||||
// colorIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// colorIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// }
|
||||
// colorIcon.setItemMeta(colorIconMeta);
|
||||
//
|
||||
// return colorIcon;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for a note to be used for data
|
||||
// *
|
||||
// * @param currentNote What note the player is currently using
|
||||
// * @param noteIndex What note to use
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForNoteData(NoteColor currentNote, int noteIndex) {
|
||||
// ItemStack noteIcon = new ItemStack(Material.NOTE_BLOCK, noteIndex + 1);
|
||||
// ItemMeta noteIconMeta = noteIcon.getItemMeta();
|
||||
//
|
||||
// noteIconMeta.setDisplayName(LangManager.getText(Lang.GUI_ICON_NAME_COLOR) + "note #" + noteIndex);
|
||||
// if (currentNote.getValueX() * 24 != noteIndex) {
|
||||
// noteIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "note data") + "note #" + noteIndex));
|
||||
// } else {
|
||||
// noteIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "note data") + "note #" + noteIndex, LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, "note data")));
|
||||
// noteIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// noteIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// }
|
||||
// noteIcon.setItemMeta(noteIconMeta);
|
||||
//
|
||||
// return noteIcon;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for rainbow color/note data
|
||||
// *
|
||||
// * @param currentColor The player's current color data
|
||||
// * @param dyeColor The color of the rainbow we're on
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForRainbowColorData(OrdinaryColor currentColor, DyeColor dyeColor) {
|
||||
// ColorData colorData = getColorDataFromOrdinaryColor(dyeColor);
|
||||
// ItemStack rainbowIcon;
|
||||
// if (colorData.getMaterial() != null) { // Use 1.13 materials
|
||||
// rainbowIcon = new ItemStack(colorData.getMaterial());
|
||||
// } else { // Use < 1.13 dye colors
|
||||
// rainbowIcon = new Dye(colorData.getDyeColor()).toItemStack(1);
|
||||
// }
|
||||
// ItemMeta rainbowIconMeta = rainbowIcon.getItemMeta();
|
||||
//
|
||||
// rainbowIconMeta.setDisplayName(LangManager.getText(Lang.RAINBOW));
|
||||
// if (currentColor.getRed() == 999 && currentColor.getGreen() == 999 && currentColor.getBlue() == 999) {
|
||||
// rainbowIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "color data") + LangManager.getText(Lang.RAINBOW), LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, "color data")));
|
||||
// rainbowIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// rainbowIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// } else {
|
||||
// rainbowIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "color data") + LangManager.getText(Lang.RAINBOW)));
|
||||
// }
|
||||
// rainbowIcon.setItemMeta(rainbowIconMeta);
|
||||
//
|
||||
// return rainbowIcon;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Gets the icon for rainbow color/note data
|
||||
// *
|
||||
// * @param currentColor The player's current note data
|
||||
// * @param dyeColor The color of the rainbow we're on
|
||||
// * @return An ItemStack formatted to be displayed in the GUI
|
||||
// */
|
||||
// private static ItemStack getItemForRainbowNoteData(NoteColor currentColor, DyeColor dyeColor) {
|
||||
// ColorData colorData = getColorDataFromOrdinaryColor(dyeColor);
|
||||
// ItemStack rainbowIcon;
|
||||
// if (colorData.getMaterial() != null) { // Use 1.13 materials
|
||||
// rainbowIcon = new ItemStack(colorData.getMaterial());
|
||||
// } else { // Use < 1.13 dye colors
|
||||
// rainbowIcon = new Dye(colorData.getDyeColor()).toItemStack(1);
|
||||
// }
|
||||
// ItemMeta rainbowIconMeta = rainbowIcon.getItemMeta();
|
||||
//
|
||||
// rainbowIconMeta.setDisplayName(LangManager.getText(Lang.RAINBOW));
|
||||
// if (currentColor.getValueX() * 24 == 99) {
|
||||
// rainbowIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "note data") + LangManager.getText(Lang.RAINBOW), LangManager.getText(Lang.GUI_ICON_CURRENT_ACTIVE, "note data")));
|
||||
// rainbowIconMeta.addEnchant(Enchantment.ARROW_INFINITE, -1, true);
|
||||
// rainbowIconMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
// } else {
|
||||
// rainbowIconMeta.setLore(Arrays.asList(LangManager.getText(Lang.GUI_ICON_SETS_TO, "note data") + LangManager.getText(Lang.RAINBOW)));
|
||||
// }
|
||||
// rainbowIcon.setItemMeta(rainbowIconMeta);
|
||||
//
|
||||
// return rainbowIcon;
|
||||
// }
|
||||
//
|
||||
//}
|
|
@ -1,6 +1,8 @@
|
|||
package com.esophose.playerparticles.gui;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -136,6 +138,13 @@ public class GuiInventoryEditData extends GuiInventory {
|
|||
this.populate();
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the Inventory with available color data options
|
||||
*
|
||||
* @param editingParticle The ParticlePair that's being edited
|
||||
* @param callbackList The List of GuiInventoryEditFinishedCallbacks
|
||||
* @param callbackListPosition The index of the callbackList we're currently at
|
||||
*/
|
||||
private void populateColorData(ParticlePair editingParticle, List<GuiInventoryEditFinishedCallback> callbackList, int callbackListPosition) {
|
||||
int index = 10;
|
||||
int nextWrap = 17;
|
||||
|
@ -162,17 +171,39 @@ public class GuiInventoryEditData extends GuiInventory {
|
|||
}
|
||||
|
||||
// Rainbow Color Data Button
|
||||
GuiActionButton setRainbowColorButton = new GuiActionButton(40,
|
||||
GuiActionButton setRainbowColorButton = new GuiActionButton(39,
|
||||
rainbowColorMapping,
|
||||
LangManager.getText(Lang.RAINBOW),
|
||||
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.RAINBOW),
|
||||
new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_SELECT_DATA_DESCRIPTION, LangManager.getText(Lang.RAINBOW)) },
|
||||
(button, isShiftClick) -> {
|
||||
editingParticle.setColor(new OrdinaryColor(999, 999, 999));
|
||||
callbackList.get(callbackListPosition + 1).execute();
|
||||
});
|
||||
this.actionButtons.add(setRainbowColorButton);
|
||||
|
||||
// Rainbow Color Data Button
|
||||
List<ColorData> randomizedColorsList = Arrays.asList(colorMapping.clone());
|
||||
Collections.shuffle(randomizedColorsList);
|
||||
ColorData[] randomizedColors = new ColorData[randomizedColorsList.size()];
|
||||
randomizedColors = randomizedColorsList.toArray(randomizedColors);
|
||||
GuiActionButton setRandomColorButton = new GuiActionButton(41,
|
||||
randomizedColors,
|
||||
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.RANDOM),
|
||||
new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_SELECT_DATA_DESCRIPTION, LangManager.getText(Lang.RANDOM)) },
|
||||
(button, isShiftClick) -> {
|
||||
editingParticle.setColor(new OrdinaryColor(998, 998, 998));
|
||||
callbackList.get(callbackListPosition + 1).execute();
|
||||
});
|
||||
this.actionButtons.add(setRandomColorButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the Inventory with available note data options
|
||||
*
|
||||
* @param editingParticle The ParticlePair that's being edited
|
||||
* @param callbackList The List of GuiInventoryEditFinishedCallbacks
|
||||
* @param callbackListPosition The index of the callbackList we're currently at
|
||||
*/
|
||||
private void populateNoteData(ParticlePair editingParticle, List<GuiInventoryEditFinishedCallback> callbackList, int callbackListPosition) {
|
||||
for (int i = 0; i < noteColorMapping.length; i++) {
|
||||
ColorData colorData = noteColorMapping[i];
|
||||
|
@ -192,18 +223,40 @@ public class GuiInventoryEditData extends GuiInventory {
|
|||
this.actionButtons.add(setColorButton);
|
||||
}
|
||||
|
||||
// Rainbow Color Data Button
|
||||
GuiActionButton setRainbowColorButton = new GuiActionButton(40,
|
||||
// Rainbow Note Data Button
|
||||
GuiActionButton setRainbowColorButton = new GuiActionButton(39,
|
||||
rainbowColorMapping,
|
||||
LangManager.getText(Lang.RAINBOW),
|
||||
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.RAINBOW),
|
||||
new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_SELECT_DATA_DESCRIPTION, LangManager.getText(Lang.RAINBOW)) },
|
||||
(button, isShiftClick) -> {
|
||||
editingParticle.setNoteColor(new NoteColor(99));
|
||||
callbackList.get(callbackListPosition + 1).execute();
|
||||
});
|
||||
this.actionButtons.add(setRainbowColorButton);
|
||||
|
||||
// Rainbow Note Data Button
|
||||
List<ColorData> randomizedColorsList = Arrays.asList(colorMapping.clone());
|
||||
Collections.shuffle(randomizedColorsList);
|
||||
ColorData[] randomizedColors = new ColorData[randomizedColorsList.size()];
|
||||
randomizedColors = randomizedColorsList.toArray(randomizedColors);
|
||||
GuiActionButton setRandomColorButton = new GuiActionButton(41,
|
||||
randomizedColors,
|
||||
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.RANDOM),
|
||||
new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_SELECT_DATA_DESCRIPTION, LangManager.getText(Lang.RANDOM)) },
|
||||
(button, isShiftClick) -> {
|
||||
editingParticle.setNoteColor(new NoteColor(98));
|
||||
callbackList.get(callbackListPosition + 1).execute();
|
||||
});
|
||||
this.actionButtons.add(setRandomColorButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the Inventory with available item data options
|
||||
*
|
||||
* @param editingParticle The ParticlePair that's being edited
|
||||
* @param callbackList The List of GuiInventoryEditFinishedCallbacks
|
||||
* @param callbackListPosition The index of the callbackList we're currently at
|
||||
*/
|
||||
private void populateItemData(ParticlePair editingParticle, List<GuiInventoryEditFinishedCallback> callbackList, int callbackListPosition) {
|
||||
List<Material> materialBag = new ArrayList<Material>();
|
||||
while (materialBag.size() < 36) { // Grab 36 random materials that are an item
|
||||
|
@ -236,6 +289,13 @@ public class GuiInventoryEditData extends GuiInventory {
|
|||
this.actionButtons.add(randomizeButton);
|
||||
}
|
||||
|
||||
/**
|
||||
* Populates the Inventory with available block data options
|
||||
*
|
||||
* @param editingParticle The ParticlePair that's being edited
|
||||
* @param callbackList The List of GuiInventoryEditFinishedCallbacks
|
||||
* @param callbackListPosition The index of the callbackList we're currently at
|
||||
*/
|
||||
private void populateBlockData(ParticlePair editingParticle, List<GuiInventoryEditFinishedCallback> callbackList, int callbackListPosition) {
|
||||
List<Material> materialBag = new ArrayList<Material>();
|
||||
while (materialBag.size() < 36) { // Grab 36 random materials that are an item
|
||||
|
|
|
@ -8,6 +8,7 @@ import org.bukkit.Bukkit;
|
|||
|
||||
import com.esophose.playerparticles.manager.DataManager;
|
||||
import com.esophose.playerparticles.manager.LangManager;
|
||||
import com.esophose.playerparticles.manager.PermissionManager;
|
||||
import com.esophose.playerparticles.manager.LangManager.Lang;
|
||||
import com.esophose.playerparticles.manager.SettingManager.GuiIcon;
|
||||
import com.esophose.playerparticles.particles.PPlayer;
|
||||
|
@ -68,11 +69,14 @@ public class GuiInventoryManageParticles extends GuiInventory {
|
|||
}
|
||||
|
||||
// Create New Particle Button
|
||||
boolean canCreate = pplayer.getActiveParticles().size() < PermissionManager.getMaxParticlesAllowed(pplayer.getPlayer());
|
||||
String lore = LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_CREATE_PARTICLE_DESCRIPTION);
|
||||
GuiActionButton createNewParticle = new GuiActionButton(38,
|
||||
GuiIcon.CREATE.get(),
|
||||
LangManager.getText(Lang.GUI_COLOR_ICON_NAME) + LangManager.getText(Lang.GUI_CREATE_PARTICLE),
|
||||
new String[] { LangManager.getText(Lang.GUI_COLOR_INFO) + LangManager.getText(Lang.GUI_CREATE_PARTICLE_DESCRIPTION) },
|
||||
canCreate ? new String[] { lore } : new String[] { lore, LangManager.getText(Lang.GUI_COLOR_UNAVAILABLE) + LangManager.getText(Lang.GUI_CREATE_PARTICLE_UNAVAILABLE) },
|
||||
(button, isShiftClick) -> {
|
||||
if (!canCreate) return;
|
||||
ParticlePair editingParticle = ParticlePair.getNextDefault(pplayer);
|
||||
List<GuiInventoryEditFinishedCallback> callbacks = new ArrayList<GuiInventoryEditFinishedCallback>();
|
||||
callbacks.add(() -> GuiHandler.transition(new GuiInventoryManageParticles(pplayer)));
|
||||
|
|
|
@ -110,6 +110,9 @@ public class LangManager {
|
|||
// Rainbow
|
||||
RAINBOW,
|
||||
|
||||
// Random
|
||||
RANDOM,
|
||||
|
||||
// Effects
|
||||
EFFECT_NO_PERMISSION,
|
||||
EFFECT_INVALID,
|
||||
|
@ -210,8 +213,10 @@ public class LangManager {
|
|||
GUI_EDIT_DATA,
|
||||
GUI_EDIT_DATA_DESCRIPTION,
|
||||
GUI_EDIT_DATA_UNAVAILABLE,
|
||||
GUI_DATA_NONE,
|
||||
GUI_CREATE_PARTICLE,
|
||||
GUI_CREATE_PARTICLE_DESCRIPTION,
|
||||
GUI_CREATE_PARTICLE_UNAVAILABLE,
|
||||
GUI_SELECT_EFFECT,
|
||||
GUI_SELECT_EFFECT_DESCRIPTION,
|
||||
GUI_SELECT_STYLE,
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.esophose.playerparticles.manager;
|
|||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
|
@ -37,6 +38,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
|||
*/
|
||||
private static int hue = 0;
|
||||
private static int note = 0;
|
||||
private static final Random RANDOM = new Random();
|
||||
|
||||
/**
|
||||
* Adds the player to the array when they join
|
||||
|
@ -148,13 +150,42 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
|||
ParticleEffect.display(particle, pparticle, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rainbow OrdinaryColor for particle spawning with data 'rainbow'
|
||||
*
|
||||
* @return The rainbow OrdinaryColor for particle spawning with data 'rainbow'
|
||||
*/
|
||||
public static OrdinaryColor getRainbowParticleColor() {
|
||||
Color rgb = Color.getHSBColor(hue / 360F, 1.0F, 1.0F);
|
||||
return new OrdinaryColor(rgb.getRed(), rgb.getGreen(), rgb.getBlue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the rainbow NoteColor for particle spawning with data 'rainbow'
|
||||
*
|
||||
* @return The rainbow NoteColor for particle spawning with data 'rainbow'
|
||||
*/
|
||||
public static NoteColor getRainbowNoteParticleColor() {
|
||||
return new NoteColor(note);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a randomized OrdinaryColor for particle spawning with data 'random'
|
||||
*
|
||||
* @return A randomized OrdinaryColor for particle spawning with data 'random'
|
||||
*/
|
||||
public static OrdinaryColor getRandomParticleColor() {
|
||||
Color rgb = new Color(RANDOM.nextInt(256), RANDOM.nextInt(256), RANDOM.nextInt(256));
|
||||
return new OrdinaryColor(rgb.getRed(), rgb.getGreen(), rgb.getBlue());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a randomized NoteColor for particle spawning with data 'random'
|
||||
*
|
||||
* @return A randomized NoteColor for particle spawning with data 'random'
|
||||
*/
|
||||
public static NoteColor getRandomNoteParticleColor() {
|
||||
return new NoteColor(RANDOM.nextInt(25));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -218,6 +218,7 @@ public class SettingManager {
|
|||
* Gets the Material for this icon
|
||||
* Tries to get from cache first, otherwise loads it
|
||||
*
|
||||
* @param configPath Where to look in the config.yml for the Material name
|
||||
* @return The path in the config.yml to lookup
|
||||
*/
|
||||
private Material getInternal(String configPath) {
|
||||
|
|
|
@ -400,7 +400,7 @@ public enum ParticleEffect {
|
|||
* or higher than 255
|
||||
*/
|
||||
public OrdinaryColor(int red, int green, int blue) throws IllegalArgumentException {
|
||||
if (red == 999 && green == 999 && blue == 999) {
|
||||
if ((red == 999 && green == 999 && blue == 999) || (red == 998 && green == 998 && blue == 998)) { // Allow rainbow and random values
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
|
@ -463,7 +463,7 @@ public enum ParticleEffect {
|
|||
*/
|
||||
@Override
|
||||
public float getValueX() {
|
||||
if (red == 999) return 0F;
|
||||
if (red == 999 || red == 998) return 0F;
|
||||
return (float) red / 255F;
|
||||
}
|
||||
|
||||
|
@ -474,7 +474,7 @@ public enum ParticleEffect {
|
|||
*/
|
||||
@Override
|
||||
public float getValueY() {
|
||||
if (green == 999) return 0F;
|
||||
if (green == 999 || green == 998) return 0F;
|
||||
return (float) green / 255F;
|
||||
}
|
||||
|
||||
|
@ -485,7 +485,7 @@ public enum ParticleEffect {
|
|||
*/
|
||||
@Override
|
||||
public float getValueZ() {
|
||||
if (blue == 999) return 0F;
|
||||
if (blue == 999 || blue == 998) return 0F;
|
||||
return (float) blue / 255F;
|
||||
}
|
||||
}
|
||||
|
@ -510,7 +510,7 @@ public enum ParticleEffect {
|
|||
* higher than 24
|
||||
*/
|
||||
public NoteColor(int note) throws IllegalArgumentException {
|
||||
if (note == 99) {
|
||||
if (note == 99 || note == 98) { // Allow rainbow and random values
|
||||
this.note = note;
|
||||
} else {
|
||||
if (note < 0) {
|
||||
|
|
|
@ -198,11 +198,15 @@ public class ParticlePair {
|
|||
if (this.effect == ParticleEffect.NOTE) {
|
||||
if (this.noteColor.getValueX() * 24 == 99) {
|
||||
return ParticleManager.getRainbowNoteParticleColor();
|
||||
} else if (this.noteColor.getValueX() * 24 == 98) {
|
||||
return ParticleManager.getRandomNoteParticleColor();
|
||||
}
|
||||
return this.noteColor;
|
||||
} else {
|
||||
if (this.color.getRed() == 999 && this.color.getGreen() == 999 && this.color.getBlue() == 999) {
|
||||
return ParticleManager.getRainbowParticleColor();
|
||||
} else if (this.color.getRed() == 998 && this.color.getGreen() == 998 && this.color.getBlue() == 998) {
|
||||
return ParticleManager.getRandomParticleColor();
|
||||
} else {
|
||||
return this.color;
|
||||
}
|
||||
|
@ -241,17 +245,21 @@ public class ParticlePair {
|
|||
if (this.effect == ParticleEffect.NOTE) {
|
||||
if (this.noteColor.getValueX() * 24 == 99) {
|
||||
return LangManager.getText(Lang.RAINBOW);
|
||||
} else if ((int)(this.noteColor.getValueX() * 24) == 98) {
|
||||
return LangManager.getText(Lang.RANDOM);
|
||||
}
|
||||
return "note #" + (int) (this.noteColor.getValueX() * 24);
|
||||
return LangManager.getText(Lang.GUI_SELECT_DATA_NOTE, (int) (this.noteColor.getValueX() * 24));
|
||||
} else {
|
||||
if (this.color.getRed() == 999 && this.color.getGreen() == 999 && this.color.getBlue() == 999) {
|
||||
return LangManager.getText(Lang.RAINBOW);
|
||||
} else if (this.color.getRed() == 998 && this.color.getGreen() == 998 && this.color.getBlue() == 998) {
|
||||
return LangManager.getText(Lang.RANDOM);
|
||||
} else {
|
||||
return ChatColor.RED + "" + this.color.getRed() + " " + ChatColor.GREEN + this.color.getGreen() + " " + ChatColor.AQUA + this.color.getBlue();
|
||||
}
|
||||
}
|
||||
}
|
||||
return "none";
|
||||
return LangManager.getText(Lang.GUI_DATA_NONE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -96,6 +96,9 @@ list-output: '&eID: &b{0} &eEffect: &b{1} &eStyle: &b{2} &eData: &b{3}'
|
|||
# Rainbow
|
||||
rainbow: '&cr&6a&ei&an&bb&9o&dw'
|
||||
|
||||
# Random
|
||||
random: 'random'
|
||||
|
||||
# Effects
|
||||
effect-no-permission: '&cYou do not have permission to use the effect &b{0} &c!'
|
||||
effect-invalid: '&cThe effect &b{0} &cdoes not exist! Use &b/pp effects &cfor a list of effects you can use.'
|
||||
|
@ -112,12 +115,12 @@ style-list: '&eYou can use the following styles: &b{0}'
|
|||
data-usage-none: '&eThe effect &b{0} &edoes not use any data!'
|
||||
data-usage-block: '&eThe effect &b{0} &erequires &bblock &edata! &bFormat: <blockName>'
|
||||
data-usage-item: '&eThe effect &b{0} &erequires &bitem &edata! &bFormat: <itemName>'
|
||||
data-usage-color: '&eThe effect &b{0} &erequires &bcolor &edata! &bFormat: <<0-255> <0-255> <0-255>>|<rainbow>'
|
||||
data-usage-note: '&eThe effect &b{0} &erequires &bnote &edata! &bFormat: <0-24>|<rainbow>'
|
||||
data-usage-color: '&eThe effect &b{0} &erequires &bcolor &edata! &bFormat: <<0-255> <0-255> <0-255>>|<rainbow>|<random>'
|
||||
data-usage-note: '&eThe effect &b{0} &erequires &bnote &edata! &bFormat: <0-24>|<rainbow>|<random>'
|
||||
data-invalid-block: '&cThe &bblock &cdata you entered is invalid! &bFormat: <blockName>'
|
||||
data-invalid-item: '&cThe &bitem &cdata you entered is invalid! &bFormat: <itemName>'
|
||||
data-invalid-color: '&cThe &bcolor &cdata you entered is invalid! &bFormat: <<0-255> <0-255> <0-255>>|<rainbow>'
|
||||
data-invalid-note: '&cThe &bnote &cdata you entered is invalid! &bFormat: <0-24>|<rainbow>'
|
||||
data-invalid-color: '&cThe &bcolor &cdata you entered is invalid! &bFormat: <<0-255> <0-255> <0-255>>|<rainbow>|<random>'
|
||||
data-invalid-note: '&cThe &bnote &cdata you entered is invalid! &bFormat: <0-24>|<rainbow>|<random>'
|
||||
data-invalid-material-not-item: '&cThe &bitem &cmaterial &b{0} &cyou entered is not an item!'
|
||||
data-invalid-material-not-block: '&cThe &bblock &cmaterial &b{0} &cyou entered is not a block!'
|
||||
data-invalid-material-item: '&cThe &bitem &cmaterial &b{0} you entered does not exist!'
|
||||
|
@ -196,8 +199,10 @@ gui-edit-style-description: 'Click to edit the style of this particle'
|
|||
gui-edit-data: 'Edit Data'
|
||||
gui-edit-data-description: 'Click to edit the data of this particle'
|
||||
gui-edit-data-unavailable: 'The effect of this particle does not use any data'
|
||||
gui-data-none: 'none'
|
||||
gui-create-particle: 'Create A New Particle'
|
||||
gui-create-particle-description: 'Create a new particle with an effect, style, and data'
|
||||
gui-create-particle-unavailable: 'You have reached the maximum amount of particles you can create'
|
||||
gui-select-effect: 'Select Particle Effect'
|
||||
gui-select-effect-description: 'Sets the particle effect to &b{0}'
|
||||
gui-select-style: 'Select Particle Style'
|
||||
|
@ -224,4 +229,4 @@ gui-edit-data-color-brown: '&6brown'
|
|||
gui-edit-data-color-black: '&8black'
|
||||
gui-edit-data-color-gray: '&8gray'
|
||||
gui-edit-data-color-light-gray: '&7light gray'
|
||||
gui-edit-data-color-white: '&fwhite'
|
||||
gui-edit-data-color-white: '&fwhite'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue