Reverted changes

This commit is contained in:
Indyuce 2022-10-11 23:54:16 +02:00
parent 7c20dcb8cb
commit b2987371f8
2 changed files with 6 additions and 14 deletions

View File

@ -1,7 +1,5 @@
package net.Indyuce.mmocore.loot.chest.particle; package net.Indyuce.mmocore.loot.chest.particle;
import java.util.function.Consumer;
import org.apache.commons.lang.Validate; import org.apache.commons.lang.Validate;
import org.bukkit.Color; import org.bukkit.Color;
import org.bukkit.Location; import org.bukkit.Location;
@ -9,6 +7,8 @@ import org.bukkit.Material;
import org.bukkit.Particle; import org.bukkit.Particle;
import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.ConfigurationSection;
import java.util.function.Consumer;
public class CastingParticle { public class CastingParticle {
private final Consumer<Location> display; private final Consumer<Location> display;
@ -22,8 +22,7 @@ public class CastingParticle {
if (config.contains("color")) { if (config.contains("color")) {
final float size = (float) config.getDouble("size") == 0 ? 1 : (float) Math.max(config.getDouble("size"), 0); final float size = (float) config.getDouble("size") == 0 ? 1 : (float) Math.max(config.getDouble("size"), 0);
Color color = Color.fromRGB(config.getInt("color.red"), config.getInt("color.green"), config.getInt("color.blue")); Color color = Color.fromRGB(config.getInt("color.red"), config.getInt("color.green"), config.getInt("color.blue"));
display = loc -> loc.getWorld().spawnParticle(particle, loc, 1, new Particle.DustOptions(color, size));
display = (loc) -> loc.getWorld().spawnParticle(particle, loc, 1, new Particle.DustOptions(color, size));
return; return;
} }
@ -31,16 +30,11 @@ public class CastingParticle {
format = config.getString("material"); format = config.getString("material");
Validate.notNull(format, "Could not read material name"); Validate.notNull(format, "Could not read material name");
Material material = Material.valueOf(format.toUpperCase().replace("-", "_").replace(" ", "_")); Material material = Material.valueOf(format.toUpperCase().replace("-", "_").replace(" ", "_"));
if (material == Material.DIRT && particle == Particle.SUSPENDED) display = loc -> loc.getWorld().spawnParticle(particle, loc, 1, material.createBlockData());
display = (loc) -> {
return;
};
else
display = (loc) -> loc.getWorld().spawnParticle(particle, loc, 1, material.createBlockData());
return; return;
} }
display = (loc) -> loc.getWorld().spawnParticle(particle, loc, 0); display = loc -> loc.getWorld().spawnParticle(particle, loc, 0);
} }
public CastingParticle(Particle particle) { public CastingParticle(Particle particle) {

View File

@ -38,12 +38,10 @@ public class PlayerListener implements Listener {
// Register custom inventory clicks // Register custom inventory clicks
@EventHandler @EventHandler
public void b(InventoryClickEvent event) { public void b(InventoryClickEvent event) {
if (event.getInventory().getHolder() instanceof PluginInventory) { if (event.getInventory().getHolder() instanceof PluginInventory)
event.setCancelled(true);
if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null) if (event.getCurrentItem() != null && event.getCurrentItem().getItemMeta() != null)
((PluginInventory) event.getInventory().getHolder()) ((PluginInventory) event.getInventory().getHolder())
.whenClicked(new InventoryClickContext(event.getRawSlot(), event.getCurrentItem(), event.getClick(), event, event.getInventory())); .whenClicked(new InventoryClickContext(event.getRawSlot(), event.getCurrentItem(), event.getClick(), event, event.getInventory()));
}
} }
// Register custom inventory close effect // Register custom inventory close effect