v6.0 Update Finished

This commit is contained in:
Esophose 2018-12-01 19:34:01 -07:00
parent 03f4b06a05
commit c493011ad6
39 changed files with 192 additions and 139 deletions

View file

@ -3,6 +3,7 @@
=== v6.0 ===
* Many other changes, the changelog will be updated once the plugin update is about to be released
+ Added setting in config.yml to control how fast the rainbow hue cycles
- Removed style 'blockedit', apply 'blockplace' and 'blockbreak' at the same time to recreate it
=== v5.2 ===
* Added native support for Minecraft 1.13.x
* Still compatible with Minecraft 1.9 through Minecraft 1.12!

10
pom.xml
View file

@ -54,7 +54,7 @@
</excludes>
</filter>
</filters>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.13\plugins\update\PlayerParticles v6.0.jar</outputFile>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.13\plugins\update\PlayerParticles v${project.version}.jar</outputFile>
</configuration>
</execution>
<execution>
@ -81,7 +81,7 @@
</excludes>
</filter>
</filters>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.12\plugins\update\PlayerParticles v6.0.jar</outputFile>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.12\plugins\update\PlayerParticles v${project.version}.jar</outputFile>
</configuration>
</execution>
<execution>
@ -108,7 +108,7 @@
</excludes>
</filter>
</filters>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.11\plugins\update\PlayerParticles v6.0.jar</outputFile>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.11\plugins\update\PlayerParticles v${project.version}.jar</outputFile>
</configuration>
</execution>
<execution>
@ -135,7 +135,7 @@
</excludes>
</filter>
</filters>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.10\plugins\update\PlayerParticles v6.0.jar</outputFile>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.10\plugins\update\PlayerParticles v${project.version}.jar</outputFile>
</configuration>
</execution>
<execution>
@ -162,7 +162,7 @@
</excludes>
</filter>
</filters>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.9\plugins\update\PlayerParticles v6.0.jar</outputFile>
<outputFile>C:\Users\Esophose\Desktop\Spigot Dev Servers\1.9\plugins\update\PlayerParticles v${project.version}.jar</outputFile>
</configuration>
</execution>
</executions>

View file

@ -1,13 +1,9 @@
/*
* TODO: v6.0
* TODO: v6.1
* * Write a class called ConfigManager which manages updating the config.yml between versions so it doesn't have to be deleted every time
* + Add new style 'tornado'
* + Add new style 'doubleorbit'
* + Add new style 'wings_<type>', multiple new wing types: fairy, demon
* * Adjust style positioning around central point based on if they are being spawned for a player or fixed effect
* * Display a note in the GUI under event-based styles
*
* TODO: v6.1
* * Write a class called ConfigManager which manages updating the config.yml between versions so it doesn't have to be deleted every time
*/
package com.esophose.playerparticles;

View file

@ -378,6 +378,9 @@ public class FixedCommandModule implements CommandModule {
} else if (!PermissionManager.hasStylePermission(pplayer.getPlayer(), style)) {
LangManager.sendMessage(pplayer, Lang.FIXED_EDIT_STYLE_NO_PERMISSION, style.getName());
return;
} else if (!style.canBeFixed()) {
LangManager.sendMessage(p, Lang.FIXED_EDIT_STYLE_NON_FIXABLE, style.getName());
return;
}
fixedEffect.getParticlePair().setStyle(style);

View file

@ -14,6 +14,7 @@ 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.particles.PPlayer;
public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
@ -129,14 +130,17 @@ public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
if (!(sender instanceof Player)) return new ArrayList<String>();
if (cmd.getName().equalsIgnoreCase("pp")) {
PPlayer pplayer = DataManager.getPPlayer(((Player) sender).getUniqueId());
if (pplayer == null) return new ArrayList<String>();
if (args.length <= 1) {
CommandModule commandModule = findMatchingCommand(""); // Get the default command module
return commandModule.onTabComplete(DataManager.getPPlayer(((Player) sender).getUniqueId()), args);
return commandModule.onTabComplete(pplayer, args);
} else if (args.length >= 2) {
CommandModule commandModule = findMatchingCommand(args[0]);
String[] cmdArgs = Arrays.copyOfRange(args, 1, args.length);
if (commandModule != null) {
return commandModule.onTabComplete(DataManager.getPPlayer(((Player) sender).getUniqueId()), cmdArgs);
return commandModule.onTabComplete(pplayer, cmdArgs);
}
}
}

View file

@ -209,8 +209,8 @@ public class DataManager {
/**
* Updates the particles_hidden setting in the database and for the PPlayer
*
* @param playerUUID
* @param particlesHidden
* @param playerUUID The player to hide PlayerParticles from
* @param particlesHidden True if the particles should be hidden, otherwise False
*/
public static void updateSettingParticlesHidden(UUID playerUUID, boolean particlesHidden) {
async(() -> {

View file

@ -437,7 +437,6 @@ public class LangManager {
*
* @param player The player to send the message to
* @param message The message to send to the player
* @param includePrefix If the prefix should be included
*/
public static void sendCustomMessage(Player player, String message) {
if (!PSetting.MESSAGES_ENABLED.getBoolean()) return;
@ -465,7 +464,7 @@ public class LangManager {
/**
* Sends a message to a Player without the prefix
*
* @param player The plaeyr to send the message to
* @param player The player to send the message to
* @param messageType The message type to send the player
* @param replacements The replacements for the message
*/
@ -484,7 +483,7 @@ public class LangManager {
/**
* Sends a message to a PPlayer without the prefix
*
* @param player The plaeyr to send the message to
* @param pplayer The player to send the message to
* @param messageType The message type to send the player
* @param replacements The replacements for the message
*/

View file

@ -155,7 +155,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
*/
private void displayFixedParticleEffect(FixedParticleEffect fixedEffect) {
ParticlePair particle = fixedEffect.getParticlePair();
for (PParticle pparticle : particle.getStyle().getParticles(particle, fixedEffect.getLocation()))
for (PParticle pparticle : particle.getStyle().getParticles(particle, fixedEffect.getLocation().clone().add(0, particle.getStyle().getFixedEffectOffset(), 0)))
ParticleEffect.display(particle, pparticle, true);
}

View file

@ -18,7 +18,6 @@ public class DefaultStyles {
public static final ParticleStyle BATMAN = new ParticleStyleBatman();
public static final ParticleStyle BEAM = new ParticleStyleBeam();
public static final ParticleStyle BLOCKBREAK = new ParticleStyleBlockBreak();
public static final ParticleStyle BLOCKEDIT = new ParticleStyleBlockEdit();
public static final ParticleStyle BLOCKPLACE = new ParticleStyleBlockPlace();
public static final ParticleStyle CELEBRATION = new ParticleStyleCelebration();
public static final ParticleStyle CHAINS = new ParticleStyleChains();
@ -52,7 +51,6 @@ public class DefaultStyles {
ParticleStyleManager.registerStyle(BATMAN);
ParticleStyleManager.registerStyle(BEAM);
ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK);
ParticleStyleManager.registerCustomHandledStyle(BLOCKEDIT);
ParticleStyleManager.registerCustomHandledStyle(BLOCKPLACE);
ParticleStyleManager.registerStyle(CELEBRATION);
ParticleStyleManager.registerStyle(CHAINS);
@ -83,7 +81,6 @@ public class DefaultStyles {
manager.registerEvents((Listener) ARROWS, playerParticles);
manager.registerEvents((Listener) BLOCKBREAK, playerParticles);
manager.registerEvents((Listener) BLOCKPLACE, playerParticles);
manager.registerEvents((Listener) BLOCKEDIT, playerParticles);
manager.registerEvents((Listener) HURT, playerParticles);
manager.registerEvents((Listener) MOVE, playerParticles);
manager.registerEvents((Listener) SWORDS, playerParticles);

View file

@ -60,6 +60,10 @@ public class ParticleStyleArrows implements ParticleStyle, Listener {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
/**
* The event used to get all arrows fired by players
* Adds all arrows fired from players to the array

View file

@ -125,4 +125,8 @@ public class ParticleStyleBatman implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return -1;
}
}

View file

@ -63,4 +63,8 @@ public class ParticleStyleBeam implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0.5;
}
}

View file

@ -46,6 +46,10 @@ public class ParticleStyleBlockBreak implements ParticleStyle, Listener {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();

View file

@ -1,67 +0,0 @@
package com.esophose.playerparticles.styles;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import com.esophose.playerparticles.manager.DataManager;
import com.esophose.playerparticles.manager.ParticleManager;
import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticlePair;
import com.esophose.playerparticles.styles.api.PParticle;
import com.esophose.playerparticles.styles.api.ParticleStyle;
public class ParticleStyleBlockEdit implements ParticleStyle, Listener {
public List<PParticle> getParticles(ParticlePair particle, Location location) {
return new ArrayList<PParticle>(); // Particles are taken from DefaultStyles.BLOCKPLACE or DefaultStyles.BLOCKBREAK
}
public void updateTimers() {
}
public String getName() {
return "blockedit";
}
public boolean canBeFixed() {
return false;
}
public boolean canToggleWithMovement() {
return false;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockBreak(BlockBreakEvent event) {
Player player = event.getPlayer();
PPlayer pplayer = DataManager.getPPlayer(player.getUniqueId());
if (pplayer != null) {
for (ParticlePair particle : pplayer.getActiveParticlesForStyle(DefaultStyles.BLOCKEDIT)) {
Location loc = event.getBlock().getLocation();
ParticleManager.displayParticles(particle, DefaultStyles.BLOCKBREAK.getParticles(particle, loc));
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();
PPlayer pplayer = DataManager.getPPlayer(player.getUniqueId());
if (pplayer != null) {
for (ParticlePair particle : pplayer.getActiveParticlesForStyle(DefaultStyles.BLOCKEDIT)) {
Location loc = event.getBlock().getLocation().clone();
ParticleManager.displayParticles(particle, DefaultStyles.BLOCKPLACE.getParticles(particle, loc));
}
}
}
}

View file

@ -46,6 +46,10 @@ public class ParticleStyleBlockPlace implements ParticleStyle, Listener {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onBlockPlace(BlockPlaceEvent event) {
Player player = event.getPlayer();

View file

@ -11,6 +11,7 @@ import org.bukkit.scheduler.BukkitRunnable;
import com.esophose.playerparticles.PlayerParticles;
import com.esophose.playerparticles.manager.ParticleManager;
import com.esophose.playerparticles.particles.FixedParticleEffect;
import com.esophose.playerparticles.particles.PPlayer;
import com.esophose.playerparticles.particles.ParticleEffect;
import com.esophose.playerparticles.particles.ParticlePair;
@ -35,18 +36,27 @@ public class ParticleStyleCelebration implements ParticleStyle {
if (step == spawnTime) {
step = 0;
final Random random = new Random();
Random random = new Random();
for (PPlayer pplayer : ParticleManager.getPPlayers()) {
final Player player = pplayer.getPlayer();
Player player = pplayer.getPlayer();
for (ParticlePair particle : pplayer.getActiveParticles()) {
if (particle.getStyle() != this) continue;
for (ParticlePair particle : pplayer.getActiveParticles())
if (particle.getStyle() == this)
spawnFirework(player.getLocation(), pplayer, particle, random);
for (FixedParticleEffect fixedEffect : pplayer.getFixedParticles())
if (fixedEffect.getParticlePair().getStyle() == this)
spawnFirework(fixedEffect.getLocation(), pplayer, fixedEffect.getParticlePair(), random);
}
}
}
private void spawnFirework(final Location location, final PPlayer pplayer, final ParticlePair particle, final Random random) {
double angle = random.nextDouble() * Math.PI * 2;
double distanceFrom = 1.25 + random.nextDouble() * 1.5;
double dx = Math.sin(angle) * distanceFrom;
double dz = Math.cos(angle) * distanceFrom;
final Location loc = player.getLocation().clone().add(dx, 1, dz);
final Location loc = location.clone().add(dx, 1, dz);
final int fuse = 3 + random.nextInt(3);
new BukkitRunnable() {
@ -85,9 +95,6 @@ public class ParticleStyleCelebration implements ParticleStyle {
}
}.runTaskTimer(PlayerParticles.getPlugin(), 0, 1);
}
}
}
}
public String getName() {
return "celebration";
@ -101,4 +108,8 @@ public class ParticleStyleCelebration implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -40,4 +40,8 @@ public class ParticleStyleChains implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -78,4 +78,8 @@ public class ParticleStyleCompanion implements ParticleStyle {
return false;
}
public double getFixedEffectOffset() {
return 1;
}
}

View file

@ -103,4 +103,8 @@ public class ParticleStyleCube implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -33,4 +33,8 @@ public class ParticleStyleFeet implements ParticleStyle {
return false;
}
public double getFixedEffectOffset() {
return 0.5;
}
}

View file

@ -61,4 +61,8 @@ public class ParticleStyleHalo implements ParticleStyle {
return false;
}
public double getFixedEffectOffset() {
return -0.5;
}
}

View file

@ -47,6 +47,10 @@ public class ParticleStyleHurt implements ParticleStyle, Listener {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player) {

View file

@ -103,4 +103,8 @@ public class ParticleStyleInvocation implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0.5;
}
}

View file

@ -37,6 +37,10 @@ public class ParticleStyleMove implements ParticleStyle, Listener {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerMove(PlayerMoveEvent e) {
PPlayer pplayer = DataManager.getPPlayer(e.getPlayer().getUniqueId());

View file

@ -143,4 +143,8 @@ public class ParticleStyleNormal implements ParticleStyle {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -57,4 +57,8 @@ public class ParticleStyleOrbit implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -34,4 +34,8 @@ public class ParticleStyleOverhead implements ParticleStyle {
return false;
}
public double getFixedEffectOffset() {
return -0.5;
}
}

View file

@ -31,4 +31,8 @@ public class ParticleStylePoint implements ParticleStyle {
return false;
}
public double getFixedEffectOffset() {
return -0.5;
}
}

View file

@ -69,4 +69,8 @@ public class ParticleStyleQuadhelix implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -63,4 +63,8 @@ public class ParticleStyleRings implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -46,4 +46,8 @@ public class ParticleStyleSphere implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -51,4 +51,8 @@ public class ParticleStyleSpin implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return -0.5;
}
}

View file

@ -40,4 +40,8 @@ public class ParticleStyleSpiral implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -56,6 +56,10 @@ public class ParticleStyleSwords implements ParticleStyle, Listener {
return false;
}
public double getFixedEffectOffset() {
return 0;
}
@EventHandler(priority = EventPriority.MONITOR)
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
if (event.getDamager() instanceof Player && event.getEntity() instanceof LivingEntity) {

View file

@ -39,4 +39,8 @@ public class ParticleStyleThick implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -71,4 +71,8 @@ public class ParticleStyleVortex implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0.5;
}
}

View file

@ -45,4 +45,8 @@ public class ParticleStyleWings implements ParticleStyle {
return true;
}
public double getFixedEffectOffset() {
return 0;
}
}

View file

@ -43,6 +43,13 @@ public interface ParticleStyle {
*/
public boolean canToggleWithMovement();
/**
* The Y-axis offset to be applied when using '/pp fixed create looking'
*
* @return How far to move the style up or down to get it centered on the block properly
*/
public double getFixedEffectOffset();
/**
* Gets the ParticleStyle with the name given, returns null if not found
*

View file

@ -300,8 +300,6 @@ gui-icon:
- POWERED_RAIL
blockbreak:
- IRON_PICKAXE
blockedit:
- DISPENSER
blockplace:
- OAK_PLANKS
- WOOD