NukkitX 2.0 Plugin Development Error

Kazuk

Moderator
Staff member
I'm creating a plugin using NukkitX API 2.0 where if you hit a player with a bow it will display in chat from a config file that %name% is now at %health%
I'm getting this error Operator '==' cannot be applied to 'cn.nukkit.utils.Identifier', 'int'
Java:
public void onDamageByBow(EntityDamageEvent event) {
        if (event instanceof EntityDamageByEntityEvent && event.getCause() == DamageCause.PROJECTILE && ((EntityDamageByEntityEvent)event).getDamager() instanceof Player && ((Player)((EntityDamageByEntityEvent)event).getDamager()).getInventory().getItemInHand().getId() == 261) {
            Player player = (Player)((EntityDamageByEntityEvent)event).getDamager();
            if (this.getConfig().getBoolean("actionbar.enable", false)) {
                player.sendActionBar(TextFormat.colorize(this.getConfig().getString("actionbar.format")).replace("%name%", event.getEntity().getName()).replace("%health%", Float.toString(event.getEntity().getHealth())), this.getConfig().getInt("actionbar.fadein"), this.getConfig().getInt("actionbar.duration"), this.getConfig().getInt("actionbar.fadeout"));
            }
            if (this.getConfig().getBoolean("message.enable", true)) {
                player.sendMessage(TextFormat.colorize(this.getConfig().getString("message.format")).replace("%name%", event.getEntity().getName()).replace("%health%", Float.toString(event.getEntity().getHealth())));
            }
        }
    }
 
Top