added force join command for ADMIN+

This commit is contained in:
NewGarbo 2015-11-28 19:56:47 +00:00
parent 75ef42d8c9
commit afbccba36f

View File

@ -114,7 +114,9 @@ public class ClansCommand extends CommandBase<ClansManager>
else if (args[0].equalsIgnoreCase("who") || args[0].equalsIgnoreCase("w"))
{
if (args.length > 1)
if (args.length > 2 && args[2].equals("join"))
forceJoinClan(caller, args[1]);
else if (args.length == 2)
infoClan(caller, args[1]);
else
infoClan(caller, null);
@ -863,6 +865,35 @@ public class ClansCommand extends CommandBase<ClansManager>
_manager.getClanShop().openClanWho(caller, clan);
}
public void forceJoinClan(Player caller, String search)
{
if (_manager.getClientManager().hasRank(caller, Rank.ADMIN))
{
UtilPlayer.message(caller, F.main("Clans", "No no no, this command is not for you ;-)"));
return;
}
if (search == null)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a search parameter."));
return;
}
ClansCommandExecutedEvent event = new ClansCommandExecutedEvent(caller, "info", search);
UtilServer.getServer().getPluginManager().callEvent(event);
if (event.isCancelled())
{
return;
}
ClanInfo clan = Plugin.getClanUtility().searchClanPlayer(caller, search, true);
if (clan == null) return;
_manager.getClanUtility().join(caller, clan);
}
public void infoTerritory(Player caller, String[] args)
{
ClanInfo clan;