Skip to content
This repository has been archived by the owner on Feb 3, 2024. It is now read-only.

[Sponge] Events #2139

Open
Favorlock opened this issue Aug 23, 2015 · 9 comments
Open

[Sponge] Events #2139

Favorlock opened this issue Aug 23, 2015 · 9 comments
Milestone

Comments

@Favorlock
Copy link

Will you be adding any events for sponge? Would be really helpful for 3rd party plugins that need to listen for when a players group changes, etc. Would like to be able to support PEX early on in the Sponge version of the Enjin plugin, but without a means to listen for group changes I can't support it.

@zml2008
Copy link
Member

zml2008 commented Aug 27, 2015

I plan to add events -- mostly been debating how to structure events best with PEX's new structure.

My current plan, for subject-specific events, is to just have an event that is cancellable with old subject, new subject, making it the listener's job to figure out what changes are relevant.

System event will most likely be similar to before, or perhaps even simpler, just a reload event. Unsure currently.

@zml2008 zml2008 added this to the 2.0 milestone Aug 29, 2015
@zml2008
Copy link
Member

zml2008 commented Sep 3, 2015

So I'm not sure if this way of going forward makes sense. Current, what PermissionsEx uses internally is instances of the Caching interface, which are called any time data is updated with the new data. However, this system is not very well exposed to higher-level objects like CalculatedSubject or SubjectDataReference. I'm thinking the simplest way to handle folks wanting to listen for changes is to tweak SubjectDataReference to allow registering arbitrary listeners. That fits well with the way that PEX works internally, but for the Sponge permissions API something different would have to be used -- especially since the Sponge API .

Also keep in mind that the Caching system only holds weak references to listeners -- so if the listener isn't being held on to by anything else, it's removed.

@Favorlock
Copy link
Author

I see. I'll be happy as long as I have a way to listen for when a rank is changed. Considering that PEX is the only plugin that appears to be usable with Sponge it'll be nice to be able to offer extended permission functionality that the Enjin plugin relies on.

@Favorlock
Copy link
Author

Any news on this?

@Favorlock
Copy link
Author

Still no news on this?

@zml2008
Copy link
Member

zml2008 commented Mar 16, 2016

Right now what you probably want to do is to add a listener to a SubjectDataReference (gotten from pex.getSubjects(SUBJECTS_USER).persistentData().getReference(player.getUniqueId().toString());

(as well as the one from transientData)

You just have to keep the SubjectDataReference instance around to prevent the listener from getting garbage-collected.

Let me know if that's enough to deal with your usecase. The one thing that might be a blocker for that is if the reference's state is updated before listeners are called, but that should be able to be swapped pretty easily.

@Favorlock
Copy link
Author

@zml2008 I can't call getManager from outside the same package it would appear.

Asides from that issue I was able to make it work by creating a class in "ninja.leaping.permissionsex.sponge" package.

@Favorlock
Copy link
Author

@zml2008 any chance you've made changes to make it possible to move my class whever I want?

@zml2008
Copy link
Member

zml2008 commented Dec 24, 2017

Unfortunately PermissionsEx is currently unmaintained and no further updates are planned. Because of this, all pull requests are being closed. If you are looking for an actively maintained permissions plugin, take a look at LuckPerms. It is compatible with major server platforms and can import data from PEX.

@zml2008 zml2008 closed this as completed Dec 24, 2017
@zml2008 zml2008 reopened this Aug 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants