Skip to content
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

Improve Bans API. Add Whitelist API #954

Closed
wants to merge 1 commit into from
Closed

Conversation

Aaron1011
Copy link
Contributor

SpongeAPI | SpongeCommon

This PR improves the Bans API, correcting several issues preventing it from being implemented properly.

Notable changes:

  • The BanType enum has been replaced with the standard pseudo-enum classes (BanType and BanTypes)
  • Bans are now made on GameProfiles instead of Users. A User has associated world data, which is not applicable for Bans.
  • Each GameProfile or InetAddress can have exactly one ban. The previous concept of multiple bans per user/IP was a significant departure from Vanilla, and had no real use-cases
  • All BanData and WhitelistData references have been removed. This was a redundant way of accessing the BanService, and made it too easy for plugins to overwrite existing bans.
  • Ban#getStartDate has been changed to Ban#getCreatedDate. While the date is present in Vanilla, it only serves as an informational value. Making it function as a proper start date would break Vanilla compatibility, or introduce a disparity between the internal handling of Bans versus the BanService
  • Add WhitelistService. This is much simpler than BanService, as Vanilla whitelist entries lack the complexity of ban entries (no start/expiration date, source, or InetAddress target)
  • ClientConnectionEvent.Login is now fired already cancelled, if the player would be unable to join due to a ban/lack of whitelist/server being full.

Both BanService and WhitelistService fully support replacement. However, SimpleServiceManager still needs to be updated to allow services to be replaced.

TODO:

  • Determine if we should expose extra information about the disconnect reason in ClientConnectionEvent.Join. This could be in the form of a specific Cause object (similar to SpawnCause), or 'getOriginalXXX, getXXX, setXXX methods on the event.

@@ -29,7 +29,7 @@
* using an {@link Enum}.
*
* <p>All implementing classes, including those not listed in the catalog
* specified by the {@link org.spongepowered.api.util.annotation.CatalogedBy
* specified by the {@link org.spongepowered.api.util.annnotation.CatalogedBy
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

annnotation

@@ -44,7 +44,7 @@
String SUBJECTS_ROLE_TEMPLATE = "role-template";

/**
* Returns the permissions level that describes users. User identifiers are
* Returns the permissions level that describes users. Profile identifiers are
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

derp change?

@Aaron1011 Aaron1011 force-pushed the feature/new-bans branch 2 times, most recently from f8de336 to 3b6cfb3 Compare December 19, 2015 19:22
@Aaron1011
Copy link
Contributor Author

Closed in 7089fbd

@Aaron1011 Aaron1011 closed this Dec 19, 2015
@Aaron1011 Aaron1011 deleted the feature/new-bans branch December 19, 2015 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants