Unlinkdiscord now works for ops

This commit is contained in:
ZeroEpoch1969 2018-06-29 12:36:42 -07:00
parent 107d886b35
commit b43a9b6749
No known key found for this signature in database
GPG Key ID: E0AAB104FB9F8FDF
3 changed files with 25 additions and 9 deletions

View File

@ -1,5 +1,6 @@
package me.totalfreedom.totalfreedommod.command; package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import me.totalfreedom.totalfreedommod.admin.Admin; import me.totalfreedom.totalfreedommod.admin.Admin;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -20,15 +21,31 @@ public class Command_unlinkdiscord extends FreedomCommand
msg("The discord verification system is currently disabled.", ChatColor.RED); msg("The discord verification system is currently disabled.", ChatColor.RED);
return true; return true;
} }
Admin admin = plugin.al.getAdmin(playerSender); if (plugin.al.isAdmin(playerSender))
if (admin.getDiscordID() == null)
{ {
msg("Your minecraft account is not linked to a discord account.", ChatColor.RED); Admin admin = plugin.al.getAdmin(playerSender);
if (admin.getDiscordID() == null)
{
msg("Your minecraft account is not linked to a discord account.", ChatColor.RED);
return true;
}
admin.setDiscordID(null);
msg("Your minecraft account has been successfully unlinked from the discord account.", ChatColor.GREEN);
return true;
}
else
{
VPlayer data = plugin.pv.getVerificationPlayer(playerSender);
if (data.getDiscordId() == null)
{
msg("Your minecraft account is not linked to a discord account.", ChatColor.RED);
return true;
}
data.setDiscordId(null);
data.setDiscordEnabled(false);
msg("Your minecraft account has been successfully unlinked from the discord account.", ChatColor.GREEN);
return true; return true;
} }
admin.setDiscordID(null);
msg("Your minecraft account has been successfully unlinked from the discord account.", ChatColor.GREEN);
return true;
} }
} }

View File

@ -18,7 +18,7 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
@CommandParameters(description = "Vanish/unvanish yourself.", usage = "/<command> [-s[ilent]]", aliases = "v") @CommandParameters(description = "Vanish/unvanish yourself.", usage = "/<command> [-s[ilent]]", aliases = "v")
public class Command_vanish extends FreedomCommand public class Command_vanish extends FreedomCommand
{ {
public static ArrayList<Player> VANISHED = new ArrayList<Player>(); public static ArrayList<Player> VANISHED = new ArrayList<>();
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) { public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole) {
Displayable display = plugin.rm.getDisplay(playerSender); Displayable display = plugin.rm.getDisplay(playerSender);

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.config; package me.totalfreedom.totalfreedommod.config;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;