1. Guest, as per the stickied thread, this forum has not been in use since 2014. All bugs and feature requests should be posted to JIRA.

Accepted A way to prevent this

Discussion in 'Bugs & Feature Requests' started by PhanaticD, Sep 11, 2013.

  1. PhanaticD



    so basically someone on my creative server created a skeleton egg with this ridiculously long name, and when they placed it, it would crash anyone who loaded it with:


    please add some sort of check to prevent this
  2. joehot200


    Well, when the blocks placed, get the item name/lore in the persons hand, get the length of characters in it, and if its over 60, set the item in the players hand to air and cancel the place event.
    #2 joehot200, Sep 11, 2013
    Last edited: Sep 11, 2013
  3. PhanaticD


    since i dont know how to code you should send a PR to spigot so they add it then
  4. LiLChris

    LiLChris Retired Moderator

    A suggestion, as 50% of your posts seem to be you spewing out code related words...STOP!

    Not everyone is a coder and not everyone wants a plugin to fix an issue whether it be within Spigot or another plugin. Finding a solution that doesn't involve extra plugins is best.
    • Agree Agree x 3
    • Friendly Friendly x 1
    • Optimistic Optimistic x 1
    • Creative Creative x 1
  5. joehot200


    Of course it is, but when things need to be sorted quickly it is the work of less than 5 minutes to type out the code, put it on the servers, and restart the server.
    Also, i presume everyone who owns 100+ player server to be a coder. Running 500+ players with code? How is that even possible? :confused:

    Anyway, yes i will stop presuming everyone is a coder. however i see no immediate fix to the problem apart from md_5 coding one, or there being a plugin that will block such actions.
    #5 joehot200, Sep 11, 2013
    Last edited: Sep 11, 2013
    • Agree Agree x 1
  6. Dmck2b

    Services Staff

    Or someone submitting a patch with an extra check in ItemMonsterEgg.java in n/m/s/1.6.2/ on line 40/41.

    I'd try to help out but I've never gotten Spigot to successfully compile.
  7. Puremin0rez


    Nice find. I hate these types of bugs, NPC nameplates did it when they first came out aswell.
  8. The problem is creative is super powerful. Creative mode has raw access to the NBT, and could create any kind of item they want with client mods.

    This is only the tip of the iceberg in bugs like this, and will be plenty more if you give your players creative.

    I know of quite a few super damaging things to do with creative... its best to simply enable fly mode and access to /give, or maybe someone can nerf creative mode to not have so much freedom.
    • Agree Agree x 1
  9. PhanaticD


    Would be nice if servers nerfed creative mode powers especially if they can damage i did not even know creative mode has that kind of access
  10. joehot200


    *sigh* ikr. Whats next. /stop? :mad:
  11. LiLChris

    LiLChris Retired Moderator

    My players have yet to see this.
    *crosses fingers*
    • Optimistic Optimistic x 2
  12. PhanaticD


    so this says accepted but is it in spigot yet? one of my mods got caught in a crash trap again
  13. md_5

    Administrator Developer

    No, when its solved it will be.
  14. Dmck2b

    Services Staff

    Made a fix but it is probably the least efficient way possible knowing how I used to code.

    Commit to forked repo.

    Patch file.

    Test environment with .bat start up looking for a spigot.jar and my build with a fix, spigot #1100 and a world file with a player (change it to your name) with a skeleton spawn egg with 900+ characters.

    Note, that test build actually has a comment in the wrong place, but I have tested the re-made commit/patch's build. (My horrible internet took 40 minutes to upload that 30mb file)
    • Like Like x 2
  15. jtaylor69

    jtaylor69 Retired Moderator

    First world problems ;-)
    • Like Like x 3
    • Funny Funny x 2
  16. I've got people on my creative server with potions that kill you just by holding them and don't let you respawn. I think that there should be a way.
  17. If you're looking for a quick fix and are okay with using NMS code you can easily fix this problem by interacting with the itemstack's attribute modifiers.

    To get the NMS ItemStack object from a Bukkit ItemStack:
    net.minecraft.server.v1_6_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);

    To get the NBTTagCompound:
    #18 EDawg878, Oct 3, 2013
    Last edited: Oct 3, 2013
  18. PhanaticD


    yea totally
  19. What do you mean? They are called AttributeModifiers and they are being stored in the NBT tags, there's no way as far as I know to read the tags with the Bukkit API so you have to use NMS code.