WIP: Teams - still testing and debugging, but making progress.

This commit is contained in:
tastybento 2017-08-12 09:08:09 -07:00
parent 25d2702632
commit 4c69587d9a
5 changed files with 266 additions and 237 deletions

View File

@ -552,7 +552,10 @@ sign-acidisland:
line3: "Water is acid!"
line4: "Beware!"
targetInPVPArea: "Target is in a no-PVP area!"
team:
team:
color: "&b"
leader-color: "&a"
leader: " - Leader"
listingMembers: "Listing your island members"
teamchat:
helpChat: "turn on/off team chat"

View File

@ -6,6 +6,9 @@ import org.bukkit.command.CommandSender;
import org.bukkit.command.TabCompleter;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.config.BSBLocale;
import us.tastybento.bskyblock.database.managers.IslandsManager;
import us.tastybento.bskyblock.database.managers.PlayersManager;
import us.tastybento.bskyblock.util.Util;
import java.util.*;
@ -312,8 +315,34 @@ public abstract class AbstractCommand implements CommandExecutor, TabCompleter {
*/
public void setErrorResponse(String errorResponse) {
this.errorResponse = errorResponse;
}
}
}
// These methods below just neaten up the code in the commands so "plugin." isn't always used
/**
* @return PlayersManager
*/
protected PlayersManager getPlayers() {
return plugin.getPlayers();
}
/**
* @return IslandsManager
*/
protected IslandsManager getIslands() {
return plugin.getIslands();
}
/**
* @param sender
* @return Locale for sender
*/
protected BSBLocale getLocale(CommandSender sender) {
return plugin.getLocale(sender);
}
/**
* @param uuid
* @return Locale for UUID
*/
protected BSBLocale getLocale(UUID uuid) {
return plugin.getLocale(uuid);
}
}

View File

@ -487,10 +487,15 @@ public class IslandsManager {
/**
* @param playerUUID
* @return true if player has island
* @return true if player has island and owns it
*/
public boolean hasIsland(UUID playerUUID) {
return islandsByUUID.containsKey(playerUUID);
if (islandsByUUID.containsKey(playerUUID) && islandsByUUID.get(playerUUID).getOwner() != null) {
if (islandsByUUID.get(playerUUID).getOwner().equals(playerUUID)) {
return true;
}
}
return false;
}
/**

View File

@ -8,7 +8,9 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import us.tastybento.bskyblock.BSkyBlock;
@ -327,10 +329,13 @@ public class PlayersManager{
* @param adminCheck - if made via an admin call, this will go out to the 'net and grab - may cause lag
* @return UUID of player or null if unknown
*/
@SuppressWarnings("deprecation")
public UUID getUUID(String string, boolean adminCheck) {
// Look in the database if it ready
// TODO: finish this!
return Bukkit.getOfflinePlayer(string).getUniqueId();
//return database.getUUID(string, adminCheck);
return null;
}
/**