Script Turing Completeness #152
@ -32,6 +32,10 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryCreativeEvent;
|
||||
import org.bukkit.event.inventory.InventoryInteractEvent;
|
||||
import org.bukkit.event.inventory.InventoryMoveItemEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -72,6 +76,43 @@ public class ScriptListener implements Listener {
|
||||
new ScriptExecutor((BookMeta) item.getItemMeta(), event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onInventoryClick(InventoryClickEvent event) {
|
||||
if (!(event.isShiftClick() && event.isLeftClick())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item = event.getCurrentItem();
|
||||
if(item == null || isNoBook(item) || item.getItemMeta() == null)
|
||||
return;
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals("§8Script Buch")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
new ScriptExecutor((BookMeta) item.getItemMeta(), (Player) event.getWhoClicked());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onInventoryCreative(InventoryCreativeEvent event) {
|
||||
System.out.println(event + " " + event.getCursor() + " " + event.getClick() + " " + event.getCurrentItem());
|
||||
if (!(event.isShiftClick() && event.isLeftClick())) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack item = event.getCurrentItem();
|
||||
if(item == null || isNoBook(item) || item.getItemMeta() == null)
|
||||
return;
|
||||
|
||||
if (item.getItemMeta().getDisplayName().equals("§8Script Buch")) {
|
||||
return;
|
||||
}
|
||||
|
||||
event.setCancelled(true);
|
||||
new ScriptExecutor((BookMeta) item.getItemMeta(), (Player) event.getWhoClicked());
|
||||
}
|
||||
|
||||
private boolean isNoBook(ItemStack item){
|
||||
switch(Core.getVersion()){
|
||||
case 12:
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren