Esempio n. 1
0
 /** Commits the database records and closes the database */
 public void closeDB() {
   /** Map changes are not persisted yet, commit them (save to disk) */
   try {
     recMan.commit();
     /** close record manager */
     recMan.close();
     plugin.getLogger().info("Saved name database");
   } catch (IOException e) {
     plugin.getLogger().severe("Problem saving name database!");
     e.printStackTrace();
   }
 }
Esempio n. 2
0
 /**
  * Changes the sign to red if it exists
  *
  * @param loc
  */
 private void popSign(Location loc) {
   Block b = loc.getBlock();
   if (b.getType().equals(Material.SIGN_POST) || b.getType().equals(Material.WALL_SIGN)) {
     Sign s = (Sign) b.getState();
     if (s != null) {
       if (s.getLine(0).equalsIgnoreCase(ChatColor.GREEN + plugin.myLocale().warpswelcomeLine)) {
         s.setLine(0, ChatColor.RED + plugin.myLocale().warpswelcomeLine);
         s.update();
       }
     }
   }
 }
Esempio n. 3
0
 /**
  * Checks if location is anywhere in the island space (island distance)
  *
  * @param target
  * @return true if in the area
  */
 public boolean inIslandSpace(Location target) {
   if (target.getWorld().equals(ASkyBlock.getIslandWorld())
       || target.getWorld().equals(ASkyBlock.getNetherWorld())) {
     if (target.getX() >= center.getBlockX() - islandDistance / 2
         && target.getX() < center.getBlockX() + islandDistance / 2
         && target.getZ() >= center.getBlockZ() - islandDistance / 2
         && target.getZ() < center.getBlockZ() + islandDistance / 2) {
       return true;
     }
   }
   return false;
 }
Esempio n. 4
0
  /**
   * Stores warps in the warp array
   *
   * @param player
   * @param loc
   */
  public boolean addWarp(final UUID player, Location loc) {
    // Do not allow warps to be in the same location
    if (warpList.containsValue(loc)) {
      return false;
    }
    // Remove the old warp if it existed
    if (warpList.containsKey(player)) {
      warpList.remove(player);
    }
    warpList.put(player, loc);
    saveWarpList();
    // Update warp signs
    // Run one tick later because text gets updated at the end of tick
    plugin
        .getServer()
        .getScheduler()
        .runTask(
            plugin,
            new Runnable() {

              @Override
              public void run() {
                plugin.getWarpPanel().addWarp(player);
                plugin.getWarpPanel().updatePanel();
              }
            });
    return true;
  }
Esempio n. 5
0
 /**
  * @param location
  * @return Name of warp owner
  */
 public String getWarpOwner(Location location) {
   for (UUID playerUUID : warpList.keySet()) {
     if (location.equals(warpList.get(playerUUID))) {
       return plugin.getPlayers().getName(playerUUID);
     }
   }
   return "";
 }
Esempio n. 6
0
 private void convertFiles() {
   /** create database */
   try {
     recMan = RecordManagerFactory.createRecordManager(name2UUID.getAbsolutePath());
     String recordName = "nameToUUID";
     treeMap = recMan.hashMap(recordName);
     // Load all the files from the player folder
     FilenameFilter ymlFilter =
         new FilenameFilter() {
           public boolean accept(File dir, String name) {
             String lowercaseName = name.toLowerCase();
             if (lowercaseName.endsWith(".yml")) {
               return true;
             } else {
               return false;
             }
           }
         };
     int count = 0;
     for (final File file : plugin.getPlayersFolder().listFiles(ymlFilter)) {
       if (count % 1000 == 0) {
         System.out.println("[ASkyBlock]: Processed " + count + " names to database");
       }
       count++;
       try {
         // Get UUID
         String uuid = file.getName().substring(0, file.getName().length() - 4);
         // System.out.println("DEBUG: UUID is " + uuid);
         final UUID playerUUID = UUID.fromString(uuid);
         // Get the player's name
         Scanner scanner = new Scanner(file);
         while (scanner.hasNextLine()) {
           final String lineFromFile = scanner.nextLine();
           if (lineFromFile.contains("playerName:")) {
             // Check against potentialUnowned list
             String playerName = lineFromFile.substring(lineFromFile.indexOf(' ')).trim();
             // System.out.println("DEBUG: Player name is " + playerName);
             treeMap.put(playerName.toLowerCase(), playerUUID);
             break;
           }
         }
         scanner.close();
       } catch (Exception ex) {
         System.err.println(
             "[ASkyBlock/AcidIsland]: Problem reading " + file.getName() + " skipping...");
         // ex.printStackTrace();
       }
     }
     /** Map changes are not persisted yet, commit them (save to disk) */
     recMan.commit();
     System.out.println("[ASkyBlock]: Complete. Processed " + count + " names to database");
     // Set flag
     dbReady = true;
   } catch (Exception e) {
     System.err.println("[ASkyBlock/AcidIsland] : Problem creating database");
   }
 }
