v4.3.1 Fix Update

This update should fix some problems with too many players' data being
stored
This commit is contained in:
Esophose 2017-04-25 21:19:51 -06:00
parent 3f5cd1ce69
commit 022a4efee2
8 changed files with 106 additions and 76 deletions

View file

@ -1,5 +1,9 @@
== UPDATING WILL DELETE YOUR CONFIG.YML == == UPDATING WILL DELETE YOUR CONFIG.YML ==
* Create a backup of your config.yml if you wish to import all your old settings! * Create a backup of your config.yml if you wish to import all your old settings!
=== v4.3.1 ===
* Fix players with the permission playerparticles.* being able to force reset other player's particles when they weren't supposed to be able to
* Fix players being saved in the config/database even if they haven't used the plugin
* Other internal changes & optimizations
=== v4.3 === === v4.3 ===
* Fix effects and styles not defaulting to 'none' if the player no longer has permission * Fix effects and styles not defaulting to 'none' if the player no longer has permission
* Fix errors printing to console resulting from offline players trying to spawn particles * Fix errors printing to console resulting from offline players trying to spawn particles

View file

@ -87,7 +87,7 @@ public class FixedParticleEffect {
this.particleColorData = colorData; this.particleColorData = colorData;
this.particleNoteColorData = noteColorData; this.particleNoteColorData = noteColorData;
PPlayer owner = ConfigManager.getInstance().getPPlayer(this.pplayerUUID, false); PPlayer owner = ConfigManager.getInstance().getPPlayer(this.pplayerUUID, true);
// Check nulls, if any are null set them to the PPlayer's values // Check nulls, if any are null set them to the PPlayer's values
if (this.particleItemData == null) this.particleItemData = owner.getItemData(); if (this.particleItemData == null) this.particleItemData = owner.getItemData();

View file

@ -10,7 +10,9 @@ package com.esophose.playerparticles;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Player;
import com.esophose.playerparticles.library.ParticleEffect; import com.esophose.playerparticles.library.ParticleEffect;
import com.esophose.playerparticles.library.ParticleEffect.BlockData; import com.esophose.playerparticles.library.ParticleEffect.BlockData;
@ -74,6 +76,15 @@ public class PPlayer {
public UUID getUniqueId() { public UUID getUniqueId() {
return this.playerUUID; return this.playerUUID;
} }
/**
* Gets the Player from their UUID
*
* @return The player if they are online, null if they are offline
*/
public Player getPlayer() {
return Bukkit.getPlayer(this.playerUUID);
}
/** /**
* Gets the player's particle effect * Gets the player's particle effect

View file

@ -10,6 +10,7 @@
TODO: v4.4 TODO: v4.4
+ Add new style 'tornado' + Add new style 'tornado'
+ Add new style 'atom' + Add new style 'atom'
+ Add new style 'wings'
+ GUI for styles and effects - Requires no additional permissions + GUI for styles and effects - Requires no additional permissions
/pp gui - Shows GUI that tells you your current effect, style, and data and lets you choose new ones /pp gui - Shows GUI that tells you your current effect, style, and data and lets you choose new ones
/pp gui effect - Shows GUI that lets you select a new effect, also shows your current one /pp gui effect - Shows GUI that lets you select a new effect, also shows your current one

View file

@ -77,19 +77,21 @@ public class ConfigManager {
* @param fileName The name of the file * @param fileName The name of the file
*/ */
private ConfigManager(String fileName) { private ConfigManager(String fileName) {
if (!PlayerParticles.getPlugin().getDataFolder().exists()) PlayerParticles.getPlugin().getDataFolder().mkdir(); if (!PlayerParticles.useMySQL) { // Don't bother creating the playerData.yml file if we aren't going to use it
if (!PlayerParticles.getPlugin().getDataFolder().exists()) PlayerParticles.getPlugin().getDataFolder().mkdir();
file = new File(PlayerParticles.getPlugin().getDataFolder(), fileName + ".yml"); file = new File(PlayerParticles.getPlugin().getDataFolder(), fileName + ".yml");
if (!file.exists()) { if (!file.exists()) {
try { try {
file.createNewFile(); file.createNewFile();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
}
} }
}
config = YamlConfiguration.loadConfiguration(file); config = YamlConfiguration.loadConfiguration(file);
}
} }
/** /**
@ -110,18 +112,24 @@ public class ConfigManager {
* @param addIfNotFound Adds the pplayer to the processing queue if they are not already in it * @param addIfNotFound Adds the pplayer to the processing queue if they are not already in it
* @return The found pplayer, or a newly generated one * @return The found pplayer, or a newly generated one
*/ */
public PPlayer getPPlayer(UUID playerUUID, boolean addIfNotFound) { public PPlayer getPPlayer(UUID playerUUID, boolean createIfNotFound) {
for (PPlayer pp : ParticleManager.particlePlayers) { for (PPlayer pp : ParticleManager.particlePlayers) {
if (pp.getUniqueId() == playerUUID) return pp; if (pp.getUniqueId() == playerUUID) return pp;
} }
PPlayer pplayer = buildPPlayer(playerUUID); PPlayer alreadySavedPPlayer = buildPPlayer(playerUUID, false); // If they exist, get them from the database
if (alreadySavedPPlayer != null) {
if (addIfNotFound && Bukkit.getPlayer(playerUUID) != null) { ParticleManager.particlePlayers.add(alreadySavedPPlayer);
ParticleManager.particlePlayers.add(pplayer); return alreadySavedPPlayer;
} }
return pplayer; if (createIfNotFound && Bukkit.getPlayer(playerUUID) != null) {
PPlayer pplayer = buildPPlayer(playerUUID, true); // Build a new PPlayer and store them in the config
ParticleManager.particlePlayers.add(pplayer);
return pplayer;
}
return null; // Not requesting a new PPlayer and nothing was found, return null
} }
/** /**
@ -131,7 +139,7 @@ public class ConfigManager {
* @param playerUUID The UUID to match the PPlayer to * @param playerUUID The UUID to match the PPlayer to
* @return A newly built pplayer * @return A newly built pplayer
*/ */
private PPlayer buildPPlayer(UUID playerUUID) { private PPlayer buildPPlayer(UUID playerUUID, boolean createIfNotFound) {
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
if (config.getString(playerUUID.toString() + ".style.name") != null) { if (config.getString(playerUUID.toString() + ".style.name") != null) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString()); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString());
@ -150,7 +158,7 @@ public class ConfigManager {
NoteColor particleNoteColorData = new NoteColor(noteColorDataSection.getInt("note")); NoteColor particleNoteColorData = new NoteColor(noteColorDataSection.getInt("note"));
return new PPlayer(playerUUID, particleEffect, particleStyle, particleItemData, particleBlockData, particleColorData, particleNoteColorData); return new PPlayer(playerUUID, particleEffect, particleStyle, particleItemData, particleBlockData, particleColorData, particleNoteColorData);
} else { } else if (createIfNotFound) {
PPlayer pplayer = PPlayer.getNewPPlayer(playerUUID); PPlayer pplayer = PPlayer.getNewPPlayer(playerUUID);
saveNewPPlayer(pplayer); saveNewPPlayer(pplayer);
return pplayer; return pplayer;
@ -173,7 +181,7 @@ public class ConfigManager {
NoteColor particleNoteColorData = new NoteColor(res.getByte("n.note")); NoteColor particleNoteColorData = new NoteColor(res.getByte("n.note"));
return new PPlayer(playerUUID, particleEffect, particleStyle, particleItemData, particleBlockData, particleColorData, particleNoteColorData); return new PPlayer(playerUUID, particleEffect, particleStyle, particleItemData, particleBlockData, particleColorData, particleNoteColorData);
} else { } else if (createIfNotFound) {
PPlayer pplayer = PPlayer.getNewPPlayer(playerUUID); PPlayer pplayer = PPlayer.getNewPPlayer(playerUUID);
saveNewPPlayer(pplayer); saveNewPPlayer(pplayer);
return pplayer; return pplayer;
@ -288,6 +296,7 @@ public class ConfigManager {
* @param particleEffect The effect that is being saved * @param particleEffect The effect that is being saved
*/ */
public void savePPlayer(UUID playerUUID, ParticleEffect particleEffect) { public void savePPlayer(UUID playerUUID, ParticleEffect particleEffect) {
PPlayer pplayer = getPPlayer(playerUUID, true);
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".effect"); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".effect");
section.set("name", particleEffect.getName()); section.set("name", particleEffect.getName());
@ -299,7 +308,7 @@ public class ConfigManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
getPPlayer(playerUUID, false).setParticleEffect(particleEffect); pplayer.setParticleEffect(particleEffect);
} }
/** /**
@ -309,6 +318,7 @@ public class ConfigManager {
* @param particleStyle The style that is being saved * @param particleStyle The style that is being saved
*/ */
public void savePPlayer(UUID playerUUID, ParticleStyle particleStyle) { public void savePPlayer(UUID playerUUID, ParticleStyle particleStyle) {
PPlayer pplayer = getPPlayer(playerUUID, true);
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".style"); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".style");
section.set("name", particleStyle.getName()); section.set("name", particleStyle.getName());
@ -320,7 +330,7 @@ public class ConfigManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
getPPlayer(playerUUID, false).setParticleStyle(particleStyle); pplayer.setParticleStyle(particleStyle);
} }
/** /**
@ -330,6 +340,7 @@ public class ConfigManager {
* @param particleItemData The data that is being saved * @param particleItemData The data that is being saved
*/ */
public void savePPlayer(UUID playerUUID, ItemData particleItemData) { public void savePPlayer(UUID playerUUID, ItemData particleItemData) {
PPlayer pplayer = getPPlayer(playerUUID, true);
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".itemData"); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".itemData");
section.set("material", particleItemData.getMaterial().name()); section.set("material", particleItemData.getMaterial().name());
@ -342,7 +353,7 @@ public class ConfigManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
getPPlayer(playerUUID, false).setItemData(particleItemData); pplayer.setItemData(particleItemData);
} }
/** /**
@ -352,6 +363,7 @@ public class ConfigManager {
* @param particleBlockData The data that is being saved * @param particleBlockData The data that is being saved
*/ */
public void savePPlayer(UUID playerUUID, BlockData particleBlockData) { public void savePPlayer(UUID playerUUID, BlockData particleBlockData) {
PPlayer pplayer = getPPlayer(playerUUID, true);
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".blockData"); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".blockData");
section.set("material", particleBlockData.getMaterial().name()); section.set("material", particleBlockData.getMaterial().name());
@ -364,7 +376,7 @@ public class ConfigManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
getPPlayer(playerUUID, false).setBlockData(particleBlockData); pplayer.setBlockData(particleBlockData);
} }
/** /**
@ -374,6 +386,7 @@ public class ConfigManager {
* @param particleColorData The data that is being saved * @param particleColorData The data that is being saved
*/ */
public void savePPlayer(UUID playerUUID, OrdinaryColor particleColorData) { public void savePPlayer(UUID playerUUID, OrdinaryColor particleColorData) {
PPlayer pplayer = getPPlayer(playerUUID, true);
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".colorData"); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".colorData");
section.set("r", particleColorData.getRed()); section.set("r", particleColorData.getRed());
@ -387,7 +400,7 @@ public class ConfigManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
getPPlayer(playerUUID, false).setColorData(particleColorData); pplayer.setColorData(particleColorData);
} }
/** /**
@ -397,6 +410,7 @@ public class ConfigManager {
* @param particleNoteColorData The data that is being saved * @param particleNoteColorData The data that is being saved
*/ */
public void savePPlayer(UUID playerUUID, NoteColor particleNoteColorData) { public void savePPlayer(UUID playerUUID, NoteColor particleNoteColorData) {
PPlayer pplayer = getPPlayer(playerUUID, true);
if (!PlayerParticles.useMySQL) { if (!PlayerParticles.useMySQL) {
ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".noteColorData"); ConfigurationSection section = config.getConfigurationSection(playerUUID.toString() + ".noteColorData");
section.set("note", (byte) (particleNoteColorData.getValueX() * 24)); section.set("note", (byte) (particleNoteColorData.getValueX() * 24));
@ -408,7 +422,7 @@ public class ConfigManager {
e.printStackTrace(); e.printStackTrace();
} }
} }
getPPlayer(playerUUID, false).setNoteColorData(particleNoteColorData); pplayer.setNoteColorData(particleNoteColorData);
} }
/** /**
@ -797,7 +811,7 @@ public class ConfigManager {
* @return The max distance a fixed effect can be created from the player * @return The max distance a fixed effect can be created from the player
*/ */
public int getMaxFixedEffectCreationDistance() { public int getMaxFixedEffectCreationDistance() {
if (maxFixedEffectCreationDistance == -1) { if (maxFixedEffectCreationDistance == -1) { // Initialize on the fly
maxFixedEffectCreationDistance = PlayerParticles.getPlugin().getConfig().getInt("max-fixed-effect-creation-distance"); maxFixedEffectCreationDistance = PlayerParticles.getPlugin().getConfig().getInt("max-fixed-effect-creation-distance");
} }
return maxFixedEffectCreationDistance; return maxFixedEffectCreationDistance;

View file

@ -32,7 +32,7 @@ import com.esophose.playerparticles.styles.api.PParticle;
import com.esophose.playerparticles.styles.api.ParticleStyleManager; import com.esophose.playerparticles.styles.api.ParticleStyleManager;
public class ParticleManager extends BukkitRunnable implements Listener { public class ParticleManager extends BukkitRunnable implements Listener {
/** /**
* How far away particles will spawn from players * How far away particles will spawn from players
*/ */
@ -42,12 +42,12 @@ public class ParticleManager extends BukkitRunnable implements Listener {
* The list containing all the player effect info * The list containing all the player effect info
*/ */
public static ArrayList<PPlayer> particlePlayers = new ArrayList<PPlayer>(); public static ArrayList<PPlayer> particlePlayers = new ArrayList<PPlayer>();
/** /**
* The list containing all the fixed effect info * The list containing all the fixed effect info
*/ */
public static ArrayList<FixedParticleEffect> fixedParticleEffects = new ArrayList<FixedParticleEffect>(); public static ArrayList<FixedParticleEffect> fixedParticleEffects = new ArrayList<FixedParticleEffect>();
/** /**
* Rainbow particle effect hue and note color used for rainbow colorable effects * Rainbow particle effect hue and note color used for rainbow colorable effects
* These should be moved to a more appropriate place later * These should be moved to a more appropriate place later
@ -62,7 +62,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
*/ */
@EventHandler @EventHandler
public void onPlayerJoin(PlayerJoinEvent e) { public void onPlayerJoin(PlayerJoinEvent e) {
ConfigManager.getInstance().getPPlayer(e.getPlayer().getUniqueId(), true); ConfigManager.getInstance().getPPlayer(e.getPlayer().getUniqueId(), false);
} }
/** /**
@ -81,7 +81,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
public static void addAllFixedEffects() { public static void addAllFixedEffects() {
fixedParticleEffects.addAll(ConfigManager.getInstance().getAllFixedEffects()); fixedParticleEffects.addAll(ConfigManager.getInstance().getAllFixedEffects());
} }
/** /**
* Removes all fixed effects for the given pplayer * Removes all fixed effects for the given pplayer
* *
@ -89,11 +89,10 @@ public class ParticleManager extends BukkitRunnable implements Listener {
*/ */
public static void removeAllFixedEffectsForPlayer(UUID pplayerUUID) { public static void removeAllFixedEffectsForPlayer(UUID pplayerUUID) {
for (int i = fixedParticleEffects.size() - 1; i >= 0; i--) { for (int i = fixedParticleEffects.size() - 1; i >= 0; i--) {
if (fixedParticleEffects.get(i).getOwnerUniqueId().equals(pplayerUUID)) if (fixedParticleEffects.get(i).getOwnerUniqueId().equals(pplayerUUID)) fixedParticleEffects.remove(i);
fixedParticleEffects.remove(i);
} }
} }
/** /**
* Adds a fixed effect * Adds a fixed effect
* *
@ -102,7 +101,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
public static void addFixedEffect(FixedParticleEffect fixedEffect) { public static void addFixedEffect(FixedParticleEffect fixedEffect) {
fixedParticleEffects.add(fixedEffect); fixedParticleEffects.add(fixedEffect);
} }
/** /**
* Removes a fixed effect for the given pplayer with the given id * Removes a fixed effect for the given pplayer with the given id
* *
@ -111,12 +110,10 @@ public class ParticleManager extends BukkitRunnable implements Listener {
*/ */
public static void removeFixedEffectForPlayer(UUID pplayerUUID, int id) { public static void removeFixedEffectForPlayer(UUID pplayerUUID, int id) {
for (int i = fixedParticleEffects.size() - 1; i >= 0; i--) { for (int i = fixedParticleEffects.size() - 1; i >= 0; i--) {
if (fixedParticleEffects.get(i).getOwnerUniqueId().equals(pplayerUUID) && if (fixedParticleEffects.get(i).getOwnerUniqueId().equals(pplayerUUID) && fixedParticleEffects.get(i).getId() == id) fixedParticleEffects.remove(i);
fixedParticleEffects.get(i).getId() == id)
fixedParticleEffects.remove(i);
} }
} }
/** /**
* Clears the list then adds everybody on the server * Clears the list then adds everybody on the server
* Used for when the server reloads and we can't rely on players rejoining * Used for when the server reloads and we can't rely on players rejoining
@ -124,7 +121,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
public static void refreshPPlayers() { public static void refreshPPlayers() {
particlePlayers.clear(); particlePlayers.clear();
for (Player player : Bukkit.getOnlinePlayers()) { for (Player player : Bukkit.getOnlinePlayers()) {
ConfigManager.getInstance().getPPlayer(player.getUniqueId(), true); ConfigManager.getInstance().getPPlayer(player.getUniqueId(), false);
} }
} }
@ -162,62 +159,65 @@ public class ParticleManager extends BukkitRunnable implements Listener {
*/ */
public void run() { public void run() {
ParticleStyleManager.updateTimers(); ParticleStyleManager.updateTimers();
hue++; hue++;
hue %= 360; hue %= 360;
if (hue % 10 == 0) { // Only increment note by 2 notes per second if (hue % 10 == 0) { // Only increment note by 2 notes per second
note++; note++;
note %= 24; note %= 24;
} }
// Loop for PPlayers // Loop over backwards so we can remove pplayers if need be
for (PPlayer pplayer : particlePlayers) { for (int i = particlePlayers.size() - 1; i >= 0; i--) {
Player player = Bukkit.getPlayer(pplayer.getUniqueId()); PPlayer pplayer = particlePlayers.get(i);
Player player = pplayer.getPlayer();
if (player == null) continue; // Skip if they aren't online
if (player == null) { // Skip and remove, why are they still in the array if they are offline?
particlePlayers.remove(i);
}
// Perform permission and validity checks // Perform permission and validity checks
boolean valid = true; boolean valid = true;
// If the player no longer has permission for the effect, remove it // If the player no longer has permission for the effect, remove it
if (!PermissionManager.hasEffectPermission(player, pplayer.getParticleEffect())) { if (!PermissionManager.hasEffectPermission(player, pplayer.getParticleEffect())) {
ConfigManager.getInstance().savePPlayer(pplayer.getUniqueId(), ParticleEffect.NONE); ConfigManager.getInstance().savePPlayer(pplayer.getUniqueId(), ParticleEffect.NONE);
valid = false; valid = false;
} }
// If the player no longer has permission for the style, default to none // If the player no longer has permission for the style, default to none
if (!PermissionManager.hasStylePermission(player, pplayer.getParticleStyle())) { if (!PermissionManager.hasStylePermission(player, pplayer.getParticleStyle())) {
ConfigManager.getInstance().savePPlayer(pplayer.getUniqueId(), DefaultStyles.NONE); ConfigManager.getInstance().savePPlayer(pplayer.getUniqueId(), DefaultStyles.NONE);
valid = false; valid = false;
} }
// Check for the string matching to maintain support for 1.7 // Check for the string matching to maintain support for 1.7
// This was checking GameMode.SPECTATOR before and was throwing errors // This was checking GameMode.SPECTATOR before and was throwing errors
if (player.getGameMode().name().equalsIgnoreCase("spectator")) { if (player.getGameMode().name().equalsIgnoreCase("spectator")) {
valid = false; valid = false;
} }
if (ConfigManager.getInstance().isWorldDisabled(player.getWorld().getName())) { if (ConfigManager.getInstance().isWorldDisabled(player.getWorld().getName())) {
valid = false; valid = false;
} }
if (!valid) continue; if (!valid) continue;
Location loc = player.getLocation(); Location loc = player.getLocation();
loc.setY(loc.getY() + 1); loc.setY(loc.getY() + 1);
displayParticles(pplayer, loc); displayParticles(pplayer, loc);
} }
// Loop for FixedParticleEffects // Loop for FixedParticleEffects
for (FixedParticleEffect effect : fixedParticleEffects) { for (FixedParticleEffect effect : fixedParticleEffects) {
boolean valid = true; boolean valid = true;
for (PPlayer pplayer: particlePlayers) { for (PPlayer pplayer : particlePlayers) {
if (pplayer.getUniqueId() == effect.getOwnerUniqueId()) { if (pplayer.getUniqueId() == effect.getOwnerUniqueId()) {
valid = PermissionManager.canUseFixedEffects(Bukkit.getPlayer(pplayer.getUniqueId())); valid = PermissionManager.canUseFixedEffects(Bukkit.getPlayer(pplayer.getUniqueId()));
} }
} }
if (valid) { if (valid) {
displayFixedParticleEffect(effect); displayFixedParticleEffect(effect);
} }
@ -265,7 +265,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
} }
} }
} }
/** /**
* Displays particles at the given fixed effect location * Displays particles at the given fixed effect location
* *
@ -284,12 +284,12 @@ public class ParticleManager extends BukkitRunnable implements Listener {
} }
} }
} }
public static OrdinaryColor getRainbowParticleColor() { public static OrdinaryColor getRainbowParticleColor() {
Color rgb = Color.getHSBColor(hue / 360F, 1.0F, 1.0F); Color rgb = Color.getHSBColor(hue / 360F, 1.0F, 1.0F);
return new OrdinaryColor(rgb.getRed(), rgb.getGreen(), rgb.getBlue()); return new OrdinaryColor(rgb.getRed(), rgb.getGreen(), rgb.getBlue());
} }
public static NoteColor getRainbowNoteParticleColor() { public static NoteColor getRainbowNoteParticleColor() {
return new NoteColor(note); return new NoteColor(note);
} }

View file

@ -12,19 +12,19 @@ public class DefaultStyles {
/** /**
* All the styles that are available by default from this plugin * All the styles that are available by default from this plugin
*/ */
public static ParticleStyle NONE = new ParticleStyleNone(); public static final ParticleStyle NONE = new ParticleStyleNone();
public static ParticleStyle BEAM = new ParticleStyleBeam(); public static final ParticleStyle BEAM = new ParticleStyleBeam();
public static ParticleStyle HALO = new ParticleStyleHalo(); public static final ParticleStyle HALO = new ParticleStyleHalo();
public static ParticleStyle POINT = new ParticleStylePoint(); public static final ParticleStyle POINT = new ParticleStylePoint();
public static ParticleStyle MOVE = new ParticleStyleMove(); public static final ParticleStyle MOVE = new ParticleStyleMove();
public static ParticleStyle SPIN = new ParticleStyleSpin(); public static final ParticleStyle SPIN = new ParticleStyleSpin();
public static ParticleStyle QUADHELIX = new ParticleStyleQuadhelix(); public static final ParticleStyle QUADHELIX = new ParticleStyleQuadhelix();
public static ParticleStyle ORBIT = new ParticleStyleOrbit(); public static final ParticleStyle ORBIT = new ParticleStyleOrbit();
public static ParticleStyle FEET = new ParticleStyleFeet(); public static final ParticleStyle FEET = new ParticleStyleFeet();
public static ParticleStyle CUBE = new ParticleStyleCube(); public static final ParticleStyle CUBE = new ParticleStyleCube();
public static ParticleStyle ARROWS = new ParticleStyleArrows(); public static final ParticleStyle ARROWS = new ParticleStyleArrows();
public static ParticleStyle SPIRAL = new ParticleStyleSpiral(); public static final ParticleStyle SPIRAL = new ParticleStyleSpiral();
public static ParticleStyle THICK = new ParticleStyleThick(); public static final ParticleStyle THICK = new ParticleStyleThick();
/** /**
* Registers all the default styles to the ParticleStyleManager * Registers all the default styles to the ParticleStyleManager

View file

@ -24,7 +24,7 @@ public class ParticleStyleMove extends ParticleStyleNone implements Listener {
@EventHandler @EventHandler
public void onPlayerMove(PlayerMoveEvent e) { public void onPlayerMove(PlayerMoveEvent e) {
PPlayer pplayer = ConfigManager.getInstance().getPPlayer(e.getPlayer().getUniqueId(), false); PPlayer pplayer = ConfigManager.getInstance().getPPlayer(e.getPlayer().getUniqueId(), false);
if (pplayer.getParticleStyle() == DefaultStyles.MOVE) { if (pplayer != null && pplayer.getParticleStyle() == DefaultStyles.MOVE) {
if (PermissionManager.hasStylePermission(e.getPlayer(), DefaultStyles.MOVE)) { if (PermissionManager.hasStylePermission(e.getPlayer(), DefaultStyles.MOVE)) {
Location loc = e.getPlayer().getLocation(); Location loc = e.getPlayer().getLocation();
loc.setY(loc.getY() + 0.05); loc.setY(loc.getY() + 0.05);