Clan name->uuid changes

This commit is contained in:
Shaun Bennett 2015-09-21 20:05:16 -04:00
parent 6a4c9061fa
commit 86420132ce
12 changed files with 362 additions and 191 deletions

View File

@ -1,6 +1,8 @@
package mineplex.core.common.util;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@ -24,6 +26,15 @@ public class UtilAlg
return sortedSet;
}
public static <T> TreeSet<T> sortSet(Collection<T> toSort, Comparator<T> comparator)
{
TreeSet<T> sortedSet = new TreeSet<T>(comparator);
for (T cur : toSort)
sortedSet.add(cur);
return sortedSet;
}
public static Location getMidpoint(Location a, Location b)
{

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Location;
@ -53,7 +54,7 @@ public class ClanInfo
private TntGenerator _generator;
// Loaded from Client
private NautHashMap<String, ClanRole> _memberMap = new NautHashMap<String, ClanRole>();
private NautHashMap<UUID, ClansPlayer> _memberMap = new NautHashMap<UUID, ClansPlayer>();
private NautHashMap<String, Boolean> _allyMap = new NautHashMap<String, Boolean>();
private HashSet<String> _claimSet = new HashSet<String>();
private EnemyData _enemyData;
@ -109,7 +110,8 @@ public class ClanInfo
for (ClanMemberToken memberToken : token.Members)
{
_memberMap.put(memberToken.Name, ClanRole.valueOf(memberToken.ClanRole));
ClanRole role = ClanRole.valueOf(memberToken.ClanRole);
_memberMap.put(memberToken.PlayerUUID, new ClansPlayer(memberToken.Name, memberToken.PlayerUUID, role));
}
for (ClanTerritoryToken territoryToken : token.Territories)
@ -181,9 +183,9 @@ public class ClanInfo
return true;
}
public boolean isMember(String other)
public boolean isMember(Player player)
{
return getMembers().containsKey(other);
return getMembers().containsKey(player.getUniqueId());
}
public boolean isAlly(String other)
@ -220,7 +222,7 @@ public class ClanInfo
return getAllyMap().get(clan);
}
public LinkedList<String> mDetails(String caller)
public LinkedList<String> mDetails(Player caller)
{
LinkedList<String> stringList = new LinkedList<String>();
@ -264,22 +266,22 @@ public class ClanInfo
// Members
String members = "";
for (String cur : UtilAlg.sortKey(getMembers().keySet()))
for (ClansPlayer cur : UtilAlg.sortSet(getMembers().values(), new ClansPlayerComparator()))
{
String name = C.listValueOff + cur;
if (UtilPlayer.isOnline(cur))
name = C.listValueOn + cur;
String name = C.listValueOff + cur.getPlayerName();
if (cur.isOnline())
name = C.listValueOn + cur.getPlayerName();
if (getMembers().get(cur) == ClanRole.LEADER)
if (cur.getRole() == ClanRole.LEADER)
members += C.listValue + "L." + name + C.mBody + ", ";
if (getMembers().get(cur) == ClanRole.ADMIN)
if (cur.getRole() == ClanRole.ADMIN)
members += C.listValue + "A." + name + C.mBody + ", ";
if (getMembers().get(cur) == ClanRole.MEMBER)
if (cur.getRole() == ClanRole.MEMBER)
members += C.listValue + "M." + name + C.mBody + ", ";
if (getMembers().get(cur) == ClanRole.RECRUIT)
if (cur.getRole() == ClanRole.RECRUIT)
members += C.listValue + "R." + name + C.mBody + ", ";
}
stringList.add(F.value("Members", members));
@ -327,16 +329,16 @@ public class ClanInfo
public void inform(String message, String ignore)
{
for (String cur : getMembers().keySet())
for (UUID cur : getMembers().keySet())
{
if (ignore != null && cur.equals(ignore))
continue;
Player player = UtilPlayer.searchOnline(null, cur, false);
Player player = UtilPlayer.searchExact(cur);
if (player == null)
continue;
if (player.getName().equals(ignore))
continue;
UtilPlayer.message(player, F.main("Clans", message));
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
}
@ -357,7 +359,7 @@ public class ClanInfo
_desc = desc;
}
public NautHashMap<String, ClanRole> getMembers()
public NautHashMap<UUID, ClansPlayer> getMembers()
{
return _memberMap;
}
@ -424,8 +426,8 @@ public class ClanInfo
public boolean isOnlineNow()
{
for (String cur : getMembers().keySet())
if (UtilPlayer.isOnline(cur))
for (ClansPlayer cur : getMembers().values())
if (cur.isOnline())
return true;
return false;
@ -433,8 +435,8 @@ public class ClanInfo
public boolean isOnline()
{
for (String cur : getMembers().keySet())
if (UtilPlayer.isOnline(cur))
for (ClansPlayer cur : getMembers().values())
if (cur.isOnline())
return true;
return System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime();
@ -442,8 +444,8 @@ public class ClanInfo
public String getProtected()
{
for (String cur : getMembers().keySet())
if (UtilPlayer.isOnline(cur))
for (ClansPlayer cur : getMembers().values())
if (cur.isOnline())
return C.cRed + "No - Clan Members are Online";
if (System.currentTimeMillis() - _lastOnline.getTime() > Clans.getOnlineTime())
@ -598,7 +600,11 @@ public class ClanInfo
public void playerOnline(Player player)
{
ClansPlayer clansPlayer = _memberMap.get(player.getUniqueId());
_onlinePlayers.add(player.getUniqueId());
clansPlayer.setPlayerName(player.getName());
clansPlayer.setOnline(true);
}
public void playerOnline(String player)
@ -621,6 +627,36 @@ public class ClanInfo
public void playerOffline(Player player)
{
ClansPlayer clansPlayer = _memberMap.get(player.getUniqueId());
if (clansPlayer != null)
{
clansPlayer.setOnline(false);
}
_onlinePlayers.remove(player.getUniqueId());
}
public Set<String> getMemberNameSet()
{
HashSet<String> set = new HashSet<String>();
for (ClansPlayer cp : _memberMap.values())
{
set.add(cp.getPlayerName());
}
return set;
}
public ClansPlayer getClansPlayerFromName(String playerName)
{
for (ClansPlayer cp : _memberMap.values())
{
if (cp.getPlayerName().equals(playerName))
return cp;
}
return null;
}
}

View File

@ -319,12 +319,13 @@ public class ClansAdmin
return;
}
String target = UtilPlayer.searchCollection(caller, args[2], clan.getMembers().keySet(), "Clan Member", true);
String target = UtilPlayer.searchCollection(caller, args[2], clan.getMemberNameSet(), "Clan Member", true);
ClansPlayer clansPlayer = clan.getClansPlayerFromName(target);
if (target == null)
if (target == null || clansPlayer == null)
return;
if (clan.getMembers().get(target) == ClanRole.LEADER)
if (clansPlayer.getRole() == ClanRole.LEADER)
{
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot promote " + F.name(target) + " any further."));
return;
@ -332,19 +333,19 @@ public class ClansAdmin
//Task
String newRank = "?";
if (clan.getMembers().get(target) == ClanRole.RECRUIT)
if (clansPlayer.getRole() == ClanRole.RECRUIT)
{
Clans.getClanDataAccess().role(clan, target, ClanRole.MEMBER);
Clans.getClanDataAccess().role(clan, clansPlayer.getUuid(), ClanRole.MEMBER);
newRank = "Member";
}
else if (clan.getMembers().get(target) == ClanRole.MEMBER)
else if (clansPlayer.getRole() == ClanRole.MEMBER)
{
Clans.getClanDataAccess().role(clan, target, ClanRole.ADMIN);
Clans.getClanDataAccess().role(clan, clansPlayer.getUuid(), ClanRole.ADMIN);
newRank = "Admin";
}
else if (clan.getMembers().get(target) == ClanRole.ADMIN)
else if (clansPlayer.getRole() == ClanRole.ADMIN)
{
Clans.getClanDataAccess().role(clan, target, ClanRole.LEADER);
Clans.getClanDataAccess().role(clan, clansPlayer.getUuid(), ClanRole.LEADER);
newRank = "Leader";
}
@ -366,11 +367,12 @@ public class ClansAdmin
return;
}
String target = UtilPlayer.searchCollection(caller, args[2], clan.getMembers().keySet(), "Clan Member", true);
if (target == null)
String target = UtilPlayer.searchCollection(caller, args[2], clan.getMemberNameSet(), "Clan Member", true);
ClansPlayer clansPlayer = clan.getClansPlayerFromName(target);
if (target == null || clansPlayer == null)
return;
if (clan.getMembers().get(target) == ClanRole.RECRUIT)
if (clansPlayer.getRole() == ClanRole.RECRUIT)
{
UtilPlayer.message(caller, F.main("Clans Admin", "You cannot demote " + F.name(target) + " any further."));
return;
@ -378,19 +380,19 @@ public class ClansAdmin
//Task
String newRank = "?";
if (clan.getMembers().get(target) == ClanRole.MEMBER)
if (clansPlayer.getRole() == ClanRole.MEMBER)
{
Clans.getClanDataAccess().role(clan, target, ClanRole.RECRUIT);
Clans.getClanDataAccess().role(clan, clansPlayer.getUuid(), ClanRole.RECRUIT);
newRank = "Recruit";
}
else if (clan.getMembers().get(target) == ClanRole.ADMIN)
else if (clansPlayer.getRole() == ClanRole.ADMIN)
{
Clans.getClanDataAccess().role(clan, target, ClanRole.MEMBER);
Clans.getClanDataAccess().role(clan, clansPlayer.getUuid(), ClanRole.MEMBER);
newRank = "Member";
}
else if (clan.getMembers().get(target) == ClanRole.LEADER)
else if (clansPlayer.getRole() == ClanRole.LEADER)
{
Clans.getClanDataAccess().role(clan, target, ClanRole.ADMIN);
Clans.getClanDataAccess().role(clan, clansPlayer.getUuid(), ClanRole.ADMIN);
newRank = "Admin";
}
@ -412,12 +414,13 @@ public class ClansAdmin
return;
}
final String targetName = UtilPlayer.searchCollection(caller, args[2], clan.getMembers().keySet(), "Clan Member", true);
final String target = UtilPlayer.searchCollection(caller, args[2], clan.getMemberNameSet(), "Clan Member", true);
ClansPlayer clansPlayer = clan.getClansPlayerFromName(target);
if (targetName == null)
if (target == null || clansPlayer == null)
return;
final Player player = UtilPlayer.searchOnline(null, targetName, false);
final Player player = UtilPlayer.searchExact(clansPlayer.getUuid());
Callback<Boolean> callback = new Callback<Boolean>()
{
@ -429,8 +432,8 @@ public class ClansAdmin
//Inform
if (player != null)
UtilPlayer.message(player, F.main("Clans Admin", caller.getName() + " kicked you from " + F.elem("Clan " + clan.getName()) + "."));
UtilPlayer.message(caller, F.main("Clans Admin", "You kicked " + targetName + " from your Clan."));
clan.inform(F.main("Clans Admin", caller.getName() + " kicked " + targetName + " from your Clan."), caller.getName());
UtilPlayer.message(caller, F.main("Clans Admin", "You kicked " + target + " from your Clan."));
clan.inform(F.main("Clans Admin", caller.getName() + " kicked " + target + " from your Clan."), caller.getName());
}
else
{
@ -440,7 +443,7 @@ public class ClansAdmin
};
if (player != null) Clans.getClanDataAccess().leave(clan, player, callback);
else Clans.getClanDataAccess().leave(clan, targetName, callback);
else Clans.getClanDataAccess().leave(clan, clansPlayer, callback);
}
public void ally(Player caller, String[] args)
@ -600,7 +603,7 @@ public class ClansAdmin
if (ownerClan != null)
{
UtilPlayer.message(caller, F.main("Clans Admin", "This Territory is claimed by " +
Clans.getClanUtility().mRel(Clans.getClanUtility().relPC(caller.getName(), ownerClan), ownerClan.getName(), true) + "."));
Clans.getClanUtility().mRel(Clans.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
return;
}

View File

@ -1,6 +1,7 @@
package mineplex.game.clans.clans;
import java.sql.Timestamp;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@ -14,6 +15,7 @@ import org.bukkit.inventory.ItemStack;
import com.sun.org.apache.xpath.internal.operations.Bool;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilWorld;
import mineplex.game.clans.clans.scoreboard.ClansScoreboardManager;
@ -75,9 +77,9 @@ public class ClansDataAccessLayer
_manager.getClanMap().remove(clan.getName());
for (String cur : clan.getMembers().keySet())
for (ClansPlayer player : clan.getMembers().values())
{
_manager.getClanMemberMap().remove(cur);
_manager.getClanMemberUuidMap().remove(player.getUuid());
}
//Clean from Others
@ -208,15 +210,15 @@ public class ClansDataAccessLayer
private void updateJoinCache(ClanInfo clan, Player player, ClanRole role)
{
String playerName = player.getName();
if (_manager.getClanMemberMap().containsKey(playerName))
if (_manager.getClanMemberUuidMap().containsKey(player.getUniqueId()))
leave(_manager.getClanUtility().getClanByPlayer(player), player, null);
//Update Clan
clan.getMembers().put(playerName, role);
_manager.getClanMemberMap().put(playerName, clan);
clan.getInviteeMap().remove(playerName);
clan.getInviterMap().remove(playerName);
ClansPlayer cp = new ClansPlayer(player.getName(), player.getUniqueId(), role);
clan.getMembers().put(player.getUniqueId(), cp);
_manager.getClanMemberUuidMap().put(player.getUniqueId(), clan);
clan.getInviteeMap().remove(player.getName());
clan.getInviterMap().remove(player.getName());
clan.playerOnline(player);
//Scoreboard
@ -225,11 +227,15 @@ public class ClansDataAccessLayer
public void leave(ClanInfo clan, Player player, Callback<Boolean> callback)
{
leave(clan, player.getName(), callback);
_scoreboard.refresh(player);
ClansPlayer clansPlayer = clan.getMembers().get(player.getUniqueId());
if (clansPlayer != null)
{
leave(clan, clansPlayer, callback);
_scoreboard.refresh(player);
}
}
public void leave(final ClanInfo clan, final String player, final Callback<Boolean> callback)
public void leave(final ClanInfo clan, final ClansPlayer clansPlayer, final Callback<Boolean> callback)
{
if (clan == null)
return;
@ -239,7 +245,7 @@ public class ClansDataAccessLayer
@Override
public void run()
{
final boolean success = _repository.removeMember(clan.getId(), player);
final boolean success = _repository.removeMember(clan.getId(), clansPlayer.getPlayerName());
runSync(new Runnable()
{
@ -249,11 +255,11 @@ public class ClansDataAccessLayer
if (success)
{
//Update Clan
clan.getMembers().remove(player);
_manager.getClanMemberMap().remove(player);
clan.playerOffline(player);
clan.getMembers().remove(clansPlayer.getUuid());
_manager.getClanMemberUuidMap().remove(clansPlayer.getUuid());
clan.playerOffline(clansPlayer.getPlayerName());
//Log
_manager.log("Removed [" + player + "] from [" + clan.getName() + "].");
_manager.log("Removed [" + clansPlayer.getPlayerName() + "] from [" + clan.getName() + "].");
}
if (callback != null) callback.run(success);
@ -263,23 +269,28 @@ public class ClansDataAccessLayer
});
}
public void role(final ClanInfo clan, final String player, final ClanRole role)
public void role(final ClanInfo clan, final UUID uuid, final ClanRole role)
{
//Update Clan
clan.getMembers().put(player, role);
final ClansPlayer clansPlayer = clan.getMembers().get(uuid);
//Save
runAsync(new Runnable()
if (clansPlayer != null)
{
@Override
public void run()
{
_repository.updateMember(clan.getId(), player, role.toString());
}
});
// Update Clan
clansPlayer.setRole(role);
//Log
_manager.log("Removed [" + player + "] from [" + clan.getName() + "].");
//Save
runAsync(new Runnable()
{
@Override
public void run()
{
_repository.updateMember(clan.getId(), clansPlayer.getPlayerName(), role.toString());
}
});
//Log
_manager.log("Removed [" + clansPlayer.getPlayerName() + "] from [" + clan.getName() + "].");
}
}
public void invite(ClanInfo clan, String player, String inviter)

View File

@ -108,7 +108,7 @@ public class ClansDisplay extends MiniPlugin
if (claim != null)
{
//Relation
ClanRelation relation = Clans.getClanUtility().relPT(player.getName(), claim.Chunk);
ClanRelation relation = Clans.getClanUtility().relPT(player, claim.Chunk);
//Name
ownerString = Clans.getClanUtility().mRel(relation, claim.Owner, false);
@ -187,9 +187,9 @@ public class ClansDisplay extends MiniPlugin
//Add Icon
if (i == chunk.getX() && j == chunk.getZ())
output += getMapIcon(Clans.getClanUtility().relPC(player.getName(), curOwner), curClaim, curOwner, curChunk, pCount, true, local);
output += getMapIcon(Clans.getClanUtility().relPC(player, curOwner), curClaim, curOwner, curChunk, pCount, true, local);
else
output += getMapIcon(Clans.getClanUtility().relPC(player.getName(), curOwner), curClaim, curOwner, curChunk, pCount, false, local);
output += getMapIcon(Clans.getClanUtility().relPC(player, curOwner), curClaim, curOwner, curChunk, pCount, false, local);
}
output += ">";

View File

@ -153,7 +153,7 @@ public class ClansGame extends MiniPlugin
if (!Clans.getClanUtility().canHurt(defender, attacker))
{
event.setCancelled(true);
ClanRelation rel = Clans.getRelation(defender.getName(), attacker.getName());
ClanRelation rel = Clans.getRelation(defender, attacker);
UtilPlayer.message(attacker, F.main("Clans", "You cannot harm " + Clans.getClanUtility().mRel(rel, defender.getName(), false) + "."));
}
}
@ -235,7 +235,7 @@ public class ClansGame extends MiniPlugin
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break " +
F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) +
" in " +
Clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer().getName()) +
Clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer()) +
"."));
}
@ -265,7 +265,7 @@ public class ClansGame extends MiniPlugin
UtilPlayer.message(event.getPlayer(), F.main("Clans", "You can not break " +
F.elem(ItemStackFactory.Instance.GetName(event.getBlock(), true)) +
" in " +
Clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer().getName()) +
Clans.getClanUtility().getOwnerStringRel(event.getBlock().getLocation(), event.getPlayer()) +
"." +
mimic));
}
@ -290,7 +290,7 @@ public class ClansGame extends MiniPlugin
//Inform
if (damager != null)
{
ClanRelation rel = Clans.getRelation(damagee.getName(), damager.getName());
ClanRelation rel = Clans.getRelation(damagee, damager);
UtilPlayer.message(damager, F.main("Clans",
"You cannot harm " + Clans.getClanUtility().mRel(rel, damagee.getName(), false) + "."));
}
@ -382,7 +382,7 @@ public class ClansGame extends MiniPlugin
Location sideLoc = new Location(loc.getWorld(), loc.getX()+x, loc.getY(), loc.getZ()+z);
if (Clans.getClanUtility().isSelf(player.getName(), sideLoc))
if (Clans.getClanUtility().isSelf(player, sideLoc))
self = true;
if (enemy != null)
@ -391,7 +391,7 @@ public class ClansGame extends MiniPlugin
if (Clans.getClanUtility().getAccess(player, sideLoc) != ClanRelation.SELF)
enemy = Clans.getClanUtility().getOwnerStringRel(
new Location(loc.getWorld(), loc.getX()+x, loc.getY(), loc.getZ()+z),
player.getName());
player);
}
if (enemy != null && !self)
@ -442,7 +442,7 @@ public class ClansGame extends MiniPlugin
F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) +
" in " +
Clans.getClanUtility().getOwnerStringRel(event.getClickedBlock().getLocation(),
player.getName()) +
player) +
"." +
mimic));
@ -459,7 +459,7 @@ public class ClansGame extends MiniPlugin
F.elem(ItemStackFactory.Instance.GetName(event.getClickedBlock(), true)) +
" in " +
Clans.getClanUtility().getOwnerStringRel(event.getClickedBlock().getLocation(),
player.getName()) +
player) +
"." +
mimic));
@ -480,7 +480,7 @@ public class ClansGame extends MiniPlugin
F.elem(ItemStackFactory.Instance.GetName(player.getItemInHand(), true)) +
" in " +
Clans.getClanUtility().getOwnerStringRel(event.getClickedBlock().getRelative(event.getBlockFace()).getLocation(),
player.getName()) +
player) +
"." +
mimic));

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.clans;
import java.util.HashSet;
import java.util.TimeZone;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -154,7 +155,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
//Clans
private NautHashMap<String, ClanInfo> _clanMap = new NautHashMap<String, ClanInfo>();
private NautHashMap<String, ClanInfo> _clanMemberMap = new NautHashMap<String, ClanInfo>();
// private NautHashMap<String, ClanInfo> _clanMemberNameMap = new NautHashMap<String, ClanInfo>();
private NautHashMap<UUID, ClanInfo> _clanMemberUuidMap = new NautHashMap<UUID, ClanInfo>();
private NautHashMap<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
@ -273,7 +275,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_clanMap.put(clanToken.Name, clan);
for (ClanMemberToken memberToken : clanToken.Members)
_clanMemberMap.put(memberToken.Name, clan);
{
_clanMemberUuidMap.put(memberToken.PlayerUUID, clan);
// _clanMemberMap.put(memberToken.Name, clan);
}
for (ClanTerritoryToken territoryToken : clanToken.Territories)
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
@ -314,9 +319,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return _clanMap;
}
public NautHashMap<String, ClanInfo> getClanMemberMap()
public NautHashMap<UUID, ClanInfo> getClanMemberUuidMap()
{
return _clanMemberMap;
return _clanMemberUuidMap;
}
public static boolean isClaimable(Location location)
@ -341,7 +346,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public ClanInfo getClan(Player player)
{
return _clanMemberMap.get(player.getName());
return _clanMemberUuidMap.get(player.getUniqueId());
}
public ClanInfo getEnemy(ClanInfo clanInfo)
@ -357,7 +362,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public boolean isInClan(Player player)
{
return _clanMemberMap.containsKey(player.getName());
return _clanMemberUuidMap.containsKey(player.getUniqueId());
}
public ClanInfo getClan(String clan)
@ -431,7 +436,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public void join(PlayerJoinEvent event)
{
Player player = event.getPlayer();
ClanInfo clanInfo = getClanMemberMap().get(player.getName());
ClanInfo clanInfo = _clanMemberUuidMap.get(player.getUniqueId());
if (clanInfo != null)
{
clanInfo.playerOnline(player);
@ -457,7 +462,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public void quit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
ClanInfo clanInfo = getClanMemberMap().get(player.getName());
ClanInfo clanInfo = getClanMemberUuidMap().get(player.getUniqueId());
if (clanInfo != null)
{
clanInfo.playerOffline(player);
@ -482,9 +487,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
event.setFormat(C.cAqua + "%1$s " + C.cDAqua + "%2$s");
event.getRecipients().clear();
for (String cur : clan.getMembers().keySet())
for (ClansPlayer cur : clan.getMembers().values())
{
Player player = UtilPlayer.searchOnline(null, cur, false);
Player player = UtilPlayer.searchExact(cur.getUuid());
if (player == null)
continue;
@ -497,9 +502,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
event.setFormat(C.cDGreen + clan.getName() + " " + C.cDGreen + "%1$s " + C.cGreen + "%2$s");
event.getRecipients().clear();
for (String cur : clan.getMembers().keySet())
for (ClansPlayer cur : clan.getMembers().values())
{
Player player = UtilPlayer.searchOnline(null, cur, false);
Player player = UtilPlayer.searchExact(cur.getUuid());
if (player == null)
continue;
@ -512,9 +517,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
if (ally == null) continue;
for (String playerName : ally.getMembers().keySet())
for (ClansPlayer cur : ally.getMembers().values())
{
Player player = UtilPlayer.searchOnline(null, playerName, false);
Player player = UtilPlayer.searchExact(cur.getUuid());
if (player == null)
continue;
@ -616,11 +621,22 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return _clanUtility.isSafe(a);
}
public ClanRelation getRelation(String playerA, String playerB)
// public ClanRelation getRelation(String playerA, String playerB)
// {
// return getClanUtility().rel(_clanMemberMap.get(playerA), _clanMemberMap.get(playerB));
// }
public ClanRelation getRelation(Player playerA, Player playerB)
{
return getClanUtility().rel(_clanMemberMap.get(playerA), _clanMemberMap.get(playerB));
return getRelation(playerA.getUniqueId(), playerB.getUniqueId());
}
public ClanRelation getRelation(UUID playerA, UUID playerB)
{
return getClanUtility().rel(getClanMemberUuidMap().get(playerA), getClanMemberUuidMap().get(playerB));
}
public long getOnlineTime()
{
return _onlineTime;

View File

@ -0,0 +1,54 @@
package mineplex.game.clans.clans;
import java.util.UUID;
public class ClansPlayer
{
private String _playerName;
private UUID _uuid;
private ClanRole _role;
private boolean _online;
public ClansPlayer(String playerName, UUID uuid, ClanRole role)
{
_playerName = playerName;
_uuid = uuid;
_role = role;
_online = false;
}
public String getPlayerName()
{
return _playerName;
}
public UUID getUuid()
{
return _uuid;
}
public ClanRole getRole()
{
return _role;
}
public void setRole(ClanRole role)
{
_role = role;
}
public void setPlayerName(String playerName)
{
_playerName = playerName;
}
public boolean isOnline()
{
return _online;
}
public void setOnline(boolean online)
{
_online = online;
}
}

View File

@ -0,0 +1,20 @@
package mineplex.game.clans.clans;
import java.util.Comparator;
public class ClansPlayerComparator implements Comparator<ClansPlayer>
{
@Override
public int compare(ClansPlayer o1, ClansPlayer o2)
{
if (o1 == null || o2 == null)
return 0;
if (o1.getRole() != o2.getRole())
{
return o2.getRole().ordinal() - o1.getRole().ordinal();
}
return o1.getPlayerName().compareTo(o2.getPlayerName());
}
}

View File

@ -5,6 +5,7 @@ import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -128,13 +129,17 @@ public class ClansUtility
//PLAYER
LinkedList<ClanInfo> playerMatchList = new LinkedList<ClanInfo>();
for (Entry<String, ClanInfo> clanMemberEntry : Clans.getClanMemberMap().entrySet())
for (ClanInfo clanInfo : Clans.getClanMap().values())
{
if (clanMemberEntry.getKey().equalsIgnoreCase(name))
return clanMemberEntry.getValue();
for (ClansPlayer player : clanInfo.getMembers().values())
{
if (player.getPlayerName().equalsIgnoreCase(name))
return clanInfo;
if (clanMemberEntry.getKey().toLowerCase().contains(name.toLowerCase()))
playerMatchList.add(clanMemberEntry.getValue());
if (player.getPlayerName().toLowerCase().contains(name.toLowerCase()))
playerMatchList.add(clanInfo);
}
}
if (playerMatchList.size() == 1)
@ -214,22 +219,28 @@ public class ClansUtility
public ClanInfo getClanByPlayer(Player player)
{
return getClanByPlayer(player.getName());
return getClanByUUID(player.getUniqueId());
}
public ClanInfo getClanByPlayer(String name)
public ClanInfo getClanByUUID(UUID uuid)
{
if (!Clans.getClanMemberMap().containsKey(name))
return null;
return Clans.getClanMemberMap().get(name);
return Clans.getClanMemberUuidMap().get(uuid);
}
// @Deprecated
// public ClanInfo getClanByPlayer(String name)
// {
// if (!Clans.getClanMemberMap().containsKey(name))
// return null;
//
// return Clans.getClanMemberMap().get(name);
// }
public ClanRole getRole(Player player)
{
try
{
return getClanByPlayer(player).getMembers().get(player.getName());
return getClanByPlayer(player).getMembers().get(player.getUniqueId()).getRole();
}
catch (Exception e)
{
@ -315,7 +326,7 @@ public class ClansUtility
return owner.getName();
}
public String getOwnerStringRel(Location loc, String player)
public String getOwnerStringRel(Location loc, Player player)
{
ClanRelation rel = relPT(player, UtilWorld.chunkToStr(loc.getChunk()));
return mRel(rel, getOwnerString(loc), true);
@ -328,26 +339,28 @@ public class ClansUtility
return Clans.getClaimMap().containsKey(chunk);
}
public boolean isAlliance(String player, Location loc)
// public boolean isAlliance(String player, Location loc)
// {
// if (!Clans.getClanMemberMap().containsKey(player))
// return false;
//
// if (!isClaimed(loc))
// return false;
//
// return getOwner(getClaim(loc)).isAlly(Clans.getClanMemberMap().get(player).getName());
// }
public boolean isSelf(Player player, Location loc)
{
if (!Clans.getClanMemberMap().containsKey(player))
ClanInfo clan = Clans.getClan(player);
if (clan == null)
return false;
if (!isClaimed(loc))
return false;
return getOwner(getClaim(loc)).isAlly(Clans.getClanMemberMap().get(player).getName());
}
public boolean isSelf(String player, Location loc)
{
if (!Clans.getClanMemberMap().containsKey(player))
return false;
if (!isClaimed(loc))
return false;
return getOwner(getClaim(loc)).isSelf(Clans.getClanMemberMap().get(player).getName());
return getOwner(getClaim(loc)).isSelf(clan.getName());
}
public boolean isAdmin(Location loc)
@ -397,7 +410,7 @@ public class ClansUtility
}
//Player Player
public ClanRelation relPP(String pA, String pB)
public ClanRelation relPP(Player pA, Player pB)
{
return rel(getClanByPlayer(pA), getClanByPlayer(pB));
}
@ -415,19 +428,19 @@ public class ClansUtility
}
//Player Clan
public ClanRelation relPC(String pA, String cB)
public ClanRelation relPC(Player pA, String cB)
{
return rel(getClanByPlayer(pA), searchClan(null, cB, false));
}
//Player Clan (Object)
public ClanRelation relPC(String pA, ClanInfo cB)
public ClanRelation relPC(Player pA, ClanInfo cB)
{
return rel(getClanByPlayer(pA), cB);
}
//Player Territory
public ClanRelation relPT(String pA, String tB)
public ClanRelation relPT(Player pA, String tB)
{
ClanTerritory claim = getClaim(tB);
if (claim != null && claim.Safe)
@ -489,7 +502,7 @@ public class ClansUtility
return relColor(relation, dark) + message + C.mChat;
}
public boolean playerSelf(String pA, String pB)
public boolean playerSelf(Player pA, Player pB)
{
ClanInfo cA = getClanByPlayer(pA);
ClanInfo cB = getClanByPlayer(pB);
@ -500,7 +513,7 @@ public class ClansUtility
return cA.isSelf(cB.getName());
}
public boolean playerAlly(String pA, String pB)
public boolean playerAlly(Player pA, Player pB)
{
ClanInfo cA = getClanByPlayer(pA);
ClanInfo cB = getClanByPlayer(pB);
@ -511,7 +524,7 @@ public class ClansUtility
return cA.isAlly(cB.getName());
}
public boolean playerEnemy(String pA, String pB)
public boolean playerEnemy(Player pA, Player pB)
{
ClanInfo cA = getClanByPlayer(pA);
ClanInfo cB = getClanByPlayer(pB);
@ -527,7 +540,7 @@ public class ClansUtility
if (damagee == null || damager == null)
return false;
ClanRelation rel = relPP(damagee.getName(), damager.getName());
ClanRelation rel = relPP(damagee, damager);
if (rel == ClanRelation.ALLY || rel == ClanRelation.ALLY_TRUST || rel == ClanRelation.SELF)
return false;

View File

@ -22,6 +22,7 @@ import mineplex.game.clans.clans.ClanInfo;
import mineplex.game.clans.clans.ClanRole;
import mineplex.game.clans.clans.ClansBlacklist;
import mineplex.game.clans.clans.ClansManager;
import mineplex.game.clans.clans.ClansPlayer;
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
import mineplex.game.clans.clans.ClientClan;
import mineplex.game.clans.core.repository.tokens.ClanToken;
@ -42,8 +43,8 @@ public class ClansCommand extends CommandBase<ClansManager>
{
if (args == null || args.length == 0)
{
if (Plugin.getClanMemberMap().containsKey(caller.getName()))
infoClan(caller, Plugin.getClanMemberMap().get(caller.getName()).getName());
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
infoClan(caller, Plugin.getClanMemberUuidMap().get(caller.getUniqueId()).getName());
else
UtilPlayer.message(caller, F.main("Clans", "You are not in a Clan."));
@ -228,7 +229,7 @@ public class ClansCommand extends CommandBase<ClansManager>
ClientClan client = Plugin.Get(caller);
if (Plugin.getClanMemberMap().containsKey(caller.getName()))
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
return;
@ -366,8 +367,8 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()) != ClanRole.LEADER &&
clan.getMembers().get(caller.getName()) != ClanRole.ADMIN)
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER &&
clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can send invites."));
return;
@ -401,7 +402,7 @@ public class ClansCommand extends CommandBase<ClansManager>
public void join(final Player caller, String[] args)
{
if (Plugin.getClanMemberMap().containsKey(caller.getName()))
if (Plugin.getClanMemberUuidMap().containsKey(caller.getUniqueId()))
{
UtilPlayer.message(caller, F.main("Clans", "You are already in a Clan."));
return;
@ -469,7 +470,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()) == ClanRole.LEADER && clan.getMembers().size() > 1)
if (clan.getMembers().get(caller.getUniqueId()).getRole() == ClanRole.LEADER && clan.getMembers().size() > 1)
{
UtilPlayer.message(caller, F.main("Clans", "You must pass on " + F.elem("Leadership") + " before leaving."));
return;
@ -512,20 +513,22 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
final String target = UtilPlayer.searchCollection(caller, args[1], clan.getMembers().keySet(), "Clan Member", true);
final String target = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
ClansPlayer clansPlayer = clan.getClansPlayerFromName(target);
if (target == null)
if (target == null || clansPlayer == null)
return;
if (clan.getMembers().get(caller.getName()) != ClanRole.LEADER &&
clan.getMembers().get(caller.getName()) != ClanRole.ADMIN)
if (self.getRole() != ClanRole.LEADER &&
self.getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can kick members."));
return;
}
if ((clan.getMembers().get(target) == ClanRole.LEADER && clan.getMembers().get(caller.getName()) == ClanRole.ADMIN) ||
(clan.getMembers().get(target) == ClanRole.ADMIN && clan.getMembers().get(caller.getName()) == ClanRole.ADMIN))
if ((clansPlayer.getRole() == ClanRole.LEADER && self.getRole() == ClanRole.ADMIN) ||
(clansPlayer.getRole() == ClanRole.ADMIN && self.getRole() == ClanRole.ADMIN))
{
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(target) + "."));
return;
@ -548,7 +551,7 @@ public class ClansCommand extends CommandBase<ClansManager>
//Task
if (player != null) Plugin.getClanDataAccess().leave(clan, player, callback);
else Plugin.getClanDataAccess().leave(clan, target, callback);
else Plugin.getClanDataAccess().leave(clan, clansPlayer, callback);
}
public void promote(Player caller, String[] args)
@ -567,7 +570,9 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
String target = UtilPlayer.searchCollection(caller, args[1], clan.getMembers().keySet(), "Clan Member", true);
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
ClansPlayer target = clan.getClansPlayerFromName(targetName);
if (target == null)
return;
@ -578,35 +583,35 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()).ordinal() <= clan.getMembers().get(target).ordinal())
if (self.getRole().ordinal() <= target.getRole().ordinal())
{
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(target) + "."));
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(targetName) + "."));
return;
}
//Task
String newRank = "?";
if (clan.getMembers().get(target) == ClanRole.RECRUIT)
if (target.getRole() == ClanRole.RECRUIT)
{
Plugin.getClanDataAccess().role(clan, target, ClanRole.MEMBER);
Plugin.getClanDataAccess().role(clan, target.getUuid(), ClanRole.MEMBER);
newRank = "Member";
}
else if (clan.getMembers().get(target) == ClanRole.MEMBER)
else if (target.getRole() == ClanRole.MEMBER)
{
Plugin.getClanDataAccess().role(clan, target, ClanRole.ADMIN);
Plugin.getClanDataAccess().role(clan, target.getUuid(), ClanRole.ADMIN);
newRank = "Admin";
}
else if (clan.getMembers().get(target) == ClanRole.ADMIN)
else if (target.getRole() == ClanRole.ADMIN)
{
Plugin.getClanDataAccess().role(clan, target, ClanRole.LEADER);
Plugin.getClanDataAccess().role(clan, target.getUuid(), ClanRole.LEADER);
newRank = "Leader";
//Give Leader
Plugin.getClanDataAccess().role(clan, caller.getName(), ClanRole.ADMIN);
Plugin.getClanDataAccess().role(clan, caller.getUniqueId(), ClanRole.ADMIN);
}
//Inform
clan.inform(F.name(caller.getName()) + " promoted " + F.name(target) + " to " + F.elem(newRank) + ".", null);
clan.inform(F.name(caller.getName()) + " promoted " + F.name(targetName) + " to " + F.elem(newRank) + ".", null);
}
public void demote(Player caller, String[] args)
@ -625,7 +630,9 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
String target = UtilPlayer.searchCollection(caller, args[1], clan.getMembers().keySet(), "Clan Member", true);
final String targetName = UtilPlayer.searchCollection(caller, args[1], clan.getMemberNameSet(), "Clan Member", true);
ClansPlayer self = clan.getMembers().get(caller.getUniqueId());
ClansPlayer target = clan.getClansPlayerFromName(targetName);
if (target == null)
return;
@ -636,33 +643,33 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()).ordinal() <= clan.getMembers().get(target).ordinal())
if (self.getRole().ordinal() <= target.getRole().ordinal())
{
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(target) + "."));
UtilPlayer.message(caller, F.main("Clans", "You do not outrank " + F.name(targetName) + "."));
return;
}
if (clan.getMembers().get(target) == ClanRole.RECRUIT)
if (target.getRole() == ClanRole.RECRUIT)
{
UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(target) + " any further."));
UtilPlayer.message(caller, F.main("Clans", "You cannot demote " + F.name(targetName) + " any further."));
return;
}
//Task
String newRank = "?";
if (clan.getMembers().get(target) == ClanRole.MEMBER)
if (target.getRole() == ClanRole.MEMBER)
{
Plugin.getClanDataAccess().role(clan, target, ClanRole.RECRUIT);
Plugin.getClanDataAccess().role(clan, target.getUuid(), ClanRole.RECRUIT);
newRank = "Recruit";
}
else if (clan.getMembers().get(target) == ClanRole.ADMIN)
else if (target.getRole() == ClanRole.ADMIN)
{
Plugin.getClanDataAccess().role(clan, target, ClanRole.MEMBER);
Plugin.getClanDataAccess().role(clan, target.getUuid(), ClanRole.MEMBER);
newRank = "Member";
}
//Inform
clan.inform(F.main("Clans", F.name(caller.getName()) + " demoted " + F.name(target) + " to " + F.elem(newRank) + "."), null);
clan.inform(F.main("Clans", F.name(caller.getName()) + " demoted " + F.name(targetName) + " to " + F.elem(newRank) + "."), null);
}
public void ally(Player caller, String[] args)
@ -675,7 +682,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (cA.getMembers().get(caller.getName()) != ClanRole.LEADER && cA.getMembers().get(caller.getName()) != ClanRole.ADMIN)
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 Alliances."));
return;
@ -746,7 +753,7 @@ public class ClansCommand extends CommandBase<ClansManager>
public void trust(Player caller, String[] args)
{
ClanInfo cA = Plugin.getClan(Plugin.getClanMemberMap().get(caller.getName()).getName());
ClanInfo cA = Plugin.getClan(Plugin.getClanMemberUuidMap().get(caller.getUniqueId()).getName());
if (cA == null)
{
@ -754,7 +761,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (cA.getMembers().get(caller.getName()) != ClanRole.LEADER && cA.getMembers().get(caller.getName()) != ClanRole.ADMIN)
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;
@ -796,7 +803,7 @@ public class ClansCommand extends CommandBase<ClansManager>
public void neutral(Player caller, String[] args)
{
ClanInfo cA = Plugin.getClan(Plugin.getClanMemberMap().get(caller.getName()).getName());
ClanInfo cA = Plugin.getClanMemberUuidMap().get(caller.getUniqueId());
if (cA == null)
{
@ -804,7 +811,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (cA.getMembers().get(caller.getName()) != ClanRole.LEADER && cA.getMembers().get(caller.getName()) != ClanRole.ADMIN)
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;
@ -855,7 +862,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()) != ClanRole.LEADER && clan.getMembers().get(caller.getName()) != ClanRole.ADMIN)
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can claim Territory."));
return;
@ -885,7 +892,7 @@ public class ClansCommand extends CommandBase<ClansManager>
else
{
UtilPlayer.message(caller, F.main("Clans", "This Territory is owned by " +
Plugin.getClanUtility().mRel(Plugin.getClanUtility().relPC(caller.getName(), ownerClan), ownerClan.getName(), true) + "."));
Plugin.getClanUtility().mRel(Plugin.getClanUtility().relPC(caller, ownerClan), ownerClan.getName(), true) + "."));
return;
}
@ -967,7 +974,7 @@ public class ClansCommand extends CommandBase<ClansManager>
//Enemies in Land
for (Player cur : UtilServer.getPlayers())
if (UtilMath.offset(cur, caller) < 16)
if (Plugin.getClanUtility().playerEnemy(caller.getName(), cur.getName()))
if (Plugin.getClanUtility().playerEnemy(caller, cur))
{
UtilPlayer.message(caller, F.main("Clans", "You cannot claim while enemies are nearby."));
return;
@ -1036,7 +1043,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
//Role
if (clan.getMembers().get(caller.getName()) != ClanRole.LEADER && clan.getMembers().get(caller.getName()) != ClanRole.ADMIN)
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can unclaim Territory."));
return;
@ -1089,7 +1096,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()) != ClanRole.LEADER)
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader can unclaim all Territory."));
return;
@ -1188,7 +1195,7 @@ public class ClansCommand extends CommandBase<ClansManager>
return;
}
if (clan.getMembers().get(caller.getName()) != ClanRole.LEADER && clan.getMembers().get(caller.getName()) != ClanRole.ADMIN)
if (clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.LEADER && clan.getMembers().get(caller.getUniqueId()).getRole() != ClanRole.ADMIN)
{
UtilPlayer.message(caller, F.main("Clans", "Only the Clan Leader and Admins can manage Clan Home."));
return;
@ -1227,7 +1234,7 @@ public class ClansCommand extends CommandBase<ClansManager>
if (clan == null)
return;
UtilPlayer.message(caller, clan.mDetails(caller.getName()));
UtilPlayer.message(caller, clan.mDetails(caller));
}
public void infoTerritory(Player caller, String[] args)

View File

@ -34,7 +34,7 @@ public class ScoreboardElementPlayer implements ScoreboardElement
if (claim != null)
{
//Relation
ClansUtility.ClanRelation relation = _clansManager.getClanUtility().relPT(player.getName(), claim.Chunk);
ClansUtility.ClanRelation relation = _clansManager.getClanUtility().relPT(player, claim.Chunk);
//Name
regionString = _clansManager.getClanUtility().mRel(relation, claim.Owner, false);