NOOB WONDERS - What can plugins do, and what are their limits?

Hi,
My name is Simon. I play Minecraft since the early Indev versions, and lately I’ve been active in the Command Block community. I have extended knowledge in the Command Block domain, but these have their own limits.

The projects I work on becoming more and more ambitious, I’m starting to consider plugin development. Unfortunately I have absolutely no knowledge of plugins, and Sponge. I’ve learned today that Bukkit died 11 months ago, and I was recommended to check here instead.

I’ve read a bit of the docs, but didn’t understand half of it. Also, before considering the tough job of learning Java and plugin development, I’d like to know if the following things are possible at this stage of Sponge API or in a very close future.

The project would be running on Sponge Vanilla (if I’m right, Sponge Vanilla is kind of the equivalent of CraftBukkit, playable with the Vanilla client, while Sponge Coremod is running Forge Server and requires Forge on the client side).

Thanks in advance for your help :smile: . These are my questions :


1. Is it possible to create custom interfaces such as the ones below : (Seen on Hypixel, Wynncraft)

http://i.imgur.com/qkcBf0S.png

2. Is it possible to detect wether the player is within a interface or not. By within an interface I mean if there’s an interface opened (his own inventory, a chest, a furnace, or a custom interface as above, anything) ?


3. Is it possible to detect if a player clicks a slot (empty or not) in his inventory (including the small crafting grid and the craft output) ? (Seen on Minescape)


4. Is it possible to display others’ player names relatively to a player ? (For instance in a minigame, my teammates would have a green name while opponents would have a red one, but my opponent would see himself as green and would see me as red) (Seen on Hypixel)

http://i.imgur.com/ClWm8cN.png

5. If the case above is possible, would it be possible to do the same for entities others than players : for instance, if I right click a Chest, an Armor Stand nametag will pop out saying “It’s locked”. But other players around who didn’t try to open the chest won’t see it.

http://i.imgur.com/AwozAoa.png

6. If the case above is possible, would it be possible to have an entity visible only to a certain player ? If servers can send packets to each player individually, could a server send a packet to a server with let’s say an ArmorStand with a block on his head, but not send it to other players ? So only one player sees the Armor Stand like this :

http://i.imgur.com/9gCJixn.png

7. Is is possible to detect a player left and right clicking : air, an entity, and a block in adventure mode ? (Seen on Wynncraft)


8. Is it possible to set a custom skin for a player ? Wynncraft released a “Custom Armor” system on their server : when you place a piece of armor on you, it converts to a slimeball in the appropriate armor slot so it doesn’t render on your body, but your skin is modified so the overlay looks like a custom armor. This allows for an infinite number of armors. When you remove the armor, the slimeball held by the cursor is immediately converted back to the armor piece.

http://i.imgur.com/HdOh6jq.png

9. Is it possible to create a fake player entity (NPC), give him a custom skin and maybe a simple IA (like chasing the nearest player) ?

http://i.imgur.com/nUUxhSR.png

10. Is it possible to increase the maxstack of any item and apply to every container (including custom interfaces), so if I have a stack of 100 Stone, wherever I place it it’ll stay 100 Stone, and won’t split up in a stack of 64 as it currently does in vanilla ?

http://i.imgur.com/1F9ecaW.png

11. Is it possible to display the nametag of a player only if he is in a close radius to you ?


12. Is it possible to, instead of displaying what the player has written in the chat, display the text above his head (basically the plugin would fetch what the player has sent, and write it in the name tag of an Armor Stand place above the player, and after a short delay the Armor Stand would be killed) ?


13. Is it possible to only see the messages in the chat from people in a certain range of you ? (Seen on Wynncraft)


If you made it this far, thanks a lot for your patience. I made research to find answers, but I didn’t find anything on Sponge, probably because I don’t know the technical language.

Anyway, most of the things above are possible in CraftBukkit, because they are things I’ve seen on servers (I mentioned which ones when appropriate).

How is Sponge advanced compared to Bukkit before it died ? As it all the features ? More ?

Thanks a lot in advance for your help, I hope I didn’t bother you too much !

Edit. The image links are in code because new users aren’t allowed to post images

I cant answer half of those questions, but forge no longer requires client side if installed on the server. (If there are no mods on the server of course, except a very few like world edit)