Esempio n. 7
0
 /** Creates the warp list if it does not exist */
 public void loadWarpList() {
   plugin.getLogger().info("Loading warps...");
   // warpList.clear();
   welcomeWarps = Util.loadYamlFile("warps.yml");
   if (welcomeWarps.getConfigurationSection("warps") == null) {
     welcomeWarps.createSection("warps"); // This is only used to create
     // the warp.yml file so forgive
     // this code
   }
   HashMap<String, Object> temp =
       (HashMap<String, Object>) welcomeWarps.getConfigurationSection("warps").getValues(true);
   for (String s : temp.keySet()) {
     try {
       UUID playerUUID = UUID.fromString(s);
       Location l = Util.getLocationString((String) temp.get(s));
       // plugin.getLogger().info("DEBUG: Loading warp at " + l);
       Block b = l.getBlock();
       // Check that a warp sign is still there
       if (b.getType().equals(Material.SIGN_POST) || b.getType().equals(Material.WALL_SIGN)) {
         warpList.put(playerUUID, l);
       } else {
         plugin
             .getLogger()
             .warning("Warp at location " + temp.get(s) + " has no sign - removing.");
         // Test code
         /*
         warpList.put(playerUUID, l);
         b.getRelative(BlockFace.DOWN).setType(Material.DIRT);
         b.setType(Material.SIGN_POST);
         Sign sign = (Sign)b.getState();
         sign.setLine(0, ChatColor.GREEN + plugin.myLocale().warpswelcomeLine);
         sign.setLine(1, "test");
         sign.setLine(2, "Test 2");
         sign.update();
                        */
       }
     } catch (Exception e) {
       plugin
           .getLogger()
           .severe("Problem loading warp at location " + temp.get(s) + " - removing.");
       e.printStackTrace();
     }
   }
 }
Esempio n. 8
0
 /** @return Sorted list of warps with most recent players listed first */
 public Collection<UUID> listSortedWarps() {
   // Bigger value of time means a more recent login
   TreeMap<Long, UUID> map = new TreeMap<Long, UUID>();
   for (UUID uuid : warpList.keySet()) {
     // If never played, will be zero
     long lastPlayed = plugin.getServer().getOfflinePlayer(uuid).getLastPlayed();
     // This aims to avoid the chance that players logged off at exactly the same time
     if (!map.isEmpty() && map.containsKey(lastPlayed)) {
       lastPlayed = map.firstKey() - 1;
     }
     map.put(lastPlayed, uuid);
   }
   Collection<UUID> result = map.descendingMap().values();
   // Fire event
   WarpListEvent event = new WarpListEvent(plugin, result);
   plugin.getServer().getPluginManager().callEvent(event);
   // Get the result of any changes by listeners
   result = event.getWarps();
   return result;
 }
Esempio n. 9
0
 /**
  * Provides a list of all the players who are allowed on this island including coop members
  *
  * @return a list of UUIDs that have legitimate access to the island
  */
 public List<UUID> getMembers() {
   List<UUID> result = new ArrayList<UUID>();
   // Add any coop members for this island
   result.addAll(CoopPlay.getInstance().getCoopPlayers(center));
   if (owner == null) {
     return result;
   }
   result.add(owner);
   // Add any team members
   result.addAll(plugin.getPlayers().getMembers(owner));
   return result;
 }
