1.15.2 Block speed atribute in boots on creative server

Discussion in 'Spigot Plugin Development' started by Msql, Jan 25, 2020.

  1. Hi, is it possible to block speed atribute in boots on creative server?
    If yes, how to listen to it and block it?
    Players on my server are generating this boots and walk like crazy. Problem with it is that by this speed they are triggering map render a lot and TPS drops are huge.
    Thanks for any help!
     
  2. Are they generating them in survival mode?
    Otherwise your event would be the inventory click event (for dragging in the gui). It should be possible to detect the "right click" equipping through the player interact event.

    In both cases just check if the item is invalid and remove it.
     
  3. This is creative mode so I think it is impossible to listen to inventory events correctly, so players can equip it directly from inventory.
    I was asking for more like how to prevent players from using this boots or how to disable affect of this attribute, is it possible?
     
  4. Disabling the effect globally is not possible.
    But the event will be called. It is just the take item out of creative inventory that is handled client sided.
     
  5. Otherwise you could just use Runnable checking every second if any player has one of the forbidden boots.
     
  6. Ok, thanks. How to check if boots have speed attribute with bukkit api? Is it possible?
     
  7. Should work with something like
    Code (Java):
    ItemStack boots = ...;
    final Multimap<Attribute, AttributeModifier> attributeModifiers = boots.getItemMeta().getAttributeModifiers();
    if (attributeModifiers.containsKey(Attribute.GENERIC_MOVEMENT_SPEED)) {
        // reurn falso or smth
    }
     
    • Useful Useful x 1
  8. Btw how are the players generating the boots?
    If they just enter a command that adds the modifier; you would basically have to check for every Armor Item, the Item in the current Hand and the Item in the off-hand...
    If you'd simply block the command (or at least a part of the command that allows them to get the boots) you could simply listen to when a command is been sent
     
  9. They are generating it by using saved toolbar in creative mode.