Moved code to normal listeners
parent
3695315d42
commit
51e22f2f9e
@ -1,26 +0,0 @@
|
|||||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener;
|
|
||||||
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.Main;
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterBlock;
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterItem;
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterManager;
|
|
||||||
import org.bukkit.GameMode;
|
|
||||||
import org.bukkit.event.block.BlockBreakEvent;
|
|
||||||
|
|
||||||
public class OnBlockBreak {
|
|
||||||
|
|
||||||
public static void onBlockBreakEvent(BlockBreakEvent e, LinkedBeaconTeleporterBlock lbtBlock){
|
|
||||||
LinkedBeaconTeleporterItem lbtItem = Main.lbtManager.breakLbtBlock(lbtBlock);
|
|
||||||
|
|
||||||
// Dont drop anything
|
|
||||||
e.setDropItems(false);
|
|
||||||
e.setExpToDrop(0);
|
|
||||||
|
|
||||||
// Drop custom-item
|
|
||||||
if(e.getPlayer().getGameMode() != GameMode.CREATIVE)
|
|
||||||
lbtBlock.block().getLocation().getWorld().dropItemNaturally(
|
|
||||||
lbtBlock.block().getLocation(),
|
|
||||||
lbtItem.item()
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,16 +0,0 @@
|
|||||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener;
|
|
||||||
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.Main;
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterBlock;
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterItem;
|
|
||||||
import org.bukkit.block.Block;
|
|
||||||
import org.bukkit.event.block.BlockPlaceEvent;
|
|
||||||
|
|
||||||
public class OnBlockPlace {
|
|
||||||
|
|
||||||
public static void onBlockPlaceEvent(BlockPlaceEvent e, LinkedBeaconTeleporterItem lbtItem){
|
|
||||||
Block block = e.getBlock();
|
|
||||||
|
|
||||||
LinkedBeaconTeleporterBlock lbtBlock = Main.lbtManager.placeLbtItem(lbtItem, block);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,27 +0,0 @@
|
|||||||
package eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.listener;
|
|
||||||
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.Main;
|
|
||||||
import eu.ruekov.ruakij.LinkedBeaconTeleporters.linkedBeaconTeleporter.LinkedBeaconTeleporterItem;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.bukkit.event.EventPriority;
|
|
||||||
import org.bukkit.event.Listener;
|
|
||||||
import org.bukkit.event.inventory.CraftItemEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.Recipe;
|
|
||||||
|
|
||||||
public class OnCraftItemEvent {
|
|
||||||
|
|
||||||
public static void onCraftItemEvent(CraftItemEvent e, LinkedBeaconTeleporterItem lbtItem){
|
|
||||||
|
|
||||||
// Create new LinkedBeaconTeleporterItem
|
|
||||||
lbtItem = new LinkedBeaconTeleporterItem();
|
|
||||||
|
|
||||||
ItemStack item = lbtItem.item();
|
|
||||||
// Exactly 2
|
|
||||||
item.setAmount(2);
|
|
||||||
|
|
||||||
// FIXME: Changing the just-crafted-item only works for a single item, bulk-crafting (e.g. Shift-Click) will result in default-items getting crafted!
|
|
||||||
|
|
||||||
e.setCurrentItem(item);
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue