Update copyright

Update the copyright notice on some classes and fix a few bugs
This commit is contained in:
Esophose 2017-03-06 17:27:20 -07:00
parent c1616638a9
commit 97799955de
18 changed files with 68 additions and 54 deletions

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -251,7 +251,7 @@ public class FixedParticleEffect {
* @return The effect's location
*/
public Location getLocation() {
return this.location;
return this.location.clone();
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -90,6 +90,7 @@ public class PPlayer {
* @return The player's particle style
*/
public ParticleStyle getParticleStyle() {
if (this.particleStyle == null) return DefaultStyles.NONE;
return this.particleStyle;
}

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -36,7 +36,7 @@ import com.esophose.playerparticles.manager.PermissionManager;
import com.esophose.playerparticles.styles.DefaultStyles;
import com.esophose.playerparticles.styles.api.ParticleStyle;
import com.esophose.playerparticles.styles.api.ParticleStyleManager;
import com.esophose.playerparticles.util.ParticlesUtils;
import com.esophose.playerparticles.util.ParticleUtils;
public class ParticleCommandExecutor implements CommandExecutor {
@ -244,7 +244,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
int data = -1;
try {
material = ParticlesUtils.closestMatch(args[0]);
material = ParticleUtils.closestMatch(args[0]);
if (material == null) material = Material.matchMaterial(args[0]);
if (material == null) throw new Exception();
} catch (Exception e) {
@ -280,7 +280,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
int data = -1;
try {
material = ParticlesUtils.closestMatch(args[0]);
material = ParticleUtils.closestMatch(args[0]);
if (material == null) material = Material.matchMaterial(args[0]);
if (material == null) throw new Exception();
} catch (Exception e) {
@ -586,7 +586,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
g = Integer.parseInt(args[6]);
b = Integer.parseInt(args[7]);
} catch (Exception e) {
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "colr");
MessageManager.sendMessage(p, MessageType.CREATE_FIXED_DATA_ERROR, "color");
return;
}
@ -604,7 +604,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
int data = -1;
try {
material = ParticlesUtils.closestMatch(args[5]);
material = ParticleUtils.closestMatch(args[5]);
if (material == null) material = Material.matchMaterial(args[5]);
if (material == null) throw new Exception();
} catch (Exception e) {
@ -630,7 +630,7 @@ public class ParticleCommandExecutor implements CommandExecutor {
int data = -1;
try {
material = ParticlesUtils.closestMatch(args[5]);
material = ParticleUtils.closestMatch(args[5]);
if (material == null) material = Material.matchMaterial(args[5]);
if (material == null) throw new Exception();
} catch (Exception e) {

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -13,16 +13,13 @@
* Fix arrow style particles staying after an arrow is considered dead (in rare cases this occurred)
* Fix SQL queries getting logged to console when database-enable is set to true
* Fix tab completion, it stopped working at one point and I didn't notice until now
* Fix style 'arrows' not working with tipped/spectral arrows
* Added fixed particle effects, see how to use them on the main plugin page
* Requires permission playerparticles.fixed or playerparticles.*
* Infinite fixed effects with permission playerparticles.fixed.unlimited (playerparticles.* does not grant this permission)
* Added new style 'thick'
TODO:
+ Add command /pp fixed -
/pp fixed create <x> <y> <z> <effect> <style> [data] - Creates a fixed effect and assigns it an id
/pp fixed remove <id> - Removes a fixed effect by its id
/pp fixed list - Lists the location, and id of all fixed effects
/pp fixed info <id> - Lists all information about the fixed effect with the matching id
Requires permission playerparticles.fixed
Maximum number of fixed effects defined in config.yml, default value 5
+ Add player variable in commands
Requires permission playerparticles.altexecute
+ Add new style 'tornado'

View file

@ -1,3 +1,11 @@
/**
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
* be distributed to any person by any means.
*/
package com.esophose.playerparticles.gui;
public class GUIHandler {

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -13,6 +13,7 @@ import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
@ -33,7 +34,7 @@ import com.esophose.playerparticles.library.ParticleEffect.NoteColor;
import com.esophose.playerparticles.library.ParticleEffect.OrdinaryColor;
import com.esophose.playerparticles.styles.api.ParticleStyle;
import com.esophose.playerparticles.styles.api.ParticleStyleManager;
import com.esophose.playerparticles.util.ParticlesUtils;
import com.esophose.playerparticles.util.ParticleUtils;
public class ConfigManager {
@ -530,7 +531,7 @@ public class ConfigManager {
"DELETE FROM pp_data_item WHERE uuid = '" + uuid + "';" +
"DELETE FROM pp_data_block WHERE uuid = '" + uuid + "';" +
"DELETE FROM pp_data_color WHERE uuid = '" + uuid + "';" +
"DELETE FROM pp_data_note WHERE uuid '" + uuid + "';"
"DELETE FROM pp_data_note WHERE uuid = '" + uuid + "';"
);
} // @formatter:on
} catch (ClassNotFoundException | SQLException e) {
@ -742,6 +743,8 @@ public class ConfigManager {
maxFixedEffects = PlayerParticles.getPlugin().getConfig().getInt("max-fixed-effects");
}
if (Bukkit.getPlayer(pplayerUUID).hasPermission("playerparticles.fixed.unlimited")) return false;
if (!PlayerParticles.useMySQL) {
if (config.isConfigurationSection(pplayerUUID.toString() + ".fixedEffect")) {
return config.getConfigurationSection(pplayerUUID.toString() + ".fixedEffect").getKeys(false).size() >= maxFixedEffects;
@ -762,33 +765,32 @@ public class ConfigManager {
/**
* Gets the next Id for a player's fixed effects
*
* @param playerUUID The player to get the Id for
* @param pplayerUUID The player to get the Id for
* @return The smallest available Id the player can use
*/
public int getNextFixedEffectId(UUID playerUUID) {
public int getNextFixedEffectId(UUID pplayerUUID) {
Set<String> idsSet = new HashSet<String>();
if (!PlayerParticles.useMySQL) {
if (!config.isConfigurationSection(playerUUID.toString() + ".fixedEffect")) return 0;
Set<String> keys = config.getConfigurationSection(playerUUID.toString() + ".fixedEffect").getKeys(false);
int[] ids = new int[keys.size()];
int i = 0;
for (String key : keys)
ids[i++] = Integer.parseInt(key);
return ParticlesUtils.getSmallestPositiveInt(ids);
} else { // @formatter:off
try (ResultSet res = PlayerParticles.mySQL.querySQL("SELECT MIN(t1.id + 1) AS nextId FROM pp_fixed t1 " +
"LEFT JOIN pp_fixed t2 ON t1.id + 1 = t2.id " +
"WHERE t2.id IS NULL AND t1.player_uuid = '" + playerUUID.toString() + "'")) {
if (res.next()) { // @formatter:on
return res.getInt(1);
if (!config.isConfigurationSection(pplayerUUID.toString() + ".fixedEffect")) return 1;
idsSet = config.getConfigurationSection(pplayerUUID.toString() + ".fixedEffect").getKeys(false);
} else {
try (ResultSet res = PlayerParticles.mySQL.querySQL("SELECT id FROM pp_fixed WHERE player_uuid = '" + pplayerUUID.toString() + "'")) {
while (res.next()) {
idsSet.add(res.getInt(1) + "");
}
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
}
}
return -1;
if (idsSet.isEmpty()) return 1;
int[] ids = new int[idsSet.size()];
int i = 0;
for (String key : idsSet)
ids[i++] = Integer.parseInt(key);
return ParticleUtils.getSmallestPositiveInt(ids);
}
/**
* Gets the max distance a fixed effect can be created from the player
*

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -57,7 +57,7 @@ public class ParticleStyleArrows implements ParticleStyle, Listener {
*/
@EventHandler
public void onArrowFired(EntityShootBowEvent e) {
if (e.getEntityType() == EntityType.PLAYER && e.getProjectile().getType() == EntityType.ARROW) {
if (e.getEntityType() == EntityType.PLAYER && (e.getProjectile().getType() == EntityType.ARROW) || e.getProjectile().getType() == EntityType.SPECTRAL_ARROW || e.getProjectile().getType() == EntityType.TIPPED_ARROW) {
arrows.add((Arrow) e.getProjectile());
}
}

View file

@ -9,6 +9,7 @@ import com.esophose.playerparticles.styles.api.ParticleStyle;
public class ParticleStyleBeam implements ParticleStyle {
private float step = 0;
private boolean reversed = false;
public PParticle[] getParticles(PPlayer pplayer, Location location) {
int points = 16;
@ -26,9 +27,13 @@ public class ParticleStyleBeam implements ParticleStyle {
}
public void updateTimers() {
step++;
if (step > 30) {
step = 0;
if (!reversed) step++;
else step--;
if (step >= 30) {
reversed = true;
} else if (step <= 0) {
reversed = false;
}
}

View file

@ -13,12 +13,13 @@ public class ParticleStylePoint implements ParticleStyle {
}
public void updateTimers() {
}
public String getName() {
return "point";
}
public boolean canBeFixed() {
return true;
}

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -28,7 +28,7 @@ public class PluginUpdateListener implements Listener {
if (e.getPlayer().isOp()) {
if (PlayerParticles.updateVersion != null) {
MessageManager.sendCustomMessage(e.getPlayer(), ChatColor.YELLOW + "An update (" + ChatColor.AQUA + "v" + PlayerParticles.updateVersion + ChatColor.YELLOW + ") is available! You are running " + ChatColor.AQUA + "v" + PlayerParticles.getPlugin().getDescription().getVersion());
MessageManager.sendCustomMessage(e.getPlayer(), ChatColor.YELLOW + "Download from: http://dev.bukkit.org/bukkit-plugins/playerparticles/");
MessageManager.sendCustomMessage(e.getPlayer(), ChatColor.YELLOW + "Download from: https://dev.bukkit.org/projects/playerparticles");
}
}
}

View file

@ -1,5 +1,5 @@
/**
* Copyright Esophose 2016
* Copyright Esophose 2017
* While using any of the code provided by this plugin
* you must not claim it as your own. This plugin may
* be modified and installed on a server, but may not
@ -12,7 +12,7 @@ import java.util.ArrayList;
import org.bukkit.Material;
public class ParticlesUtils {
public class ParticleUtils {
/**
* Finds a block/item as a material from a string