@EventHandler
public void onQuickSlotHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
if (!InventoryManager.playerIsLoaded(player)) {
return;
}
int slotId = event.getNewSlot();
Slot slot = InventoryManager.getQuickSlot(slotId);
if (slot != null && slot.isCup(player.getInventory().getItem(slotId))) {
event.setCancelled(true);
InventoryUtils.heldFreeSlot(player, slotId,
(event.getPreviousSlot() + 1) % 9 == slotId ? InventoryUtils.SearchType.NEXT : InventoryUtils.SearchType.PREV);
}
}
java类org.bukkit.event.player.PlayerItemHeldEvent的实例源码
InventoryListener.java 文件源码
项目:RPGInventory
阅读 27
收藏 0
点赞 0
评论 0
RuneListener.java 文件源码
项目:AsgardAscension
阅读 25
收藏 0
点赞 0
评论 0
@EventHandler
public void onTakeRune(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
if(plugin.getRuneManager().getEffect(player) != null && plugin.getRuneManager().getActiveRune(player) == null) {
plugin.getRuneManager().removeEffect(event.getPlayer());
}
ItemStack item = event.getPlayer().getInventory().getItem(event.getNewSlot());
if(item == null || item.getItemMeta() == null || !item.getType().equals(Material.ENCHANTED_BOOK)) {
return;
}
Rune rune = plugin.getRuneManager().getRune(item.getItemMeta().getDisplayName().substring(2));
if(rune == null) {
return;
}
plugin.getRuneManager().startHoldingEffect(player, rune);
}
Imbuement.java 文件源码
项目:QuestManager
阅读 19
收藏 0
点赞 0
评论 0
@EventHandler
public void onWeaponSwitch(PlayerItemHeldEvent e) {
if (!player.getPlayer().isOnline()) {
return;
}
if (!e.getPlayer().getUniqueId().equals(player.getPlayer().getUniqueId())) {
return;
}
if (!(QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getWorlds()
.contains(e.getPlayer().getWorld().getName()))) {
return;
}
//not allowed to switch weapons, cheater!
this.cancel();
e.getPlayer().sendMessage(FADE_MESSAGE);
}
ForgeSequence.java 文件源码
项目:QuestManager
阅读 21
收藏 0
点赞 0
评论 0
@EventHandler
public void onToolSwap(PlayerItemHeldEvent e) {
if (!e.getPlayer().getUniqueId().equals(player.getPlayer().getUniqueId())) {
return;
}
if (!isWrongTool && !skill.isTool(e.getPlayer().getInventory().getItem(e.getNewSlot()))) {
this.isWrongTool = true;
e.getPlayer().sendMessage(WRONG_TOOL_MESSAGE);
this.wrongItemTimeLeft = WRONG_TOOL_TIMEOUT;
return;
}
if (skill.isTool(e.getPlayer().getInventory().getItem(e.getNewSlot()))) {
this.isWrongTool = false;
return;
}
}
ChargeAction.java 文件源码
项目:QuestManager
阅读 25
收藏 0
点赞 0
评论 0
@EventHandler
public void onItemSwitch(PlayerItemHeldEvent e) {
if (canChangeItems) {
return;
}
if (!player.getPlayer().isOnline()) {
return;
}
if (!e.getPlayer().getUniqueId().equals(player.getPlayer().getUniqueId())) {
return;
}
if (!(QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getWorlds()
.contains(e.getPlayer().getWorld().getName()))) {
return;
}
//not allowed to switch weapons, cheater!
doneCasting();
e.getPlayer().sendMessage(DISTURBED_MESSAGE);
}
PlayerConnection.java 文件源码
项目:CraftBukkit
阅读 26
收藏 0
点赞 0
评论 0
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
// CraftBukkit start
if (this.player.dead) return;
if (packetplayinhelditemslot.c() >= 0 && packetplayinhelditemslot.c() < PlayerInventory.getHotbarSize()) {
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packetplayinhelditemslot.c());
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
this.player.v();
return;
}
// CraftBukkit end
this.player.inventory.itemInHandIndex = packetplayinhelditemslot.c();
this.player.v();
} else {
c.warn(this.player.getName() + " tried to set an invalid carried item");
this.disconnect("Nope!"); // CraftBukkit
}
}
BeaconLinkListener.java 文件源码
项目:beaconz
阅读 23
收藏 0
点赞 0
评论 0
/**
* Make sure all player held maps have triangle overlays. (todo: make sure all maps on item frames do as well)
* There seem to be some bugs around this. It doesn't always take on the first try.
*/
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled=true)
public void onMapHold(final PlayerItemHeldEvent event) {
Player player = event.getPlayer();
ItemStack itemInHand = player.getInventory().getItem(event.getNewSlot());
if (itemInHand == null) return;
if (!Material.MAP.equals(itemInHand.getType())) {
return;
}
if (!player.getWorld().equals(getBeaconzWorld())) {
return;
}
@SuppressWarnings("deprecation")
MapView map = Bukkit.getMap(itemInHand.getDurability());
for (MapRenderer renderer : map.getRenderers()) {
if (renderer instanceof TerritoryMapRenderer) {
return;
}
}
map.addRenderer(new TerritoryMapRenderer(getBeaconzPlugin()));
}
CustomItemManager.java 文件源码
项目:civcraft
阅读 24
收藏 0
点赞 0
评论 0
@EventHandler(priority = EventPriority.HIGHEST)
public void onItemHeld(PlayerItemHeldEvent event) {
if (event.isCancelled()) {
return;
}
ItemStack stack = event.getPlayer().getItemInHand();
if (stack == null) {
return;
}
LoreMaterial material = LoreMaterial.getMaterial(stack);
if (material != null) {
material.onHold(event);
}
}
PlayerConnection.java 文件源码
项目:Almura-Server
阅读 31
收藏 0
点赞 0
评论 0
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
// CraftBukkit start
if (this.player.dead) return;
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) {
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex));
this.player.u();
return;
}
// CraftBukkit end
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
this.player.u();
} else {
this.minecraftServer.getLogger().warning(this.player.getName() + " tried to set an invalid carried item");
this.disconnect("Nope!"); // CraftBukkit
}
}
PlayerConnection.java 文件源码
项目:Tweakkit-Server
阅读 25
收藏 0
点赞 0
评论 0
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
// CraftBukkit start
if (this.player.dead) return;
if (packetplayinhelditemslot.c() >= 0 && packetplayinhelditemslot.c() < PlayerInventory.getHotbarSize()) {
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packetplayinhelditemslot.c());
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
this.player.v();
return;
}
// CraftBukkit end
this.player.inventory.itemInHandIndex = packetplayinhelditemslot.c();
this.player.v();
} else {
c.warn(this.player.getName() + " tried to set an invalid carried item");
this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason
}
}
MultiBuilder.java 文件源码
项目:sensibletoolbox
阅读 21
收藏 0
点赞 0
评论 0
@Override
public void onItemHeld(PlayerItemHeldEvent event) {
int delta = event.getNewSlot() - event.getPreviousSlot();
if (delta == 0) {
return;
} else if (delta >= 6) {
delta -= 9;
} else if (delta <= -6) {
delta += 9;
}
delta = (delta > 0) ? 1 : -1;
int o = getMode().ordinal() + delta;
if (o < 0) {
o = Mode.values().length - 1;
} else if (o >= Mode.values().length) {
o = 0;
}
setMode(Mode.values()[o]);
event.getPlayer().setItemInHand(toItemStack());
}
PlayerConnection.java 文件源码
项目:SpigotSource
阅读 29
收藏 0
点赞 0
评论 0
public void a(PacketPlayInHeldItemSlot packetplayinhelditemslot) {
PlayerConnectionUtils.ensureMainThread(packetplayinhelditemslot, this, this.player.x());
if (this.player.dead) return; // CraftBukkit
if (packetplayinhelditemslot.a() >= 0 && packetplayinhelditemslot.a() < PlayerInventory.getHotbarSize()) {
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packetplayinhelditemslot.a());
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.sendPacket(new PacketPlayOutHeldItemSlot(this.player.inventory.itemInHandIndex));
this.player.resetIdleTimer();
return;
}
// CraftBukkit end
this.player.inventory.itemInHandIndex = packetplayinhelditemslot.a();
this.player.resetIdleTimer();
} else {
PlayerConnection.LOGGER.warn(this.player.getName() + " tried to set an invalid carried item");
this.disconnect("Invalid hotbar selection (Hacking?)"); // CraftBukkit //Spigot "Nope" -> Descriptive reason
}
}
PlayerConnection.java 文件源码
项目:Craft-city
阅读 25
收藏 0
点赞 0
评论 0
public void a(Packet16BlockItemSwitch packet16blockitemswitch) {
// CraftBukkit start
if (this.player.dead) return;
if (packet16blockitemswitch.itemInHandIndex >= 0 && packet16blockitemswitch.itemInHandIndex < PlayerInventory.getHotbarSize()) {
PlayerItemHeldEvent event = new PlayerItemHeldEvent(this.getPlayer(), this.player.inventory.itemInHandIndex, packet16blockitemswitch.itemInHandIndex);
this.server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
this.sendPacket(new Packet16BlockItemSwitch(this.player.inventory.itemInHandIndex));
return;
}
// CraftBukkit end
this.player.inventory.itemInHandIndex = packet16blockitemswitch.itemInHandIndex;
} else {
this.minecraftServer.getLogger().warning(this.player.name + " tried to set an invalid carried item");
this.disconnect("Nope!"); // CraftBukkit
}
}
CreateListener.java 文件源码
项目:Shopkeepers
阅读 22
收藏 0
点赞 0
评论 0
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
void onItemHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE) return;
ItemStack newItemInHand = player.getInventory().getItem(event.getNewSlot());
if (!Settings.isShopCreationItem(newItemInHand)) {
return;
}
if (!ShopkeepersPlugin.getInstance().hasCreatePermission(player)) {
// player cannot create any shopkeeper at all
return;
}
// print info message about usage:
Utils.sendMessage(player, Settings.msgCreationItemSelected);
}
OpenBookListener.java 文件源码
项目:EpicQuest
阅读 27
收藏 0
点赞 0
评论 0
@EventHandler
public void onEditBook(PlayerItemHeldEvent event){
//Get player and the action
Player player = event.getPlayer();
EpicPlayer epicPlayer = EpicSystem.getEpicPlayer(player.getUniqueId());
ItemStack inHand = player.getInventory().getItem(event.getNewSlot());
if(inHand != null && inHand.getType() == Material.WRITTEN_BOOK){
BookMeta book = (BookMeta)inHand.getItemMeta();
if(book.hasTitle() && book.getTitle().equalsIgnoreCase("Quest Book")){
//Open zeh quest book!
inHand.setItemMeta(SetQuestBookPages(epicPlayer, book));
}
}
}
CombatManager.java 文件源码
项目:ZentrelaRPG
阅读 23
收藏 0
点赞 0
评论 0
@EventHandler
public void onChangeItemInHand_equipItem(final PlayerItemHeldEvent event) {
RScheduler.schedule(plugin, new Runnable() {
public void run() {
PlayerDataRPG pd = plugin.getPD((Player) (event.getPlayer()));
if (pd != null)
pd.updateEquipmentStats();
}
});
}
BardClass.java 文件源码
项目:HCFCore
阅读 21
收藏 0
点赞 0
评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onItemHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
PvpClass equipped = plugin.getPvpClassManager().getEquippedClass(player);
if (equipped == null || !equipped.equals(this)) {
return;
}
UUID uuid = player.getUniqueId();
long lastMessage = msgCooldowns.get(uuid);
long millis = System.currentTimeMillis();
if (lastMessage != msgCooldowns.getNoEntryValue() && lastMessage - millis > 0L) {
return;
}
ItemStack newStack = player.getInventory().getItem(event.getNewSlot());
if (newStack != null) {
BardEffect bardEffect = bardEffects.get(newStack.getType());
if (bardEffect != null) {
msgCooldowns.put(uuid, millis + 1500L);
player.sendMessage(ChatColor.GOLD + "Bard Effect: " + ChatColor.GOLD);
player.sendMessage(ChatColor.GOLD + "\u00bb " + ChatColor.YELLOW + "Clickable Effect: " + ChatColor.AQUA + Lang.fromPotionEffectType(bardEffect.clickable.getType()) + ' '
+ (bardEffect.clickable.getAmplifier() + 1) + ChatColor.GRAY + " (" + (bardEffect.clickable.getDuration() / 20) + "s)");
player.sendMessage(ChatColor.GOLD + "\u00bb " + ChatColor.YELLOW + "Energy Cost: " + ChatColor.AQUA + bardEffect.energyCost);
}
}
}
EnderPearlTimer.java 文件源码
项目:HCFCore
阅读 21
收藏 0
点赞 0
评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
PearlNameFaker pearlNameFaker = itemNameFakes.get(player.getUniqueId());
if (pearlNameFaker != null) {
int previousSlot = event.getPreviousSlot();
ItemStack item = player.getInventory().getItem(previousSlot);
if (item == null)
return;
pearlNameFaker.setFakeItem(((CraftItemStack) item).handle, previousSlot);
}
}
BardClass.java 文件源码
项目:HCFCore
阅读 20
收藏 0
点赞 0
评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onItemHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
PvpClass equipped = plugin.getPvpClassManager().getEquippedClass(player);
if (equipped == null || !equipped.equals(this)) {
return;
}
UUID uuid = player.getUniqueId();
long lastMessage = msgCooldowns.get(uuid);
long millis = System.currentTimeMillis();
if (lastMessage != msgCooldowns.getNoEntryValue() && lastMessage - millis > 0L) {
return;
}
ItemStack newStack = player.getInventory().getItem(event.getNewSlot());
if (newStack != null) {
BardEffect bardEffect = bardEffects.get(newStack.getType());
if (bardEffect != null) {
msgCooldowns.put(uuid, millis + 1500L);
player.sendMessage(ChatColor.GOLD + "Bard Effect: " + ChatColor.GOLD);
player.sendMessage(ChatColor.GOLD + "\u00bb " + ChatColor.YELLOW + "Clickable Effect: " + ChatColor.AQUA + Lang.fromPotionEffectType(bardEffect.clickable.getType()) + ' '
+ (bardEffect.clickable.getAmplifier() + 1) + ChatColor.GRAY + " (" + (bardEffect.clickable.getDuration() / 20) + "s)");
player.sendMessage(ChatColor.GOLD + "\u00bb " + ChatColor.YELLOW + "Energy Cost: " + ChatColor.AQUA + bardEffect.energyCost);
}
}
}
EnderPearlTimer.java 文件源码
项目:HCFCore
阅读 30
收藏 0
点赞 0
评论 0
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
PearlNameFaker pearlNameFaker = itemNameFakes.get(player.getUniqueId());
if (pearlNameFaker != null) {
int previousSlot = event.getPreviousSlot();
ItemStack item = player.getInventory().getItem(previousSlot);
if (item == null)
return;
pearlNameFaker.setFakeItem(((CraftItemStack) item).handle, previousSlot);
}
}
InventoryListener.java 文件源码
项目:ArchersBattle
阅读 26
收藏 0
点赞 0
评论 0
@EventHandler
public void onHeld(PlayerItemHeldEvent e) {
if (e.isCancelled()) {
return;
}
if (!Utils.isInArena(e.getPlayer())) {
return;
}
if (e.getNewSlot() == 0) {
return;
}
if (e.getNewSlot() >= 2 && e.getNewSlot() <= 4) {
int slot = e.getNewSlot();
Player p = e.getPlayer();
PlayerInventory inv = p.getInventory();
ItemStack item = inv.getItem(slot).clone();
item.setAmount(1);
if (SkillManager.getInstance().isSkillSelector(item)) {
Skill skill = SkillManager.getInstance().getSkillBySelector(item);
if(skill.getSkillType().equals(SkillType.ITEM)){
inv.setItem(0, skill.getShow());
}
else{
Class<?> skillClazz=skill.getClass();
try {
Method method =skillClazz.getMethod("doUpgrade",Player.class);
if(method!=null){
method.invoke(SkillManager.getInstance().getSkillByName(skill.getName()),p);
}
} catch (Exception e1) {
e1.printStackTrace();
}
}
inv.setItem(2, ItemManager.getForbidden(3));
inv.setItem(3, ItemManager.getForbidden(4));
inv.setItem(4, ItemManager.getForbidden(5));
}
}
e.setCancelled(true);
}
HeldItemListener.java 文件源码
项目:FlexMC
阅读 20
收藏 0
点赞 0
评论 0
@Override
public void handle( ConnectionHandler connectionHandler, MessageC1AHeldItemChange message ) {
FlexPlayer p = connectionHandler.getPlayer();
p.handleSetHeldItemSlot( message.getSlot() );
ItemStack stack = connectionHandler.getPlayer().getInventory().getItem( message.getSlot() );
EventFactory.call( new PlayerItemHeldEvent( p, p.getHeldItemSlot(), message.getSlot() ) );
for( FlexPlayer player : connectionHandler.getPlayer().getWorld().getPlayerSet() ) {
if( !player.equals( connectionHandler.getPlayer() ) ) {
player.getConnectionHandler().sendMessage( new MessageS3FEntityEquipment( connectionHandler.getPlayer().getEntityId(), 0, stack ) );
}
}
}
EnderpearlListener.java 文件源码
项目:Chambers
阅读 24
收藏 0
点赞 0
评论 0
@EventHandler
public void onPlayerItemHeldEvent(PlayerItemHeldEvent event) {
ItemStack itemStack = event.getPlayer().getInventory().getItem(event.getPreviousSlot());
if (itemStack != null && itemStack.getType() == Material.ENDER_PEARL && itemStack.getItemMeta() != null) {
ItemMeta itemMeta = itemStack.getItemMeta();
itemMeta.setDisplayName(null);
itemStack.setItemMeta(itemMeta);
}
}
ActionBind.java 文件源码
项目:McLink
阅读 32
收藏 0
点赞 0
评论 0
@EventHandler
public void onNewItem(PlayerItemHeldEvent event) {
for (int s = 0; s < 103; s++) {
ItemStack i = event.getPlayer().getInventory().getItem(s);
if (i != null && i.getItemMeta() != null && !i.getType().equals(Material.AIR) && ItemId.extract(i).equals("")) {
event.getPlayer().getInventory().setItem(s, ItemId.attach(i, "minecraft:" + i.getType().name().toLowerCase()));
}
}
}
Events.java 文件源码
项目:NeoHG
阅读 27
收藏 0
点赞 0
评论 0
@EventHandler
private void onBar(PlayerItemHeldEvent event) {
if (!CONFIG_RESULTS[0])
return;
if (Game.getState() != State.STARTING)
return;
if (event.getPlayer().getInventory().getItem(event.getNewSlot()) != null)
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.ORB_PICKUP, 1.0F, 1.0F);
}
PlayerListener.java 文件源码
项目:ExilePearl
阅读 24
收藏 0
点赞 0
评论 0
/**
* Announce the person in a pearl when a player holds it
* @param event
*/
@EventHandler(priority = EventPriority.MONITOR)
public void onItemHeldChange(PlayerItemHeldEvent event) {
Inventory inv = event.getPlayer().getInventory();
ItemStack item = inv.getItem(event.getNewSlot());
ItemStack newitem = validatePearl(item);
if (newitem != null) {
inv.setItem(event.getNewSlot(), newitem);
}
}
InventoryEvents.java 文件源码
项目:Pokkit
阅读 30
收藏 0
点赞 0
评论 0
@EventHandler(ignoreCancelled = false)
public void onDrop(cn.nukkit.event.player.PlayerDropItemEvent event) {
if (canIgnore(PlayerItemHeldEvent.getHandlerList())) {
return;
}
PokkitItemEntity pokkit = new PokkitItemEntity(event.getItem(), event.getPlayer().getLocation());
PlayerDropItemEvent bukkitEvent = new PlayerDropItemEvent(PokkitPlayer.toBukkit(event.getPlayer()), pokkit);
callCancellable(event, bukkitEvent);
}
ExprHotbarSwitchSlot.java 文件源码
项目:Skellett
阅读 21
收藏 0
点赞 0
评论 0
@SuppressWarnings({ "unchecked", "rawtypes" })
public boolean init(Expression<?>[] e, int matchedPattern, Kleenean isDelayed, ParseResult parser) {
if (!ScriptLoader.isCurrentEvent((Class)PlayerItemHeldEvent.class)) {
Skript.error("changed hotbar slot can only be used within the on hotbar change event!");
return false;
}
if (parser.mark == 2) {boo = false;}
return true;
}
ExprHotbarSwitchSlot.java 文件源码
项目:Skellett
阅读 22
收藏 0
点赞 0
评论 0
@Nullable
protected Integer[] get(Event e) {
if (boo) {
return new Integer[]{((PlayerItemHeldEvent)e).getPreviousSlot()};
} else {
return new Integer[]{((PlayerItemHeldEvent)e).getNewSlot()};
}
}
BrushListener.java 文件源码
项目:FastAsyncWorldedit
阅读 19
收藏 0
点赞 0
评论 0
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlayerItemHoldEvent(final PlayerItemHeldEvent event) {
final Player bukkitPlayer = event.getPlayer();
if (bukkitPlayer.isSneaking()) {
return;
}
FawePlayer<Object> fp = FawePlayer.wrap(bukkitPlayer);
com.sk89q.worldedit.entity.Player player = fp.getPlayer();
LocalSession session = fp.getSession();
Tool tool = session.getTool(player);
if (tool instanceof ScrollTool) {
final int slot = event.getNewSlot();
final int oldSlot = event.getPreviousSlot();
final int ri;
if ((((slot - oldSlot) <= 4) && ((slot - oldSlot) > 0)) || (((slot - oldSlot) < -4))) {
ri = 1;
} else {
ri = -1;
}
ScrollTool scrollable = (ScrollTool) tool;
if (scrollable.increment(player, ri)) {
if (Settings.IMP.EXPERIMENTAL.PERSISTENT_BRUSHES) {
bukkitPlayer.getInventory().setHeldItemSlot(oldSlot);
} else {
final PlayerInventory inv = bukkitPlayer.getInventory();
final ItemStack item = inv.getItem(slot);
final ItemStack newItem = inv.getItem(oldSlot);
inv.setItem(slot, newItem);
inv.setItem(oldSlot, item);
bukkitPlayer.updateInventory();
}
}
}
}