Esempio n. 10
0
 /**
  * Checks to see if a sign has been broken
  *
  * @param e
  */
 @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false)
 public void onSignBreak(BlockBreakEvent e) {
   Block b = e.getBlock();
   Player player = e.getPlayer();
   if (b.getWorld().equals(ASkyBlock.getIslandWorld())
       || b.getWorld().equals(ASkyBlock.getNetherWorld())) {
     if (b.getType().equals(Material.SIGN_POST) || b.getType().equals(Material.WALL_SIGN)) {
       Sign s = (Sign) b.getState();
       if (s != null) {
         // plugin.getLogger().info("DEBUG: sign found at location " + s.toString());
         if (s.getLine(0).equalsIgnoreCase(ChatColor.GREEN + plugin.myLocale().warpswelcomeLine)) {
           // Do a quick check to see if this sign location is in
           // plugin.getLogger().info("DEBUG: welcome sign");
           // the list of warp signs
           if (warpList.containsValue(s.getLocation())) {
             // plugin.getLogger().info("DEBUG: warp sign is in list");
             // Welcome sign detected - check to see if it is
             // this player's sign
             if ((warpList.containsKey(player.getUniqueId())
                 && warpList.get(player.getUniqueId()).equals(s.getLocation()))) {
               // Player removed sign
               removeWarp(s.getLocation());
             } else if (player.isOp()
                 || player.hasPermission(Settings.PERMPREFIX + "mod.removesign")) {
               // Op or mod removed sign
               player.sendMessage(
                   ChatColor.GREEN + plugin.myLocale(player.getUniqueId()).warpsremoved);
               removeWarp(s.getLocation());
             } else {
               // Someone else's sign - not allowed
               player.sendMessage(
                   ChatColor.RED + plugin.myLocale(player.getUniqueId()).warpserrorNoRemove);
               e.setCancelled(true);
             }
           }
         }
       }
     }
   }
 }
Esempio n. 11
0
  /**
   * Opens the database
   *
   * @param plugin
   */
  public TinyDB(ASkyBlock plugin) {
    this.plugin = plugin;
    this.dbReady = false;
    // Open database
    dbFolder = new File(plugin.getDataFolder(), "database");
    name2UUID = new File(dbFolder, fileName);
    if (!dbFolder.exists()) {
      plugin.getLogger().info("Creating a tiny playerName-UUID database");
      // Create folder
      dbFolder.mkdir();
      // Run async task to do conversion
      plugin
          .getServer()
          .getScheduler()
          .runTaskAsynchronously(
              plugin,
              new Runnable() {

                @Override
                public void run() {
                  convertFiles();
                }
              });

    } else {
      try {
        recMan = RecordManagerFactory.createRecordManager(name2UUID.getAbsolutePath());
        String recordName = "nameToUUID";
        treeMap = recMan.hashMap(recordName);
        dbReady = true;
      } catch (IOException e) {
        dbReady = false;
        // TODO Auto-generated catch block
        e.printStackTrace();
      }
    }
  }
Esempio n. 12
0
 /**
  * Removes a warp at a location. Called by WarpSigns.java.
  *
  * @param loc
  */
 public void removeWarp(Location loc) {
   // plugin.getLogger().info("Asked to remove warp at " + loc);
   popSign(loc);
   Iterator<Entry<UUID, Location>> it = warpList.entrySet().iterator();
   while (it.hasNext()) {
     Entry<UUID, Location> en = it.next();
     if (en.getValue().equals(loc)) {
       // Inform player
       Player p = plugin.getServer().getPlayer(en.getKey());
       if (p != null) {
         // Inform the player
         p.sendMessage(ChatColor.RED + plugin.myLocale(p.getUniqueId()).warpssignRemoved);
       } else {
         plugin
             .getMessages()
             .setMessage(
                 en.getKey(), ChatColor.RED + plugin.myLocale(en.getKey()).warpssignRemoved);
       }
       it.remove();
     }
   }
   saveWarpList();
   plugin.getWarpPanel().updatePanel();
 }
