EssentialsX

EssentialsX

2M Downloads

With the default items.json, there's no way to [trade] some items with long names

oskarkk opened this issue · 1 comments

commented

Type of bug

Other unexpected behaviour

/ess dump all output

https://essentialsx.net/dump.html?id=19eaf5c0e31848c6ac263d9ac5b33121

Error log (if applicable)

No response

Bug description

The problem

With the default items.json, there's no way to trade some items with long names. Take for example "waxed exposed cut copper". Firstly, the /itemdb command is useless, because it shows only 14 names (it could show more or have a config value to decide how much names should it show). Here's how it looks:

[11:40:14 Server thread/INFO] CONSOLE issued server command: /itemdb waxed_exposed_cut_copper
[11:40:14 Server thread/INFO] Przedmiot: WAXED_EXPOSED_CUT_COPPER
[11:40:14 Server thread/INFO] Krótka nazwa: cexposedwacoblock, cexposedwacopblock, cexposedwacopperblock, cexposedwaxcoblock, cexposedwaxcopblock, cexposedwaxcopperblock, cexposedwaxedcoblock, cexposedwaxedcopblock, cexposedwaxedcopperblock, cexpwacoblock, cexpwacopblock, cexpwacopperblock, cexpwaxcoblock, cexpwaxcopblock

The full list of aliases for that item is:

