EssentialsX

EssentialsX

2M Downloads

Trade sign "Line is too long!" error when line is at or near maximum allowed length

EvModder opened this issue ยท 20 comments

commented

Information

Full output of /ess version:

[05:01:02 INFO]: Server version: 1.13.2-R0.1-SNAPSHOT git-Paper-597 (MC: 1.13.2)
[05:01:02 INFO]: EssentialsX version: 2.16.1.80
[05:01:02 INFO]: EssentialsXChat version: 2.16.1.80
[05:01:02 INFO]: EssentialsXSpawn version: 2.16.1.80
[05:01:02 INFO]: Vault is not installed. Chat and permissions may not work.

EssentialsX config:
https://gist.github.com/EvModder/29cf2c5d52cf6fcf425396cfb76e4c1f

Details

Description
When the length of a line on a [Trade] sign is at or near the maximum allowed length of a line on a sign, EssentialsX will allow the creation of the sign (text will turn blue) but will not allow any interaction with the sign, even if the result of the interaction REDUCES the length of the line in question.

Steps to reproduce
This issue occurs for many signs in our market area, but for a good baseline example copy the following onto a sign:

[Trade]
$15:0
64 gunpowder:256

If a custom currency symbol is set, (in our case, L) use that instead of $ on line 2.

Expected behavior
If it is possible to create the signs, it should also be possible to interact with them, especially if that interaction only reduces the length of the lines on the sign (e.g., buying).

commented

I can confirm that this occurs when using a valid username of 16 characters.

commented

Follow up to bradykolson's tip:
in /plugins/Essentials/ there is a file (items.csv or items.json in newer versions), where you can add your own "short names" for items (e.g., add "sulfur" for gunpowder).

Of course, this helps fit longer text on the sign, but doesn't fix the issue of EssentialsX thinking the sign has less space than it actually does.

commented

Thanks for the solution, it works well for the smoothstone:

In /plugins/Essentials/items.json:

...
  "smoothstone": "smooth_stone",
  "smooth": "smooth_stone",                        <--- New line
  "smoothsmoothstone": "smooth_stone_slab",
...

Now I can use smooth for smoothstone

2020-03-01_20 58 03

I think this example could be helpful to someone

commented

Use the command </itemno gunpowder> to find all possible "Short names" for the item on the sign. Unfortunately gunpowder has no other names, but in the case of cooked_beef, "gbeef" is actually one of the short names.

Will not help in all cases, but useful if you're just 1 character space too short. Hope this helps for some of your signs.

commented

FYI, manually editing items.json isn't recommended (and may not be supported at all in the future). You should use custom_items.yml to add custom item aliases instead.

commented

Hi, thank you your help.

Is there somewhere on the wiki or any documentation I can find back this specific information?

commented

@bidetaggle See the examples in the plugins/Essentials/custom_items.yml file.

I can't find a plugins folder in the actual repository, I don't see anything relevant here neither and I the wiki doesn't seem to speak about it.

Could you provide a direct link?

commented
commented

To clarify: the file should already exist with examples at plugins/Essentials/custom_items.yml in your server's directory (if it doesn't, you need to update EssentialsX or else the feature won't work).

commented

This is quite a large problem, if you check the recent bug reports, we figured out this length limit can dupe large amounts of items with the right conditions

commented

@bidetaggle See the examples in the plugins/Essentials/custom_items.yml file.

commented

Not sure why this has not yet received confirmed status, as the issue is incredibly easy to reproduce. Also, it is now the cause of another much more serious issue as I have reported in #3384 wherein it is possible possible to duplicate items via destroying a trade sign when the item line is affected by this error.

commented

@BusiedBat306 Please don't bump multiple threads to draw attention to your issue. We're aware of it and will deal with it when we're able to - you don't need to keep bumping it.

commented

@md678685 Was not my intention, apologies if it came off that way. I have replied several times to my own simply because I was discovering more relevant information and wanted to add it to the thread. Likewise, this issue and my own are relevant to each other, so linking them is simply (at least in my mind) the appropriate thing to do.

commented

This is not going to be fixed; apparently the 15 character limit is a feature.

commented

We're not going to remove the limit for the reasons explained in my response to #3392. I'm planning to improve validation to be less frustrating (making creation and interaction checks more consistent), but the limit isn't going to be removed entirely.

commented

Was line length limit removed or not being removed? I read another ticket that said removed on June 16, but this one says not being removed on Jun 19.

My name is too long to fit on a sign (as are others), so I cannot trade currently due to a line (my name) being too long. Is there a fix or workaround for this?

commented

@ASHLEYakaASHLEY EssentialsX does not enforce a maximum username length on signs. If you believe otherwise, please open a bug report and fill out the template in full, and include /ess debug logs that occur when you interact with the sign.

commented

@EvModder

EssentialsX does not enforce a maximum username length on signs.


This issue is labelled appropriately, assigned and attached to a milestone.

As for character width calculation, this would be more complex than it's worth, given it relies on the assumption they're using the standard Minecraft font. The string length is good enough for this case.

The underlying issue here is that EssentialsX doesn't enforce the line length limit in a sensible way - operations that shrink the line can fail the limit, signs can be created when they would exceed the limit etc. We're currently exploring two options, either changing the logic for line length checks to allow interactions that reduce the line length, or storing data outside the sign text entirely.

commented

@mdcfe EssentialsX does not enforce a limit? This seems contrast to your previous comment (Jun.19)

I'm planning to improve validation...

I assume this issue/thread is now tracking that, perhaps we can add a label for feature request / enhancement?

We're not going to remove the limit for the reasons explained in my response to #3392.

Since that issue has been closed, I'll continue the discussion here, and recommend one of two approaches:

  1. don't put a limit on the username line(s), only enforce it for the item count line(s)
  2. use something akin to the util i linked earlier, R: EvLib/extras/TextUtils.java#L405