bukkitgui2 icon indicating copy to clipboard operation
bukkitgui2 copied to clipboard

Player inventory editor

Open BetaPotato opened this issue 10 years ago • 16 comments

An option like this in the players tab would be useful.

BetaPotato avatar Jan 22 '15 00:01 BetaPotato

While this would be useful, this is close to impossible. I can't alter the player data files while the server is running, and using a plugin would make it version and server dependant.

Bertware avatar Jan 22 '15 13:01 Bertware

I don't see a good way to do this aside from making several plugin versions, or somehow making a plugin that is universally compatible with all versions. I will reopen this if I find a better way to do it.

BetaPotato avatar Jan 22 '15 13:01 BetaPotato

@Bertware You could use the give command instead of directly modifying the player data files, although that might be dependent on the server software.

spideynn avatar Jan 22 '15 20:01 spideynn

That would work, but it's limited to giving items only, not viewing or editing the inventories (which is what @technoguy20000 meant)

Bertware avatar Jan 22 '15 22:01 Bertware

I've heard from a plugin developer that the plugin is not version specific if it doesn't have version specific imports, in other words, using only the BukkitAPI

BetaPotato avatar Jan 22 '15 23:01 BetaPotato

Just by the way, the give command paired with the clear command (/clear [player] [item] [data] [maxCount] [dataTag]) and the .dat file for viewing the inventory, this approach still could work. A plugin would still be better though.

BetaPotato avatar Jan 22 '15 23:01 BetaPotato

@Bertware I was thinking about making a plugin for it, since I figured out a way that shouldn't depend on a certain version using the Bukkit Inventory API. How should the information be transferred between the plugin and BukkitGUI?

spideynn avatar Jan 23 '15 00:01 spideynn

The .dat file isn't up to date while the server is running I believe, or it's locked. It might be possible though, although it's not my number one priority. A possible solution would be this:

  • User clicks "view inventory"
  • GUI sends command "/bukkitguihelp inventory (command limited to console operator only)
  • GUI receives JSON encoded array, hides the output from the user
  • GUI parses JSON and shows window

Bertware avatar Jan 23 '15 13:01 Bertware

I vote a Sponge plugin, since Bukkit will be obsolete in a few months.

It should be an optional extra though.

simon816 avatar Jan 23 '15 14:01 simon816

@Bertware I tested this on my server, you can modify the .dat while the server is running but the player needs to disconnect before the changes save, or they get overwritten when something happens before the player leaves.

@simon816 I'll do both, but I need to learn the Sponge API first. I know that Glowstone & Spigot use the Bukkit API still. EDIT: Sponge looks a lot like Minecraft Forge modding, so Sponge support may take a while.

spideynn avatar Jan 23 '15 20:01 spideynn

Before y'all start working on plugins or stuff: both glowstone and sponge support is planned or work in progress, but as far as I know they both don't work 100% as they should now. Just a reminder, so you don't get disappointed when you want to test

Bertware avatar Jan 23 '15 21:01 Bertware

I've almost finished the plugin, and here's the output when you do '/bukkitguihelp inventory playername' http://pastebin.com/L8DhNGad I'm just trying to figure out why its adding (0) on the end of the item name, once I fix that the bukkit / spigot plugin is done. EDIT: Found out its not printing out equipped armor, so that needs to be fixed as well. :smiley:

spideynn avatar Jan 23 '15 21:01 spideynn

@Bertware @technoguy20000 Spigot, Bukkit, and Glowstone support for only reading the inventory is available here: https://github.com/spideynn/InventoryAPI-JSON/releases

The way this works is 0-35 are the inventory slots, and 36-39 are the armor slots. I'm working on a diagram for it at the moment. EDIT2: Fixed. https://github.com/spideynn/InventoryAPI-JSON/releases/tag/v0.2.1

spideynn avatar Jan 24 '15 16:01 spideynn

I'm currently fixing up the server support before I'm continuing on this myself (if you know .NET, feel free to create an inventory edit window that takes the console output and player name, shows the inventory, and sends the necessary commands to alter the inventory)

Bertware avatar Jan 24 '15 19:01 Bertware

@Bertware Yeah, I'll see what I can do with it. I just need to look through the codebase to learn how you do things in this.

spideynn avatar Jan 26 '15 16:01 spideynn

You could add it to the MinecraftInterop namespace, a class and a form to edit inventories. I try to put all the forms in the UI folder/namespace, thought addon specific forms are in the corresponding addon folder/namespace. Since this would be globally available in both console and player list, I'd keep it as a global thing

Bertware avatar Jan 27 '15 23:01 Bertware