-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Vault Block API #11159
base: master
Are you sure you want to change the base?
Add Vault Block API #11159
Conversation
I would also add methods accepting player UUIDs, so you can manage rewarded players when they are offline/you don't have a Player instance. It is done similarly for example for Wolf owners etc... |
patches/api/0483-Vault-API.patch
Outdated
* @return the 'vault_state' value | ||
*/ | ||
@NotNull | ||
- State getTrialSpawnerState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might break plugins. Maybe keep those old methods but deprecate them
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion this is a fine api break, considering this is clearly a wrong name and the methods have not been around for long and since the naming of these methods might cause confusion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While I don't hate the API break here, we cannot break ABI for spigot plugins as those will need to use said methods.
As such, this PR would have to address the conversion in commodore byte code rewriting.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part can be remove when pr is rebased. see https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/8a9ecf29405887b9e58244cd5d87e8ca0a5970d4#src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fblock%2Fdata%2Ftype%2FVault.java
patches/server/1045-Vault-API.patch
Outdated
+ return this.rewardedPlayers.contains(uniqueId); | ||
+ } | ||
+ | ||
+ public void addToRewardedPlayers(UUID uniqueId) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A lot of AT can be removed if you use your new methods instead and just get the uuid from the player and to reduce the diff a bit you could just change the original method and make a new overload with player, same applies for the api.
patches/server/1045-Vault-API.patch
Outdated
+ } | ||
+ | ||
+ @Override | ||
+ public void setItemsToEject(final List<ItemStack> itemsToEject) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't check empty item, so i can easily create a corrupted block entity
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The codec doesn't support those empty item.
For reference here is the stacktrace when you save the world without interacting with the vault (or using the data command): https://pastes.dev/faeBdNZWcj
You should also check with requirePlaced/isPlaced to take in account unplaced blockstate for all methods that works on the block entity directly (and require a level to be set) and not the snapshot |
patches/api/0483-Vault-API.patch
Outdated
* @return the 'vault_state' value | ||
*/ | ||
@NotNull | ||
- State getTrialSpawnerState(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That part can be remove when pr is rebased. see https://hub.spigotmc.org/stash/projects/SPIGOT/repos/bukkit/commits/8a9ecf29405887b9e58244cd5d87e8ca0a5970d4#src%2Fmain%2Fjava%2Forg%2Fbukkit%2Fblock%2Fdata%2Ftype%2FVault.java
merged onto master for 1.21.4 🙏 |
Adds bunch of basic API to get/set properties of vault blocks
Not finished but opening to get some feedback on structure and whatnot
The API Break with renaming of Vault-api methods get/setTrialSpawnerState -> get/setVaultState needs bytecode modification
If a contributor could sort that before merging this PR
All accessing of VaultServerData is done through TileEntity instead of a snapshot, due to snapshot always having a ServerLevel null
![image](https://private-user-images.githubusercontent.com/62521371/351752520-564a8a83-e619-4e3b-8c5f-632f01a7a1c2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk0NzU1NTAsIm5iZiI6MTczOTQ3NTI1MCwicGF0aCI6Ii82MjUyMTM3MS8zNTE3NTI1MjAtNTY0YThhODMtZTYxOS00ZTNiLThjNWYtNjMyZjAxYTdhMWMyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEzVDE5MzQxMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE5NWM0ZGZmMDIxOWIzYjc5ZmFlMTEzYmFhNmNlOTMxNzZiODZlYmE4NDI3ZTMxYWVkMGIwZmM5YjliNTI3NTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.x8lklPTobsOEyfvyPxE3zeif_FR3GXOwvgei0BiwmuE)
Therefore VaultServerData would always return null
Unsure if its a bug in my implementation or another issue