Skip to content

Commit

Permalink
updates. override /reload (to disable it), fix command unregistering …
Browse files Browse the repository at this point in the history
…in phases, make user prefix/suffix application adhere to the config value for the role system
  • Loading branch information
itsaphel committed Jul 4, 2017
1 parent 67c92fe commit b811c25
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/main/java/me/minidigger/voxelgameslib/VoxelGamesLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import me.minidigger.voxelgameslib.commands.FunCommands;
import me.minidigger.voxelgameslib.commands.GameCommands;
import me.minidigger.voxelgameslib.commands.LangCommands;
import me.minidigger.voxelgameslib.commands.OverrideCommands;
import me.minidigger.voxelgameslib.commands.RoleCommands;
import me.minidigger.voxelgameslib.commands.VGLCommands;
import me.minidigger.voxelgameslib.commands.WorldCommands;
Expand Down Expand Up @@ -57,6 +58,7 @@
import co.aikar.commands.BukkitCommandCompletionContext;
import co.aikar.commands.BukkitCommandExecutionContext;
import co.aikar.commands.BukkitCommandManager;
import co.aikar.commands.BukkitRootCommand;
import co.aikar.commands.CommandCompletions;
import co.aikar.commands.CommandContexts;
import co.aikar.commands.CommandReplacements;
Expand Down Expand Up @@ -258,7 +260,7 @@ private void registerCommandCompletions() {
}

private void registerCommands() {
commandManager.registerCommand(injector.getInstance(FunCommands.class));
commandManager.registerCommand(injector.getInstance(OverrideCommands.class), true);
commandManager.registerCommand(injector.getInstance(GameCommands.class));
commandManager.registerCommand(injector.getInstance(LangCommands.class));
commandManager.registerCommand(injector.getInstance(VGLCommands.class));
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package me.minidigger.voxelgameslib.commands;

import javax.inject.Singleton;

import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

import co.aikar.commands.BaseCommand;
import co.aikar.commands.annotation.CommandAlias;
import co.aikar.commands.annotation.CommandPermission;
import lombok.extern.java.Log;

/**
* This class overrides core Bukkit commands as necessary.
*/
@Singleton
@Log
@SuppressWarnings("JavaDoc") // commands don't need javadoc, go read the command's descriptions
public class OverrideCommands extends BaseCommand {

@CommandAlias("reload")
@CommandPermission("bukkit.command.reload") // don't change the access for this command
public void reload(CommandSender sender) {
sender.sendMessage(ChatColor.RED + "This command has been disabled by VoxelGamesLib, as it will break the framework from functioning.");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,9 @@ public void stop() {
HandlerList.unregisterAll((Listener) feature);
}

// todo, fix unregistering... waiting for aikar to update acf to support this
/*if (features instanceof BukkitRootCommand) {
commandManager.unregisterCommand((BukkitRootCommand) feature);
}*/
if (feature instanceof FeatureCommandImplementor) {
commandManager.unregisterCommand(((FeatureCommandImplementor) feature).getCommandClass());
}
}
startedFeatures.clear();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,14 +292,14 @@ public void setActiveChannel(String identifier) {

@Override
public void applyRolePrefix() {
if(getRole().getPrefix() != null) {
if(config.useRoleSystem && getRole().getPrefix() != null) {
setPrefix(getRole().getPrefix());
}
}

@Override
public void applyRoleSuffix() {
if(getRole().getSuffix() != null) {
if(config.useRoleSystem && getRole().getSuffix() != null) {
setSuffix(getRole().getSuffix());
}
}
Expand Down

0 comments on commit b811c25

Please sign in to comment.