Essentials icon indicating copy to clipboard operation
Essentials copied to clipboard

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

Open EvModder opened this issue 5 years ago • 20 comments

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).

EvModder avatar Apr 08 '19 10:04 EvModder

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

Justin42 avatar Apr 11 '19 13:04 Justin42

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.

bradykolson avatar Jun 25 '19 14:06 bradykolson

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.

EvModder avatar Nov 15 '19 03:11 EvModder

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

cromatikap avatar Mar 01 '20 19:03 cromatikap

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.

mdcfe avatar Jun 15 '20 13:06 mdcfe

Hi, thank you your help.

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

cromatikap avatar Jun 17 '20 13:06 cromatikap

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

APersonOnGithub avatar Jun 18 '20 09:06 APersonOnGithub

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

mdcfe avatar Jun 18 '20 09:06 mdcfe

@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?

cromatikap avatar Jun 18 '20 11:06 cromatikap

Could you provide a direct link?

https://github.com/EssentialsX/Essentials/blob/2.x/Essentials/src/custom_items.yml

triagonal avatar Jun 18 '20 11:06 triagonal

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).

mdcfe avatar Jun 18 '20 12:06 mdcfe

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.

BusiedBat306 avatar Jun 18 '20 14:06 BusiedBat306

@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.

mdcfe avatar Jun 18 '20 14:06 mdcfe

@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.

BusiedBat306 avatar Jun 18 '20 15:06 BusiedBat306

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

pop4959 avatar Jun 19 '20 10:06 pop4959

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.

mdcfe avatar Jun 19 '20 13:06 mdcfe

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?

ASHLEYakaASHLEY avatar Jan 18 '21 00:01 ASHLEYakaASHLEY

@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.

mdcfe avatar Mar 02 '21 13:03 mdcfe

@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

EvModder avatar Mar 11 '21 20:03 EvModder

@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.

mdcfe avatar Mar 11 '21 21:03 mdcfe