mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-02-11 11:40:21 +00:00
Fix inconsistencies in whitespace formatting
Only use 4 spaces, no tabs.
This commit is contained in:
parent
8cbb588d18
commit
6871b7e3d2
50 changed files with 1652 additions and 1689 deletions
|
@ -41,8 +41,7 @@ public class FixedCommandModule implements CommandModule {
|
||||||
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_REMOVE);
|
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_REMOVE);
|
||||||
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_LIST);
|
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_LIST);
|
||||||
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_INFO);
|
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_INFO);
|
||||||
if (p.hasPermission("playerparticles.fixed.clear"))
|
if (p.hasPermission("playerparticles.fixed.clear")) LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CLEAR);
|
||||||
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CLEAR);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,28 +68,22 @@ public class FixedCommandModule implements CommandModule {
|
||||||
double xPos = -1, yPos = -1, zPos = -1;
|
double xPos = -1, yPos = -1, zPos = -1;
|
||||||
try {
|
try {
|
||||||
if (args[0].startsWith("~")) {
|
if (args[0].startsWith("~")) {
|
||||||
if (args[0].equals("~"))
|
if (args[0].equals("~")) xPos = p.getLocation().getX();
|
||||||
xPos = p.getLocation().getX();
|
else xPos = p.getLocation().getX() + Double.parseDouble(args[0].substring(1));
|
||||||
else
|
|
||||||
xPos = p.getLocation().getX() + Double.parseDouble(args[0].substring(1));
|
|
||||||
} else {
|
} else {
|
||||||
xPos = Double.parseDouble(args[0]);
|
xPos = Double.parseDouble(args[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[1].startsWith("~")) {
|
if (args[1].startsWith("~")) {
|
||||||
if (args[1].equals("~"))
|
if (args[1].equals("~")) yPos = p.getLocation().getY() + 1;
|
||||||
yPos = p.getLocation().getY() + 1;
|
else yPos = p.getLocation().getY() + 1 + Double.parseDouble(args[1].substring(1));
|
||||||
else
|
|
||||||
yPos = p.getLocation().getY() + 1 + Double.parseDouble(args[1].substring(1));
|
|
||||||
} else {
|
} else {
|
||||||
yPos = Double.parseDouble(args[1]);
|
yPos = Double.parseDouble(args[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args[2].startsWith("~")) {
|
if (args[2].startsWith("~")) {
|
||||||
if (args[2].equals("~"))
|
if (args[2].equals("~")) zPos = p.getLocation().getZ();
|
||||||
zPos = p.getLocation().getZ();
|
else zPos = p.getLocation().getZ() + Double.parseDouble(args[2].substring(1));
|
||||||
else
|
|
||||||
zPos = p.getLocation().getZ() + Double.parseDouble(args[2].substring(1));
|
|
||||||
} else {
|
} else {
|
||||||
zPos = Double.parseDouble(args[2]);
|
zPos = Double.parseDouble(args[2]);
|
||||||
}
|
}
|
||||||
|
@ -185,10 +178,8 @@ public class FixedCommandModule implements CommandModule {
|
||||||
Material material = null;
|
Material material = null;
|
||||||
try {
|
try {
|
||||||
material = ParticleUtils.closestMatch(args[5]);
|
material = ParticleUtils.closestMatch(args[5]);
|
||||||
if (material == null)
|
if (material == null) material = Material.matchMaterial(args[5]);
|
||||||
material = Material.matchMaterial(args[5]);
|
if (material == null) throw new Exception();
|
||||||
if (material == null)
|
|
||||||
throw new Exception();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "block");
|
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "block");
|
||||||
return;
|
return;
|
||||||
|
@ -199,10 +190,8 @@ public class FixedCommandModule implements CommandModule {
|
||||||
Material material = null;
|
Material material = null;
|
||||||
try {
|
try {
|
||||||
material = ParticleUtils.closestMatch(args[5]);
|
material = ParticleUtils.closestMatch(args[5]);
|
||||||
if (material == null)
|
if (material == null) material = Material.matchMaterial(args[5]);
|
||||||
material = Material.matchMaterial(args[5]);
|
if (material == null) throw new Exception();
|
||||||
if (material == null)
|
|
||||||
throw new Exception();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "item");
|
LangManager.sendMessage(p, Lang.CREATE_FIXED_DATA_ERROR, "item");
|
||||||
return;
|
return;
|
||||||
|
@ -251,10 +240,8 @@ public class FixedCommandModule implements CommandModule {
|
||||||
String msg = Lang.LIST_FIXED_SUCCESS.get();
|
String msg = Lang.LIST_FIXED_SUCCESS.get();
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
for (int id : ids) {
|
for (int id : ids) {
|
||||||
if (!first)
|
if (!first) msg += ", ";
|
||||||
msg += ", ";
|
else first = false;
|
||||||
else
|
|
||||||
first = false;
|
|
||||||
msg += id;
|
msg += id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -281,7 +268,6 @@ public class FixedCommandModule implements CommandModule {
|
||||||
|
|
||||||
ParticlePair particle = fixedEffect.getParticlePair();
|
ParticlePair particle = fixedEffect.getParticlePair();
|
||||||
|
|
||||||
|
|
||||||
DecimalFormat df = new DecimalFormat("0.##"); // Decimal formatter so the coords aren't super long
|
DecimalFormat df = new DecimalFormat("0.##"); // Decimal formatter so the coords aren't super long
|
||||||
String listMessage = Lang.INFO_FIXED_INFO.get() // @formatter:off
|
String listMessage = Lang.INFO_FIXED_INFO.get() // @formatter:off
|
||||||
.replaceAll("\\{0\\}", fixedEffect.getId() + "")
|
.replaceAll("\\{0\\}", fixedEffect.getId() + "")
|
||||||
|
@ -316,9 +302,7 @@ public class FixedCommandModule implements CommandModule {
|
||||||
|
|
||||||
for (PPlayer ppl : ParticleManager.getPPlayers())
|
for (PPlayer ppl : ParticleManager.getPPlayers())
|
||||||
for (FixedParticleEffect fixedEffect : ppl.getFixedParticles())
|
for (FixedParticleEffect fixedEffect : ppl.getFixedParticles())
|
||||||
if (fixedEffect.getLocation().getWorld().equals(p.getLocation().getWorld())
|
if (fixedEffect.getLocation().getWorld().equals(p.getLocation().getWorld()) && fixedEffect.getLocation().distance(p.getLocation()) <= radius) fixedEffectsToRemove.add(fixedEffect);
|
||||||
&& fixedEffect.getLocation().distance(p.getLocation()) <= radius)
|
|
||||||
fixedEffectsToRemove.add(fixedEffect);
|
|
||||||
|
|
||||||
for (FixedParticleEffect fixedEffect : fixedEffectsToRemove)
|
for (FixedParticleEffect fixedEffect : fixedEffectsToRemove)
|
||||||
DataManager.removeFixedEffect(fixedEffect.getOwnerUniqueId(), fixedEffect.getId());
|
DataManager.removeFixedEffect(fixedEffect.getOwnerUniqueId(), fixedEffect.getId());
|
||||||
|
@ -333,8 +317,7 @@ public class FixedCommandModule implements CommandModule {
|
||||||
LangManager.sendMessage(pplayer, Lang.FIXED_COMMAND_DESC_REMOVE);
|
LangManager.sendMessage(pplayer, Lang.FIXED_COMMAND_DESC_REMOVE);
|
||||||
LangManager.sendMessage(pplayer, Lang.FIXED_COMMAND_DESC_LIST);
|
LangManager.sendMessage(pplayer, Lang.FIXED_COMMAND_DESC_LIST);
|
||||||
LangManager.sendMessage(pplayer, Lang.FIXED_COMMAND_DESC_INFO);
|
LangManager.sendMessage(pplayer, Lang.FIXED_COMMAND_DESC_INFO);
|
||||||
if (p.hasPermission("playerparticles.fixed.clear"))
|
if (p.hasPermission("playerparticles.fixed.clear")) LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CLEAR);
|
||||||
LangManager.sendMessage(p, Lang.FIXED_COMMAND_DESC_CLEAR);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -250,10 +250,8 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
private static void setPPlayerEffect(PPlayer pplayer, ParticleEffect effect) {
|
private static void setPPlayerEffect(PPlayer pplayer, ParticleEffect effect) {
|
||||||
List<ParticlePair> particles = pplayer.getActiveParticles();
|
List<ParticlePair> particles = pplayer.getActiveParticles();
|
||||||
ParticlePair particle;
|
ParticlePair particle;
|
||||||
if (particles.isEmpty())
|
if (particles.isEmpty()) particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
||||||
particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
else particle = particles.get(0);
|
||||||
else
|
|
||||||
particle = particles.get(0);
|
|
||||||
|
|
||||||
particle.setEffect(effect);
|
particle.setEffect(effect);
|
||||||
particles.clear();
|
particles.clear();
|
||||||
|
@ -266,10 +264,8 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
private static void setPPlayerStyle(PPlayer pplayer, ParticleStyle style) {
|
private static void setPPlayerStyle(PPlayer pplayer, ParticleStyle style) {
|
||||||
List<ParticlePair> particles = pplayer.getActiveParticles();
|
List<ParticlePair> particles = pplayer.getActiveParticles();
|
||||||
ParticlePair particle;
|
ParticlePair particle;
|
||||||
if (particles.isEmpty())
|
if (particles.isEmpty()) particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
||||||
particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
else particle = particles.get(0);
|
||||||
else
|
|
||||||
particle = particles.get(0);
|
|
||||||
|
|
||||||
particle.setStyle(style);
|
particle.setStyle(style);
|
||||||
particles.clear();
|
particles.clear();
|
||||||
|
@ -282,10 +278,8 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
private static void setPPlayerItemMaterial(PPlayer pplayer, Material material) {
|
private static void setPPlayerItemMaterial(PPlayer pplayer, Material material) {
|
||||||
List<ParticlePair> particles = pplayer.getActiveParticles();
|
List<ParticlePair> particles = pplayer.getActiveParticles();
|
||||||
ParticlePair particle;
|
ParticlePair particle;
|
||||||
if (particles.isEmpty())
|
if (particles.isEmpty()) particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
||||||
particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
else particle = particles.get(0);
|
||||||
else
|
|
||||||
particle = particles.get(0);
|
|
||||||
|
|
||||||
particle.setItemMaterial(material);
|
particle.setItemMaterial(material);
|
||||||
particles.clear();
|
particles.clear();
|
||||||
|
@ -298,10 +292,8 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
private static void setPPlayerBlockMaterial(PPlayer pplayer, Material material) {
|
private static void setPPlayerBlockMaterial(PPlayer pplayer, Material material) {
|
||||||
List<ParticlePair> particles = pplayer.getActiveParticles();
|
List<ParticlePair> particles = pplayer.getActiveParticles();
|
||||||
ParticlePair particle;
|
ParticlePair particle;
|
||||||
if (particles.isEmpty())
|
if (particles.isEmpty()) particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
||||||
particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
else particle = particles.get(0);
|
||||||
else
|
|
||||||
particle = particles.get(0);
|
|
||||||
|
|
||||||
particle.setBlockMaterial(material);
|
particle.setBlockMaterial(material);
|
||||||
particles.clear();
|
particles.clear();
|
||||||
|
@ -314,10 +306,8 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
private static void setPPlayerColor(PPlayer pplayer, OrdinaryColor color) {
|
private static void setPPlayerColor(PPlayer pplayer, OrdinaryColor color) {
|
||||||
List<ParticlePair> particles = pplayer.getActiveParticles();
|
List<ParticlePair> particles = pplayer.getActiveParticles();
|
||||||
ParticlePair particle;
|
ParticlePair particle;
|
||||||
if (particles.isEmpty())
|
if (particles.isEmpty()) particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
||||||
particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
else particle = particles.get(0);
|
||||||
else
|
|
||||||
particle = particles.get(0);
|
|
||||||
|
|
||||||
particle.setColor(color);
|
particle.setColor(color);
|
||||||
particles.clear();
|
particles.clear();
|
||||||
|
@ -330,10 +320,8 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
private static void setPPlayerNoteColor(PPlayer pplayer, NoteColor noteColor) {
|
private static void setPPlayerNoteColor(PPlayer pplayer, NoteColor noteColor) {
|
||||||
List<ParticlePair> particles = pplayer.getActiveParticles();
|
List<ParticlePair> particles = pplayer.getActiveParticles();
|
||||||
ParticlePair particle;
|
ParticlePair particle;
|
||||||
if (particles.isEmpty())
|
if (particles.isEmpty()) particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
||||||
particle = ParticlePair.getDefault(pplayer.getUniqueId());
|
else particle = particles.get(0);
|
||||||
else
|
|
||||||
particle = particles.get(0);
|
|
||||||
|
|
||||||
particle.setNoteColor(noteColor);
|
particle.setNoteColor(noteColor);
|
||||||
particles.clear();
|
particles.clear();
|
||||||
|
@ -425,9 +413,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
public static void changeState(PPlayer pplayer, GuiState state) {
|
public static void changeState(PPlayer pplayer, GuiState state) {
|
||||||
Player player = pplayer.getPlayer();
|
Player player = pplayer.getPlayer();
|
||||||
|
|
||||||
if ((state == GuiState.EFFECT && PermissionManager.getEffectsUserHasPermissionFor(player).size() == 1) ||
|
if ((state == GuiState.EFFECT && PermissionManager.getEffectsUserHasPermissionFor(player).size() == 1) || (state == GuiState.STYLE && PermissionManager.getStylesUserHasPermissionFor(player).size() == 1) || (state == GuiState.DATA && getPPlayerSpawnMaterial(pplayer) == null && getPPlayerSpawnColor(pplayer) == null)) return;
|
||||||
(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
|
// 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 they have the wrong inventory open for some reason, create a new one and open it for them
|
||||||
|
@ -486,7 +472,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
currentIconLore[2] = ChatColor.YELLOW + "Active Data: " + ChatColor.AQUA + getPPlayerDataString(pplayer);
|
currentIconLore[2] = ChatColor.YELLOW + "Active Data: " + ChatColor.AQUA + getPPlayerDataString(pplayer);
|
||||||
currentIconMeta.setLore(Arrays.asList(currentIconLore));
|
currentIconMeta.setLore(Arrays.asList(currentIconLore));
|
||||||
currentIconMeta.setOwner(player.getName());
|
currentIconMeta.setOwner(player.getName());
|
||||||
//currentIconMeta.setOwningPlayer(Bukkit.getOfflinePlayer(player.getUniqueId())); // This doesn't exist in 1.9
|
// currentIconMeta.setOwningPlayer(Bukkit.getOfflinePlayer(player.getUniqueId())); // This doesn't exist in 1.9
|
||||||
currentIcon.setItemMeta(currentIconMeta);
|
currentIcon.setItemMeta(currentIconMeta);
|
||||||
|
|
||||||
ItemStack effectIcon = new ItemStack(defaultMenuIcons[0], 1);
|
ItemStack effectIcon = new ItemStack(defaultMenuIcons[0], 1);
|
||||||
|
@ -632,8 +618,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
|
|
||||||
while (materialBag.size() < 28) { // Grab 28 random materials that are an item
|
while (materialBag.size() < 28) { // Grab 28 random materials that are an item
|
||||||
Material randomMaterial = ITEM_MATERIALS.get(RANDOM.nextInt(ITEM_MATERIALS.size()));
|
Material randomMaterial = ITEM_MATERIALS.get(RANDOM.nextInt(ITEM_MATERIALS.size()));
|
||||||
if (!materialBag.contains(randomMaterial))
|
if (!materialBag.contains(randomMaterial)) materialBag.add(randomMaterial);
|
||||||
materialBag.add(randomMaterial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 10; i <= 16; i++) { // Top row
|
for (int i = 10; i <= 16; i++) { // Top row
|
||||||
|
@ -657,8 +642,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
|
|
||||||
while (materialBag.size() < 28) { // Grab 28 random materials that are an item
|
while (materialBag.size() < 28) { // Grab 28 random materials that are an item
|
||||||
Material randomMaterial = BLOCK_MATERIALS.get(RANDOM.nextInt(BLOCK_MATERIALS.size()));
|
Material randomMaterial = BLOCK_MATERIALS.get(RANDOM.nextInt(BLOCK_MATERIALS.size()));
|
||||||
if (!materialBag.contains(randomMaterial))
|
if (!materialBag.contains(randomMaterial)) materialBag.add(randomMaterial);
|
||||||
materialBag.add(randomMaterial);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 10; i <= 16; i++) { // Top row
|
for (int i = 10; i <= 16; i++) { // Top row
|
||||||
|
@ -978,8 +962,7 @@ public class PlayerParticlesGui extends BukkitRunnable implements Listener {
|
||||||
*/
|
*/
|
||||||
private static ColorData getColorDataFromOrdinaryColor(DyeColor color) {
|
private static ColorData getColorDataFromOrdinaryColor(DyeColor color) {
|
||||||
for (ColorData colorData : colorMapping)
|
for (ColorData colorData : colorMapping)
|
||||||
if (colorData.getDyeColor().equals(color))
|
if (colorData.getDyeColor().equals(color)) return colorData;
|
||||||
return colorData;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ import com.esophose.playerparticles.util.ParticleUtils;
|
||||||
* All data changes to PPlayers such as group or fixed effect changes must be done through here,
|
* All data changes to PPlayers such as group or fixed effect changes must be done through here,
|
||||||
* rather than directly on the PPlayer object
|
* rather than directly on the PPlayer object
|
||||||
*/
|
*/
|
||||||
public class DataManager { // @formatter:off
|
public class DataManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The disabled worlds cached for quick access
|
* The disabled worlds cached for quick access
|
||||||
|
@ -53,7 +53,9 @@ public class DataManager { // @formatter:off
|
||||||
/**
|
/**
|
||||||
* This is not instantiable
|
* This is not instantiable
|
||||||
*/
|
*/
|
||||||
private DataManager() { }
|
private DataManager() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets a PPlayer from cache
|
* Gets a PPlayer from cache
|
||||||
|
@ -65,8 +67,7 @@ public class DataManager { // @formatter:off
|
||||||
*/
|
*/
|
||||||
public static PPlayer getPPlayer(UUID playerUUID) {
|
public static PPlayer getPPlayer(UUID playerUUID) {
|
||||||
for (PPlayer pp : ParticleManager.particlePlayers)
|
for (PPlayer pp : ParticleManager.particlePlayers)
|
||||||
if (pp.getUniqueId() == playerUUID)
|
if (pp.getUniqueId() == playerUUID) return pp;
|
||||||
return pp;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,9 +91,9 @@ public class DataManager { // @formatter:off
|
||||||
|
|
||||||
PlayerParticles.databaseConnector.connect((connection) -> {
|
PlayerParticles.databaseConnector.connect((connection) -> {
|
||||||
// Load particle groups
|
// Load particle groups
|
||||||
String groupQuery = "SELECT * FROM pp_group g " +
|
String groupQuery = "SELECT * FROM pp_group g " + // @formatter:off
|
||||||
"JOIN pp_particle p ON g.uuid = p.group_uuid " +
|
"JOIN pp_particle p ON g.uuid = p.group_uuid " +
|
||||||
"WHERE g.owner_uuid = ?";
|
"WHERE g.owner_uuid = ?"; // @formatter:on
|
||||||
try (PreparedStatement statement = connection.prepareStatement(groupQuery)) {
|
try (PreparedStatement statement = connection.prepareStatement(groupQuery)) {
|
||||||
statement.setString(1, playerUUID.toString());
|
statement.setString(1, playerUUID.toString());
|
||||||
|
|
||||||
|
@ -132,9 +133,9 @@ public class DataManager { // @formatter:off
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load fixed effects
|
// Load fixed effects
|
||||||
String fixedQuery = "SELECT f.id AS f_id, f.world, f.xPos, f.yPos, f.zPos, p.id AS p_id, p.effect, p.style, p.item_material, p.block_material, p.note, p.r, p.g, p.b FROM pp_fixed f " +
|
String fixedQuery = "SELECT f.id AS f_id, f.world, f.xPos, f.yPos, f.zPos, p.id AS p_id, p.effect, p.style, p.item_material, p.block_material, p.note, p.r, p.g, p.b FROM pp_fixed f " + // @formatter:off
|
||||||
"JOIN pp_particle p ON f.particle_uuid = p.uuid " +
|
"JOIN pp_particle p ON f.particle_uuid = p.uuid " +
|
||||||
"WHERE f.owner_uuid = ?";
|
"WHERE f.owner_uuid = ?"; // @formatter:on
|
||||||
try (PreparedStatement statement = connection.prepareStatement(fixedQuery)) {
|
try (PreparedStatement statement = connection.prepareStatement(fixedQuery)) {
|
||||||
statement.setString(1, playerUUID.toString());
|
statement.setString(1, playerUUID.toString());
|
||||||
|
|
||||||
|
@ -392,8 +393,7 @@ public class DataManager { // @formatter:off
|
||||||
maxFixedEffects = PlayerParticles.getPlugin().getConfig().getInt("max-fixed-effects");
|
maxFixedEffects = PlayerParticles.getPlugin().getConfig().getInt("max-fixed-effects");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pplayer.getPlayer().hasPermission("playerparticles.fixed.unlimited"))
|
if (pplayer.getPlayer().hasPermission("playerparticles.fixed.unlimited")) return false;
|
||||||
return false;
|
|
||||||
return pplayer.getFixedEffectIds().size() >= maxFixedEffects;
|
return pplayer.getFixedEffectIds().size() >= maxFixedEffects;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -471,4 +471,4 @@ public class DataManager { // @formatter:off
|
||||||
public void execute(T obj);
|
public void execute(T obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // @formatter:on
|
}
|
||||||
|
|
|
@ -166,7 +166,7 @@ public class LangManager {
|
||||||
* @return The message
|
* @return The message
|
||||||
*/
|
*/
|
||||||
public String get(String... replacements) {
|
public String get(String... replacements) {
|
||||||
return String.format(this.message, (Object[])replacements);
|
return String.format(this.message, (Object[]) replacements);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -54,7 +54,8 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
||||||
*/
|
*/
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||||
DataManager.getPPlayer(e.getPlayer().getUniqueId(), (pplayer) -> {}); // Loads the PPlayer from the database
|
DataManager.getPPlayer(e.getPlayer().getUniqueId(), (pplayer) -> {
|
||||||
|
}); // Loads the PPlayer from the database
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -65,8 +66,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerQuit(PlayerQuitEvent e) {
|
public void onPlayerQuit(PlayerQuitEvent e) {
|
||||||
PPlayer pplayer = DataManager.getPPlayer(e.getPlayer().getUniqueId());
|
PPlayer pplayer = DataManager.getPPlayer(e.getPlayer().getUniqueId());
|
||||||
if (pplayer != null)
|
if (pplayer != null) particlePlayers.remove(pplayer);
|
||||||
particlePlayers.remove(pplayer);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,8 @@ 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())
|
||||||
DataManager.getPPlayer(player.getUniqueId(), (pplayer) -> {}); // Loads the PPlayer from the database
|
DataManager.getPPlayer(player.getUniqueId(), (pplayer) -> {
|
||||||
|
}); // Loads the PPlayer from the database
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,8 +149,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
||||||
// Loop for FixedParticleEffects
|
// Loop for FixedParticleEffects
|
||||||
// Don't spawn particles if the world doesn't allow it
|
// Don't spawn particles if the world doesn't allow it
|
||||||
for (FixedParticleEffect effect : pplayer.getFixedParticles())
|
for (FixedParticleEffect effect : pplayer.getFixedParticles())
|
||||||
if (!DataManager.isWorldDisabled(effect.getLocation().getWorld().getName()))
|
if (!DataManager.isWorldDisabled(effect.getLocation().getWorld().getName())) displayFixedParticleEffect(effect);
|
||||||
displayFixedParticleEffect(effect);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,7 @@ public class PPlayer {
|
||||||
*/
|
*/
|
||||||
public ParticleGroup getParticlesByName(String name) {
|
public ParticleGroup getParticlesByName(String name) {
|
||||||
for (ParticleGroup group : this.particleGroups)
|
for (ParticleGroup group : this.particleGroups)
|
||||||
if (group.getName().equalsIgnoreCase(name))
|
if (group.getName().equalsIgnoreCase(name)) return group;
|
||||||
return group;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,8 +94,7 @@ public class PPlayer {
|
||||||
*/
|
*/
|
||||||
public List<ParticlePair> getActiveParticles() {
|
public List<ParticlePair> getActiveParticles() {
|
||||||
for (ParticleGroup group : this.particleGroups)
|
for (ParticleGroup group : this.particleGroups)
|
||||||
if (group.getName() == null)
|
if (group.getName() == null) return group.getParticles();
|
||||||
return group.getParticles();
|
|
||||||
return null; // This should never return null, there will always be at least one ParticleGroup
|
return null; // This should never return null, there will always be at least one ParticleGroup
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,8 +107,7 @@ public class PPlayer {
|
||||||
public List<ParticlePair> getActiveParticlesForStyle(ParticleStyle style) {
|
public List<ParticlePair> getActiveParticlesForStyle(ParticleStyle style) {
|
||||||
List<ParticlePair> matches = new ArrayList<ParticlePair>();
|
List<ParticlePair> matches = new ArrayList<ParticlePair>();
|
||||||
for (ParticlePair pair : this.getActiveParticles())
|
for (ParticlePair pair : this.getActiveParticles())
|
||||||
if (pair.getStyle().equals(style))
|
if (pair.getStyle().equals(style)) matches.add(pair);
|
||||||
matches.add(pair);
|
|
||||||
return matches;
|
return matches;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,8 +119,7 @@ public class PPlayer {
|
||||||
*/
|
*/
|
||||||
public ParticlePair getActiveParticle(int id) {
|
public ParticlePair getActiveParticle(int id) {
|
||||||
for (ParticlePair particle : this.getActiveParticles())
|
for (ParticlePair particle : this.getActiveParticles())
|
||||||
if (particle.getId() == id)
|
if (particle.getId() == id) return particle;
|
||||||
return particle;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,8 +140,7 @@ public class PPlayer {
|
||||||
*/
|
*/
|
||||||
public FixedParticleEffect getFixedEffectById(int id) {
|
public FixedParticleEffect getFixedEffectById(int id) {
|
||||||
for (FixedParticleEffect fixedEffect : this.fixedParticles)
|
for (FixedParticleEffect fixedEffect : this.fixedParticles)
|
||||||
if (fixedEffect.getId() == id)
|
if (fixedEffect.getId() == id) return fixedEffect;
|
||||||
return fixedEffect;
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,8 +172,7 @@ public class PPlayer {
|
||||||
*/
|
*/
|
||||||
public void removeFixedEffect(int id) {
|
public void removeFixedEffect(int id) {
|
||||||
for (int i = this.fixedParticles.size() - 1; i >= 0; i--)
|
for (int i = this.fixedParticles.size() - 1; i >= 0; i--)
|
||||||
if (this.fixedParticles.get(i).getId() == id)
|
if (this.fixedParticles.get(i).getId() == id) this.fixedParticles.remove(i);
|
||||||
this.fixedParticles.remove(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -47,7 +47,7 @@ public enum ParticleEffect {
|
||||||
DRIPPING_LAVA("DRIP_LAVA", "DRIP_LAVA"),
|
DRIPPING_LAVA("DRIP_LAVA", "DRIP_LAVA"),
|
||||||
DRIPPING_WATER("DRIP_WATER", "DRIP_WATER"),
|
DRIPPING_WATER("DRIP_WATER", "DRIP_WATER"),
|
||||||
DUST("REDSTONE", "REDSTONE", ParticleProperty.COLORABLE),
|
DUST("REDSTONE", "REDSTONE", ParticleProperty.COLORABLE),
|
||||||
//ELDER_GUARDIAN("MOB_APPEARANCE", "MOB_APPEARANCE"), // No thank you
|
// ELDER_GUARDIAN("MOB_APPEARANCE", "MOB_APPEARANCE"), // No thank you
|
||||||
ENCHANT("ENCHANTMENT_TABLE", "ENCHANTMENT_TABLE"),
|
ENCHANT("ENCHANTMENT_TABLE", "ENCHANTMENT_TABLE"),
|
||||||
ENCHANTED_HIT("CRIT_MAGIC", "CRIT_MAGIC"),
|
ENCHANTED_HIT("CRIT_MAGIC", "CRIT_MAGIC"),
|
||||||
END_ROD("END_ROD", "END_ROD"),
|
END_ROD("END_ROD", "END_ROD"),
|
||||||
|
@ -231,11 +231,13 @@ public enum ParticleEffect {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this == DUST && VERSION_13) { // DUST uses a special data object for spawning in 1.13
|
if (this == DUST && VERSION_13) { // DUST uses a special data object for spawning in 1.13
|
||||||
OrdinaryColor dustColor = (OrdinaryColor)color;
|
OrdinaryColor dustColor = (OrdinaryColor) color;
|
||||||
Object dustData = null;
|
Object dustData = null;
|
||||||
try { // The DustData class doesn't exist in Minecraft versions less than 1.13... so this is disgusting... but it works great
|
try { // The DustData class doesn't exist in Minecraft versions less than 1.13... so this is disgusting... but it works great
|
||||||
dustData = DustOptions_CONSTRUCTOR.newInstance(Color.fromRGB(dustColor.getRed(), dustColor.getGreen(), dustColor.getBlue()), 1); // Wait, you can change the size of these now??? AWESOME! I might implement this in the future!
|
dustData = DustOptions_CONSTRUCTOR.newInstance(Color.fromRGB(dustColor.getRed(), dustColor.getGreen(), dustColor.getBlue()), 1); // Wait, you can change the size of these now??? AWESOME! I might implement this in the future!
|
||||||
} catch (Exception e) { }
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
for (Player player : getPlayersInRange(center)) {
|
for (Player player : getPlayersInRange(center)) {
|
||||||
player.spawnParticle(internalEnum, center.getX(), center.getY(), center.getZ(), 1, 0, 0, 0, 0, dustData);
|
player.spawnParticle(internalEnum, center.getX(), center.getY(), center.getZ(), 1, 0, 0, 0, 0, dustData);
|
||||||
|
@ -271,7 +273,9 @@ public enum ParticleEffect {
|
||||||
if (internalEnum.getDataType().getTypeName().equals("org.bukkit.block.data.BlockData")) {
|
if (internalEnum.getDataType().getTypeName().equals("org.bukkit.block.data.BlockData")) {
|
||||||
try { // The Material.createBlockData() method doesn't exist in Minecraft versions less than 1.13... so this is disgusting... but it works great
|
try { // The Material.createBlockData() method doesn't exist in Minecraft versions less than 1.13... so this is disgusting... but it works great
|
||||||
extraData = createBlockData_METHOD.invoke(spawnMaterial);
|
extraData = createBlockData_METHOD.invoke(spawnMaterial);
|
||||||
} catch (Exception e) { }
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
} else if (internalEnum.getDataType() == ItemStack.class) {
|
} else if (internalEnum.getDataType() == ItemStack.class) {
|
||||||
extraData = new ItemStack(spawnMaterial);
|
extraData = new ItemStack(spawnMaterial);
|
||||||
} else if (internalEnum.getDataType() == MaterialData.class) {
|
} else if (internalEnum.getDataType() == MaterialData.class) {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import com.esophose.playerparticles.styles.api.ParticleStyle;
|
||||||
|
|
||||||
public class ParticleStyleSpiral implements ParticleStyle {
|
public class ParticleStyleSpiral implements ParticleStyle {
|
||||||
|
|
||||||
private float stepX = 0;
|
private int stepX = 0;
|
||||||
|
|
||||||
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
public List<PParticle> getParticles(ParticlePair particle, Location location) {
|
||||||
List<PParticle> particles = new ArrayList<PParticle>();
|
List<PParticle> particles = new ArrayList<PParticle>();
|
||||||
|
|
|
@ -46,11 +46,9 @@ public class ParticleUtils {
|
||||||
Material mat = null;
|
Material mat = null;
|
||||||
for (String name : input) {
|
for (String name : input) {
|
||||||
mat = closestMatch(name);
|
mat = closestMatch(name);
|
||||||
if (mat != null)
|
if (mat != null) return mat;
|
||||||
return mat;
|
|
||||||
}
|
}
|
||||||
if (mat == null)
|
if (mat == null) mat = Material.BARRIER;
|
||||||
mat = Material.BARRIER;
|
|
||||||
return mat;
|
return mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +84,8 @@ public class ParticleUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int i = 0; i < n.length; ++i)
|
for (int i = 0; i < n.length; ++i)
|
||||||
if (n[i] != i + 1) return i + 1;
|
if (n[i] != i + 1)
|
||||||
|
return i + 1;
|
||||||
return n.length + 1;
|
return n.length + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue