本文整理汇总了Java中org.bukkit.event.inventory.InventoryClickEvent.setCurrentItem方法的典型用法代码示例。如果您正苦于以下问题:Java InventoryClickEvent.setCurrentItem方法的具体用法?Java InventoryClickEvent.setCurrentItem怎么用?Java InventoryClickEvent.setCurrentItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.inventory.InventoryClickEvent
的用法示例。
在下文中一共展示了InventoryClickEvent.setCurrentItem方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ClickCheckItem
import org.bukkit.event.inventory.InventoryClickEvent; //导入方法依赖的package包/类
@EventHandler
public void ClickCheckItem(InventoryClickEvent evt){
if(ConfigPatch.AntiLongStringCrashenable == true){
if(evt.getWhoClicked().getType() != EntityType.PLAYER){
return;
}
Player player = (Player) evt.getWhoClicked();
ItemStack item = evt.getCursor();
if(item != null){
if(item.hasItemMeta() && item.getItemMeta().getDisplayName() != null){
if(item.getItemMeta().getDisplayName().length() >= 127){
evt.setCancelled(true);
evt.setCurrentItem(null);
AzureAPI.log(player, ConfigPatch.AntiLongStringCrashWarnMessage);
}
}
}
}
}
示例2: onInventoryClick
import org.bukkit.event.inventory.InventoryClickEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOWEST)
public void onInventoryClick(InventoryClickEvent event){
if(event.getSlot() == 8){
event.setCurrentItem(null);
try {
if(plugin.getConfig().getString("valeitemininv").equals("true")) {
ValeUtil.setVale((Player) event.getWhoClicked(), ValeUtil.getVale((Player) event.getWhoClicked()));
}
} catch (SQLException e) {
e.printStackTrace();
}
event.setCancelled(true);
}
}
示例3: onEvent
import org.bukkit.event.inventory.InventoryClickEvent; //导入方法依赖的package包/类
@Override
public void onEvent(InventoryClickEvent event) {
super.onEvent(event);
if(this.isCarrier(event.getWhoClicked()) && event.getSlot() == ArmorType.HELMET.inventorySlot()) {
event.setCancelled(true);
event.getView().setCursor(null);
event.setCurrentItem(null);
this.flag.getMatch().getScheduler(MatchScope.RUNNING).createTask(() -> {
if(isCurrent()) {
dropFlag();
}
});
}
}
示例4: onInventoryClick
import org.bukkit.event.inventory.InventoryClickEvent; //导入方法依赖的package包/类
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
Player player = (Player) event.getWhoClicked();
ItemStack currentItem = event.getCurrentItem();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
if (!ItemUtils.isEmpty(currentItem) && InventoryLocker.isLockedSlot(currentItem)) {
int slot = event.getSlot();
int line = InventoryLocker.getLine(slot);
if (InventoryLocker.isBuyableSlot(currentItem, line)) {
if (InventoryLocker.canBuySlot((Player) event.getWhoClicked(), line) && InventoryLocker.buySlot(player, line)) {
player.getInventory().setItem(slot, null);
event.setCurrentItem(null);
if (slot < 35) {
player.getInventory().setItem(slot + 1, InventoryLocker.getBuyableSlotForLine(InventoryLocker.getLine(slot + 1)));
}
InventoryManager.get(player).setBuyedSlots(InventoryManager.get(player).getBuyedGenericSlots() + 1);
} else {
event.setCancelled(true);
}
} else {
PlayerUtils.sendMessage(player, RPGInventory.getLanguage().getMessage("error.previous"));
event.setCancelled(true);
}
}
}
示例5: onInventoryClick
import org.bukkit.event.inventory.InventoryClickEvent; //导入方法依赖的package包/类
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (event.getSlot() == 8) {
event.setCurrentItem(null);
try {
ScrapsUtil.setScraps((Player) event.getWhoClicked(), ScrapsUtil.getScraps((Player) event.getWhoClicked()));
} catch (SQLException e) {
e.printStackTrace();
}
event.setCancelled(true);
}
}