Vivecraft_Spigot_Extensions icon indicating copy to clipboard operation
Vivecraft_Spigot_Extensions copied to clipboard

Replace metadata with API class

Open Mwthorn opened this issue 4 years ago • 7 comments

Metadata is "a really inefficient global hashmap of uuid to data list". I suggest replacing metadata with an API class to access the values.

Mwthorn avatar Jan 17 '21 05:01 Mwthorn

Hashmaps are pretty fast, and metadata is far easier to implement without creating a hard dependency.

Techjar avatar Jan 17 '21 05:01 Techjar

It should definitely be replaced with API which doesn't require us to use NMS as it does currently.

WeaponMechanics users have experienced some random metadata loss in multiworld servers making the Vivecraft pretty much unusable with weapons

Even having this method return bukkit Vector would be enough to solve our problems:

  • https://github.com/jrbudda/Vivecraft_Spigot_Extensions/blob/1.19/src/org/vivecraft/VivePlayer.java#L120

We kinda don't want to make compatibility for 1.12 - 1.19 only to support Vec3 from this plugin

DeeCaaD avatar Feb 14 '23 12:02 DeeCaaD

Yeah I'm not sure what multiworld is doing to break the metadata stuff, will have to investigate that later. Can you open a separate issue for that?

Techjar avatar Feb 14 '23 23:02 Techjar

Yeah I'm not sure what multiworld is doing to break the metadata stuff, will have to investigate that later. Can you open a separate issue for that?

I just noticed CJ already fixed everything, see #94. It should be merged, far easier for everyone that way! We will tell people to use that fork until it gets merged to this.

DeeCaaD avatar Feb 15 '23 12:02 DeeCaaD

I'm not merging that #94 any time soon for various reasons (namely that it's too sudden/drastic of a codebase change for us). If they or someone else wants to pull out just the metadata bugfix, I'll merge that. Otherwise I guess I'll just have to redo the debugging work myself.

Techjar avatar Feb 15 '23 13:02 Techjar

I'm not merging that #94 any time soon for various reasons (namely that it's too sudden/drastic of a codebase change for us). If they or someone else wants to pull out just the metadata bugfix, I'll merge that. Otherwise I guess I'll just have to redo the debugging work myself.

You should definitely give it a try. Its easy to use. Even though its drastic change to codebase you wont kinda need to do anything expect merge (+ simply run few tests). There is also step-by-step guide for adding new version support inside same jar.

Similar system for compatibility is used in WeaponMechanics. The current system isn't good for plugin as it can't support multiple versions and for other plugins its harder to support Vivecraft properly.

DeeCaaD avatar Feb 15 '23 13:02 DeeCaaD

Searching for the right metadata key requires us to search through every metadata key in the entity... An API is better. #94 fixes it across all minecraft versions, #97 fixes it in the current version.

CJCrafter avatar Feb 15 '23 19:02 CJCrafter