Esempio n. 13
0
 public Island(ASkyBlock plugin, int x, int z, UUID owner) {
   this.plugin = plugin;
   // Calculate min minX and z
   this.minX = x - Settings.islandDistance / 2;
   this.minZ = z - Settings.islandDistance / 2;
   this.minProtectedX = x - Settings.island_protectionRange / 2;
   this.minProtectedZ = z - Settings.island_protectionRange / 2;
   this.y = Settings.island_level;
   this.islandDistance = Settings.islandDistance;
   this.protectionRange = Settings.island_protectionRange;
   this.world = ASkyBlock.getIslandWorld();
   this.center = new Location(world, x, y, z);
   this.createdDate = new Date().getTime();
   this.updatedDate = createdDate;
   this.password = "";
   this.votes = 0;
   this.owner = owner;
   // Island Guard Settings
   this.igs.put(Flags.allowAnvilUse, Settings.allowAnvilUse);
   this.igs.put(Flags.allowArmorStandUse, Settings.allowArmorStandUse);
   this.igs.put(Flags.allowBeaconAccess, Settings.allowBeaconAccess);
   this.igs.put(Flags.allowBedUse, Settings.allowBedUse);
   this.igs.put(Flags.allowBreakBlocks, Settings.allowBreakBlocks);
   this.igs.put(Flags.allowBreeding, Settings.allowBreeding);
   this.igs.put(Flags.allowBrewing, Settings.allowBrewing);
   this.igs.put(Flags.allowBucketUse, Settings.allowBucketUse);
   this.igs.put(Flags.allowChestAccess, Settings.allowChestAccess);
   this.igs.put(Flags.allowCrafting, Settings.allowCrafting);
   this.igs.put(Flags.allowCropTrample, Settings.allowCropTrample);
   this.igs.put(Flags.allowDoorUse, Settings.allowDoorUse);
   this.igs.put(Flags.allowEnchanting, Settings.allowEnchanting);
   this.igs.put(Flags.allowEnderPearls, Settings.allowEnderPearls);
   this.igs.put(Flags.allowFurnaceUse, Settings.allowFurnaceUse);
   this.igs.put(Flags.allowGateUse, Settings.allowGateUse);
   this.igs.put(Flags.allowHorseInvAccess, Settings.allowHorseInvAccess);
   this.igs.put(Flags.allowHorseRiding, Settings.allowHorseRiding);
   this.igs.put(Flags.allowHurtMobs, Settings.allowHurtMobs);
   this.igs.put(Flags.allowLeashUse, Settings.allowLeashUse);
   this.igs.put(Flags.allowLeverButtonUse, Settings.allowLeverButtonUse);
   this.igs.put(Flags.allowMusic, Settings.allowMusic);
   this.igs.put(Flags.allowPlaceBlocks, Settings.allowPlaceBlocks);
   this.igs.put(Flags.allowPortalUse, Settings.allowPortalUse);
   this.igs.put(Flags.allowPressurePlate, Settings.allowPressurePlate);
   this.igs.put(Flags.allowPvP, Settings.allowPvP);
   this.igs.put(Flags.allowNetherPvP, Settings.allowNetherPvP);
   this.igs.put(Flags.allowRedStone, Settings.allowRedStone);
   this.igs.put(Flags.allowShearing, Settings.allowShearing);
 }