cexposedwacoblock, cexposedwacopblock, cexposedwacopperblock, cexposedwaxcoblock, cexposedwaxcopblock, cexposedwaxcopperblock, cexposedwaxedcoblock, cexposedwaxedcopblock, cexposedwaxedcopperblock, cexpwacoblock, cexpwacopblock, cexpwacopperblock, cexpwaxcoblock, cexpwaxcopblock, cexpwaxcopperblock, cexpwaxedcoblock, cexpwaxedcopblock, cexpwaxedcopperblock, cexwacoblock, cexwacopblock, cexwacopperblock, cexwaxcoblock, cexwaxcopblock, cexwaxcopperblock, cexwaxedcoblock, cexwaxedcopblock, cexwaxedcopperblock, cutexposedwacoblock, cutexposedwacopblock, cutexposedwacopperblock, cutexposedwaxcoblock, cutexposedwaxcopblock, cutexposedwaxcopperblock, cutexposedwaxedcoblock, cutexposedwaxedcopblock, cutexposedwaxedcopperblock, cutexpwacoblock, cutexpwacopblock, cutexpwacopperblock, cutexpwaxcoblock, cutexpwaxcopblock, cutexpwaxcopperblock, cutexpwaxedcoblock, cutexpwaxedcopblock, cutexpwaxedcopperblock, cutexwacoblock, cutexwacopblock, cutexwacopperblock, cutexwaxcoblock, cutexwaxcopblock, cutexwaxcopperblock, cutexwaxedcoblock, cutexwaxedcopblock, cutexwaxedcopperblock, cutwaexcoblock, cutwaexcopblock, cutwaexcopperblock, cutwaexpcoblock, cutwaexpcopblock, cutwaexpcopperblock, cutwaexposedcoblock, cutwaexposedcopblock, cutwaexposedcopperblock, cutwaxedexcoblock, cutwaxedexcopblock, cutwaxedexcopperblock, cutwaxedexpcoblock, cutwaxedexpcopblock, cutwaxedexpcopperblock, cutwaxedexposedcoblock, cutwaxedexposedcopblock, cutwaxedexposedcopperblock, cutwaxexcoblock, cutwaxexcopblock, cutwaxexcopperblock, cutwaxexpcoblock, cutwaxexpcopblock, cutwaxexpcopperblock, cutwaxexposedcoblock, cutwaxexposedcopblock, cutwaxexposedcopperblock, cwaexcoblock, cwaexcopblock, cwaexcopperblock, cwaexpcoblock, cwaexpcopblock, cwaexpcopperblock, cwaexposedcoblock, cwaexposedcopblock, cwaexposedcopperblock, cwaxedexcoblock, cwaxedexcopblock, cwaxedexcopperblock, cwaxedexpcoblock, cwaxedexpcopblock, cwaxedexpcopperblock, cwaxedexposedcoblock, cwaxedexposedcopblock, cwaxedexposedcopperblock, cwaxexcoblock, cwaxexcopblock, cwaxexcopperblock, cwaxexpcoblock, cwaxexpcopblock, cwaxexpcopperblock, cwaxexposedcoblock, cwaxexposedcopblock, cwaxexposedcopperblock, excutwacoblock, excutwacopblock, excutwacopperblock, excutwaxcoblock, excutwaxcopblock, excutwaxcopperblock, excutwaxedcoblock, excutwaxedcopblock, excutwaxedcopperblock, excwacoblock, excwacopblock, excwacopperblock, excwaxcoblock, excwaxcopblock, excwaxcopperblock, excwaxedcoblock, excwaxedcopblock, excwaxedcopperblock, expcutwacoblock, expcutwacopblock, expcutwacopperblock, expcutwaxcoblock, expcutwaxcopblock, expcutwaxcopperblock, expcutwaxedcoblock, expcutwaxedcopblock, expcutwaxedcopperblock, expcwacoblock, expcwacopblock, expcwacopperblock, expcwaxcoblock, expcwaxcopblock, expcwaxcopperblock, expcwaxedcoblock, expcwaxedcopblock, expcwaxedcopperblock, exposedcutwacoblock, exposedcutwacopblock, exposedcutwacopperblock, exposedcutwaxcoblock, exposedcutwaxcopblock, exposedcutwaxcopperblock, exposedcutwaxedcoblock, exposedcutwaxedcopblock, exposedcutwaxedcopperblock, exposedcwacoblock, exposedcwacopblock, exposedcwacopperblock, exposedcwaxcoblock, exposedcwaxcopblock, exposedcwaxcopperblock, exposedcwaxedcoblock, exposedcwaxedcopblock, exposedcwaxedcopperblock, exposedwaccoblock, exposedwaccopblock, exposedwaccopperblock, exposedwacutcoblock, exposedwacutcopblock, exposedwacutcopperblock, exposedwaxccoblock, exposedwaxccopblock, exposedwaxccopperblock, exposedwaxcutcoblock, exposedwaxcutcopblock, exposedwaxcutcopperblock, exposedwaxedccoblock, exposedwaxedccopblock, exposedwaxedccopperblock, exposedwaxedcutcoblock, exposedwaxedcutcopblock, exposedwaxedcutcopperblock, expwaccoblock, expwaccopblock, expwaccopperblock, expwacutcoblock, expwacutcopblock, expwacutcopperblock, expwaxccoblock, expwaxccopblock, expwaxccopperblock, expwaxcutcoblock, expwaxcutcopblock, expwaxcutcopperblock, expwaxedccoblock, expwaxedccopblock, expwaxedccopperblock, expwaxedcutcoblock, expwaxedcutcopblock, expwaxedcutcopperblock, exwaccoblock, exwaccopblock, exwaccopperblock, exwacutcoblock, exwacutcopblock, exwacutcopperblock, exwaxccoblock, exwaxccopblock, exwaxccopperblock, exwaxcutcoblock, exwaxcutcopblock, exwaxcutcopperblock, exwaxedccoblock, exwaxedccopblock, exwaxedccopperblock, exwaxedcutcoblock, exwaxedcutcopblock, exwaxedcutcopperblock, minecraft:waxed_exposed_cut_copper, wacexcoblock, wacexcopblock, wacexcopperblock, wacexpcoblock, wacexpcopblock, wacexpcopperblock, wacexposedcoblock, wacexposedcopblock, wacexposedcopperblock, wacutexcoblock, wacutexcopblock, wacutexcopperblock, wacutexpcoblock, wacutexpcopblock, wacutexpcopperblock, wacutexposedcoblock, wacutexposedcopblock, wacutexposedcopperblock, waexccoblock, waexccopblock, waexccopperblock, waexcutcoblock, waexcutcopblock, waexcutcopperblock, waexpccoblock, waexpccopblock, waexpccopperblock, waexpcutcoblock, waexpcutcopblock, waexpcutcopperblock, waexposedccoblock, waexposedccopblock, waexposedccopperblock, waexposedcutcoblock, waexposedcutcopblock, waexposedcutcopperblock, waxcexcoblock, waxcexcopblock, waxcexcopperblock, waxcexpcoblock, waxcexpcopblock, waxcexpcopperblock, waxcexposedcoblock, waxcexposedcopblock, waxcexposedcopperblock, waxcutexcoblock, waxcutexcopblock, waxcutexcopperblock, waxcutexpcoblock, waxcutexpcopblock, waxcutexpcopperblock, waxcutexposedcoblock, waxcutexposedcopblock, waxcutexposedcopperblock, waxedcexcoblock, waxedcexcopblock, waxedcexcopperblock, waxedcexpcoblock, waxedcexpcopblock, waxedcexpcopperblock, waxedcexposedcoblock, waxedcexposedcopblock, waxedcexposedcopperblock, waxedcutexcoblock, waxedcutexcopblock, waxedcutexcopperblock, waxedcutexpcoblock, waxedcutexpcopblock, waxedcutexpcopperblock, waxedcutexposedcoblock, waxedcutexposedcopblock, waxedcutexposedcopperblock, waxedexccoblock, waxedexccopblock, waxedexccopperblock, waxedexcutcoblock, waxedexcutcopblock, waxedexcutcopperblock, waxedexpccoblock, waxedexpccopblock, waxedexpccopperblock, waxedexpcutcoblock, waxedexpcutcopblock, waxedexpcutcopperblock, waxedexposedccoblock, waxedexposedccopblock, waxedexposedccopperblock, waxedexposedcutcoblock, waxedexposedcutcopblock, waxedexposedcutcopper, waxedexposedcutcopperblock, waxexccoblock, waxexccopblock, waxexccopperblock, waxexcutcoblock, waxexcutcopblock, waxexcutcopperblock, waxexpccoblock, waxexpccopblock, waxexpccopperblock, waxexpcutcoblock, waxexpcutcopblock, waxexpcutcopperblock, waxexposedccoblock, waxexposedccopblock, waxexposedccopperblock, waxexposedcutcoblock, waxexposedcutcopblock, waxexposedcutcopperblock

Wow. 326 f-ing ways to name a block. Most of them are useless. Who would want to use something like "expcwacopblock" (EXPosed Cut WAxed COPper BLOCK)? And only 4 of them are short enough (12 chars) to potentially fit in a sign line at all:

waexccoblock
wacexcoblock
exwaccoblock
cwaexcoblock
cexwacoblock

And the only thing you can deduce from a name like this is that it's a block. I'd rather have "copperbl" than "coblock", the first has kinda more information.

A sign with one of these names would look like:
image

... but that won't work, error "the sign is full". So you can't trade waxed exposed cut copper at all. And even if that limit would be changed to allow a full line, it would allow a maximum of only 9 blocks to trade. Kinda useless.

Situation is better with slabs and stairs. We have e.g. "cexwacosl", 9 chars, with which we can sell up to 99 items. Not great, but somewhat acceptable.

image

The fix

So what I think should be done?

Copper names

Remove most of the useless aliases. I haven't checked the code that generates them, and I haven't read aliases for all items. Maybe that code gives good, useful results for some blocks with shorter multi-word names, but it certainly doesn't work for these copper items. Aliases of "waxed exposed cut copper" could have "block" dropped from them. Aliases like "waxexpcutcop" would look nice, but for signs it would still be too long. It could be shortened to even "wecc" but that doesn't really convey any meaning, so we need something a little longer. Maybe "weccopper"? 9 chars, we can sell up to 99 items, acceptable. Everyone knows that copper can be [W]axed, can be [E]xposed, [W]eathered or [O]xidized, and it can be [C]ut. So:

waxed, cut, variously oxidised:

weccopper
wwccopper
woccopper

not waxed, cut, variously oxidised:

expccopper
weaccopper
oxiccopper

waxed, not cut, variously oxidised:

waxecopper
waxwcopper
waxocopper

waxed or cut

waxccopper
waxcopper
cutcopper

variously oxidised:

expcopper
weacopper
oxicopper

All of these could be further shortened by dropping "per" from "copper". Stairs - "copst", slabs - "copsl". So e.g. "waxed exposed cut copper" would have aliases:

weccop
weccopper
waxexpcutcop
waxexpcutcopper
waxedexposedcutcopper

"weathered cut copper":

weaccop
weaccopper
weacutcop
weacutcopper
weatheredcutcopper

"waxed copper":

waxcop
waxcopper
waxedcopper

"waxed oxidized cut copper stairs":

woccopst
woccopperst
woccopperstairs
waxoxicutcopst
waxoxicutcopperst
waxoxicutcopperstairs
waxedoxidizedcutcopper
waxedoxidizedcutcopperstairs

There could be some further variations, but why? It's enough. And maybe we could have even less.

So, these new names would use the following components:

"waxed" - "wax" - "w" (only in "weccopper" etc.)

"exposed" - "exp" - "e" (only in waxed variants)
"weathered" - "wea" - "w" (only in waxed variants) ("wea" or "wth"
"oxidized" - "oxi" - "o" (only in waxed variants)

"cut" - "c"

"copper" - "cop"

"stairs" - "st"
"slab" - "sl" (I strongly suggest dropping aliases like "step" and "halfblock", especially "halfblock", is there any person that would ever use it?)

"block" would be used only in the basic copper block ("copblock", "copperblock") - any oxidization, waxing or anything and you know that it isn't a copper ingot, so really there no need to put that "block" everywhere. No two-letter abbreviations of any word. Words always in the same order. Shuffled words can be nice for maybe blocks with 2-3 words, but with copper it's madness. There are literally 10 thousand aliases for copper. Trust me, I've checked.

image

That's 25% of all aliases in Essentials. 25% of 40000 aliases are referring to only 32 items.

/itemdb command

Like I said earlier, it could show more aliases, (or it could be configurable). Or it could have some logic, and show some of the best abbreviations, with the lowest number of characters, for use in signs? I think that finding abbreviations for signs is the main purpose of /itemdb command, so it would make sense to do that.

Further work

Overall, I guess that part of the idea behind most of all aliases was making easier for people to use commands like /give etc., when there was no tab completion, so it was good to have many variants to make it easy for people to guess them. Now, with tab completion that many variations are not needed that much, so it may be good to remove most of them.

And by the way, tab completion in Essentials is much worse than in vanilla. Look at this:

image

And look at this (Essentials /give):

image

image

Most of the utility for these various aliases with shuffled words can be substituted by implementing better tab completion and maybe adding more aliases with underscores, because vanilla tab completion doesn't search for any parts of the words, but for the words separated by underscores. E.g. when I write "og", it won't find "log":

image

From what I've seen, the other big groups of items that have absurd amount of aliases are potions and tipped arrows, which can be looked into next.

I could help with designing the new aliases and maybe with some basic Java code.

Steps to reproduce

See above

Expected behaviour

See above

Actual behaviour

See above

commented

I agree, that is a bit silly. Worth noting that most of the current aliases are automatically generated. This was done for backwards compatibility due to the fact that back in the old days Minecraft used item IDs (0, 1, 2, etc) for items, instead of names, so Essentials maintained its own list of names. This used to be a shorter list of aliases, and was more or less updated by hand (which becomes increasingly difficult with the number of items and combinations that exist today).

It is currently possible to add custom aliases to custom_items.yml, so that would be the recommended way of solving this for the time being. Although gonna leave this open since we should probably make sure there is a usable alias for all items out of the box.