WIP: Island class - saving to flat file.

This works but not all the data types in the class are serialized
correctly yet. To enable true generic type saving will take more work.
This commit is contained in:
tastybento 2017-05-21 21:37:10 -07:00
parent 960993108d
commit aa170f8563
7 changed files with 516 additions and 363 deletions

View File

@ -82,7 +82,7 @@ public class BSkyBlock extends JavaPlugin{
// Save data
playersManager.shutdown();
islandsManager.shutdown();
offlineHistoryMessages.shutdown();
//offlineHistoryMessages.shutdown();
plugin = null;
}

View File

@ -1012,7 +1012,7 @@ public class IslandCommand extends BSBCommand{
Player player = (Player) sender;
Island island = plugin.getIslands().getIsland(player.getUniqueId());
if(!island.isLocked()){
if(!island.getLocked()){
// TODO: Expel all visitors
// TODO: send offline messages
island.setLocked(false);

View File

@ -21,12 +21,11 @@ public class OfflineHistoryMessages {
private BSBDatabase database;
// Offline Messages
private HashMap<UUID, List<String>> messages;
private HashMap<UUID, List<String>> messages = new HashMap<UUID, List<String>>();
public OfflineHistoryMessages(BSkyBlock plugin){
this.plugin = plugin;
database = BSBDatabase.getDatabase();
messages = new HashMap<UUID, List<String>>();
}
public void load(){

View File

@ -3,6 +3,7 @@ package us.tastybento.bskyblock.database;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
@ -12,6 +13,7 @@ import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.database.flatfile.FlatFileDatabaseConnecter;
import us.tastybento.bskyblock.database.flatfile.FlatFileDatabaseInserter;
import us.tastybento.bskyblock.database.flatfile.FlatFileDatabaseSelecter;
import us.tastybento.bskyblock.database.objects.Island;
public class RunTest {
@ -24,9 +26,14 @@ public class RunTest {
new DatabaseConnectionSettingsImpl(
"127.0.0.1", 3306, "exampleDatabase","user", "pass"));
*/
Test test = new Test();
test.setId(34);
Island test = new Island();
test.setName("testname");
test.setOwner(UUID.randomUUID());
test.addMember(UUID.randomUUID());
test.addToBanList(UUID.randomUUID());
test.setCenter(new Location(plugin.getServer().getWorld("world"), 1, 2, 3, 1, 1));
test.setLocked(true);
/*
HashMap<Integer, Location> homes = new HashMap<Integer, Location>();
homes.put(1, new Location(plugin.getServer().getWorld("world"), 1, 2, 3, 1, 1));
homes.put(2, new Location(plugin.getServer().getWorld("world"), 3, 3, 3, 3, 3));
@ -35,22 +42,25 @@ public class RunTest {
items.add(new ItemStack(Material.ACTIVATOR_RAIL, 2));
items.add(new ItemStack(Material.FEATHER,5));
test.setInventory(items);
FlatFileDatabaseInserter<Test> inserter = new FlatFileDatabaseInserter<Test>(plugin, Test.class, connecter);
*/
FlatFileDatabaseInserter<Island> inserter = new FlatFileDatabaseInserter<Island>(plugin, Island.class, connecter);
inserter.insertObject(test);
plugin.getLogger().info("DEBUG: ALL WRITTEN! Now reading...");
FlatFileDatabaseSelecter<Test> selecter = new FlatFileDatabaseSelecter<Test>(plugin, Test.class, connecter);
FlatFileDatabaseSelecter<Island> selecter = new FlatFileDatabaseSelecter<Island>(plugin, Island.class, connecter);
test = selecter.selectObject();
plugin.getLogger().info("DEBUG: name = " + test.getName());
plugin.getLogger().info("DEBUG: id = " + test.getId());
plugin.getLogger().info("DEBUG: owner = " + test.getOwner());
/*
homes = test.getHomeLocations();
plugin.getLogger().info("DEBUG: homes = " + homes);
items = test.getInventory();
plugin.getLogger().info("DEBUG: items = " + items);
*/
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -5,11 +5,15 @@ import java.beans.PropertyDescriptor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.configuration.file.YamlConfiguration;
@ -56,9 +60,29 @@ public class FlatFileDatabaseInserter<T> extends AbstractDatabaseHandler<T> {
Method method = propertyDescriptor.getReadMethod();
Object value = method.invoke(instance);
plugin.getLogger().info("DEBUG: writing " + field.getName());
plugin.getLogger().info("DEBUG: property desc = " + propertyDescriptor.getPropertyType().getTypeName());
// TODO: depending on the type, it'll need serializing
config.set(field.getName(), value);
if (propertyDescriptor.getPropertyType().equals(UUID.class)) {
plugin.getLogger().info("DEBUG: writing UUID for " + field.getName());
if (value != null) {
config.set(field.getName(), ((UUID)value).toString());
} else {
config.set(field.getName(), "null");
}
} else if (propertyDescriptor.getPropertyType().equals(Set.class)) {
plugin.getLogger().info("DEBUG: Hashset for " + field.getName());
List<Object> list = new ArrayList<Object>();
for (Object object : (Set<Object>)value) {
if (object instanceof UUID) {
list.add(((UUID)object).toString());
}
}
config.set(field.getName(), list);
} else {
config.set(field.getName(), value);
}
}

View File

@ -6,6 +6,10 @@ import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.configuration.file.YamlConfiguration;
@ -81,15 +85,31 @@ public class FlatFileDatabaseSelecter<T> extends AbstractDatabaseHandler<T> {
field.getName(), type);
Method method = propertyDescriptor.getWriteMethod();
plugin.getLogger().info("DEBUG: " + propertyDescriptor.getPropertyType().getTypeName());
plugin.getLogger().info("DEBUG: " + field.getName() + ": " + propertyDescriptor.getPropertyType().getTypeName());
if (propertyDescriptor.getPropertyType().equals(HashMap.class)) {
plugin.getLogger().info("DEBUG: is HashMap");
// TODO: this may not work with all keys. Further serialization may be required.
// TODO: this may not work with all keys. Further serialization may be required.
HashMap<Object,Object> value = new HashMap<Object, Object>();
for (String key : config.getConfigurationSection(field.getName()).getKeys(false)) {
value.put(key, config.get(field.getName() + "." + key));
}
method.invoke(instance, value);
} else if (propertyDescriptor.getPropertyType().equals(Set.class)) {
plugin.getLogger().info("DEBUG: is Set " + propertyDescriptor.getReadMethod().getGenericReturnType().getTypeName());
// TODO: this may not work with all keys. Further serialization may be required.
Set<Object> value = new HashSet((List<Object>) config.getList(field.getName()));
method.invoke(instance, value);
} else if (propertyDescriptor.getPropertyType().equals(UUID.class)) {
plugin.getLogger().info("DEBUG: is UUID");
String uuid = (String)config.get(field.getName());
if (uuid.equals("null")) {
method.invoke(instance, (Object)null);
} else {
Object value = UUID.fromString(uuid);
method.invoke(instance, value);
}
} else {
Object value = config.get(field.getName());
method.invoke(instance, value);

View File

@ -5,10 +5,10 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import us.tastybento.bskyblock.BSkyBlock;
import us.tastybento.bskyblock.api.events.island.IslandLockEvent;
import us.tastybento.bskyblock.api.events.island.IslandUnlockEvent;
import us.tastybento.bskyblock.config.Settings;
@ -22,273 +22,6 @@ import us.tastybento.bskyblock.config.Settings;
* @author Poslovitch
*/
public class Island {
private BSkyBlock plugin;
//// Island ////
// The center of the island itself
private Location center;
// Island range
private int range;
// Coordinates of the island area
private int minX;
private int minZ;
// Coordinates of minimum protected area
private int minProtectedX;
private int minProtectedZ;
// Protection size
private int protectionRange;
// World the island is in
private World world;
// Display name
private String name;
// Time parameters
private long createdDate;
private long updatedDate;
//// Team ////
// Owner (Team Leader)
private UUID owner;
// Members (use set because each value must be unique)
private Set<UUID> members;
// Trustees
private Set<UUID> trustees;
// Coops
private Set<UUID> coops;
// Banned players
private Set<UUID> banned;
//// State ////
private boolean locked = false;
private boolean isSpawn = false;
private boolean purgeProtected = false;
//// Protection ////
private HashMap<SettingsFlag, Boolean> flags = new HashMap<SettingsFlag, Boolean>();
public Island(Location location, UUID owner, int protectionRange) {
this.members = new HashSet<UUID>();
this.members.add(owner);
this.owner = owner;
this.coops = new HashSet<UUID>();
this.trustees = new HashSet<UUID>();
this.banned = new HashSet<UUID>();
this.createdDate = System.currentTimeMillis();
this.updatedDate = System.currentTimeMillis();
this.name = "";
this.world = location.getWorld();
this.center = location;
this.minX = center.getBlockX() - Settings.islandDistance;
this.minZ = center.getBlockZ() - Settings.islandDistance;
this.protectionRange = protectionRange;
this.minProtectedX = center.getBlockX() - protectionRange;
this.minProtectedZ = center.getBlockZ() - protectionRange;
}
/**
* @return the center Location
*/
public Location getCenter(){
return center;
}
/**
* @return the x coordinate of the island center
*/
public int getX(){
return center.getBlockX();
}
/**
* @return the y coordinate of the island center
*/
public int getY(){
return center.getBlockY();
}
/**
* @return the z coordinate of the island center
*/
public int getZ(){
return center.getBlockZ();
}
/**
* @return the island range
*/
public int getRange(){
return range;
}
/**
* @param range - the range to set
*/
public void setRange(int range){
this.range = range;
}
/**
* @return the island display name or the owner's name if none is set
*/
public String getName(){
return (name != null) ? name : plugin.getServer().getOfflinePlayer(owner).getName();
}
/**
* @param name - the display name to set
* Set to null to remove the display name
*/
public void setName(String name){
this.name = name;
}
/**
* @return the date when the island was created
*/
public long getCreatedDate(){
return createdDate;
}
/**
* @param createdDate - the createdDate to sets
*/
public void setCreatedDate(long createdDate){
this.createdDate = createdDate;
}
/**
* @return the date when the island was updated (team member connection, etc...)
*/
public long getUpdatedDate(){
return updatedDate;
}
/**
* @param updatedDate - the updatedDate to sets
*/
public void setUpdatedDate(long updatedDate){
this.updatedDate = updatedDate;
}
/**
* @return the owner (team leader)
*/
public UUID getOwner(){
return owner;
}
/**
* Sets the owner of the island. If the owner was previous banned, they are unbanned
* @param owner - the owner/team leader to set
*/
public void setOwner(UUID owner){
this.owner = owner;
this.banned.remove(owner);
}
/**
* @return the members of the island (owner included)
*/
public Set<UUID> getMembers(){
return members;
}
/**
* @param members - the members to set
*/
public void setMembers(Set<UUID> members){
this.members = members;
}
/**
* @return the trustees players of the island
*/
public Set<UUID> getTrustees(){
return trustees;
}
/**
* @param trustees - the trustees to set
*/
public void setTrustees(Set<UUID> trustees){
this.trustees = trustees;
}
/**
* @return the coop players of the island
*/
public Set<UUID> getCoops(){
return coops;
}
/**
* @param coops - the coops to set
*/
public void setCoops(Set<UUID> coops){
this.coops = coops;
}
/**
* @return true if the island is locked, otherwise false
*/
public boolean isLocked(){
return locked;
}
/**
* Locks/Unlocks the island. May be cancelled by
* {@link IslandLockEvent} or {@link IslandUnlockEvent}.
* @param locked - the lock state to set
*/
public void setLocked(boolean locked){
if(locked){
// Lock the island
IslandLockEvent event = new IslandLockEvent(this);
plugin.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()){
this.locked = locked;
}
} else {
// Unlock the island
IslandUnlockEvent event = new IslandUnlockEvent(this);
plugin.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()){
this.locked = locked;
}
}
}
/**
* @return true if the island is the spawn otherwise false
*/
public boolean isSpawn(){
return isSpawn;
}
/**
* @param isSpawn - if the island is the spawn
*/
public void setSpawn(boolean isSpawn){
this.isSpawn = isSpawn;
}
/**
* @return true if the island is protected from the Purge, otherwise false
*/
public boolean isPurgeProtected(){
return purgeProtected;
}
/**
* @param purgeProtected - if the island is protected from the Purge
*/
public void setPurgeProtected(boolean purgeProtected){
this.purgeProtected = purgeProtected;
}
/**
* Island Guard Settings flags
@ -544,49 +277,72 @@ public class Island {
WITHER_BLOW_UP_SHULKER_BOX
}
/**
* Resets the flags to their default as set in config.yml for this island
*/
public void setFlagsDefaults(){
/*for(SettingsFlag flag : SettingsFlag.values()){
this.flags.put(flag, Settings.defaultIslandSettings.get(flag));
}*/ //TODO default flags
}
//// Island ////
// The center of the island itself
private Location center;
/**
* Resets the flags to their default as set in config.yml for the spawn
*/
public void setSpawnFlagsDefaults(){
/*for(SettingsFlag flag : SettingsFlag.values()){
this.flags.put(flag, Settings.defaultSpawnSettings.get(flag));
}*/ //TODO default flags
}
// Island range
private int range;
/**
* Get the Island Guard flag status
* @param flag
* @return true or false, or false if flag is not in the list
*/
public boolean getFlag(SettingsFlag flag){
if(flags.containsKey(flag)) return flags.get(flag);
else return false;
}
// Coordinates of the island area
private int minX;
/**
* Set the Island Guard flag status
* @param flag
* @param value
*/
public void setFlag(SettingsFlag flag, boolean value){
flags.put(flag, value);
}
private int minZ;
/**
* Toggles the Island Guard flag status if it is in the list
* @param flag
*/
public void toggleFlag(SettingsFlag flag){
if(flags.containsKey(flag)) flags.put(flag, (flags.get(flag)) ? false : true);
// Coordinates of minimum protected area
private int minProtectedX;
private int minProtectedZ;
// Protection size
private int protectionRange;
// World the island is in
private World world;
// Display name
private String name;
// Time parameters
private long createdDate;
private long updatedDate;
//// Team ////
// Owner (Team Leader)
private UUID owner;
// Members (use set because each value must be unique)
private Set<UUID> members = new HashSet<UUID>();
// Trustees
private Set<UUID> trustees = new HashSet<UUID>();
// Coops
private Set<UUID> coops = new HashSet<UUID>();
// Banned players
private Set<UUID> banned = new HashSet<UUID>();
//// State ////
private boolean locked = false;
private boolean spawn = false;
private boolean purgeProtected = false;
//// Protection ////
private HashMap<SettingsFlag, Boolean> flags = new HashMap<SettingsFlag, Boolean>();
public Island() {};
public Island(Location location, UUID owner, int protectionRange) {
this.members.add(owner);
this.owner = owner;
this.createdDate = System.currentTimeMillis();
this.updatedDate = System.currentTimeMillis();
this.world = location.getWorld();
this.center = location;
this.minX = center.getBlockX() - Settings.islandDistance;
this.minZ = center.getBlockZ() - Settings.islandDistance;
this.protectionRange = protectionRange;
this.minProtectedX = center.getBlockX() - protectionRange;
this.minProtectedZ = center.getBlockZ() - protectionRange;
}
/**
@ -598,32 +354,6 @@ public class Island {
banned.remove(playerUUID);
}
/**
* Checks if a location is within this island's protected area
*
* @param target
* @return true if it is, false if not
*/
public boolean onIsland(Location target) {
if (center.getWorld() != null) {
if (target.getBlockX() >= minProtectedX && target.getBlockX() < (minProtectedX + protectionRange)
&& target.getBlockZ() >= minProtectedZ && target.getBlockZ() < (minProtectedZ + protectionRange)) {
return true;
}
}
return false;
}
public boolean inIslandSpace(int x, int z) {
if (x >= center.getBlockX() - Settings.islandDistance / 2 && x < center.getBlockX() + Settings.islandDistance / 2 && z >= center.getBlockZ() - Settings.islandDistance / 2
&& z < center.getBlockZ() + Settings.islandDistance / 2) {
return true;
}
return false;
}
/**
* Adds target to a list of banned players for this island. May be blocked by the event being cancelled.
* If the player is a member, coop or trustee, they will be removed from those lists.
@ -646,14 +376,158 @@ public class Island {
}
/**
* Removes target from the banned list. May be cancelled by unban event.
* @param targetUUID
* @return true if successful, otherwise false.
* @return the banned
*/
public boolean removeFromBanList(UUID targetUUID) {
// TODO fire unban event
banned.remove(targetUUID);
return true;
public Set<UUID> getBanned() {
return banned;
}
/**
* @return the center Location
*/
public Location getCenter(){
return center;
}
/**
* @return the coop players of the island
*/
public Set<UUID> getCoops(){
return coops;
}
/**
* @return the date when the island was created
*/
public long getCreatedDate(){
return createdDate;
}
/**
* Get the Island Guard flag status
* @param flag
* @return true or false, or false if flag is not in the list
*/
public boolean getFlag(SettingsFlag flag){
if(flags.containsKey(flag)) {
return flags.get(flag);
} else {
return false;
}
}
/**
* @return the flags
*/
public HashMap<SettingsFlag, Boolean> getFlags() {
return flags;
}
/**
* @return the members of the island (owner included)
*/
public Set<UUID> getMembers(){
return members;
}
/**
* @return the minProtectedX
*/
public int getMinProtectedX() {
return minProtectedX;
}
/**
* @return the minProtectedZ
*/
public int getMinProtectedZ() {
return minProtectedZ;
}
/**
* @return the minX
*/
public int getMinX() {
return minX;
}
/**
* @return the minZ
*/
public int getMinZ() {
return minZ;
}
/**
* @return the island display name or the owner's name if none is set
*/
public String getName(){
return (name != null) ? name : Bukkit.getServer().getOfflinePlayer(owner).getName();
}
/**
* @return the owner (team leader)
*/
public UUID getOwner(){
return owner;
}
/**
* @return the protectionRange
*/
public int getProtectionRange() {
return protectionRange;
}
/**
* @return the island range
*/
public int getRange(){
return range;
}
/**
* @return the trustees players of the island
*/
public Set<UUID> getTrustees(){
return trustees;
}
/**
* @return the date when the island was updated (team member connection, etc...)
*/
public long getUpdatedDate(){
return updatedDate;
}
/**
* @return the world
*/
public World getWorld() {
return world;
}
/**
* @return the x coordinate of the island center
*/
public int getX(){
return center.getBlockX();
}
/**
* @return the y coordinate of the island center
*/
public int getY(){
return center.getBlockY();
}
/**
* @return the z coordinate of the island center
*/
public int getZ(){
return center.getBlockZ();
}
public boolean inIslandSpace(int x, int z) {
if (x >= center.getBlockX() - Settings.islandDistance / 2 && x < center.getBlockX() + Settings.islandDistance / 2 && z >= center.getBlockZ() - Settings.islandDistance / 2
&& z < center.getBlockZ() + Settings.islandDistance / 2) {
return true;
}
return false;
}
/**
@ -666,10 +540,182 @@ public class Island {
}
/**
* @return the protectionRange
* @return true if the island is locked, otherwise false
*/
public int getProtectionRange() {
return protectionRange;
public boolean getLocked(){
return locked;
}
/**
* @return true if the island is protected from the Purge, otherwise false
*/
public boolean getPurgeProtected(){
return purgeProtected;
}
/**
* @return true if the island is the spawn otherwise false
*/
public boolean getSpawn(){
return spawn;
}
/**
* Checks if a location is within this island's protected area
*
* @param target
* @return true if it is, false if not
*/
public boolean onIsland(Location target) {
if (center.getWorld() != null) {
if (target.getBlockX() >= minProtectedX && target.getBlockX() < (minProtectedX + protectionRange)
&& target.getBlockZ() >= minProtectedZ && target.getBlockZ() < (minProtectedZ + protectionRange)) {
return true;
}
}
return false;
}
/**
* Removes target from the banned list. May be cancelled by unban event.
* @param targetUUID
* @return true if successful, otherwise false.
*/
public boolean removeFromBanList(UUID targetUUID) {
// TODO fire unban event
banned.remove(targetUUID);
return true;
}
/**
* @param banned the banned to set
*/
public void setBanned(Set<UUID> banned) {
this.banned = banned;
}
/**
* @param center the center to set
*/
public void setCenter(Location center) {
this.center = center;
}
/**
* @param coops - the coops to set
*/
public void setCoops(Set<UUID> coops){
this.coops = coops;
}
/**
* @param createdDate - the createdDate to sets
*/
public void setCreatedDate(long createdDate){
this.createdDate = createdDate;
}
/**
* Set the Island Guard flag status
* @param flag
* @param value
*/
public void setFlag(SettingsFlag flag, boolean value){
flags.put(flag, value);
}
/**
* @param flags the flags to set
*/
public void setFlags(HashMap<SettingsFlag, Boolean> flags) {
this.flags = flags;
}
/**
* Resets the flags to their default as set in config.yml for this island
*/
public void setFlagsDefaults(){
/*for(SettingsFlag flag : SettingsFlag.values()){
this.flags.put(flag, Settings.defaultIslandSettings.get(flag));
}*/ //TODO default flags
}
/**
* Locks/Unlocks the island. May be cancelled by
* {@link IslandLockEvent} or {@link IslandUnlockEvent}.
* @param locked - the lock state to set
*/
public void setLocked(boolean locked){
if(locked){
// Lock the island
IslandLockEvent event = new IslandLockEvent(this);
Bukkit.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()){
this.locked = locked;
}
} else {
// Unlock the island
IslandUnlockEvent event = new IslandUnlockEvent(this);
Bukkit.getServer().getPluginManager().callEvent(event);
if(!event.isCancelled()){
this.locked = locked;
}
}
}
/**
* @param members - the members to set
*/
public void setMembers(Set<UUID> members){
this.members = members;
}
/**
* @param minProtectedX the minProtectedX to set
*/
public void setMinProtectedX(int minProtectedX) {
this.minProtectedX = minProtectedX;
}
/**
* @param minProtectedZ the minProtectedZ to set
*/
public void setMinProtectedZ(int minProtectedZ) {
this.minProtectedZ = minProtectedZ;
}
/**
* @param minX the minX to set
*/
public void setMinX(int minX) {
this.minX = minX;
}
/**
* @param minZ the minZ to set
*/
public void setMinZ(int minZ) {
this.minZ = minZ;
}
/**
* @param name - the display name to set
* Set to null to remove the display name
*/
public void setName(String name){
this.name = name;
}
/**
* Sets the owner of the island. If the owner was previous banned, they are unbanned
* @param owner - the owner/team leader to set
*/
public void setOwner(UUID owner){
this.owner = owner;
this.banned.remove(owner);
}
/**
@ -680,9 +726,63 @@ public class Island {
}
/**
* @return the banned
* @param purgeProtected - if the island is protected from the Purge
*/
public Set<UUID> getBanned() {
return banned;
public void setPurgeProtected(boolean purgeProtected){
this.purgeProtected = purgeProtected;
}
}
/**
* @param range - the range to set
*/
public void setRange(int range){
this.range = range;
}
/**
* @param isSpawn - if the island is the spawn
*/
public void setSpawn(boolean isSpawn){
this.spawn = isSpawn;
}
/**
* Resets the flags to their default as set in config.yml for the spawn
*/
public void setSpawnFlagsDefaults(){
/*for(SettingsFlag flag : SettingsFlag.values()){
this.flags.put(flag, Settings.defaultSpawnSettings.get(flag));
}*/ //TODO default flags
}
/**
* @param trustees - the trustees to set
*/
public void setTrustees(Set<UUID> trustees){
this.trustees = trustees;
}
/**
* @param updatedDate - the updatedDate to sets
*/
public void setUpdatedDate(long updatedDate){
this.updatedDate = updatedDate;
}
/**
* @param world the world to set
*/
public void setWorld(World world) {
this.world = world;
}
/**
* Toggles the Island Guard flag status if it is in the list
* @param flag
*/
public void toggleFlag(SettingsFlag flag){
if(flags.containsKey(flag)) {
flags.put(flag, (flags.get(flag)) ? false : true);
}
}
}