Esempio n. 14
0
 /**
  * @param mat
  * @return count of how many tile entities of type mat are on the island at last count. Counts are
  *     done when a player places a tile entity.
  */
 public int getTileEntityCount(Material material) {
   int result = 0;
   for (int x = getMinProtectedX() / 16;
       x <= (getMinProtectedX() + getProtectionSize() - 1) / 16;
       x++) {
     for (int z = getMinProtectedZ() / 16;
         z <= (getMinProtectedZ() + getProtectionSize() - 1) / 16;
         z++) {
       for (BlockState holder : world.getChunkAt(x, z).getTileEntities()) {
         // plugin.getLogger().info("DEBUG: tile entity: " + holder.getType());
         if (holder.getType() == material) {
           result++;
         } else if (material.equals(Material.REDSTONE_COMPARATOR_OFF)) {
           if (holder.getType().equals(Material.REDSTONE_COMPARATOR_ON)) {
             result++;
           }
         } else if (material.equals(Material.FURNACE)) {
           if (holder.getType().equals(Material.BURNING_FURNACE)) {
             result++;
           }
         } else if (material.toString().endsWith("BANNER")) {
           if (holder.getType().toString().endsWith("BANNER")) {
             result++;
           }
         } else if (material.equals(Material.WALL_SIGN) || material.equals(Material.SIGN_POST)) {
           if (holder.getType().equals(Material.WALL_SIGN)
               || holder.getType().equals(Material.SIGN_POST)) {
             result++;
           }
         }
       }
       for (Entity holder : world.getChunkAt(x, z).getEntities()) {
         // plugin.getLogger().info("DEBUG: entity: " + holder.getType());
         if (holder.getType().toString().equals(material.toString())) {
           result++;
         }
       }
     }
   }
   // Version 1.7.x counts differently to 1.8 (ugh)
   // In 1.7, the entity is present before it is cancelled and so gets counted.
   // Remove 1 from count if it is 1.7.x
   if (!plugin.isOnePointEight()) {
     result--;
   }
   return result;
 }
Esempio n. 15
0
 /**
  * Checks if a location is within this island's protected area
  *
  * @param loc
  * @return
  */
 public boolean onIsland(Location target) {
   if (world != null) {
     // If the new nether is being used, islands exist in the nether too
     if (target.getWorld().equals(world)
         || (Settings.createNether
             && Settings.newNether
             && target.getWorld().equals(ASkyBlock.getNetherWorld()))) {
       if (target.getX() >= center.getBlockX() - protectionRange / 2
           && target.getX() < center.getBlockX() + protectionRange / 2
           && target.getZ() >= center.getBlockZ() - protectionRange / 2
           && target.getZ() < center.getBlockZ() + protectionRange / 2) {
         return true;
       }
     }
   }
   return false;
 }
Esempio n. 16
0
  /**
   * Removes a warp when the welcome sign is destroyed. Called by WarpSigns.java.
   *
   * @param uuid
   */
  public void removeWarp(UUID uuid) {
    if (warpList.containsKey(uuid)) {
      popSign(warpList.get(uuid));
      warpList.remove(uuid);
    }
    saveWarpList();
    // Update warp signs
    // Run one tick later because text gets updated at the end of tick
    plugin
        .getServer()
        .getScheduler()
        .runTask(
            plugin,
            new Runnable() {

              @Override
              public void run() {
                plugin.getWarpPanel().updatePanel();
              }
            });
  }
