mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-24 02:56:02 +01:00
Make use of the new InventoryMoveEvent
This commit is contained in:
parent
1bc4fbcc78
commit
2448af7bcb
@ -12,6 +12,7 @@ import com.Acrobot.ChestShop.Listeners.Block.BlockPlace;
|
|||||||
import com.Acrobot.ChestShop.Listeners.Block.Break.ChestBreak;
|
import com.Acrobot.ChestShop.Listeners.Block.Break.ChestBreak;
|
||||||
import com.Acrobot.ChestShop.Listeners.Block.Break.SignBreak;
|
import com.Acrobot.ChestShop.Listeners.Block.Break.SignBreak;
|
||||||
import com.Acrobot.ChestShop.Listeners.Block.SignCreate;
|
import com.Acrobot.ChestShop.Listeners.Block.SignCreate;
|
||||||
|
import com.Acrobot.ChestShop.Listeners.Item.ItemMoveListener;
|
||||||
import com.Acrobot.ChestShop.Listeners.ItemInfoListener;
|
import com.Acrobot.ChestShop.Listeners.ItemInfoListener;
|
||||||
import com.Acrobot.ChestShop.Listeners.Player.PlayerConnect;
|
import com.Acrobot.ChestShop.Listeners.Player.PlayerConnect;
|
||||||
import com.Acrobot.ChestShop.Listeners.Player.PlayerInteract;
|
import com.Acrobot.ChestShop.Listeners.Player.PlayerInteract;
|
||||||
@ -170,6 +171,7 @@ public class ChestShop extends JavaPlugin {
|
|||||||
registerEvent(new ChestBreak());
|
registerEvent(new ChestBreak());
|
||||||
|
|
||||||
registerEvent(new BlockPlace());
|
registerEvent(new BlockPlace());
|
||||||
|
registerEvent(new ItemMoveListener());
|
||||||
registerEvent(new PlayerConnect());
|
registerEvent(new PlayerConnect());
|
||||||
registerEvent(new PlayerInteract());
|
registerEvent(new PlayerInteract());
|
||||||
registerEvent(new PlayerInventory());
|
registerEvent(new PlayerInventory());
|
||||||
|
@ -0,0 +1,27 @@
|
|||||||
|
package com.Acrobot.ChestShop.Listeners.Item;
|
||||||
|
|
||||||
|
import com.Acrobot.ChestShop.Signs.ChestShopSign;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
|
import org.bukkit.block.Chest;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Acrobot
|
||||||
|
*/
|
||||||
|
public class ItemMoveListener implements Listener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public static void onItemMove(InventoryMoveItemEvent event) {
|
||||||
|
if (!(event.getSource().getHolder() instanceof Chest)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ChestShopSign.isShopChest(((BlockState) event.getSource().getHolder()).getBlock())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user