EssentialsX

EssentialsX

2M Downloads

Trade Signs: Duplication Glitch

BusiedBat306 opened this issue ยท 7 comments

commented

Information

Full output of /ess version:
16.06 17:00:57 [Server] Server thread/INFO Server version: 1.15.2-R0.1-SNAPSHOT git-Spigot-a99063f-c9d7c16 (MC: 1.15.2)
16.06 17:00:57 [Server] Server thread/INFO EssentialsX version: 2.17.2.123
16.06 17:00:57 [Server] Server thread/INFO LuckPerms version: 5.0.72
16.06 17:00:57 [Server] Server thread/INFO Vault version: 1.7.2-b107
16.06 17:00:57 [Server] Server thread/INFO Citizens version: 2.0.26-SNAPSHOT (build 1951)
16.06 17:00:57 [Server] Server thread/INFO EssentialsXXMPP version: 2.17.2.123
16.06 17:00:57 [Server] Server thread/INFO EssentialsXProtect version: 2.17.2.123
16.06 17:00:57 [Server] Server thread/INFO EssentialsXGeoIP version: 2.17.2.123
16.06 17:00:57 [Server] Server thread/INFO EssentialsXChat version: 2.17.2.123
16.06 17:00:57 [Server] Server thread/INFO EssentialsXSpawn version: 2.17.2.123

<!-- Run the command in your console, and copy and paste the whole output here -->

Server log:
https://gist.github.com/APersonOnGithub/19b45428ebf8b3ed0561972ae2f5f0dc

Details

Description
When using a trade sign, it is possible to duplicate the items being sold if the line for the item name and quantity is at max length.
Steps to reproduce
Example presented here will be with diamond blocks.

  1. Create a trade sign using the name of an item that results in the name/quantity line being max length, in this case "1 diamondblock:64"
  2. Add more than 64 blocks to the sign after it has been created. As many as you would like. (in this case 1 additional diamond block.)
  3. Fill your inventory until there is not enough room for the items in the sign to be stored within your inventory. (in this case a full inventory except for 1 slot.)
  4. Break the sign.

Edit: Note, when attempting to reproduce the bug, you must not be OP.

Expected behavior
When the glitch happens:
Upon breaking the item, the plugin will attempt to place as many of the item as it can into your inventory, in this case being 64 diamond blocks. Because there are more than 64 diamond blocks in the sign, the sign will then reappear with the same number of diamond blocks it had within it before being broken. You will now have a stack of diamond blocks in your inventory plus the ones that were being stored within the sign. Note: If the sign is filled beyond the max capacity of an empty players inventory, it is possible to obtain an entire inventory worth of diamond blocks each time that the sign is broken.

What should happen:
The sign should reappear with the appropriate number of items removed from it, equal to the number that has been placed within the player's inventory.
Screenshots
glitchsign

commented
commented

This seems more likely a plugin conflict than an issue with Essentials. I've tried replicating the behavior described and shown in the video, but the sign does not reappear when broken. Most likely, some other plugin is preventing the sign from breaking, which is causing this problem. Can you please try replicating this on your end without any other plugins installed?

commented

Testing now. Do note however that there must be more items in the sign than can fit in your inventory for the sign to reappear.

commented

Found a potential cause of the issue, and suggestion for the solution. Over the years. and after many updates, the character limit for lines on a sign has been increased. It would seem that the code for trade signs has not been fully updated to be able to read these new and longer lines, resulting in the "Error: This sign is full: Line too long" message that accompanies this glitch. It is this problem that also results in a number of items, namely baked potatoes being un-sellable in essentials trade signs due to their rather long shortname, despite actually fitting on the sign.

Edit:

Found more info but don't want to keep spamming with all these messages so will just add it into this one.

At present, Essentials is only capable of reading lines on signs that are 15 characters or shorter, including spaces. 16 characters or higher will result in the line too long error, and under the right circumstances, this duplication glitch.

15 used to be the character limit per line in signs in older versions of minecraft, ie when essentials was first created. Since then, the limit has increased to simply however many characters can visually fit on the sign, ex 25 lower case "L"s and as opposed to 45 "."s due to their smaller size.

Adapting the code for essentials trade signs so that it is capable of reading up to, say, 40 characters per line on a sign should result in this issue and several others being solved.

commented

We successfully reproduced the issue on a server with only essentials... and luck-perms. However the issue is not with conflicting plugins, it is simply that the issue is not reproducible when the player attempting to do it is OP. Therefore, in order to have the player be able to create, use, and break trade signs without being op, luck-perms had to be installed. Any permissions plugin will suffice.

commented

I have added a note to the reproduction steps section. I'm sure @pop4959 you will be able to reproduce the bug under these conditions.

commented

Confirmed bug, and confirmed fix, when removing line length limitations.