0

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.

2
  • 1
    "Is this a known spigot bug" is a question you should direct to the maintainers of Spigot, not here. Stack Overflow is not customer support for your favourite project. If you want to know how to fix a problem, you should ask about that. Commented Mar 24 at 10:33
  • If it wasn't obvious enough: "How on earth would I go about debugging this? I have no clue what so ever as to what could be the cause :(" implies that I'm inquiring about how to fix this. Commented Mar 25 at 14:15

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.