use of org.lanternpowered.server.command.test.CommandOpenTestContainer in project LanternServer by LanternPowered.
the class DefaultCommandsCollection method load.
public void load() {
final Multimap<PluginContainer, CommandProvider> commandProviders = HashMultimap.create();
// Minecraft Commands
commandProviders.put(this.minecraft, new CommandBan());
commandProviders.put(this.minecraft, new CommandBanIp());
commandProviders.put(this.minecraft, new CommandBorder());
commandProviders.put(this.minecraft, new CommandDeop());
commandProviders.put(this.minecraft, new CommandDifficulty());
commandProviders.put(this.minecraft, new CommandGameMode());
commandProviders.put(this.minecraft, new CommandGameRule());
commandProviders.put(this.minecraft, new CommandHelp());
commandProviders.put(this.minecraft, new CommandKick());
commandProviders.put(this.minecraft, new CommandListBans());
commandProviders.put(this.minecraft, new CommandListPlayers());
commandProviders.put(this.minecraft, new CommandMe());
commandProviders.put(this.minecraft, new CommandOp());
commandProviders.put(this.minecraft, new CommandPardon());
commandProviders.put(this.minecraft, new CommandPardonIp());
commandProviders.put(this.minecraft, new CommandParticle());
commandProviders.put(this.implementation, new CommandParticleEffect());
commandProviders.put(this.minecraft, new CommandPlaySound());
commandProviders.put(this.minecraft, new CommandSay());
commandProviders.put(this.minecraft, new CommandScoreboard());
commandProviders.put(this.implementation, new CommandSetData());
commandProviders.put(this.minecraft, new CommandSetIdleTimeout());
commandProviders.put(this.minecraft, new CommandSetSpawn());
commandProviders.put(this.minecraft, new CommandStop());
commandProviders.put(this.minecraft, new CommandStopSound());
commandProviders.put(this.minecraft, new CommandTeleport());
commandProviders.put(this.minecraft, new CommandTell());
commandProviders.put(this.minecraft, new CommandTime());
commandProviders.put(this.minecraft, new CommandTitle());
commandProviders.put(this.minecraft, new CommandToggleDownfall());
commandProviders.put(this.minecraft, new CommandTp());
commandProviders.put(this.implementation, new CommandVersion());
commandProviders.put(this.minecraft, new CommandWeather());
commandProviders.put(this.minecraft, new CommandWhitelist());
// Testing Commands
commandProviders.put(this.implementation, new CommandOpenTestContainer());
for (Map.Entry<PluginContainer, CommandProvider> entry : commandProviders.entries()) {
final PluginContainer plugin = entry.getKey();
this.commandManager.register(plugin, entry.getValue().buildSpecFor(plugin), entry.getValue().getAliases());
}
final PermissionService permissionService = this.permissionService.get();
if (permissionService instanceof LanternPermissionService) {
final LanternPermissionService lanternPermissionService = (LanternPermissionService) permissionService;
// noinspection Convert2streamapi
for (Map.Entry<PluginContainer, CommandProvider> entry : commandProviders.entries()) {
entry.getValue().getOpPermissionLevel().ifPresent(level -> lanternPermissionService.getGroupForOpLevel(level).getSubjectData().setPermission(SubjectData.GLOBAL_CONTEXT, entry.getValue().getPermissionFor(entry.getKey()), Tristate.TRUE));
}
} else {
// noinspection Convert2streamapi
for (Map.Entry<PluginContainer, CommandProvider> entry : commandProviders.entries()) {
if (entry.getValue().getOpPermissionLevel().orElse(0) == 0) {
permissionService.getDefaults().getTransientSubjectData().setPermission(SubjectData.GLOBAL_CONTEXT, entry.getValue().getPermissionFor(entry.getKey()), Tristate.TRUE);
}
}
}
}
Aggregations