mirror of
https://github.com/TotalFreedomMC/PlayerParticles.git
synced 2025-08-03 19:15:40 +00:00
testing
This commit is contained in:
parent
80a4613725
commit
9567b06e23
147 changed files with 1811 additions and 1406 deletions
3
Particles/Wrapper/build.gradle
Normal file
3
Particles/Wrapper/build.gradle
Normal file
|
@ -0,0 +1,3 @@
|
|||
dependencies {
|
||||
shadow 'org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT'
|
||||
}
|
|
@ -0,0 +1,19 @@
|
|||
package dev.esophose.playerparticles.nms.wrapper;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.version.VersionMapping;
|
||||
import java.util.Collection;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public abstract class ParticleHandler {
|
||||
|
||||
protected VersionMapping versionMapping;
|
||||
|
||||
public ParticleHandler(VersionMapping versionMapping) {
|
||||
this.versionMapping = versionMapping;
|
||||
}
|
||||
|
||||
public abstract void spawnParticle(ParticleEffect particleEffect, Collection<Player> players, Location location, int count, float offsetX, float offsetY, float offsetZ, float extra, Object data);
|
||||
|
||||
}
|
|
@ -0,0 +1,103 @@
|
|||
package dev.esophose.playerparticles.particles;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public enum ParticleEffect {
|
||||
|
||||
AMBIENT_ENTITY_EFFECT(ParticleProperty.REQUIRES_COLOR_DATA),
|
||||
ANGRY_VILLAGER,
|
||||
ASH,
|
||||
BARRIER,
|
||||
BLOCK(ParticleProperty.REQUIRES_BLOCK_DATA),
|
||||
BUBBLE,
|
||||
BUBBLE_COLUMN_UP,
|
||||
BUBBLE_POP,
|
||||
CAMPFIRE_COSY_SMOKE,
|
||||
CAMPFIRE_SIGNAL_SMOKE,
|
||||
CLOUD,
|
||||
COMPOSTER,
|
||||
CRIMSON_SPORE,
|
||||
CRIT,
|
||||
CURRENT_DOWN,
|
||||
DAMAGE_INDICATOR,
|
||||
DOLPHIN,
|
||||
DRAGON_BREATH,
|
||||
DRIPPING_HONEY,
|
||||
DRIPPING_LAVA,
|
||||
DRIPPING_OBSIDIAN_TEAR,
|
||||
DRIPPING_WATER,
|
||||
DUST(ParticleProperty.REQUIRES_COLOR_DATA),
|
||||
ELDER_GUARDIAN,
|
||||
ENCHANT,
|
||||
ENCHANTED_HIT,
|
||||
END_ROD,
|
||||
ENTITY_EFFECT(ParticleProperty.REQUIRES_COLOR_DATA),
|
||||
EXPLOSION,
|
||||
EXPLOSION_EMITTER,
|
||||
FALLING_DUST(ParticleProperty.REQUIRES_BLOCK_DATA),
|
||||
FALLING_HONEY,
|
||||
FALLING_LAVA,
|
||||
FALLING_NECTAR,
|
||||
FALLING_OBSIDIAN_TEAR,
|
||||
FALLING_WATER,
|
||||
FIREWORK,
|
||||
FISHING,
|
||||
FLAME,
|
||||
FLASH,
|
||||
FOOTSTEP,
|
||||
HAPPY_VILLAGER,
|
||||
HEART,
|
||||
INSTANT_EFFECT,
|
||||
ITEM(ParticleProperty.REQUIRES_ITEM_DATA),
|
||||
ITEM_SLIME,
|
||||
ITEM_SNOWBALL,
|
||||
LANDING_HONEY,
|
||||
LANDING_LAVA,
|
||||
LANDING_OBSIDIAN_TEAR,
|
||||
LARGE_SMOKE,
|
||||
LAVA,
|
||||
MYCELIUM,
|
||||
NAUTILUS,
|
||||
NOTE(ParticleProperty.REQUIRES_COLOR_DATA),
|
||||
POOF,
|
||||
PORTAL,
|
||||
RAIN,
|
||||
SMOKE,
|
||||
SNEEZE,
|
||||
SOUL,
|
||||
SOUL_FIRE_FLAME,
|
||||
SPELL, // The Minecraft internal name for this is actually "effect", but that's the command name, so it's SPELL for the plugin instead
|
||||
SPIT,
|
||||
SPLASH,
|
||||
SQUID_INK,
|
||||
SWEEP_ATTACK,
|
||||
TOTEM_OF_UNDYING,
|
||||
UNDERWATER,
|
||||
WARPED_SPORE,
|
||||
WITCH;
|
||||
|
||||
private List<ParticleProperty> properties;
|
||||
|
||||
ParticleEffect(ParticleProperty... properties) {
|
||||
this.properties = Arrays.asList(properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine if this particle effect has a specific property
|
||||
*
|
||||
* @param property The property to check
|
||||
* @return Whether it has the property or not
|
||||
*/
|
||||
public boolean hasProperty(ParticleProperty property) {
|
||||
return this.properties.contains(property);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this ParticleEffect has properties, otherwise false
|
||||
*/
|
||||
public boolean hasProperties() {
|
||||
return !this.properties.isEmpty();
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
package dev.esophose.playerparticles.particles;
|
||||
|
||||
/**
|
||||
* Represents a property of a particle effect
|
||||
*/
|
||||
public enum ParticleProperty {
|
||||
|
||||
REQUIRES_BLOCK_DATA,
|
||||
REQUIRES_ITEM_DATA,
|
||||
REQUIRES_COLOR_DATA
|
||||
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
package dev.esophose.playerparticles.particles.version;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@SuppressWarnings("StaticInitializerReferencesSubClass")
|
||||
public abstract class VersionMapping {
|
||||
|
||||
public static final VersionMapping _16 = new VersionMapping16();
|
||||
public static final VersionMapping _15 = new VersionMapping15();
|
||||
|
||||
private final Map<ParticleEffect, Integer> particleEffectNameMapping;
|
||||
|
||||
public VersionMapping() {
|
||||
this.particleEffectNameMapping = new HashMap<>();
|
||||
}
|
||||
|
||||
public abstract Map<Integer, ParticleEffect> getParticleEffectIdMapping();
|
||||
|
||||
public Map<ParticleEffect, Integer> getParticleEffectNameMapping() {
|
||||
if (this.particleEffectNameMapping.isEmpty())
|
||||
this.getParticleEffectIdMapping().forEach((key, value) -> this.particleEffectNameMapping.put(value, key));
|
||||
return this.particleEffectNameMapping;
|
||||
}
|
||||
|
||||
public static VersionMapping getVersionMapping(int version) {
|
||||
switch (version) {
|
||||
case 16:
|
||||
return _16;
|
||||
case 15:
|
||||
return _15;
|
||||
}
|
||||
|
||||
return new VersionMapping() {
|
||||
@Override
|
||||
public Map<Integer, ParticleEffect> getParticleEffectIdMapping() {
|
||||
return new HashMap<>();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,83 @@
|
|||
package dev.esophose.playerparticles.particles.version;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VersionMapping15 extends VersionMapping {
|
||||
|
||||
private final Map<Integer, ParticleEffect> particleEffectNameMapping;
|
||||
|
||||
public VersionMapping15() {
|
||||
this.particleEffectNameMapping = new HashMap<Integer, ParticleEffect>() {{
|
||||
this.put(0, ParticleEffect.AMBIENT_ENTITY_EFFECT);
|
||||
this.put(1, ParticleEffect.ANGRY_VILLAGER);
|
||||
this.put(2, ParticleEffect.BARRIER);
|
||||
this.put(3, ParticleEffect.BLOCK);
|
||||
this.put(4, ParticleEffect.BUBBLE);
|
||||
this.put(5, ParticleEffect.CLOUD);
|
||||
this.put(6, ParticleEffect.CRIT);
|
||||
this.put(7, ParticleEffect.DAMAGE_INDICATOR);
|
||||
this.put(8, ParticleEffect.DRAGON_BREATH);
|
||||
this.put(9, ParticleEffect.DRIPPING_LAVA);
|
||||
this.put(10, ParticleEffect.FALLING_LAVA);
|
||||
this.put(11, ParticleEffect.LANDING_LAVA);
|
||||
this.put(12, ParticleEffect.DRIPPING_WATER);
|
||||
this.put(13, ParticleEffect.FALLING_WATER);
|
||||
this.put(14, ParticleEffect.DUST);
|
||||
this.put(15, ParticleEffect.SPELL);
|
||||
this.put(16, ParticleEffect.ELDER_GUARDIAN);
|
||||
this.put(17, ParticleEffect.ENCHANTED_HIT);
|
||||
this.put(18, ParticleEffect.ENCHANT);
|
||||
this.put(19, ParticleEffect.END_ROD);
|
||||
this.put(20, ParticleEffect.ENTITY_EFFECT);
|
||||
this.put(21, ParticleEffect.EXPLOSION_EMITTER);
|
||||
this.put(22, ParticleEffect.EXPLOSION);
|
||||
this.put(23, ParticleEffect.FALLING_DUST);
|
||||
this.put(24, ParticleEffect.FIREWORK);
|
||||
this.put(25, ParticleEffect.FISHING);
|
||||
this.put(26, ParticleEffect.FLAME);
|
||||
this.put(27, ParticleEffect.FLASH);
|
||||
this.put(28, ParticleEffect.HAPPY_VILLAGER);
|
||||
this.put(29, ParticleEffect.COMPOSTER);
|
||||
this.put(30, ParticleEffect.HEART);
|
||||
this.put(31, ParticleEffect.INSTANT_EFFECT);
|
||||
this.put(32, ParticleEffect.ITEM);
|
||||
this.put(33, ParticleEffect.ITEM_SLIME);
|
||||
this.put(34, ParticleEffect.ITEM_SNOWBALL);
|
||||
this.put(35, ParticleEffect.LARGE_SMOKE);
|
||||
this.put(36, ParticleEffect.LAVA);
|
||||
this.put(37, ParticleEffect.MYCELIUM);
|
||||
this.put(38, ParticleEffect.NOTE);
|
||||
this.put(39, ParticleEffect.POOF);
|
||||
this.put(40, ParticleEffect.PORTAL);
|
||||
this.put(41, ParticleEffect.RAIN);
|
||||
this.put(42, ParticleEffect.SMOKE);
|
||||
this.put(43, ParticleEffect.SNEEZE);
|
||||
this.put(44, ParticleEffect.SPIT);
|
||||
this.put(45, ParticleEffect.SQUID_INK);
|
||||
this.put(46, ParticleEffect.SWEEP_ATTACK);
|
||||
this.put(47, ParticleEffect.TOTEM_OF_UNDYING);
|
||||
this.put(48, ParticleEffect.UNDERWATER);
|
||||
this.put(49, ParticleEffect.SPLASH);
|
||||
this.put(50, ParticleEffect.WITCH);
|
||||
this.put(51, ParticleEffect.BUBBLE_POP);
|
||||
this.put(52, ParticleEffect.CURRENT_DOWN);
|
||||
this.put(53, ParticleEffect.BUBBLE_COLUMN_UP);
|
||||
this.put(54, ParticleEffect.NAUTILUS);
|
||||
this.put(55, ParticleEffect.DOLPHIN);
|
||||
this.put(56, ParticleEffect.CAMPFIRE_COSY_SMOKE);
|
||||
this.put(57, ParticleEffect.CAMPFIRE_SIGNAL_SMOKE);
|
||||
this.put(58, ParticleEffect.DRIPPING_HONEY);
|
||||
this.put(59, ParticleEffect.FALLING_HONEY);
|
||||
this.put(60, ParticleEffect.LANDING_HONEY);
|
||||
this.put(61, ParticleEffect.FALLING_NECTAR);
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, ParticleEffect> getParticleEffectIdMapping() {
|
||||
return this.particleEffectNameMapping;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
package dev.esophose.playerparticles.particles.version;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class VersionMapping16 extends VersionMapping {
|
||||
|
||||
private final Map<Integer, ParticleEffect> particleEffectNameMapping;
|
||||
|
||||
public VersionMapping16() {
|
||||
this.particleEffectNameMapping = new HashMap<Integer, ParticleEffect>() {{
|
||||
this.put(0, ParticleEffect.AMBIENT_ENTITY_EFFECT);
|
||||
this.put(1, ParticleEffect.ANGRY_VILLAGER);
|
||||
this.put(2, ParticleEffect.BARRIER);
|
||||
this.put(3, ParticleEffect.BLOCK);
|
||||
this.put(4, ParticleEffect.BUBBLE);
|
||||
this.put(5, ParticleEffect.CLOUD);
|
||||
this.put(6, ParticleEffect.CRIT);
|
||||
this.put(7, ParticleEffect.DAMAGE_INDICATOR);
|
||||
this.put(8, ParticleEffect.DRAGON_BREATH);
|
||||
this.put(9, ParticleEffect.DRIPPING_LAVA);
|
||||
this.put(10, ParticleEffect.FALLING_LAVA);
|
||||
this.put(11, ParticleEffect.LANDING_LAVA);
|
||||
this.put(12, ParticleEffect.DRIPPING_WATER);
|
||||
this.put(13, ParticleEffect.FALLING_WATER);
|
||||
this.put(14, ParticleEffect.DUST);
|
||||
this.put(15, ParticleEffect.SPELL);
|
||||
this.put(16, ParticleEffect.ELDER_GUARDIAN);
|
||||
this.put(17, ParticleEffect.ENCHANTED_HIT);
|
||||
this.put(18, ParticleEffect.ENCHANT);
|
||||
this.put(19, ParticleEffect.END_ROD);
|
||||
this.put(20, ParticleEffect.ENTITY_EFFECT);
|
||||
this.put(21, ParticleEffect.EXPLOSION_EMITTER);
|
||||
this.put(22, ParticleEffect.EXPLOSION);
|
||||
this.put(23, ParticleEffect.FALLING_DUST);
|
||||
this.put(24, ParticleEffect.FIREWORK);
|
||||
this.put(25, ParticleEffect.FISHING);
|
||||
this.put(26, ParticleEffect.FLAME);
|
||||
this.put(27, ParticleEffect.SOUL_FIRE_FLAME);
|
||||
this.put(28, ParticleEffect.SOUL);
|
||||
this.put(29, ParticleEffect.FLASH);
|
||||
this.put(30, ParticleEffect.HAPPY_VILLAGER);
|
||||
this.put(31, ParticleEffect.COMPOSTER);
|
||||
this.put(32, ParticleEffect.HEART);
|
||||
this.put(33, ParticleEffect.INSTANT_EFFECT);
|
||||
this.put(34, ParticleEffect.ITEM);
|
||||
this.put(35, ParticleEffect.ITEM_SLIME);
|
||||
this.put(36, ParticleEffect.ITEM_SNOWBALL);
|
||||
this.put(37, ParticleEffect.LARGE_SMOKE);
|
||||
this.put(38, ParticleEffect.LAVA);
|
||||
this.put(39, ParticleEffect.MYCELIUM);
|
||||
this.put(40, ParticleEffect.NOTE);
|
||||
this.put(41, ParticleEffect.POOF);
|
||||
this.put(42, ParticleEffect.PORTAL);
|
||||
this.put(43, ParticleEffect.RAIN);
|
||||
this.put(44, ParticleEffect.SMOKE);
|
||||
this.put(45, ParticleEffect.SNEEZE);
|
||||
this.put(46, ParticleEffect.SPIT);
|
||||
this.put(47, ParticleEffect.SQUID_INK);
|
||||
this.put(48, ParticleEffect.SWEEP_ATTACK);
|
||||
this.put(49, ParticleEffect.TOTEM_OF_UNDYING);
|
||||
this.put(50, ParticleEffect.UNDERWATER);
|
||||
this.put(51, ParticleEffect.SPLASH);
|
||||
this.put(52, ParticleEffect.WITCH);
|
||||
this.put(53, ParticleEffect.BUBBLE_POP);
|
||||
this.put(54, ParticleEffect.CURRENT_DOWN);
|
||||
this.put(55, ParticleEffect.BUBBLE_COLUMN_UP);
|
||||
this.put(56, ParticleEffect.NAUTILUS);
|
||||
this.put(57, ParticleEffect.DOLPHIN);
|
||||
this.put(58, ParticleEffect.CAMPFIRE_COSY_SMOKE);
|
||||
this.put(59, ParticleEffect.CAMPFIRE_SIGNAL_SMOKE);
|
||||
this.put(60, ParticleEffect.DRIPPING_HONEY);
|
||||
this.put(61, ParticleEffect.FALLING_HONEY);
|
||||
this.put(62, ParticleEffect.LANDING_HONEY);
|
||||
this.put(63, ParticleEffect.FALLING_NECTAR);
|
||||
this.put(64, ParticleEffect.ASH);
|
||||
this.put(65, ParticleEffect.CRIMSON_SPORE);
|
||||
this.put(66, ParticleEffect.WARPED_SPORE);
|
||||
this.put(67, ParticleEffect.DRIPPING_OBSIDIAN_TEAR);
|
||||
this.put(68, ParticleEffect.FALLING_OBSIDIAN_TEAR);
|
||||
this.put(69, ParticleEffect.LANDING_OBSIDIAN_TEAR);
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, ParticleEffect> getParticleEffectIdMapping() {
|
||||
return this.particleEffectNameMapping;
|
||||
}
|
||||
|
||||
}
|
5
Particles/v1_15_R1/build.gradle
Normal file
5
Particles/v1_15_R1/build.gradle
Normal file
|
@ -0,0 +1,5 @@
|
|||
dependencies {
|
||||
implementation project(':NMS-Wrapper')
|
||||
shadow 'org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT'
|
||||
shadow 'com.comphenix.protocol:ProtocolLib:4.5.0'
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
package dev.esophose.playerparticles.nms.v1_15_R1;
|
||||
|
||||
import net.minecraft.server.v1_15_R1.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutWorldParticles;
|
||||
import net.minecraft.server.v1_15_R1.ParticleParam;
|
||||
|
||||
class ModifiedPacketPlayOutWorldParticles extends PacketPlayOutWorldParticles {
|
||||
|
||||
private int particleId;
|
||||
private double x;
|
||||
private double y;
|
||||
private double z;
|
||||
private float offsetX;
|
||||
private float offsetY;
|
||||
private float offsetZ;
|
||||
private float extra;
|
||||
private int count;
|
||||
private boolean longDistance;
|
||||
private ParticleParam particleParam;
|
||||
|
||||
public <T extends ParticleParam> ModifiedPacketPlayOutWorldParticles(int particleId, T particalParam, boolean longDistance, double x, double y, double z, float offsetX, float offsetY, float offsetZ, float extra, int count) {
|
||||
this.particleId = particleId;
|
||||
this.particleParam = particalParam;
|
||||
this.longDistance = longDistance;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
this.z = z;
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
this.offsetZ = offsetZ;
|
||||
this.extra = extra;
|
||||
this.count = count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(PacketDataSerializer var0) {
|
||||
var0.writeInt(this.particleId);
|
||||
var0.writeBoolean(this.longDistance);
|
||||
var0.writeDouble(this.x);
|
||||
var0.writeDouble(this.y);
|
||||
var0.writeDouble(this.z);
|
||||
var0.writeFloat(this.offsetX);
|
||||
var0.writeFloat(this.offsetY);
|
||||
var0.writeFloat(this.offsetZ);
|
||||
var0.writeFloat(this.extra);
|
||||
var0.writeInt(this.count);
|
||||
|
||||
if (this.particleParam != null)
|
||||
this.particleParam.a(var0);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,85 @@
|
|||
package dev.esophose.playerparticles.nms.v1_15_R1;
|
||||
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import dev.esophose.playerparticles.nms.wrapper.ParticleHandler;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.version.VersionMapping;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.server.v1_15_R1.IRegistry;
|
||||
import net.minecraft.server.v1_15_R1.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutWorldParticles;
|
||||
import net.minecraft.server.v1_15_R1.Particle;
|
||||
import net.minecraft.server.v1_15_R1.ParticleParam;
|
||||
import net.minecraft.server.v1_15_R1.ParticleParamBlock;
|
||||
import net.minecraft.server.v1_15_R1.ParticleParamItem;
|
||||
import net.minecraft.server.v1_15_R1.ParticleParamRedstone;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle.DustOptions;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.craftbukkit.v1_15_R1.util.CraftMagicNumbers;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public class ParticleHandlerImpl extends ParticleHandler {
|
||||
|
||||
public ParticleHandlerImpl(VersionMapping versionMapping) {
|
||||
super(versionMapping);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void spawnParticle(ParticleEffect particleEffect, Collection<Player> players, Location location, int count, float offsetX, float offsetY, float offsetZ, float extra, Object data) {
|
||||
int particleId = this.versionMapping.getParticleEffectNameMapping().get(particleEffect);
|
||||
Particle nms = IRegistry.PARTICLE_TYPE.fromId(particleId);
|
||||
|
||||
ParticleParam particleParam = null;
|
||||
if (data instanceof ItemStack) {
|
||||
ItemStack itemStack = (ItemStack) data;
|
||||
particleParam = new ParticleParamItem(nms, CraftItemStack.asNMSCopy(itemStack));
|
||||
} else if (data instanceof MaterialData) {
|
||||
MaterialData materialData = (MaterialData) data;
|
||||
particleParam = new ParticleParamBlock(nms, CraftMagicNumbers.getBlock(materialData));
|
||||
} else if (data instanceof BlockData) {
|
||||
BlockData blockData = (BlockData) data;
|
||||
particleParam = new ParticleParamBlock(nms, ((CraftBlockData) blockData).getState());
|
||||
} else if (data instanceof DustOptions) {
|
||||
DustOptions dustOptions = (DustOptions) data;
|
||||
Color color = dustOptions.getColor();
|
||||
particleParam = new ParticleParamRedstone((float) color.getRed() / 255.0F, (float) color.getGreen() / 255.0F, (float) color.getBlue() / 255.0F, dustOptions.getSize());
|
||||
}
|
||||
|
||||
PacketPlayOutWorldParticles packetplayoutworldparticles = new ModifiedPacketPlayOutWorldParticles(particleId, particleParam, true, location.getX(), location.getY(), location.getZ(), offsetX, offsetY, offsetZ, extra, count);
|
||||
|
||||
PacketDataSerializer dataSerializer = new PacketDataSerializer(Unpooled.buffer());
|
||||
try {
|
||||
packetplayoutworldparticles.b(dataSerializer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
|
||||
byte[] bytes = new byte[dataSerializer.readableBytes()];
|
||||
dataSerializer.readBytes(bytes);
|
||||
|
||||
try {
|
||||
for (Player player : players) {
|
||||
protocolManager.sendWirePacket(player, 0x24, bytes);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
73
Plugin/build.gradle
Normal file
73
Plugin/build.gradle
Normal file
|
@ -0,0 +1,73 @@
|
|||
import org.apache.tools.ant.filters.ReplaceTokens
|
||||
|
||||
plugins {
|
||||
id 'maven-publish'
|
||||
}
|
||||
|
||||
compileJava {
|
||||
options.compilerArgs += ['-parameters']
|
||||
options.fork = true
|
||||
options.forkOptions.executable = 'javac'
|
||||
options.encoding = 'UTF-8'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// Other modules
|
||||
implementation project(':NMS-Wrapper')
|
||||
|
||||
// Referenced dependencies
|
||||
shadow 'org.spigotmc:spigot:1.15.2-R0.1-SNAPSHOT'
|
||||
shadow 'org.jetbrains:annotations:16.0.2'
|
||||
shadow 'me.clip:placeholderapi:2.10.4'
|
||||
shadow 'org.xerial:sqlite-jdbc:3.23.1'
|
||||
shadow 'com.comphenix.protocol:ProtocolLib:4.5.0'
|
||||
|
||||
// Dependencies that will be shaded into the jar
|
||||
implementation 'org.slf4j:slf4j-api:1.7.25'
|
||||
implementation 'org.slf4j:slf4j-nop:1.7.25'
|
||||
implementation 'com.zaxxer:HikariCP:3.2.0'
|
||||
}
|
||||
|
||||
processResources {
|
||||
from (sourceSets.main.resources.srcDirs) {
|
||||
include '**/*.yml'
|
||||
filter ReplaceTokens, tokens: ["version": project.property("version")]
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications {
|
||||
shadow(MavenPublication) { publication ->
|
||||
project.shadow.component(publication)
|
||||
}
|
||||
mavenJava(MavenPublication) {
|
||||
artifactId = 'playerparticles'
|
||||
from components.java
|
||||
versionMapping {
|
||||
usage('java-api') {
|
||||
fromResolutionOf('runtimeClasspath')
|
||||
}
|
||||
usage('java-runtime') {
|
||||
fromResolutionResult()
|
||||
}
|
||||
}
|
||||
pom {
|
||||
name = 'playerparticles'
|
||||
}
|
||||
}
|
||||
}
|
||||
repositories {
|
||||
if (project.hasProperty('mavenUsername') && project.hasProperty('mavenPassword')) {
|
||||
maven {
|
||||
credentials {
|
||||
username project.mavenUsername
|
||||
password project.mavenPassword
|
||||
}
|
||||
|
||||
def releasesRepoUrl = 'https://repo.codemc.org/repository/maven-releases/'
|
||||
def snapshotsRepoUrl = 'https://repo.codemc.org/repository/maven-snapshots/'
|
||||
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -6,6 +6,11 @@
|
|||
|
||||
package dev.esophose.playerparticles;
|
||||
|
||||
import com.comphenix.protocol.PacketType;
|
||||
import com.comphenix.protocol.ProtocolLibrary;
|
||||
import com.comphenix.protocol.ProtocolManager;
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.EnumWrappers.TitleAction;
|
||||
import dev.esophose.playerparticles.gui.hook.PlayerChatHook;
|
||||
import dev.esophose.playerparticles.hook.ParticlePlaceholderExpansion;
|
||||
import dev.esophose.playerparticles.hook.PlaceholderAPIHook;
|
||||
|
@ -24,12 +29,20 @@ import dev.esophose.playerparticles.manager.PluginUpdateManager;
|
|||
import dev.esophose.playerparticles.particles.listener.PPlayerCombatListener;
|
||||
import dev.esophose.playerparticles.particles.listener.PPlayerMovementListener;
|
||||
import dev.esophose.playerparticles.util.Metrics;
|
||||
import io.netty.buffer.Unpooled;
|
||||
import java.awt.Color;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Map;
|
||||
import net.minecraft.server.v1_15_R1.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_15_R1.PacketPlayOutTitle;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.plugin.PluginManager;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
/**
|
||||
* @author Esophose
|
||||
|
@ -69,9 +82,76 @@ public class PlayerParticles extends JavaPlugin {
|
|||
if (PlaceholderAPIHook.enabled())
|
||||
new ParticlePlaceholderExpansion(this).register();
|
||||
|
||||
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
|
||||
new BukkitRunnable() {
|
||||
private LinkedList<String> queue = new LinkedList<>();
|
||||
private String message = "Snapshot 20w17a Chat Hex Code Colors!";
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (queue.size() >= message.length())
|
||||
queue.poll();
|
||||
|
||||
Color color = getRainbowColor();
|
||||
String hex = String.format("#%02x%02x%02x", color.getRed(), color.getGreen(), color.getBlue());
|
||||
queue.add(hex);
|
||||
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("[");
|
||||
boolean isFirst = true;
|
||||
for (int i = 0; i < queue.size(); i++) {
|
||||
if (!isFirst)
|
||||
stringBuilder.append(",");
|
||||
isFirst = false;
|
||||
|
||||
stringBuilder.append("{");
|
||||
stringBuilder.append("\"color\":\"").append(queue.get(i)).append("\",");
|
||||
stringBuilder.append("\"text\":\"").append(message.charAt(i)).append("\"");
|
||||
stringBuilder.append("}");
|
||||
}
|
||||
stringBuilder.append("]");
|
||||
|
||||
PacketContainer timePacket = protocolManager.createPacket(PacketType.fromClass(PacketPlayOutTitle.class));
|
||||
timePacket.getTitleActions().write(0, TitleAction.TIMES);
|
||||
timePacket.getIntegers().write(0, 0).write(1, 20).write(2, 0);
|
||||
|
||||
PacketDataSerializer dataSerializer = new PacketDataSerializer(Unpooled.buffer());
|
||||
try {
|
||||
PacketPlayOutTitle titlePacket = new PacketPlayOutTitle() {
|
||||
@Override
|
||||
public void b(PacketDataSerializer var0) {
|
||||
var0.a(EnumTitleAction.TITLE);
|
||||
var0.a(stringBuilder.toString());
|
||||
}
|
||||
};
|
||||
titlePacket.b(dataSerializer);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
byte[] bytes = new byte[dataSerializer.readableBytes()];
|
||||
dataSerializer.readBytes(bytes);
|
||||
|
||||
Bukkit.getOnlinePlayers().forEach(x -> {
|
||||
try {
|
||||
protocolManager.sendServerPacket(x, timePacket);
|
||||
protocolManager.sendWirePacket(x, 0x50, bytes);
|
||||
} catch (InvocationTargetException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
}
|
||||
}.runTaskTimer(this, 0, 1);
|
||||
|
||||
PlayerChatHook.setup();
|
||||
}
|
||||
|
||||
private float hue = 0;
|
||||
private Color getRainbowColor() {
|
||||
this.hue = (this.hue + 4) % 362;
|
||||
return Color.getHSBColor(this.hue / 360F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
this.managers.values().forEach(Manager::disable);
|
|
@ -1,6 +1,5 @@
|
|||
package dev.esophose.playerparticles.api;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.DataManager;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
|
@ -9,11 +8,12 @@ import dev.esophose.playerparticles.particles.ConsolePPlayer;
|
|||
import dev.esophose.playerparticles.particles.FixedParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
|
@ -1,17 +1,18 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleStyleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
|
@ -20,7 +21,6 @@ import dev.esophose.playerparticles.util.inputparser.parsable.ParsableOrdinaryCo
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
public class AddCommandModule implements CommandModule {
|
||||
|
@ -31,6 +31,7 @@ public class AddCommandModule implements CommandModule {
|
|||
return;
|
||||
}
|
||||
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
PermissionManager permissionManager = PlayerParticles.getInstance().getManager(PermissionManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
|
@ -47,7 +48,7 @@ public class AddCommandModule implements CommandModule {
|
|||
localeManager.sendMessage(pplayer, "effect-invalid", StringPlaceholders.single("effect", args[0]));
|
||||
return;
|
||||
} else if (!permissionManager.hasEffectPermission(pplayer, effect)) {
|
||||
localeManager.sendMessage(pplayer, "effect-no-permission", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "effect-no-permission", StringPlaceholders.single("effect", particleManager.getEffectSettings(effect).getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -66,7 +67,7 @@ public class AddCommandModule implements CommandModule {
|
|||
NoteColor noteColorData = null;
|
||||
|
||||
if (args.length > 2) {
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) {
|
||||
noteColorData = inputParser.next(NoteColor.class);
|
||||
if (noteColorData == null) {
|
||||
|
@ -80,14 +81,13 @@ public class AddCommandModule implements CommandModule {
|
|||
return;
|
||||
}
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
blockData = inputParser.next(Material.class);
|
||||
if (blockData == null || !blockData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "data-invalid-block");
|
||||
return;
|
||||
}
|
||||
} else if (effect == ParticleEffect.ITEM) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
itemData = inputParser.next(Material.class);
|
||||
if (itemData == null || itemData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "data-invalid-item");
|
||||
|
@ -95,14 +95,13 @@ public class AddCommandModule implements CommandModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParticleGroup group = pplayer.getActiveParticleGroup();
|
||||
ParticlePair newParticle = new ParticlePair(pplayer.getUniqueId(), pplayer.getNextActiveParticleId(), effect, style, itemData, blockData, colorData, noteColorData);
|
||||
group.getParticles().put(newParticle.getId(), newParticle);
|
||||
PlayerParticlesAPI.getInstance().savePlayerParticleGroup(pplayer.getPlayer(), group);
|
||||
|
||||
StringPlaceholders addParticlePlaceholders = StringPlaceholders.builder("effect", newParticle.getEffect().getName())
|
||||
StringPlaceholders addParticlePlaceholders = StringPlaceholders.builder("effect", particleManager.getEffectSettings(newParticle.getEffect()).getName())
|
||||
.addPlaceholder("style", newParticle.getStyle().getName())
|
||||
.addPlaceholder("data", newParticle.getDataString()).build();
|
||||
localeManager.sendMessage(pplayer, "add-particle-applied", addParticlePlaceholders);
|
||||
|
@ -113,8 +112,8 @@ public class AddCommandModule implements CommandModule {
|
|||
}
|
||||
|
||||
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
|
||||
Player p = pplayer.getPlayer();
|
||||
List<String> matches = new ArrayList<>();
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
PermissionManager permissionManager = PlayerParticles.getInstance().getManager(PermissionManager.class);
|
||||
|
||||
if (args.length <= 1) { // Effect name
|
||||
|
@ -123,9 +122,9 @@ public class AddCommandModule implements CommandModule {
|
|||
} else if (args.length == 2) { // Style name
|
||||
StringUtil.copyPartialMatches(args[1], permissionManager.getStyleNamesUserHasPermissionFor(pplayer), matches);
|
||||
} else { // Data
|
||||
ParticleEffect effect = ParticleEffect.fromName(args[0]);
|
||||
ParticleEffect effect = particleManager.getEffectFromName(args[0]);
|
||||
if (effect != null) {
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
List<String> possibleValues = new ArrayList<>();
|
||||
if (effect == ParticleEffect.NOTE) { // Note data
|
||||
if (args.length == 3) {
|
||||
|
@ -145,15 +144,13 @@ public class AddCommandModule implements CommandModule {
|
|||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
} else if (args.length == 3 && effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) { // Block material
|
||||
} else if (args.length == 3 && effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[2], ParticleUtils.getAllBlockMaterials(), matches);
|
||||
} else if (effect == ParticleEffect.ITEM) { // Item material
|
||||
} else if (args.length == 3 && effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[2], ParticleUtils.getAllItemMaterials(), matches);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return matches;
|
||||
}
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.List;
|
||||
|
|
@ -2,10 +2,11 @@ package dev.esophose.playerparticles.command;
|
|||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -14,29 +15,29 @@ import org.bukkit.util.StringUtil;
|
|||
public class DataCommandModule implements CommandModule {
|
||||
|
||||
public void onCommandExecute(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
if (args.length > 0) {
|
||||
ParticleEffect effect = ParticleEffect.fromName(args[0]);
|
||||
ParticleEffect effect = particleManager.getEffectFromName(args[0]);
|
||||
if (effect == null) {
|
||||
localeManager.sendMessage(pplayer, "effect-invalid", StringPlaceholders.single("effect", args[0]));
|
||||
return;
|
||||
}
|
||||
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
String effectName = particleManager.getEffectSettings(effect).getName();
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) {
|
||||
localeManager.sendMessage(pplayer, "data-usage-note", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "data-usage-note", StringPlaceholders.single("effect", effectName));
|
||||
} else {
|
||||
localeManager.sendMessage(pplayer, "data-usage-color", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "data-usage-color", StringPlaceholders.single("effect", effectName));
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.ITEM) {
|
||||
localeManager.sendMessage(pplayer, "data-usage-item", StringPlaceholders.single("effect", effect.getName()));
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
localeManager.sendMessage(pplayer, "data-usage-block", StringPlaceholders.single("effect", effectName));
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
localeManager.sendMessage(pplayer, "data-usage-item", StringPlaceholders.single("effect", effectName));
|
||||
} else {
|
||||
localeManager.sendMessage(pplayer, "data-usage-block", StringPlaceholders.single("effect", effect.getName()));
|
||||
}
|
||||
} else {
|
||||
localeManager.sendMessage(pplayer, "data-usage-none", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "data-usage-none", StringPlaceholders.single("effect", effectName));
|
||||
}
|
||||
} else {
|
||||
localeManager.sendMessage(pplayer, "data-no-args");
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.CommandManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.util.StringUtil;
|
|
@ -1,16 +1,17 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
|
@ -77,6 +78,7 @@ public class EditCommandModule implements CommandModule {
|
|||
* @param args The rest of the args
|
||||
*/
|
||||
private void editEffect(PPlayer pplayer, int id, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
InputParser inputParser = new InputParser(pplayer, args);
|
||||
|
@ -85,7 +87,7 @@ public class EditCommandModule implements CommandModule {
|
|||
localeManager.sendMessage(pplayer, "effect-invalid", StringPlaceholders.single("effect", args[0]));
|
||||
return;
|
||||
} else if (!PlayerParticles.getInstance().getManager(PermissionManager.class).hasEffectPermission(pplayer, effect)) {
|
||||
localeManager.sendMessage(pplayer, "effect-no-permission", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "effect-no-permission", StringPlaceholders.single("effect", particleManager.getEffectSettings(effect).getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -98,7 +100,7 @@ public class EditCommandModule implements CommandModule {
|
|||
}
|
||||
|
||||
PlayerParticlesAPI.getInstance().savePlayerParticleGroup(pplayer.getPlayer(), group);
|
||||
localeManager.sendMessage(pplayer, "edit-success-effect", StringPlaceholders.builder("id", id).addPlaceholder("effect", effect.getName()).build());
|
||||
localeManager.sendMessage(pplayer, "edit-success-effect", StringPlaceholders.builder("id", id).addPlaceholder("effect", particleManager.getEffectSettings(effect).getName()).build());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -151,7 +153,7 @@ public class EditCommandModule implements CommandModule {
|
|||
ParticleEffect effect = pplayer.getActiveParticle(id).getEffect();
|
||||
|
||||
InputParser inputParser = new InputParser(pplayer, args);
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) {
|
||||
noteColorData = inputParser.next(NoteColor.class);
|
||||
if (noteColorData == null) {
|
||||
|
@ -165,21 +167,19 @@ public class EditCommandModule implements CommandModule {
|
|||
return;
|
||||
}
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
blockData = inputParser.next(Material.class);
|
||||
if (blockData == null || !blockData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "data-invalid-block");
|
||||
return;
|
||||
}
|
||||
} else if (effect == ParticleEffect.ITEM) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
itemData = inputParser.next(Material.class);
|
||||
if (itemData == null || itemData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "data-invalid-item");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String updatedDataString = null;
|
||||
ParticleGroup group = pplayer.getActiveParticleGroup();
|
||||
|
@ -237,7 +237,7 @@ public class EditCommandModule implements CommandModule {
|
|||
break;
|
||||
case "data":
|
||||
ParticleEffect effect = pplayer.getActiveParticle(id).getEffect();
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
List<String> possibleValues = new ArrayList<>();
|
||||
if (effect == ParticleEffect.NOTE) { // Note data
|
||||
if (args.length == 3) {
|
||||
|
@ -257,13 +257,11 @@ public class EditCommandModule implements CommandModule {
|
|||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
} else if (args.length == 3 && effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) { // Block material
|
||||
} else if (args.length == 3 && effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[2], ParticleUtils.getAllBlockMaterials(), matches);
|
||||
} else if (effect == ParticleEffect.ITEM) { // Item material
|
||||
} else if (args.length == 3 && effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[2], ParticleUtils.getAllItemMaterials(), matches);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,16 +1,17 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.FixedParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
|
@ -108,6 +109,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
* @param args The command arguments
|
||||
*/
|
||||
private void handleCreate(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
PermissionManager permissionManager = PlayerParticles.getInstance().getManager(PermissionManager.class);
|
||||
Player player = pplayer.getPlayer();
|
||||
|
@ -171,7 +173,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
localeManager.sendMessage(pplayer, "fixed-create-effect-invalid", StringPlaceholders.single("effect", args[3]));
|
||||
return;
|
||||
} else if (!permissionManager.hasEffectPermission(pplayer, effect)) {
|
||||
localeManager.sendMessage(pplayer, "fixed-create-effect-no-permission", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "fixed-create-effect-no-permission", StringPlaceholders.single("effect", particleManager.getEffectSettings(effect).getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -194,8 +196,8 @@ public class FixedCommandModule implements CommandModule {
|
|||
OrdinaryColor colorData = null;
|
||||
NoteColor noteColorData = null;
|
||||
|
||||
if (inputParser.hasNext() && (effect.hasProperty(ParticleProperty.COLORABLE) || effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA))) {
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (inputParser.hasNext() && (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA) || effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA) || effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA))) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) {
|
||||
noteColorData = inputParser.next(NoteColor.class);
|
||||
if (noteColorData == null) {
|
||||
|
@ -209,14 +211,13 @@ public class FixedCommandModule implements CommandModule {
|
|||
return;
|
||||
}
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
blockData = inputParser.next(Material.class);
|
||||
if (blockData == null || !blockData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "fixed-create-data-error");
|
||||
return;
|
||||
}
|
||||
} else if (effect == ParticleEffect.ITEM) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
itemData = inputParser.next(Material.class);
|
||||
if (itemData == null || itemData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "fixed-create-data-error");
|
||||
|
@ -224,7 +225,6 @@ public class FixedCommandModule implements CommandModule {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ParticlePair particle = new ParticlePair(pplayer.getUniqueId(), pplayer.getNextFixedEffectId(), effect, style, itemData, blockData, colorData, noteColorData);
|
||||
PlayerParticlesAPI.getInstance().createFixedParticleEffect(player == null ? Bukkit.getConsoleSender() : player, location, particle);
|
||||
|
@ -238,6 +238,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
* @param args The command arguments
|
||||
*/
|
||||
private void handleEdit(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
PermissionManager permissionManager = PlayerParticles.getInstance().getManager(PermissionManager.class);
|
||||
Player player = pplayer.getPlayer();
|
||||
|
@ -291,7 +292,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
localeManager.sendMessage(pplayer, "fixed-edit-effect-invalid", StringPlaceholders.single("effect", args[2]));
|
||||
return;
|
||||
} else if (!permissionManager.hasEffectPermission(pplayer, effect)) {
|
||||
localeManager.sendMessage(pplayer, "fixed-edit-effect-no-permission", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "fixed-edit-effect-no-permission", StringPlaceholders.single("effect", particleManager.getEffectSettings(effect).getName()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -320,7 +321,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
NoteColor noteColorData = null;
|
||||
|
||||
ParticleEffect effect = fixedEffect.getParticlePair().getEffect();
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) {
|
||||
noteColorData = inputParser.next(NoteColor.class);
|
||||
if (noteColorData == null) {
|
||||
|
@ -334,20 +335,18 @@ public class FixedCommandModule implements CommandModule {
|
|||
return;
|
||||
}
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
blockData = inputParser.next(Material.class);
|
||||
if (blockData == null || !blockData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "fixed-edit-data-error");
|
||||
return;
|
||||
}
|
||||
} else if (effect == ParticleEffect.ITEM) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
itemData = inputParser.next(Material.class);
|
||||
if (itemData == null || itemData.isBlock()) {
|
||||
localeManager.sendMessage(pplayer, "fixed-edit-data-error");
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
localeManager.sendMessage(pplayer, "fixed-edit-data-none");
|
||||
return;
|
||||
|
@ -434,6 +433,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
* @param args The command arguments
|
||||
*/
|
||||
private void handleInfo(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
if (args.length < 1) {
|
||||
|
@ -463,7 +463,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
.addPlaceholder("x", df.format(fixedEffect.getLocation().getX()))
|
||||
.addPlaceholder("y", df.format(fixedEffect.getLocation().getY()))
|
||||
.addPlaceholder("z", df.format(fixedEffect.getLocation().getZ()))
|
||||
.addPlaceholder("effect", particle.getEffect().getName())
|
||||
.addPlaceholder("effect", particleManager.getEffectSettings(particle.getEffect()).getName())
|
||||
.addPlaceholder("style", particle.getStyle().getName())
|
||||
.addPlaceholder("data", particle.getDataString())
|
||||
.build();
|
||||
|
@ -556,6 +556,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
}
|
||||
|
||||
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
PermissionManager permissionManager = PlayerParticles.getInstance().getManager(PermissionManager.class);
|
||||
List<String> matches = new ArrayList<>();
|
||||
Player player = pplayer.getPlayer();
|
||||
|
@ -623,9 +624,9 @@ public class FixedCommandModule implements CommandModule {
|
|||
} else if (args.length == 6) {
|
||||
StringUtil.copyPartialMatches(args[5], permissionManager.getFixableStyleNamesUserHasPermissionFor(pplayer), matches);
|
||||
} else if (args.length >= 7) {
|
||||
ParticleEffect effect = ParticleEffect.fromName(args[4]);
|
||||
ParticleEffect effect = particleManager.getEffectFromName(args[4]);
|
||||
if (effect != null) {
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
List<String> possibleValues = new ArrayList<>();
|
||||
if (effect == ParticleEffect.NOTE) { // Note data
|
||||
if (args.length == 7) {
|
||||
|
@ -645,15 +646,13 @@ public class FixedCommandModule implements CommandModule {
|
|||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
} else if (args.length == 7 && effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) { // Block material
|
||||
} else if (args.length == 7 && effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[6], ParticleUtils.getAllBlockMaterials(), matches);
|
||||
} else if (effect == ParticleEffect.ITEM) { // Item material
|
||||
} else if (args.length == 7 && effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[6], ParticleUtils.getAllItemMaterials(), matches);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "edit":
|
||||
if (args.length == 2) {
|
||||
|
@ -704,7 +703,7 @@ public class FixedCommandModule implements CommandModule {
|
|||
FixedParticleEffect fixedEffect = pplayer.getFixedEffectById(id);
|
||||
if (fixedEffect != null) {
|
||||
ParticleEffect effect = fixedEffect.getParticlePair().getEffect();
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
List<String> possibleValues = new ArrayList<>();
|
||||
if (effect == ParticleEffect.NOTE) { // Note data
|
||||
if (args.length == 4) {
|
||||
|
@ -724,16 +723,14 @@ public class FixedCommandModule implements CommandModule {
|
|||
}
|
||||
}
|
||||
StringUtil.copyPartialMatches(args[args.length - 1], possibleValues, matches);
|
||||
} else if (args.length == 4 && effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) { // Block material
|
||||
} else if (args.length == 4 && effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[3], ParticleUtils.getAllBlockMaterials(), matches);
|
||||
} else if (effect == ParticleEffect.ITEM) { // Item material
|
||||
} else if (args.length == 4 && effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
StringUtil.copyPartialMatches(args[3], ParticleUtils.getAllItemMaterials(), matches);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case "remove":
|
||||
case "info":
|
|
@ -1,11 +1,11 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -1,14 +1,15 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleGroupPresetManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroupPreset;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
@ -213,6 +214,7 @@ public class GroupCommandModule implements CommandModule {
|
|||
* @param groupName The target group name
|
||||
*/
|
||||
private void onInfo(PPlayer pplayer, String groupName) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
// Check that the groupName isn't the reserved name
|
||||
|
@ -244,7 +246,7 @@ public class GroupCommandModule implements CommandModule {
|
|||
localeManager.sendMessage(pplayer, "group-info-header", StringPlaceholders.single("group", groupName));
|
||||
for (ParticlePair particle : particles) {
|
||||
StringPlaceholders stringPlaceholders = StringPlaceholders.builder("id", particle.getId())
|
||||
.addPlaceholder("effect", particle.getEffect().getName())
|
||||
.addPlaceholder("effect", particleManager.getEffectSettings(particle.getEffect()).getName())
|
||||
.addPlaceholder("style", particle.getStyle().getName())
|
||||
.addPlaceholder("data", particle.getDataString())
|
||||
.build();
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.CommandManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -1,9 +1,10 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
|
@ -12,6 +13,7 @@ import java.util.List;
|
|||
public class ListCommandModule implements CommandModule {
|
||||
|
||||
public void onCommandExecute(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
List<ParticlePair> particles = new ArrayList<>(pplayer.getActiveParticles());
|
||||
|
@ -25,7 +27,7 @@ public class ListCommandModule implements CommandModule {
|
|||
localeManager.sendMessage(pplayer, "list-you-have");
|
||||
for (ParticlePair particle : particles) {
|
||||
StringPlaceholders stringPlaceholders = StringPlaceholders.builder("id", particle.getId())
|
||||
.addPlaceholder("effect", particle.getEffect().getName())
|
||||
.addPlaceholder("effect", particleManager.getEffectSettings(particle.getEffect()).getName())
|
||||
.addPlaceholder("style", particle.getStyle().getName())
|
||||
.addPlaceholder("data", particle.getDataString())
|
||||
.build();
|
|
@ -1,12 +1,12 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.CommandManager;
|
||||
import dev.esophose.playerparticles.manager.DataManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.OtherPPlayer;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
|
@ -1,11 +1,11 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleStyleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.styles.DefaultStyles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
@ -19,7 +19,6 @@ public class ReloadCommandModule implements CommandModule {
|
|||
LocaleManager localeManager = playerParticles.getManager(LocaleManager.class);
|
||||
if (playerParticles.getManager(PermissionManager.class).canReloadPlugin(pplayer.getUnderlyingExecutor())) {
|
||||
playerParticles.reload();
|
||||
ParticleEffect.reloadSettings();
|
||||
DefaultStyles.reloadSettings(playerParticles.getManager(ParticleStyleManager.class));
|
||||
localeManager.sendMessage(pplayer, "reload-success");
|
||||
playerParticles.getLogger().info("Reloaded configuration.");
|
|
@ -1,12 +1,13 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
|
@ -19,6 +20,7 @@ import org.bukkit.util.StringUtil;
|
|||
public class RemoveCommandModule implements CommandModule {
|
||||
|
||||
public void onCommandExecute(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
|
||||
if (args.length == 0) {
|
||||
|
@ -51,7 +53,7 @@ public class RemoveCommandModule implements CommandModule {
|
|||
PlayerParticlesAPI.getInstance().savePlayerParticleGroup(pplayer.getPlayer(), activeGroup);
|
||||
localeManager.sendMessage(pplayer, "remove-id-success", StringPlaceholders.single("id", id));
|
||||
} else { // Removing by effect/style name
|
||||
ParticleEffect effect = ParticleEffect.fromName(args[0]);
|
||||
ParticleEffect effect = particleManager.getEffectFromName(args[0]);
|
||||
ParticleStyle style = ParticleStyle.fromName(args[0]);
|
||||
|
||||
if (effect != null) {
|
||||
|
@ -65,9 +67,9 @@ public class RemoveCommandModule implements CommandModule {
|
|||
|
||||
if (toRemove.size() > 0) {
|
||||
PlayerParticlesAPI.getInstance().savePlayerParticleGroup(pplayer.getPlayer(), activeGroup);
|
||||
localeManager.sendMessage(pplayer, "remove-effect-success", StringPlaceholders.builder("amount", toRemove.size()).addPlaceholder("effect", effect.getName()).build());
|
||||
localeManager.sendMessage(pplayer, "remove-effect-success", StringPlaceholders.builder("amount", toRemove.size()).addPlaceholder("effect", particleManager.getEffectSettings(effect).getName()).build());
|
||||
} else {
|
||||
localeManager.sendMessage(pplayer, "remove-effect-none", StringPlaceholders.single("effect", effect.getName()));
|
||||
localeManager.sendMessage(pplayer, "remove-effect-none", StringPlaceholders.single("effect", particleManager.getEffectSettings(effect).getName()));
|
||||
}
|
||||
} else if (style != null) {
|
||||
Set<Integer> toRemove = new HashSet<>();
|
||||
|
@ -91,12 +93,14 @@ public class RemoveCommandModule implements CommandModule {
|
|||
}
|
||||
|
||||
public List<String> onTabComplete(PPlayer pplayer, String[] args) {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
|
||||
List<String> matches = new ArrayList<>();
|
||||
Set<String> removeBy = new HashSet<>();
|
||||
|
||||
for (ParticlePair particle : pplayer.getActiveParticles()) {
|
||||
removeBy.add(String.valueOf(particle.getId()));
|
||||
removeBy.add(particle.getEffect().getName());
|
||||
removeBy.add(particleManager.getEffectSettings(particle.getEffect()).getName());
|
||||
removeBy.add(particle.getStyle().getName());
|
||||
}
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.command;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -191,6 +191,18 @@ public class CommentedConfigurationSection implements ConfigurationSection {
|
|||
return this.config.isDouble(s);
|
||||
}
|
||||
|
||||
public float getFloat(String s) {
|
||||
return (float) this.config.getDouble(s);
|
||||
}
|
||||
|
||||
public float getFloat(String s, float v) {
|
||||
return (float) this.config.getDouble(s, v);
|
||||
}
|
||||
|
||||
public boolean isFloat(String s) {
|
||||
return this.config.isDouble(s);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLong(String s) {
|
||||
return this.config.getLong(s);
|
|
@ -19,7 +19,7 @@ public class MySQLConnector implements DatabaseConnector {
|
|||
config.setJdbcUrl("jdbc:mysql://" + hostname + ":" + port + "/" + database + "?useSSL=" + useSSL);
|
||||
config.setUsername(username);
|
||||
config.setPassword(password);
|
||||
config.setMaximumPoolSize(5);
|
||||
config.setMaximumPoolSize(2);
|
||||
|
||||
try {
|
||||
this.hikari = new HikariDataSource(config);
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
|
@ -1,18 +1,18 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleGroupPresetManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -110,7 +110,7 @@ public class GuiInventoryDefault extends GuiInventory {
|
|||
|
||||
final ParticlePair editingParticle = pplayer.getPrimaryParticle();
|
||||
boolean canEditPrimaryStyleAndData = pplayer.getActiveParticle(1) != null;
|
||||
boolean doesEffectUseData = editingParticle.getEffect().hasProperty(ParticleProperty.COLORABLE) || editingParticle.getEffect().hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA);
|
||||
boolean doesEffectUseData = editingParticle.getEffect().hasProperties();
|
||||
|
||||
// Edit Primary Effect
|
||||
GuiActionButton editPrimaryEffect = new GuiActionButton(
|
|
@ -6,10 +6,10 @@ import dev.esophose.playerparticles.manager.GuiManager;
|
|||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.util.NMSUtil;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
|
@ -147,19 +147,17 @@ public class GuiInventoryEditData extends GuiInventory {
|
|||
|
||||
this.fillBorder(BorderColor.MAGENTA);
|
||||
|
||||
ParticleEffect pe = editingParticle.getEffect();
|
||||
if (pe.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (pe == ParticleEffect.NOTE) { // Note data
|
||||
ParticleEffect effect = editingParticle.getEffect();
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) { // Note data
|
||||
this.populateNoteData(editingParticle, pageNumber, callbackList, callbackListPosition);
|
||||
} else { // Color data
|
||||
this.populateColorData(editingParticle, pageNumber, callbackList, callbackListPosition);
|
||||
}
|
||||
} else if (pe.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (pe == ParticleEffect.ITEM) { // Item data
|
||||
this.populateItemData(editingParticle, pageNumber, callbackList, callbackListPosition);
|
||||
} else { // Block data
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
this.populateBlockData(editingParticle, pageNumber, callbackList, callbackListPosition);
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
this.populateItemData(editingParticle, pageNumber, callbackList, callbackListPosition);
|
||||
}
|
||||
|
||||
// Back Button
|
|
@ -1,15 +1,17 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffectSettings;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
|
||||
|
@ -18,6 +20,7 @@ public class GuiInventoryEditEffect extends GuiInventory {
|
|||
public GuiInventoryEditEffect(PPlayer pplayer, ParticlePair editingParticle, int pageNumber, List<Runnable> callbackList, int callbackListPosition) {
|
||||
super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, PlayerParticles.getInstance().getManager(LocaleManager.class).getLocaleMessage("gui-select-effect")));
|
||||
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
GuiManager guiManager = PlayerParticles.getInstance().getManager(GuiManager.class);
|
||||
|
||||
|
@ -34,11 +37,12 @@ public class GuiInventoryEditEffect extends GuiInventory {
|
|||
|
||||
for (int i = (pageNumber - 1) * itemsPerPage; i < numberOfItems; i++) {
|
||||
ParticleEffect effect = effectsUserHasPermissionFor.get(i);
|
||||
ParticleEffectSettings effectSettings = particleManager.getEffectSettings(effect);
|
||||
GuiActionButton selectButton = new GuiActionButton(
|
||||
slot,
|
||||
GuiIcon.EFFECT.get(effect.getInternalName()),
|
||||
localeManager.getLocaleMessage("gui-color-icon-name") + ParticleUtils.formatName(effect.getName()),
|
||||
new String[]{localeManager.getLocaleMessage("gui-color-info") + localeManager.getLocaleMessage("gui-select-effect-description", StringPlaceholders.single("effect", ParticleUtils.formatName(effect.getName())))},
|
||||
GuiIcon.EFFECT.get(effectSettings.getInternalName()),
|
||||
localeManager.getLocaleMessage("gui-color-icon-name") + ParticleUtils.formatName(effectSettings.getName()),
|
||||
new String[]{localeManager.getLocaleMessage("gui-color-info") + localeManager.getLocaleMessage("gui-select-effect-description", StringPlaceholders.single("effect", ParticleUtils.formatName(effectSettings.getName())))},
|
||||
(button, isShiftClick) -> {
|
||||
editingParticle.setEffect(effect);
|
||||
callbackList.get(callbackListPosition + 1).run();
|
|
@ -1,15 +1,15 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
|
@ -19,6 +19,7 @@ public class GuiInventoryEditParticle extends GuiInventory {
|
|||
public GuiInventoryEditParticle(PPlayer pplayer, ParticlePair editingParticle) {
|
||||
super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, PlayerParticles.getInstance().getManager(LocaleManager.class).getLocaleMessage("gui-editing-particle", StringPlaceholders.single("id", editingParticle.getId()))));
|
||||
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
GuiManager guiManager = PlayerParticles.getInstance().getManager(GuiManager.class);
|
||||
|
||||
|
@ -26,7 +27,7 @@ public class GuiInventoryEditParticle extends GuiInventory {
|
|||
|
||||
// Particle Info Icon
|
||||
StringPlaceholders stringPlaceholders = StringPlaceholders.builder("id", editingParticle.getId())
|
||||
.addPlaceholder("effect", editingParticle.getEffect().getName())
|
||||
.addPlaceholder("effect", particleManager.getEffectSettings(editingParticle.getEffect()).getName())
|
||||
.addPlaceholder("style", editingParticle.getStyle().getName())
|
||||
.addPlaceholder("data", editingParticle.getDataString())
|
||||
.build();
|
||||
|
@ -93,7 +94,7 @@ public class GuiInventoryEditParticle extends GuiInventory {
|
|||
this.actionButtons.add(editStyleButton);
|
||||
|
||||
// Edit Data Button
|
||||
boolean usesData = editingParticle.getEffect().hasProperty(ParticleProperty.COLORABLE) || editingParticle.getEffect().hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA);
|
||||
boolean usesData = editingParticle.getEffect().hasProperties();
|
||||
GuiActionButton editDataButton = new GuiActionButton(42,
|
||||
GuiIcon.EDIT_DATA.get(),
|
||||
localeManager.getLocaleMessage("gui-color-icon-name") + localeManager.getLocaleMessage("gui-edit-data"),
|
|
@ -1,6 +1,5 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
|
@ -10,6 +9,7 @@ import dev.esophose.playerparticles.particles.ParticlePair;
|
|||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
|
|
@ -1,18 +1,19 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleGroupPresetManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroupPreset;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -23,6 +24,7 @@ public class GuiInventoryLoadPresetGroups extends GuiInventory {
|
|||
public GuiInventoryLoadPresetGroups(PPlayer pplayer, boolean isEndPoint) {
|
||||
super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, PlayerParticles.getInstance().getManager(LocaleManager.class).getLocaleMessage("gui-load-a-preset-group")));
|
||||
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
GuiManager guiManager = PlayerParticles.getInstance().getManager(GuiManager.class);
|
||||
|
||||
|
@ -44,7 +46,7 @@ public class GuiInventoryLoadPresetGroups extends GuiInventory {
|
|||
int i = 1;
|
||||
for (ParticlePair particle : particles) {
|
||||
StringPlaceholders stringPlaceholders = StringPlaceholders.builder("id", particle.getId())
|
||||
.addPlaceholder("effect", ParticleUtils.formatName(particle.getEffect().getName()))
|
||||
.addPlaceholder("effect", ParticleUtils.formatName(particleManager.getEffectSettings(particle.getEffect()).getName()))
|
||||
.addPlaceholder("style", ParticleUtils.formatName(particle.getStyle().getName()))
|
||||
.addPlaceholder("data", particle.getDataString())
|
||||
.build();
|
|
@ -1,19 +1,20 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.gui.hook.PlayerChatHook;
|
||||
import dev.esophose.playerparticles.gui.hook.PlayerChatHookData;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -26,6 +27,7 @@ public class GuiInventoryManageGroups extends GuiInventory {
|
|||
public GuiInventoryManageGroups(PPlayer pplayer) {
|
||||
super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, PlayerParticles.getInstance().getManager(LocaleManager.class).getLocaleMessage("gui-manage-your-groups")));
|
||||
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
GuiManager guiManager = PlayerParticles.getInstance().getManager(GuiManager.class);
|
||||
|
||||
|
@ -48,7 +50,7 @@ public class GuiInventoryManageGroups extends GuiInventory {
|
|||
int i = 1;
|
||||
for (ParticlePair particle : particles) {
|
||||
StringPlaceholders stringPlaceholders = StringPlaceholders.builder("id", particle.getId())
|
||||
.addPlaceholder("effect", ParticleUtils.formatName(particle.getEffect().getName()))
|
||||
.addPlaceholder("effect", ParticleUtils.formatName(particleManager.getEffectSettings(particle.getEffect()).getName()))
|
||||
.addPlaceholder("style", ParticleUtils.formatName(particle.getStyle().getName()))
|
||||
.addPlaceholder("data", particle.getDataString())
|
||||
.build();
|
|
@ -1,17 +1,17 @@
|
|||
package dev.esophose.playerparticles.gui;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.GuiIcon;
|
||||
import dev.esophose.playerparticles.manager.GuiManager;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
@ -22,6 +22,7 @@ public class GuiInventoryManageParticles extends GuiInventory {
|
|||
public GuiInventoryManageParticles(PPlayer pplayer) {
|
||||
super(pplayer, Bukkit.createInventory(pplayer.getPlayer(), INVENTORY_SIZE, PlayerParticles.getInstance().getManager(LocaleManager.class).getLocaleMessage("gui-manage-your-particles")));
|
||||
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
LocaleManager localeManager = PlayerParticles.getInstance().getManager(LocaleManager.class);
|
||||
GuiManager guiManager = PlayerParticles.getInstance().getManager(GuiManager.class);
|
||||
|
||||
|
@ -36,7 +37,7 @@ public class GuiInventoryManageParticles extends GuiInventory {
|
|||
int maxIndex = 35;
|
||||
for (ParticlePair particle : particles) {
|
||||
StringPlaceholders stringPlaceholders = StringPlaceholders.builder("id", particle.getId())
|
||||
.addPlaceholder("effect", ParticleUtils.formatName(particle.getEffect().getName()))
|
||||
.addPlaceholder("effect", ParticleUtils.formatName(particleManager.getEffectSettings(particle.getEffect()).getName()))
|
||||
.addPlaceholder("style", ParticleUtils.formatName(particle.getStyle().getName()))
|
||||
.addPlaceholder("data", particle.getDataString())
|
||||
.build();
|
||||
|
@ -89,7 +90,7 @@ public class GuiInventoryManageParticles extends GuiInventory {
|
|||
callbacks.add(() -> guiManager.transition(new GuiInventoryEditEffect(pplayer, editingParticle, 1, callbacks, 1)));
|
||||
callbacks.add(() -> guiManager.transition(new GuiInventoryEditStyle(pplayer, editingParticle, 1, callbacks, 2)));
|
||||
callbacks.add(() -> {
|
||||
if (editingParticle.getEffect().hasProperty(ParticleProperty.COLORABLE) || editingParticle.getEffect().hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (editingParticle.getEffect().hasProperties()) {
|
||||
guiManager.transition(new GuiInventoryEditData(pplayer, editingParticle, 1, callbacks, 3));
|
||||
} else {
|
||||
callbacks.get(4).run();
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.gui.hook;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.util.NMSUtil;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
|
@ -1,9 +1,10 @@
|
|||
package dev.esophose.playerparticles.hook;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.DataManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -46,7 +47,8 @@ public class ParticlePlaceholderExpansion extends PlaceholderExpansion {
|
|||
return null;
|
||||
|
||||
if (placeholder.startsWith("particle_effect_")) {
|
||||
return particle.getEffect().getName();
|
||||
ParticleManager particleManager = this.playerParticles.getManager(ParticleManager.class);
|
||||
return particleManager.getEffectSettings(particle.getEffect()).getName();
|
||||
} else if (placeholder.startsWith("particle_style_")) {
|
||||
return particle.getStyle().getName();
|
||||
} else if (placeholder.startsWith("particle_data_")) {
|
|
@ -1,5 +1,6 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.api.PlayerParticlesAPI;
|
||||
import dev.esophose.playerparticles.command.AddCommandModule;
|
||||
|
@ -22,7 +23,6 @@ import dev.esophose.playerparticles.command.StylesCommandModule;
|
|||
import dev.esophose.playerparticles.command.ToggleCommandModule;
|
||||
import dev.esophose.playerparticles.command.VersionCommandModule;
|
||||
import dev.esophose.playerparticles.command.WorldsCommandModule;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
|
@ -55,7 +55,7 @@ public class ConfigurationManager extends Manager {
|
|||
PARTICLE_RENDER_RANGE_FIXED_EFFECT("particle-render-range-fixed-effect", 192, "From how many blocks away should a player be able to see the particles from a fixed effect?"),
|
||||
RAINBOW_CYCLE_SPEED("rainbow-cycle-speed", 2, "How many out of 360 hue ticks to move per game tick", "Higher values make the rainbow cycle faster", "Note: Must be a positive whole number"),
|
||||
DUST_SIZE("dust-size", 1.0, "How large should dust particles appear?", "Note: Can include decimals", "Only works in 1.13+"),
|
||||
|
||||
OVERRIDE_PARTICLE_VERSION("override-particle-version", -1, "Allows you to override the version of Minecraft that will be assumed for spawning particles", "This should follow this format: 9, 12, 15, etc. 9 means 1.9, 14 means 1.14... and so on"),
|
||||
MYSQL_SETTINGS("mysql-settings", null, "Settings for if you want to use MySQL for data management"),
|
||||
MYSQL_ENABLED("mysql-settings.enabled", false, "Enable MySQL", "If false, SQLite will be used instead"),
|
||||
MYSQL_HOSTNAME("mysql-settings.hostname", "", "MySQL Database Hostname"),
|
|
@ -1,18 +1,18 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.database.DatabaseConnector;
|
||||
import dev.esophose.playerparticles.database.MySQLConnector;
|
||||
import dev.esophose.playerparticles.database.SQLiteConnector;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.ConsolePPlayer;
|
||||
import dev.esophose.playerparticles.particles.FixedParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import java.sql.PreparedStatement;
|
||||
|
@ -147,7 +147,7 @@ public class DataManager extends Manager {
|
|||
|
||||
// Particle properties
|
||||
int id = result.getInt("id");
|
||||
ParticleEffect effect = ParticleEffect.fromInternalName(result.getString("effect"));
|
||||
ParticleEffect effect = this.playerParticles.getManager(ParticleManager.class).getEffectFromInternalName(result.getString("effect"));
|
||||
ParticleStyle style = ParticleStyle.fromInternalName(result.getString("style"));
|
||||
Material itemMaterial = ParticleUtils.closestMatchWithFallback(true, result.getString("item_material"));
|
||||
Material blockMaterial = ParticleUtils.closestMatchWithFallback(true, result.getString("block_material"));
|
||||
|
@ -212,7 +212,7 @@ public class DataManager extends Manager {
|
|||
|
||||
// Particle properties
|
||||
int particleId = result.getInt("p_id");
|
||||
ParticleEffect effect = ParticleEffect.fromInternalName(result.getString("effect"));
|
||||
ParticleEffect effect = this.playerParticles.getManager(ParticleManager.class).getEffectFromInternalName(result.getString("effect"));
|
||||
ParticleStyle style = ParticleStyle.fromInternalName(result.getString("style"));
|
||||
Material itemMaterial = ParticleUtils.closestMatchWithFallback(true, result.getString("item_material"));
|
||||
Material blockMaterial = ParticleUtils.closestMatchWithFallback(true, result.getString("block_material"));
|
||||
|
@ -347,7 +347,7 @@ public class DataManager extends Manager {
|
|||
particlesStatement.setString(1, UUID.randomUUID().toString());
|
||||
particlesStatement.setString(2, groupUUID);
|
||||
particlesStatement.setInt(3, particle.getId());
|
||||
particlesStatement.setString(4, particle.getEffect().getInternalName());
|
||||
particlesStatement.setString(4, this.playerParticles.getManager(ParticleManager.class).getEffectSettings(particle.getEffect()).getInternalName());
|
||||
particlesStatement.setString(5, particle.getStyle().getInternalName());
|
||||
particlesStatement.setString(6, particle.getItemMaterial().name());
|
||||
particlesStatement.setString(7, particle.getBlockMaterial().name());
|
||||
|
@ -418,7 +418,7 @@ public class DataManager extends Manager {
|
|||
ParticlePair particle = fixedEffect.getParticlePair();
|
||||
statement.setString(1, particleUUID);
|
||||
statement.setInt(2, fixedEffect.getId());
|
||||
statement.setString(3, particle.getEffect().getInternalName());
|
||||
statement.setString(3, this.playerParticles.getManager(ParticleManager.class).getEffectSettings(particle.getEffect()).getInternalName());
|
||||
statement.setString(4, particle.getStyle().getInternalName());
|
||||
statement.setString(5, particle.getItemMaterial().name());
|
||||
statement.setString(6, particle.getBlockMaterial().name());
|
||||
|
@ -467,7 +467,7 @@ public class DataManager extends Manager {
|
|||
"WHERE uuid = (SELECT particle_uuid FROM " + this.getTablePrefix() + "fixed WHERE owner_uuid = ? AND id = ?)";
|
||||
try (PreparedStatement statement = connection.prepareStatement(particleUpdateQuery)) {
|
||||
ParticlePair particle = fixedEffect.getParticlePair();
|
||||
statement.setString(1, particle.getEffect().getInternalName());
|
||||
statement.setString(1, this.playerParticles.getManager(ParticleManager.class).getEffectSettings(particle.getEffect()).getInternalName());
|
||||
statement.setString(2, particle.getStyle().getInternalName());
|
||||
statement.setString(3, particle.getItemMaterial().name());
|
||||
statement.setString(4, particle.getBlockMaterial().name());
|
|
@ -1,10 +1,10 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.database.DataMigration;
|
||||
import dev.esophose.playerparticles.database.DatabaseConnector;
|
||||
import dev.esophose.playerparticles.database.SQLiteConnector;
|
||||
import dev.esophose.playerparticles.database.migrations._1_InitialMigration;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Arrays;
|
|
@ -1,11 +1,11 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.gui.GuiInventory;
|
||||
import dev.esophose.playerparticles.gui.GuiInventoryDefault;
|
||||
import dev.esophose.playerparticles.gui.GuiInventoryLoadPresetGroups;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
|
@ -1,5 +1,6 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.hook.PlaceholderAPIHook;
|
||||
|
@ -11,7 +12,6 @@ import dev.esophose.playerparticles.locale.RussianLocale;
|
|||
import dev.esophose.playerparticles.locale.SimplifiedChineseLocale;
|
||||
import dev.esophose.playerparticles.locale.VietnameseLocale;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.util.StringPlaceholders;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
|
@ -1,14 +1,14 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroup;
|
||||
import dev.esophose.playerparticles.particles.ParticleGroupPreset;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.inputparser.InputParser;
|
||||
import java.io.File;
|
||||
|
@ -119,7 +119,7 @@ public class ParticleGroupPresetManager extends Manager {
|
|||
String[] args = dataString.split(" ");
|
||||
InputParser inputParser = new InputParser(null, args);
|
||||
|
||||
if (effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (effect == ParticleEffect.NOTE) {
|
||||
noteColorData = inputParser.next(NoteColor.class);
|
||||
if (noteColorData == null) {
|
||||
|
@ -133,14 +133,13 @@ public class ParticleGroupPresetManager extends Manager {
|
|||
throw new Exception();
|
||||
}
|
||||
}
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (effect == ParticleEffect.BLOCK || effect == ParticleEffect.FALLING_DUST) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
blockData = inputParser.next(Material.class);
|
||||
if (blockData == null || !blockData.isBlock()) {
|
||||
PlayerParticles.getInstance().getLogger().severe("Invalid block: '" + dataString + "'!");
|
||||
throw new Exception();
|
||||
}
|
||||
} else if (effect == ParticleEffect.ITEM) {
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
itemData = inputParser.next(Material.class);
|
||||
if (itemData == null || itemData.isBlock()) {
|
||||
PlayerParticles.getInstance().getLogger().severe("Invalid item: '" + dataString + "'!");
|
||||
|
@ -148,7 +147,6 @@ public class ParticleGroupPresetManager extends Manager {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
particles.put(id, new ParticlePair(null, id, effect, style, itemData, blockData, colorData, noteColorData));
|
||||
}
|
|
@ -2,25 +2,38 @@ package dev.esophose.playerparticles.manager;
|
|||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.nms.wrapper.ParticleHandler;
|
||||
import dev.esophose.playerparticles.particles.ConsolePPlayer;
|
||||
import dev.esophose.playerparticles.particles.FixedParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffectSettings;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.color.ParticleColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.particles.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.version.VersionMapping;
|
||||
import dev.esophose.playerparticles.styles.DefaultStyles;
|
||||
import dev.esophose.playerparticles.util.NMSUtil;
|
||||
import java.awt.Color;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Random;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Particle.DustOptions;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -28,6 +41,9 @@ import org.bukkit.event.EventPriority;
|
|||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class ParticleManager extends Manager implements Listener, Runnable {
|
||||
|
@ -42,6 +58,9 @@ public class ParticleManager extends Manager implements Listener, Runnable {
|
|||
*/
|
||||
private BukkitTask particleTask;
|
||||
|
||||
private ParticleHandler particleHandler;
|
||||
private Map<ParticleEffect, ParticleEffectSettings> supportedParticleEffects;
|
||||
|
||||
/**
|
||||
* Rainbow particle effect hue and note color used for rainbow colorable effects
|
||||
*/
|
||||
|
@ -66,6 +85,14 @@ public class ParticleManager extends Manager implements Listener, Runnable {
|
|||
if (this.particleTask != null)
|
||||
this.particleTask.cancel();
|
||||
|
||||
int overrideVersion = Setting.OVERRIDE_PARTICLE_VERSION.getInt();
|
||||
VersionMapping versionMapping = VersionMapping.getVersionMapping(overrideVersion != -1 ? overrideVersion : NMSUtil.getVersionNumber());
|
||||
this.particleHandler = NMSUtil.getHandler(versionMapping);
|
||||
|
||||
this.supportedParticleEffects = new HashMap<>();
|
||||
for (ParticleEffect particleEffect : versionMapping.getParticleEffectNameMapping().keySet())
|
||||
this.supportedParticleEffects.put(particleEffect, new ParticleEffectSettings(particleEffect));
|
||||
|
||||
Bukkit.getScheduler().runTaskLater(this.playerParticles, () -> {
|
||||
long ticks = Setting.TICKS_PER_PARTICLE.getLong();
|
||||
this.particleTask = Bukkit.getScheduler().runTaskTimerAsynchronously(this.playerParticles, this, 5, ticks);
|
||||
|
@ -132,6 +159,7 @@ public class ParticleManager extends Manager implements Listener, Runnable {
|
|||
* The main loop to display all the particles
|
||||
* Does not display particles if the world is disabled or if the player is in spectator mode
|
||||
*/
|
||||
@Override
|
||||
public void run() {
|
||||
this.playerParticles.getManager(ParticleStyleManager.class).updateTimers();
|
||||
|
||||
|
@ -175,32 +203,34 @@ public class ParticleManager extends Manager implements Listener, Runnable {
|
|||
if (Setting.TOGGLE_ON_COMBAT.getBoolean() && pplayer.isInCombat())
|
||||
return;
|
||||
|
||||
List<PParticle> particles;
|
||||
if (Setting.TOGGLE_ON_MOVE.getBoolean() && particle.getStyle().canToggleWithMovement() && pplayer.isMoving()) {
|
||||
for (PParticle pparticle : DefaultStyles.FEET.getParticles(particle, location))
|
||||
ParticleEffect.display(particle, pparticle, particle.getStyle().hasLongRangeVisibility(), pplayer.getPlayer());
|
||||
particles = DefaultStyles.FEET.getParticles(particle, location);
|
||||
} else {
|
||||
for (PParticle pparticle : particle.getStyle().getParticles(particle, location))
|
||||
ParticleEffect.display(particle, pparticle, particle.getStyle().hasLongRangeVisibility(), pplayer.getPlayer());
|
||||
particles = particle.getStyle().getParticles(particle, location);
|
||||
}
|
||||
|
||||
for (PParticle pparticle : particles)
|
||||
this.displayParticles(particle, pparticle, particle.getStyle().hasLongRangeVisibility(), pplayer.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* An alternative method used for event styles
|
||||
*
|
||||
* @param player The player the particles are spawning from, nullable for special cases
|
||||
* @param source The player the particles are spawning from, nullable for special cases
|
||||
* @param world The world the particles are spawning in
|
||||
* @param particle The ParticlePair to use for getting particle settings
|
||||
* @param particles The particles to display
|
||||
* @param isLongRange If the particle can be viewed from long range
|
||||
*/
|
||||
public void displayParticles(Player player, World world, ParticlePair particle, List<PParticle> particles, boolean isLongRange) {
|
||||
public void displayParticles(Player source, World world, ParticlePair particle, List<PParticle> particles, boolean isLongRange) {
|
||||
PermissionManager permissionManager = this.playerParticles.getManager(PermissionManager.class);
|
||||
if ((player != null && player.getGameMode() == GameMode.SPECTATOR) || !permissionManager.isWorldEnabled(world.getName()))
|
||||
if ((source != null && source.getGameMode() == GameMode.SPECTATOR) || !permissionManager.isWorldEnabled(world.getName()))
|
||||
return;
|
||||
|
||||
for (PParticle pparticle : particles)
|
||||
ParticleEffect.display(particle, pparticle, isLongRange, player);
|
||||
this.displayParticles(particle, pparticle, isLongRange, source);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -211,7 +241,163 @@ public class ParticleManager extends Manager implements Listener, Runnable {
|
|||
private void displayFixedParticleEffect(FixedParticleEffect fixedEffect) {
|
||||
ParticlePair particle = fixedEffect.getParticlePair();
|
||||
for (PParticle pparticle : particle.getStyle().getParticles(particle, fixedEffect.getLocation().clone().add(0, particle.getStyle().getFixedEffectOffset(), 0)))
|
||||
ParticleEffect.display(particle, pparticle, true, null);
|
||||
this.displayParticles(particle, pparticle, true, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* The main internal method for spawning particles
|
||||
*
|
||||
* @param particle The ParticlePair to spawn
|
||||
* @param pparticle The particle data to spawn with
|
||||
* @param isLongRange true if the particle is viewable at long distances, otherwise false
|
||||
* @param owner The owner of the particle, nullable for no online owner
|
||||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
private void displayParticles(ParticlePair particle, PParticle pparticle, boolean isLongRange, Player owner) {
|
||||
ParticleEffect effect = particle.getEffect();
|
||||
int count = pparticle.isDirectional() ? 0 : 1;
|
||||
|
||||
Object data = null;
|
||||
Location center;
|
||||
float offsetX, offsetY, offsetZ;
|
||||
if (effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
if (NMSUtil.getVersionNumber() >= 13) {
|
||||
data = particle.getSpawnMaterial().createBlockData();
|
||||
} else {
|
||||
data = new MaterialData(particle.getSpawnMaterial());
|
||||
}
|
||||
|
||||
center = pparticle.getLocation(false);
|
||||
offsetX = pparticle.getOffsetX();
|
||||
offsetY = pparticle.getOffsetY();
|
||||
offsetZ = pparticle.getOffsetZ();
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
data = new ItemStack(particle.getSpawnMaterial());
|
||||
center = pparticle.getLocation(false);
|
||||
offsetX = pparticle.getOffsetX();
|
||||
offsetY = pparticle.getOffsetY();
|
||||
offsetZ = pparticle.getOffsetZ();
|
||||
} else if (effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
center = pparticle.getLocation(true);
|
||||
|
||||
ParticleColor color = particle.getSpawnColor();
|
||||
if (effect == ParticleEffect.DUST && NMSUtil.getVersionNumber() >= 13) {
|
||||
OrdinaryColor dustColor = (OrdinaryColor) color;
|
||||
data = new DustOptions(org.bukkit.Color.fromRGB(dustColor.getRed(), dustColor.getGreen(), dustColor.getBlue()), Setting.DUST_SIZE.getFloat());
|
||||
offsetX = 0;
|
||||
offsetY = 0;
|
||||
offsetZ = 0;
|
||||
} else {
|
||||
offsetX = effect == ParticleEffect.DUST && color.getValueX() == 0 ? Float.MIN_VALUE : color.getValueX();
|
||||
offsetY = color.getValueY();
|
||||
offsetZ = color.getValueZ();
|
||||
}
|
||||
} else {
|
||||
center = pparticle.getLocation(false);
|
||||
offsetX = pparticle.getOffsetX();
|
||||
offsetY = pparticle.getOffsetY();
|
||||
offsetZ = pparticle.getOffsetZ();
|
||||
}
|
||||
|
||||
this.particleHandler.spawnParticle(effect, this.getPlayersInRange(center, isLongRange, owner), center, count, offsetX, offsetY, offsetZ, pparticle.getSpeed(), data);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a List of Players within the particle display range
|
||||
*
|
||||
* @param center The center of the radius to check around
|
||||
* @param isLongRange If the particle can be viewed from long range
|
||||
* @param owner The player that owns the particles
|
||||
* @return A List of Players within the particle display range
|
||||
*/
|
||||
private List<Player> getPlayersInRange(Location center, boolean isLongRange, Player owner) {
|
||||
List<Player> players = new ArrayList<>();
|
||||
int range = !isLongRange ? Setting.PARTICLE_RENDER_RANGE_PLAYER.getInt() : Setting.PARTICLE_RENDER_RANGE_FIXED_EFFECT.getInt();
|
||||
range *= range;
|
||||
|
||||
for (PPlayer pplayer : PlayerParticles.getInstance().getManager(ParticleManager.class).getPPlayers()) {
|
||||
Player p = pplayer.getPlayer();
|
||||
if (!this.canSee(p, owner))
|
||||
continue;
|
||||
|
||||
if (p != null && pplayer.canSeeParticles() && p.getWorld().equals(center.getWorld()) && center.distanceSquared(p.getLocation()) <= range)
|
||||
players.add(p);
|
||||
}
|
||||
|
||||
return players;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player can see another player
|
||||
*
|
||||
* @param player The player
|
||||
* @param target The target
|
||||
* @return True if player can see target, otherwise false
|
||||
*/
|
||||
private boolean canSee(Player player, Player target) {
|
||||
if (player == null || target == null)
|
||||
return true;
|
||||
|
||||
for (MetadataValue meta : target.getMetadata("vanished"))
|
||||
if (meta.asBoolean())
|
||||
return false;
|
||||
|
||||
return player.canSee(target);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A sorted List of all enabled ParticleEffects
|
||||
*/
|
||||
public List<ParticleEffect> getEnabledEffects() {
|
||||
return this.getEnabledEffectsStream()
|
||||
.sorted(Comparator.comparing(x -> x.getValue().getName()))
|
||||
.map(Entry::getKey)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the settings for a ParticleEffect
|
||||
*
|
||||
* @param particleEffect The ParticleEffect to get the settings for
|
||||
* @return The settings for a ParticleEffect
|
||||
*/
|
||||
public ParticleEffectSettings getEffectSettings(ParticleEffect particleEffect) {
|
||||
return this.supportedParticleEffects.get(particleEffect);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ParticleEffect with the given name
|
||||
*
|
||||
* @param name Name of the ParticleEffect
|
||||
* @return The ParticleEffect, or null if not found
|
||||
*/
|
||||
public ParticleEffect getEffectFromName(String name) {
|
||||
return this.getEnabledEffectsStream()
|
||||
.filter(x -> x.getValue().getName().equalsIgnoreCase(name))
|
||||
.findFirst()
|
||||
.map(Entry::getKey)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ParticleEffect with the given internal name
|
||||
*
|
||||
* @param internalName Internal name of the particle effect
|
||||
* @return The ParticleEffect, or null if not found
|
||||
*/
|
||||
public ParticleEffect getEffectFromInternalName(String internalName) {
|
||||
return this.getEnabledEffectsStream()
|
||||
.filter(x -> x.getValue().getInternalName().equalsIgnoreCase(internalName))
|
||||
.findFirst()
|
||||
.map(Entry::getKey)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return A stream of enabled ParticleEffects
|
||||
*/
|
||||
private Stream<Entry<ParticleEffect, ParticleEffectSettings>> getEnabledEffectsStream() {
|
||||
return this.supportedParticleEffects.entrySet().stream().filter(x -> x.getValue().isEnabled());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -251,4 +437,5 @@ public class ParticleManager extends Manager implements Listener, Runnable {
|
|||
public NoteColor getRandomNoteParticleColor() {
|
||||
return new NoteColor(this.random.nextInt(25));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,10 +1,10 @@
|
|||
package dev.esophose.playerparticles.manager;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.particles.OtherPPlayer;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ConfigurationManager.Setting;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
@ -76,6 +76,7 @@ public class PermissionManager extends Manager {
|
|||
|
||||
// Register plugin permissions to Bukkit
|
||||
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||
ParticleManager particleManager = this.playerParticles.getManager(ParticleManager.class);
|
||||
|
||||
// Don't register the permissions if we already have, could have happened because of a reload?
|
||||
if (pluginManager.getPermission("playerparticles.*") != null)
|
||||
|
@ -85,8 +86,8 @@ public class PermissionManager extends Manager {
|
|||
|
||||
// Effects
|
||||
Map<String, Boolean> effectPermissions = new HashMap<>();
|
||||
for (ParticleEffect effect : ParticleEffect.values()) {
|
||||
Permission permission = new Permission("playerparticles.effect." + effect.getInternalName());
|
||||
for (ParticleEffect effect : particleManager.getEnabledEffects()) {
|
||||
Permission permission = new Permission("playerparticles.effect." + particleManager.getEffectSettings(effect).getInternalName());
|
||||
pluginManager.addPermission(permission);
|
||||
effectPermissions.put(permission.getName(), true);
|
||||
}
|
||||
|
@ -257,7 +258,8 @@ public class PermissionManager extends Manager {
|
|||
* @return True if the player has permission to use the effect
|
||||
*/
|
||||
public boolean hasEffectPermission(PPlayer player, ParticleEffect effect) {
|
||||
return PPermission.EFFECT.check(player.getUnderlyingExecutor(), effect.getInternalName());
|
||||
ParticleManager particleManager = this.playerParticles.getManager(ParticleManager.class);
|
||||
return PPermission.EFFECT.check(player.getUnderlyingExecutor(), particleManager.getEffectSettings(effect).getInternalName());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -279,10 +281,11 @@ public class PermissionManager extends Manager {
|
|||
* @return A String List of all effect names the given player has permission for
|
||||
*/
|
||||
public List<String> getEffectNamesUserHasPermissionFor(PPlayer p) {
|
||||
ParticleManager particleManager = this.playerParticles.getManager(ParticleManager.class);
|
||||
List<String> list = new ArrayList<>();
|
||||
for (ParticleEffect pe : ParticleEffect.getEnabledEffects())
|
||||
if (this.hasEffectPermission(p, pe))
|
||||
list.add(pe.getName());
|
||||
for (ParticleEffect particleEffect : particleManager.getEnabledEffects())
|
||||
if (this.hasEffectPermission(p, particleEffect))
|
||||
list.add(particleManager.getEffectSettings(particleEffect).getName());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -294,9 +297,9 @@ public class PermissionManager extends Manager {
|
|||
*/
|
||||
public List<String> getStyleNamesUserHasPermissionFor(PPlayer p) {
|
||||
List<String> list = new ArrayList<>();
|
||||
for (ParticleStyle ps : this.playerParticles.getManager(ParticleStyleManager.class).getStyles())
|
||||
if (this.hasStylePermission(p, ps))
|
||||
list.add(ps.getName());
|
||||
for (ParticleStyle particleStyle : this.playerParticles.getManager(ParticleStyleManager.class).getStyles())
|
||||
if (this.hasStylePermission(p, particleStyle))
|
||||
list.add(particleStyle.getName());
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -321,8 +324,9 @@ public class PermissionManager extends Manager {
|
|||
* @return A List of all effects the given player has permission for
|
||||
*/
|
||||
public List<ParticleEffect> getEffectsUserHasPermissionFor(PPlayer p) {
|
||||
ParticleManager particleManager = this.playerParticles.getManager(ParticleManager.class);
|
||||
List<ParticleEffect> list = new ArrayList<>();
|
||||
for (ParticleEffect pe : ParticleEffect.getEnabledEffects())
|
||||
for (ParticleEffect pe : particleManager.getEnabledEffects())
|
||||
if (this.hasEffectPermission(p, pe))
|
||||
list.add(pe);
|
||||
return list;
|
|
@ -8,25 +8,25 @@ public class PParticle {
|
|||
* Data that determines where the particle will spawn
|
||||
*/
|
||||
private Location location;
|
||||
private double speed;
|
||||
private double xOff, yOff, zOff;
|
||||
private boolean directional;
|
||||
private float offsetX, offsetY, offsetZ;
|
||||
private float speed;
|
||||
|
||||
/**
|
||||
* The constructor with all the fancy parameters for customization
|
||||
*
|
||||
* @param location The location to display the particle at
|
||||
* @param xOff The offset for the x-axis
|
||||
* @param yOff The offset for the y-axis
|
||||
* @param zOff The offset for the z-axis
|
||||
* @param offsetX The offset for the x-axis
|
||||
* @param offsetY The offset for the y-axis
|
||||
* @param offsetZ The offset for the z-axis
|
||||
* @param speed The speed the particle will move at
|
||||
* @param directional If the particle should use the x, y, and z offsets as directions instead
|
||||
*/
|
||||
public PParticle(Location location, double xOff, double yOff, double zOff, double speed, boolean directional) {
|
||||
public PParticle(Location location, float offsetX, float offsetY, float offsetZ, float speed, boolean directional) {
|
||||
this.location = location;
|
||||
this.xOff = xOff;
|
||||
this.yOff = yOff;
|
||||
this.zOff = zOff;
|
||||
this.offsetX = offsetX;
|
||||
this.offsetY = offsetY;
|
||||
this.offsetZ = offsetZ;
|
||||
this.speed = speed;
|
||||
this.directional = directional;
|
||||
}
|
||||
|
@ -35,13 +35,13 @@ public class PParticle {
|
|||
* The constructor with all the fancy parameters for customization
|
||||
*
|
||||
* @param location The location to display the particle at
|
||||
* @param xOff The offset for the x-axis
|
||||
* @param yOff The offset for the y-axis
|
||||
* @param zOff The offset for the z-axis
|
||||
* @param offsetX The offset for the x-axis
|
||||
* @param offsetY The offset for the y-axis
|
||||
* @param offsetZ The offset for the z-axis
|
||||
* @param speed The speed the particle will move at
|
||||
*/
|
||||
public PParticle(Location location, double xOff, double yOff, double zOff, double speed) {
|
||||
this(location, xOff, yOff, zOff, speed, false);
|
||||
public PParticle(Location location, float offsetX, float offsetY, float offsetZ, float speed) {
|
||||
this(location, offsetX, offsetY, offsetZ, speed, false);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,22 +70,13 @@ public class PParticle {
|
|||
double y = this.location.getY();
|
||||
double z = this.location.getZ();
|
||||
|
||||
x += this.xOff * 1.75D * (Math.random() > 0.5 ? Math.random() : -Math.random());
|
||||
y += this.yOff * 1.75D * (Math.random() > 0.5 ? Math.random() : -Math.random());
|
||||
z += this.zOff * 1.75D * (Math.random() > 0.5 ? Math.random() : -Math.random());
|
||||
x += this.offsetX * 1.75D * (Math.random() > 0.5 ? Math.random() : -Math.random());
|
||||
y += this.offsetY * 1.75D * (Math.random() > 0.5 ? Math.random() : -Math.random());
|
||||
z += this.offsetZ * 1.75D * (Math.random() > 0.5 ? Math.random() : -Math.random());
|
||||
|
||||
return new Location(this.location.getWorld(), x, y, z);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the speed of the particle
|
||||
*
|
||||
* @return The particle's speed
|
||||
*/
|
||||
public double getSpeed() {
|
||||
return this.speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets if the particle is directional
|
||||
*
|
||||
|
@ -100,8 +91,8 @@ public class PParticle {
|
|||
*
|
||||
* @return The x-axis offset
|
||||
*/
|
||||
public double getXOff() {
|
||||
return this.xOff;
|
||||
public float getOffsetX() {
|
||||
return this.offsetX;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -109,8 +100,8 @@ public class PParticle {
|
|||
*
|
||||
* @return The y-axis offset
|
||||
*/
|
||||
public double getYOff() {
|
||||
return this.yOff;
|
||||
public float getOffsetY() {
|
||||
return this.offsetY;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,8 +109,17 @@ public class PParticle {
|
|||
*
|
||||
* @return The z-axis offset
|
||||
*/
|
||||
public double getZOff() {
|
||||
return this.zOff;
|
||||
public float getOffsetZ() {
|
||||
return this.offsetZ;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the speed of the particle
|
||||
*
|
||||
* @return The particle's speed
|
||||
*/
|
||||
public float getSpeed() {
|
||||
return this.speed;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,105 @@
|
|||
package dev.esophose.playerparticles.particles;
|
||||
|
||||
import com.google.common.collect.ObjectArrays;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class ParticleEffectSettings {
|
||||
|
||||
private static final List<ParticleEffect> disabledByDefaultParticleEffects = Arrays.asList(ParticleEffect.ELDER_GUARDIAN, ParticleEffect.FLASH);
|
||||
|
||||
private ParticleEffect particleEffect;
|
||||
|
||||
private CommentedFileConfiguration config;
|
||||
private boolean enabledByDefault;
|
||||
|
||||
private String effectName;
|
||||
private boolean enabled;
|
||||
|
||||
public ParticleEffectSettings(ParticleEffect particleEffect) {
|
||||
this.particleEffect = particleEffect;
|
||||
this.enabledByDefault = !disabledByDefaultParticleEffects.contains(particleEffect);
|
||||
|
||||
this.setDefaultSettings();
|
||||
this.loadSettings(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default settings for the particle type
|
||||
*/
|
||||
private void setDefaultSettings() {
|
||||
File directory = new File(PlayerParticles.getInstance().getDataFolder(), "effects");
|
||||
directory.mkdirs();
|
||||
|
||||
File file = new File(directory, this.getInternalName() + ".yml");
|
||||
this.config = CommentedFileConfiguration.loadConfiguration(PlayerParticles.getInstance(), file);
|
||||
|
||||
boolean changed = this.setIfNotExists("effect-name", this.getInternalName(), "The name the effect will display as");
|
||||
changed |= this.setIfNotExists("enabled", this.enabledByDefault, "If the effect is enabled or not");
|
||||
|
||||
if (changed)
|
||||
this.config.save();
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads the settings shared for each style then calls loadSettings(CommentedFileConfiguration)
|
||||
*
|
||||
* @param reloadConfig If the settings should be reloaded or not
|
||||
*/
|
||||
public void loadSettings(boolean reloadConfig) {
|
||||
if (reloadConfig)
|
||||
this.setDefaultSettings();
|
||||
|
||||
this.effectName = this.config.getString("effect-name");
|
||||
this.enabled = this.config.getBoolean("enabled");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets a value to the config if it doesn't already exist
|
||||
*
|
||||
* @param setting The setting name
|
||||
* @param value The setting value
|
||||
* @param comments Comments for the setting
|
||||
* @return true if changes were made
|
||||
*/
|
||||
private boolean setIfNotExists(String setting, Object value, String... comments) {
|
||||
if (this.config.get(setting) != null)
|
||||
return false;
|
||||
|
||||
String defaultMessage = "Default: ";
|
||||
if (value instanceof String && ParticleUtils.containsConfigSpecialCharacters((String) value)) {
|
||||
defaultMessage += "'" + value + "'";
|
||||
} else {
|
||||
defaultMessage += value;
|
||||
}
|
||||
|
||||
this.config.set(setting, value, ObjectArrays.concat(comments, new String[] { defaultMessage }, String.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the internal name of this particle effect that will never change
|
||||
*/
|
||||
public String getInternalName() {
|
||||
return this.particleEffect.name().toLowerCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the name that the style will display to the users as
|
||||
*/
|
||||
public String getName() {
|
||||
return this.effectName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if this effect is enabled, otherwise false
|
||||
*/
|
||||
public boolean isEnabled() {
|
||||
return this.enabled;
|
||||
}
|
||||
|
||||
}
|
|
@ -3,10 +3,9 @@ package dev.esophose.playerparticles.particles;
|
|||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.LocaleManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleColor;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect.ParticleProperty;
|
||||
import dev.esophose.playerparticles.particles.color.NoteColor;
|
||||
import dev.esophose.playerparticles.particles.color.OrdinaryColor;
|
||||
import dev.esophose.playerparticles.particles.color.ParticleColor;
|
||||
import dev.esophose.playerparticles.styles.DefaultStyles;
|
||||
import dev.esophose.playerparticles.styles.ParticleStyle;
|
||||
import dev.esophose.playerparticles.util.ParticleUtils;
|
||||
|
@ -205,7 +204,7 @@ public class ParticlePair {
|
|||
public ParticleColor getSpawnColor() {
|
||||
ParticleManager particleManager = PlayerParticles.getInstance().getManager(ParticleManager.class);
|
||||
|
||||
if (this.effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
if (this.effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (this.effect == ParticleEffect.NOTE) {
|
||||
if (this.noteColor.equals(NoteColor.RAINBOW)) {
|
||||
return particleManager.getRainbowNoteParticleColor();
|
||||
|
@ -232,13 +231,11 @@ public class ParticlePair {
|
|||
* @return The Material the current particle effect requires
|
||||
*/
|
||||
public Material getSpawnMaterial() {
|
||||
if (this.effect.hasProperty(ParticleProperty.REQUIRES_MATERIAL_DATA)) {
|
||||
if (this.effect == ParticleEffect.ITEM) {
|
||||
if (this.effect.hasProperty(ParticleProperty.REQUIRES_ITEM_DATA)) {
|
||||
return this.itemMaterial;
|
||||
} else {
|
||||
} else if (this.effect.hasProperty(ParticleProperty.REQUIRES_BLOCK_DATA)) {
|
||||
return this.blockMaterial;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -253,7 +250,7 @@ public class ParticlePair {
|
|||
return this.blockMaterial.toString().toLowerCase();
|
||||
} else if (this.effect == ParticleEffect.ITEM) {
|
||||
return this.itemMaterial.toString().toLowerCase();
|
||||
} else if (this.effect.hasProperty(ParticleProperty.COLORABLE)) {
|
||||
} else if (this.effect.hasProperty(ParticleProperty.REQUIRES_COLOR_DATA)) {
|
||||
if (this.effect == ParticleEffect.NOTE) {
|
||||
if (this.noteColor.equals(NoteColor.RAINBOW)) {
|
||||
return localeManager.getLocaleMessage("rainbow");
|
|
@ -0,0 +1,94 @@
|
|||
package dev.esophose.playerparticles.particles.color;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents the color for the {@link ParticleEffect#NOTE} effect
|
||||
* <p>
|
||||
* This class is part of the <b>ParticleEffect Library</b> and follows the
|
||||
* same usage conditions
|
||||
*
|
||||
* @author DarkBlade12
|
||||
* @since 1.7
|
||||
*/
|
||||
public final class NoteColor implements ParticleColor {
|
||||
public static final NoteColor RAINBOW = new NoteColor(99);
|
||||
public static final NoteColor RANDOM = new NoteColor(98);
|
||||
|
||||
private final int note;
|
||||
|
||||
/**
|
||||
* Construct a new note color
|
||||
*
|
||||
* @param note Note id which determines color
|
||||
* @throws IllegalArgumentException If the note value is lower than 0 or
|
||||
* higher than 24
|
||||
*/
|
||||
public NoteColor(int note) throws IllegalArgumentException {
|
||||
if (note == 99 || note == 98) { // Allow rainbow and random values
|
||||
this.note = note;
|
||||
} else {
|
||||
if (note < 0) {
|
||||
throw new IllegalArgumentException("The note value is lower than 0");
|
||||
}
|
||||
if (note > 24) {
|
||||
throw new IllegalArgumentException("The note value is higher than 24");
|
||||
}
|
||||
this.note = note;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the note value
|
||||
*
|
||||
* @return The note value
|
||||
*/
|
||||
public int getNote() {
|
||||
return this.note;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the note value divided by 24
|
||||
*
|
||||
* @return The offsetX value
|
||||
*/
|
||||
@Override
|
||||
public float getValueX() {
|
||||
return (float) this.note / 24F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns zero because the offsetY value is unused
|
||||
*
|
||||
* @return zero
|
||||
*/
|
||||
@Override
|
||||
public float getValueY() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns zero because the offsetZ value is unused
|
||||
*
|
||||
* @return zero
|
||||
*/
|
||||
@Override
|
||||
public float getValueZ() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof NoteColor))
|
||||
return false;
|
||||
NoteColor otherColor = (NoteColor) other;
|
||||
return this.note == otherColor.note;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hashCode(this.note);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,138 @@
|
|||
package dev.esophose.playerparticles.particles.color;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents the color for effects like {@link ParticleEffect#ENTITY_EFFECT},
|
||||
* {@link ParticleEffect#AMBIENT_ENTITY_EFFECT} and {@link ParticleEffect#NOTE}
|
||||
* <p>
|
||||
* This class is part of the <b>ParticleEffect Library</b> and follows the
|
||||
* same usage conditions
|
||||
*
|
||||
* @author DarkBlade12
|
||||
*/
|
||||
public final class OrdinaryColor implements ParticleColor {
|
||||
public static final OrdinaryColor RAINBOW = new OrdinaryColor(999, 999, 999);
|
||||
public static final OrdinaryColor RANDOM = new OrdinaryColor(998, 998, 998);
|
||||
|
||||
private final int red;
|
||||
private final int green;
|
||||
private final int blue;
|
||||
|
||||
/**
|
||||
* Construct a new ordinary color
|
||||
*
|
||||
* @param red Red value of the RGB format
|
||||
* @param green Green value of the RGB format
|
||||
* @param blue Blue value of the RGB format
|
||||
* @throws IllegalArgumentException If one of the values is lower than 0
|
||||
* or higher than 255
|
||||
*/
|
||||
public OrdinaryColor(int red, int green, int blue) throws IllegalArgumentException {
|
||||
if ((red == 999 && green == 999 && blue == 999) || (red == 998 && green == 998 && blue == 998)) { // Allow rainbow and random values
|
||||
this.red = red;
|
||||
this.green = green;
|
||||
this.blue = blue;
|
||||
} else {
|
||||
if (red < 0) {
|
||||
throw new IllegalArgumentException("The red value is lower than 0");
|
||||
}
|
||||
if (red > 255) {
|
||||
throw new IllegalArgumentException("The red value is higher than 255");
|
||||
}
|
||||
this.red = red;
|
||||
if (green < 0) {
|
||||
throw new IllegalArgumentException("The green value is lower than 0");
|
||||
}
|
||||
if (green > 255) {
|
||||
throw new IllegalArgumentException("The green value is higher than 255");
|
||||
}
|
||||
this.green = green;
|
||||
if (blue < 0) {
|
||||
throw new IllegalArgumentException("The blue value is lower than 0");
|
||||
}
|
||||
if (blue > 255) {
|
||||
throw new IllegalArgumentException("The blue value is higher than 255");
|
||||
}
|
||||
this.blue = blue;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the red value of the RGB format
|
||||
*
|
||||
* @return The red value
|
||||
*/
|
||||
public int getRed() {
|
||||
return this.red;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the green value of the RGB format
|
||||
*
|
||||
* @return The green value
|
||||
*/
|
||||
public int getGreen() {
|
||||
return this.green;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blue value of the RGB format
|
||||
*
|
||||
* @return The blue value
|
||||
*/
|
||||
public int getBlue() {
|
||||
return this.blue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the red value divided by 255
|
||||
*
|
||||
* @return The offsetX value
|
||||
*/
|
||||
@Override
|
||||
public float getValueX() {
|
||||
if (this.equals(OrdinaryColor.RAINBOW) || this.equals(OrdinaryColor.RANDOM))
|
||||
return 0F;
|
||||
return (float) this.red / 255F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the green value divided by 255
|
||||
*
|
||||
* @return The offsetY value
|
||||
*/
|
||||
@Override
|
||||
public float getValueY() {
|
||||
if (this.equals(OrdinaryColor.RAINBOW) || this.equals(OrdinaryColor.RANDOM))
|
||||
return 0F;
|
||||
return (float) this.green / 255F;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the blue value divided by 255
|
||||
*
|
||||
* @return The offsetZ value
|
||||
*/
|
||||
@Override
|
||||
public float getValueZ() {
|
||||
if (this.equals(OrdinaryColor.RAINBOW) || this.equals(OrdinaryColor.RANDOM))
|
||||
return 0F;
|
||||
return (float) this.blue / 255F;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if (!(other instanceof OrdinaryColor))
|
||||
return false;
|
||||
OrdinaryColor otherColor = (OrdinaryColor) other;
|
||||
return this.red == otherColor.red && this.green == otherColor.green && this.blue == otherColor.blue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(this.red, this.green, this.blue);
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
package dev.esophose.playerparticles.particles.color;
|
||||
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
|
||||
/**
|
||||
* Represents the color for effects like {@link ParticleEffect#ENTITY_EFFECT},
|
||||
* {@link ParticleEffect#AMBIENT_ENTITY_EFFECT}, {@link ParticleEffect#DUST}
|
||||
* and {@link ParticleEffect#NOTE}
|
||||
* <p>
|
||||
* This class is part of the <b>ParticleEffect Library</b> and follows the
|
||||
* same usage conditions
|
||||
*
|
||||
* @author DarkBlade12
|
||||
* @since 1.7
|
||||
*/
|
||||
public interface ParticleColor {
|
||||
/**
|
||||
* Returns the value for the offsetX field
|
||||
*
|
||||
* @return The offsetX value
|
||||
*/
|
||||
float getValueX();
|
||||
|
||||
/**
|
||||
* Returns the value for the offsetY field
|
||||
*
|
||||
* @return The offsetY value
|
||||
*/
|
||||
float getValueY();
|
||||
|
||||
/**
|
||||
* Returns the value for the offsetZ field
|
||||
*
|
||||
* @return The offsetZ value
|
||||
*/
|
||||
float getValueZ();
|
||||
|
||||
}
|
|
@ -1,7 +1,7 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ParticleStyleManager;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.plugin.PluginManager;
|
|
@ -1,9 +1,9 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.manager.ParticleStyleManager;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.util.VectorUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.util.MathL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -1,12 +1,12 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.manager.DataManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
|
@ -19,8 +19,8 @@ import org.bukkit.event.block.BlockBreakEvent;
|
|||
public class ParticleStyleBlockBreak extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private int particleAmount;
|
||||
private double particleSpread;
|
||||
private double particleSpeed;
|
||||
private float particleSpread;
|
||||
private float particleSpeed;
|
||||
|
||||
public ParticleStyleBlockBreak() {
|
||||
super("blockbreak", false, false, 0);
|
||||
|
@ -54,7 +54,7 @@ public class ParticleStyleBlockBreak extends DefaultParticleStyle implements Lis
|
|||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
this.particleAmount = config.getInt("particle-amount");
|
||||
this.particleSpread = config.getInt("particle-spread");
|
||||
this.particleSpeed = config.getDouble("particle-speed");
|
||||
this.particleSpeed = config.getFloat("particle-speed");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
@ -1,12 +1,12 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.manager.DataManager;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
||||
|
@ -19,8 +19,8 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||
public class ParticleStyleBlockPlace extends DefaultParticleStyle implements Listener {
|
||||
|
||||
private int particleAmount;
|
||||
private double particleSpread;
|
||||
private double particleSpeed;
|
||||
private float particleSpread;
|
||||
private float particleSpeed;
|
||||
|
||||
public ParticleStyleBlockPlace() {
|
||||
super("blockplace", false, false, 0);
|
||||
|
@ -54,7 +54,7 @@ public class ParticleStyleBlockPlace extends DefaultParticleStyle implements Lis
|
|||
protected void loadSettings(CommentedFileConfiguration config) {
|
||||
this.particleAmount = config.getInt("particle-amount");
|
||||
this.particleSpread = config.getInt("particle-spread");
|
||||
this.particleSpeed = config.getDouble("particle-speed");
|
||||
this.particleSpeed = config.getFloat("particle-speed");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
|
@ -1,7 +1,5 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.manager.ParticleManager;
|
||||
import dev.esophose.playerparticles.manager.PermissionManager;
|
||||
import dev.esophose.playerparticles.particles.FixedParticleEffect;
|
||||
|
@ -9,6 +7,8 @@ import dev.esophose.playerparticles.particles.PParticle;
|
|||
import dev.esophose.playerparticles.particles.PPlayer;
|
||||
import dev.esophose.playerparticles.particles.ParticleEffect;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.PlayerParticles;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.util.MathL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
@ -96,7 +96,7 @@ public class ParticleStyleCelebration extends DefaultParticleStyle {
|
|||
this.baseDistanceFrom = config.getDouble("base-distance-from");
|
||||
this.distanceFromRandomizer = config.getDouble("distance-from-randomizer");
|
||||
this.fuseSpacing = config.getDouble("fuse-spacing");
|
||||
this.fuseEffect = ParticleEffect.fromInternalName(config.getString("fuse-effect"));
|
||||
this.fuseEffect = PlayerParticles.getInstance().getManager(ParticleManager.class).getEffectFromInternalName(config.getString("fuse-effect"));
|
||||
|
||||
if (this.fuseEffect == null)
|
||||
this.fuseEffect = ParticleEffect.FIREWORK;
|
|
@ -1,8 +1,8 @@
|
|||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.bukkit.Location;
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.util.MathL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
|
@ -23,9 +23,9 @@
|
|||
*/
|
||||
package dev.esophose.playerparticles.styles;
|
||||
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.particles.PParticle;
|
||||
import dev.esophose.playerparticles.particles.ParticlePair;
|
||||
import dev.esophose.playerparticles.config.CommentedFileConfiguration;
|
||||
import dev.esophose.playerparticles.util.VectorUtils;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue