mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2024-11-04 01:49:31 +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 org.spongepowered.api.scheduler.SynchronousExecutor;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -242,10 +244,19 @@ public class LPSpongeBootstrap implements LuckPermsBootstrap {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public File getDataDirectory() {
|
public File getDataDirectory() {
|
||||||
File serverRoot = getConfigPath().toFile().getParentFile().getParentFile();
|
Path serverRoot = getConfigPath().getParent().getParent();
|
||||||
File dataDirectory = new File(serverRoot, "luckperms");
|
Path dataDirectory = serverRoot.resolve("luckperms");
|
||||||
dataDirectory.mkdirs();
|
try {
|
||||||
return dataDirectory;
|
Files.createDirectories(dataDirectory);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return dataDirectory.toFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public File getConfigDirectory() {
|
||||||
|
return this.configDirectory.toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -111,8 +111,8 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
|||||||
@Override
|
@Override
|
||||||
protected void registerPlatformListeners() {
|
protected void registerPlatformListeners() {
|
||||||
this.connectionListener = new SpongeConnectionListener(this);
|
this.connectionListener = new SpongeConnectionListener(this);
|
||||||
this.bootstrap.getGame().getEventManager().registerListeners(this, this.connectionListener);
|
this.bootstrap.getGame().getEventManager().registerListeners(this.bootstrap, this.connectionListener);
|
||||||
this.bootstrap.getGame().getEventManager().registerListeners(this, new SpongePlatformListener(this));
|
this.bootstrap.getGame().getEventManager().registerListeners(this.bootstrap, new SpongePlatformListener(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -123,7 +123,7 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
|||||||
@Override
|
@Override
|
||||||
protected void registerCommands() {
|
protected void registerCommands() {
|
||||||
this.commandManager = new SpongeCommandExecutor(this);
|
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
|
@Override
|
||||||
@ -155,15 +155,15 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
|||||||
getLogger().warn("Delaying LuckPerms PermissionService registration.");
|
getLogger().warn("Delaying LuckPerms PermissionService registration.");
|
||||||
this.lateLoad = true;
|
this.lateLoad = true;
|
||||||
} else {
|
} else {
|
||||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LPPermissionService.class, this.service);
|
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LPPermissionService.class, this.service);
|
||||||
this.bootstrap.getGame().getServiceManager().setProvider(this, PermissionService.class, this.service.sponge());
|
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, PermissionService.class, this.service.sponge());
|
||||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LuckPermsService.class, this.service);
|
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LuckPermsService.class, this.service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void registerApiOnPlatform(LuckPermsApi api) {
|
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
|
@Override
|
||||||
@ -184,9 +184,9 @@ public class LPSpongePlugin extends AbstractLuckPermsPlugin {
|
|||||||
public void lateEnable() {
|
public void lateEnable() {
|
||||||
if (this.lateLoad) {
|
if (this.lateLoad) {
|
||||||
getLogger().info("Providing late registration of PermissionService...");
|
getLogger().info("Providing late registration of PermissionService...");
|
||||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LPPermissionService.class, this.service);
|
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LPPermissionService.class, this.service);
|
||||||
this.bootstrap.getGame().getServiceManager().setProvider(this, PermissionService.class, this.service.sponge());
|
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, PermissionService.class, this.service.sponge());
|
||||||
this.bootstrap.getGame().getServiceManager().setProvider(this, LuckPermsService.class, this.service);
|
this.bootstrap.getGame().getServiceManager().setProvider(this.bootstrap, LuckPermsService.class, this.service);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ public class BungeeMessenger implements Messenger, RawDataListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void init() {
|
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);
|
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()));
|
this.channel.sendTo(p, buf -> buf.writeUTF(outgoingMessage.asEncodedString()));
|
||||||
task.cancel();
|
task.cancel();
|
||||||
}).submit(this.plugin);
|
}).submit(this.plugin.getBootstrap());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -62,6 +62,10 @@ public class LPSubjectDataUpdateEvent extends AbstractEvent implements SubjectDa
|
|||||||
.add(EventContextKeys.PLUGIN, this.plugin.getBootstrap().getPluginContainer())
|
.add(EventContextKeys.PLUGIN, this.plugin.getBootstrap().getPluginContainer())
|
||||||
.build();
|
.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