use of xyz.derkades.ublisk.weapons.Weapon in project Ublisk by Derkades.
the class AbilityListener method onInteract.
@EventHandler
public void onInteract(PlayerInteractEvent event) {
Action action = event.getAction();
if (action == Action.PHYSICAL)
return;
UPlayer player = new UPlayer(event);
if (action == Action.LEFT_CLICK_AIR || action == Action.LEFT_CLICK_BLOCK) {
for (Weapon weapon : Weapon.WEAPONS) {
if (Weapon.itemStackIsWeapon(player.getInventory().getItemInMainHand().getItemStack(), weapon)) {
player.doAbility(weapon.getLeftClickAbility());
}
}
}
if (action == Action.RIGHT_CLICK_AIR || action == Action.RIGHT_CLICK_BLOCK) {
for (Weapon weapon : Weapon.WEAPONS) {
if (Weapon.itemStackIsWeapon(player.getInventory().getItemInMainHand().getItemStack(), weapon)) {
player.doAbility(weapon.getRightClickAbility());
}
}
}
}
Aggregations