Open Parties and Claims

Open Parties and Claims

25M Downloads

API for implementing claim cost

thexaero opened this issue ยท 11 comments

commented

Basically a way to catch claim requests on the server side before they're fulfilled with the ability to cancel them, and a way to react to fulfilled requests.
EDIT: Also needs to give mods a way to override whether a player has access to a chunk (e.g. for expiration times stored in the actual world save).
EDIT: The override should allow granting access to an otherwise inaccessible claim too, not just take it away.

commented

That part would have to go in the addon itself. I can't really add timers/timestamps to each individual chunk claim without destroying resource usage and performance anyway, so the addon can store it however it chooses. I could do something with all claims expiring for a player. I don't know if that's what you want though.

That is very interesting. I'm not a java programmer, but am a programmer by trade. It's interesting that minecraft is putting you in such a scenario that storing times and firing events / callbacks is so strenuous on the system that it's a legitimate performance concern. I am consistently amazed by the byzantine constraints you have to put up with.

commented

Not only that, but some way to create an event around a claim existing for a certain amount of time. This way you can have periodic payments. This is extra handy as it allows unpaid claims to decay away over time.

commented

That part would have to go in the addon itself. I can't really add timers/timestamps to each individual chunk claim without destroying resource usage and performance anyway, so the addon can store it however it chooses. I could do something with all claims expiring for a player. I don't know if that's what you want though.

commented

That's not really a Minecraft thing, but I guess it does come from what it is. Just think about how many claims you can create in a 60,000,000x60,000,000 world and how much memory an average computer/server has, but you don't even have to go that far for it to become a problem. A big enough server will get the claim number up very quickly.

All of the claims need to be kept loaded, if I want to give quick access to all the claims to other mods, and all of it needs to be synced to each player's client too, to do the same on the client side, which is how my map mods are able to display them. Requiring mods to requests parts of the world to be loaded and unloaded and wait for it would be pretty strange, limiting and unnecessary. Claims are stored in regions with a palette and a bit array and are synced over time (usually a very short amount of time). It works very well until each claim has unique data attached to it. That's what you would get if you stored a timestamp for each claim. Of course, timestamps don't need to be accessible on the client side, but converting server data to syncable data (without timestamps) takes a significant amount of time, and storing it separately at all times (to avoid converting anything) increases memory usage and the CPU cost of creating a single claim. Although just keeping the timestamps loaded on the server side would be a huge issue to begin with. Interestingly, syncing claim positions is actually much faster than simply syncing all the unique claim states that exist. Even Minecraft itself doesn't have to deal with this problem when syncing chunks because the number of unique block states doesn't grow over the lifetime of a server, unless new blocks are purposely added.

An addon that implements a claim cost for the claims can store timers per chunk group to optimize this, instead of each individual chunk. Or just have 1 timer for all of a player's claims. It all depends on how they want to handle claim costs, and I don't want to take away that freedom. So I think that this part should be left to the addon developers to figure out. Mods can already claim/unclaim chunks on the server side using the current API without any input from the player. The ability to catch player claim requests and cancel them is going to be very powerful.

commented

Just had an idea, after thinking this through, that one could attach the timers to the actual game chunks, that are not loaded at all times, so don't create any of the previously mentioned problems. This will be good enough if you want a system that doesn't actually affect the claim data when they expire, but takes away the access from the owner player until they pay the rent. This won't be reflected on a claim map in any way but will work for chunk protection.
So, basically, I should also add an API for overriding whether a player has access to a chunk.

commented

Hey there, any news on this ?

We want to add currency to our server ( Numismatic Overhaul ) and with that money we wanna provide a way to buy more claim chunks with that money.

Is there a way to achieve this in the current version of OPAC ?

BTW do you have a discord?

commented

@SpigotDE I have a Patreon-only discord. No, I have not even started working on this. This is far from a priority feature.

commented

@SpigotDE I am aware, it seems great, but it's not exactly what this issue is for. I want to add an API that lets you add a cost to the actual claim action, not the claim limit increase, and lets you override chunk access. The API would allow a lot more customization, e.g. basing the claim cost on the chunk location, selling/renting specific chunks etc.
I didn't even know that you meant buying a higher claim limit.

commented

That sounds awesome

Globox made a quick mod for our server and i thought i share it here as a temporary solution.

If someone really needs it now.

commented

Globox_Z wrote a mod for implementing OPAC and Numismatic Overhaul Claim Costs

https://www.curseforge.com/minecraft/mc-mods/numismaticclaim

commented

As you said before, this is not a priority feature, however, was this feature ever begin development?