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) {
|
} else if (plugin.lang == null) {
|
||||||
new IllegalStateException("There are no lang options available at this time").printStackTrace();
|
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");
|
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 {
|
} else {
|
||||||
if (sender.hasPermission("subservers.command")) {
|
if (sender.hasPermission("subservers.command")) {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
|
|
|
@ -77,13 +77,11 @@ public final class SubPlugin extends JavaPlugin {
|
||||||
|
|
||||||
reload(false);
|
reload(false);
|
||||||
|
|
||||||
if (config.get().getSection("Settings").getBoolean("Ingame-Access", true)) {
|
gui = new DefaultUIHandler(this);
|
||||||
gui = new DefaultUIHandler(this);
|
SubCommand cmd = new SubCommand(this);
|
||||||
SubCommand cmd = new SubCommand(this);
|
getCommand("subservers").setExecutor(cmd);
|
||||||
getCommand("subservers").setExecutor(cmd);
|
getCommand("subserver").setExecutor(cmd);
|
||||||
getCommand("subserver").setExecutor(cmd);
|
getCommand("sub").setExecutor(cmd);
|
||||||
getCommand("sub").setExecutor(cmd);
|
|
||||||
}
|
|
||||||
|
|
||||||
new Metrics(this);
|
new Metrics(this);
|
||||||
Bukkit.getScheduler().runTaskTimerAsynchronously(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.CommandSource;
|
||||||
import org.spongepowered.api.command.args.CommandContext;
|
import org.spongepowered.api.command.args.CommandContext;
|
||||||
import org.spongepowered.api.command.args.GenericArguments;
|
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.CommandExecutor;
|
||||||
import org.spongepowered.api.command.spec.CommandSpec;
|
import org.spongepowered.api.command.spec.CommandSpec;
|
||||||
import org.spongepowered.api.entity.living.player.Player;
|
import org.spongepowered.api.entity.living.player.Player;
|
||||||
|
@ -115,7 +116,7 @@ public final class SubCommand implements CommandExecutor {
|
||||||
} else if (plugin.lang == null) {
|
} 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);
|
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 {
|
} 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);
|
reload(false);
|
||||||
|
|
||||||
if (config.get().getSection("Settings").getBoolean("Ingame-Access", true)) {
|
//gui = new InternalUIHandler(this);
|
||||||
//gui = new InternalUIHandler(this);
|
Sponge.getCommandManager().register(plugin, new SubCommand(this).spec(), "sub", "subserver", "subservers");
|
||||||
Sponge.getCommandManager().register(plugin, new SubCommand(this).spec(), "sub", "subserver", "subservers");
|
|
||||||
}
|
|
||||||
|
|
||||||
new Metrics(this);
|
new Metrics(this);
|
||||||
game.getScheduler().createTaskBuilder().async().execute(() -> {
|
game.getScheduler().createTaskBuilder().async().execute(() -> {
|
||||||
|
|
Loading…
Reference in New Issue