Inactive [DEV] BukkitContrib Alpha 0.1.7 [1000]

Discussion in 'Inactive/Unsupported Plugins' started by Afforess, May 21, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    BukkitContrib is superseded by Spout, the new Bukkit/Client framework.
  2. Offline


    Ok maybe best if we start from the beginning and keep it seperate from other talk...

    I'm trying to implement BukkitContrib into Heroes to give us Inventory Hooks. I am monitoring the onInventoryClick event and I am Cancelling/Not Allowing the click to happen if they are trying to equip a piece of armor or weapon they cant use.

    When this happens the server knows this and acts accordingly however the client isn't informed of this behaviour and still thinks they have the item equipped so the inventories become out of sync. This is on servers with just Heroes and BukkitContrib, no other plugins present that touch the inventory or the events.
  3. Offline


    perhaps we need more testing on both sides to see if the issues persist or not.
  4. Offline


    OMFG, LOL, I never tested that half of the code. It will currently allow you to cancel removing an item from a slot, but not from placing an item into a slot. It's a simple fix. (Already have it fixed on my machine...) I'll have BukkitContrib 0.0.3 up tonight!

    Switching Subjects:


    I have discovered the cause of the clash between OpenInv & BukkitContrib. BukkitContrib caches the bukkit inventory wrapper to save memory, but when you replaced the inventory on the entityplayer, the cache becomes out of date. I've added checks to ensure the cache is up to date with each .getInventory() call on players, and it should fix the problem. So really, neither party is to blame, just an unfortunate combination of code. It will also be fixed in 0.0.3
  5. Offline


    Glad to hear, looking forward to the update so Kainzo can finally rest and have his Inv hooks :p.
  6. Offline


    Honestly - If I dont get inventory restrictions soon - I'll kill everyone around me with tweezers
  7. Offline


    Likewise. Just double checking that my small change did not blow anything else up with it. ;)

    Your sister first, right?

    jk. :p

    Edit: ha, it didn't break anything. Thank you for being persistent @Rigby90 - I often do not get the point unless you bash it into my skull. :)

    Edit2: @Rigby90 - you can test my fix here:

    Let me know if it still doesn't work.
  8. Offline


    I'll provide the noose and or hammer!
  9. Offline


    I can't pick up any item at all within inventory anymore, as soon as I click it it changes it to another space in the inventory. This is with Heroes enabled and BukkitContrib on its own.

    Just out of curiosity... I hope that 'welcome message' is toggleable and can be turned off by admins.
  10. Offline


    Really? I'm using it fine - my inventory acts normally. With just BukkitContrib does it work? What events are you cancelling in heroes?

    Yeah - I'm hoping to find a less intrusive way around that. I agree, it is not ideal. I'm developing a BukkitContrib SP mod, with extra packets. I need a way to tell the SP mod that the Server is using BukkitContrib and can receive the new packets (sending unsupported packets kicks the player), and so right now, I'm intercepting that login chat message. The login message does not appear if you are using the BukkitContrib SP mod. But I want to look at other packets, and see if I can take advantage of one of them instead of using the chat packet.
  11. Offline


    Can we have an option to disable the onJoin message? I'd rather have the login msg for MOTD updates as they can get pretty hefty.\

    heh - I just now saw that it was addressed.
  12. Offline


    Ok first of all... Ignore that error... Turns out the client mod I installed a few hours ago decided it wanted to play silly buggers after I updated BukkitContrib. Will get straight to testing it properly.

    If you just want the intro message there to tell the Client version of the Mod it is enabled then send a combination of color codes, these dont show up on the client but can be detected by your client side mod.

    WorldEdit etc use this to communicate with their clientside mods, same as FlyHack mods use this for servers to turn off Flying.
  13. Offline


    TYVM, genius idea. I was thinking of changing the text white, but I was unsure how effective that would be.
  14. Offline


    Ok good news, looks like with that Client Mod out the Window it works perfectly and the client is informed of the restriction. We'll chuck this on the Heroes test server and see if it keeps up.

    During one of the /reload's the following stack trace popped up, not sure if it is of any value to you.

    Ok came across something.

    My character has a DIAMOND_CHESTPLATE equipped... he can wear it fine. He cannot wear a LEATHER_CHESTPLATE. When I go to replace the DIAMOND with the LEATHER I get told I can't use the armor which is correct... However the LEATHER_CHESTPLATE is then lost into oblivion as the mouse clears its item and the DIAMOND_CHESTPLATE stays equipped.

    The part which is the problem is losing the LEATHER_CHESTPLATE everything else works fine. Not sure if this is intentional or not, if it is we can resolve it within Heroes by creating a new item and attaching it to ther Cursor.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 15, 2016
  15. Offline


    Thanks! That'll be convenient for me...
  16. Offline


    Yeah, I need to unregister my new packets. Thanks for reminding me.

    The cursor should not be lost (I attempt to save the cursor), but I have noticed instances where it get's lost despite that not being possible from my end. I expect Notch's client packets are to blame. So if you want to ensure that the cursor it correct, set the cursor slot.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 15, 2016
  17. Offline


    Progress! Lovely
  18. Offline


    Ok got more on the issue...

    When placing an item into an empty slot then cancelling it... the item is reattached to your cursor. However when placing an item in a slot which already contains an item (so replacing the item in slot with the one in hand) the item in hand is lost upon cancelling the event.

    Also using the method of assigning the item back to the cursor is causing duplication of items for some reason. So the only real solution I can think of is to try to fix the issue as to why it is lost in the first place.
  19. Offline


  20. Offline


    Well, I do correctly initialize both stacks after the event:

            //clicked on bottom player inventory
            if (!(this.player.activeContainer instanceof ContainerPlayer) && this.player.defaultContainer instanceof ContainerPlayer && packet.b >= inventory.getSize()) {
                int activeSlot = packet.b - inventory.getSize() + 9;
                if (activeSlot > this.getPlayer().getInventory().getSize()) {
                    activeSlot -= this.getPlayer().getInventory().getSize();
                type = getInventorySlotType(activeSlot);
                event = new InventoryPlayerClickEvent(this.getPlayer(), this.getPlayer().getInventory(), type, slot, cursor, activeSlot, activeLocation);
            else {
                event = new InventoryClickEvent(this.getPlayer(), inventory, type, slot, cursor, packet.b, activeLocation);
            if (event != null) {
                 result = event.getResult();
                 cursor = ContribCraftItemStack.getContribCraftItemStack(event.getCursor());
                 slot = ContribCraftItemStack.getContribCraftItemStack(event.getItem());
            //initialize setup
            ItemStack itemstack = slot != null ? slot.getHandle() : null;
            ItemStack cursorstack = cursor != null ? cursor.getHandle() : null;
    The //initialize setup part creates MC item stacks based on the items set in the event.

    Anyway, when I first wrote the BukkitContrib code, I had like 15 lines of debug text for each window click, so I knew the slot, item, packet info, etc, and there were times were the packets were simply missed. I think the client pre-processing can just assume that if a player clicks an item into a slot (and the client allows it) that it should happen - and if it happens quickly enough (same tick), the cursor item is lost (the first packet is not sent with the valid cursor, the newer packet takes over, with the cursor empty after the first 'succcessful' packet) and so the server is not told about it. At least, something like that. Because I know the server is not being sent all the info in about 2% cases (the lost cursor only happened to me when I rapidly tried to place an item when it blocked me)

    If your cursor is being lost more than 2 times in 100, then something else is amiss. I only have 1 loose cannon idea, and I'll post an alpha 2 here for you to test. I need sleep. Sorry @Kainzo . ;)

    Also, to tantalize others, what to expect in future BukkitContrib releases:

    BukkitContrib 0.0.3
    -Fully functional Inventory Hooks
    -Fix for inventory cache bug experienced with InvOpen

    BukkitContrib 0.0.4
    Chunk/Block state cache view (see Bukkit pull request for general idea) for concurrent thread processing
    Keyboard Events/Keyboard Manager
    Custom Skin Manager (per Player & global)
    Custom Name for players/entities (per Player & global)
    Fix for various MC SP

    BukkitContrib will be launching an optional client mod that will provide plugin developers even more events and a broader API to improve the player experience. I'd like to get as many players using it, since the more players, the better the experience. I also want to make it more than just my personal project, so I will encourage pull requests for both the SMP and SP client mod. The SP client mod will not negatively interact with servers w/o the BukkitContrib plugin. In the long term, I'd like to add custom packet management for other plugins & a way for clients to download new items/entities to from servers, but that will be post Alpha. I want to add new features incrementally, and be sure they all work before focusing on others.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 15, 2016
  21. Offline


    For me it works fine, but you maybe want to have a look at it.
  22. Offline


    I didn't test it 100 times but a definitely a good few times and it was lost everytime.

    Seems like that version you posted there works and the cursor item is kept.
  23. Offline


    Already figured out the issue a few pages back, if you see the planned changelog for v0.0.3, you'l see I've got it covered.

    (I did put "Alpha"in the title here. ;) This is very much a work in progress)

    Really? Awesome. That was just a stab in the dark by my exhausted mind. Glad it was right.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 15, 2016
  24. Offline


    fine :)
  25. Offline


    BukkitContrib alpha 0.0.3 is up! Please see the changelog on the OP, fixes several bugs.
  26. Offline


    You left debug messaging in again :p.

    17:04:33 [INFO] hmm
    17:04:59 [INFO] hmm
    17:05:01 [INFO] hmm
    17:05:08 [INFO] hmm
    17:05:08 [INFO] hmm
    17:05:08 [INFO] hmm
    17:05:09 [INFO] hmm
    17:05:13 [INFO] hmm
    17:05:21 [INFO] hmm
  27. Offline


  28. Offline


    Pretty sure that's not me - I always use numbers or something descriptive. Anyway a Notepad++ search through all the files in the directory turned up nothing. Even searching for "System.out" in *.java* returned 0 hits.
  29. Offline


    Strange ... Not sure where this is coming from - unless its Heroes - but thats even more disturbing...
  30. Offline


    BukkitContrib 0.0.4 is out, now with it's cousin optional client mod!
  31. Offline


    when do we get a plugin for this that allows me to give me and my admins cloaks??? :D
Thread Status:
Not open for further replies.

Share This Page