1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-20 03:35:51 +00:00

[CI skip] Refactoring

This commit is contained in:
TheBusyBiscuit 2020-01-11 23:58:05 +01:00
parent 55269d587c
commit ffc0fe41f0
11 changed files with 144 additions and 112 deletions

View File

@ -57,14 +57,14 @@ public class BackpackListener implements Listener {
@EventHandler @EventHandler
public void onClick(InventoryClickEvent e) { public void onClick(InventoryClickEvent e) {
ItemStack item = SlimefunPlugin.getUtilities().backpack.get(e.getWhoClicked().getUniqueId()); ItemStack item = SlimefunPlugin.getUtilities().backpack.get(e.getWhoClicked().getUniqueId());
if (item != null) { if (item != null) {
if (e.getClick() == ClickType.NUMBER_KEY) { if (e.getClick() == ClickType.NUMBER_KEY) {
ItemStack hotbarItem = e.getWhoClicked().getInventory().getItem(e.getHotbarButton()); ItemStack hotbarItem = e.getWhoClicked().getInventory().getItem(e.getHotbarButton());
SlimefunItem sfItem = SlimefunItem.getByItem(hotbarItem);
if ((hotbarItem != null && hotbarItem.getType().toString().contains("SHULKER_BOX")) ||
sfItem instanceof SlimefunBackpack)
e.setCancelled(true); if ((hotbarItem != null && hotbarItem.getType().toString().contains("SHULKER_BOX")) || SlimefunItem.getByItem(hotbarItem) instanceof SlimefunBackpack) {
e.setCancelled(true);
}
} }
else if (e.getCurrentItem() != null && e.getCurrentItem().getType() != Material.AIR) { else if (e.getCurrentItem() != null && e.getCurrentItem().getType() != Material.AIR) {
SlimefunItem sfItem = SlimefunItem.getByItem(e.getCurrentItem()); SlimefunItem sfItem = SlimefunItem.getByItem(e.getCurrentItem());

View File

@ -27,15 +27,18 @@ public class CoolerListener implements Listener {
public void onStarve(FoodLevelChangeEvent e) { public void onStarve(FoodLevelChangeEvent e) {
if (e.getFoodLevel() < ((Player) e.getEntity()).getFoodLevel()) { if (e.getFoodLevel() < ((Player) e.getEntity()).getFoodLevel()) {
Player p = (Player) e.getEntity(); Player p = (Player) e.getEntity();
for (ItemStack item : p.getInventory().getContents()) { for (ItemStack item : p.getInventory().getContents()) {
if (SlimefunManager.isItemSimilar(item, SlimefunItems.COOLER, false)) { if (SlimefunManager.isItemSimilar(item, SlimefunItems.COOLER, false)) {
BackpackInventory backpack = PlayerProfile.getBackpack(item); BackpackInventory backpack = PlayerProfile.getBackpack(item);
if (backpack != null) { if (backpack != null) {
Inventory inv = backpack.getInventory(); Inventory inv = backpack.getInventory();
int slot = -1; int slot = -1;
for (int i = 0; i < inv.getSize(); i++) { for (int i = 0; i < inv.getSize(); i++) {
ItemStack stack = inv.getItem(i); ItemStack stack = inv.getItem(i);
if (stack != null && stack.getType() == Material.POTION && stack.hasItemMeta() && stack.getItemMeta().hasDisplayName()) { if (stack != null && stack.getType() == Material.POTION && stack.hasItemMeta() && stack.getItemMeta().hasDisplayName()) {
slot = i; slot = i;
break; break;

View File

@ -12,11 +12,11 @@ import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Lists.SlimefunItems; import me.mrCookieSlime.Slimefun.Lists.SlimefunItems;
import me.mrCookieSlime.Slimefun.api.Slimefun; import me.mrCookieSlime.Slimefun.api.Slimefun;
public class WaypointListener implements Listener { public class DeathpointListener implements Listener {
private final SimpleDateFormat format = new SimpleDateFormat("(MMM d, yyyy @ hh:mm)"); private final SimpleDateFormat format = new SimpleDateFormat("(MMM d, yyyy @ hh:mm)");
public WaypointListener(SlimefunPlugin plugin) { public DeathpointListener(SlimefunPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin); plugin.getServer().getPluginManager().registerEvents(this, plugin);
} }
@ -24,8 +24,9 @@ public class WaypointListener implements Listener {
public void onDamage(EntityDeathEvent e) { public void onDamage(EntityDeathEvent e) {
if (e.getEntity() instanceof Player) { if (e.getEntity() instanceof Player) {
Player p = (Player) e.getEntity(); Player p = (Player) e.getEntity();
if (p.getInventory().containsAtLeast(SlimefunItems.GPS_EMERGENCY_TRANSMITTER, 1)) { if (p.getInventory().containsAtLeast(SlimefunItems.GPS_EMERGENCY_TRANSMITTER, 1)) {
Slimefun.getGPSNetwork().addWaypoint(p, "&4Deathpoint &7" + format.format(new Date()), p.getLocation().getBlock().getLocation()); Slimefun.getGPSNetwork().addWaypoint(p, SlimefunPlugin.getLocal().getMessage(p, "gps.deathpoint").replace("%date%", format.format(new Date())), p.getLocation().getBlock().getLocation());
} }
} }
} }

View File

@ -0,0 +1,54 @@
package io.github.thebusybiscuit.slimefun4.implementation.listeners;
import java.util.Iterator;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.Objects.SlimefunBlockHandler;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.UnregisterReason;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
public class ExplosionsListener implements Listener {
public ExplosionsListener(SlimefunPlugin plugin) {
plugin.getServer().getPluginManager().registerEvents(this, plugin);
}
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent e) {
Iterator<Block> blocks = e.blockList().iterator();
while (blocks.hasNext()) {
Block block = blocks.next();
String id = BlockStorage.checkID(block);
if (id != null) {
blocks.remove();
if (!id.equalsIgnoreCase("HARDENED_GLASS") && !id.equalsIgnoreCase("WITHER_PROOF_OBSIDIAN") && !id.equalsIgnoreCase("WITHER_PROOF_GLASS") && !id.equalsIgnoreCase("FORCEFIELD_PROJECTOR") && !id.equalsIgnoreCase("FORCEFIELD_RELAY")) {
boolean success = true;
SlimefunItem sfItem = SlimefunItem.getByID(id);
SlimefunBlockHandler blockHandler = SlimefunPlugin.getUtilities().blockHandlers.get(sfItem.getID());
if (blockHandler != null) {
success = blockHandler.onBreak(null, block, sfItem, UnregisterReason.EXPLODE);
}
if (success) {
BlockStorage.clearBlockInfo(block);
block.setType(Material.AIR);
}
}
}
}
}
}

View File

@ -40,8 +40,7 @@ public class SlimefunBootsListener implements Listener {
plugin.getServer().getPluginManager().registerEvents(this, plugin); plugin.getServer().getPluginManager().registerEvents(this, plugin);
cancelledEvents.put("ENDER_BOOTS", e -> cancelledEvents.put("ENDER_BOOTS", e ->
e instanceof EntityDamageByEntityEvent e instanceof EntityDamageByEntityEvent && ((EntityDamageByEntityEvent) e).getDamager() instanceof EnderPearl
&& ((EntityDamageByEntityEvent) e).getDamager() instanceof EnderPearl
); );
cancelledEvents.put("BOOTS_OF_THE_STOMPER", e -> { cancelledEvents.put("BOOTS_OF_THE_STOMPER", e -> {

View File

@ -130,9 +130,11 @@ public class TalismanListener implements Listener {
if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_WIZARD)) { if (!e.getEnchantsToAdd().containsKey(Enchantment.SILK_TOUCH) && Enchantment.LOOT_BONUS_BLOCKS.canEnchantItem(e.getItem()) && Talisman.checkFor(e, (SlimefunItemStack) SlimefunItems.TALISMAN_WIZARD)) {
if (e.getEnchantsToAdd().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) e.getEnchantsToAdd().remove(Enchantment.LOOT_BONUS_BLOCKS); if (e.getEnchantsToAdd().containsKey(Enchantment.LOOT_BONUS_BLOCKS)) e.getEnchantsToAdd().remove(Enchantment.LOOT_BONUS_BLOCKS);
Set<Enchantment> enchantments = e.getEnchantsToAdd().keySet(); Set<Enchantment> enchantments = e.getEnchantsToAdd().keySet();
for (Enchantment en : enchantments) { for (Enchantment en : enchantments) {
if (random.nextInt(100) < 40) e.getEnchantsToAdd().put(en, random.nextInt(3) + 1); if (random.nextInt(100) < 40) e.getEnchantsToAdd().put(en, random.nextInt(3) + 1);
} }
e.getItem().addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3); e.getItem().addUnsafeEnchantment(Enchantment.LOOT_BONUS_BLOCKS, random.nextInt(3) + 3);
} }
} }

View File

@ -1,14 +1,5 @@
package io.github.thebusybiscuit.slimefun4.implementation.listeners; package io.github.thebusybiscuit.slimefun4.implementation.listeners;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.GPS.Elevator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.Teleporter;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
import me.mrCookieSlime.Slimefun.api.Slimefun;
import java.util.logging.Level;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
@ -16,6 +7,12 @@ import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import me.mrCookieSlime.Slimefun.SlimefunPlugin;
import me.mrCookieSlime.Slimefun.GPS.Elevator;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.abstractItems.Teleporter;
import me.mrCookieSlime.Slimefun.api.BlockStorage;
public class TeleporterListener implements Listener { public class TeleporterListener implements Listener {
private final BlockFace[] faces = {BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST}; private final BlockFace[] faces = {BlockFace.NORTH, BlockFace.NORTH_EAST, BlockFace.EAST, BlockFace.SOUTH_EAST, BlockFace.SOUTH, BlockFace.SOUTH_WEST, BlockFace.WEST, BlockFace.NORTH_WEST};
@ -39,11 +36,7 @@ public class TeleporterListener implements Listener {
if (!BlockStorage.check(e.getClickedBlock().getRelative(BlockFace.DOWN).getRelative(face), "GPS_TELEPORTER_PYLON")) return; if (!BlockStorage.check(e.getClickedBlock().getRelative(BlockFace.DOWN).getRelative(face), "GPS_TELEPORTER_PYLON")) return;
} }
try { ((Teleporter) teleporter).onInteract(e.getPlayer(), e.getClickedBlock().getRelative(BlockFace.DOWN));
((Teleporter) teleporter).onInteract(e.getPlayer(), e.getClickedBlock().getRelative(BlockFace.DOWN));
} catch (Exception x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while interacting with a Teleporter", x);
}
} }
} }
else if (id.equals("ELEVATOR_PLATE")) { else if (id.equals("ELEVATOR_PLATE")) {

View File

@ -33,7 +33,9 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.BackpackListe
import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.BlockListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.CoolerListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DamageListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.DamageListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.DeathpointListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.EnhancedFurnaceListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ExplosionsListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GearListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.GearListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.GrapplingHookListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.ItemPickupListener;
@ -46,7 +48,6 @@ import io.github.thebusybiscuit.slimefun4.implementation.listeners.SlimefunGuide
import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.SoulboundListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.TalismanListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.TeleporterListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.TeleporterListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WaypointListener;
import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener; import io.github.thebusybiscuit.slimefun4.implementation.listeners.WorldListener;
import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib; import me.mrCookieSlime.CSCoreLibPlugin.CSCoreLib;
import me.mrCookieSlime.Slimefun.GEO.OreGenSystem; import me.mrCookieSlime.Slimefun.GEO.OreGenSystem;
@ -224,7 +225,8 @@ public final class SlimefunPlugin extends JavaPlugin {
new AndroidKillingListener(this); new AndroidKillingListener(this);
new NetworkListener(this); new NetworkListener(this);
new ItemPickupListener(this); new ItemPickupListener(this);
new WaypointListener(this); new DeathpointListener(this);
new ExplosionsListener(this);
// Toggleable Listeners for performance // Toggleable Listeners for performance
if (config.getBoolean("items.talismans")) new TalismanListener(this); if (config.getBoolean("items.talismans")) new TalismanListener(this);

View File

@ -231,8 +231,8 @@ public class ItemListener implements Listener {
if (slimefunItem != null) { if (slimefunItem != null) {
if (Slimefun.hasUnlocked(p, slimefunItem, true)) { if (Slimefun.hasUnlocked(p, slimefunItem, true)) {
slimefunItem.callItemHandler(ItemInteractionHandler.class, handler -> slimefunItem.callItemHandler(ItemInteractionHandler.class, handler ->
handler.onRightClick(e, p, item) handler.onRightClick(e, p, item)
); );
// Open the Backpack (also includes Coolers) // Open the Backpack (also includes Coolers)
if (slimefunItem instanceof SlimefunBackpack) { if (slimefunItem instanceof SlimefunBackpack) {
@ -280,11 +280,13 @@ public class ItemListener implements Listener {
if (e.getClickedBlock() != null && BlockStorage.hasBlockInfo(e.getClickedBlock())) { if (e.getClickedBlock() != null && BlockStorage.hasBlockInfo(e.getClickedBlock())) {
String id = BlockStorage.checkID(e.getClickedBlock()); String id = BlockStorage.checkID(e.getClickedBlock());
if (BlockMenuPreset.isInventory(id) && !canPlaceCargoNodes(p, item, e.getClickedBlock().getRelative(e.getParentEvent().getBlockFace())) && (!p.isSneaking() || item == null || item.getType() == Material.AIR)) { if (BlockMenuPreset.isInventory(id) && !canPlaceCargoNodes(p, item, e.getClickedBlock().getRelative(e.getParentEvent().getBlockFace())) && (!p.isSneaking() || item == null || item.getType() == Material.AIR)) {
e.setCancelled(true); e.setCancelled(true);
if (BlockStorage.hasUniversalInventory(id)) { if (BlockStorage.hasUniversalInventory(id)) {
UniversalBlockMenu menu = BlockStorage.getUniversalInventory(id); UniversalBlockMenu menu = BlockStorage.getUniversalInventory(id);
if (menu.canOpen(e.getClickedBlock(), p)) { if (menu.canOpen(e.getClickedBlock(), p)) {
menu.open(p); menu.open(p);
} }
@ -294,6 +296,7 @@ public class ItemListener implements Listener {
} }
else if (BlockStorage.getStorage(e.getClickedBlock().getWorld()).hasInventory(e.getClickedBlock().getLocation())) { else if (BlockStorage.getStorage(e.getClickedBlock().getWorld()).hasInventory(e.getClickedBlock().getLocation())) {
BlockMenu menu = BlockStorage.getInventory(e.getClickedBlock().getLocation()); BlockMenu menu = BlockStorage.getInventory(e.getClickedBlock().getLocation());
if (menu.canOpen(e.getClickedBlock(), p)) { if (menu.canOpen(e.getClickedBlock(), p)) {
menu.open(p); menu.open(p);
} }
@ -379,6 +382,7 @@ public class ItemListener implements Listener {
public void onCraft(CraftItemEvent e) { public void onCraft(CraftItemEvent e) {
for (ItemStack item : e.getInventory().getContents()) { for (ItemStack item : e.getInventory().getContents()) {
SlimefunItem sfItem = SlimefunItem.getByItem(item); SlimefunItem sfItem = SlimefunItem.getByItem(item);
if (sfItem != null && !sfItem.isUseableInWorkbench()) { if (sfItem != null && !sfItem.isUseableInWorkbench()) {
e.setCancelled(true); e.setCancelled(true);
SlimefunPlugin.getLocal().sendMessage((Player) e.getWhoClicked(), "workbench.not-enhanced", true); SlimefunPlugin.getLocal().sendMessage((Player) e.getWhoClicked(), "workbench.not-enhanced", true);
@ -391,6 +395,7 @@ public class ItemListener implements Listener {
public void onPrepareCraft(PrepareItemCraftEvent e) { public void onPrepareCraft(PrepareItemCraftEvent e) {
for (ItemStack item : e.getInventory().getContents()) { for (ItemStack item : e.getInventory().getContents()) {
SlimefunItem sfItem = SlimefunItem.getByItem(item); SlimefunItem sfItem = SlimefunItem.getByItem(item);
if (sfItem != null && !sfItem.isUseableInWorkbench()) { if (sfItem != null && !sfItem.isUseableInWorkbench()) {
e.getInventory().setResult(null); e.getInventory().setResult(null);
break; break;
@ -408,6 +413,7 @@ public class ItemListener implements Listener {
} }
else if (e.getEntity() instanceof Wither) { else if (e.getEntity() instanceof Wither) {
String id = BlockStorage.checkID(e.getBlock()); String id = BlockStorage.checkID(e.getBlock());
if (id != null && id.startsWith("WITHER_PROOF_")) { if (id != null && id.startsWith("WITHER_PROOF_")) {
e.setCancelled(true); e.setCancelled(true);
} }
@ -460,8 +466,8 @@ public class ItemListener implements Listener {
SlimefunManager.isItemSimilar(slot1, SlimefunGuide.getItem(SlimefunGuideLayout.BOOK), true) || SlimefunManager.isItemSimilar(slot1, SlimefunGuide.getItem(SlimefunGuideLayout.BOOK), true) ||
SlimefunManager.isItemSimilar(slot1, SlimefunGuide.getItem(SlimefunGuideLayout.CHEST), true)) { SlimefunManager.isItemSimilar(slot1, SlimefunGuide.getItem(SlimefunGuideLayout.CHEST), true)) {
e.setCancelled(true); e.setCancelled(true);
SlimefunPlugin.getLocal().sendMessage((Player) e.getWhoClicked(), "anvil.not-working", true); SlimefunPlugin.getLocal().sendMessage((Player) e.getWhoClicked(), "anvil.not-working", true);
} }
} }
} }
@ -469,6 +475,7 @@ public class ItemListener implements Listener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onPreBrew(InventoryClickEvent e) { public void onPreBrew(InventoryClickEvent e) {
Inventory inventory = e.getInventory(); Inventory inventory = e.getInventory();
if (inventory instanceof BrewerInventory && inventory.getHolder() instanceof BrewingStand && e.getRawSlot() < inventory.getSize()) { if (inventory instanceof BrewerInventory && inventory.getHolder() instanceof BrewingStand && e.getRawSlot() < inventory.getSize()) {
e.setCancelled(SlimefunItem.getByItem(e.getCursor()) != null); e.setCancelled(SlimefunItem.getByItem(e.getCursor()) != null);
} }

View File

@ -2,7 +2,6 @@ package me.mrCookieSlime.Slimefun.listeners;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.Random; import java.util.Random;
@ -22,7 +21,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils; import io.github.thebusybiscuit.cscorelib2.inventory.ItemUtils;
@ -289,32 +287,4 @@ public class ToolListener implements Listener {
} }
} }
} }
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityExplode(EntityExplodeEvent e) {
Iterator<Block> blocks = e.blockList().iterator();
while (blocks.hasNext()) {
Block block = blocks.next();
String id = BlockStorage.checkID(block);
if (id != null) {
blocks.remove();
if (!id.equalsIgnoreCase("HARDENED_GLASS") && !id.equalsIgnoreCase("WITHER_PROOF_OBSIDIAN") && !id.equalsIgnoreCase("WITHER_PROOF_GLASS") && !id.equalsIgnoreCase("FORCEFIELD_PROJECTOR") && !id.equalsIgnoreCase("FORCEFIELD_RELAY")) {
boolean success = true;
SlimefunItem sfItem = SlimefunItem.getByID(id);
SlimefunBlockHandler blockHandler = utilities.blockHandlers.get(sfItem.getID());
if (blockHandler != null) {
success = blockHandler.onBreak(null, block, sfItem, UnregisterReason.EXPLODE);
}
if (success) {
BlockStorage.clearBlockInfo(block);
block.setType(Material.AIR);
}
}
}
}
}
} }

View File

@ -139,6 +139,7 @@ workbench:
not-enhanced: '&4You cannot use Slimefun Items in a normal workbench' not-enhanced: '&4You cannot use Slimefun Items in a normal workbench'
gps: gps:
deathpoint: '&4Deathpoint &7%date%'
waypoint: waypoint:
new: '&ePlease type in a name for your new waypoint in the chat. &7(Color Codes supported!)' new: '&ePlease type in a name for your new waypoint in the chat. &7(Color Codes supported!)'
added: '&aSuccessfully added a new waypoint' added: '&aSuccessfully added a new waypoint'