mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-26 22:03:07 +00:00
Fix Sponge build
This commit is contained in:
7 files changed
+23
-47
No files matched your search
@@ -53,7 +53,6 @@ import me.lucko.luckperms.sponge.model.manager.SpongeGroupManager;
|
||||
import me.lucko.luckperms.sponge.model.manager.SpongeUserManager;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.ProxyFactory;
|
||||
import me.lucko.luckperms.sponge.service.events.UpdateEventHandler;
|
||||
import me.lucko.luckperms.sponge.service.model.LPPermissionService;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectCollection;
|
||||
import me.lucko.luckperms.sponge.service.model.ProxiedServiceObject;
|
||||
@@ -94,7 +93,6 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
private StandardTrackManager trackManager;
|
||||
private SpongeContextManager contextManager;
|
||||
private LuckPermsService service;
|
||||
private UpdateEventHandler updateEventHandler;
|
||||
|
||||
private boolean lateLoad = false;
|
||||
|
||||
@@ -170,7 +168,6 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
@Override
|
||||
protected void setupPlatformHooks() {
|
||||
getLogger().info("Registering PermissionService...");
|
||||
this.updateEventHandler = UpdateEventHandler.obtain(this);
|
||||
this.service = new LuckPermsService(this);
|
||||
|
||||
PermissionService oldService = this.bootstrap.getGame().getServiceManager().provide(PermissionService.class).orElse(null);
|
||||
@@ -325,8 +322,4 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
return this.service;
|
||||
}
|
||||
|
||||
public UpdateEventHandler getUpdateEventHandler() {
|
||||
return this.updateEventHandler;
|
||||
}
|
||||
|
||||
}
|
||||
+8
-16
@@ -28,23 +28,15 @@ package me.lucko.luckperms.sponge.service.events;
|
||||
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectData;
|
||||
|
||||
public interface UpdateEventHandler {
|
||||
import org.spongepowered.api.event.permission.SubjectDataUpdateEvent;
|
||||
|
||||
static UpdateEventHandler obtain(LPSpongePlugin plugin) {
|
||||
try {
|
||||
Class.forName("org.spongepowered.api.event.permission.SubjectDataUpdateEvent");
|
||||
return new UpdateEventHandlerImpl(plugin);
|
||||
} catch (ClassNotFoundException e) {
|
||||
return new Noop();
|
||||
}
|
||||
}
|
||||
public final class UpdateEventHandler {
|
||||
private UpdateEventHandler() {}
|
||||
|
||||
void fireUpdateEvent(LPSubjectData subjectData);
|
||||
|
||||
class Noop implements UpdateEventHandler {
|
||||
@Override
|
||||
public void fireUpdateEvent(LPSubjectData subjectData) {
|
||||
|
||||
}
|
||||
public static void fireUpdateEvent(LPSpongePlugin plugin, LPSubjectData subjectData) {
|
||||
plugin.getBootstrap().getScheduler().executeAsync(() -> {
|
||||
SubjectDataUpdateEvent event = new LPSubjectDataUpdateEvent(plugin, subjectData);
|
||||
plugin.getBootstrap().getGame().getEventManager().post(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
-47
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* This file is part of LuckPerms, licensed under the MIT License.
|
||||
*
|
||||
* Copyright (c) lucko (Luck) <[email protected]>
|
||||
* Copyright (c) contributors
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
package me.lucko.luckperms.sponge.service.events;
|
||||
|
||||
import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectData;
|
||||
|
||||
import org.spongepowered.api.event.permission.SubjectDataUpdateEvent;
|
||||
|
||||
public class UpdateEventHandlerImpl implements UpdateEventHandler {
|
||||
private final LPSpongePlugin plugin;
|
||||
|
||||
public UpdateEventHandlerImpl(LPSpongePlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fireUpdateEvent(LPSubjectData subjectData) {
|
||||
this.plugin.getBootstrap().getScheduler().executeAsync(() -> {
|
||||
SubjectDataUpdateEvent event = new LPSubjectDataUpdateEvent(this.plugin, subjectData);
|
||||
this.plugin.getBootstrap().getGame().getEventManager().post(event);
|
||||
});
|
||||
}
|
||||
}
|
||||
+3
-2
@@ -41,6 +41,7 @@ import me.lucko.luckperms.sponge.LPSpongePlugin;
|
||||
import me.lucko.luckperms.sponge.model.SpongeGroup;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.ProxyFactory;
|
||||
import me.lucko.luckperms.sponge.service.events.UpdateEventHandler;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectReference;
|
||||
import me.lucko.luckperms.sponge.service.model.ProxiedSubject;
|
||||
@@ -74,8 +75,8 @@ public abstract class PermissionHolderSubject<T extends PermissionHolder> implem
|
||||
}
|
||||
|
||||
public void fireUpdateEvent() {
|
||||
this.plugin.getUpdateEventHandler().fireUpdateEvent(this.subjectData);
|
||||
this.plugin.getUpdateEventHandler().fireUpdateEvent(this.transientSubjectData);
|
||||
UpdateEventHandler.fireUpdateEvent(this.plugin, this.subjectData);
|
||||
UpdateEventHandler.fireUpdateEvent(this.plugin, this.transientSubjectData);
|
||||
}
|
||||
|
||||
public T getParent() {
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ import me.lucko.luckperms.common.cache.BufferedRequest;
|
||||
import me.lucko.luckperms.common.plugin.LuckPermsPlugin;
|
||||
import me.lucko.luckperms.sponge.service.LuckPermsService;
|
||||
import me.lucko.luckperms.sponge.service.ProxyFactory;
|
||||
import me.lucko.luckperms.sponge.service.events.UpdateEventHandler;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubject;
|
||||
import me.lucko.luckperms.sponge.service.model.LPSubjectData;
|
||||
import me.lucko.luckperms.sponge.service.model.ProxiedSubject;
|
||||
@@ -109,7 +110,7 @@ public class PersistedSubject extends CalculatedSubject implements LPSubject {
|
||||
* @param subjectData the subject data
|
||||
*/
|
||||
private void fireUpdateEvent(LPSubjectData subjectData) {
|
||||
this.service.getPlugin().getUpdateEventHandler().fireUpdateEvent(subjectData);
|
||||
UpdateEventHandler.fireUpdateEvent(this.service.getPlugin(), subjectData);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user