mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-25 11:46:50 +01:00
Stop Ingame-Access from disallowing console access
This commit is contained in:
parent
935a59bb34
commit
463861744c
@ -40,6 +40,8 @@ public final class SubCommand implements CommandExecutor {
|
||||
} else if (plugin.lang == null) {
|
||||
new IllegalStateException("There are no lang options available at this time").printStackTrace();
|
||||
if (!(sender instanceof ConsoleCommandSender)) sender.sendMessage(ChatColor.RED + "An exception has occurred while running this command");
|
||||
} else if (!(sender instanceof ConsoleCommandSender || plugin.config.get().getSection("Settings").getBoolean("Ingame-Access", true))) {
|
||||
sender.sendMessage(plugin.api.getLang("SubServers", "Command.Generic.Invalid-Permission").replace("$str$", "subservers.command"));
|
||||
} else {
|
||||
if (sender.hasPermission("subservers.command")) {
|
||||
if (args.length > 0) {
|
||||
|
@ -77,13 +77,11 @@ public final class SubPlugin extends JavaPlugin {
|
||||
|
||||
reload(false);
|
||||
|
||||
if (config.get().getSection("Settings").getBoolean("Ingame-Access", true)) {
|
||||
gui = new DefaultUIHandler(this);
|
||||
SubCommand cmd = new SubCommand(this);
|
||||
getCommand("subservers").setExecutor(cmd);
|
||||
getCommand("subserver").setExecutor(cmd);
|
||||
getCommand("sub").setExecutor(cmd);
|
||||
}
|
||||
gui = new DefaultUIHandler(this);
|
||||
SubCommand cmd = new SubCommand(this);
|
||||
getCommand("subservers").setExecutor(cmd);
|
||||
getCommand("subserver").setExecutor(cmd);
|
||||
getCommand("sub").setExecutor(cmd);
|
||||
|
||||
new Metrics(this);
|
||||
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {
|
||||
|
@ -17,6 +17,7 @@ import org.spongepowered.api.command.CommandResult;
|
||||
import org.spongepowered.api.command.CommandSource;
|
||||
import org.spongepowered.api.command.args.CommandContext;
|
||||
import org.spongepowered.api.command.args.GenericArguments;
|
||||
import org.spongepowered.api.command.source.ConsoleSource;
|
||||
import org.spongepowered.api.command.spec.CommandExecutor;
|
||||
import org.spongepowered.api.command.spec.CommandSpec;
|
||||
import org.spongepowered.api.entity.living.player.Player;
|
||||
@ -115,7 +116,7 @@ public final class SubCommand implements CommandExecutor {
|
||||
} else if (plugin.lang == null) {
|
||||
throw new CommandException(Text.builder("An exception has occurred while running this command").color(TextColors.RED).build(), new IllegalStateException("There are no lang options available at this time"), false);
|
||||
} else {
|
||||
return sender.hasPermission("subservers.command");
|
||||
return (sender instanceof ConsoleSource || plugin.config.get().getSection("Settings").getBoolean("Ingame-Access", true)) && sender.hasPermission("subservers.command");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,10 +102,8 @@ public final class SubPlugin {
|
||||
|
||||
reload(false);
|
||||
|
||||
if (config.get().getSection("Settings").getBoolean("Ingame-Access", true)) {
|
||||
//gui = new InternalUIHandler(this);
|
||||
Sponge.getCommandManager().register(plugin, new SubCommand(this).spec(), "sub", "subserver", "subservers");
|
||||
}
|
||||
//gui = new InternalUIHandler(this);
|
||||
Sponge.getCommandManager().register(plugin, new SubCommand(this).spec(), "sub", "subserver", "subservers");
|
||||
|
||||
new Metrics(this);
|
||||
game.getScheduler().createTaskBuilder().async().execute(() -> {
|
||||
|
Loading…
Reference in New Issue
Block a user