remove trust command

This commit is contained in:
NewGarbo 2015-11-27 20:27:33 +00:00
parent d5502500b6
commit b36642b22b
2 changed files with 123 additions and 123 deletions

View File

@ -376,33 +376,33 @@ public class ClansDataAccessLayer
* "]."); }
*/
public boolean trust(final ClanInfo ownerClan, final ClanInfo otherClan, String player)
{
if (!ownerClan.getAllyMap().containsKey(otherClan.getName())) return false;
final boolean trust = !ownerClan.getAllyMap().get(otherClan.getName());
// Memory
ownerClan.getAllyMap().put(otherClan.getName(), trust);
// Save
runAsync(new Runnable()
{
@Override
public void run()
{
_repository.updateClanRelationship(ownerClan.getId(), otherClan.getId(), trust);
}
});
// Scoreboard
_scoreboard.refresh(ownerClan);
// Log
_manager.log((trust ? "Gave" : "Revoked") + " Trust [" + trust + "] to [" + otherClan.getName() + "] for [" + ownerClan.getName() + "] by [" + player + "].");
return trust;
}
// public boolean trust(final ClanInfo ownerClan, final ClanInfo otherClan, String player)
// {
// if (!ownerClan.getAllyMap().containsKey(otherClan.getName())) return false;
//
// final boolean trust = !ownerClan.getAllyMap().get(otherClan.getName());
//
// // Memory
// ownerClan.getAllyMap().put(otherClan.getName(), trust);
//
// // Save
// runAsync(new Runnable()
// {
// @Override
// public void run()
// {
// _repository.updateClanRelationship(ownerClan.getId(), otherClan.getId(), trust);
// }
// });
//
// // Scoreboard
// _scoreboard.refresh(ownerClan);
//
// // Log
// _manager.log((trust ? "Gave" : "Revoked") + " Trust [" + trust + "] to [" + otherClan.getName() + "] for [" + ownerClan.getName() + "] by [" + player + "].");
//
// return trust;
// }
public void neutral(final ClanInfo cA, final ClanInfo cB, String player, boolean bothClansManager)
{

View File

@ -82,8 +82,8 @@ public class ClansCommand extends CommandBase<ClansManager>
else if (args[0].equalsIgnoreCase("ally") || args[0].equalsIgnoreCase("a"))
ally(caller, args);
else if (args[0].equalsIgnoreCase("trust"))
trust(caller, args);
// else if (args[0].equalsIgnoreCase("trust"))
// trust(caller, args);
else if (args[0].equalsIgnoreCase("neutral") || args[0].equalsIgnoreCase("neut") || args[0].equalsIgnoreCase("n"))
neutral(caller, args);
@ -547,100 +547,100 @@ public class ClansCommand extends CommandBase<ClansManager>
}
}
public void trust(Player caller, String[] args)
{
ClanInfo cA = Plugin.getClan(Plugin.getClanMemberUuidMap().get(caller.getUniqueId()).getName());
if (cA == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to enemy."));
return;
}
ClanInfo cB = Plugin.getClanUtility().searchClanPlayer(caller, args[1], true);
if (cB == null) return;
if (!cA.isAlly(cB.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You must be allied to trust a clan!"));
return;
}
// Task
if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
{
// Inform
UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " has given trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
cB.inform(F.elem("Clan " + cA.getName()) + " has given trust to you.", null);
}
else
{
// Inform
UtilPlayer.message(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " has revoked trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked trust to you.", null);
}
}
public void neutral(Player caller, String[] args)
{
ClanInfo cA = Plugin.getClanMemberUuidMap().get(caller.getUniqueId());
if (cA == null)
{
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
return;
}
if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
return;
}
if (args.length < 2)
{
UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
return;
}
ClanInfo cB = Plugin.getClanUtility().searchClanPlayer(caller, args[1], true);
if (cB == null) return;
if (cB.isSelf(cA.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
}
else if (cB.isNeutral(cA.getName()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
}
else if (cB.isAlly(cA.getName()))
{
// Task
Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
// Inform
UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
}
}
// public void trust(Player caller, String[] args)
// {
// ClanInfo cA = Plugin.getClan(Plugin.getClanMemberUuidMap().get(caller.getUniqueId()).getName());
//
// if (cA == null)
// {
// UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
// return;
// }
//
// if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
// {
// UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Trust."));
// return;
// }
//
// if (args.length < 2)
// {
// UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to enemy."));
// return;
// }
//
// ClanInfo cB = Plugin.getClanUtility().searchClanPlayer(caller, args[1], true);
//
// if (cB == null) return;
//
// if (!cA.isAlly(cB.getName()))
// {
// UtilPlayer.message(caller, F.main("Clans", "You must be allied to trust a clan!"));
// return;
// }
//
// // Task
// if (Plugin.getClanDataAccess().trust(cA, cB, caller.getName()))
// {
// // Inform
// UtilPlayer.message(caller, F.main("Clans", "You gave trust to " + F.elem("Clan " + cB.getName()) + "."));
// cA.inform(F.name(caller.getName()) + " has given trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
// cB.inform(F.elem("Clan " + cA.getName()) + " has given trust to you.", null);
// }
// else
// {
// // Inform
// UtilPlayer.message(caller, F.main("Clans", "You revoked trust to " + F.elem("Clan " + cB.getName()) + "."));
// cA.inform(F.name(caller.getName()) + " has revoked trust to " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
// cB.inform(F.elem("Clan " + cA.getName()) + " has revoked trust to you.", null);
// }
// }
//
// public void neutral(Player caller, String[] args)
// {
// ClanInfo cA = Plugin.getClanMemberUuidMap().get(caller.getUniqueId());
//
// if (cA == null)
// {
// UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
// return;
// }
//
// if (cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && cA.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
// {
// UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage relationships."));
// return;
// }
//
// if (args.length < 2)
// {
// UtilPlayer.message(caller, F.main("Clans", "You did not input a Clan to set neutrality with."));
// return;
// }
//
// ClanInfo cB = Plugin.getClanUtility().searchClanPlayer(caller, args[1], true);
//
// if (cB == null) return;
//
// if (cB.isSelf(cA.getName()))
// {
// UtilPlayer.message(caller, F.main("Clans", "You prefer to think of yourself positively..."));
// }
// else if (cB.isNeutral(cA.getName()))
// {
// UtilPlayer.message(caller, F.main("Clans", "You are already neutral with " + F.elem("Clan " + cB.getName()) + "."));
// }
// else if (cB.isAlly(cA.getName()))
// {
// // Task
// Plugin.getClanDataAccess().neutral(cA, cB, caller.getName(), true);
//
// // Inform
// UtilPlayer.message(caller, F.main("Clans", "You revoked alliance with " + F.elem("Clan " + cB.getName()) + "."));
// cA.inform(F.name(caller.getName()) + " revoked alliance with " + F.elem("Clan " + cB.getName()) + ".", caller.getName());
// cB.inform(F.elem("Clan " + cA.getName()) + " has revoked alliance with you.", null);
// }
// }
public void claim(Player caller, String args[])
{