1 Like

Thanks for the read anyway !
Is there any advantage of having Sponge Forge when the target will be vanilla clients ? (Better performance, exclusive APIs, etc.)

Performance is probably negligable at best
But with SV you wont have to wait for forge to update, only sponge.

2 Likes

I’m not 100% sure about sponge (as I’m not as familar with it as Bukkit), but I am fairly sure:

12 probably requires a client mod. I’ve never seen a bukkit server that did this. I have seen servers that put hearts above monsters when you hit them though (is this a plugin, or just a feature of bukkit?) so it may be possible.

3 might be possible. I seem to recall some sort of server events in bukkit that could handle this sort of thing but I am not entirely sure. Also not sure if those events will exist in sponge.

1,2,7,10,13 were all easily possible in bukkit (there were plugins that did all of them), so probably will be possible with sponge.

4,5,6,8,9,11 MIGHT be possible. I think you could do some of that in bukkit using… I forget what it’s called. There was a plugin (ProtocolLibs?) that allowed plugins to hijack the data packets that went to the client and would allow a lot of crazy stuff. But that all depends on if someone develops a plugin for Sponge that does the same thing.

If anybody knows better then please feel free to correct me.

1 Like

Pretty much all of these are possible. The general rule with what you can and can’t do with Minecraft using server-side plugins, is that if its controlled server-side or if the client depends on information that’s sent by the server, then we’re able to manipulate it. #10 for example might not be possible, I don’t exactly remember whether or not the client assumes max items in a stack don’t ever change, but if it does, then it definitely won’t be–we can’t exactly tell the client to do things it won’t listen to us about. The same goes for #11, player name rendering is purely client-side, we don’t have control over its visibility aside from making the player completely invisible–something that you probably don’t want when all you want is the name tag gone. correction

All of the servers you mentioned are using a server modification that makes it easier to manipulate everything–today that’s typically a derivation of Bukkit, the Spigot project. Of course, that doesn’t mean it isn’t possible with Sponge. A lot of Sponge is still unimplemented and in the planning stages, but once its all done you’ll be able to do everything you could with Bukkit with Sponge. And probably easier with Sponge too, as in my view, Sponge’s API is a lot more expansive over what you have control over. A lot of the “cooler” features in Bukkit require you to hack into Minecraft server code yourself, which, if you’re unexperienced, may end up in causing a lot of bugs and glitches for receiving players.

EDIT: Also, Sponge for Forge doesn’t require you to have Forge on your vanilla client. In fact, Forge for 1.8 does that on its own. Sponge for Forge just allows compability with server mods. You can get even more powerful with what you can do by writing server-side-only mods if using the Sponge API alone isn’t enough.

1 Like

What about scoreboards? Cant you make a nametag disappear with it? @Aaron1011

2 Likes

oh right. scoreboards.

sorry; I haven’t been exactly up-to-date with everything; looking at the scoreboard page on the minecraft wiki it looks like there’s a tag to disable nametag visibility.

so yeah, correction there; its possible to make them disappear on the client.

2 Likes
  1. Yes. Henceforth ‘interface’ will just be referred to as ‘inventory’.

  2. Yes.

  3. Yes/No. (I don’t believe player clicking an empty slot triggers a PlayerInteractEvent)

  4. Yes.

  5. Maybe. This would likely require packet manipulation.

  6. If 5 = Yes, then yes. However, packet manipulation would be involved.

  7. No, Yes/No, Yes/No. The client doesn’t send information to the server if the player interacts with the air, so this isn’t possible. As far as entities go, it depends on what type of entity it is. Villagers, yes - Right clicking is understood by the client as a trade/inventory check, so the server can manipulate it. Mobs, you can check for left (damage) click, but not for right (interact), as no mob, except the villager, can be interacted with. As far as blocks in adventure mode go, it depends on the block. Switches/Doors, yes. Signs/etc? no.

All of the limitations of number 7 are simply what the client doesn’t send to the server - it’s impossible for us to check for it.

  1. I believe it is.
  2. Yes, to creating the fake entity. Custom Skin, depends on 8. Simple AI? I wouldn’t call it AI, but you can tell it to go after a player, though I’m not sure exactly how Sponge will handle this, if we do.
  3. No. Though, I’m not sure where the bottleneck on this is.
  4. I don’t believe so. Rendering of objects in Minecraft are pretty much all handled by the client. The solution to this would be to not send the Player packet to the other Player at all until they were within a certain distance. This would definitely be possible, but it’s not a clean solution.
  5. That sounds possible, sure.
  6. This would be possible to make, yes.
2 Likes

@FerusGrim 7. i’m half-sure bukkit supported r-clicking air in interact event. plus, i know Action.RIGHT_CLICK_AIR is a thing, and unless bukkit was more off than i remember, it has its reason to be there. same goes for right-clicking entities; PlayerInteractEntityEvent or whatever it was called would always fire regardless of whether or not right-clicking the entity had a vanilla function.

<3>. minecraft sends info for whenever it makes a click at all in a GUI; hence getting a nullpointerexception if you try to handle a slot that doesn’t exist in a bukkit InventoryClickEvent (occurs when a player clicks outside the inventory)

<8>. custom skins aren’t necessarily possible; though then again i’m not exactly sure how minecraft receives data for loading skins. as far as i’m concerned, minecraft’ll only take the UUID of an existing player to load a skin from, meaning you’ll have to do this through resourcepacks unless you’re willing to spend lots of money just to skin a few bits of custom armor.

<09>. custom skin we know we can do using player skins (which you’ll have to spend money on), and we can disable the nametag through scoreboards. AI has to do with messing the pathfinders and goals minecraft has. it’d be much easier to make a forge server-mod to do this, though, but i’m still hoping for sponge ai api.

<11>. scoreboards.

<>‘s cuz’ discourse autoformats the numbers into a number list.

1 Like

It’s a hardcoded limit in Minecraft’s InventoryBasic class. The client (and presumably the server) won’t allow for a stack to be larger.

Well, it is possible then, just not without a bit of hassle involving packet interception.

12 is possible as @FerusGrim said, although it would likely be a huge pain in the arse to manage.

Minecraft does define a packet for an arm swing animation (S0BPacketAnimation in Forge), so I believe it should be possible (at least on a theoretical level).

1 Like

Thanks a lot for all your answers, your time and your patience, I didn’t expect that many replies ! :grinning:

1 Like

Yeah, as @Joe_Schmo2840 said there’s a function to hide the nametag.

In vanilla, with Command Blocks, this could be achieved by creating two teams. Considering only two players, when the players are far from each other, they are in their respective team, with for both team the parameter “nametagVisibility” set to “hideForOtherTeams”. When the player get closer, they are moved in the same team and they can see each other’s nametag.

With Sponge, would I have to have those teams too, or as the function to hide nametag exist, can I apply it whenever I want, bypassing the requirement of vanilla teams and scoreboard stuff ?


So right now, Sponge is far from having all the features implemented, this means we currently can’t do with Sponge what we can do with Bukkit / Spigot ?
For the moment I should use Spigot, and then move to Sponge when it’s finished ?

Thanks for your answer !

3. While browsing the Spigot forum I found http://wiki.vg/Protocol, which apparently lists the protocols of Minecraft server. Maybe it has nothing to do with Sponge, etc., but if it has, there’s a Click Windows protocol

http://wiki.vg/Protocol#Click_Window

Which is a packet sent by the player to the player when a click is performed in a window, may the slot be empty or not, could you confirm my interpretation or am I completely out of subject ? If it’s right, it means it can even detect clicks outside the window, shift-clicks, hotkeys, etc. !


5. An example of it in action

https://www.youtube.com/watch?v=InDMwxBOfyc

Is this kind of packet manipulation currently possible in Sponge ?


7. Again with the Protocol thing wiki, I found a ‘Use Entity’ protocol (http://wiki.vg/Protocol#Use_Entity) which is apparently a packet sent by the client to the server when the player left or right clicks an entity. I does not specify so I suppose it applies to all gamemodes.
But what about blocks for adventure mode ? When you look at a block, it does not drawn the wireframe around it, so does it even recognize a block ?

https://www.youtube.com/watch?v=xxPFD65snGw

Wynncraft does, while in gamemode 2. Maybe it’s placing an invisible entity on the player so the hitbox of the entity overlap the one of the player and any click would hit that hitbox instead of the one around. The detection of left and right-clicks is then performed relatively to this entity, would that be possible ?


Thanks again for all your answers, you are all helping me a lot !

Thanks ! Yeah it’s 100% sure that Bukkit supports right-click and left-click air.


8. I found out a topic on Spigot’s forum where developers finally found out how to do this. Basically you can only fetch a skin off of Mojang’s servers because they are signed. Wynncraft works by downloading the player skin, combining it with the overlay of the custom armor, upload it to a WynnSkinXX premium Minecraft account (they have 30 accounts, from WynnSkin1 to WynnSkin30), and then edit the metadata of the Spawn Player packet so - for this session only - the player his modified skin with the custom armor overlay. The WynnSkinXX account used is now available to process for another player.

Source : https://www.spigotmc.org/threads/how-is-wynncraft-changing-skins.41207/

They seem to only need 30 accounts with an average of constant 500 players logged in.


9. For fake players, it’d be easier than the method described above, because I’d use it for custom mobs that won’t swap their armor. The neat thing is that apparently player skins data never expire, this means I can change my skin to create variants of the fake player I want, record the skin data every time, and then put back my own skin, and I can set the skins of those fake players with the skin datas I recorded previously. This means with 1 account I can apparently make an unlimited number of skins.

1 Like

10. Thanks for letting me know that ! I made researches and there are no way to bypass this limit, I can fill a slot with 100 items, but moving them around is something else. The dirty way would be to, when clicking a stack of 64 items while holding a stack of 36 of the same item, call a redraw of the slot to be filled with 100 and erase what my cursor was holding. Not sure if it’s possible though.


12. Why would it be a pain. Can’t I just get the string sent in the chat, get the player that sent this string. And then create an entity at the position of this player with the string as the custom name of this entity ?

Item types have a max stack size attribute. And when you pick up items it’ll make you pick up stack.size > stack.item.maxsize ? stack.item.maxsize : stack.size if that made any sense at all… It’s in Minecraft (including the client as far as I’m aware)

1 Like

Not necessarily; you have to use the same system as you do with command blocks, just with code. The only way the client’ll listen to hiding nametags is if the scoreboard tells them to, which means you need to tell the client they’re part of a scoreboard that says they should hide the nametags.


You can play around with what’s currently implemented, but as of now, Sponge is far from ready for a production server. Using spigot temporarily is a good idea, but if you can wait, you can play and learn about using Sponge until its ready, too.

The specification isn’t clear on that, but I looked through the game code and found this bit:

if ((this.theSlot != null) && (this.theSlot.getHasStack())) {
    if (keyCode == this.mc.gameSettings.keyBindPickBlock.getKeyCode()) {
          handleMouseClick(this.theSlot, this.theSlot.slotNumber, 0, 3);
    } else if (keyCode == this.mc.gameSettings.keyBindDrop.getKeyCode()) {
        handleMouseClick(this.theSlot, this.theSlot.slotNumber, isCtrlKeyDown() ? 1 : 0, 4);
    }
}

windowClick is responsible for sending the packet and Slot#getHasStack() will return null if the slot is empty, so the implication here is that a packet will not be sent and thus it is not possible currently to detect clicks on empty slots.

Here’s some code I found:

if (this.currentGameType.isAdventure()) {
    if (this.currentGameType == WorldSettings.GameType.SPECTATOR) {
        return false;
    }
    if (!this.mc.thePlayer.isAllowEdit()) {
        Block block = this.mc.theWorld.getBlockState(loc).getBlock();
        ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem();
        if (itemstack == null) {
            return false;
        }
        if (!itemstack.canDestroy(block)) {
            return false;
        }
    }
}

The packet for player digging is sent later in the method I grabbed this from. This code block is at the top of it, and will return false if the player is in adventure mode and is not holding an item explicitly permitted to break the block involved. Therefore, I’m led to believe that it’s not possible to listen for these clicks in the strictest sense, although as you mentioned, there may be a “hack” involving invisible entities or something to that extent.

It would essentially require a client mod to bypass the limit properly, since it does audits to make sure no stack is larger than the global limit.

It would be a pain because AFAIK name tags can’t be longer than 16 characters, so you’d need to manipulate multiple entities for most messages.