mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-28 05:35:26 +01:00
Fix errors relating to sponge plugin parameter being an illegal argument (#810)
This commit is contained in:
parent
0d89840179
commit
6d2ea659a4
@ -52,7 +52,9 @@ import org.spongepowered.api.scheduler.SpongeExecutorService;
|
||||
import org.spongepowered.api.scheduler.SynchronousExecutor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
@ -242,10 +244,19 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
||||
|
||||
@Override
|
||||
public File getDataDirectory() {
|
||||
File serverRoot = getConfigPath().toFile().getParentFile().getParentFile();
|
||||
File dataDirectory = new File(serverRoot, "luckperms");
|
||||
dataDirectory.mkdirs();
|
||||
return dataDirectory;
|
||||
Path serverRoot = getConfigPath().getParent().getParent();
|
||||
Path dataDirectory = serverRoot.resolve("luckperms");
|
||||
try {
|
||||
Files.createDirectories(dataDirectory);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return dataDirectory.toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getConfigDirectory() {
|
||||
return this.configDirectory.toFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -111,8 +111,8 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
@Override
|
||||
protected void registerPlatformListeners() {
|
||||
this.connectionListener = new SpongeConnectionListener(this);
|
||||
this.bootstrap.getGame().getEventManager().registerListeners(this, this.connectionListener);
|
||||
this.bootstrap.getGame().getEventManager().registerListeners(this, new SpongePlatformListener(this));
|
||||
this.bootstrap.getGame().getEventManager().registerListeners(this.bootstrap, this.connectionListener);
|
||||
this.bootstrap.getGame().getEventManager().registerListeners(this.bootstrap, new SpongePlatformListener(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -123,7 +123,7 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
@Override
|
||||
protected void registerCommands() {
|
||||
this.commandManager = new SpongeCommandExecutor(this);
|
||||
this.bootstrap.getGame().getCommandManager().register(this, this.commandManager, "luckperms", "lp", "perm", "perms", "permission", "permissions");
|
||||
this.bootstrap.getGame().getCommandManager().register(this.bootstrap, this.commandManager, "luckperms", "lp", "perm", "perms", "permission", "permissions");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -155,15 +155,15 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
getLogger().warn("Delaying LuckPerms PermissionService registration.");
|
||||
this.lateLoad = true;
|
||||
} else {
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LPPermissionService.class, this.service);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, PermissionService.class, this.service.sponge());
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LuckPermsService.class, this.service);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LPPermissionService.class, this.service);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, PermissionService.class, this.service.sponge());
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LuckPermsService.class, this.service);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void registerApiOnPlatform(LuckPermsApi api) {
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LuckPermsApi.class, api);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LuckPermsApi.class, api);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -184,9 +184,9 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
||||
public void lateEnable() {
|
||||
if (this.lateLoad) {
|
||||
getLogger().info("Providing late registration of PermissionService...");
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LPPermissionService.class, this.service);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, PermissionService.class, this.service.sponge());
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LuckPermsService.class, this.service);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LPPermissionService.class, this.service);
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, PermissionService.class, this.service.sponge());
|
||||
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LuckPermsService.class, this.service);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class BungeeMessenger implements Messenger, RawDataListener {
|
||||
}
|
||||
|
||||
public void init() {
|
||||
this.channel = this.plugin.getBootstrap().getGame().getChannelRegistrar().createRawChannel(this.plugin, CHANNEL);
|
||||
this.channel = this.plugin.getBootstrap().getGame().getChannelRegistrar().createRawChannel(this.plugin.getBootstrap(), CHANNEL);
|
||||
this.channel.addListener(Platform.Type.SERVER, this);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ public class BungeeMessenger implements Messenger, RawDataListener {
|
||||
|
||||
this.channel.sendTo(p, buf -> buf.writeUTF(outgoingMessage.asEncodedString()));
|
||||
task.cancel();
|
||||
}).submit(this.plugin);
|
||||
}).submit(this.plugin.getBootstrap());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -62,6 +62,10 @@ public class LPSubjectDataUpdateEvent extends AbstractEvent implements SubjectDa
|
||||
.add(EventContextKeys.PLUGIN, this.plugin.getBootstrap().getPluginContainer())
|
||||
.build();
|
||||
|
||||
return Cause.builder().build(eventContext);
|
||||
return Cause.builder()
|
||||
.append(this.plugin.getService())
|
||||
.append(this.plugin.getService().sponge())
|
||||
.append(this.plugin.getBootstrap().getPluginContainer())
|
||||
.build(eventContext);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user