mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-07-13 17:24:22 +00:00
v6.0 Update Finished
This commit is contained in:
parent
03f4b06a05
commit
c493011ad6
39 changed files with 192 additions and 139 deletions
|
@ -3,6 +3,7 @@
|
||||||
=== v6.0 ===
|
=== v6.0 ===
|
||||||
* Many other changes, the changelog will be updated once the plugin update is about to be released
|
* 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
|
+ 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 ===
|
=== v5.2 ===
|
||||||
* Added native support for Minecraft 1.13.x
|
* Added native support for Minecraft 1.13.x
|
||||||
* Still compatible with Minecraft 1.9 through Minecraft 1.12!
|
* Still compatible with Minecraft 1.9 through Minecraft 1.12!
|
||||||
|
|
10
pom.xml
10
pom.xml
|
@ -54,7 +54,7 @@
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
</filters>
|
</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>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
</filters>
|
</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>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -108,7 +108,7 @@
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
</filters>
|
</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>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -135,7 +135,7 @@
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
</filters>
|
</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>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
<execution>
|
<execution>
|
||||||
|
@ -162,7 +162,7 @@
|
||||||
</excludes>
|
</excludes>
|
||||||
</filter>
|
</filter>
|
||||||
</filters>
|
</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>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
|
|
|
@ -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 'tornado'
|
||||||
* + Add new style 'doubleorbit'
|
* + Add new style 'doubleorbit'
|
||||||
* + Add new style 'wings_<type>', multiple new wing types: fairy, demon
|
* + 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;
|
package com.esophose.playerparticles;
|
||||||
|
|
|
@ -378,6 +378,9 @@ public class FixedCommandModule implements CommandModule {
|
||||||
} else if (!PermissionManager.hasStylePermission(pplayer.getPlayer(), style)) {
|
} else if (!PermissionManager.hasStylePermission(pplayer.getPlayer(), style)) {
|
||||||
LangManager.sendMessage(pplayer, Lang.FIXED_EDIT_STYLE_NO_PERMISSION, style.getName());
|
LangManager.sendMessage(pplayer, Lang.FIXED_EDIT_STYLE_NO_PERMISSION, style.getName());
|
||||||
return;
|
return;
|
||||||
|
} else if (!style.canBeFixed()) {
|
||||||
|
LangManager.sendMessage(p, Lang.FIXED_EDIT_STYLE_NON_FIXABLE, style.getName());
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
fixedEffect.getParticlePair().setStyle(style);
|
fixedEffect.getParticlePair().setStyle(style);
|
||||||
|
|
|
@ -14,6 +14,7 @@ import com.esophose.playerparticles.manager.DataManager;
|
||||||
import com.esophose.playerparticles.manager.LangManager;
|
import com.esophose.playerparticles.manager.LangManager;
|
||||||
import com.esophose.playerparticles.manager.LangManager.Lang;
|
import com.esophose.playerparticles.manager.LangManager.Lang;
|
||||||
import com.esophose.playerparticles.manager.PermissionManager;
|
import com.esophose.playerparticles.manager.PermissionManager;
|
||||||
|
import com.esophose.playerparticles.particles.PPlayer;
|
||||||
|
|
||||||
public class ParticleCommandHandler implements CommandExecutor, TabCompleter {
|
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 (!(sender instanceof Player)) return new ArrayList<String>();
|
||||||
|
|
||||||
if (cmd.getName().equalsIgnoreCase("pp")) {
|
if (cmd.getName().equalsIgnoreCase("pp")) {
|
||||||
|
PPlayer pplayer = DataManager.getPPlayer(((Player) sender).getUniqueId());
|
||||||
|
if (pplayer == null) return new ArrayList<String>();
|
||||||
|
|
||||||
if (args.length <= 1) {
|
if (args.length <= 1) {
|
||||||
CommandModule commandModule = findMatchingCommand(""); // Get the default command module
|
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) {
|
} else if (args.length >= 2) {
|
||||||
CommandModule commandModule = findMatchingCommand(args[0]);
|
CommandModule commandModule = findMatchingCommand(args[0]);
|
||||||
String[] cmdArgs = Arrays.copyOfRange(args, 1, args.length);
|
String[] cmdArgs = Arrays.copyOfRange(args, 1, args.length);
|
||||||
if (commandModule != null) {
|
if (commandModule != null) {
|
||||||
return commandModule.onTabComplete(DataManager.getPPlayer(((Player) sender).getUniqueId()), cmdArgs);
|
return commandModule.onTabComplete(pplayer, cmdArgs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -209,8 +209,8 @@ public class DataManager {
|
||||||
/**
|
/**
|
||||||
* Updates the particles_hidden setting in the database and for the PPlayer
|
* Updates the particles_hidden setting in the database and for the PPlayer
|
||||||
*
|
*
|
||||||
* @param playerUUID
|
* @param playerUUID The player to hide PlayerParticles from
|
||||||
* @param particlesHidden
|
* @param particlesHidden True if the particles should be hidden, otherwise False
|
||||||
*/
|
*/
|
||||||
public static void updateSettingParticlesHidden(UUID playerUUID, boolean particlesHidden) {
|
public static void updateSettingParticlesHidden(UUID playerUUID, boolean particlesHidden) {
|
||||||
async(() -> {
|
async(() -> {
|
||||||
|
|
|
@ -437,7 +437,6 @@ public class LangManager {
|
||||||
*
|
*
|
||||||
* @param player The player to send the message to
|
* @param player The player to send the message to
|
||||||
* @param message The message to send to the player
|
* @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) {
|
public static void sendCustomMessage(Player player, String message) {
|
||||||
if (!PSetting.MESSAGES_ENABLED.getBoolean()) return;
|
if (!PSetting.MESSAGES_ENABLED.getBoolean()) return;
|
||||||
|
@ -465,7 +464,7 @@ public class LangManager {
|
||||||
/**
|
/**
|
||||||
* Sends a message to a Player without the prefix
|
* 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 messageType The message type to send the player
|
||||||
* @param replacements The replacements for the message
|
* @param replacements The replacements for the message
|
||||||
*/
|
*/
|
||||||
|
@ -484,7 +483,7 @@ public class LangManager {
|
||||||
/**
|
/**
|
||||||
* Sends a message to a PPlayer without the prefix
|
* 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 messageType The message type to send the player
|
||||||
* @param replacements The replacements for the message
|
* @param replacements The replacements for the message
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -155,7 +155,7 @@ public class ParticleManager extends BukkitRunnable implements Listener {
|
||||||
*/
|
*/
|
||||||
private void displayFixedParticleEffect(FixedParticleEffect fixedEffect) {
|
private void displayFixedParticleEffect(FixedParticleEffect fixedEffect) {
|
||||||
ParticlePair particle = fixedEffect.getParticlePair();
|
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);
|
ParticleEffect.display(particle, pparticle, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ public class DefaultStyles {
|
||||||
public static final ParticleStyle BATMAN = new ParticleStyleBatman();
|
public static final ParticleStyle BATMAN = new ParticleStyleBatman();
|
||||||
public static final ParticleStyle BEAM = new ParticleStyleBeam();
|
public static final ParticleStyle BEAM = new ParticleStyleBeam();
|
||||||
public static final ParticleStyle BLOCKBREAK = new ParticleStyleBlockBreak();
|
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 BLOCKPLACE = new ParticleStyleBlockPlace();
|
||||||
public static final ParticleStyle CELEBRATION = new ParticleStyleCelebration();
|
public static final ParticleStyle CELEBRATION = new ParticleStyleCelebration();
|
||||||
public static final ParticleStyle CHAINS = new ParticleStyleChains();
|
public static final ParticleStyle CHAINS = new ParticleStyleChains();
|
||||||
|
@ -52,7 +51,6 @@ public class DefaultStyles {
|
||||||
ParticleStyleManager.registerStyle(BATMAN);
|
ParticleStyleManager.registerStyle(BATMAN);
|
||||||
ParticleStyleManager.registerStyle(BEAM);
|
ParticleStyleManager.registerStyle(BEAM);
|
||||||
ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK);
|
ParticleStyleManager.registerCustomHandledStyle(BLOCKBREAK);
|
||||||
ParticleStyleManager.registerCustomHandledStyle(BLOCKEDIT);
|
|
||||||
ParticleStyleManager.registerCustomHandledStyle(BLOCKPLACE);
|
ParticleStyleManager.registerCustomHandledStyle(BLOCKPLACE);
|
||||||
ParticleStyleManager.registerStyle(CELEBRATION);
|
ParticleStyleManager.registerStyle(CELEBRATION);
|
||||||
ParticleStyleManager.registerStyle(CHAINS);
|
ParticleStyleManager.registerStyle(CHAINS);
|
||||||
|
@ -83,7 +81,6 @@ public class DefaultStyles {
|
||||||
manager.registerEvents((Listener) ARROWS, playerParticles);
|
manager.registerEvents((Listener) ARROWS, playerParticles);
|
||||||
manager.registerEvents((Listener) BLOCKBREAK, playerParticles);
|
manager.registerEvents((Listener) BLOCKBREAK, playerParticles);
|
||||||
manager.registerEvents((Listener) BLOCKPLACE, playerParticles);
|
manager.registerEvents((Listener) BLOCKPLACE, playerParticles);
|
||||||
manager.registerEvents((Listener) BLOCKEDIT, playerParticles);
|
|
||||||
manager.registerEvents((Listener) HURT, playerParticles);
|
manager.registerEvents((Listener) HURT, playerParticles);
|
||||||
manager.registerEvents((Listener) MOVE, playerParticles);
|
manager.registerEvents((Listener) MOVE, playerParticles);
|
||||||
manager.registerEvents((Listener) SWORDS, playerParticles);
|
manager.registerEvents((Listener) SWORDS, playerParticles);
|
||||||
|
|
|
@ -59,6 +59,10 @@ public class ParticleStyleArrows implements ParticleStyle, Listener {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The event used to get all arrows fired by players
|
* The event used to get all arrows fired by players
|
||||||
|
|
|
@ -124,5 +124,9 @@ public class ParticleStyleBatman implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,5 +62,9 @@ public class ParticleStyleBeam implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,10 @@ public class ParticleStyleBlockBreak implements ParticleStyle, Listener {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
|
|
|
@ -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));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -45,6 +45,10 @@ public class ParticleStyleBlockPlace implements ParticleStyle, Listener {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import com.esophose.playerparticles.PlayerParticles;
|
import com.esophose.playerparticles.PlayerParticles;
|
||||||
import com.esophose.playerparticles.manager.ParticleManager;
|
import com.esophose.playerparticles.manager.ParticleManager;
|
||||||
|
import com.esophose.playerparticles.particles.FixedParticleEffect;
|
||||||
import com.esophose.playerparticles.particles.PPlayer;
|
import com.esophose.playerparticles.particles.PPlayer;
|
||||||
import com.esophose.playerparticles.particles.ParticleEffect;
|
import com.esophose.playerparticles.particles.ParticleEffect;
|
||||||
import com.esophose.playerparticles.particles.ParticlePair;
|
import com.esophose.playerparticles.particles.ParticlePair;
|
||||||
|
@ -35,59 +36,65 @@ public class ParticleStyleCelebration implements ParticleStyle {
|
||||||
if (step == spawnTime) {
|
if (step == spawnTime) {
|
||||||
step = 0;
|
step = 0;
|
||||||
|
|
||||||
final Random random = new Random();
|
Random random = new Random();
|
||||||
for (PPlayer pplayer : ParticleManager.getPPlayers()) {
|
for (PPlayer pplayer : ParticleManager.getPPlayers()) {
|
||||||
final Player player = pplayer.getPlayer();
|
Player player = pplayer.getPlayer();
|
||||||
|
|
||||||
for (ParticlePair particle : pplayer.getActiveParticles()) {
|
for (ParticlePair particle : pplayer.getActiveParticles())
|
||||||
if (particle.getStyle() != this) continue;
|
if (particle.getStyle() == this)
|
||||||
|
spawnFirework(player.getLocation(), pplayer, particle, random);
|
||||||
double angle = random.nextDouble() * Math.PI * 2;
|
|
||||||
double distanceFrom = 1.25 + random.nextDouble() * 1.5;
|
for (FixedParticleEffect fixedEffect : pplayer.getFixedParticles())
|
||||||
double dx = Math.sin(angle) * distanceFrom;
|
if (fixedEffect.getParticlePair().getStyle() == this)
|
||||||
double dz = Math.cos(angle) * distanceFrom;
|
spawnFirework(fixedEffect.getLocation(), pplayer, fixedEffect.getParticlePair(), random);
|
||||||
final Location loc = player.getLocation().clone().add(dx, 1, dz);
|
|
||||||
final int fuse = 3 + random.nextInt(3);
|
|
||||||
|
|
||||||
new BukkitRunnable() {
|
|
||||||
private Location location = loc;
|
|
||||||
private int fuseLength = fuse;
|
|
||||||
private int fuseTimer = 0;
|
|
||||||
|
|
||||||
public void run() {
|
|
||||||
if (this.fuseTimer < this.fuseLength) {
|
|
||||||
ParticlePair trail = ParticlePair.getNextDefault(pplayer);
|
|
||||||
trail.setEffect(ParticleEffect.FIREWORK);
|
|
||||||
trail.setStyle(DefaultStyles.CELEBRATION);
|
|
||||||
|
|
||||||
ParticleManager.displayParticles(trail, Collections.singletonList(new PParticle(this.location)));
|
|
||||||
|
|
||||||
this.location.add(0, 0.25, 0);
|
|
||||||
} else {
|
|
||||||
List<PParticle> particles = new ArrayList<PParticle>();
|
|
||||||
for (int i = 0; i < 40; i++) {
|
|
||||||
double radius = 0.6 + random.nextDouble() * 0.2;
|
|
||||||
double u = random.nextDouble();
|
|
||||||
double v = random.nextDouble();
|
|
||||||
double theta = 2 * Math.PI * u;
|
|
||||||
double phi = Math.acos(2 * v - 1);
|
|
||||||
double dx = radius * Math.sin(phi) * Math.cos(theta);
|
|
||||||
double dy = radius * Math.sin(phi) * Math.sin(theta);
|
|
||||||
double dz = radius * Math.cos(phi);
|
|
||||||
|
|
||||||
particles.add(new PParticle(this.location.clone().add(dx, dy, dz)));
|
|
||||||
}
|
|
||||||
ParticleManager.displayParticles(particle, particles);
|
|
||||||
|
|
||||||
this.cancel();
|
|
||||||
}
|
|
||||||
this.fuseTimer++;
|
|
||||||
}
|
|
||||||
}.runTaskTimer(PlayerParticles.getPlugin(), 0, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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 = location.clone().add(dx, 1, dz);
|
||||||
|
final int fuse = 3 + random.nextInt(3);
|
||||||
|
|
||||||
|
new BukkitRunnable() {
|
||||||
|
private Location location = loc;
|
||||||
|
private int fuseLength = fuse;
|
||||||
|
private int fuseTimer = 0;
|
||||||
|
|
||||||
|
public void run() {
|
||||||
|
if (this.fuseTimer < this.fuseLength) {
|
||||||
|
ParticlePair trail = ParticlePair.getNextDefault(pplayer);
|
||||||
|
trail.setEffect(ParticleEffect.FIREWORK);
|
||||||
|
trail.setStyle(DefaultStyles.CELEBRATION);
|
||||||
|
|
||||||
|
ParticleManager.displayParticles(trail, Collections.singletonList(new PParticle(this.location)));
|
||||||
|
|
||||||
|
this.location.add(0, 0.25, 0);
|
||||||
|
} else {
|
||||||
|
List<PParticle> particles = new ArrayList<PParticle>();
|
||||||
|
for (int i = 0; i < 40; i++) {
|
||||||
|
double radius = 0.6 + random.nextDouble() * 0.2;
|
||||||
|
double u = random.nextDouble();
|
||||||
|
double v = random.nextDouble();
|
||||||
|
double theta = 2 * Math.PI * u;
|
||||||
|
double phi = Math.acos(2 * v - 1);
|
||||||
|
double dx = radius * Math.sin(phi) * Math.cos(theta);
|
||||||
|
double dy = radius * Math.sin(phi) * Math.sin(theta);
|
||||||
|
double dz = radius * Math.cos(phi);
|
||||||
|
|
||||||
|
particles.add(new PParticle(this.location.clone().add(dx, dy, dz)));
|
||||||
|
}
|
||||||
|
ParticleManager.displayParticles(particle, particles);
|
||||||
|
|
||||||
|
this.cancel();
|
||||||
|
}
|
||||||
|
this.fuseTimer++;
|
||||||
|
}
|
||||||
|
}.runTaskTimer(PlayerParticles.getPlugin(), 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "celebration";
|
return "celebration";
|
||||||
|
@ -100,5 +107,9 @@ public class ParticleStyleCelebration implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,9 @@ public class ParticleStyleChains implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,5 +77,9 @@ public class ParticleStyleCompanion implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,5 +102,9 @@ public class ParticleStyleCube implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,5 +32,9 @@ public class ParticleStyleFeet implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,5 +60,9 @@ public class ParticleStyleHalo implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return -0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,6 +46,10 @@ public class ParticleStyleHurt implements ParticleStyle, Listener {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
|
|
|
@ -102,5 +102,9 @@ public class ParticleStyleInvocation implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,10 @@ public class ParticleStyleMove implements ParticleStyle, Listener {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onPlayerMove(PlayerMoveEvent e) {
|
public void onPlayerMove(PlayerMoveEvent e) {
|
||||||
|
|
|
@ -142,5 +142,9 @@ public class ParticleStyleNormal implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,5 +56,9 @@ public class ParticleStyleOrbit implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,5 +33,9 @@ public class ParticleStyleOverhead implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return -0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,5 +30,9 @@ public class ParticleStylePoint implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return -0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,5 +68,9 @@ public class ParticleStyleQuadhelix implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,5 +62,9 @@ public class ParticleStyleRings implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,5 +45,9 @@ public class ParticleStyleSphere implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,5 +50,9 @@ public class ParticleStyleSpin implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return -0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,5 +39,9 @@ public class ParticleStyleSpiral implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,10 @@ public class ParticleStyleSwords implements ParticleStyle, Listener {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
|
public void onEntityDamageEntity(EntityDamageByEntityEvent event) {
|
||||||
|
|
|
@ -38,5 +38,9 @@ public class ParticleStyleThick implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,5 +70,9 @@ public class ParticleStyleVortex implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0.5;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,5 +44,9 @@ public class ParticleStyleWings implements ParticleStyle {
|
||||||
public boolean canToggleWithMovement() {
|
public boolean canToggleWithMovement() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public double getFixedEffectOffset() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,13 @@ public interface ParticleStyle {
|
||||||
*/
|
*/
|
||||||
public boolean canToggleWithMovement();
|
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
|
* Gets the ParticleStyle with the name given, returns null if not found
|
||||||
*
|
*
|
||||||
|
|
|
@ -300,8 +300,6 @@ gui-icon:
|
||||||
- POWERED_RAIL
|
- POWERED_RAIL
|
||||||
blockbreak:
|
blockbreak:
|
||||||
- IRON_PICKAXE
|
- IRON_PICKAXE
|
||||||
blockedit:
|
|
||||||
- DISPENSER
|
|
||||||
blockplace:
|
blockplace:
|
||||||
- OAK_PLANKS
|
- OAK_PLANKS
|
||||||
- WOOD
|
- WOOD
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue