Added particles to notify-on-special

This commit is contained in:
Auxilor 2021-07-31 17:13:30 +01:00
parent 069d1dfb63
commit 362166d3b2
3 changed files with 34 additions and 3 deletions

View File

@ -8,8 +8,11 @@ import com.willfp.ecoenchants.enchantments.EcoEnchant;
import com.willfp.ecoenchants.enchantments.EcoEnchants;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentTarget;
import com.willfp.ecoenchants.enchantments.meta.EnchantmentType;
import org.bukkit.Color;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentOffer;
@ -208,6 +211,33 @@ public class EnchantingListeners extends PluginDependent<EcoPlugin> implements L
pitch
);
if (this.getPlugin().getConfigYml().getBool("enchanting-table.notify-on-special.show-particles")) {
Particle.DustOptions extra = new Particle.DustOptions(
Color.fromRGB(Integer.parseInt(
this.getPlugin().getLangYml().getString("special-particle-color").substring(1),
16
)),
1.0f
);
Location location = player.getLocation().clone();
location.add(0, 1, 0);
int limit = NumberUtils.randInt(8, 13);
for (int i = 0; i < limit; i++) {
Location spawnLoc = location.clone();
spawnLoc.add(
NumberUtils.randFloat(-2, 2),
NumberUtils.randFloat(-0.3, 1.6),
NumberUtils.randFloat(-2, 2)
);
spawnLoc.getWorld().spawnParticle(Particle.REDSTONE, spawnLoc, 1, 0, 0, 0, 0, extra, true);
}
}
player.sendMessage(this.getPlugin().getLangYml().getMessage("got-special"));
}

View File

@ -261,9 +261,9 @@ public class VillagerListeners extends PluginDependent<EcoPlugin> implements Lis
for (int i = 0; i < limit; i++) {
Location spawnLoc = location.clone();
spawnLoc.add(
NumberUtils.randFloat(-1.2, 1.2),
NumberUtils.randFloat(-0.3, 1.2),
NumberUtils.randFloat(-1.2, 1.2)
NumberUtils.randFloat(-2, 2),
NumberUtils.randFloat(-0.3, 1.6),
NumberUtils.randFloat(-2, 2)
);
spawnLoc.getWorld().spawnParticle(Particle.REDSTONE, spawnLoc, 1, 0, 0, 0, 0, extra, true);

View File

@ -72,6 +72,7 @@ enchanting-table:
enabled: true
sound: ENTITY_PLAYER_LEVELUP
pitch: 1.5
show-particles: true
cap-amount: # Prevent getting above a certain amount of enchantments
enabled: true # Enable capping