This commit is contained in:
Norbi Peti 2018-11-01 21:47:40 +01:00
parent 17887707cb
commit 8721b623cb
No known key found for this signature in database
GPG key ID: DBA4C4549A927E56
2 changed files with 10 additions and 7 deletions

View file

@ -59,19 +59,19 @@ public class RoleCommand extends DiscordCommandBase {
DiscordPlugin.sendMessageToChannel(message.getChannel(), usage + "\nUsage: " + argsa[0] + " <rolename>"); DiscordPlugin.sendMessageToChannel(message.getChannel(), usage + "\nUsage: " + argsa[0] + " <rolename>");
return null; return null;
} }
String rolename = argsa[1]; StringBuilder rolename = new StringBuilder(argsa[1]);
for (int i = 2; i < argsa.length; i++) for (int i = 2; i < argsa.length; i++)
rolename += " " + argsa[i]; rolename.append(" ").append(argsa[i]);
if (!DiscordPlugin.GameRoles.contains(rolename)) { if (!DiscordPlugin.GameRoles.contains(rolename.toString())) {
DiscordPlugin.sendMessageToChannel(message.getChannel(), "That game role cannot be found."); DiscordPlugin.sendMessageToChannel(message.getChannel(), "That game role cannot be found.");
listRoles(message); listRoles(message);
return null; return null;
} }
final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rolename); final List<IRole> roles = DiscordPlugin.mainServer.getRolesByName(rolename.toString());
if (roles.size() == 0) { if (roles.size() == 0) {
DiscordPlugin.sendMessageToChannel(message.getChannel(), DiscordPlugin.sendMessageToChannel(message.getChannel(),
"The specified role cannot be found on Discord! Removing from the list."); "The specified role cannot be found on Discord! Removing from the list.");
DiscordPlugin.GameRoles.remove(rolename); DiscordPlugin.GameRoles.remove(rolename.toString());
return null; return null;
} }
if (roles.size() > 1) { if (roles.size() > 1) {

View file

@ -1,6 +1,7 @@
package buttondevteam.discordplugin.mccommands; package buttondevteam.discordplugin.mccommands;
import buttondevteam.discordplugin.DiscordPlugin; import buttondevteam.discordplugin.DiscordPlugin;
import buttondevteam.discordplugin.DiscordSenderBase;
import buttondevteam.lib.chat.CommandClass; import buttondevteam.lib.chat.CommandClass;
import buttondevteam.lib.chat.TBMCCommandBase; import buttondevteam.lib.chat.TBMCCommandBase;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -15,9 +16,11 @@ public class ResetMCCommand extends TBMCCommandBase { //Not player-only, so not
resetting = true; //Turned off after sending enable message (ReadyEvent) resetting = true; //Turned off after sending enable message (ReadyEvent)
sender.sendMessage("§bDisabling DiscordPlugin..."); sender.sendMessage("§bDisabling DiscordPlugin...");
Bukkit.getPluginManager().disablePlugin(DiscordPlugin.plugin); Bukkit.getPluginManager().disablePlugin(DiscordPlugin.plugin);
sender.sendMessage("§bEnabling DiscordPlugin..."); if (!(sender instanceof DiscordSenderBase)) //Sending to Discord errors
sender.sendMessage("§bEnabling DiscordPlugin...");
Bukkit.getPluginManager().enablePlugin(DiscordPlugin.plugin); Bukkit.getPluginManager().enablePlugin(DiscordPlugin.plugin);
sender.sendMessage("§bReset finished!"); if (!(sender instanceof DiscordSenderBase)) //Sending to Discord errors
sender.sendMessage("§bReset finished!");
}); });
return true; return true;
} }