java - Bug: Spigot overrides damage - Stack Overflow

I'm working on a kit plugin for Spigot 1.8.8 (Because besides 1.7.10 that's the only viable v

I'm working on a kit plugin for Spigot 1.8.8 (Because besides 1.7.10 that's the only viable version to pvp on). I'm dealing with a weird issue though; Sometimes the damage a player deals to another player is permanently changed to have some arbitrary offset, for instance: He deals 4.0 damage more than he should, even with the fist or an item in hand. This, apparently, is also (sometimes) added to sword damage, although I specifically modified the NBT Data of the swords of my kits to have a custom damage amount, without having to mingle with events where I have to check if a player has a specific kit.

This is extremely weird behaviour, since I don't have any listeners that override damage, except kit specific ones (None of them increase damage by the way), but those literally only work when a kit is equipped (I have custom interfaces, such that a central PlayerKitManager implements the listeners and calls a specific method on any kit implementing the related interface, see below). Furthermore, this damage bug persists, even when

  1. no kit is applied
  2. the kit system is not installed on the server
  3. no plugins whatsoever are installed on the server
  4. deleting usercache and/or playerdata on a map

The ONLY way to fix this temporarily is to setup a completely new server.

My question: Is this a known spigot bug (I'm experiencing this both on FlamePaper and on pandaspigot)? How on earth would I go about debugging this? I have no clue what so ever as to what could be the cause :(

P.S.: A "fix" that worked for a few weeks up until a few moments ago that I implemented (because then, sword damage was not affected):

@EventHandler(priority = EventPriority.HIGH)
    public void onPlayerDamage(EntityDamageByEntityEvent e) {
        if (!(e.getEntity() instanceof Player) || !(e.getDamager() instanceof Player)) return;

        Player damager = (Player) e.getDamager();
        Material itemType = damager.getItemInHand().getType();
        EntityDamageEvent.DamageCause cause = e.getCause();

        System.out.println(damager + ": " + itemType + ", " + cause + ", " + e.getFinalDamage());

        if (!(cause == EntityDamageEvent.DamageCause.ENTITY_ATTACK)) return;

        Set<Material> weapons = new HashSet<>(Arrays.asList(
                Material.WOOD_SWORD, Material.STONE_SWORD, Material.IRON_SWORD,
                Material.GOLD_SWORD, Material.DIAMOND_SWORD
        ));

        UUID damagerUniqueId = damager.getUniqueId();

        //if (!this.playerKits.containsKey(damagerUniqueId)) return;

        Kit damagerkit = this.playerKits.get(damagerUniqueId);

        if (!weapons.contains(itemType) && damager.isOnGround() && !(damagerkit instanceof Stomper))
            e.setDamage(1.0);
        else if (!weapons.contains(itemType) && !damager.isOnGround() && !(damagerkit instanceof Stomper))
            e.setDamage(2.0);

        if (damagerkit instanceof IEntityDamageByEntityEvent)
            e.setCancelled(((IEntityDamageByEntityEvent) damagerkit).onDamage(e));
    }

Don't mind the other stuff in there, that's just code related to kit and listener handling.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744276390a4566350.html

相关推荐

  • java - Bug: Spigot overrides damage - Stack Overflow

    I'm working on a kit plugin for Spigot 1.8.8 (Because besides 1.7.10 that's the only viable v

    7天前
    40

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信