likely something along the lines of
Code:player.getEquipment().contains(...)
|
So I was wondering, how do I check wether a player is holding a specific weapon?
I tried playing around with this
But it didnt get me very farCode:if(player.getEquipment().update(Slot.WEAPON, ));
of course it depends on your source which you haven't provided but will be along the lines of what Tesla said above. If you use an IDE (eclipse, intelliji) you can type
(type it not copy and paste it), and a list of available methods will pop up after the period. Of course if you don't have player declared or your source does not contain these methods then it won't, but that should be self explanatory.Code:player.getEquipment().
With a bit of some trial and error I managed to fix it if anyone else is wondering here is the code.
Code:if(c.getItems().isWearingItem(tboww.getId())) { c.sendMessage("Player is wearing Twisted Bow!"); }else { c.sendMessage("Player is not wearing a Twisted Bow!"); }
is the same asCode:if(c.getItems().isWearingItem(tboww.getId())) {
just different method namesCode:player.getEquipment().contains(...)
I'm so glad im done with pi
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |