Removed some unnecessary code in updateRank and opened up all ranks to be used.
This commit is contained in:
parent
daee44d262
commit
ac792dcd02
@ -28,13 +28,6 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
@Override
|
||||
public void Execute(final Player caller, String[] args)
|
||||
{
|
||||
if (!Plugin.Get(caller).GetRank(true).has(caller, Rank.ADMIN, true))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
boolean testServer = Plugin.getPlugin().getConfig().getString("serverstatus.group").equalsIgnoreCase("Testing");
|
||||
|
||||
if (args == null)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), "/" + AliasUsed + " joeschmo MODERATOR"));
|
||||
@ -62,79 +55,70 @@ public class UpdateRank extends CommandBase<CoreClientManager>
|
||||
|
||||
final Rank rank = tempRank;
|
||||
|
||||
if (rank == Rank.ADMIN || rank == Rank.YOUTUBE || rank == Rank.TWITCH || rank == Rank.MODERATOR || rank == Rank.JNR_DEV || rank == Rank.HELPER || rank == Rank.ALL || rank == Rank.MAPDEV || rank == Rank.SNR_MODERATOR || rank == Rank.SUPPORT)
|
||||
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
if (!testServer && rank.has(Rank.ADMIN) && !Plugin.hasRank(caller, Rank.LT))
|
||||
public void run(List<String> matches)
|
||||
{
|
||||
UtilPlayer.message(caller, F.main(Plugin.getName(), ChatColor.RED + "" + ChatColor.BOLD + "Insufficient privileges!"));
|
||||
return;
|
||||
}
|
||||
boolean matchedExact = false;
|
||||
|
||||
Plugin.getRepository().matchPlayerName(new Callback<List<String>>()
|
||||
{
|
||||
public void run(List<String> matches)
|
||||
for (String match : matches)
|
||||
{
|
||||
boolean matchedExact = false;
|
||||
|
||||
for (String match : matches)
|
||||
if (match.equalsIgnoreCase(playerName))
|
||||
{
|
||||
if (match.equalsIgnoreCase(playerName))
|
||||
{
|
||||
matchedExact = true;
|
||||
}
|
||||
matchedExact = true;
|
||||
}
|
||||
|
||||
if (matchedExact)
|
||||
{
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
|
||||
{
|
||||
if (!matchIterator.next().equalsIgnoreCase(playerName))
|
||||
{
|
||||
matchIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilPlayer.isOnline(playerName))
|
||||
{
|
||||
Player p = UtilServer.getServer().getPlayer(playerName);
|
||||
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
|
||||
Plugin.Get(p).resetTemp();
|
||||
|
||||
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
|
||||
Plugin.Get(p).SetRank(rank, false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
|
||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||
{
|
||||
public void run(final String target)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = Plugin.loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getRepository().saveRank(new Callback<Rank>()
|
||||
{
|
||||
public void run(Rank rank)
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
}, target, uuid, rank, true);
|
||||
|
||||
}
|
||||
}, caller, playerName, true);
|
||||
}
|
||||
}, playerName);
|
||||
}
|
||||
|
||||
if (matchedExact)
|
||||
{
|
||||
for (Iterator<String> matchIterator = matches.iterator(); matchIterator.hasNext();)
|
||||
{
|
||||
if (!matchIterator.next().equalsIgnoreCase(playerName))
|
||||
{
|
||||
matchIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (UtilPlayer.isOnline(playerName))
|
||||
{
|
||||
Player p = UtilServer.getServer().getPlayer(playerName);
|
||||
if (Plugin.Get(p).GetRank() != Plugin.Get(p).GetRank(true))
|
||||
Plugin.Get(p).resetTemp();
|
||||
|
||||
OnlineRankUpdateEvent event = new OnlineRankUpdateEvent(caller, Plugin.Get(caller).GetRank(), rank, true);
|
||||
Plugin.Get(p).SetRank(rank, false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
|
||||
UtilPlayer.message(p, F.main(Plugin.getName(), "Your rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
|
||||
UtilPlayer.searchOffline(matches, new Callback<String>()
|
||||
{
|
||||
public void run(final String target)
|
||||
{
|
||||
if (target == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UUID uuid = Plugin.loadUUIDFromDB(playerName);
|
||||
|
||||
if (uuid == null)
|
||||
uuid = UUIDFetcher.getUUIDOf(playerName);
|
||||
|
||||
Plugin.getRepository().saveRank(new Callback<Rank>()
|
||||
{
|
||||
public void run(Rank rank)
|
||||
{
|
||||
caller.sendMessage(F.main(Plugin.getName(), target + "'s rank has been updated to " + rank.Name + "!"));
|
||||
}
|
||||
}, target, uuid, rank, true);
|
||||
|
||||
}
|
||||
}, caller, playerName, true);
|
||||
}
|
||||
}, playerName);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user