Esempio n. 17
0
  /**
   * Event handler for Sign Changes
   *
   * @param e
   */
  @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = false)
  public void onSignWarpCreate(SignChangeEvent e) {
    // plugin.getLogger().info("DEBUG: SignChangeEvent called");
    String title = e.getLine(0);
    Player player = e.getPlayer();
    if (player.getWorld().equals(ASkyBlock.getIslandWorld())
        || player.getWorld().equals(ASkyBlock.getNetherWorld())) {
      // plugin.getLogger().info("DEBUG: Correct world");
      if (e.getBlock().getType().equals(Material.SIGN_POST)
          || e.getBlock().getType().equals(Material.WALL_SIGN)) {

        // plugin.getLogger().info("DEBUG: The first line of the sign says " + title);
        // Check if someone is changing their own sign
        // This should never happen !!
        if (title.equalsIgnoreCase(plugin.myLocale().warpswelcomeLine)) {
          // plugin.getLogger().info("DEBUG: Welcome sign detected");
          // Welcome sign detected - check permissions
          if (!(VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.addwarp"))) {
            player.sendMessage(
                ChatColor.RED + plugin.myLocale(player.getUniqueId()).warpserrorNoPerm);
            return;
          }
          // Check that the player is on their island
          if (!(plugin.getGrid().playerIsOnIsland(player))) {
            player.sendMessage(
                ChatColor.RED + plugin.myLocale(player.getUniqueId()).warpserrorNoPlace);
            e.setLine(0, ChatColor.RED + plugin.myLocale().warpswelcomeLine);
            return;
          }
          // Check if the player already has a sign
          final Location oldSignLoc = getWarp(player.getUniqueId());
          if (oldSignLoc == null) {
            // plugin.getLogger().info("DEBUG: Player does not have a sign already");
            // First time the sign has been placed or this is a new
            // sign
            if (addWarp(player.getUniqueId(), e.getBlock().getLocation())) {
              player.sendMessage(
                  ChatColor.GREEN + plugin.myLocale(player.getUniqueId()).warpssuccess);
              e.setLine(0, ChatColor.GREEN + plugin.myLocale().warpswelcomeLine);
              for (int i = 1; i < 4; i++) {
                e.setLine(i, ChatColor.translateAlternateColorCodes('&', e.getLine(i)));
              }
            } else {
              player.sendMessage(
                  ChatColor.RED + plugin.myLocale(player.getUniqueId()).warpserrorDuplicate);
              e.setLine(0, ChatColor.RED + plugin.myLocale().warpswelcomeLine);
              for (int i = 1; i < 4; i++) {
                e.setLine(i, ChatColor.translateAlternateColorCodes('&', e.getLine(i)));
              }
            }
          } else {
            // plugin.getLogger().info("DEBUG: Player already has a Sign");
            // A sign already exists. Check if it still there and if
            // so,
            // deactivate it
            Block oldSignBlock = oldSignLoc.getBlock();
            if (oldSignBlock.getType().equals(Material.SIGN_POST)
                || oldSignBlock.getType().equals(Material.WALL_SIGN)) {
              // The block is still a sign
              // plugin.getLogger().info("DEBUG: The block is still a sign");
              Sign oldSign = (Sign) oldSignBlock.getState();
              if (oldSign != null) {
                // plugin.getLogger().info("DEBUG: Sign block is a sign");
                if (oldSign
                    .getLine(0)
                    .equalsIgnoreCase(ChatColor.GREEN + plugin.myLocale().warpswelcomeLine)) {
                  // plugin.getLogger().info("DEBUG: Old sign had a green welcome");
                  oldSign.setLine(0, ChatColor.RED + plugin.myLocale().warpswelcomeLine);
                  oldSign.update();
                  player.sendMessage(
                      ChatColor.RED + plugin.myLocale(player.getUniqueId()).warpsdeactivate);
                  removeWarp(player.getUniqueId());
                }
              }
            }
            // Set up the warp
            if (addWarp(player.getUniqueId(), e.getBlock().getLocation())) {
              player.sendMessage(
                  ChatColor.GREEN + plugin.myLocale(player.getUniqueId()).warpssuccess);
              e.setLine(0, ChatColor.GREEN + plugin.myLocale().warpswelcomeLine);
            } else {
              player.sendMessage(
                  ChatColor.RED + plugin.myLocale(player.getUniqueId()).warpserrorDuplicate);
              e.setLine(0, ChatColor.RED + plugin.myLocale().warpswelcomeLine);
            }
          }
        }
      }
    }
  }
Esempio n. 18
0
 /**
  * New island by loading islands.yml
  *
  * @param plugin
  * @param serial
  */
 public Island(ASkyBlock plugin, String serial) {
   this.plugin = plugin;
   // Bukkit.getLogger().info("DEBUG: adding serialized island to grid ");
   // Deserialize
   // Format:
   // x:height:z:protection range:island distance:owner UUID: locked: protected
   String[] split = serial.split(":");
   try {
     protectionRange = Integer.parseInt(split[3]);
     islandDistance = Integer.parseInt(split[4]);
     int x = Integer.parseInt(split[0]);
     int z = Integer.parseInt(split[2]);
     minX = x - islandDistance / 2;
     y = Integer.parseInt(split[1]);
     minZ = z - islandDistance / 2;
     minProtectedX = x - protectionRange / 2;
     minProtectedZ = z - protectionRange / 2;
     this.world = ASkyBlock.getIslandWorld();
     this.center = new Location(world, x, y, z);
     this.createdDate = new Date().getTime();
     this.updatedDate = createdDate;
     this.password = "";
     this.votes = 0;
     if (split.length > 6) {
       // Bukkit.getLogger().info("DEBUG: " + split[6]);
       // Get locked status
       if (split[6].equalsIgnoreCase("true")) {
         this.locked = true;
       } else {
         this.locked = false;
       }
       // Bukkit.getLogger().info("DEBUG: " + locked);
     } else {
       this.locked = false;
     }
     // Check if deletable
     if (split.length > 7) {
       if (split[7].equalsIgnoreCase("true")) {
         this.purgeProtected = true;
       } else {
         this.purgeProtected = false;
       }
     } else {
       this.purgeProtected = false;
     }
     if (!split[5].equals("null")) {
       if (split[5].equals("spawn")) {
         isSpawn = true;
         // Try to get the spawn point
         if (split.length > 8) {
           // plugin.getLogger().info("DEBUG: " + serial.substring(serial.indexOf(":SP:") + 4));
           spawnPoint = Util.getLocationString(serial.substring(serial.indexOf(":SP:") + 4));
         }
       } else {
         owner = UUID.fromString(split[5]);
       }
     }
     // Check if protection options there
     if (!isSpawn) {
       // plugin.getLogger().info("DEBUG: NOT SPAWN owner is " + owner + " location " + center);
       if (split.length > 8 && split[8].length() == 29) {
         // Parse the 8th string into island guard protection settings
         int index = 0;
         // Run through the enum and set
         for (Flags f : Flags.values()) {
           this.igs.put(f, split[8].charAt(index++) == '1' ? true : false);
         }
       } else {
         // plugin.getLogger().info("DEBUG: Setting default protection items");
         // Manually set to defaults
         this.igs.put(Flags.allowAnvilUse, Settings.allowAnvilUse);
         this.igs.put(Flags.allowArmorStandUse, Settings.allowArmorStandUse);
         this.igs.put(Flags.allowBeaconAccess, Settings.allowBeaconAccess);
         this.igs.put(Flags.allowBedUse, Settings.allowBedUse);
         this.igs.put(Flags.allowBreakBlocks, Settings.allowBreakBlocks);
         this.igs.put(Flags.allowBreeding, Settings.allowBreeding);
         this.igs.put(Flags.allowBrewing, Settings.allowBrewing);
         this.igs.put(Flags.allowBucketUse, Settings.allowBucketUse);
         this.igs.put(Flags.allowChestAccess, Settings.allowChestAccess);
         this.igs.put(Flags.allowCrafting, Settings.allowCrafting);
         this.igs.put(Flags.allowCropTrample, Settings.allowCropTrample);
         this.igs.put(Flags.allowDoorUse, Settings.allowDoorUse);
         this.igs.put(Flags.allowEnchanting, Settings.allowEnchanting);
         this.igs.put(Flags.allowEnderPearls, Settings.allowEnderPearls);
         this.igs.put(Flags.allowFurnaceUse, Settings.allowFurnaceUse);
         this.igs.put(Flags.allowGateUse, Settings.allowGateUse);
         this.igs.put(Flags.allowHorseInvAccess, Settings.allowHorseInvAccess);
         this.igs.put(Flags.allowHorseRiding, Settings.allowHorseRiding);
         this.igs.put(Flags.allowHurtMobs, Settings.allowHurtMobs);
         this.igs.put(Flags.allowLeashUse, Settings.allowLeashUse);
         this.igs.put(Flags.allowLeverButtonUse, Settings.allowLeverButtonUse);
         this.igs.put(Flags.allowMusic, Settings.allowMusic);
         this.igs.put(Flags.allowPlaceBlocks, Settings.allowPlaceBlocks);
         this.igs.put(Flags.allowPortalUse, Settings.allowPortalUse);
         this.igs.put(Flags.allowPressurePlate, Settings.allowPressurePlate);
         this.igs.put(Flags.allowPvP, Settings.allowPvP);
         this.igs.put(Flags.allowNetherPvP, Settings.allowNetherPvP);
         this.igs.put(Flags.allowRedStone, Settings.allowRedStone);
         this.igs.put(Flags.allowShearing, Settings.allowShearing);
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
 }