diff --git a/pom.xml b/pom.xml
index 5a5b7ee0a..be212eda9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,28 +6,16 @@
2.0.0-b${env.BUILD_NUMBER}
Ultimate Skyblock
-
- bukkit-repo
- http://repo.bukkit.org/content/groups/public/
-
-
- bukkit-maven
- http://repo.bukkit.org/content/repositories/releases/
-
- true
-
-
-
+
+ vault-repo
+ http://nexus.theyeticave.net/content/repositories/public/
+
+
sk89q-mvn2
http://mvn2.sk89q.com/repo
-
-
-
- addstar-repo
- http://maven.addstar.com.au/artifactory/ext-release-local
-
+
uSkyBlock
@@ -62,18 +50,25 @@
org.bukkit
bukkit
- 1.7.9-R0.2
+ 1.8-R0.1-SNAPSHOT
true
+ system
+ ${env.SPIGOT_BASE}/Bukkit/target/Bukkit-1.8-R0.1-SNAPSHOT.jar
- net.milkbowl
- vault
- 1.2.12
+ net.milkbowl.vault
+ Vault
+ 1.4.2-SNAPSHOT
+
+ net.milkbowl.vault
+ VaultAPI
+ 1.4
+
com.sk89q
worldedit
- LATEST
+ 6.0.0-SNAPSHOT
compile
jar
true
@@ -81,7 +76,7 @@
com.sk89q
worldguard
- LATEST
+ 6.0.0-SNAPSHOT
compile
jar
true
diff --git a/src/us/talabrek/ultimateskyblock/Challenge.java b/src/us/talabrek/ultimateskyblock/Challenge.java
index d71d61b40..f21b4bebd 100644
--- a/src/us/talabrek/ultimateskyblock/Challenge.java
+++ b/src/us/talabrek/ultimateskyblock/Challenge.java
@@ -2,66 +2,58 @@
public class Challenge
{
- private String name;
- private long firstCompleted;
- private int timesCompleted;
- private int timesCompletedSinceTimer;
-
- public Challenge(String name)
- {
- this.name = name;
- this.firstCompleted = 0L;
- this.timesCompleted = 0;
- }
-
- public Challenge(String name, long firstCompleted, int timesCompleted, int timesCompletedSinceTimer)
- {
- this.name = name;
- this.firstCompleted = firstCompleted;
- this.timesCompleted = timesCompleted;
- this.timesCompletedSinceTimer = timesCompletedSinceTimer;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public long getFirstCompleted()
- {
- return this.firstCompleted;
- }
-
- public int getTimesCompleted()
- {
- return this.timesCompleted;
- }
-
- public int getTimesCompletedSinceTimer()
- {
- return this.timesCompletedSinceTimer;
- }
-
- public void setFirstCompleted(long newCompleted)
- {
- this.firstCompleted = newCompleted;
- this.timesCompletedSinceTimer = 0;
- }
-
- public void setTimesCompleted(int newCompleted)
- {
- this.timesCompleted = newCompleted;
- this.timesCompletedSinceTimer = newCompleted;
- }
-
- public void addTimesCompleted()
- {
- this.timesCompleted += 1;
- this.timesCompletedSinceTimer += 1;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
+ private String name;
+ private long firstCompleted;
+ private int timesCompleted;
+ private int timesCompletedSinceTimer;
+
+ public Challenge(final String name) {
+ super();
+ this.name = name;
+ this.firstCompleted = 0L;
+ this.timesCompleted = 0;
+ }
+
+ public Challenge(final String name, final long firstCompleted, final int timesCompleted, final int timesCompletedSinceTimer) {
+ super();
+ this.name = name;
+ this.firstCompleted = firstCompleted;
+ this.timesCompleted = timesCompleted;
+ this.timesCompletedSinceTimer = timesCompletedSinceTimer;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public long getFirstCompleted() {
+ return this.firstCompleted;
+ }
+
+ public int getTimesCompleted() {
+ return this.timesCompleted;
+ }
+
+ public int getTimesCompletedSinceTimer() {
+ return this.timesCompletedSinceTimer;
+ }
+
+ public void setFirstCompleted(final long newCompleted) {
+ this.firstCompleted = newCompleted;
+ this.timesCompletedSinceTimer = 0;
+ }
+
+ public void setTimesCompleted(final int newCompleted) {
+ this.timesCompleted = newCompleted;
+ this.timesCompletedSinceTimer = newCompleted;
+ }
+
+ public void addTimesCompleted() {
+ ++this.timesCompleted;
+ ++this.timesCompletedSinceTimer;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
}
diff --git a/src/us/talabrek/ultimateskyblock/ChallengesCommand.java b/src/us/talabrek/ultimateskyblock/ChallengesCommand.java
index 2270a8472..90b137eb7 100644
--- a/src/us/talabrek/ultimateskyblock/ChallengesCommand.java
+++ b/src/us/talabrek/ultimateskyblock/ChallengesCommand.java
@@ -1,111 +1,84 @@
package us.talabrek.ultimateskyblock;
-import java.util.HashMap;
-import net.milkbowl.vault.economy.Economy;
-import org.bukkit.ChatColor;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
+import org.bukkit.command.*;
+import org.bukkit.entity.*;
+import org.bukkit.*;
-public class ChallengesCommand
- implements CommandExecutor
+public class ChallengesCommand implements CommandExecutor
{
- public ChallengesCommand() {}
-
- public boolean onCommand(CommandSender sender, Command command, String label, String[] split)
- {
- if (!(sender instanceof Player)) {
- return false;
- }
- Player player = sender.getServer().getPlayer(sender.getName());
- if (!Settings.challenges_allowChallenges) {
- return true;
- }
- if ((!VaultHandler.checkPerk(player.getName(), "usb.island.challenges", player.getWorld())) && (!player.isOp()))
- {
- player.sendMessage(ChatColor.RED + "You don't have access to this command!");
- return true;
- }
- if (!player.getWorld().getName().equalsIgnoreCase(Settings.general_worldName))
- {
- player.sendMessage(ChatColor.RED + "You can only submit challenges in the skyblock world!");
- return true;
- }
- if (split.length == 0) {
- player.openInventory(uSkyBlock.getInstance().displayChallengeGUI(player));
- } else if (split.length == 1)
- {
- if ((split[0].equalsIgnoreCase("help")) || (split[0].equalsIgnoreCase("complete")) || (split[0].equalsIgnoreCase("c")))
- {
- sender.sendMessage(ChatColor.YELLOW + "Use /c to view information about a challenge.");
- sender.sendMessage(ChatColor.YELLOW + "Use /c complete to attempt to complete that challenge.");
- sender.sendMessage(ChatColor.YELLOW + "Challenges will have different colors depending on if they are:");
- sender.sendMessage(Settings.challenges_challengeColor.replace('&', '§') + "Incomplete " + Settings.challenges_finishedColor.replace('&', '§') + "Completed(not repeatable) " + Settings.challenges_repeatableColor.replace('&', '§') + "Completed(repeatable) ");
- }
- else if (uSkyBlock.getInstance().isRankAvailable(player, uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".rankLevel")))
- {
- sender.sendMessage(ChatColor.YELLOW + "Challenge Name: " + ChatColor.WHITE + split[0].toLowerCase());
- sender.sendMessage(ChatColor.YELLOW + uSkyBlock.getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".description").toString()));
- if (uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".type").equalsIgnoreCase("onPlayer"))
- {
- if (uSkyBlock.getInstance().getConfig().getBoolean("options.challenges.challengeList." + split[0].toLowerCase() + ".takeItems")) {
- sender.sendMessage(ChatColor.RED + "You will lose all required items when you complete this challenge!");
- }
- }
- else if (uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".type").equalsIgnoreCase("onIsland")) {
- sender.sendMessage(ChatColor.RED + "All required items must be placed on your island!");
+ public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] split) {
+ if (!(sender instanceof Player)) {
+ return false;
}
- if (Settings.challenges_ranks.length > 1) {
- sender.sendMessage(ChatColor.YELLOW + "Rank: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".rankLevel").toString()));
+ final Player player = sender.getServer().getPlayer(sender.getName());
+ if (!Settings.challenges_allowChallenges) {
+ return true;
}
- if ((((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName())).checkChallenge(split[0].toLowerCase()) > 0) && ((!uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".type").equalsIgnoreCase("onPlayer")) || (!uSkyBlock.getInstance().getConfig().getBoolean("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatable"))))
- {
- sender.sendMessage(ChatColor.RED + "This Challenge is not repeatable!");
- return true;
+ if (!VaultHandler.checkPerk(player.getName(), "usb.island.challenges", player.getWorld()) && !player.isOp()) {
+ player.sendMessage(ChatColor.RED + "You don't have access to this command!");
+ return true;
}
- if ((Settings.challenges_enableEconomyPlugin) && (VaultHandler.econ != null))
- {
- if (((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName())).checkChallenge(split[0].toLowerCase()) > 0)
- {
- sender.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".repeatRewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".repeatXpReward").toString()));
- sender.sendMessage(ChatColor.YELLOW + "Repeat currency reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".repeatCurrencyReward").toString()) + " " + VaultHandler.econ.currencyNamePlural());
- }
- else
- {
- sender.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".rewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".xpReward").toString()));
- sender.sendMessage(ChatColor.YELLOW + "Currency reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".currencyReward").toString()) + " " + VaultHandler.econ.currencyNamePlural());
- }
+ if (!player.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
+ player.sendMessage(ChatColor.RED + "You can only submit challenges in the skyblock world!");
+ return true;
}
- else if (((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName())).checkChallenge(split[0].toLowerCase()) > 0)
- {
- sender.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".repeatRewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".repeatXpReward").toString()));
+ if (split.length == 0) {
+ player.openInventory(uSkyBlock.getInstance().displayChallengeGUI(player));
}
- else
- {
- sender.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".rewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(split[0].toLowerCase()).append(".xpReward").toString()));
+ else if (split.length == 1) {
+ if (split[0].equalsIgnoreCase("help") || split[0].equalsIgnoreCase("complete") || split[0].equalsIgnoreCase("c")) {
+ sender.sendMessage(ChatColor.YELLOW + "Use /c to view information about a challenge.");
+ sender.sendMessage(ChatColor.YELLOW + "Use /c complete to attempt to complete that challenge.");
+ sender.sendMessage(ChatColor.YELLOW + "Challenges will have different colors depending on if they are:");
+ sender.sendMessage(String.valueOf(Settings.challenges_challengeColor.replace('&', '§')) + "Incomplete " + Settings.challenges_finishedColor.replace('&', '§') + "Completed(not repeatable) " + Settings.challenges_repeatableColor.replace('&', '§') + "Completed(repeatable) ");
+ }
+ else if (uSkyBlock.getInstance().isRankAvailable(player, uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".rankLevel"))) {
+ sender.sendMessage(ChatColor.YELLOW + "Challenge Name: " + ChatColor.WHITE + split[0].toLowerCase());
+ sender.sendMessage(ChatColor.YELLOW + uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".description"));
+ if (uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".type").equalsIgnoreCase("onPlayer")) {
+ if (uSkyBlock.getInstance().getConfig().getBoolean("options.challenges.challengeList." + split[0].toLowerCase() + ".takeItems")) {
+ sender.sendMessage(ChatColor.RED + "You will lose all required items when you complete this challenge!");
+ }
+ }
+ else if (uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".type").equalsIgnoreCase("onIsland")) {
+ sender.sendMessage(ChatColor.RED + "All required items must be placed on your island!");
+ }
+ if (Settings.challenges_ranks.length > 1) {
+ sender.sendMessage(ChatColor.YELLOW + "Rank: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".rankLevel"));
+ }
+ if (uSkyBlock.getInstance().getActivePlayers().get(player.getName()).checkChallenge(split[0].toLowerCase()) > 0 && (!uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".type").equalsIgnoreCase("onPlayer") || !uSkyBlock.getInstance().getConfig().getBoolean("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatable"))) {
+ sender.sendMessage(ChatColor.RED + "This Challenge is not repeatable!");
+ return true;
+ }
+ if (Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null) {
+ if (uSkyBlock.getInstance().getActivePlayers().get(player.getName()).checkChallenge(split[0].toLowerCase()) > 0) {
+ sender.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatRewardText").replace('&', '§'));
+ player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatXpReward"));
+ sender.sendMessage(ChatColor.YELLOW + "Repeat currency reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatCurrencyReward") + " " + VaultHandler.econ.currencyNamePlural());
+ }
+ else {
+ sender.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".rewardText").replace('&', '§'));
+ player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + split[0].toLowerCase() + ".xpReward"));
+ sender.sendMessage(ChatColor.YELLOW + "Currency reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + split[0].toLowerCase() + ".currencyReward") + " " + VaultHandler.econ.currencyNamePlural());
+ }
+ }
+ else if (uSkyBlock.getInstance().getActivePlayers().get(player.getName()).checkChallenge(split[0].toLowerCase()) > 0) {
+ sender.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatRewardText").replace('&', '§'));
+ player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + split[0].toLowerCase() + ".repeatXpReward"));
+ }
+ else {
+ sender.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getString("options.challenges.challengeList." + split[0].toLowerCase() + ".rewardText").replace('&', '§'));
+ player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + split[0].toLowerCase() + ".xpReward"));
+ }
+ sender.sendMessage(ChatColor.YELLOW + "To complete this challenge, use " + ChatColor.WHITE + "/c c " + split[0].toLowerCase());
+ }
+ else {
+ sender.sendMessage(ChatColor.RED + "Invalid challenge name! Use /c help for more information");
+ }
}
- sender.sendMessage(ChatColor.YELLOW + "To complete this challenge, use " + ChatColor.WHITE + "/c c " + split[0].toLowerCase());
- }
- else
- {
- sender.sendMessage(ChatColor.RED + "Invalid challenge name! Use /c help for more information");
- }
- }
- else if (split.length == 2) {
- if ((split[0].equalsIgnoreCase("complete")) || (split[0].equalsIgnoreCase("c"))) {
- if (uSkyBlock.getInstance().checkIfCanCompleteChallenge(player, split[1].toLowerCase())) {
- uSkyBlock.getInstance().giveReward(player, split[1].toLowerCase());
+ else if (split.length == 2 && (split[0].equalsIgnoreCase("complete") || split[0].equalsIgnoreCase("c")) && uSkyBlock.getInstance().checkIfCanCompleteChallenge(player, split[1].toLowerCase())) {
+ uSkyBlock.getInstance().giveReward(player, split[1].toLowerCase());
}
- }
+ return true;
}
- return true;
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/DevCommand.java b/src/us/talabrek/ultimateskyblock/DevCommand.java
index ce860bd07..cc41ecad5 100644
--- a/src/us/talabrek/ultimateskyblock/DevCommand.java
+++ b/src/us/talabrek/ultimateskyblock/DevCommand.java
@@ -1,359 +1,338 @@
-package us.talabrek.ultimateskyblock;
-
-import java.util.HashMap;
-import org.bukkit.ChatColor;
-import org.bukkit.Server;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.scheduler.BukkitScheduler;
-
-public class DevCommand
- implements CommandExecutor
-{
- public DevCommand() {}
-
- public boolean onCommand(CommandSender sender, Command command, String label, String[] split)
- {
- if (!(sender instanceof Player)) {
- return false;
- }
- Player player = (Player)sender;
- if (split.length == 0)
- {
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.protect", player.getWorld())) || (VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld())) ||
- (VaultHandler.checkPerk(player.getName(), "usb.mod.topten", player.getWorld())) || (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) ||
- (VaultHandler.checkPerk(player.getName(), "usb.admin.delete", player.getWorld())) || (VaultHandler.checkPerk(player.getName(), "usb.admin.remove", player.getWorld())) ||
- (VaultHandler.checkPerk(player.getName(), "usb.admin.register", player.getWorld())) || (player.isOp()))
- {
- player.sendMessage("[dev usage]");
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.protect", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev protect :" + ChatColor.WHITE + " add protection to an island.");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.admin.reload", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev reload:" + ChatColor.WHITE + " reload configuration from file.");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev protectall:" + ChatColor.WHITE + " add island protection to unprotected islands.");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.topten", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev topten:" + ChatColor.WHITE + " manually update the top 10 list");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev orphancount:" + ChatColor.WHITE + " unused island locations count");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev clearorphan:" + ChatColor.WHITE + " remove any unused island locations.");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev saveorphan:" + ChatColor.WHITE + " save the list of old (empty) island locations.");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.admin.delete", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev delete :" + ChatColor.WHITE + " delete an island (removes blocks).");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.admin.remove", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev remove :" + ChatColor.WHITE + " remove a player from an island.");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.admin.register", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev register :" + ChatColor.WHITE + " set a player's island to your location");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev completechallenge :" + ChatColor.WHITE + " marks a challenge as complete");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev resetchallenge :" + ChatColor.WHITE + " marks a challenge as incomplete");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev resetallchallenges :" + ChatColor.WHITE + " resets all of the player's challenges");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.admin.purge", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev purge [TimeInDays]:" + ChatColor.WHITE + " delete inactive islands older than [TimeInDays].");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev buildpartylist:" + ChatColor.WHITE + " build a new party list (use this if parties are broken).");
- }
- if ((VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) || (player.isOp())) {
- player.sendMessage(ChatColor.YELLOW + "/dev info :" + ChatColor.WHITE + " check the party information for the given player.");
- }
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You don't have permission to use this command.");
- }
- }
- else if (split.length == 1)
- {
- if ((split[0].equals("clearorphan")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) || (player.isOp())))
- {
- player.sendMessage(ChatColor.YELLOW + "Clearing all old (empty) island locations.");
- uSkyBlock.getInstance().clearOrphanedIsland();
- }
- else if ((split[0].equals("protectall")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld())) || (player.isOp())))
- {
- player.sendMessage(ChatColor.YELLOW + "This command is only available using WorldGuard.");
- if (Settings.island_protectWithWorldGuard) {
- player.sendMessage(ChatColor.YELLOW + "This command has been disabled.");
- } else {
- player.sendMessage(ChatColor.RED + "You must enable WorldGuard protection in the config.yml to use this!");
- }
- }
- else if ((split[0].equals("buildislandlist")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld())) || (player.isOp())))
- {
- player.sendMessage(ChatColor.YELLOW + "Building island list..");
- uSkyBlock.getInstance().buildIslandList();
- player.sendMessage(ChatColor.YELLOW + "Finished building island list..");
- }
- else if ((split[0].equals("orphancount")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) || (player.isOp())))
- {
- player.sendMessage(ChatColor.YELLOW + uSkyBlock.getInstance().orphanCount() + " old island locations will be used before new ones.");
- }
- else if ((split[0].equals("reload")) && ((VaultHandler.checkPerk(player.getName(), "usb.admin.reload", player.getWorld())) || (player.isOp())))
- {
- uSkyBlock.getInstance().reloadConfig();
- uSkyBlock.getInstance().loadPluginConfig();
- uSkyBlock.getInstance().reloadLevelConfig();
- uSkyBlock.getInstance().loadLevelConfig();
- player.sendMessage(ChatColor.YELLOW + "Configuration reloaded from file.");
- }
- else if ((split[0].equals("saveorphan")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld())) || (player.isOp())))
- {
- player.sendMessage(ChatColor.YELLOW + "Saving the orphan list.");
- uSkyBlock.getInstance().saveOrphans();
- }
- else if ((split[0].equals("topten")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.topten", player.getWorld())) || (player.isOp())))
- {
- player.sendMessage(ChatColor.YELLOW + "Generating the Top Ten list");
- uSkyBlock.getInstance().updateTopTen(uSkyBlock.getInstance().generateTopTen());
- player.sendMessage(ChatColor.YELLOW + "Finished generation of the Top Ten list");
- }
- else if ((split[0].equals("purge")) && ((VaultHandler.checkPerk(player.getName(), "usb.admin.purge", player.getWorld())) || (player.isOp())))
- {
- if (uSkyBlock.getInstance().isPurgeActive())
- {
- player.sendMessage(ChatColor.RED + "A purge is already running, please wait for it to finish!");
- return true;
- }
- player.sendMessage(ChatColor.YELLOW + "Usage: /dev purge [TimeInDays]");
- return true;
- }
- }
- else if (split.length == 2)
- {
- if ((split[0].equals("purge")) && ((VaultHandler.checkPerk(player.getName(), "usb.admin.purge", player.getWorld())) || (player.isOp())))
- {
- if (uSkyBlock.getInstance().isPurgeActive())
- {
- player.sendMessage(ChatColor.RED + "A purge is already running, please wait for it to finish!");
- return true;
- }
- uSkyBlock.getInstance().activatePurge();
- int time = Integer.parseInt(split[1]) * 24;
- player.sendMessage(ChatColor.YELLOW + "Marking all islands inactive for more than " + split[1] + " days.");
- uSkyBlock.getInstance().getServer().getScheduler().runTaskAsynchronously(uSkyBlock.getInstance(), new DevCommand.1(this, time));
- }
- else if ((split[0].equals("goto")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.goto", player.getWorld())) || (player.isOp())))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- }
- else
- {
- if (pi.getHomeLocation() != null)
- {
- player.sendMessage(ChatColor.GREEN + "Teleporting to " + split[1] + "'s island.");
- player.teleport(pi.getHomeLocation());
- return true;
- }
- if (pi.getIslandLocation() != null)
- {
- player.sendMessage(ChatColor.GREEN + "Teleporting to " + split[1] + "'s island.");
- player.teleport(pi.getIslandLocation());
- return true;
- }
- player.sendMessage("Error: That player does not have an island!");
- }
- }
- else if ((split[0].equals("remove")) && ((VaultHandler.checkPerk(player.getName(), "usb.admin.remove", player.getWorld())) || (player.isOp())))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- }
- else
- {
- if (pi.getIslandLocation() != null)
- {
- player.sendMessage(ChatColor.YELLOW + "Removing " + split[1] + "'s island.");
- uSkyBlock.getInstance().devDeletePlayerIsland(split[1]);
- return true;
- }
- player.sendMessage("Error: That player does not have an island!");
- }
- }
- else if ((split[0].equals("delete")) && ((VaultHandler.checkPerk(player.getName(), "usb.admin.delete", player.getWorld())) || (player.isOp())))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- }
- else
- {
- if (pi.getIslandLocation() != null)
- {
- player.sendMessage(ChatColor.YELLOW + "Removing " + split[1] + "'s island.");
- uSkyBlock.getInstance().deletePlayerIsland(split[1]);
- return true;
- }
- player.sendMessage("Error: That player does not have an island!");
- }
- }
- else if ((split[0].equals("register")) && ((VaultHandler.checkPerk(player.getName(), "usb.admin.register", player.getWorld())) || (player.isOp())))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (pi.getHasIsland()) {
- uSkyBlock.getInstance().devDeletePlayerIsland(split[1]);
- }
- if (uSkyBlock.getInstance().devSetPlayerIsland(player, player.getLocation(), split[1])) {
- player.sendMessage(ChatColor.GREEN + "Set " + split[1] + "'s island to the bedrock nearest you.");
- } else {
- player.sendMessage(ChatColor.RED + "Bedrock not found: unable to set the island!");
- }
- }
- else if ((!split[0].equals("info")) || ((!VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) && (!player.isOp())))
- {
- if ((split[0].equals("resetallchallenges")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld())) || (player.isOp())))
- {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1]))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- return true;
- }
- pi.resetAllChallenges();
- pi.savePlayerConfig(split[1]);
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had all challenges reset.");
- }
- else
- {
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[1])).resetAllChallenges();
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had all challenges reset.");
- }
- }
- else if ((split[0].equals("setbiome")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.setbiome", player.getWorld())) || (player.isOp()))) {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1]))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- return true;
- }
- uSkyBlock.getInstance().setBiome(pi.getIslandLocation(), "OCEAN");
- pi.savePlayerConfig(split[1]);
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
- }
- else
- {
- uSkyBlock.getInstance().setBiome(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[1])).getIslandLocation(), "OCEAN");
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
- }
- }
- }
- }
- else if (split.length == 3) {
- if ((split[0].equals("completechallenge")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld())) || (player.isOp())))
- {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[2]))
- {
- PlayerInfo pi = new PlayerInfo(split[2]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- return true;
- }
- if ((pi.checkChallenge(split[1].toLowerCase()) > 0) || (!pi.challengeExists(split[1].toLowerCase())))
- {
- player.sendMessage(ChatColor.RED + "Challenge doesn't exist or is already completed");
- return true;
- }
- pi.completeChallenge(split[1].toLowerCase());
- pi.savePlayerConfig(split[2]);
- player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been completed for " + split[2]);
- }
- else
- {
- if ((((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[2])).checkChallenge(split[1].toLowerCase()) > 0) || (!((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[2])).challengeExists(split[1].toLowerCase())))
- {
- player.sendMessage(ChatColor.RED + "Challenge doesn't exist or is already completed");
- return true;
- }
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[2])).completeChallenge(split[1].toLowerCase());
- player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been completed for " + split[2]);
- }
- }
- else if ((split[0].equals("resetchallenge")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld())) || (player.isOp())))
- {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[2]))
- {
- PlayerInfo pi = new PlayerInfo(split[2]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- return true;
- }
- if ((pi.checkChallenge(split[1].toLowerCase()) == 0) || (!pi.challengeExists(split[1].toLowerCase())))
- {
- player.sendMessage(ChatColor.RED + "Challenge doesn't exist or isn't yet completed");
- return true;
- }
- pi.resetChallenge(split[1].toLowerCase());
- pi.savePlayerConfig(split[2]);
- player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been reset for " + split[2]);
- }
- else
- {
- if ((((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[2])).checkChallenge(split[1].toLowerCase()) == 0) || (!((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[2])).challengeExists(split[1].toLowerCase())))
- {
- player.sendMessage(ChatColor.RED + "Challenge doesn't exist or isn't yet completed");
- return true;
- }
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[2])).resetChallenge(split[1].toLowerCase());
- player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been completed for " + split[2]);
- }
- }
- else if ((split[0].equals("setbiome")) && ((VaultHandler.checkPerk(player.getName(), "usb.mod.setbiome", player.getWorld())) || (player.isOp()))) {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1]))
- {
- PlayerInfo pi = new PlayerInfo(split[1]);
- if (!pi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
- return true;
- }
- if (uSkyBlock.getInstance().setBiome(pi.getIslandLocation(), split[2])) {
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to " + split[2].toUpperCase() + ".");
- } else {
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
- }
- pi.savePlayerConfig(split[1]);
- }
- else if (uSkyBlock.getInstance().setBiome(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[1])).getIslandLocation(), split[2]))
- {
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to " + split[2].toUpperCase() + ".");
- }
- else
- {
- player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
- }
- }
- }
- return true;
- }
-}
+package us.talabrek.ultimateskyblock;
+
+import org.bukkit.command.*;
+import org.bukkit.entity.*;
+import java.io.*;
+import org.bukkit.plugin.*;
+import org.bukkit.*;
+
+public class DevCommand implements CommandExecutor
+{
+ public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] split) {
+ if (!(sender instanceof Player)) {
+ return false;
+ }
+ final Player player = (Player)sender;
+ if (split.length == 0) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.protect", player.getWorld()) || VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld()) || VaultHandler.checkPerk(player.getName(), "usb.mod.topten", player.getWorld()) || VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || VaultHandler.checkPerk(player.getName(), "usb.admin.delete", player.getWorld()) || VaultHandler.checkPerk(player.getName(), "usb.admin.remove", player.getWorld()) || VaultHandler.checkPerk(player.getName(), "usb.admin.register", player.getWorld()) || player.isOp()) {
+ player.sendMessage("[dev usage]");
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.protect", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev protect :" + ChatColor.WHITE + " add protection to an island.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.admin.reload", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev reload:" + ChatColor.WHITE + " reload configuration from file.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev protectall:" + ChatColor.WHITE + " add island protection to unprotected islands.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.topten", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev topten:" + ChatColor.WHITE + " manually update the top 10 list");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev orphancount:" + ChatColor.WHITE + " unused island locations count");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev clearorphan:" + ChatColor.WHITE + " remove any unused island locations.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev saveorphan:" + ChatColor.WHITE + " save the list of old (empty) island locations.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.admin.delete", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev delete :" + ChatColor.WHITE + " delete an island (removes blocks).");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.admin.remove", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev remove :" + ChatColor.WHITE + " remove a player from an island.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.admin.register", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev register :" + ChatColor.WHITE + " set a player's island to your location");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev completechallenge :" + ChatColor.WHITE + " marks a challenge as complete");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev resetchallenge :" + ChatColor.WHITE + " marks a challenge as incomplete");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev resetallchallenges :" + ChatColor.WHITE + " resets all of the player's challenges");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.admin.purge", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev purge [TimeInDays]:" + ChatColor.WHITE + " delete inactive islands older than [TimeInDays].");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev buildpartylist:" + ChatColor.WHITE + " build a new party list (use this if parties are broken).");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld()) || player.isOp()) {
+ player.sendMessage(ChatColor.YELLOW + "/dev info :" + ChatColor.WHITE + " check the party information for the given player.");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You don't have permission to use this command.");
+ }
+ }
+ else if (split.length == 1) {
+ if (split[0].equals("clearorphan") && (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || player.isOp())) {
+ player.sendMessage(ChatColor.YELLOW + "Clearing all old (empty) island locations.");
+ uSkyBlock.getInstance().clearOrphanedIsland();
+ }
+ else if (split[0].equals("protectall") && (VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld()) || player.isOp())) {
+ player.sendMessage(ChatColor.YELLOW + "This command is only available using WorldGuard.");
+ if (Settings.island_protectWithWorldGuard) {
+ player.sendMessage(ChatColor.YELLOW + "This command has been disabled.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You must enable WorldGuard protection in the config.yml to use this!");
+ }
+ }
+ else if (split[0].equals("buildislandlist") && (VaultHandler.checkPerk(player.getName(), "usb.mod.protectall", player.getWorld()) || player.isOp())) {
+ player.sendMessage(ChatColor.YELLOW + "Building island list..");
+ uSkyBlock.getInstance().buildIslandList();
+ player.sendMessage(ChatColor.YELLOW + "Finished building island list..");
+ }
+ else if (split[0].equals("orphancount") && (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || player.isOp())) {
+ player.sendMessage(new StringBuilder().append(ChatColor.YELLOW).append(uSkyBlock.getInstance().orphanCount()).append(" old island locations will be used before new ones.").toString());
+ }
+ else if (split[0].equals("reload") && (VaultHandler.checkPerk(player.getName(), "usb.admin.reload", player.getWorld()) || player.isOp())) {
+ uSkyBlock.getInstance().reloadConfig();
+ uSkyBlock.getInstance().loadPluginConfig();
+ uSkyBlock.getInstance().reloadLevelConfig();
+ uSkyBlock.getInstance().loadLevelConfig();
+ player.sendMessage(ChatColor.YELLOW + "Configuration reloaded from file.");
+ }
+ else if (split[0].equals("saveorphan") && (VaultHandler.checkPerk(player.getName(), "usb.mod.orphan", player.getWorld()) || player.isOp())) {
+ player.sendMessage(ChatColor.YELLOW + "Saving the orphan list.");
+ uSkyBlock.getInstance().saveOrphans();
+ }
+ else if (split[0].equals("topten") && (VaultHandler.checkPerk(player.getName(), "usb.mod.topten", player.getWorld()) || player.isOp())) {
+ player.sendMessage(ChatColor.YELLOW + "Generating the Top Ten list");
+ uSkyBlock.getInstance().updateTopTen(uSkyBlock.getInstance().generateTopTen());
+ player.sendMessage(ChatColor.YELLOW + "Finished generation of the Top Ten list");
+ }
+ else if (split[0].equals("purge") && (VaultHandler.checkPerk(player.getName(), "usb.admin.purge", player.getWorld()) || player.isOp())) {
+ if (uSkyBlock.getInstance().isPurgeActive()) {
+ player.sendMessage(ChatColor.RED + "A purge is already running, please wait for it to finish!");
+ return true;
+ }
+ player.sendMessage(ChatColor.YELLOW + "Usage: /dev purge [TimeInDays]");
+ return true;
+ }
+ }
+ else if (split.length == 2) {
+ if (split[0].equals("purge") && (VaultHandler.checkPerk(player.getName(), "usb.admin.purge", player.getWorld()) || player.isOp())) {
+ if (uSkyBlock.getInstance().isPurgeActive()) {
+ player.sendMessage(ChatColor.RED + "A purge is already running, please wait for it to finish!");
+ return true;
+ }
+ uSkyBlock.getInstance().activatePurge();
+ final int time = Integer.parseInt(split[1]) * 24;
+ player.sendMessage(ChatColor.YELLOW + "Marking all islands inactive for more than " + split[1] + " days.");
+ uSkyBlock.getInstance().getServer().getScheduler().runTaskAsynchronously((Plugin)uSkyBlock.getInstance(), (Runnable)new Runnable() {
+ @Override
+ public void run() {
+ final File directoryPlayers = new File(uSkyBlock.getInstance().getDataFolder() + File.separator + "players");
+ long offlineTime = 0L;
+ File[] listFiles;
+ for (int length = (listFiles = directoryPlayers.listFiles()).length, i = 0; i < length; ++i) {
+ final File child = listFiles[i];
+ if (Bukkit.getOfflinePlayer(child.getName()) != null && Bukkit.getPlayer(child.getName()) == null) {
+ final OfflinePlayer oplayer = Bukkit.getOfflinePlayer(child.getName());
+ offlineTime = oplayer.getLastPlayed();
+ offlineTime = (System.currentTimeMillis() - offlineTime) / 3600000L;
+ if (offlineTime > time && uSkyBlock.getInstance().hasIsland(oplayer.getName())) {
+ final PlayerInfo pi = new PlayerInfo(oplayer.getName());
+ if (pi.getHasIsland()) {
+ if (!pi.getHasParty()) {
+ if (uSkyBlock.getInstance().getTempIslandConfig(pi.locationForParty()) != null && uSkyBlock.getInstance().getTempIslandConfig(pi.locationForParty()).getInt("general.level") < 10 && child.getName() != null) {
+ uSkyBlock.getInstance().addToRemoveList(child.getName());
+ }
+ }
+ }
+ }
+ }
+ }
+ System.out.print("Removing " + uSkyBlock.getInstance().getRemoveList().size() + " inactive islands.");
+ uSkyBlock.getInstance().getServer().getScheduler().scheduleSyncRepeatingTask((Plugin)uSkyBlock.getInstance(), (Runnable)new Runnable() {
+ @Override
+ public void run() {
+ if (uSkyBlock.getInstance().getRemoveList().size() > 0 && uSkyBlock.getInstance().isPurgeActive()) {
+ uSkyBlock.getInstance().deletePlayerIsland(uSkyBlock.getInstance().getRemoveList().get(0));
+ System.out.print("[uSkyBlock] Purge: Removing " + uSkyBlock.getInstance().getRemoveList().get(0) + "'s island");
+ uSkyBlock.getInstance().deleteFromRemoveList();
+ }
+ if (uSkyBlock.getInstance().getRemoveList().size() == 0 && uSkyBlock.getInstance().isPurgeActive()) {
+ uSkyBlock.getInstance().deactivatePurge();
+ System.out.print("[uSkyBlock] Finished purging marked inactive islands.");
+ }
+ }
+ }, 0L, 20L);
+ }
+ });
+ }
+ else if (split[0].equals("goto") && (VaultHandler.checkPerk(player.getName(), "usb.mod.goto", player.getWorld()) || player.isOp())) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ }
+ else {
+ if (pi.getHomeLocation() != null) {
+ player.sendMessage(ChatColor.GREEN + "Teleporting to " + split[1] + "'s island.");
+ player.teleport(pi.getHomeLocation());
+ return true;
+ }
+ if (pi.getIslandLocation() != null) {
+ player.sendMessage(ChatColor.GREEN + "Teleporting to " + split[1] + "'s island.");
+ player.teleport(pi.getIslandLocation());
+ return true;
+ }
+ player.sendMessage("Error: That player does not have an island!");
+ }
+ }
+ else if (split[0].equals("remove") && (VaultHandler.checkPerk(player.getName(), "usb.admin.remove", player.getWorld()) || player.isOp())) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ }
+ else {
+ if (pi.getIslandLocation() != null) {
+ player.sendMessage(ChatColor.YELLOW + "Removing " + split[1] + "'s island.");
+ uSkyBlock.getInstance().devDeletePlayerIsland(split[1]);
+ return true;
+ }
+ player.sendMessage("Error: That player does not have an island!");
+ }
+ }
+ else if (split[0].equals("delete") && (VaultHandler.checkPerk(player.getName(), "usb.admin.delete", player.getWorld()) || player.isOp())) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ }
+ else {
+ if (pi.getIslandLocation() != null) {
+ player.sendMessage(ChatColor.YELLOW + "Removing " + split[1] + "'s island.");
+ uSkyBlock.getInstance().deletePlayerIsland(split[1]);
+ return true;
+ }
+ player.sendMessage("Error: That player does not have an island!");
+ }
+ }
+ else if (split[0].equals("register") && (VaultHandler.checkPerk(player.getName(), "usb.admin.register", player.getWorld()) || player.isOp())) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (pi.getHasIsland()) {
+ uSkyBlock.getInstance().devDeletePlayerIsland(split[1]);
+ }
+ if (uSkyBlock.getInstance().devSetPlayerIsland(player, player.getLocation(), split[1])) {
+ player.sendMessage(ChatColor.GREEN + "Set " + split[1] + "'s island to the bedrock nearest you.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "Bedrock not found: unable to set the island!");
+ }
+ }
+ else if (!split[0].equals("info") || (!VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld()) && !player.isOp())) {
+ if (split[0].equals("resetallchallenges") && (VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld()) || player.isOp())) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1])) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ return true;
+ }
+ pi.resetAllChallenges();
+ pi.savePlayerConfig(split[1]);
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had all challenges reset.");
+ }
+ else {
+ uSkyBlock.getInstance().getActivePlayers().get(split[1]).resetAllChallenges();
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had all challenges reset.");
+ }
+ }
+ else if (split[0].equals("setbiome") && (VaultHandler.checkPerk(player.getName(), "usb.mod.setbiome", player.getWorld()) || player.isOp())) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1])) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ return true;
+ }
+ uSkyBlock.getInstance().setBiome(pi.getIslandLocation(), "OCEAN");
+ pi.savePlayerConfig(split[1]);
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
+ }
+ else {
+ uSkyBlock.getInstance().setBiome(uSkyBlock.getInstance().getActivePlayers().get(split[1]).getIslandLocation(), "OCEAN");
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
+ }
+ }
+ }
+ }
+ else if (split.length == 3) {
+ if (split[0].equals("completechallenge") && (VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld()) || player.isOp())) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[2])) {
+ final PlayerInfo pi = new PlayerInfo(split[2]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ return true;
+ }
+ if (pi.checkChallenge(split[1].toLowerCase()) > 0 || !pi.challengeExists(split[1].toLowerCase())) {
+ player.sendMessage(ChatColor.RED + "Challenge doesn't exist or is already completed");
+ return true;
+ }
+ pi.completeChallenge(split[1].toLowerCase());
+ pi.savePlayerConfig(split[2]);
+ player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been completed for " + split[2]);
+ }
+ else {
+ if (uSkyBlock.getInstance().getActivePlayers().get(split[2]).checkChallenge(split[1].toLowerCase()) > 0 || !uSkyBlock.getInstance().getActivePlayers().get(split[2]).challengeExists(split[1].toLowerCase())) {
+ player.sendMessage(ChatColor.RED + "Challenge doesn't exist or is already completed");
+ return true;
+ }
+ uSkyBlock.getInstance().getActivePlayers().get(split[2]).completeChallenge(split[1].toLowerCase());
+ player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been completed for " + split[2]);
+ }
+ }
+ else if (split[0].equals("resetchallenge") && (VaultHandler.checkPerk(player.getName(), "usb.mod.challenges", player.getWorld()) || player.isOp())) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[2])) {
+ final PlayerInfo pi = new PlayerInfo(split[2]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ return true;
+ }
+ if (pi.checkChallenge(split[1].toLowerCase()) == 0 || !pi.challengeExists(split[1].toLowerCase())) {
+ player.sendMessage(ChatColor.RED + "Challenge doesn't exist or isn't yet completed");
+ return true;
+ }
+ pi.resetChallenge(split[1].toLowerCase());
+ pi.savePlayerConfig(split[2]);
+ player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been reset for " + split[2]);
+ }
+ else {
+ if (uSkyBlock.getInstance().getActivePlayers().get(split[2]).checkChallenge(split[1].toLowerCase()) == 0 || !uSkyBlock.getInstance().getActivePlayers().get(split[2]).challengeExists(split[1].toLowerCase())) {
+ player.sendMessage(ChatColor.RED + "Challenge doesn't exist or isn't yet completed");
+ return true;
+ }
+ uSkyBlock.getInstance().getActivePlayers().get(split[2]).resetChallenge(split[1].toLowerCase());
+ player.sendMessage(ChatColor.YELLOW + "challange: " + split[1].toLowerCase() + " has been completed for " + split[2]);
+ }
+ }
+ else if (split[0].equals("setbiome") && (VaultHandler.checkPerk(player.getName(), "usb.mod.setbiome", player.getWorld()) || player.isOp())) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1])) {
+ final PlayerInfo pi = new PlayerInfo(split[1]);
+ if (!pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "Error: Invalid Player (check spelling)");
+ return true;
+ }
+ if (uSkyBlock.getInstance().setBiome(pi.getIslandLocation(), split[2])) {
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to " + split[2].toUpperCase() + ".");
+ }
+ else {
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
+ }
+ pi.savePlayerConfig(split[1]);
+ }
+ else if (uSkyBlock.getInstance().setBiome(uSkyBlock.getInstance().getActivePlayers().get(split[1]).getIslandLocation(), split[2])) {
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to " + split[2].toUpperCase() + ".");
+ }
+ else {
+ player.sendMessage(ChatColor.YELLOW + split[1] + " has had their biome changed to OCEAN.");
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/src/us/talabrek/ultimateskyblock/IslandCommand.java b/src/us/talabrek/ultimateskyblock/IslandCommand.java
index 3880629f1..e449c5c01 100644
--- a/src/us/talabrek/ultimateskyblock/IslandCommand.java
+++ b/src/us/talabrek/ultimateskyblock/IslandCommand.java
@@ -1,963 +1,840 @@
package us.talabrek.ultimateskyblock;
-import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
-import com.sk89q.worldguard.protection.managers.RegionManager;
-import java.io.PrintStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Location;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.configuration.ConfigurationSection;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.PlayerInventory;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.scheduler.BukkitScheduler;
+import org.bukkit.command.*;
+import org.bukkit.entity.*;
+import java.util.*;
+import org.bukkit.plugin.*;
+import org.bukkit.*;
-public class IslandCommand
- implements CommandExecutor
+public class IslandCommand implements CommandExecutor
{
- public Location Islandlocation;
- private List banList;
- private String tempTargetPlayer;
- public boolean allowInfo = true;
- Set memberList = null;
- private HashMap inviteList = new HashMap();
- String tPlayer;
-
- public IslandCommand()
- {
- this.inviteList.put("NoInvited", "NoInviter");
- }
-
- public boolean onCommand(CommandSender sender, Command command, String label, String[] split)
- {
- if (!(sender instanceof Player)) {
- return false;
- }
- Player player = (Player)sender;
+ public Location Islandlocation;
+ private List banList;
+ private String tempTargetPlayer;
+ public boolean allowInfo;
+ Set memberList;
+ private HashMap inviteList;
+ String tPlayer;
-
-
-
-
-
-
- PlayerInfo pi = (PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName());
- if (pi == null)
- {
- player.sendMessage(ChatColor.RED + "Error: Couldn't read your player data!");
- return true;
- }
- String iName = "";
- if (pi.getIslandLocation() != null) {
- iName = pi.locationForParty();
- }
- if (split.length == 0)
- {
- uSkyBlock.getInstance().updatePartyNumber(player);
- player.openInventory(uSkyBlock.getInstance().displayIslandGUI(player));
-
-
-
-
-
-
- return true;
+ public IslandCommand() {
+ super();
+ this.allowInfo = true;
+ this.memberList = null;
+ (this.inviteList = new HashMap()).put("NoInvited", "NoInviter");
}
- if (split.length == 1)
- {
- if (((split[0].equals("restart")) || (split[0].equals("reset"))) && (pi.getIslandLocation() != null))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getInt("party.currentSize") > 1)
- {
- if (!uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader").equalsIgnoreCase(player.getName())) {
- player.sendMessage(ChatColor.RED + "Only the owner may restart this island. Leave this island in order to start your own (/island leave).");
- } else {
- player.sendMessage(ChatColor.YELLOW + "You must remove all players from your island before you can restart it (/island kick ). See a list of players currently part of your island using /island party.");
- }
- return true;
- }
- if ((!uSkyBlock.getInstance().onRestartCooldown(player)) || (Settings.general_cooldownRestart == 0))
- {
- uSkyBlock.getInstance().restartPlayerIsland(player, pi.getIslandLocation());
- uSkyBlock.getInstance().setRestartCooldown(player);
- return true;
- }
- player.sendMessage(ChatColor.YELLOW + "You can restart your island in " + uSkyBlock.getInstance().getRestartCooldownTime(player) / 1000L + " seconds.");
- return true;
- }
- if (((split[0].equals("sethome")) || (split[0].equals("tpset"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.island.sethome", player.getWorld())))
- {
- uSkyBlock.getInstance().homeSet(player);
- return true;
- }
- if (((split[0].equals("log")) || (split[0].equals("l"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.island.create", player.getWorld())))
- {
- player.openInventory(uSkyBlock.getInstance().displayLogGUI(player));
- return true;
- }
- if (((split[0].equals("create")) || (split[0].equals("c"))) && (VaultHandler.checkPerk(player.getName(), "usb.island.create", player.getWorld())))
- {
- if (pi.getIslandLocation() == null)
- {
- uSkyBlock.getInstance().createIsland(sender, pi);
- return true;
- }
- if ((pi.getIslandLocation().getBlockX() == 0) && (pi.getIslandLocation().getBlockY() == 0) && (pi.getIslandLocation().getBlockZ() == 0))
- {
- uSkyBlock.getInstance().createIsland(sender, pi);
- return true;
- }
- return true;
- }
- if (((split[0].equals("home")) || (split[0].equals("h"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.island.sethome", player.getWorld())))
- {
- if (pi.getHomeLocation() == null) {
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName())).setHomeLocation(pi.getIslandLocation());
- }
- uSkyBlock.getInstance().homeTeleport(player);
- return true;
- }
- if (((split[0].equals("setwarp")) || (split[0].equals("warpset"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld())))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canChangeWarp"))
- {
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " changed the island warp location.");
- uSkyBlock.getInstance().warpSet(player);
- }
- else
- {
- player.sendMessage("§cYou do not have permission to set your island's warp point!");
- }
- return true;
- }
- if ((split[0].equals("warp")) || (split[0].equals("w")))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld()))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.warpActive")) {
- player.sendMessage(ChatColor.GREEN + "Your incoming warp is active, players may warp to your island.");
- } else {
- player.sendMessage(ChatColor.RED + "Your incoming warp is inactive, players may not warp to your island.");
- }
- player.sendMessage(ChatColor.WHITE + "Set incoming warp to your current location using " + ChatColor.YELLOW + "/island setwarp");
- player.sendMessage(ChatColor.WHITE + "Toggle your warp on/off using " + ChatColor.YELLOW + "/island togglewarp");
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to create a warp on your island!");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.island.warp", player.getWorld())) {
- player.sendMessage(ChatColor.WHITE + "Warp to another island using " + ChatColor.YELLOW + "/island warp ");
- } else {
- player.sendMessage(ChatColor.RED + "You do not have permission to warp to other islands!");
- }
- return true;
- }
- if (((split[0].equals("togglewarp")) || (split[0].equals("tw"))) && (pi.getIslandLocation() != null))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld()))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleWarp"))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.warpActive"))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.locked"))
- {
- player.sendMessage(ChatColor.RED + "Your island is locked. You must unlock it before enabling your warp.");
- return true;
- }
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " activated the island warp.");
- uSkyBlock.getInstance().getIslandConfig(iName).set("general.warpActive", Boolean.valueOf(true));
- }
- else
- {
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " deactivated the island warp.");
- uSkyBlock.getInstance().getIslandConfig(iName).set("general.warpActive", Boolean.valueOf(false));
- }
- }
- else {
- player.sendMessage("§cYou do not have permission to enable/disable your island's warp!");
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "You do not have permission to create a warp on your island!");
- }
- uSkyBlock.getInstance().getActivePlayers().put(player.getName(), pi);
- return true;
- }
- if (((split[0].equals("ban")) || (split[0].equals("banned")) || (split[0].equals("banlist")) || (split[0].equals("b"))) && (pi.getIslandLocation() != null))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.island.ban", player.getWorld()))
- {
- player.sendMessage(ChatColor.YELLOW + "The following players are banned from warping to your island:");
- player.sendMessage(ChatColor.RED + getBanList(player));
- player.sendMessage(ChatColor.YELLOW + "To ban/unban from your island, use /island ban ");
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to ban players from your island!");
- }
- return true;
- }
- if ((split[0].equals("lock")) && (pi.getIslandLocation() != null))
- {
- if ((Settings.island_allowIslandLock) && (VaultHandler.checkPerk(player.getName(), "usb.lock", player.getWorld())))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleLock"))
- {
- WorldGuardHandler.islandLock(sender, uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader"));
- uSkyBlock.getInstance().getIslandConfig(iName).set("general.locked", Boolean.valueOf(true));
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " locked the island.");
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.warpActive"))
- {
- uSkyBlock.getInstance().getIslandConfig(iName).set("general.warpActive", Boolean.valueOf(false));
- player.sendMessage(ChatColor.RED + "Since your island is locked, your incoming warp has been deactivated.");
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " deactivated the island warp.");
- }
- uSkyBlock.getInstance().getActivePlayers().put(player.getName(), pi);
- uSkyBlock.getInstance().saveIslandConfig(iName);
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to lock your island!");
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "You don't have access to this command!");
- }
- return true;
- }
- if ((split[0].equals("unlock")) && (pi.getIslandLocation() != null))
- {
- if ((Settings.island_allowIslandLock) && (VaultHandler.checkPerk(player.getName(), "usb.lock", player.getWorld())))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleLock"))
- {
- WorldGuardHandler.islandUnlock(sender, uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader"));
- uSkyBlock.getInstance().getIslandConfig(iName).set("general.locked", Boolean.valueOf(false));
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " unlocked the island.");
- uSkyBlock.getInstance().saveIslandConfig(iName);
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to unlock your island!");
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "You don't have access to this command!");
- }
- return true;
- }
- if (split[0].equals("help"))
- {
- player.sendMessage(ChatColor.GREEN + "[SkyBlock command usage]");
-
- player.sendMessage(ChatColor.YELLOW + "/island :" + ChatColor.WHITE + " start your island, or teleport back to one you have.");
- player.sendMessage(ChatColor.YELLOW + "/island restart :" + ChatColor.WHITE + " delete your island and start a new one.");
- player.sendMessage(ChatColor.YELLOW + "/island sethome :" + ChatColor.WHITE + " set your island teleport point.");
- if (Settings.island_useIslandLevel)
- {
- player.sendMessage(ChatColor.YELLOW + "/island level :" + ChatColor.WHITE + " check your island level");
- player.sendMessage(ChatColor.YELLOW + "/island level :" + ChatColor.WHITE + " check another player's island level.");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld()))
- {
- player.sendMessage(ChatColor.YELLOW + "/island party :" + ChatColor.WHITE + " view your party information.");
- player.sendMessage(ChatColor.YELLOW + "/island invite :" + ChatColor.WHITE + " invite a player to join your island.");
- player.sendMessage(ChatColor.YELLOW + "/island leave :" + ChatColor.WHITE + " leave another player's island.");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.party.kick", player.getWorld())) {
- player.sendMessage(ChatColor.YELLOW + "/island kick :" + ChatColor.WHITE + " remove a player from your island.");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.party.join", player.getWorld())) {
- player.sendMessage(ChatColor.YELLOW + "/island [accept/reject]:" + ChatColor.WHITE + " accept/reject an invitation.");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.party.makeleader", player.getWorld())) {
- player.sendMessage(ChatColor.YELLOW + "/island makeleader :" + ChatColor.WHITE + " transfer the island to .");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.island.warp", player.getWorld())) {
- player.sendMessage(ChatColor.YELLOW + "/island warp :" + ChatColor.WHITE + " warp to another player's island.");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld()))
- {
- player.sendMessage(ChatColor.YELLOW + "/island setwarp :" + ChatColor.WHITE + " set your island's warp location.");
- player.sendMessage(ChatColor.YELLOW + "/island togglewarp :" + ChatColor.WHITE + " enable/disable warping to your island.");
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.island.ban", player.getWorld())) {
- player.sendMessage(ChatColor.YELLOW + "/island ban :" + ChatColor.WHITE + " ban/unban a player from your island.");
- }
- player.sendMessage(ChatColor.YELLOW + "/island top :" + ChatColor.WHITE + " see the top ranked islands.");
- if (Settings.island_allowIslandLock) {
- if (!VaultHandler.checkPerk(player.getName(), "usb.lock", player.getWorld()))
- {
- player.sendMessage(ChatColor.DARK_GRAY + "/island lock :" + ChatColor.GRAY + " non-group members can't enter your island.");
- player.sendMessage(ChatColor.DARK_GRAY + "/island unlock :" + ChatColor.GRAY + " allow anyone to enter your island.");
- }
- else
- {
- player.sendMessage(ChatColor.YELLOW + "/island lock :" + ChatColor.WHITE + " non-group members can't enter your island.");
- player.sendMessage(ChatColor.YELLOW + "/island unlock :" + ChatColor.WHITE + " allow anyone to enter your island.");
- }
- }
- if (Bukkit.getServer().getServerId().equalsIgnoreCase("UltimateSkyblock"))
- {
- player.sendMessage(ChatColor.YELLOW + "/dungeon :" + ChatColor.WHITE + " to warp to the dungeon world.");
- player.sendMessage(ChatColor.YELLOW + "/fun :" + ChatColor.WHITE + " to warp to the Mini-Game/Fun world.");
- player.sendMessage(ChatColor.YELLOW + "/pvp :" + ChatColor.WHITE + " join a pvp match.");
- player.sendMessage(ChatColor.YELLOW + "/spleef :" + ChatColor.WHITE + " join spleef match.");
- player.sendMessage(ChatColor.YELLOW + "/hub :" + ChatColor.WHITE + " warp to the world hub Sanconia.");
- }
- return true;
- }
- if ((split[0].equals("top")) && (VaultHandler.checkPerk(player.getName(), "usb.island.topten", player.getWorld())))
- {
- uSkyBlock.getInstance().displayTopTen(player);
- return true;
- }
- if (((split[0].equals("biome")) || (split[0].equals("b"))) && (pi.getIslandLocation() != null))
- {
- player.openInventory(uSkyBlock.getInstance().displayBiomeGUI(player));
- if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleLock")) {
- player.sendMessage("§cYou do not have permission to change the biome of your current island.");
- }
- return true;
- }
- if (((split[0].equals("info")) || (split[0].equals("level"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.island.info", player.getWorld())) && (Settings.island_useIslandLevel))
- {
- if (uSkyBlock.getInstance().playerIsOnIsland(player))
- {
- if ((!uSkyBlock.getInstance().onInfoCooldown(player)) || (Settings.general_cooldownInfo == 0))
- {
- uSkyBlock.getInstance().setInfoCooldown(player);
- if ((!pi.getHasParty()) && (!pi.getHasIsland()))
- {
- player.sendMessage(ChatColor.RED + "You do not have an island!");
- }
- else
- {
- for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
- for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
- uSkyBlock.getSkyBlockWorld().loadChunk((pi.getIslandLocation().getBlockX() + x) / 16, (pi.getIslandLocation().getBlockZ() + z) / 16);
- }
- }
- getIslandLevel(player, player.getName());
- }
- return true;
- }
- player.sendMessage(ChatColor.YELLOW + "You can use that command again in " + uSkyBlock.getInstance().getInfoCooldownTime(player) / 1000L + " seconds.");
- return true;
- }
- player.sendMessage(ChatColor.YELLOW + "You must be on your island to use this command.");
- return true;
- }
- if ((split[0].equals("invite")) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())))
- {
- player.sendMessage(ChatColor.YELLOW + "Use" + ChatColor.WHITE + " /island invite " + ChatColor.YELLOW + " to invite a player to your island.");
- if (uSkyBlock.getInstance().hasParty(player.getName()))
- {
- if ((uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader").equalsIgnoreCase(player.getName())) || (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getBoolean("party.members." + player.getName() + ".canInviteOthers")))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.partysize", player.getWorld()))
- {
- if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize") < Settings.general_maxPartySize * 2) {
- player.sendMessage(ChatColor.GREEN + "You can invite " + (Settings.general_maxPartySize * 2 - uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize")) + " more players.");
- } else {
- player.sendMessage(ChatColor.RED + "You can't invite any more players.");
- }
- return true;
- }
- if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize") < Settings.general_maxPartySize) {
- player.sendMessage(ChatColor.GREEN + "You can invite " + (Settings.general_maxPartySize - uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize")) + " more players.");
- } else {
- player.sendMessage(ChatColor.RED + "You can't invite any more players.");
- }
+
+ public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] split) {
+ if (!(sender instanceof Player)) {
+ return false;
+ }
+ final Player player = (Player)sender;
+ final PlayerInfo pi = uSkyBlock.getInstance().getActivePlayers().get(player.getName());
+ if (pi == null) {
+ player.sendMessage(ChatColor.RED + "Error: Couldn't read your player data!");
return true;
- }
- player.sendMessage(ChatColor.RED + "Only the island's owner can invite!");
- return true;
}
- return true;
- }
- if ((split[0].equals("accept")) && (VaultHandler.checkPerk(player.getName(), "usb.party.join", player.getWorld())))
- {
- if ((uSkyBlock.getInstance().onRestartCooldown(player)) && (Settings.general_cooldownRestart > 0))
- {
- player.sendMessage(ChatColor.YELLOW + "You can't join an island for another " + uSkyBlock.getInstance().getRestartCooldownTime(player) / 1000L + " seconds.");
- return true;
+ String iName = "";
+ if (pi.getIslandLocation() != null) {
+ iName = pi.locationForParty();
}
- if ((!uSkyBlock.getInstance().hasParty(player.getName())) && (this.inviteList.containsKey(player.getName())))
- {
- if (pi.getHasIsland()) {
- uSkyBlock.getInstance().deletePlayerIsland(player.getName());
- }
- player.sendMessage(ChatColor.GREEN + "You have joined an island! Use /island party to see the other members.");
- addPlayertoParty(player.getName(), (String)this.inviteList.get(player.getName()));
- if (Bukkit.getPlayer((String)this.inviteList.get(player.getName())) != null)
- {
- Bukkit.getPlayer((String)this.inviteList.get(player.getName())).sendMessage(ChatColor.GREEN + player.getName() + " has joined your island!");
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You couldn't join the island, maybe it's full.");
-
+ if (split.length == 0) {
+ uSkyBlock.getInstance().updatePartyNumber(player);
+ player.openInventory(uSkyBlock.getInstance().displayIslandGUI(player));
return true;
- }
- uSkyBlock.getInstance().setRestartCooldown(player);
-
- uSkyBlock.getInstance().homeTeleport(player);
-
- player.getInventory().clear();
- player.getEquipment().clear();
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- if (WorldGuardHandler.getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(uSkyBlock.getInstance().getIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(this.inviteList.get(player.getName()))).locationForParty()).getString("party.leader") + "Island")) {
- WorldGuardHandler.addPlayerToOldRegion(uSkyBlock.getInstance().getIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(this.inviteList.get(player.getName()))).locationForParty()).getString("party.leader"), player.getName());
- }
- }
- this.inviteList.remove(player.getName());
- return true;
- }
- player.sendMessage(ChatColor.RED + "You can't use that command right now.");
- return true;
- }
- if (split[0].equals("reject"))
- {
- if (this.inviteList.containsKey(player.getName()))
- {
- player.sendMessage(ChatColor.YELLOW + "You have rejected the invitation to join an island.");
- if (Bukkit.getPlayer((String)this.inviteList.get(player.getName())) != null) {
- Bukkit.getPlayer((String)this.inviteList.get(player.getName())).sendMessage(ChatColor.RED + player.getName() + " has rejected your island invite!");
- }
- this.inviteList.remove(player.getName());
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You haven't been invited.");
- }
- return true;
- }
- if (split[0].equalsIgnoreCase("partypurge"))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
- player.sendMessage(ChatColor.RED + "This command no longer functions!");
- } else {
- player.sendMessage(ChatColor.RED + "You can't access that command!");
- }
- return true;
- }
- if (split[0].equalsIgnoreCase("partyclean"))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
- player.sendMessage(ChatColor.RED + "This command no longer functions!");
- } else {
- player.sendMessage(ChatColor.RED + "You can't access that command!");
- }
- return true;
- }
- if (split[0].equalsIgnoreCase("purgeinvites"))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld()))
- {
- player.sendMessage(ChatColor.RED + "Deleting all invites!");
- invitePurge();
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You can't access that command!");
- }
- return true;
- }
- if (split[0].equalsIgnoreCase("partylist"))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
- player.sendMessage(ChatColor.RED + "This command is currently not active.");
- } else {
- player.sendMessage(ChatColor.RED + "You can't access that command!");
}
- return true;
- }
- if (split[0].equalsIgnoreCase("invitelist"))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld()))
- {
- player.sendMessage(ChatColor.RED + "Checking Invites.");
- inviteDebug(player);
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You can't access that command!");
- }
- return true;
- }
- if ((split[0].equals("leave")) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.party.join", player.getWorld())))
- {
- if (player.getWorld().getName().equalsIgnoreCase(uSkyBlock.getSkyBlockWorld().getName()))
- {
- if (uSkyBlock.getInstance().hasParty(player.getName()))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader").equalsIgnoreCase(player.getName()))
- {
- player.sendMessage(ChatColor.YELLOW + "You own this island, use /island remove instead.");
- return true;
- }
- player.getInventory().clear();
- player.getEquipment().clear();
- if (Settings.extras_sendToSpawn) {
- player.performCommand("spawn");
- } else {
- player.teleport(uSkyBlock.getSkyBlockWorld().getSpawnLocation());
- }
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- WorldGuardHandler.removePlayerFromRegion(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"), player.getName());
- }
- removePlayerFromParty(player.getName(), uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"), pi.locationForParty());
-
- player.sendMessage(ChatColor.YELLOW + "You have left the island and returned to the player spawn.");
- if (Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")) != null) {
- Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")).sendMessage(ChatColor.RED + player.getName() + " has left your island!");
- }
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You can't leave your island if you are the only person. Try using /island restart if you want a new one!");
- return true;
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "You must be in the skyblock world to leave your party!");
- }
- return true;
- }
- if ((split[0].equals("party")) && (pi.getIslandLocation() != null))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())) {
- player.openInventory(uSkyBlock.getInstance().displayPartyGUI(player));
- }
- player.sendMessage(ChatColor.YELLOW + "Listing your island members:");
- String total = "";
- this.memberList = uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getConfigurationSection("party.members").getKeys(false);
- total = total + "§a<" + uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader") + "> ";
- Iterator tempIt = this.memberList.iterator();
- while (tempIt.hasNext())
- {
- String temp = (String)tempIt.next();
- if (!temp.equalsIgnoreCase(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"))) {
- total = total + "§e[" + temp + "]";
- }
- }
- player.sendMessage(total);
-
-
- return true;
- }
- }
- else if (split.length == 2)
- {
- if (((split[0].equals("info")) || (split[0].equals("level"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.island.info", player.getWorld())) && (Settings.island_useIslandLevel))
- {
- if ((!uSkyBlock.getInstance().onInfoCooldown(player)) || (Settings.general_cooldownInfo == 0))
- {
- uSkyBlock.getInstance().setInfoCooldown(player);
- if ((!pi.getHasParty()) && (!pi.getHasIsland())) {
- player.sendMessage(ChatColor.RED + "You do not have an island!");
- } else {
- getIslandLevel(player, split[1]);
- }
- return true;
- }
- player.sendMessage(ChatColor.YELLOW + "You can use that command again in " + uSkyBlock.getInstance().getInfoCooldownTime(player) / 1000L + " seconds.");
- return true;
- }
- if ((split[0].equals("warp")) || (split[0].equals("w")))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.island.warp", player.getWorld()))
- {
- PlayerInfo wPi = null;
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(Bukkit.getPlayer(split[1])))
- {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1]))
- {
- wPi = new PlayerInfo(split[1]);
- if (!wPi.getHasIsland())
- {
- player.sendMessage(ChatColor.RED + "That player does not exist!");
+ if (split.length == 1) {
+ if ((split[0].equals("restart") || split[0].equals("reset")) && pi.getIslandLocation() != null) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getInt("party.currentSize") > 1) {
+ if (!uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader").equalsIgnoreCase(player.getName())) {
+ player.sendMessage(ChatColor.RED + "Only the owner may restart this island. Leave this island in order to start your own (/island leave).");
+ }
+ else {
+ player.sendMessage(ChatColor.YELLOW + "You must remove all players from your island before you can restart it (/island kick ). See a list of players currently part of your island using /island party.");
+ }
+ return true;
+ }
+ if (!uSkyBlock.getInstance().onRestartCooldown(player) || Settings.general_cooldownRestart == 0) {
+ uSkyBlock.getInstance().restartPlayerIsland(player, pi.getIslandLocation());
+ uSkyBlock.getInstance().setRestartCooldown(player);
+ return true;
+ }
+ player.sendMessage(ChatColor.YELLOW + "You can restart your island in " + uSkyBlock.getInstance().getRestartCooldownTime(player) / 1000L + " seconds.");
return true;
- }
- }
- else
- {
- wPi = (PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(split[1]);
- }
- }
- else {
- wPi = (PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(Bukkit.getPlayer(split[1]));
- }
- if (!wPi.getHasIsland()) {
- return true;
- }
- if (uSkyBlock.getInstance().getIslandConfig(wPi.locationForParty()).getBoolean("general.warpActive"))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(wPi.locationForParty()).contains("banned.list." + player.getName())) {
- uSkyBlock.getInstance().warpTeleport(player, wPi);
- } else {
- player.sendMessage(ChatColor.RED + "That player has forbidden you from warping to their island.");
- }
- }
- else
- {
- player.sendMessage(ChatColor.RED + "That player does not have an active warp.");
- return true;
- }
- }
- else
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to warp to other islands!");
- }
- return true;
- }
- if ((split[0].equals("ban")) && (pi.getIslandLocation() != null))
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.island.ban", player.getWorld()))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).contains("banned.list." + player.getName()))
- {
- this.banList = uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getStringList("banned.list");
- this.banList.add(split[1]);
- uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).set("banned.list", this.banList);
- player.sendMessage(ChatColor.YELLOW + "You have banned " + ChatColor.RED + split[1] + ChatColor.YELLOW + " from warping to your island.");
- }
- else
- {
- this.banList = uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getStringList("banned.list");
- this.banList.remove(split[1]);
- uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).set("banned.list", this.banList);
- player.sendMessage(ChatColor.YELLOW + "You have unbanned " + ChatColor.GREEN + split[1] + ChatColor.YELLOW + " from warping to your island.");
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "You do not have permission to ban players from this island!");
- }
- uSkyBlock.getInstance().getActivePlayers().put(player.getName(), pi);
- return true;
- }
- if (((split[0].equals("biome")) || (split[0].equals("b"))) && (pi.getIslandLocation() != null))
- {
- if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canChangeBiome"))
- {
- if ((!uSkyBlock.getInstance().onBiomeCooldown(player)) || (Settings.general_biomeChange == 0))
- {
- if (uSkyBlock.getInstance().playerIsOnIsland(player))
- {
- if (uSkyBlock.getInstance().changePlayerBiome(player, split[1]))
- {
- player.sendMessage(ChatColor.GREEN + "You have changed your island's biome to " + split[1].toUpperCase());
- player.sendMessage(ChatColor.GREEN + "You may need to relog to see the changes.");
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " changed the island biome to " + split[1].toUpperCase());
- uSkyBlock.getInstance().setBiomeCooldown(player);
- }
- else
- {
- player.sendMessage(ChatColor.GREEN + "Unknown biome name, changing your biome to OCEAN");
- player.sendMessage(ChatColor.GREEN + "You may need to relog to see the changes.");
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " changed the island biome to OCEAN");
- }
}
else {
- player.sendMessage(ChatColor.YELLOW + "You must be on your island to change the biome!");
+ if ((split[0].equals("sethome") || split[0].equals("tpset")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.island.sethome", player.getWorld())) {
+ uSkyBlock.getInstance().homeSet(player);
+ return true;
+ }
+ if ((split[0].equals("log") || split[0].equals("l")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.island.create", player.getWorld())) {
+ player.openInventory(uSkyBlock.getInstance().displayLogGUI(player));
+ return true;
+ }
+ if ((split[0].equals("create") || split[0].equals("c")) && VaultHandler.checkPerk(player.getName(), "usb.island.create", player.getWorld())) {
+ if (pi.getIslandLocation() == null) {
+ uSkyBlock.getInstance().createIsland(sender, pi);
+ return true;
+ }
+ if (pi.getIslandLocation().getBlockX() == 0 && pi.getIslandLocation().getBlockY() == 0 && pi.getIslandLocation().getBlockZ() == 0) {
+ uSkyBlock.getInstance().createIsland(sender, pi);
+ return true;
+ }
+ return true;
+ }
+ else {
+ if ((split[0].equals("home") || split[0].equals("h")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.island.sethome", player.getWorld())) {
+ if (pi.getHomeLocation() == null) {
+ uSkyBlock.getInstance().getActivePlayers().get(player.getName()).setHomeLocation(pi.getIslandLocation());
+ }
+ uSkyBlock.getInstance().homeTeleport(player);
+ return true;
+ }
+ if ((split[0].equals("setwarp") || split[0].equals("warpset")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld())) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canChangeWarp")) {
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " changed the island warp location.");
+ uSkyBlock.getInstance().warpSet(player);
+ }
+ else {
+ player.sendMessage("�cYou do not have permission to set your island's warp point!");
+ }
+ return true;
+ }
+ if (split[0].equals("warp") || split[0].equals("w")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld())) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.warpActive")) {
+ player.sendMessage(ChatColor.GREEN + "Your incoming warp is active, players may warp to your island.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "Your incoming warp is inactive, players may not warp to your island.");
+ }
+ player.sendMessage(ChatColor.WHITE + "Set incoming warp to your current location using " + ChatColor.YELLOW + "/island setwarp");
+ player.sendMessage(ChatColor.WHITE + "Toggle your warp on/off using " + ChatColor.YELLOW + "/island togglewarp");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to create a warp on your island!");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.island.warp", player.getWorld())) {
+ player.sendMessage(ChatColor.WHITE + "Warp to another island using " + ChatColor.YELLOW + "/island warp ");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to warp to other islands!");
+ }
+ return true;
+ }
+ if ((split[0].equals("togglewarp") || split[0].equals("tw")) && pi.getIslandLocation() != null) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld())) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleWarp")) {
+ if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.warpActive")) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.locked")) {
+ player.sendMessage(ChatColor.RED + "Your island is locked. You must unlock it before enabling your warp.");
+ return true;
+ }
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " activated the island warp.");
+ uSkyBlock.getInstance().getIslandConfig(iName).set("general.warpActive", (Object)true);
+ }
+ else {
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " deactivated the island warp.");
+ uSkyBlock.getInstance().getIslandConfig(iName).set("general.warpActive", (Object)false);
+ }
+ }
+ else {
+ player.sendMessage("�cYou do not have permission to enable/disable your island's warp!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to create a warp on your island!");
+ }
+ uSkyBlock.getInstance().getActivePlayers().put(player.getName(), pi);
+ return true;
+ }
+ if ((split[0].equals("ban") || split[0].equals("banned") || split[0].equals("banlist") || split[0].equals("b")) && pi.getIslandLocation() != null) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.island.ban", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "The following players are banned from warping to your island:");
+ player.sendMessage(ChatColor.RED + this.getBanList(player));
+ player.sendMessage(ChatColor.YELLOW + "To ban/unban from your island, use /island ban ");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to ban players from your island!");
+ }
+ return true;
+ }
+ if (split[0].equals("lock") && pi.getIslandLocation() != null) {
+ if (Settings.island_allowIslandLock && VaultHandler.checkPerk(player.getName(), "usb.lock", player.getWorld())) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleLock")) {
+ WorldGuardHandler.islandLock(sender, uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader"));
+ uSkyBlock.getInstance().getIslandConfig(iName).set("general.locked", (Object)true);
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " locked the island.");
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("general.warpActive")) {
+ uSkyBlock.getInstance().getIslandConfig(iName).set("general.warpActive", (Object)false);
+ player.sendMessage(ChatColor.RED + "Since your island is locked, your incoming warp has been deactivated.");
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " deactivated the island warp.");
+ }
+ uSkyBlock.getInstance().getActivePlayers().put(player.getName(), pi);
+ uSkyBlock.getInstance().saveIslandConfig(iName);
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to lock your island!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You don't have access to this command!");
+ }
+ return true;
+ }
+ if (split[0].equals("unlock") && pi.getIslandLocation() != null) {
+ if (Settings.island_allowIslandLock && VaultHandler.checkPerk(player.getName(), "usb.lock", player.getWorld())) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleLock")) {
+ WorldGuardHandler.islandUnlock(sender, uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader"));
+ uSkyBlock.getInstance().getIslandConfig(iName).set("general.locked", (Object)false);
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " unlocked the island.");
+ uSkyBlock.getInstance().saveIslandConfig(iName);
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to unlock your island!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You don't have access to this command!");
+ }
+ return true;
+ }
+ if (split[0].equals("help")) {
+ player.sendMessage(ChatColor.GREEN + "[SkyBlock command usage]");
+ player.sendMessage(ChatColor.YELLOW + "/island :" + ChatColor.WHITE + " start your island, or teleport back to one you have.");
+ player.sendMessage(ChatColor.YELLOW + "/island restart :" + ChatColor.WHITE + " delete your island and start a new one.");
+ player.sendMessage(ChatColor.YELLOW + "/island sethome :" + ChatColor.WHITE + " set your island teleport point.");
+ if (Settings.island_useIslandLevel) {
+ player.sendMessage(ChatColor.YELLOW + "/island level :" + ChatColor.WHITE + " check your island level");
+ player.sendMessage(ChatColor.YELLOW + "/island level :" + ChatColor.WHITE + " check another player's island level.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island party :" + ChatColor.WHITE + " view your party information.");
+ player.sendMessage(ChatColor.YELLOW + "/island invite :" + ChatColor.WHITE + " invite a player to join your island.");
+ player.sendMessage(ChatColor.YELLOW + "/island leave :" + ChatColor.WHITE + " leave another player's island.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.party.kick", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island kick :" + ChatColor.WHITE + " remove a player from your island.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.party.join", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island [accept/reject]:" + ChatColor.WHITE + " accept/reject an invitation.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.party.makeleader", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island makeleader :" + ChatColor.WHITE + " transfer the island to .");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.island.warp", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island warp :" + ChatColor.WHITE + " warp to another player's island.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island setwarp :" + ChatColor.WHITE + " set your island's warp location.");
+ player.sendMessage(ChatColor.YELLOW + "/island togglewarp :" + ChatColor.WHITE + " enable/disable warping to your island.");
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.island.ban", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "/island ban :" + ChatColor.WHITE + " ban/unban a player from your island.");
+ }
+ player.sendMessage(ChatColor.YELLOW + "/island top :" + ChatColor.WHITE + " see the top ranked islands.");
+ if (Settings.island_allowIslandLock) {
+ if (!VaultHandler.checkPerk(player.getName(), "usb.lock", player.getWorld())) {
+ player.sendMessage(ChatColor.DARK_GRAY + "/island lock :" + ChatColor.GRAY + " non-group members can't enter your island.");
+ player.sendMessage(ChatColor.DARK_GRAY + "/island unlock :" + ChatColor.GRAY + " allow anyone to enter your island.");
+ }
+ else {
+ player.sendMessage(ChatColor.YELLOW + "/island lock :" + ChatColor.WHITE + " non-group members can't enter your island.");
+ player.sendMessage(ChatColor.YELLOW + "/island unlock :" + ChatColor.WHITE + " allow anyone to enter your island.");
+ }
+ }
+ if (Bukkit.getServer().getServerId().equalsIgnoreCase("UltimateSkyblock")) {
+ player.sendMessage(ChatColor.YELLOW + "/dungeon :" + ChatColor.WHITE + " to warp to the dungeon world.");
+ player.sendMessage(ChatColor.YELLOW + "/fun :" + ChatColor.WHITE + " to warp to the Mini-Game/Fun world.");
+ player.sendMessage(ChatColor.YELLOW + "/pvp :" + ChatColor.WHITE + " join a pvp match.");
+ player.sendMessage(ChatColor.YELLOW + "/spleef :" + ChatColor.WHITE + " join spleef match.");
+ player.sendMessage(ChatColor.YELLOW + "/hub :" + ChatColor.WHITE + " warp to the world hub Sanconia.");
+ }
+ return true;
+ }
+ if (split[0].equals("top") && VaultHandler.checkPerk(player.getName(), "usb.island.topten", player.getWorld())) {
+ uSkyBlock.getInstance().displayTopTen(player);
+ return true;
+ }
+ if ((split[0].equals("biome") || split[0].equals("b")) && pi.getIslandLocation() != null) {
+ player.openInventory(uSkyBlock.getInstance().displayBiomeGUI(player));
+ if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canToggleLock")) {
+ player.sendMessage("�cYou do not have permission to change the biome of your current island.");
+ }
+ return true;
+ }
+ if ((split[0].equals("info") || split[0].equals("level")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.island.info", player.getWorld()) && Settings.island_useIslandLevel) {
+ if (!uSkyBlock.getInstance().playerIsOnIsland(player)) {
+ player.sendMessage(ChatColor.YELLOW + "You must be on your island to use this command.");
+ return true;
+ }
+ if (!uSkyBlock.getInstance().onInfoCooldown(player) || Settings.general_cooldownInfo == 0) {
+ uSkyBlock.getInstance().setInfoCooldown(player);
+ if (!pi.getHasParty() && !pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "You do not have an island!");
+ }
+ else {
+ for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
+ for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
+ uSkyBlock.getSkyBlockWorld().loadChunk((pi.getIslandLocation().getBlockX() + x) / 16, (pi.getIslandLocation().getBlockZ() + z) / 16);
+ }
+ }
+ this.getIslandLevel(player, player.getName());
+ }
+ return true;
+ }
+ player.sendMessage(ChatColor.YELLOW + "You can use that command again in " + uSkyBlock.getInstance().getInfoCooldownTime(player) / 1000L + " seconds.");
+ return true;
+ }
+ else if (split[0].equals("invite") && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())) {
+ player.sendMessage(ChatColor.YELLOW + "Use" + ChatColor.WHITE + " /island invite " + ChatColor.YELLOW + " to invite a player to your island.");
+ if (!uSkyBlock.getInstance().hasParty(player.getName())) {
+ return true;
+ }
+ if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader").equalsIgnoreCase(player.getName()) && !uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getBoolean("party.members." + player.getName() + ".canInviteOthers")) {
+ player.sendMessage(ChatColor.RED + "Only the island's owner can invite!");
+ return true;
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.extra.partysize", player.getWorld())) {
+ if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize") < Settings.general_maxPartySize * 2) {
+ player.sendMessage(ChatColor.GREEN + "You can invite " + (Settings.general_maxPartySize * 2 - uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize")) + " more players.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't invite any more players.");
+ }
+ return true;
+ }
+ if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize") < Settings.general_maxPartySize) {
+ player.sendMessage(ChatColor.GREEN + "You can invite " + (Settings.general_maxPartySize - uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize")) + " more players.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't invite any more players.");
+ }
+ return true;
+ }
+ else if (split[0].equals("accept") && VaultHandler.checkPerk(player.getName(), "usb.party.join", player.getWorld())) {
+ if (uSkyBlock.getInstance().onRestartCooldown(player) && Settings.general_cooldownRestart > 0) {
+ player.sendMessage(ChatColor.YELLOW + "You can't join an island for another " + uSkyBlock.getInstance().getRestartCooldownTime(player) / 1000L + " seconds.");
+ return true;
+ }
+ if (uSkyBlock.getInstance().hasParty(player.getName()) || !this.inviteList.containsKey(player.getName())) {
+ player.sendMessage(ChatColor.RED + "You can't use that command right now.");
+ return true;
+ }
+ if (pi.getHasIsland()) {
+ uSkyBlock.getInstance().deletePlayerIsland(player.getName());
+ }
+ player.sendMessage(ChatColor.GREEN + "You have joined an island! Use /island party to see the other members.");
+ this.addPlayertoParty(player.getName(), this.inviteList.get(player.getName()));
+ if (Bukkit.getPlayer((String)this.inviteList.get(player.getName())) != null) {
+ Bukkit.getPlayer((String)this.inviteList.get(player.getName())).sendMessage(ChatColor.GREEN + player.getName() + " has joined your island!");
+ uSkyBlock.getInstance().setRestartCooldown(player);
+ uSkyBlock.getInstance().homeTeleport(player);
+ player.getInventory().clear();
+ player.getEquipment().clear();
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(this.inviteList.get(player.getName())).locationForParty()).getString("party.leader")) + "Island")) {
+ WorldGuardHandler.addPlayerToOldRegion(uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(this.inviteList.get(player.getName())).locationForParty()).getString("party.leader"), player.getName());
+ }
+ this.inviteList.remove(player.getName());
+ return true;
+ }
+ player.sendMessage(ChatColor.RED + "You couldn't join the island, maybe it's full.");
+ return true;
+ }
+ else {
+ if (split[0].equals("reject")) {
+ if (this.inviteList.containsKey(player.getName())) {
+ player.sendMessage(ChatColor.YELLOW + "You have rejected the invitation to join an island.");
+ if (Bukkit.getPlayer((String)this.inviteList.get(player.getName())) != null) {
+ Bukkit.getPlayer((String)this.inviteList.get(player.getName())).sendMessage(ChatColor.RED + player.getName() + " has rejected your island invite!");
+ }
+ this.inviteList.remove(player.getName());
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You haven't been invited.");
+ }
+ return true;
+ }
+ if (split[0].equalsIgnoreCase("partypurge")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
+ player.sendMessage(ChatColor.RED + "This command no longer functions!");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't access that command!");
+ }
+ return true;
+ }
+ if (split[0].equalsIgnoreCase("partyclean")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
+ player.sendMessage(ChatColor.RED + "This command no longer functions!");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't access that command!");
+ }
+ return true;
+ }
+ if (split[0].equalsIgnoreCase("purgeinvites")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
+ player.sendMessage(ChatColor.RED + "Deleting all invites!");
+ this.invitePurge();
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't access that command!");
+ }
+ return true;
+ }
+ if (split[0].equalsIgnoreCase("partylist")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
+ player.sendMessage(ChatColor.RED + "This command is currently not active.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't access that command!");
+ }
+ return true;
+ }
+ if (split[0].equalsIgnoreCase("invitelist")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.mod.party", player.getWorld())) {
+ player.sendMessage(ChatColor.RED + "Checking Invites.");
+ this.inviteDebug(player);
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't access that command!");
+ }
+ return true;
+ }
+ if (split[0].equals("leave") && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.party.join", player.getWorld())) {
+ if (player.getWorld().getName().equalsIgnoreCase(uSkyBlock.getSkyBlockWorld().getName())) {
+ if (!uSkyBlock.getInstance().hasParty(player.getName())) {
+ player.sendMessage(ChatColor.RED + "You can't leave your island if you are the only person. Try using /island restart if you want a new one!");
+ return true;
+ }
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getString("party.leader").equalsIgnoreCase(player.getName())) {
+ player.sendMessage(ChatColor.YELLOW + "You own this island, use /island remove instead.");
+ return true;
+ }
+ player.getInventory().clear();
+ player.getEquipment().clear();
+ if (Settings.extras_sendToSpawn) {
+ player.performCommand("spawn");
+ }
+ else {
+ player.teleport(uSkyBlock.getSkyBlockWorld().getSpawnLocation());
+ }
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ WorldGuardHandler.removePlayerFromRegion(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"), player.getName());
+ }
+ this.removePlayerFromParty(player.getName(), uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"), pi.locationForParty());
+ player.sendMessage(ChatColor.YELLOW + "You have left the island and returned to the player spawn.");
+ if (Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")) != null) {
+ Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")).sendMessage(ChatColor.RED + player.getName() + " has left your island!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You must be in the skyblock world to leave your party!");
+ }
+ return true;
+ }
+ if (split[0].equals("party") && pi.getIslandLocation() != null) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())) {
+ player.openInventory(uSkyBlock.getInstance().displayPartyGUI(player));
+ }
+ player.sendMessage(ChatColor.YELLOW + "Listing your island members:");
+ String total = "";
+ this.memberList = (Set)uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getConfigurationSection("party.members").getKeys(false);
+ total = String.valueOf(total) + "�a<" + uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader") + "> ";
+ for (final String temp : this.memberList) {
+ if (!temp.equalsIgnoreCase(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"))) {
+ total = String.valueOf(total) + "�e[" + temp + "]";
+ }
+ }
+ player.sendMessage(total);
+ return true;
+ }
+ }
+ }
}
- }
- else
- {
- player.sendMessage(ChatColor.YELLOW + "You can change your biome again in " + uSkyBlock.getInstance().getBiomeCooldownTime(player) / 1000L / 60L + " minutes.");
- return true;
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "You do not have permission to change the biome of this island!");
- }
- return true;
- }
- if ((split[0].equalsIgnoreCase("invite")) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canInviteOthers"))
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to invite others to this island!");
- return true;
- }
- if (Bukkit.getPlayer(split[1]) == null)
- {
- player.sendMessage(ChatColor.RED + "That player is offline or doesn't exist.");
- return true;
}
- if (!Bukkit.getPlayer(split[1]).isOnline())
- {
- player.sendMessage(ChatColor.RED + "That player is offline or doesn't exist.");
- return true;
- }
- if (!uSkyBlock.getInstance().hasIsland(player.getName()))
- {
- player.sendMessage(ChatColor.RED + "You must have an island in order to invite people to it!");
- return true;
- }
- if (player.getName().equalsIgnoreCase(Bukkit.getPlayer(split[1]).getName()))
- {
- player.sendMessage(ChatColor.RED + "You can't invite yourself!");
- return true;
- }
- if (uSkyBlock.getInstance().hasParty(player.getName()))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader").equalsIgnoreCase(Bukkit.getPlayer(split[1]).getName()))
- {
- if (!uSkyBlock.getInstance().hasParty(Bukkit.getPlayer(split[1]).getName()))
- {
- if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize") < uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.maxSize"))
- {
- if (this.inviteList.containsValue(player.getName()))
- {
- this.inviteList.remove(getKeyByValue(this.inviteList, player.getName()));
- player.sendMessage(ChatColor.YELLOW + "Removing your previous invite.");
+ else if (split.length == 2) {
+ if ((split[0].equals("info") || split[0].equals("level")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.island.info", player.getWorld()) && Settings.island_useIslandLevel) {
+ if (!uSkyBlock.getInstance().onInfoCooldown(player) || Settings.general_cooldownInfo == 0) {
+ uSkyBlock.getInstance().setInfoCooldown(player);
+ if (!pi.getHasParty() && !pi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "You do not have an island!");
+ }
+ else {
+ this.getIslandLevel(player, split[1]);
+ }
+ return true;
}
- this.inviteList.put(Bukkit.getPlayer(split[1]).getName(), player.getName());
- player.sendMessage(ChatColor.GREEN + "Invite sent to " + Bukkit.getPlayer(split[1]).getName());
-
- Bukkit.getPlayer(split[1]).sendMessage(player.getName() + " has invited you to join their island!");
- Bukkit.getPlayer(split[1]).sendMessage(ChatColor.WHITE + "/island [accept/reject]" + ChatColor.YELLOW + " to accept or reject the invite.");
- Bukkit.getPlayer(split[1]).sendMessage(ChatColor.RED + "WARNING: You will lose your current island if you accept!");
- uSkyBlock.getInstance().sendMessageToIslandGroup(iName, player.getName() + " invited " + Bukkit.getPlayer(split[1]).getName() + " to the island group.");
- }
- else
- {
- player.sendMessage(ChatColor.RED + "Your island is full, you can't invite anyone else.");
- }
+ player.sendMessage(ChatColor.YELLOW + "You can use that command again in " + uSkyBlock.getInstance().getInfoCooldownTime(player) / 1000L + " seconds.");
+ return true;
}
else {
- player.sendMessage(ChatColor.RED + "That player is already with a group on an island.");
+ if (split[0].equals("warp") || split[0].equals("w")) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.island.warp", player.getWorld())) {
+ PlayerInfo wPi = null;
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(Bukkit.getPlayer(split[1]))) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(split[1])) {
+ wPi = new PlayerInfo(split[1]);
+ if (!wPi.getHasIsland()) {
+ player.sendMessage(ChatColor.RED + "That player does not exist!");
+ return true;
+ }
+ }
+ else {
+ wPi = uSkyBlock.getInstance().getActivePlayers().get(split[1]);
+ }
+ }
+ else {
+ wPi = uSkyBlock.getInstance().getActivePlayers().get(Bukkit.getPlayer(split[1]));
+ }
+ if (!wPi.getHasIsland()) {
+ return true;
+ }
+ if (!uSkyBlock.getInstance().getIslandConfig(wPi.locationForParty()).getBoolean("general.warpActive")) {
+ player.sendMessage(ChatColor.RED + "That player does not have an active warp.");
+ return true;
+ }
+ if (!uSkyBlock.getInstance().getIslandConfig(wPi.locationForParty()).contains("banned.list." + player.getName())) {
+ uSkyBlock.getInstance().warpTeleport(player, wPi);
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "That player has forbidden you from warping to their island.");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to warp to other islands!");
+ }
+ return true;
+ }
+ if (split[0].equals("ban") && pi.getIslandLocation() != null) {
+ if (VaultHandler.checkPerk(player.getName(), "usb.island.ban", player.getWorld())) {
+ if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).contains("banned.list." + player.getName())) {
+ (this.banList = (List)uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getStringList("banned.list")).add(split[1]);
+ uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).set("banned.list", (Object)this.banList);
+ player.sendMessage(ChatColor.YELLOW + "You have banned " + ChatColor.RED + split[1] + ChatColor.YELLOW + " from warping to your island.");
+ }
+ else {
+ (this.banList = (List)uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getStringList("banned.list")).remove(split[1]);
+ uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).set("banned.list", (Object)this.banList);
+ player.sendMessage(ChatColor.YELLOW + "You have unbanned " + ChatColor.GREEN + split[1] + ChatColor.YELLOW + " from warping to your island.");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to ban players from this island!");
+ }
+ uSkyBlock.getInstance().getActivePlayers().put(player.getName(), pi);
+ return true;
+ }
+ if ((split[0].equals("biome") || split[0].equals("b")) && pi.getIslandLocation() != null) {
+ if (uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canChangeBiome")) {
+ if (uSkyBlock.getInstance().onBiomeCooldown(player) && Settings.general_biomeChange != 0) {
+ player.sendMessage(ChatColor.YELLOW + "You can change your biome again in " + uSkyBlock.getInstance().getBiomeCooldownTime(player) / 1000L / 60L + " minutes.");
+ return true;
+ }
+ if (uSkyBlock.getInstance().playerIsOnIsland(player)) {
+ if (uSkyBlock.getInstance().changePlayerBiome(player, split[1])) {
+ player.sendMessage(ChatColor.GREEN + "You have changed your island's biome to " + split[1].toUpperCase());
+ player.sendMessage(ChatColor.GREEN + "You may need to relog to see the changes.");
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " changed the island biome to " + split[1].toUpperCase());
+ uSkyBlock.getInstance().setBiomeCooldown(player);
+ }
+ else {
+ player.sendMessage(ChatColor.GREEN + "Unknown biome name, changing your biome to OCEAN");
+ player.sendMessage(ChatColor.GREEN + "You may need to relog to see the changes.");
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " changed the island biome to OCEAN");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.YELLOW + "You must be on your island to change the biome!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You do not have permission to change the biome of this island!");
+ }
+ return true;
+ }
+ if (split[0].equalsIgnoreCase("invite") && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.party.create", player.getWorld())) {
+ if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canInviteOthers")) {
+ player.sendMessage(ChatColor.RED + "You do not have permission to invite others to this island!");
+ return true;
+ }
+ if (Bukkit.getPlayer(split[1]) == null) {
+ player.sendMessage(ChatColor.RED + "That player is offline or doesn't exist.");
+ return true;
+ }
+ if (!Bukkit.getPlayer(split[1]).isOnline()) {
+ player.sendMessage(ChatColor.RED + "That player is offline or doesn't exist.");
+ return true;
+ }
+ if (!uSkyBlock.getInstance().hasIsland(player.getName())) {
+ player.sendMessage(ChatColor.RED + "You must have an island in order to invite people to it!");
+ return true;
+ }
+ if (player.getName().equalsIgnoreCase(Bukkit.getPlayer(split[1]).getName())) {
+ player.sendMessage(ChatColor.RED + "You can't invite yourself!");
+ return true;
+ }
+ if (uSkyBlock.getInstance().hasParty(player.getName())) {
+ if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader").equalsIgnoreCase(Bukkit.getPlayer(split[1]).getName())) {
+ if (!uSkyBlock.getInstance().hasParty(Bukkit.getPlayer(split[1]).getName())) {
+ if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.currentSize") < uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("party.maxSize")) {
+ if (this.inviteList.containsValue(player.getName())) {
+ this.inviteList.remove(this.getKeyByValue(this.inviteList, player.getName()));
+ player.sendMessage(ChatColor.YELLOW + "Removing your previous invite.");
+ }
+ this.inviteList.put(Bukkit.getPlayer(split[1]).getName(), player.getName());
+ player.sendMessage(ChatColor.GREEN + "Invite sent to " + Bukkit.getPlayer(split[1]).getName());
+ Bukkit.getPlayer(split[1]).sendMessage(String.valueOf(player.getName()) + " has invited you to join their island!");
+ Bukkit.getPlayer(split[1]).sendMessage(ChatColor.WHITE + "/island [accept/reject]" + ChatColor.YELLOW + " to accept or reject the invite.");
+ Bukkit.getPlayer(split[1]).sendMessage(ChatColor.RED + "WARNING: You will lose your current island if you accept!");
+ uSkyBlock.getInstance().sendMessageToIslandGroup(iName, String.valueOf(player.getName()) + " invited " + Bukkit.getPlayer(split[1]).getName() + " to the island group.");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "Your island is full, you can't invite anyone else.");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "That player is already with a group on an island.");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "That player is the leader of your island!");
+ }
+ return true;
+ }
+ if (!uSkyBlock.getInstance().hasParty(player.getName())) {
+ if (!uSkyBlock.getInstance().hasParty(Bukkit.getPlayer(split[1]).getName())) {
+ if (this.inviteList.containsValue(player.getName())) {
+ this.inviteList.remove(this.getKeyByValue(this.inviteList, player.getName()));
+ player.sendMessage(ChatColor.YELLOW + "Removing your previous invite.");
+ }
+ this.inviteList.put(Bukkit.getPlayer(split[1]).getName(), player.getName());
+ player.sendMessage(ChatColor.GREEN + "Invite sent to " + Bukkit.getPlayer(split[1]).getName());
+ Bukkit.getPlayer(split[1]).sendMessage(String.valueOf(player.getName()) + " has invited you to join their island!");
+ Bukkit.getPlayer(split[1]).sendMessage(ChatColor.WHITE + "/island [accept/reject]" + ChatColor.YELLOW + " to accept or reject the invite.");
+ Bukkit.getPlayer(split[1]).sendMessage(ChatColor.RED + "WARNING: You will lose your current island if you accept!");
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "That player is already with a group on an island.");
+ }
+ return true;
+ }
+ player.sendMessage(ChatColor.RED + "Only the island's owner may invite new players!");
+ return true;
+ }
+ else if ((split[0].equalsIgnoreCase("remove") || split[0].equalsIgnoreCase("kick")) && pi.getIslandLocation() != null && VaultHandler.checkPerk(player.getName(), "usb.party.kick", player.getWorld())) {
+ if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canKickOthers")) {
+ player.sendMessage(ChatColor.RED + "You do not have permission to kick others from this island!");
+ return true;
+ }
+ if (Bukkit.getPlayer(split[1]) == null && Bukkit.getOfflinePlayer(split[1]) == null) {
+ player.sendMessage(ChatColor.RED + "That player doesn't exist.");
+ return true;
+ }
+ if (Bukkit.getPlayer(split[1]) == null) {
+ this.tempTargetPlayer = Bukkit.getOfflinePlayer(split[1]).getName();
+ }
+ else {
+ this.tempTargetPlayer = Bukkit.getPlayer(split[1]).getName();
+ }
+ if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).contains("party.members." + split[1])) {
+ this.tempTargetPlayer = split[1];
+ }
+ if (uSkyBlock.getInstance().hasParty(player.getName())) {
+ if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader").equalsIgnoreCase(this.tempTargetPlayer)) {
+ if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).contains("party.members." + this.tempTargetPlayer)) {
+ if (player.getName().equalsIgnoreCase(this.tempTargetPlayer)) {
+ player.sendMessage(ChatColor.RED + "Stop kickin' yourself!");
+ return true;
+ }
+ if (Bukkit.getPlayer(split[1]) != null) {
+ if (Bukkit.getPlayer(split[1]).getWorld().getName().equalsIgnoreCase(uSkyBlock.getSkyBlockWorld().getName())) {
+ Bukkit.getPlayer(split[1]).getInventory().clear();
+ Bukkit.getPlayer(split[1]).getEquipment().clear();
+ Bukkit.getPlayer(split[1]).sendMessage(ChatColor.RED + player.getName() + " has removed you from their island!");
+ }
+ if (Settings.extras_sendToSpawn) {
+ Bukkit.getPlayer(split[1]).performCommand("spawn");
+ }
+ else {
+ Bukkit.getPlayer(split[1]).teleport(uSkyBlock.getSkyBlockWorld().getSpawnLocation());
+ }
+ }
+ if (Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")) != null) {
+ Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")).sendMessage(ChatColor.RED + this.tempTargetPlayer + " has been removed from the island.");
+ }
+ this.removePlayerFromParty(this.tempTargetPlayer, uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"), pi.locationForParty());
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ System.out.println("Removing from " + uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(player.getName()).locationForParty()).getString("party.leader") + "'s Island");
+ WorldGuardHandler.removePlayerFromRegion(uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(player.getName()).locationForParty()).getString("party.leader"), this.tempTargetPlayer);
+ }
+ }
+ else {
+ System.out.print("Player " + player.getName() + " failed to remove " + this.tempTargetPlayer);
+ player.sendMessage(ChatColor.RED + "That player is not part of your island group!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "You can't remove the leader from the Island!");
+ }
+ }
+ else {
+ player.sendMessage(ChatColor.RED + "No one else is on your island, are you seeing things?");
+ }
+ return true;
+ }
}
- }
- else {
- player.sendMessage(ChatColor.RED + "That player is the leader of your island!");
- }
}
- else
- {
- if (!uSkyBlock.getInstance().hasParty(player.getName()))
- {
- if (!uSkyBlock.getInstance().hasParty(Bukkit.getPlayer(split[1]).getName()))
- {
- if (this.inviteList.containsValue(player.getName()))
- {
- this.inviteList.remove(getKeyByValue(this.inviteList, player.getName()));
- player.sendMessage(ChatColor.YELLOW + "Removing your previous invite.");
- }
- this.inviteList.put(Bukkit.getPlayer(split[1]).getName(), player.getName());
-
-
- player.sendMessage(ChatColor.GREEN + "Invite sent to " + Bukkit.getPlayer(split[1]).getName());
- Bukkit.getPlayer(split[1]).sendMessage(player.getName() + " has invited you to join their island!");
- Bukkit.getPlayer(split[1]).sendMessage(ChatColor.WHITE + "/island [accept/reject]" + ChatColor.YELLOW + " to accept or reject the invite.");
- Bukkit.getPlayer(split[1]).sendMessage(ChatColor.RED + "WARNING: You will lose your current island if you accept!");
+ return true;
+ }
+
+ private void inviteDebug(final Player player) {
+ player.sendMessage(this.inviteList.toString());
+ }
+
+ private void invitePurge() {
+ this.inviteList.clear();
+ this.inviteList.put("NoInviter", "NoInvited");
+ }
+
+ public boolean addPlayertoParty(final String playername, final String partyleader) {
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(playername)) {
+ System.out.print("Failed to add player to party! (" + playername + ")");
+ return false;
+ }
+ if (!uSkyBlock.getInstance().getActivePlayers().containsKey(partyleader)) {
+ System.out.print("Failed to add player to party! (" + playername + ")");
+ return false;
+ }
+ uSkyBlock.getInstance().getActivePlayers().get(playername).setJoinParty(uSkyBlock.getInstance().getActivePlayers().get(partyleader).getIslandLocation());
+ if (!playername.equalsIgnoreCase(partyleader)) {
+ if (uSkyBlock.getInstance().getActivePlayers().get(partyleader).getHomeLocation() != null) {
+ uSkyBlock.getInstance().getActivePlayers().get(playername).setHomeLocation(uSkyBlock.getInstance().getActivePlayers().get(partyleader).getHomeLocation());
}
- else
- {
- player.sendMessage(ChatColor.RED + "That player is already with a group on an island.");
+ else {
+ uSkyBlock.getInstance().getActivePlayers().get(playername).setHomeLocation(uSkyBlock.getInstance().getActivePlayers().get(partyleader).getIslandLocation());
}
- return true;
- }
- player.sendMessage(ChatColor.RED + "Only the island's owner may invite new players!");
- return true;
+ uSkyBlock.getInstance().setupPartyMember(uSkyBlock.getInstance().getActivePlayers().get(partyleader).locationForParty(), playername);
}
+ uSkyBlock.getInstance().getActivePlayers().get(playername).savePlayerConfig(playername);
+ uSkyBlock.getInstance().sendMessageToIslandGroup(uSkyBlock.getInstance().getActivePlayers().get(partyleader).locationForParty(), String.valueOf(playername) + " has joined your island group.");
return true;
- }
- if (((split[0].equalsIgnoreCase("remove")) || (split[0].equalsIgnoreCase("kick"))) && (pi.getIslandLocation() != null) && (VaultHandler.checkPerk(player.getName(), "usb.party.kick", player.getWorld())))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(iName).getBoolean("party.members." + player.getName() + ".canKickOthers"))
- {
- player.sendMessage(ChatColor.RED + "You do not have permission to kick others from this island!");
- return true;
- }
- if ((Bukkit.getPlayer(split[1]) == null) && (Bukkit.getOfflinePlayer(split[1]) == null))
- {
- player.sendMessage(ChatColor.RED + "That player doesn't exist.");
- return true;
+ }
+
+ public void removePlayerFromParty(final String playername, final String partyleader, final String location) {
+ if (uSkyBlock.getInstance().getActivePlayers().containsKey(playername)) {
+ uSkyBlock.getInstance().getIslandConfig(location).set("party.members." + playername, (Object)null);
+ uSkyBlock.getInstance().getIslandConfig(location).set("party.currentSize", (Object)(uSkyBlock.getInstance().getIslandConfig(location).getInt("party.currentSize") - 1));
+ uSkyBlock.getInstance().saveIslandConfig(location);
+ uSkyBlock.getInstance().sendMessageToIslandGroup(location, String.valueOf(playername) + " has been removed from the island group.");
+ uSkyBlock.getInstance().getActivePlayers().get(playername).setHomeLocation(null);
+ uSkyBlock.getInstance().getActivePlayers().get(playername).setLeaveParty();
+ uSkyBlock.getInstance().getActivePlayers().get(playername).savePlayerConfig(playername);
}
- if (Bukkit.getPlayer(split[1]) == null) {
- this.tempTargetPlayer = Bukkit.getOfflinePlayer(split[1]).getName();
- } else {
- this.tempTargetPlayer = Bukkit.getPlayer(split[1]).getName();
+ else {
+ final PlayerInfo pi = new PlayerInfo(playername);
+ uSkyBlock.getInstance().getIslandConfig(location).set("party.members." + playername, (Object)null);
+ uSkyBlock.getInstance().getIslandConfig(location).set("party.currentSize", (Object)(uSkyBlock.getInstance().getIslandConfig(location).getInt("party.currentSize") - 1));
+ uSkyBlock.getInstance().saveIslandConfig(location);
+ uSkyBlock.getInstance().sendMessageToIslandGroup(location, String.valueOf(playername) + " has been removed from the island group.");
+ pi.setHomeLocation(null);
+ pi.setLeaveParty();
+ pi.savePlayerConfig(playername);
}
- if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).contains("party.members." + split[1])) {
- this.tempTargetPlayer = split[1];
+ }
+
+ public T getKeyByValue(final Map map, final E value) {
+ for (final Map.Entry entry : map.entrySet()) {
+ if (value.equals(entry.getValue())) {
+ return entry.getKey();
+ }
}
- if (uSkyBlock.getInstance().hasParty(player.getName()))
- {
- if (!uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader").equalsIgnoreCase(this.tempTargetPlayer))
- {
- if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).contains("party.members." + this.tempTargetPlayer))
- {
- if (player.getName().equalsIgnoreCase(this.tempTargetPlayer))
- {
- player.sendMessage(ChatColor.RED + "Stop kickin' yourself!");
- return true;
- }
- if (Bukkit.getPlayer(split[1]) != null)
- {
- if (Bukkit.getPlayer(split[1]).getWorld().getName().equalsIgnoreCase(uSkyBlock.getSkyBlockWorld().getName()))
- {
- Bukkit.getPlayer(split[1]).getInventory().clear();
- Bukkit.getPlayer(split[1]).getEquipment().clear();
- Bukkit.getPlayer(split[1]).sendMessage(ChatColor.RED + player.getName() + " has removed you from their island!");
+ return null;
+ }
+
+ public boolean getIslandLevel(final Player player, final String islandPlayer) {
+ if (!this.allowInfo) {
+ player.sendMessage(ChatColor.RED + "Can't use that command right now! Try again in a few seconds.");
+ System.out.print(String.valueOf(player.getName()) + " tried to use /island info but someone else used it first!");
+ return false;
+ }
+ this.allowInfo = false;
+ if (!uSkyBlock.getInstance().hasIsland(islandPlayer) && !uSkyBlock.getInstance().hasParty(islandPlayer)) {
+ player.sendMessage(ChatColor.RED + "That player is invalid or does not have an island!");
+ this.allowInfo = true;
+ return false;
+ }
+ uSkyBlock.getInstance().getServer().getScheduler().runTaskAsynchronously((Plugin)uSkyBlock.getInstance(), (Runnable)new Runnable() {
+ @Override
+ public void run() {
+ try {
+ final int[] values = new int[256];
+ final String playerName = player.getName();
+ final Location l = uSkyBlock.getInstance().getActivePlayers().get(playerName).getIslandLocation();
+ int blockcount = 0;
+ if (playerName.equalsIgnoreCase(islandPlayer)) {
+ final int px = l.getBlockX();
+ final int py = l.getBlockY();
+ final int pz = l.getBlockZ();
+ final World w = l.getWorld();
+ for (int x = Settings.island_protectionRange / 2 * -1; x <= Settings.island_protectionRange / 2; ++x) {
+ for (int y = 0; y <= 255; ++y) {
+ for (int z = Settings.island_protectionRange / 2 * -1; z <= Settings.island_protectionRange / 2; ++z) {
+ final int[] array = values;
+ final int typeId = w.getBlockAt(px + x, py + y, pz + z).getTypeId();
+ ++array[typeId];
+ }
+ }
+ }
+ for (int i = 1; i <= 255; ++i) {
+ if (values[i] > Settings.limitList[i] && Settings.limitList[i] >= 0) {
+ values[i] = Settings.limitList[i];
+ }
+ if (Settings.diminishingReturnsList[i] > 0) {
+ values[i] = (int)Math.round(uSkyBlock.getInstance().dReturns(values[i], Settings.diminishingReturnsList[i]));
+ }
+ values[i] *= Settings.blockList[i];
+ blockcount += values[i];
+ }
+ }
+ if (playerName.equalsIgnoreCase(islandPlayer)) {
+ uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(playerName).locationForParty()).set("general.level", (Object)(blockcount / uSkyBlock.getInstance().getLevelConfig().getInt("general.pointsPerLevel")));
+ uSkyBlock.getInstance().getActivePlayers().get(playerName).savePlayerConfig(playerName);
+ }
}
- if (Settings.extras_sendToSpawn) {
- Bukkit.getPlayer(split[1]).performCommand("spawn");
- } else {
- Bukkit.getPlayer(split[1]).teleport(uSkyBlock.getSkyBlockWorld().getSpawnLocation());
+ catch (Exception e) {
+ System.out.print("Error while calculating Island Level: " + e);
+ IslandCommand.this.allowInfo = true;
}
- }
- if (Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")) != null) {
- Bukkit.getPlayer(uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader")).sendMessage(ChatColor.RED + this.tempTargetPlayer + " has been removed from the island.");
- }
- removePlayerFromParty(this.tempTargetPlayer, uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getString("party.leader"), pi.locationForParty());
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")))
- {
- System.out.println("Removing from " + uSkyBlock.getInstance().getIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader") + "'s Island");
- WorldGuardHandler.removePlayerFromRegion(uSkyBlock.getInstance().getIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader"), this.tempTargetPlayer);
- }
- }
- else
- {
- System.out.print("Player " + player.getName() + " failed to remove " + this.tempTargetPlayer);
- player.sendMessage(ChatColor.RED + "That player is not part of your island group!");
+ uSkyBlock.getInstance().getServer().getScheduler().scheduleSyncDelayedTask((Plugin)uSkyBlock.getInstance(), (Runnable)new Runnable() {
+ @Override
+ public void run() {
+ IslandCommand.this.allowInfo = true;
+ if (Bukkit.getPlayer(player.getUniqueId()) != null) {
+ Bukkit.getPlayer(player.getUniqueId()).sendMessage(ChatColor.YELLOW + "Information about " + islandPlayer + "'s Island:");
+ if (player.getName().equalsIgnoreCase(islandPlayer)) {
+ // TODO: UUID support
+ Bukkit.getPlayer(player.getUniqueId()).sendMessage(ChatColor.GREEN + "Island level is " + uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("general.level"));
+ uSkyBlock.getInstance().saveIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(player.getName()).locationForParty());
+ }
+ else {
+ final PlayerInfo pi = new PlayerInfo(islandPlayer);
+ if (!pi.getHasIsland()) {
+ Bukkit.getPlayer(player.getUniqueId()).sendMessage(ChatColor.GREEN + "Island level is " + ChatColor.WHITE + uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()).getInt("general.level"));
+ }
+ else {
+ Bukkit.getPlayer(player.getUniqueId()).sendMessage(ChatColor.RED + "Error: Invalid Player");
+ }
+ }
+ }
+ }
+ }, 0L);
}
- }
- else {
- player.sendMessage(ChatColor.RED + "You can't remove the leader from the Island!");
- }
- }
- else {
- player.sendMessage(ChatColor.RED + "No one else is on your island, are you seeing things?");
- }
+ });
return true;
- }
}
- return true;
- }
-
- private void inviteDebug(Player player)
- {
- player.sendMessage(this.inviteList.toString());
- }
-
- private void invitePurge()
- {
- this.inviteList.clear();
- this.inviteList.put("NoInviter", "NoInvited");
- }
-
- public boolean addPlayertoParty(String playername, String partyleader)
- {
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(playername))
- {
- System.out.print("Failed to add player to party! (" + playername + ")");
- return false;
- }
- if (!uSkyBlock.getInstance().getActivePlayers().containsKey(partyleader))
- {
- System.out.print("Failed to add player to party! (" + playername + ")");
- return false;
- }
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).setJoinParty(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(partyleader)).getIslandLocation());
- if (!playername.equalsIgnoreCase(partyleader))
- {
- if (((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(partyleader)).getHomeLocation() != null) {
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).setHomeLocation(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(partyleader)).getHomeLocation());
- } else {
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).setHomeLocation(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(partyleader)).getIslandLocation());
- }
- uSkyBlock.getInstance().setupPartyMember(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(partyleader)).locationForParty(), playername);
- }
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).savePlayerConfig(playername);
- uSkyBlock.getInstance().sendMessageToIslandGroup(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(partyleader)).locationForParty(), playername + " has joined your island group.");
-
-
- return true;
- }
-
- public void removePlayerFromParty(String playername, String partyleader, String location)
- {
- if (uSkyBlock.getInstance().getActivePlayers().containsKey(playername))
- {
- uSkyBlock.getInstance().getIslandConfig(location).set("party.members." + playername, null);
- uSkyBlock.getInstance().getIslandConfig(location).set("party.currentSize", Integer.valueOf(uSkyBlock.getInstance().getIslandConfig(location).getInt("party.currentSize") - 1));
- uSkyBlock.getInstance().saveIslandConfig(location);
- uSkyBlock.getInstance().sendMessageToIslandGroup(location, playername + " has been removed from the island group.");
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).setHomeLocation(null);
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).setLeaveParty();
- ((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(playername)).savePlayerConfig(playername);
- }
- else
- {
- PlayerInfo pi = new PlayerInfo(playername);
-
- uSkyBlock.getInstance().getIslandConfig(location).set("party.members." + playername, null);
- uSkyBlock.getInstance().getIslandConfig(location).set("party.currentSize", Integer.valueOf(uSkyBlock.getInstance().getIslandConfig(location).getInt("party.currentSize") - 1));
- uSkyBlock.getInstance().saveIslandConfig(location);
- uSkyBlock.getInstance().sendMessageToIslandGroup(location, playername + " has been removed from the island group.");
- pi.setHomeLocation(null);
- pi.setLeaveParty();
- pi.savePlayerConfig(playername);
- }
- }
-
- public T getKeyByValue(Map map, E value)
- {
- for (Map.Entry entry : map.entrySet()) {
- if (value.equals(entry.getValue())) {
- return entry.getKey();
- }
- }
- return null;
- }
-
- public boolean getIslandLevel(Player player, String islandPlayer)
- {
- if (this.allowInfo)
- {
- this.allowInfo = false;
- String playerx = player.getName();
- String islandPlayerx = islandPlayer;
- if ((!uSkyBlock.getInstance().hasIsland(islandPlayer)) && (!uSkyBlock.getInstance().hasParty(islandPlayer)))
- {
- player.sendMessage(ChatColor.RED + "That player is invalid or does not have an island!");
- this.allowInfo = true;
- return false;
- }
- uSkyBlock.getInstance().getServer().getScheduler().runTaskAsynchronously(uSkyBlock.getInstance(), new IslandCommand.1(this, playerx, islandPlayerx));
- }
- else
- {
- player.sendMessage(ChatColor.RED + "Can't use that command right now! Try again in a few seconds.");
- System.out.print(player.getName() + " tried to use /island info but someone else used it first!");
- return false;
+ public String getBanList(final Player player) {
+ return null;
}
- return true;
- }
-
- public String getBanList(Player player)
- {
- return null;
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/ItemParser.java b/src/us/talabrek/ultimateskyblock/ItemParser.java
index 72dc26a6c..3cb5414d9 100644
--- a/src/us/talabrek/ultimateskyblock/ItemParser.java
+++ b/src/us/talabrek/ultimateskyblock/ItemParser.java
@@ -1,92 +1,78 @@
-package us.talabrek.ultimateskyblock;
-
-import java.util.Map;
-import java.util.logging.Logger;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.material.MaterialData;
-
-public class ItemParser
-{
- public ItemParser() {}
-
- public static String parseItemStackToString(ItemStack item)
- {
- if (item == null) {
- return "";
- }
- String s = "";
- s = s + "id:" + item.getTypeId() + ";";
- s = s + "amount:" + item.getAmount() + ";";
- s = s + "durab:" + item.getDurability() + ";";
- s = s + "data:" + item.getData().getData() + ";";
- if (item.getEnchantments().size() > 0)
- {
- s = s + "ench:";
- for (Enchantment e : item.getEnchantments().keySet())
- {
- s = s + "eid#" + e.getId() + " ";
- s = s + "elevel#" + item.getEnchantments().get(e) + " ";
- }
- }
- return s.trim();
- }
-
- public static ItemStack getItemStackfromString(String s)
- {
- if (s.equalsIgnoreCase("")) {
- return null;
- }
- ItemStack x = new ItemStack(1);
- for (String thing : s.split(";"))
- {
- String[] sp = thing.split(":");
- if (sp.length != 2) {
- uSkyBlock.getInstance().log.warning("error, wrong type size");
- }
- String name = sp[0];
- if (name.equals("id"))
- {
- x.setTypeId(Integer.parseInt(sp[1]));
- }
- else if (name.equals("amount"))
- {
- x.setAmount(Integer.parseInt(sp[1]));
- }
- else if (name.equals("durab"))
- {
- x.setDurability((short)Integer.parseInt(sp[1]));
- }
- else if (name.equals("data"))
- {
- x.getData().setData((byte)Integer.parseInt(sp[1]));
- }
- else if (name.equals("ench"))
- {
- int enchId = 0;
- int level = 0;
- for (String enchantment : sp[1].split(" "))
- {
- String[] prop = enchantment.split("#");
- if (prop.length != 2) {
- uSkyBlock.getInstance().log.warning("error, wrong enchantmenttype length");
- }
- if (prop[0].equals("eid"))
- {
- enchId = Integer.parseInt(prop[1]);
- }
- else if (prop[0].equals("elevel"))
- {
- level = Integer.parseInt(prop[1]);
- x.addUnsafeEnchantment(Enchantment.getById(enchId), level);
- }
- }
- }
- else
- {
- uSkyBlock.getInstance().log.warning("error, unknown itemvalue");
- }
- }
- return x;
- }
-}
+package us.talabrek.ultimateskyblock;
+
+import org.bukkit.inventory.*;
+import org.bukkit.enchantments.*;
+import java.util.*;
+
+public class ItemParser
+{
+ public static String parseItemStackToString(final ItemStack item) {
+ if (item == null) {
+ return "";
+ }
+ String s = "";
+ s = String.valueOf(s) + "id:" + item.getTypeId() + ";";
+ s = String.valueOf(s) + "amount:" + item.getAmount() + ";";
+ s = String.valueOf(s) + "durab:" + item.getDurability() + ";";
+ s = String.valueOf(s) + "data:" + item.getData().getData() + ";";
+ if (item.getEnchantments().size() > 0) {
+ s = String.valueOf(s) + "ench:";
+ for (final Enchantment e : item.getEnchantments().keySet()) {
+ s = String.valueOf(s) + "eid#" + e.getId() + " ";
+ s = String.valueOf(s) + "elevel#" + item.getEnchantments().get(e) + " ";
+ }
+ }
+ return s.trim();
+ }
+
+ public static ItemStack getItemStackfromString(final String s) {
+ if (s.equalsIgnoreCase("")) {
+ return null;
+ }
+ final ItemStack x = new ItemStack(1);
+ String[] split;
+ for (int length = (split = s.split(";")).length, i = 0; i < length; ++i) {
+ final String thing = split[i];
+ final String[] sp = thing.split(":");
+ if (sp.length != 2) {
+ uSkyBlock.getInstance().log.warning("error, wrong type size");
+ }
+ final String name = sp[0];
+ if (name.equals("id")) {
+ x.setTypeId(Integer.parseInt(sp[1]));
+ }
+ else if (name.equals("amount")) {
+ x.setAmount(Integer.parseInt(sp[1]));
+ }
+ else if (name.equals("durab")) {
+ x.setDurability((short)Integer.parseInt(sp[1]));
+ }
+ else if (name.equals("data")) {
+ x.getData().setData((byte)Integer.parseInt(sp[1]));
+ }
+ else if (name.equals("ench")) {
+ int enchId = 0;
+ int level = 0;
+ String[] split2;
+ for (int length2 = (split2 = sp[1].split(" ")).length, j = 0; j < length2; ++j) {
+ final String enchantment = split2[j];
+ final String[] prop = enchantment.split("#");
+ if (prop.length != 2) {
+ uSkyBlock.getInstance().log.warning("error, wrong enchantmenttype length");
+ }
+ if (prop[0].equals("eid")) {
+ enchId = Integer.parseInt(prop[1]);
+ }
+ else if (prop[0].equals("elevel")) {
+ level = Integer.parseInt(prop[1]);
+ x.addUnsafeEnchantment(Enchantment.getById(enchId), level);
+ }
+ }
+ }
+ else {
+ uSkyBlock.getInstance().log.warning("error, unknown itemvalue");
+ }
+ }
+ return x;
+ }
+}
diff --git a/src/us/talabrek/ultimateskyblock/Metrics.java b/src/us/talabrek/ultimateskyblock/Metrics.java
index c3e89360c..3b7eb4f9b 100644
--- a/src/us/talabrek/ultimateskyblock/Metrics.java
+++ b/src/us/talabrek/ultimateskyblock/Metrics.java
@@ -1,267 +1,213 @@
-package us.talabrek.ultimateskyblock;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStreamWriter;
-import java.io.UnsupportedEncodingException;
-import java.net.Proxy;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.bukkit.Bukkit;
-import org.bukkit.Server;
-import org.bukkit.configuration.InvalidConfigurationException;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.configuration.file.YamlConfigurationOptions;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginDescriptionFile;
-import org.bukkit.scheduler.BukkitScheduler;
-import org.bukkit.scheduler.BukkitTask;
-
-public class Metrics
-{
- private static final int REVISION = 6;
- private static final String BASE_URL = "http://mcstats.org";
- private static final String REPORT_URL = "/report/%s";
- private static final int PING_INTERVAL = 10;
- private final Plugin plugin;
- private final YamlConfiguration configuration;
- private final File configurationFile;
- private final String guid;
- private final boolean debug;
- private final Object optOutLock = new Object();
- private volatile BukkitTask task = null;
-
- public Metrics(Plugin plugin)
- throws IOException
- {
- if (plugin == null) {
- throw new IllegalArgumentException("Plugin cannot be null");
- }
- this.plugin = plugin;
-
-
- this.configurationFile = getConfigFile();
- this.configuration = YamlConfiguration.loadConfiguration(this.configurationFile);
-
-
- this.configuration.addDefault("opt-out", Boolean.valueOf(false));
- this.configuration.addDefault("guid", UUID.randomUUID().toString());
- this.configuration.addDefault("debug", Boolean.valueOf(false));
- if (this.configuration.get("guid", null) == null)
- {
- this.configuration.options().header("http://mcstats.org").copyDefaults(true);
- this.configuration.save(this.configurationFile);
- }
- this.guid = this.configuration.getString("guid");
- this.debug = this.configuration.getBoolean("debug", false);
- }
-
- public boolean start()
- {
- synchronized (this.optOutLock)
- {
- if (isOptOut()) {
- return false;
- }
- if (this.task != null) {
- return true;
- }
- this.task = this.plugin.getServer().getScheduler().runTaskTimerAsynchronously(this.plugin, new Metrics.1(this),
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0L, 12000L);
-
- return true;
- }
- }
-
- public boolean isOptOut()
- {
- synchronized (this.optOutLock)
- {
- try
- {
- this.configuration.load(getConfigFile());
- }
- catch (IOException ex)
- {
- if (this.debug) {
- Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
- }
- return true;
- }
- catch (InvalidConfigurationException ex)
- {
- if (this.debug) {
- Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
- }
- return true;
- }
- return this.configuration.getBoolean("opt-out", false);
- }
- }
-
- public void enable()
- throws IOException
- {
- synchronized (this.optOutLock)
- {
- if (isOptOut())
- {
- this.configuration.set("opt-out", Boolean.valueOf(false));
- this.configuration.save(this.configurationFile);
- }
- if (this.task == null) {
- start();
- }
- }
- }
-
- public void disable()
- throws IOException
- {
- synchronized (this.optOutLock)
- {
- if (!isOptOut())
- {
- this.configuration.set("opt-out", Boolean.valueOf(true));
- this.configuration.save(this.configurationFile);
- }
- if (this.task != null)
- {
- this.task.cancel();
- this.task = null;
- }
- }
- }
-
- public File getConfigFile()
- {
- File pluginsFolder = this.plugin.getDataFolder().getParentFile();
-
-
- return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
- }
-
- private void postPlugin(boolean isPing)
- throws IOException
- {
- PluginDescriptionFile description = this.plugin.getDescription();
- String pluginName = description.getName();
- boolean onlineMode = Bukkit.getServer().getOnlineMode();
- String pluginVersion = description.getVersion();
- String serverVersion = Bukkit.getVersion();
- int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
-
-
-
-
- StringBuilder data = new StringBuilder();
-
-
- data.append(encode("guid")).append('=').append(encode(this.guid));
- encodeDataPair(data, "version", pluginVersion);
- encodeDataPair(data, "server", serverVersion);
- encodeDataPair(data, "players", Integer.toString(playersOnline));
- encodeDataPair(data, "revision", String.valueOf(6));
-
-
- String osname = System.getProperty("os.name");
- String osarch = System.getProperty("os.arch");
- String osversion = System.getProperty("os.version");
- String java_version = System.getProperty("java.version");
- int coreCount = Runtime.getRuntime().availableProcessors();
- if (osarch.equals("amd64")) {
- osarch = "x86_64";
- }
- encodeDataPair(data, "osname", osname);
- encodeDataPair(data, "osarch", osarch);
- encodeDataPair(data, "osversion", osversion);
- encodeDataPair(data, "cores", Integer.toString(coreCount));
- encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
- encodeDataPair(data, "java_version", java_version);
- if (isPing) {
- encodeDataPair(data, "ping", "true");
- }
- URL url = new URL("http://mcstats.org" + String.format("/report/%s", new Object[] { encode(pluginName) }));
- URLConnection connection;
- URLConnection connection;
- if (isMineshafterPresent()) {
- connection = url.openConnection(Proxy.NO_PROXY);
- } else {
- connection = url.openConnection();
- }
- connection.setDoOutput(true);
-
-
- OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
- writer.write(data.toString());
- writer.flush();
-
-
- BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
- String response = reader.readLine();
-
-
- writer.close();
- reader.close();
- if ((response == null) || (response.startsWith("ERR"))) {
- throw new IOException(response);
- }
- }
-
- private boolean isMineshafterPresent()
- {
- try
- {
- Class.forName("mineshafter.MineServer");
- return true;
- }
- catch (Exception e) {}
- return false;
- }
-
- private static void encodeDataPair(StringBuilder buffer, String key, String value)
- throws UnsupportedEncodingException
- {
- buffer.append('&').append(encode(key)).append('=').append(encode(value));
- }
-
- private static String encode(String text)
- throws UnsupportedEncodingException
- {
- return URLEncoder.encode(text, "UTF-8");
- }
-}
+package us.talabrek.ultimateskyblock;
+
+import org.bukkit.configuration.file.*;
+import org.bukkit.scheduler.*;
+import java.util.*;
+import org.bukkit.*;
+import java.util.logging.*;
+import org.bukkit.configuration.*;
+import org.bukkit.plugin.*;
+import java.io.*;
+import java.net.*;
+
+public class Metrics
+{
+ private static final int REVISION = 6;
+ private static final String BASE_URL = "http://mcstats.org";
+ private static final String REPORT_URL = "/report/%s";
+ private static final int PING_INTERVAL = 10;
+ private final Plugin plugin;
+ private final YamlConfiguration configuration;
+ private final File configurationFile;
+ private final String guid;
+ private final boolean debug;
+ private final Object optOutLock;
+ private volatile BukkitTask task;
+
+ public Metrics(final Plugin plugin) throws IOException {
+ super();
+ this.optOutLock = new Object();
+ this.task = null;
+ if (plugin == null) {
+ throw new IllegalArgumentException("Plugin cannot be null");
+ }
+ this.plugin = plugin;
+ this.configurationFile = this.getConfigFile();
+ (this.configuration = YamlConfiguration.loadConfiguration(this.configurationFile)).addDefault("opt-out", (Object)false);
+ this.configuration.addDefault("guid", (Object)UUID.randomUUID().toString());
+ this.configuration.addDefault("debug", (Object)false);
+ if (this.configuration.get("guid", (Object)null) == null) {
+ this.configuration.options().header("http://mcstats.org").copyDefaults(true);
+ this.configuration.save(this.configurationFile);
+ }
+ this.guid = this.configuration.getString("guid");
+ this.debug = this.configuration.getBoolean("debug", false);
+ }
+
+ public boolean start() {
+ synchronized (this.optOutLock) {
+ if (this.isOptOut()) {
+ // monitorexit(this.optOutLock)
+ return false;
+ }
+ if (this.task != null) {
+ // monitorexit(this.optOutLock)
+ return true;
+ }
+ this.task = this.plugin.getServer().getScheduler().runTaskTimerAsynchronously(this.plugin, (Runnable)new Runnable() {
+ private boolean firstPost = true;
+
+ @Override
+ public void run() {
+ try {
+ synchronized (Metrics.this.optOutLock) {
+ if (Metrics.this.isOptOut() && Metrics.this.task != null) {
+ Metrics.this.task.cancel();
+ Metrics.access$2(Metrics.this, null);
+ }
+ }
+ // monitorexit(Metrics.access$0(this.this$0))
+ Metrics.this.postPlugin(!this.firstPost);
+ this.firstPost = false;
+ }
+ catch (IOException e) {
+ if (Metrics.this.debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
+ }
+ }
+ }
+ }, 0L, 12000L);
+ // monitorexit(this.optOutLock)
+ return true;
+ }
+ }
+
+ public boolean isOptOut() {
+ synchronized (this.optOutLock) {
+ try {
+ this.configuration.load(this.getConfigFile());
+ }
+ catch (IOException ex) {
+ if (this.debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
+ }
+ // monitorexit(this.optOutLock)
+ return true;
+ }
+ catch (InvalidConfigurationException ex2) {
+ if (this.debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex2.getMessage());
+ }
+ // monitorexit(this.optOutLock)
+ return true;
+ }
+ // monitorexit(this.optOutLock)
+ return this.configuration.getBoolean("opt-out", false);
+ }
+ }
+
+ public void enable() throws IOException {
+ synchronized (this.optOutLock) {
+ if (this.isOptOut()) {
+ this.configuration.set("opt-out", (Object)false);
+ this.configuration.save(this.configurationFile);
+ }
+ if (this.task == null) {
+ this.start();
+ }
+ }
+ // monitorexit(this.optOutLock)
+ }
+
+ public void disable() throws IOException {
+ synchronized (this.optOutLock) {
+ if (!this.isOptOut()) {
+ this.configuration.set("opt-out", (Object)true);
+ this.configuration.save(this.configurationFile);
+ }
+ if (this.task != null) {
+ this.task.cancel();
+ this.task = null;
+ }
+ }
+ // monitorexit(this.optOutLock)
+ }
+
+ public File getConfigFile() {
+ final File pluginsFolder = this.plugin.getDataFolder().getParentFile();
+ return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
+ }
+
+ private void postPlugin(final boolean isPing) throws IOException {
+ final PluginDescriptionFile description = this.plugin.getDescription();
+ final String pluginName = description.getName();
+ final boolean onlineMode = Bukkit.getServer().getOnlineMode();
+ final String pluginVersion = description.getVersion();
+ final String serverVersion = Bukkit.getVersion();
+ final int playersOnline = Bukkit.getServer().getOnlinePlayers().size();
+ final StringBuilder data = new StringBuilder();
+ data.append(encode("guid")).append('=').append(encode(this.guid));
+ encodeDataPair(data, "version", pluginVersion);
+ encodeDataPair(data, "server", serverVersion);
+ encodeDataPair(data, "players", Integer.toString(playersOnline));
+ encodeDataPair(data, "revision", String.valueOf(6));
+ final String osname = System.getProperty("os.name");
+ String osarch = System.getProperty("os.arch");
+ final String osversion = System.getProperty("os.version");
+ final String java_version = System.getProperty("java.version");
+ final int coreCount = Runtime.getRuntime().availableProcessors();
+ if (osarch.equals("amd64")) {
+ osarch = "x86_64";
+ }
+ encodeDataPair(data, "osname", osname);
+ encodeDataPair(data, "osarch", osarch);
+ encodeDataPair(data, "osversion", osversion);
+ encodeDataPair(data, "cores", Integer.toString(coreCount));
+ encodeDataPair(data, "online-mode", Boolean.toString(onlineMode));
+ encodeDataPair(data, "java_version", java_version);
+ if (isPing) {
+ encodeDataPair(data, "ping", "true");
+ }
+ final URL url = new URL("http://mcstats.org" + String.format("/report/%s", encode(pluginName)));
+ URLConnection connection;
+ if (this.isMineshafterPresent()) {
+ connection = url.openConnection(Proxy.NO_PROXY);
+ }
+ else {
+ connection = url.openConnection();
+ }
+ connection.setDoOutput(true);
+ final OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream());
+ writer.write(data.toString());
+ writer.flush();
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ final String response = reader.readLine();
+ writer.close();
+ reader.close();
+ if (response == null || response.startsWith("ERR")) {
+ throw new IOException(response);
+ }
+ }
+
+ private boolean isMineshafterPresent() {
+ try {
+ Class.forName("mineshafter.MineServer");
+ return true;
+ }
+ catch (Exception e) {
+ return false;
+ }
+ }
+
+ private static void encodeDataPair(final StringBuilder buffer, final String key, final String value) throws UnsupportedEncodingException {
+ buffer.append('&').append(encode(key)).append('=').append(encode(value));
+ }
+
+ private static String encode(final String text) throws UnsupportedEncodingException {
+ return URLEncoder.encode(text, "UTF-8");
+ }
+
+ static /* synthetic */ void access$2(final Metrics metrics, final BukkitTask task) {
+ metrics.task = task;
+ }
+}
diff --git a/src/us/talabrek/ultimateskyblock/Party.java b/src/us/talabrek/ultimateskyblock/Party.java
index 17ec4c0b8..946377e8e 100644
--- a/src/us/talabrek/ultimateskyblock/Party.java
+++ b/src/us/talabrek/ultimateskyblock/Party.java
@@ -2,49 +2,42 @@
public class Party
{
- private String name;
- private int firstCompleted;
- private int timesCompleted;
-
- public Party(String name, int firstCompleted, int timesCompleted)
- {
- this.name = name;
- this.firstCompleted = firstCompleted;
- this.timesCompleted = timesCompleted;
- }
-
- public String getName()
- {
- return this.name;
- }
-
- public int getFirstCompleted()
- {
- return this.firstCompleted;
- }
-
- public int getTimesCompleted()
- {
- return this.timesCompleted;
- }
-
- public void setFirstCompleted(int newCompleted)
- {
- this.firstCompleted = newCompleted;
- }
-
- public void setTimesCompleted(int newCompleted)
- {
- this.timesCompleted = newCompleted;
- }
-
- public void addTimesCompleted()
- {
- this.timesCompleted += 1;
- }
-
- public void setName(String name)
- {
- this.name = name;
- }
+ private String name;
+ private int firstCompleted;
+ private int timesCompleted;
+
+ public Party(final String name, final int firstCompleted, final int timesCompleted) {
+ super();
+ this.name = name;
+ this.firstCompleted = firstCompleted;
+ this.timesCompleted = timesCompleted;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public int getFirstCompleted() {
+ return this.firstCompleted;
+ }
+
+ public int getTimesCompleted() {
+ return this.timesCompleted;
+ }
+
+ public void setFirstCompleted(final int newCompleted) {
+ this.firstCompleted = newCompleted;
+ }
+
+ public void setTimesCompleted(final int newCompleted) {
+ this.timesCompleted = newCompleted;
+ }
+
+ public void addTimesCompleted() {
+ ++this.timesCompleted;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
}
diff --git a/src/us/talabrek/ultimateskyblock/PlayerInfo.java b/src/us/talabrek/ultimateskyblock/PlayerInfo.java
index 81ca68c6a..f78282a54 100644
--- a/src/us/talabrek/ultimateskyblock/PlayerInfo.java
+++ b/src/us/talabrek/ultimateskyblock/PlayerInfo.java
@@ -1,498 +1,420 @@
-package us.talabrek.ultimateskyblock;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.io.Serializable;
-import java.util.Calendar;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Player;
-
-public class PlayerInfo
- implements Serializable
-{
- private static final long serialVersionUID = 1L;
- private String playerName;
- private boolean hasIsland;
- private boolean hasParty;
- private String islandLocation;
- private String homeLocation;
- private HashMap challengeListNew;
- private String partyIslandLocation;
- private FileConfiguration playerData;
- private File playerConfigFile;
-
- public PlayerInfo(String playerName)
- {
- this.playerName = playerName;
- loadPlayer(playerName);
- }
-
- public PlayerInfo(String playerName, boolean hasIsland, int iX, int iY, int iZ, int hX, int hY, int hZ)
- {
- this.playerName = playerName;
- this.hasIsland = hasIsland;
- if ((iX == 0) && (iY == 0) && (iZ == 0)) {
- this.islandLocation = null;
- } else {
- this.islandLocation = getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), iX, iY, iZ));
- }
- if ((hX == 0) && (hY == 0) && (hZ == 0)) {
- this.homeLocation = null;
- } else {
- this.homeLocation = getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), hX, hY, hZ));
- }
- this.challengeListNew = new HashMap();
- buildChallengeList();
- }
-
- public void startNewIsland(Location l)
- {
- this.hasIsland = true;
- setIslandLocation(l);
- this.hasParty = false;
- this.homeLocation = null;
- }
-
- public void removeFromIsland()
- {
- this.hasIsland = false;
- setIslandLocation(null);
- this.hasParty = false;
- this.homeLocation = null;
- }
-
- public void setPlayerName(String s)
- {
- this.playerName = s;
- }
-
- public boolean getHasIsland()
- {
- return this.hasIsland;
- }
-
- public String locationForParty()
- {
- return getPartyLocationString(this.islandLocation);
- }
-
- public String locationForPartyOld()
- {
- return getPartyLocationString(this.partyIslandLocation);
- }
-
- public Player getPlayer()
- {
- return Bukkit.getPlayer(this.playerName);
- }
-
- public String getPlayerName()
- {
- return this.playerName;
- }
-
- public void setHasIsland(boolean b)
- {
- this.hasIsland = b;
- }
-
- public void setIslandLocation(Location l)
- {
- this.islandLocation = getStringLocation(l);
- }
-
- public Location getIslandLocation()
- {
- return getLocationString(this.islandLocation);
- }
-
- public void setHomeLocation(Location l)
- {
- this.homeLocation = getStringLocation(l);
- }
-
- public Location getHomeLocation()
- {
- return getLocationString(this.homeLocation);
- }
-
- public boolean getHasParty()
- {
- return this.hasParty;
- }
-
- public void setJoinParty(Location l)
- {
- this.hasParty = true;
- this.islandLocation = getStringLocation(l);
- this.hasIsland = true;
- }
-
- public void setLeaveParty()
- {
- this.hasParty = false;
- this.islandLocation = null;
- this.hasIsland = false;
- if (Bukkit.getPlayer(this.playerName) == null) {
- getPlayerConfig(this.playerName).set("player.kickWarning", Boolean.valueOf(true));
- }
- }
-
- private Location getLocationString(String s)
- {
- if ((s == null) || (s.trim() == "")) {
- return null;
- }
- String[] parts = s.split(":");
- if (parts.length == 4)
- {
- World w = Bukkit.getServer().getWorld(parts[0]);
- int x = Integer.parseInt(parts[1]);
- int y = Integer.parseInt(parts[2]);
- int z = Integer.parseInt(parts[3]);
- return new Location(w, x, y, z);
- }
- return null;
- }
-
- private String getPartyLocationString(String s)
- {
- if ((s == null) || (s.trim() == "")) {
- return null;
- }
- String[] parts = s.split(":");
- if (parts.length == 4) {
- return parts[1] + "," + parts[3];
- }
- return null;
- }
-
- public void completeChallenge(String challenge)
- {
- if (this.challengeListNew.containsKey(challenge))
- {
- if (!onChallengeCooldown(challenge)) {
- if (uSkyBlock.getInstance().getConfig().contains("options.challenges.challengeList." + challenge + ".resetInHours")) {
- ((Challenge)this.challengeListNew.get(challenge)).setFirstCompleted(Calendar.getInstance().getTimeInMillis() + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".resetInHours") * 3600000);
- } else if (uSkyBlock.getInstance().getConfig().contains("options.challenges.defaultResetInHours")) {
- ((Challenge)this.challengeListNew.get(challenge)).setFirstCompleted(Calendar.getInstance().getTimeInMillis() + uSkyBlock.getInstance().getConfig().getInt("options.challenges.defaultResetInHours") * 3600000);
- } else {
- ((Challenge)this.challengeListNew.get(challenge)).setFirstCompleted(Calendar.getInstance().getTimeInMillis() + 518400000L);
- }
- }
- ((Challenge)this.challengeListNew.get(challenge)).addTimesCompleted();
- }
- }
-
- public long getChallengeCooldownTime(String challenge)
- {
- if (getChallenge(challenge).getFirstCompleted() > 0L)
- {
- if (getChallenge(challenge).getFirstCompleted() > Calendar.getInstance().getTimeInMillis()) {
- return getChallenge(challenge).getFirstCompleted() - Calendar.getInstance().getTimeInMillis();
- }
- return 0L;
- }
- return 0L;
- }
-
- public boolean onChallengeCooldown(String challenge)
- {
- if (getChallenge(challenge).getFirstCompleted() > 0L)
- {
- if (getChallenge(challenge).getFirstCompleted() > Calendar.getInstance().getTimeInMillis()) {
- return true;
- }
- return false;
- }
- return false;
- }
-
- public void resetChallenge(String challenge)
- {
- if (this.challengeListNew.containsKey(challenge))
- {
- ((Challenge)this.challengeListNew.get(challenge)).setTimesCompleted(0);
- ((Challenge)this.challengeListNew.get(challenge)).setFirstCompleted(0L);
- }
- }
-
- public int checkChallenge(String challenge)
- {
- try
- {
- if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
- return ((Challenge)this.challengeListNew.get(challenge.toLowerCase())).getTimesCompleted();
- }
- }
- catch (ClassCastException localClassCastException) {}
- return 0;
- }
-
- public int checkChallengeSinceTimer(String challenge)
- {
- try
- {
- if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
- return ((Challenge)this.challengeListNew.get(challenge.toLowerCase())).getTimesCompletedSinceTimer();
- }
- }
- catch (ClassCastException localClassCastException) {}
- return 0;
- }
-
- public Challenge getChallenge(String challenge)
- {
- if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
- return (Challenge)this.challengeListNew.get(challenge.toLowerCase());
- }
- return null;
- }
-
- public boolean challengeExists(String challenge)
- {
- if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
- return true;
- }
- return false;
- }
-
- public void resetAllChallenges()
- {
- this.challengeListNew = null;
- buildChallengeList();
- }
-
- public void displayData(String player)
- {
- System.out.print(player + " has an island: " + getHasIsland());
- if (getIslandLocation() != null) {
- System.out.print(player + " island location: " + getIslandLocation().toString());
- }
- if (getHomeLocation() != null) {
- System.out.print(player + " home location: " + getHomeLocation().toString());
- }
- }
-
- public void buildChallengeList()
- {
- if (this.challengeListNew == null) {
- this.challengeListNew = new HashMap();
- }
- Iterator itr = Settings.challenges_challengeList.iterator();
- while (itr.hasNext())
- {
- String current = (String)itr.next();
- if (!this.challengeListNew.containsKey(current.toLowerCase())) {
- this.challengeListNew.put(current.toLowerCase(), new Challenge(current.toLowerCase(), 0L, 0, 0));
- }
- }
- if (this.challengeListNew.size() > Settings.challenges_challengeList.size())
- {
- Object[] challengeArray = this.challengeListNew.keySet().toArray();
- for (int i = 0; i < challengeArray.length; i++) {
- if (!Settings.challenges_challengeList.contains(challengeArray[i].toString())) {
- this.challengeListNew.remove(challengeArray[i].toString());
- }
- }
- }
- }
-
- public void displayChallengeList()
- {
- Iterator itr = this.challengeListNew.keySet().iterator();
- System.out.print("Displaying Challenge list for " + this.playerName);
- while (itr.hasNext())
- {
- String current = (String)itr.next();
- System.out.print(current + ": " + this.challengeListNew.get(current));
- }
- }
-
- private String getStringLocation(Location l)
- {
- if (l == null) {
- return "";
- }
- return l.getWorld().getName() + ":" + l.getBlockX() + ":" + l.getBlockY() + ":" + l.getBlockZ();
- }
-
- public Location getPartyIslandLocation()
- {
- return getLocationString(this.partyIslandLocation);
- }
-
- public void setupPlayer(String player)
- {
- System.out.println("Creating player config Paths!");
- getPlayerConfig(player).createSection("player");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "hasIsland");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "islandX");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "islandY");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "islandZ");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "homeX");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "homeY");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "homeZ");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player"), "challenges");
- getPlayerConfig(player).set("player.hasIsland", Boolean.valueOf(false));
- getPlayerConfig(player).set("player.islandX", Integer.valueOf(0));
- getPlayerConfig(player).set("player.islandY", Integer.valueOf(0));
- getPlayerConfig(player).set("player.islandZ", Integer.valueOf(0));
- getPlayerConfig(player).set("player.homeX", Integer.valueOf(0));
- getPlayerConfig(player).set("player.homeY", Integer.valueOf(0));
- getPlayerConfig(player).set("player.homeZ", Integer.valueOf(0));
- getPlayerConfig(player).set("player.kickWarning", Boolean.valueOf(false));
- Iterator ent = this.challengeListNew.keySet().iterator();
- String currentChallenge = "";
- while (ent.hasNext())
- {
- currentChallenge = (String)ent.next();
- getPlayerConfig(player).createSection("player.challenges." + currentChallenge);
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player.challenges." + currentChallenge), "firstCompleted");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player.challenges." + currentChallenge), "timesCompleted");
- getPlayerConfig(player);FileConfiguration.createPath(getPlayerConfig(player).getConfigurationSection("player.challenges." + currentChallenge), "timesCompletedSinceTimer");
- getPlayerConfig(player).set("player.challenges." + currentChallenge + ".firstCompleted", Long.valueOf(((Challenge)this.challengeListNew.get(currentChallenge)).getFirstCompleted()));
- getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompleted", Integer.valueOf(((Challenge)this.challengeListNew.get(currentChallenge)).getTimesCompleted()));
- getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompletedSinceTimer", Integer.valueOf(((Challenge)this.challengeListNew.get(currentChallenge)).getTimesCompletedSinceTimer()));
- }
- }
-
- public PlayerInfo loadPlayer(String player)
- {
- if (!getPlayerConfig(player).contains("player.hasIsland"))
- {
- this.playerName = player;
- this.hasIsland = false;
- this.islandLocation = null;
- this.homeLocation = null;
- this.hasParty = false;
- buildChallengeList();
- createPlayerConfig(player);
- return this;
- }
- try
- {
- this.hasIsland = getPlayerConfig(player).getBoolean("player.hasIsland");
- this.islandLocation = getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), getPlayerConfig(player).getInt("player.islandX"), getPlayerConfig(player).getInt("player.islandY"), getPlayerConfig(player).getInt("player.islandZ")));
- this.homeLocation = getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), getPlayerConfig(player).getInt("player.homeX"), getPlayerConfig(player).getInt("player.homeY"), getPlayerConfig(player).getInt("player.homeZ")));
- buildChallengeList();
-
- Iterator ent = Settings.challenges_challengeList.iterator();
- String currentChallenge = "";
- this.challengeListNew = new HashMap();
- while (ent.hasNext())
- {
- currentChallenge = (String)ent.next();
- this.challengeListNew.put(currentChallenge, new Challenge(currentChallenge, getPlayerConfig(player).getLong("player.challenges." + currentChallenge + ".firstCompleted"), getPlayerConfig(player).getInt("player.challenges." + currentChallenge + ".timesCompleted"), getPlayerConfig(player).getInt("player.challenges." + currentChallenge + ".timesCompletedSinceTimer")));
- }
- if (Bukkit.getPlayer(player) != null) {
- if (getPlayerConfig(player).getBoolean("player.kickWarning"))
- {
- Bukkit.getPlayer(player).sendMessage("§cYou were removed from your island since the last time you played!");
- getPlayerConfig(player).set("player.kickWarning", Boolean.valueOf(false));
- }
- }
- return this;
- }
- catch (Exception e)
- {
- e.printStackTrace();
-
- System.out.println("Returning null while loading, not good!");
- }
- return null;
- }
-
- public void reloadPlayerConfig(String player)
- {
- this.playerConfigFile = new File(uSkyBlock.getInstance().directoryPlayers, player + ".yml");
- this.playerData = YamlConfiguration.loadConfiguration(this.playerConfigFile);
- }
-
- public void createPlayerConfig(String player)
- {
- System.out.println("Creating new player config!");
- getPlayerConfig(player);
- setupPlayer(player);
- }
-
- public FileConfiguration getPlayerConfig(String player)
- {
- if (this.playerData == null)
- {
- System.out.println("Reloading player data!");
- reloadPlayerConfig(player);
- }
- return this.playerData;
- }
-
- public void savePlayerConfig(String player)
- {
- if (this.playerData == null)
- {
- System.out.println("Can't save player data!");
- return;
- }
- getPlayerConfig(player).set("player.hasIsland", Boolean.valueOf(getHasIsland()));
- if (getIslandLocation() != null)
- {
- getPlayerConfig(player).set("player.islandX", Integer.valueOf(getIslandLocation().getBlockX()));
- getPlayerConfig(player).set("player.islandY", Integer.valueOf(getIslandLocation().getBlockY()));
- getPlayerConfig(player).set("player.islandZ", Integer.valueOf(getIslandLocation().getBlockZ()));
- }
- else
- {
- getPlayerConfig(player).set("player.islandX", Integer.valueOf(0));
- getPlayerConfig(player).set("player.islandY", Integer.valueOf(0));
- getPlayerConfig(player).set("player.islandZ", Integer.valueOf(0));
- }
- if (getHomeLocation() != null)
- {
- getPlayerConfig(player).set("player.homeX", Integer.valueOf(getHomeLocation().getBlockX()));
- getPlayerConfig(player).set("player.homeY", Integer.valueOf(getHomeLocation().getBlockY()));
- getPlayerConfig(player).set("player.homeZ", Integer.valueOf(getHomeLocation().getBlockZ()));
- }
- else
- {
- getPlayerConfig(player).set("player.homeX", Integer.valueOf(0));
- getPlayerConfig(player).set("player.homeY", Integer.valueOf(0));
- getPlayerConfig(player).set("player.homeZ", Integer.valueOf(0));
- }
- Iterator ent = this.challengeListNew.keySet().iterator();
- String currentChallenge = "";
- while (ent.hasNext())
- {
- currentChallenge = (String)ent.next();
- getPlayerConfig(player).set("player.challenges." + currentChallenge + ".firstCompleted", Long.valueOf(((Challenge)this.challengeListNew.get(currentChallenge)).getFirstCompleted()));
- getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompleted", Integer.valueOf(((Challenge)this.challengeListNew.get(currentChallenge)).getTimesCompleted()));
- getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompletedSinceTimer", Integer.valueOf(((Challenge)this.challengeListNew.get(currentChallenge)).getTimesCompletedSinceTimer()));
- }
- this.playerConfigFile = new File(uSkyBlock.getInstance().directoryPlayers, player + ".yml");
- try
- {
- getPlayerConfig(player).save(this.playerConfigFile);
- System.out.println("Player data saved!");
- }
- catch (IOException ex)
- {
- uSkyBlock.getInstance().getLogger().log(Level.SEVERE, "Could not save config to " + this.playerConfigFile, ex);
- }
- }
-
- public void deleteIslandConfig(String player)
- {
- this.playerConfigFile = new File(uSkyBlock.getInstance().directoryPlayers, player + ".yml");
- this.playerConfigFile.delete();
- }
-}
+package us.talabrek.ultimateskyblock;
+
+import org.bukkit.entity.*;
+import org.bukkit.*;
+import java.util.*;
+import org.bukkit.configuration.file.*;
+import java.util.logging.*;
+import java.io.*;
+
+public class PlayerInfo implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+ private String playerName;
+ private boolean hasIsland;
+ private boolean hasParty;
+ private String islandLocation;
+ private String homeLocation;
+ private HashMap challengeListNew;
+ private String partyIslandLocation;
+ private FileConfiguration playerData;
+ private File playerConfigFile;
+
+ public PlayerInfo(final String playerName) {
+ super();
+ this.loadPlayer(this.playerName = playerName);
+ }
+
+ public PlayerInfo(final String playerName, final boolean hasIsland, final int iX, final int iY, final int iZ, final int hX, final int hY, final int hZ) {
+ super();
+ this.playerName = playerName;
+ this.hasIsland = hasIsland;
+ if (iX == 0 && iY == 0 && iZ == 0) {
+ this.islandLocation = null;
+ }
+ else {
+ this.islandLocation = this.getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), (double)iX, (double)iY, (double)iZ));
+ }
+ if (hX == 0 && hY == 0 && hZ == 0) {
+ this.homeLocation = null;
+ }
+ else {
+ this.homeLocation = this.getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), (double)hX, (double)hY, (double)hZ));
+ }
+ this.challengeListNew = new HashMap();
+ this.buildChallengeList();
+ }
+
+ public void startNewIsland(final Location l) {
+ this.hasIsland = true;
+ this.setIslandLocation(l);
+ this.hasParty = false;
+ this.homeLocation = null;
+ }
+
+ public void removeFromIsland() {
+ this.hasIsland = false;
+ this.setIslandLocation(null);
+ this.hasParty = false;
+ this.homeLocation = null;
+ }
+
+ public void setPlayerName(final String s) {
+ this.playerName = s;
+ }
+
+ public boolean getHasIsland() {
+ return this.hasIsland;
+ }
+
+ public String locationForParty() {
+ return this.getPartyLocationString(this.islandLocation);
+ }
+
+ public String locationForPartyOld() {
+ return this.getPartyLocationString(this.partyIslandLocation);
+ }
+
+ public Player getPlayer() {
+ return Bukkit.getPlayer(this.playerName);
+ }
+
+ public String getPlayerName() {
+ return this.playerName;
+ }
+
+ public void setHasIsland(final boolean b) {
+ this.hasIsland = b;
+ }
+
+ public void setIslandLocation(final Location l) {
+ this.islandLocation = this.getStringLocation(l);
+ }
+
+ public Location getIslandLocation() {
+ return this.getLocationString(this.islandLocation);
+ }
+
+ public void setHomeLocation(final Location l) {
+ this.homeLocation = this.getStringLocation(l);
+ }
+
+ public Location getHomeLocation() {
+ return this.getLocationString(this.homeLocation);
+ }
+
+ public boolean getHasParty() {
+ return this.hasParty;
+ }
+
+ public void setJoinParty(final Location l) {
+ this.hasParty = true;
+ this.islandLocation = this.getStringLocation(l);
+ this.hasIsland = true;
+ }
+
+ public void setLeaveParty() {
+ this.hasParty = false;
+ this.islandLocation = null;
+ this.hasIsland = false;
+ if (Bukkit.getPlayer(this.playerName) == null) {
+ this.getPlayerConfig(this.playerName).set("player.kickWarning", (Object)true);
+ }
+ }
+
+ private Location getLocationString(final String s) {
+ if (s == null || s.trim() == "") {
+ return null;
+ }
+ final String[] parts = s.split(":");
+ if (parts.length == 4) {
+ final World w = Bukkit.getServer().getWorld(parts[0]);
+ final int x = Integer.parseInt(parts[1]);
+ final int y = Integer.parseInt(parts[2]);
+ final int z = Integer.parseInt(parts[3]);
+ return new Location(w, (double)x, (double)y, (double)z);
+ }
+ return null;
+ }
+
+ private String getPartyLocationString(final String s) {
+ if (s == null || s.trim() == "") {
+ return null;
+ }
+ final String[] parts = s.split(":");
+ if (parts.length == 4) {
+ return String.valueOf(parts[1]) + "," + parts[3];
+ }
+ return null;
+ }
+
+ public void completeChallenge(final String challenge) {
+ if (this.challengeListNew.containsKey(challenge)) {
+ if (!this.onChallengeCooldown(challenge)) {
+ if (uSkyBlock.getInstance().getConfig().contains("options.challenges.challengeList." + challenge + ".resetInHours")) {
+ this.challengeListNew.get(challenge).setFirstCompleted(Calendar.getInstance().getTimeInMillis() + uSkyBlock.getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".resetInHours") * 3600000);
+ }
+ else if (uSkyBlock.getInstance().getConfig().contains("options.challenges.defaultResetInHours")) {
+ this.challengeListNew.get(challenge).setFirstCompleted(Calendar.getInstance().getTimeInMillis() + uSkyBlock.getInstance().getConfig().getInt("options.challenges.defaultResetInHours") * 3600000);
+ }
+ else {
+ this.challengeListNew.get(challenge).setFirstCompleted(Calendar.getInstance().getTimeInMillis() + 518400000L);
+ }
+ }
+ this.challengeListNew.get(challenge).addTimesCompleted();
+ }
+ }
+
+ public long getChallengeCooldownTime(final String challenge) {
+ if (this.getChallenge(challenge).getFirstCompleted() <= 0L) {
+ return 0L;
+ }
+ if (this.getChallenge(challenge).getFirstCompleted() > Calendar.getInstance().getTimeInMillis()) {
+ return this.getChallenge(challenge).getFirstCompleted() - Calendar.getInstance().getTimeInMillis();
+ }
+ return 0L;
+ }
+
+ public boolean onChallengeCooldown(final String challenge) {
+ return this.getChallenge(challenge).getFirstCompleted() > 0L && this.getChallenge(challenge).getFirstCompleted() > Calendar.getInstance().getTimeInMillis();
+ }
+
+ public void resetChallenge(final String challenge) {
+ if (this.challengeListNew.containsKey(challenge)) {
+ this.challengeListNew.get(challenge).setTimesCompleted(0);
+ this.challengeListNew.get(challenge).setFirstCompleted(0L);
+ }
+ }
+
+ public int checkChallenge(final String challenge) {
+ try {
+ if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
+ return this.challengeListNew.get(challenge.toLowerCase()).getTimesCompleted();
+ }
+ }
+ catch (ClassCastException ex) {}
+ return 0;
+ }
+
+ public int checkChallengeSinceTimer(final String challenge) {
+ try {
+ if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
+ return this.challengeListNew.get(challenge.toLowerCase()).getTimesCompletedSinceTimer();
+ }
+ }
+ catch (ClassCastException ex) {}
+ return 0;
+ }
+
+ public Challenge getChallenge(final String challenge) {
+ if (this.challengeListNew.containsKey(challenge.toLowerCase())) {
+ return this.challengeListNew.get(challenge.toLowerCase());
+ }
+ return null;
+ }
+
+ public boolean challengeExists(final String challenge) {
+ return this.challengeListNew.containsKey(challenge.toLowerCase());
+ }
+
+ public void resetAllChallenges() {
+ this.challengeListNew = null;
+ this.buildChallengeList();
+ }
+
+ public void displayData(final String player) {
+ System.out.print(String.valueOf(player) + " has an island: " + this.getHasIsland());
+ if (this.getIslandLocation() != null) {
+ System.out.print(String.valueOf(player) + " island location: " + this.getIslandLocation().toString());
+ }
+ if (this.getHomeLocation() != null) {
+ System.out.print(String.valueOf(player) + " home location: " + this.getHomeLocation().toString());
+ }
+ }
+
+ public void buildChallengeList() {
+ if (this.challengeListNew == null) {
+ this.challengeListNew = new HashMap();
+ }
+ for (final String current : Settings.challenges_challengeList) {
+ if (!this.challengeListNew.containsKey(current.toLowerCase())) {
+ this.challengeListNew.put(current.toLowerCase(), new Challenge(current.toLowerCase(), 0L, 0, 0));
+ }
+ }
+ if (this.challengeListNew.size() > Settings.challenges_challengeList.size()) {
+ final Object[] challengeArray = this.challengeListNew.keySet().toArray();
+ for (int i = 0; i < challengeArray.length; ++i) {
+ if (!Settings.challenges_challengeList.contains(challengeArray[i].toString())) {
+ this.challengeListNew.remove(challengeArray[i].toString());
+ }
+ }
+ }
+ }
+
+ public void displayChallengeList() {
+ final Iterator itr = this.challengeListNew.keySet().iterator();
+ System.out.print("Displaying Challenge list for " + this.playerName);
+ while (itr.hasNext()) {
+ final String current = itr.next();
+ System.out.print(String.valueOf(current) + ": " + this.challengeListNew.get(current));
+ }
+ }
+
+ private String getStringLocation(final Location l) {
+ if (l == null) {
+ return "";
+ }
+ return String.valueOf(l.getWorld().getName()) + ":" + l.getBlockX() + ":" + l.getBlockY() + ":" + l.getBlockZ();
+ }
+
+ public Location getPartyIslandLocation() {
+ return this.getLocationString(this.partyIslandLocation);
+ }
+
+ public void setupPlayer(final String player) {
+ System.out.println("Creating player config Paths!");
+ this.getPlayerConfig(player).createSection("player");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "hasIsland");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "islandX");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "islandY");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "islandZ");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "homeX");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "homeY");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "homeZ");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player"), "challenges");
+ this.getPlayerConfig(player).set("player.hasIsland", (Object)false);
+ this.getPlayerConfig(player).set("player.islandX", (Object)0);
+ this.getPlayerConfig(player).set("player.islandY", (Object)0);
+ this.getPlayerConfig(player).set("player.islandZ", (Object)0);
+ this.getPlayerConfig(player).set("player.homeX", (Object)0);
+ this.getPlayerConfig(player).set("player.homeY", (Object)0);
+ this.getPlayerConfig(player).set("player.homeZ", (Object)0);
+ this.getPlayerConfig(player).set("player.kickWarning", (Object)false);
+ final Iterator ent = this.challengeListNew.keySet().iterator();
+ String currentChallenge = "";
+ while (ent.hasNext()) {
+ currentChallenge = ent.next();
+ this.getPlayerConfig(player).createSection("player.challenges." + currentChallenge);
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player.challenges." + currentChallenge), "firstCompleted");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player.challenges." + currentChallenge), "timesCompleted");
+ this.getPlayerConfig(player);
+ FileConfiguration.createPath(this.getPlayerConfig(player).getConfigurationSection("player.challenges." + currentChallenge), "timesCompletedSinceTimer");
+ this.getPlayerConfig(player).set("player.challenges." + currentChallenge + ".firstCompleted", (Object)this.challengeListNew.get(currentChallenge).getFirstCompleted());
+ this.getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompleted", (Object)this.challengeListNew.get(currentChallenge).getTimesCompleted());
+ this.getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompletedSinceTimer", (Object)this.challengeListNew.get(currentChallenge).getTimesCompletedSinceTimer());
+ }
+ }
+
+ public PlayerInfo loadPlayer(final String player) {
+ if (!this.getPlayerConfig(player).contains("player.hasIsland")) {
+ this.playerName = player;
+ this.hasIsland = false;
+ this.islandLocation = null;
+ this.homeLocation = null;
+ this.hasParty = false;
+ this.buildChallengeList();
+ this.createPlayerConfig(player);
+ return this;
+ }
+ try {
+ this.hasIsland = this.getPlayerConfig(player).getBoolean("player.hasIsland");
+ this.islandLocation = this.getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), (double)this.getPlayerConfig(player).getInt("player.islandX"), (double)this.getPlayerConfig(player).getInt("player.islandY"), (double)this.getPlayerConfig(player).getInt("player.islandZ")));
+ this.homeLocation = this.getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), (double)this.getPlayerConfig(player).getInt("player.homeX"), (double)this.getPlayerConfig(player).getInt("player.homeY"), (double)this.getPlayerConfig(player).getInt("player.homeZ")));
+ this.buildChallengeList();
+ final Iterator ent = Settings.challenges_challengeList.iterator();
+ String currentChallenge = "";
+ this.challengeListNew = new HashMap();
+ while (ent.hasNext()) {
+ currentChallenge = ent.next();
+ this.challengeListNew.put(currentChallenge, new Challenge(currentChallenge, this.getPlayerConfig(player).getLong("player.challenges." + currentChallenge + ".firstCompleted"), this.getPlayerConfig(player).getInt("player.challenges." + currentChallenge + ".timesCompleted"), this.getPlayerConfig(player).getInt("player.challenges." + currentChallenge + ".timesCompletedSinceTimer")));
+ }
+ if (Bukkit.getPlayer(player) != null && this.getPlayerConfig(player).getBoolean("player.kickWarning")) {
+ Bukkit.getPlayer(player).sendMessage("§cYou were removed from your island since the last time you played!");
+ this.getPlayerConfig(player).set("player.kickWarning", (Object)false);
+ }
+ return this;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ System.out.println("Returning null while loading, not good!");
+ return null;
+ }
+ }
+
+ public void reloadPlayerConfig(final String player) {
+ this.playerConfigFile = new File(uSkyBlock.getInstance().directoryPlayers, String.valueOf(player) + ".yml");
+ this.playerData = (FileConfiguration)YamlConfiguration.loadConfiguration(this.playerConfigFile);
+ }
+
+ public void createPlayerConfig(final String player) {
+ System.out.println("Creating new player config!");
+ this.getPlayerConfig(player);
+ this.setupPlayer(player);
+ }
+
+ public FileConfiguration getPlayerConfig(final String player) {
+ if (this.playerData == null) {
+ System.out.println("Reloading player data!");
+ this.reloadPlayerConfig(player);
+ }
+ return this.playerData;
+ }
+
+ public void savePlayerConfig(final String player) {
+ if (this.playerData == null) {
+ System.out.println("Can't save player data!");
+ return;
+ }
+ this.getPlayerConfig(player).set("player.hasIsland", (Object)this.getHasIsland());
+ if (this.getIslandLocation() != null) {
+ this.getPlayerConfig(player).set("player.islandX", (Object)this.getIslandLocation().getBlockX());
+ this.getPlayerConfig(player).set("player.islandY", (Object)this.getIslandLocation().getBlockY());
+ this.getPlayerConfig(player).set("player.islandZ", (Object)this.getIslandLocation().getBlockZ());
+ }
+ else {
+ this.getPlayerConfig(player).set("player.islandX", (Object)0);
+ this.getPlayerConfig(player).set("player.islandY", (Object)0);
+ this.getPlayerConfig(player).set("player.islandZ", (Object)0);
+ }
+ if (this.getHomeLocation() != null) {
+ this.getPlayerConfig(player).set("player.homeX", (Object)this.getHomeLocation().getBlockX());
+ this.getPlayerConfig(player).set("player.homeY", (Object)this.getHomeLocation().getBlockY());
+ this.getPlayerConfig(player).set("player.homeZ", (Object)this.getHomeLocation().getBlockZ());
+ }
+ else {
+ this.getPlayerConfig(player).set("player.homeX", (Object)0);
+ this.getPlayerConfig(player).set("player.homeY", (Object)0);
+ this.getPlayerConfig(player).set("player.homeZ", (Object)0);
+ }
+ final Iterator ent = this.challengeListNew.keySet().iterator();
+ String currentChallenge = "";
+ while (ent.hasNext()) {
+ currentChallenge = ent.next();
+ this.getPlayerConfig(player).set("player.challenges." + currentChallenge + ".firstCompleted", (Object)this.challengeListNew.get(currentChallenge).getFirstCompleted());
+ this.getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompleted", (Object)this.challengeListNew.get(currentChallenge).getTimesCompleted());
+ this.getPlayerConfig(player).set("player.challenges." + currentChallenge + ".timesCompletedSinceTimer", (Object)this.challengeListNew.get(currentChallenge).getTimesCompletedSinceTimer());
+ }
+ this.playerConfigFile = new File(uSkyBlock.getInstance().directoryPlayers, String.valueOf(player) + ".yml");
+ try {
+ this.getPlayerConfig(player).save(this.playerConfigFile);
+ System.out.println("Player data saved!");
+ }
+ catch (IOException ex) {
+ uSkyBlock.getInstance().getLogger().log(Level.SEVERE, "Could not save config to " + this.playerConfigFile, ex);
+ }
+ }
+
+ public void deleteIslandConfig(final String player) {
+ (this.playerConfigFile = new File(uSkyBlock.getInstance().directoryPlayers, String.valueOf(player) + ".yml")).delete();
+ }
+}
diff --git a/src/us/talabrek/ultimateskyblock/PlayerInfoOld.java b/src/us/talabrek/ultimateskyblock/PlayerInfoOld.java
index f2f44939e..b20a5aea0 100644
--- a/src/us/talabrek/ultimateskyblock/PlayerInfoOld.java
+++ b/src/us/talabrek/ultimateskyblock/PlayerInfoOld.java
@@ -1,188 +1,163 @@
package us.talabrek.ultimateskyblock;
-import java.io.PrintStream;
-import java.io.Serializable;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
+import java.io.*;
+import org.bukkit.entity.*;
+import org.bukkit.*;
-public class PlayerInfoOld
- implements Serializable
+public class PlayerInfoOld implements Serializable
{
- private static final long serialVersionUID = 1L;
- private String playerName;
- private boolean hasIsland;
- private boolean hasParty;
- private String islandLocation;
- private String homeLocation;
- private String partyIslandLocation;
-
- public PlayerInfoOld(String playerName)
- {
- this.hasIsland = false;
- this.hasParty = false;
- this.islandLocation = "";
- this.homeLocation = "";
- }
-
- public PlayerInfoOld(String playerName, boolean hasIsland, int iX, int iY, int iZ, int hX, int hY, int hZ)
- {
- this.playerName = playerName;
- this.hasIsland = hasIsland;
- if ((iX == 0) && (iY == 0) && (iZ == 0)) {
- this.islandLocation = null;
- } else {
- this.islandLocation = getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), iX, iY, iZ));
- }
- if ((hX == 0) && (hY == 0) && (hZ == 0)) {
- this.homeLocation = null;
- } else {
- this.homeLocation = getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), hX, hY, hZ));
- }
- }
-
- public void startNewIsland(Location l)
- {
- this.hasIsland = true;
- setIslandLocation(l);
- this.hasParty = false;
- this.homeLocation = null;
- }
-
- public void removeFromIsland()
- {
- this.hasIsland = false;
- setIslandLocation(null);
- this.hasParty = false;
- this.homeLocation = null;
- }
-
- public void setPlayerName(String s)
- {
- this.playerName = s;
- }
-
- public boolean getHasIsland()
- {
- return this.hasIsland;
- }
-
- public String locationForParty()
- {
- return getPartyLocationString(this.islandLocation);
- }
-
- public String locationForPartyOld()
- {
- return getPartyLocationString(this.partyIslandLocation);
- }
-
- public Player getPlayer()
- {
- return Bukkit.getPlayer(this.playerName);
- }
-
- public String getPlayerName()
- {
- return this.playerName;
- }
-
- public void setHasIsland(boolean b)
- {
- this.hasIsland = b;
- }
-
- public void setIslandLocation(Location l)
- {
- this.islandLocation = getStringLocation(l);
- }
-
- public Location getIslandLocation()
- {
- return getLocationString(this.islandLocation);
- }
-
- public void setHomeLocation(Location l)
- {
- this.homeLocation = getStringLocation(l);
- }
-
- public Location getHomeLocation()
- {
- return getLocationString(this.homeLocation);
- }
-
- public boolean getHasParty()
- {
- return this.hasParty;
- }
-
- public void setJoinParty(Location l)
- {
- this.hasParty = true;
- this.islandLocation = getStringLocation(l);
- this.hasIsland = true;
- }
-
- public void setLeaveParty()
- {
- this.hasParty = false;
- this.islandLocation = null;
- this.hasIsland = false;
- }
-
- private Location getLocationString(String s)
- {
- if ((s == null) || (s.trim() == "")) {
- return null;
- }
- String[] parts = s.split(":");
- if (parts.length == 4)
- {
- World w = Bukkit.getServer().getWorld(parts[0]);
- int x = Integer.parseInt(parts[1]);
- int y = Integer.parseInt(parts[2]);
- int z = Integer.parseInt(parts[3]);
- return new Location(w, x, y, z);
- }
- return null;
- }
-
- private String getPartyLocationString(String s)
- {
- if ((s == null) || (s.trim() == "")) {
- return null;
- }
- String[] parts = s.split(":");
- if (parts.length == 4) {
- return parts[1] + "," + parts[3];
- }
- return null;
- }
-
- public void displayData(String player)
- {
- System.out.print(player + " has an island: " + getHasIsland());
- if (getIslandLocation() != null) {
- System.out.print(player + " island location: " + getIslandLocation().toString());
- }
- if (getHomeLocation() != null) {
- System.out.print(player + " home location: " + getHomeLocation().toString());
- }
- }
-
- private String getStringLocation(Location l)
- {
- if (l == null) {
- return "";
- }
- return l.getWorld().getName() + ":" + l.getBlockX() + ":" + l.getBlockY() + ":" + l.getBlockZ();
- }
-
- public Location getPartyIslandLocation()
- {
- return getLocationString(this.partyIslandLocation);
- }
+ private static final long serialVersionUID = 1L;
+ private String playerName;
+ private boolean hasIsland;
+ private boolean hasParty;
+ private String islandLocation;
+ private String homeLocation;
+ private String partyIslandLocation;
+
+ public PlayerInfoOld(final String playerName) {
+ super();
+ this.hasIsland = false;
+ this.hasParty = false;
+ this.islandLocation = "";
+ this.homeLocation = "";
+ }
+
+ public PlayerInfoOld(final String playerName, final boolean hasIsland, final int iX, final int iY, final int iZ, final int hX, final int hY, final int hZ) {
+ super();
+ this.playerName = playerName;
+ this.hasIsland = hasIsland;
+ if (iX == 0 && iY == 0 && iZ == 0) {
+ this.islandLocation = null;
+ }
+ else {
+ this.islandLocation = this.getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), (double)iX, (double)iY, (double)iZ));
+ }
+ if (hX == 0 && hY == 0 && hZ == 0) {
+ this.homeLocation = null;
+ }
+ else {
+ this.homeLocation = this.getStringLocation(new Location(uSkyBlock.getSkyBlockWorld(), (double)hX, (double)hY, (double)hZ));
+ }
+ }
+
+ public void startNewIsland(final Location l) {
+ this.hasIsland = true;
+ this.setIslandLocation(l);
+ this.hasParty = false;
+ this.homeLocation = null;
+ }
+
+ public void removeFromIsland() {
+ this.hasIsland = false;
+ this.setIslandLocation(null);
+ this.hasParty = false;
+ this.homeLocation = null;
+ }
+
+ public void setPlayerName(final String s) {
+ this.playerName = s;
+ }
+
+ public boolean getHasIsland() {
+ return this.hasIsland;
+ }
+
+ public String locationForParty() {
+ return this.getPartyLocationString(this.islandLocation);
+ }
+
+ public String locationForPartyOld() {
+ return this.getPartyLocationString(this.partyIslandLocation);
+ }
+
+ public Player getPlayer() {
+ return Bukkit.getPlayer(this.playerName);
+ }
+
+ public String getPlayerName() {
+ return this.playerName;
+ }
+
+ public void setHasIsland(final boolean b) {
+ this.hasIsland = b;
+ }
+
+ public void setIslandLocation(final Location l) {
+ this.islandLocation = this.getStringLocation(l);
+ }
+
+ public Location getIslandLocation() {
+ return this.getLocationString(this.islandLocation);
+ }
+
+ public void setHomeLocation(final Location l) {
+ this.homeLocation = this.getStringLocation(l);
+ }
+
+ public Location getHomeLocation() {
+ return this.getLocationString(this.homeLocation);
+ }
+
+ public boolean getHasParty() {
+ return this.hasParty;
+ }
+
+ public void setJoinParty(final Location l) {
+ this.hasParty = true;
+ this.islandLocation = this.getStringLocation(l);
+ this.hasIsland = true;
+ }
+
+ public void setLeaveParty() {
+ this.hasParty = false;
+ this.islandLocation = null;
+ this.hasIsland = false;
+ }
+
+ private Location getLocationString(final String s) {
+ if (s == null || s.trim() == "") {
+ return null;
+ }
+ final String[] parts = s.split(":");
+ if (parts.length == 4) {
+ final World w = Bukkit.getServer().getWorld(parts[0]);
+ final int x = Integer.parseInt(parts[1]);
+ final int y = Integer.parseInt(parts[2]);
+ final int z = Integer.parseInt(parts[3]);
+ return new Location(w, (double)x, (double)y, (double)z);
+ }
+ return null;
+ }
+
+ private String getPartyLocationString(final String s) {
+ if (s == null || s.trim() == "") {
+ return null;
+ }
+ final String[] parts = s.split(":");
+ if (parts.length == 4) {
+ return String.valueOf(parts[1]) + "," + parts[3];
+ }
+ return null;
+ }
+
+ public void displayData(final String player) {
+ System.out.print(String.valueOf(player) + " has an island: " + this.getHasIsland());
+ if (this.getIslandLocation() != null) {
+ System.out.print(String.valueOf(player) + " island location: " + this.getIslandLocation().toString());
+ }
+ if (this.getHomeLocation() != null) {
+ System.out.print(String.valueOf(player) + " home location: " + this.getHomeLocation().toString());
+ }
+ }
+
+ private String getStringLocation(final Location l) {
+ if (l == null) {
+ return "";
+ }
+ return String.valueOf(l.getWorld().getName()) + ":" + l.getBlockX() + ":" + l.getBlockY() + ":" + l.getBlockZ();
+ }
+
+ public Location getPartyIslandLocation() {
+ return this.getLocationString(this.partyIslandLocation);
+ }
}
diff --git a/src/us/talabrek/ultimateskyblock/PlayerJoin.java b/src/us/talabrek/ultimateskyblock/PlayerJoin.java
index 70029c74d..399d728be 100644
--- a/src/us/talabrek/ultimateskyblock/PlayerJoin.java
+++ b/src/us/talabrek/ultimateskyblock/PlayerJoin.java
@@ -1,518 +1,404 @@
package us.talabrek.ultimateskyblock;
-import java.io.File;
-import java.io.PrintStream;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Material;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.block.Block;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.entity.Arrow;
-import org.bukkit.entity.Creeper;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Fireball;
-import org.bukkit.entity.HumanEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.SmallFireball;
-import org.bukkit.entity.Snowball;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.Action;
-import org.bukkit.event.entity.EntityDamageEvent;
-import org.bukkit.event.entity.FoodLevelChangeEvent;
-import org.bukkit.event.inventory.InventoryClickEvent;
-import org.bukkit.event.inventory.InventoryDragEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerJoinEvent;
-import org.bukkit.event.player.PlayerQuitEvent;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.PlayerInventory;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.SkullMeta;
-import org.bukkit.plugin.PluginManager;
+import org.bukkit.inventory.meta.*;
+import java.io.*;
+import org.bukkit.event.*;
+import org.bukkit.event.player.*;
+import org.bukkit.event.block.*;
+import org.bukkit.*;
+import org.bukkit.inventory.*;
+import org.bukkit.event.entity.*;
+import org.bukkit.entity.*;
+import java.util.*;
+import org.bukkit.event.inventory.*;
-public class PlayerJoin
- implements Listener
+public class PlayerJoin implements Listener
{
- private Player hungerman = null;
- private SkullMeta meta = null;
- int randomNum = 0;
- Player p = null;
- String[] playerPerm;
-
- public PlayerJoin() {}
-
- @EventHandler(priority=EventPriority.NORMAL)
- public void onPlayerJoin(PlayerJoinEvent event)
- {
- File f = new File(uSkyBlock.getInstance().directoryPlayers, event.getPlayer().getName());
- PlayerInfo pi = new PlayerInfo(event.getPlayer().getName());
- if (f.exists())
- {
- PlayerInfo pi2 = uSkyBlock.getInstance().readPlayerFile(event.getPlayer().getName());
- if (pi2 != null)
- {
- pi.setIslandLocation(pi2.getIslandLocation());
- pi.setHomeLocation(pi2.getHomeLocation());
- pi.setHasIsland(pi2.getHasIsland());
- if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()) == null) {
- uSkyBlock.getInstance().createIslandConfig(pi.locationForParty(), event.getPlayer().getName());
+ private Player hungerman;
+ private SkullMeta meta;
+ int randomNum;
+ Player p;
+ String[] playerPerm;
+
+ public PlayerJoin() {
+ super();
+ this.hungerman = null;
+ this.meta = null;
+ this.randomNum = 0;
+ this.p = null;
+ }
+
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void onPlayerJoin(final PlayerJoinEvent event) {
+ final File f = new File(uSkyBlock.getInstance().directoryPlayers, event.getPlayer().getName());
+ final PlayerInfo pi = new PlayerInfo(event.getPlayer().getName());
+ if (f.exists()) {
+ final PlayerInfo pi2 = uSkyBlock.getInstance().readPlayerFile(event.getPlayer().getName());
+ if (pi2 != null) {
+ pi.setIslandLocation(pi2.getIslandLocation());
+ pi.setHomeLocation(pi2.getHomeLocation());
+ pi.setHasIsland(pi2.getHasIsland());
+ if (uSkyBlock.getInstance().getIslandConfig(pi.locationForParty()) == null) {
+ uSkyBlock.getInstance().createIslandConfig(pi.locationForParty(), event.getPlayer().getName());
+ }
+ uSkyBlock.getInstance().clearIslandConfig(pi.locationForParty(), event.getPlayer().getName());
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ WorldGuardHandler.protectIsland(event.getPlayer(), event.getPlayer().getName(), pi);
+ }
+ }
+ f.delete();
}
- uSkyBlock.getInstance().clearIslandConfig(pi.locationForParty(), event.getPlayer().getName());
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- WorldGuardHandler.protectIsland(event.getPlayer(), event.getPlayer().getName(), pi);
+ uSkyBlock.getInstance().addActivePlayer(event.getPlayer().getName(), pi);
+ if (pi.getHasIsland() && !uSkyBlock.getInstance().getTempIslandConfig(pi.locationForParty()).contains("general.level")) {
+ uSkyBlock.getInstance().createIslandConfig(pi.locationForParty(), event.getPlayer().getName());
+ System.out.println("Creating new Config File");
+ }
+ uSkyBlock.getInstance().getIslandConfig(pi.locationForParty());
+ System.out.print("Loaded player file for " + event.getPlayer().getName());
+ }
+
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void onPlayerQuit(final PlayerQuitEvent event) {
+ if (uSkyBlock.getInstance().hasIsland(event.getPlayer().getName()) && !uSkyBlock.getInstance().checkForOnlineMembers(event.getPlayer())) {
+ System.out.print("Removing island config from memory.");
+ uSkyBlock.getInstance().removeIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(event.getPlayer().getName()).locationForParty());
}
- }
- f.delete();
+ uSkyBlock.getInstance().removeActivePlayer(event.getPlayer().getName());
}
- uSkyBlock.getInstance().addActivePlayer(event.getPlayer().getName(), pi);
- if ((pi.getHasIsland()) && (!uSkyBlock.getInstance().getTempIslandConfig(pi.locationForParty()).contains("general.level")))
- {
- uSkyBlock.getInstance().createIslandConfig(pi.locationForParty(), event.getPlayer().getName());
- System.out.println("Creating new Config File");
+
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void onPlayerFoodChange(final FoodLevelChangeEvent event) {
+ if (event.getEntity() instanceof Player) {
+ this.hungerman = (Player)event.getEntity();
+ if (this.hungerman.getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && this.hungerman.getFoodLevel() > event.getFoodLevel() && uSkyBlock.getInstance().playerIsOnIsland(this.hungerman)) {
+ if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger4", this.hungerman.getWorld())) {
+ event.setCancelled(true);
+ return;
+ }
+ if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger3", this.hungerman.getWorld())) {
+ this.randomNum = 1 + (int)(Math.random() * 100.0);
+ if (this.randomNum <= 75) {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger2", this.hungerman.getWorld())) {
+ this.randomNum = 1 + (int)(Math.random() * 100.0);
+ if (this.randomNum <= 50) {
+ event.setCancelled(true);
+ return;
+ }
+ }
+ if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger", this.hungerman.getWorld())) {
+ this.randomNum = 1 + (int)(Math.random() * 100.0);
+ if (this.randomNum <= 25) {
+ event.setCancelled(true);
+ }
+ }
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.NORMAL)
+ public void onPlayerInteract(final PlayerInteractEvent event) {
+ if (Settings.extras_obsidianToLava && uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer()) && event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && event.getAction().equals((Object)Action.RIGHT_CLICK_BLOCK) && event.getPlayer().getItemInHand().getTypeId() == 325 && event.getClickedBlock().getType() == Material.OBSIDIAN && !uSkyBlock.getInstance().testForObsidian(event.getClickedBlock())) {
+ event.getPlayer().sendMessage(ChatColor.YELLOW + "Changing your obsidian back into lava. Be careful!");
+ event.getClickedBlock().setType(Material.AIR);
+ event.getPlayer().getInventory().removeItem(new ItemStack[] { new ItemStack(325, 1) });
+ event.getPlayer().getInventory().addItem(new ItemStack[] { new ItemStack(327, 1) });
+ }
}
- uSkyBlock.getInstance().getIslandConfig(pi.locationForParty());
- System.out.print("Loaded player file for " + event.getPlayer().getName());
- }
-
- @EventHandler(priority=EventPriority.NORMAL)
- public void onPlayerQuit(PlayerQuitEvent event)
- {
- if (uSkyBlock.getInstance().hasIsland(event.getPlayer().getName())) {
- if (!uSkyBlock.getInstance().checkForOnlineMembers(event.getPlayer()))
- {
- System.out.print("Removing island config from memory.");
- uSkyBlock.getInstance().removeIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(event.getPlayer().getName())).locationForParty());
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onEntityDamage(final EntityDamageEvent event) {
+ if (event.getEntity().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && event.getEntity().getType().equals((Object)EntityType.ITEM_FRAME)) {
+ for (final Entity temp : event.getEntity().getNearbyEntities(3.0, 3.0, 3.0)) {
+ if (temp instanceof Player) {
+ final Player p = (Player)temp;
+ if (!uSkyBlock.getInstance().locationIsOnIsland(p, event.getEntity().getLocation())) {
+ event.setCancelled(true);
+ return;
+ }
+ continue;
+ }
+ else {
+ if (temp instanceof Arrow) {
+ event.setCancelled(true);
+ return;
+ }
+ if (temp instanceof Snowball) {
+ event.setCancelled(true);
+ return;
+ }
+ if (temp instanceof SmallFireball) {
+ event.setCancelled(true);
+ return;
+ }
+ if (temp instanceof Creeper) {
+ event.setCancelled(true);
+ return;
+ }
+ if (temp instanceof Fireball) {
+ event.setCancelled(true);
+ return;
+ }
+ continue;
+ }
+ }
+ }
}
- uSkyBlock.getInstance().removeActivePlayer(event.getPlayer().getName());
- }
-
- @EventHandler(priority=EventPriority.NORMAL)
- public void onPlayerFoodChange(FoodLevelChangeEvent event)
- {
- if ((event.getEntity() instanceof Player))
- {
- this.hungerman = ((Player)event.getEntity());
- if (this.hungerman.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if (this.hungerman.getFoodLevel() > event.getFoodLevel()) {
- if (uSkyBlock.getInstance().playerIsOnIsland(this.hungerman))
- {
- if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger4", this.hungerman.getWorld()))
- {
- event.setCancelled(true);
- return;
- }
- if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger3", this.hungerman.getWorld()))
- {
- this.randomNum = (1 + (int)(Math.random() * 100.0D));
- if (this.randomNum <= 75)
- {
- event.setCancelled(true);
+
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void guiClick(final InventoryClickEvent event) {
+ if (event.getInventory().getName().equalsIgnoreCase("§9Island Group Members")) {
+ event.setCancelled(true);
+ if (event.getSlot() < 0 || event.getSlot() > 35) {
return;
- }
- }
- if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger2", this.hungerman.getWorld()))
- {
- this.randomNum = (1 + (int)(Math.random() * 100.0D));
- if (this.randomNum <= 50)
- {
- event.setCancelled(true);
+ }
+ if (event.getCurrentItem().getTypeId() == 397) {
+ this.meta = (SkullMeta)event.getCurrentItem().getItemMeta();
+ }
+ this.p = (Player)event.getWhoClicked();
+ if (this.meta == null || event.getCurrentItem().getType() == Material.SIGN) {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (this.meta.getLore().contains("§a§lLeader")) {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
+ }
+ else if (!uSkyBlock.getInstance().isPartyLeader(this.p)) {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
+ }
+ else {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.meta.getOwner()));
+ this.meta = null;
+ }
+ }
+ else if (event.getInventory().getName().contains("Permissions")) {
+ event.setCancelled(true);
+ if (event.getSlot() < 0 || event.getSlot() > 35) {
return;
- }
- }
- if (VaultHandler.checkPerk(this.hungerman.getName(), "usb.extra.hunger", this.hungerman.getWorld()))
- {
- this.randomNum = (1 + (int)(Math.random() * 100.0D));
- if (this.randomNum <= 25)
- {
- event.setCancelled(true);
+ }
+ this.p = (Player)event.getWhoClicked();
+ this.playerPerm = event.getInventory().getName().split(" ");
+ if (event.getCurrentItem().getTypeId() == 6) {
+ this.p.closeInventory();
+ uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canChangeBiome");
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ else if (event.getCurrentItem().getTypeId() == 101) {
+ this.p.closeInventory();
+ uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canToggleLock");
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ else if (event.getCurrentItem().getTypeId() == 90) {
+ this.p.closeInventory();
+ uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canChangeWarp");
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ else if (event.getCurrentItem().getTypeId() == 69) {
+ this.p.closeInventory();
+ uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canToggleWarp");
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ else if (event.getCurrentItem().getTypeId() == 398) {
+ this.p.closeInventory();
+ uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canInviteOthers");
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ else if (event.getCurrentItem().getTypeId() == 301) {
+ this.p.closeInventory();
+ uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canKickOthers");
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ else if (event.getCurrentItem().getTypeId() == 323) {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
+ }
+ else {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
+ }
+ }
+ else if (event.getInventory().getName().contains("Island Biome")) {
+ event.setCancelled(true);
+ if (event.getSlot() < 0 || event.getSlot() > 35) {
return;
- }
}
- }
+ this.p = (Player)event.getWhoClicked();
+ if (event.getCurrentItem().getType() == Material.SAPLING && event.getCurrentItem().getDurability() == 3) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome jungle");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.SAPLING && event.getCurrentItem().getDurability() == 1) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome forest");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.SAND) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome desert");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.SNOW) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome taiga");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.EYE_OF_ENDER) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome sky");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.WATER_LILY) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome swampland");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.FIRE) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome hell");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.RED_MUSHROOM) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome mushroom");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.WATER) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome ocean");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
}
- }
- }
- }
-
- @EventHandler(priority=EventPriority.NORMAL)
- public void onPlayerInteract(PlayerInteractEvent event)
- {
- if ((Settings.extras_obsidianToLava) && (uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer())) && (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName))) {
- if ((event.getAction().equals(Action.RIGHT_CLICK_BLOCK)) && (event.getPlayer().getItemInHand().getTypeId() == 325) &&
- (event.getClickedBlock().getType() == Material.OBSIDIAN)) {
- if (!uSkyBlock.getInstance().testForObsidian(event.getClickedBlock()))
- {
- event.getPlayer().sendMessage(ChatColor.YELLOW + "Changing your obsidian back into lava. Be careful!");
- event.getClickedBlock().setType(Material.AIR);
- event.getPlayer().getInventory().removeItem(new ItemStack[] { new ItemStack(325, 1) });
- event.getPlayer().getInventory().addItem(new ItemStack[] { new ItemStack(327, 1) });
+ else if (event.getInventory().getName().contains("Challenge Menu")) {
+ event.setCancelled(true);
+ if (event.getSlot() < 0 || event.getSlot() > 35) {
+ return;
+ }
+ if (event.getCurrentItem().getType() != Material.DIRT && event.getCurrentItem().getType() != Material.IRON_BLOCK && event.getCurrentItem().getType() != Material.GOLD_BLOCK && event.getCurrentItem().getType() != Material.DIAMOND_BLOCK) {
+ (this.p = (Player)event.getWhoClicked()).closeInventory();
+ if (event.getCurrentItem().getItemMeta() != null) {
+ this.p.performCommand("c c " + event.getCurrentItem().getItemMeta().getDisplayName().replace("§e", "").replace("§8", "").replace("§a", "").replace("§2", "").replace("§l", ""));
+ }
+ this.p.openInventory(uSkyBlock.getInstance().displayChallengeGUI(this.p));
+ }
+ else {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
}
- }
- }
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onEntityDamage(EntityDamageEvent event)
- {
- if (event.getEntity().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if (event.getEntity().getType().equals(EntityType.ITEM_FRAME))
- {
- Iterator closePlayers = event.getEntity().getNearbyEntities(3.0D, 3.0D, 3.0D).iterator();
- while (closePlayers.hasNext())
- {
- Entity temp = (Entity)closePlayers.next();
- if ((temp instanceof Player))
- {
- Player p = (Player)temp;
- if (!uSkyBlock.getInstance().locationIsOnIsland(p, event.getEntity().getLocation())) {
- event.setCancelled(true);
- }
- }
- else
- {
- if ((temp instanceof Arrow))
- {
- event.setCancelled(true);
- return;
- }
- if ((temp instanceof Snowball))
- {
- event.setCancelled(true);
- return;
- }
- if ((temp instanceof SmallFireball))
- {
- event.setCancelled(true);
- return;
- }
- if ((temp instanceof Creeper))
- {
- event.setCancelled(true);
- return;
- }
- if ((temp instanceof Fireball))
- {
- event.setCancelled(true);
- return;
- }
- }
+ else if (event.getInventory().getName().contains("Island Log")) {
+ event.setCancelled(true);
+ if (event.getSlot() < 0 || event.getSlot() > 35) {
+ return;
+ }
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
}
- }
- }
- }
-
- @EventHandler(priority=EventPriority.MONITOR)
- public void guiClick(InventoryClickEvent event)
- {
- if (event.getInventory().getName().equalsIgnoreCase("§9Island Group Members"))
- {
- event.setCancelled(true);
- if ((event.getSlot() < 0) || (event.getSlot() > 35)) {
- return;
- }
- if (event.getCurrentItem().getTypeId() == 397) {
- this.meta = ((SkullMeta)event.getCurrentItem().getItemMeta());
- }
- this.p = ((Player)event.getWhoClicked());
- if ((this.meta == null) || (event.getCurrentItem().getType() == Material.SIGN))
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (this.meta.getLore().contains("§a§lLeader"))
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
- }
- else if (!uSkyBlock.getInstance().isPartyLeader(this.p))
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
- }
- else
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.meta.getOwner()));
- this.meta = null;
- }
- }
- else if (event.getInventory().getName().contains("Permissions"))
- {
- event.setCancelled(true);
- if ((event.getSlot() < 0) || (event.getSlot() > 35)) {
- return;
- }
- this.p = ((Player)event.getWhoClicked());
- this.playerPerm = event.getInventory().getName().split(" ");
- if (event.getCurrentItem().getTypeId() == 6)
- {
- this.p.closeInventory();
- uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canChangeBiome");
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- else if (event.getCurrentItem().getTypeId() == 101)
- {
- this.p.closeInventory();
- uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canToggleLock");
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- else if (event.getCurrentItem().getTypeId() == 90)
- {
- this.p.closeInventory();
- uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canChangeWarp");
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- else if (event.getCurrentItem().getTypeId() == 69)
- {
- this.p.closeInventory();
- uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canToggleWarp");
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- else if (event.getCurrentItem().getTypeId() == 398)
- {
- this.p.closeInventory();
- uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canInviteOthers");
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- else if (event.getCurrentItem().getTypeId() == 301)
- {
- this.p.closeInventory();
- uSkyBlock.getInstance().changePlayerPermission(this.p, this.playerPerm[0], "canKickOthers");
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- else if (event.getCurrentItem().getTypeId() == 323)
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
- }
- else
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.playerPerm[0]));
- }
- }
- else if (event.getInventory().getName().contains("Island Biome"))
- {
- event.setCancelled(true);
- if ((event.getSlot() < 0) || (event.getSlot() > 35)) {
- return;
- }
- this.p = ((Player)event.getWhoClicked());
- if ((event.getCurrentItem().getType() == Material.SAPLING) && (event.getCurrentItem().getDurability() == 3))
- {
- this.p.closeInventory();
- this.p.performCommand("island biome jungle");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if ((event.getCurrentItem().getType() == Material.SAPLING) && (event.getCurrentItem().getDurability() == 1))
- {
- this.p.closeInventory();
- this.p.performCommand("island biome forest");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.SAND)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome desert");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.SNOW)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome taiga");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.EYE_OF_ENDER)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome sky");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.WATER_LILY)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome swampland");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.FIRE)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome hell");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.RED_MUSHROOM)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome mushroom");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.WATER)
- {
- this.p.closeInventory();
- this.p.performCommand("island biome ocean");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- }
- else if (event.getInventory().getName().contains("Challenge Menu"))
- {
- event.setCancelled(true);
- if ((event.getSlot() < 0) || (event.getSlot() > 35)) {
- return;
- }
- if ((event.getCurrentItem().getType() != Material.DIRT) && (event.getCurrentItem().getType() != Material.IRON_BLOCK) && (event.getCurrentItem().getType() != Material.GOLD_BLOCK) && (event.getCurrentItem().getType() != Material.DIAMOND_BLOCK))
- {
- this.p = ((Player)event.getWhoClicked());
-
- this.p.closeInventory();
- if (event.getCurrentItem().getItemMeta() != null) {
- this.p.performCommand("c c " + event.getCurrentItem().getItemMeta().getDisplayName().replace("§e", "").replace("§8", "").replace("§a", "").replace("§2", "").replace("§l", ""));
+ else if (event.getInventory().getName().contains("Island Menu")) {
+ event.setCancelled(true);
+ if (event.getSlot() < 0 || event.getSlot() > 35) {
+ return;
+ }
+ this.p = (Player)event.getWhoClicked();
+ if (event.getCurrentItem().getType() == Material.SAPLING && event.getCurrentItem().getDurability() == 3) {
+ this.p.closeInventory();
+ this.p.performCommand("island biome");
+ }
+ else if (event.getCurrentItem().getType() == Material.SKULL_ITEM) {
+ this.p.closeInventory();
+ this.p.performCommand("island party");
+ }
+ else if (event.getCurrentItem().getType() == Material.BED) {
+ this.p.closeInventory();
+ this.p.performCommand("island sethome");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.HOPPER) {
+ this.p.closeInventory();
+ this.p.performCommand("island setwarp");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.BOOK_AND_QUILL) {
+ this.p.closeInventory();
+ this.p.performCommand("island log");
+ }
+ else if (event.getCurrentItem().getType() == Material.ENDER_PORTAL) {
+ this.p.closeInventory();
+ this.p.performCommand("island home");
+ }
+ else if (event.getCurrentItem().getType() == Material.GRASS) {
+ this.p.closeInventory();
+ this.p.performCommand("island create");
+ }
+ else if (event.getCurrentItem().getType() == Material.CHEST) {
+ this.p.closeInventory();
+ this.p.performCommand("chc open perks");
+ }
+ else if (event.getCurrentItem().getType() == Material.ENDER_CHEST) {
+ this.p.closeInventory();
+ if (VaultHandler.checkPerk(this.p.getName(), "group.donor", this.p.getWorld())) {
+ this.p.performCommand("chc open donor");
+ }
+ else {
+ this.p.performCommand("donate");
+ }
+ }
+ else if (event.getCurrentItem().getType() == Material.EXP_BOTTLE) {
+ this.p.closeInventory();
+ this.p.performCommand("island level");
+ }
+ else if (event.getCurrentItem().getType() == Material.DIAMOND_ORE) {
+ this.p.closeInventory();
+ this.p.performCommand("c");
+ }
+ else if (event.getCurrentItem().getType() == Material.ENDER_STONE || event.getCurrentItem().getType() == Material.PORTAL) {
+ this.p.closeInventory();
+ this.p.performCommand("island togglewarp");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.IRON_FENCE && uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(event.getWhoClicked().getName()).locationForParty()).getBoolean("general.locked")) {
+ this.p.closeInventory();
+ this.p.performCommand("island unlock");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else if (event.getCurrentItem().getType() == Material.IRON_FENCE && !uSkyBlock.getInstance().getIslandConfig(uSkyBlock.getInstance().getActivePlayers().get(event.getWhoClicked().getName()).locationForParty()).getBoolean("general.locked")) {
+ this.p.closeInventory();
+ this.p.performCommand("island lock");
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
+ else {
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
+ }
}
- this.p.openInventory(uSkyBlock.getInstance().displayChallengeGUI(this.p));
- }
- else
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
}
- else if (event.getInventory().getName().contains("Island Log"))
- {
- event.setCancelled(true);
- if ((event.getSlot() < 0) || (event.getSlot() > 35)) {
- return;
- }
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getInventory().getName().contains("Island Menu"))
- {
- event.setCancelled(true);
- if ((event.getSlot() < 0) || (event.getSlot() > 35)) {
- return;
- }
- this.p = ((Player)event.getWhoClicked());
- if ((event.getCurrentItem().getType() == Material.SAPLING) && (event.getCurrentItem().getDurability() == 3))
- {
- this.p.closeInventory();
- this.p.performCommand("island biome");
- }
- else if (event.getCurrentItem().getType() == Material.SKULL_ITEM)
- {
- this.p.closeInventory();
- this.p.performCommand("island party");
- }
- else if (event.getCurrentItem().getType() == Material.BED)
- {
- this.p.closeInventory();
- this.p.performCommand("island sethome");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.HOPPER)
- {
- this.p.closeInventory();
- this.p.performCommand("island setwarp");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if (event.getCurrentItem().getType() == Material.BOOK_AND_QUILL)
- {
- this.p.closeInventory();
- this.p.performCommand("island log");
- }
- else if (event.getCurrentItem().getType() == Material.ENDER_PORTAL)
- {
- this.p.closeInventory();
- this.p.performCommand("island home");
- }
- else if (event.getCurrentItem().getType() == Material.GRASS)
- {
- this.p.closeInventory();
- this.p.performCommand("island create");
- }
- else if (event.getCurrentItem().getType() == Material.CHEST)
- {
- this.p.closeInventory();
- this.p.performCommand("chc open perks");
- }
- else if (event.getCurrentItem().getType() == Material.ENDER_CHEST)
- {
- this.p.closeInventory();
- if (VaultHandler.checkPerk(this.p.getName(), "group.donor", this.p.getWorld())) {
- this.p.performCommand("chc open donor");
- } else {
- this.p.performCommand("donate");
+
+ @EventHandler(priority = EventPriority.MONITOR)
+ public void onInventoryDrag(final InventoryDragEvent event) {
+ if (event.getInventory().getName().equalsIgnoreCase("§9SB Island Group Members")) {
+ event.setCancelled(true);
+ this.meta = (SkullMeta)event.getCursor().getItemMeta();
+ this.p = (Player)event.getWhoClicked();
+ if (this.meta.getOwner() == null) {
+ this.p.updateInventory();
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
+ }
+ else {
+ this.p.updateInventory();
+ this.p.closeInventory();
+ this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.meta.getOwner()));
+ }
}
- }
- else if (event.getCurrentItem().getType() == Material.EXP_BOTTLE)
- {
- this.p.closeInventory();
- this.p.performCommand("island level");
- }
- else if (event.getCurrentItem().getType() == Material.DIAMOND_ORE)
- {
- this.p.closeInventory();
- this.p.performCommand("c");
- }
- else if ((event.getCurrentItem().getType() == Material.ENDER_STONE) || (event.getCurrentItem().getType() == Material.PORTAL))
- {
- this.p.closeInventory();
- this.p.performCommand("island togglewarp");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if ((event.getCurrentItem().getType() == Material.IRON_FENCE) && (uSkyBlock.getInstance().getIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(event.getWhoClicked().getName())).locationForParty()).getBoolean("general.locked")))
- {
- this.p.closeInventory();
- this.p.performCommand("island unlock");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else if ((event.getCurrentItem().getType() == Material.IRON_FENCE) && (!uSkyBlock.getInstance().getIslandConfig(((PlayerInfo)uSkyBlock.getInstance().getActivePlayers().get(event.getWhoClicked().getName())).locationForParty()).getBoolean("general.locked")))
- {
- this.p.closeInventory();
- this.p.performCommand("island lock");
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- else
- {
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayIslandGUI(this.p));
- }
- }
- }
-
- @EventHandler(priority=EventPriority.MONITOR)
- public void onInventoryDrag(InventoryDragEvent event)
- {
- if (event.getInventory().getName().equalsIgnoreCase("§9SB Island Group Members"))
- {
- event.setCancelled(true);
- this.meta = ((SkullMeta)event.getCursor().getItemMeta());
- this.p = ((Player)event.getWhoClicked());
- if (this.meta.getOwner() == null)
- {
- this.p.updateInventory();
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyGUI(this.p));
- }
- else
- {
- this.p.updateInventory();
- this.p.closeInventory();
- this.p.openInventory(uSkyBlock.getInstance().displayPartyPlayerGUI(this.p, this.meta.getOwner()));
- }
}
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/ProtectionEvents.java b/src/us/talabrek/ultimateskyblock/ProtectionEvents.java
index 0ff1e8183..bb351deaf 100644
--- a/src/us/talabrek/ultimateskyblock/ProtectionEvents.java
+++ b/src/us/talabrek/ultimateskyblock/ProtectionEvents.java
@@ -1,174 +1,112 @@
package us.talabrek.ultimateskyblock;
-import org.bukkit.ChatColor;
-import org.bukkit.World;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Hanging;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Vehicle;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.BlockBreakEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.entity.EntityDamageByEntityEvent;
-import org.bukkit.event.hanging.HangingBreakByEntityEvent;
-import org.bukkit.event.player.PlayerBedEnterEvent;
-import org.bukkit.event.player.PlayerBucketEmptyEvent;
-import org.bukkit.event.player.PlayerBucketFillEvent;
-import org.bukkit.event.player.PlayerInteractEntityEvent;
-import org.bukkit.event.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerShearEntityEvent;
-import org.bukkit.event.vehicle.VehicleDamageEvent;
+import org.bukkit.entity.*;
+import org.bukkit.event.*;
+import org.bukkit.event.block.*;
+import org.bukkit.*;
+import org.bukkit.event.player.*;
+import org.bukkit.event.hanging.*;
+import org.bukkit.event.vehicle.*;
+import org.bukkit.event.entity.*;
-public class ProtectionEvents
- implements Listener
+public class ProtectionEvents implements Listener
{
- private Player attacker = null;
- private Player breaker = null;
-
- public ProtectionEvents() {}
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGH)
- public void onPlayerBlockBreak(BlockBreakEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlock().getLocation())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp())) {
- event.setCancelled(true);
- }
+ private Player attacker;
+ private Player breaker;
+
+ public ProtectionEvents() {
+ super();
+ this.attacker = null;
+ this.breaker = null;
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGH)
- public void onPlayerBlockPlace(BlockPlaceEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlock().getLocation())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp())) {
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
+ public void onPlayerBlockBreak(final BlockBreakEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlock().getLocation()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerInteract(PlayerInteractEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer())) && (!uSkyBlock.getInstance().playerIsInSpawn(event.getPlayer())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp())) {
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
+ public void onPlayerBlockPlace(final BlockPlaceEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlock().getLocation()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerBedEnter(PlayerBedEnterEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp())) {
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerInteract(final PlayerInteractEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer()) && !uSkyBlock.getInstance().playerIsInSpawn(event.getPlayer()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.setCancelled(true);
+ }
+ }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerBedEnter(final PlayerBedEnterEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerShearEntity(PlayerShearEntityEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp()))
- {
- event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerShearEntity(final PlayerShearEntityEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerInteractEntity(PlayerInteractEntityEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp()))
- {
- event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerInteractEntity(final PlayerInteractEntityEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().playerIsOnIsland(event.getPlayer()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerBucketFill(PlayerBucketFillEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlockClicked().getLocation())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp()))
- {
- event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerBucketFill(final PlayerBucketFillEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlockClicked().getLocation()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event)
- {
- if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlockClicked().getLocation())) &&
- (!VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld())) && (!event.getPlayer().isOp()))
- {
- event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerBucketEmpty(final PlayerBucketEmptyEvent event) {
+ if (event.getPlayer().getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().locationIsOnIsland(event.getPlayer(), event.getBlockClicked().getLocation()) && !VaultHandler.checkPerk(event.getPlayer().getName(), "usb.mod.bypassprotection", event.getPlayer().getWorld()) && !event.getPlayer().isOp()) {
+ event.getPlayer().sendMessage(ChatColor.RED + "You can only do that on your island!");
+ event.setCancelled(true);
+ }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerBreakHanging(HangingBreakByEntityEvent event)
- {
- if ((event.getRemover() instanceof Player))
- {
- this.breaker = ((Player)event.getRemover());
- if (this.breaker.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().locationIsOnIsland(this.breaker, event.getEntity().getLocation())) &&
- (!VaultHandler.checkPerk(this.breaker.getName(), "usb.mod.bypassprotection", this.breaker.getWorld())) && (!this.breaker.isOp())) {
- event.setCancelled(true);
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerBreakHanging(final HangingBreakByEntityEvent event) {
+ if (event.getRemover() instanceof Player) {
+ this.breaker = (Player)event.getRemover();
+ if (this.breaker.getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().locationIsOnIsland(this.breaker, event.getEntity().getLocation()) && !VaultHandler.checkPerk(this.breaker.getName(), "usb.mod.bypassprotection", this.breaker.getWorld()) && !this.breaker.isOp()) {
+ event.setCancelled(true);
+ }
}
- }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.NORMAL)
- public void onPlayerVehicleDamage(VehicleDamageEvent event)
- {
- if ((event.getAttacker() instanceof Player))
- {
- this.breaker = ((Player)event.getAttacker());
- if (this.breaker.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if ((!uSkyBlock.getInstance().locationIsOnIsland(this.breaker, event.getVehicle().getLocation())) &&
- (!VaultHandler.checkPerk(this.breaker.getName(), "usb.mod.bypassprotection", this.breaker.getWorld())) && (!this.breaker.isOp())) {
- event.setCancelled(true);
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
+ public void onPlayerVehicleDamage(final VehicleDamageEvent event) {
+ if (event.getAttacker() instanceof Player) {
+ this.breaker = (Player)event.getAttacker();
+ if (this.breaker.getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !uSkyBlock.getInstance().locationIsOnIsland(this.breaker, event.getVehicle().getLocation()) && !VaultHandler.checkPerk(this.breaker.getName(), "usb.mod.bypassprotection", this.breaker.getWorld()) && !this.breaker.isOp()) {
+ event.setCancelled(true);
+ }
}
- }
}
- }
-
- @EventHandler(ignoreCancelled=true, priority=EventPriority.HIGH)
- public void onPlayerAttack(EntityDamageByEntityEvent event)
- {
- if ((event.getDamager() instanceof Player))
- {
- this.attacker = ((Player)event.getDamager());
- if (this.attacker.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- if (!(event.getEntity() instanceof Player)) {
- if ((!uSkyBlock.getInstance().playerIsOnIsland(this.attacker)) &&
- (!VaultHandler.checkPerk(this.attacker.getName(), "usb.mod.bypassprotection", this.attacker.getWorld())) && (!this.attacker.isOp())) {
- event.setCancelled(true);
- }
+
+ @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH)
+ public void onPlayerAttack(final EntityDamageByEntityEvent event) {
+ if (event.getDamager() instanceof Player) {
+ this.attacker = (Player)event.getDamager();
+ if (this.attacker.getWorld().getName().equalsIgnoreCase(Settings.general_worldName) && !(event.getEntity() instanceof Player) && !uSkyBlock.getInstance().playerIsOnIsland(this.attacker) && !VaultHandler.checkPerk(this.attacker.getName(), "usb.mod.bypassprotection", this.attacker.getWorld()) && !this.attacker.isOp()) {
+ event.setCancelled(true);
+ }
}
- }
}
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/SLAPI.java b/src/us/talabrek/ultimateskyblock/SLAPI.java
index b0dbc6a99..773fe5da6 100644
--- a/src/us/talabrek/ultimateskyblock/SLAPI.java
+++ b/src/us/talabrek/ultimateskyblock/SLAPI.java
@@ -1,30 +1,20 @@
package us.talabrek.ultimateskyblock;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.io.*;
public class SLAPI
{
- public SLAPI() {}
-
- public static void save(Object obj, File path)
- throws Exception
- {
- ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path));
- oos.writeObject(obj);
- oos.flush();
- oos.close();
- }
-
- public static Object load(File path)
- throws Exception
- {
- ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
- Object result = ois.readObject();
- ois.close();
- return result;
- }
+ public static void save(final Object obj, final File path) throws Exception {
+ final ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(path));
+ oos.writeObject(obj);
+ oos.flush();
+ oos.close();
+ }
+
+ public static Object load(final File path) throws Exception {
+ final ObjectInputStream ois = new ObjectInputStream(new FileInputStream(path));
+ final Object result = ois.readObject();
+ ois.close();
+ return result;
+ }
}
diff --git a/src/us/talabrek/ultimateskyblock/SerializableLocation.java b/src/us/talabrek/ultimateskyblock/SerializableLocation.java
index b4c2047fa..c46964489 100644
--- a/src/us/talabrek/ultimateskyblock/SerializableLocation.java
+++ b/src/us/talabrek/ultimateskyblock/SerializableLocation.java
@@ -1,34 +1,30 @@
package us.talabrek.ultimateskyblock;
-import java.io.Serializable;
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.World;
+import java.io.*;
+import org.bukkit.*;
-public class SerializableLocation
- implements Serializable
+public class SerializableLocation implements Serializable
{
- private static final long serialVersionUID = 23L;
- private double x;
- private double y;
- private double z;
- private String world;
-
- public SerializableLocation(Location loc)
- {
- this.x = loc.getX();
- this.y = loc.getY();
- this.z = loc.getZ();
- this.world = loc.getWorld().getName();
- }
-
- public Location getLocation()
- {
- World w = Bukkit.getWorld(this.world);
- if (w == null) {
- return null;
+ private static final long serialVersionUID = 23L;
+ private double x;
+ private double y;
+ private double z;
+ private String world;
+
+ public SerializableLocation(final Location loc) {
+ super();
+ this.x = loc.getX();
+ this.y = loc.getY();
+ this.z = loc.getZ();
+ this.world = loc.getWorld().getName();
+ }
+
+ public Location getLocation() {
+ final World w = Bukkit.getWorld(this.world);
+ if (w == null) {
+ return null;
+ }
+ final Location toRet = new Location(w, this.x, this.y, this.z);
+ return toRet;
}
- Location toRet = new Location(w, this.x, this.y, this.z);
- return toRet;
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/Settings.java b/src/us/talabrek/ultimateskyblock/Settings.java
index 3e2b4e877..a18f2e7e1 100644
--- a/src/us/talabrek/ultimateskyblock/Settings.java
+++ b/src/us/talabrek/ultimateskyblock/Settings.java
@@ -1,49 +1,54 @@
package us.talabrek.ultimateskyblock;
-import java.util.Set;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
+import org.bukkit.inventory.*;
+import java.util.*;
+import org.bukkit.*;
public class Settings
{
- public static int general_maxPartySize;
- public static String general_worldName;
- public static int island_distance;
- public static int[] blockList = new int['?'];
- public static int[] limitList = new int['?'];
- public static int[] diminishingReturnsList = new int['?'];
- public static int island_height;
- public static int general_spawnSize;
- public static boolean island_removeCreaturesByTeleport;
- public static boolean island_protectWithWorldGuard;
- public static int island_protectionRange;
- public static String island_allowPvP;
- public static ItemStack[] island_chestItems;
- public static boolean island_addExtraItems;
- public static String[] island_extraPermissions;
- public static boolean island_useOldIslands;
- public static boolean island_allowIslandLock;
- public static boolean island_useIslandLevel;
- public static boolean island_useTopTen;
- public static int island_listTime;
- public static int general_cooldownInfo;
- public static int general_cooldownRestart;
- public static int general_biomeChange;
- public static boolean extras_sendToSpawn;
- public static boolean extras_obsidianToLava;
- public static String island_schematicName;
- public static boolean challenges_broadcastCompletion;
- public static String challenges_broadcastText;
- public static String[] challenges_ranks;
- public static boolean challenges_requirePreviousRank;
- public static int challenges_rankLeeway;
- public static String challenges_challengeColor;
- public static String challenges_finishedColor;
- public static String challenges_repeatableColor;
- public static boolean challenges_enableEconomyPlugin;
- public static boolean challenges_allowChallenges;
- public static Set challenges_challengeList;
- public static Material[] itemList = new Material['?'];
-
- public Settings() {}
+ public static int general_maxPartySize;
+ public static String general_worldName;
+ public static int island_distance;
+ public static int[] blockList;
+ public static int[] limitList;
+ public static int[] diminishingReturnsList;
+ public static int island_height;
+ public static int general_spawnSize;
+ public static boolean island_removeCreaturesByTeleport;
+ public static boolean island_protectWithWorldGuard;
+ public static int island_protectionRange;
+ public static String island_allowPvP;
+ public static ItemStack[] island_chestItems;
+ public static boolean island_addExtraItems;
+ public static String[] island_extraPermissions;
+ public static boolean island_useOldIslands;
+ public static boolean island_allowIslandLock;
+ public static boolean island_useIslandLevel;
+ public static boolean island_useTopTen;
+ public static int island_listTime;
+ public static int general_cooldownInfo;
+ public static int general_cooldownRestart;
+ public static int general_biomeChange;
+ public static boolean extras_sendToSpawn;
+ public static boolean extras_obsidianToLava;
+ public static String island_schematicName;
+ public static boolean challenges_broadcastCompletion;
+ public static String challenges_broadcastText;
+ public static String[] challenges_ranks;
+ public static boolean challenges_requirePreviousRank;
+ public static int challenges_rankLeeway;
+ public static String challenges_challengeColor;
+ public static String challenges_finishedColor;
+ public static String challenges_repeatableColor;
+ public static boolean challenges_enableEconomyPlugin;
+ public static boolean challenges_allowChallenges;
+ public static Set challenges_challengeList;
+ public static Material[] itemList;
+
+ static {
+ Settings.blockList = new int[256];
+ Settings.limitList = new int[256];
+ Settings.diminishingReturnsList = new int[256];
+ Settings.itemList = new Material[2000];
+ }
}
diff --git a/src/us/talabrek/ultimateskyblock/SkyBlockChunkGenerator.java b/src/us/talabrek/ultimateskyblock/SkyBlockChunkGenerator.java
index ad8e882a6..1a47ec51e 100644
--- a/src/us/talabrek/ultimateskyblock/SkyBlockChunkGenerator.java
+++ b/src/us/talabrek/ultimateskyblock/SkyBlockChunkGenerator.java
@@ -1,20 +1,13 @@
package us.talabrek.ultimateskyblock;
-import java.util.Random;
-import org.bukkit.World;
-import org.bukkit.generator.ChunkGenerator;
+import org.bukkit.generator.*;
+import org.bukkit.*;
+import java.util.*;
-public class SkyBlockChunkGenerator
- extends ChunkGenerator
+public class SkyBlockChunkGenerator extends ChunkGenerator
{
- public SkyBlockChunkGenerator() {}
-
- public byte[] generate(World world, Random random, int cx, int cz)
- {
- byte[] result = new byte[32768];
-
-
-
- return result;
- }
+ public byte[] generate(final World world, final Random random, final int cx, final int cz) {
+ final byte[] result = new byte[32768];
+ return result;
+ }
}
diff --git a/src/us/talabrek/ultimateskyblock/VaultHandler.java b/src/us/talabrek/ultimateskyblock/VaultHandler.java
index cc906d1c7..b90ccb906 100644
--- a/src/us/talabrek/ultimateskyblock/VaultHandler.java
+++ b/src/us/talabrek/ultimateskyblock/VaultHandler.java
@@ -1,66 +1,54 @@
package us.talabrek.ultimateskyblock;
-import net.milkbowl.vault.economy.Economy;
-import net.milkbowl.vault.permission.Permission;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.RegisteredServiceProvider;
-import org.bukkit.plugin.ServicesManager;
+import net.milkbowl.vault.permission.*;
+import net.milkbowl.vault.economy.*;
+import org.bukkit.entity.*;
+import org.bukkit.*;
+import org.bukkit.plugin.*;
public class VaultHandler
{
- public static Permission perms = null;
- public static Economy econ = null;
-
- public VaultHandler() {}
-
- public static void addPerk(Player player, String perk)
- {
- perms.playerAdd(null, player.getName(), perk);
- }
-
- public static void removePerk(Player player, String perk)
- {
- perms.playerRemove(null, player.getName(), perk);
- }
-
- public static void addGroup(Player player, String perk)
- {
- perms.playerAddGroup(null, player.getName(), perk);
- }
-
- public static boolean checkPerk(String player, String perk, World world)
- {
- if (perms.has(null, player, perk)) {
- return true;
+ public static Permission perms;
+ public static Economy econ;
+
+ static {
+ VaultHandler.perms = null;
+ VaultHandler.econ = null;
}
- if (perms.has(world, player, perk)) {
- return true;
+
+ public static void addPerk(final Player player, final String perk) {
+ VaultHandler.perms.playerAdd((String)null, player.getName(), perk);
}
- return false;
- }
-
- public static boolean setupPermissions()
- {
- RegisteredServiceProvider rsp = uSkyBlock.getInstance().getServer().getServicesManager().getRegistration(Permission.class);
- if (rsp.getProvider() != null) {
- perms = (Permission)rsp.getProvider();
+
+ public static void removePerk(final Player player, final String perk) {
+ VaultHandler.perms.playerRemove((String)null, player.getName(), perk);
}
- return perms != null;
- }
-
- public static boolean setupEconomy()
- {
- if (uSkyBlock.getInstance().getServer().getPluginManager().getPlugin("Vault") == null) {
- return false;
+
+ public static void addGroup(final Player player, final String perk) {
+ VaultHandler.perms.playerAddGroup((String)null, player.getName(), perk);
}
- RegisteredServiceProvider rsp = uSkyBlock.getInstance().getServer().getServicesManager().getRegistration(Economy.class);
- if (rsp == null) {
- return false;
+
+ public static boolean checkPerk(final String player, final String perk, final World world) {
+ return VaultHandler.perms.has((String)null, player, perk) || VaultHandler.perms.has(world, player, perk);
+ }
+
+ public static boolean setupPermissions() {
+ final RegisteredServiceProvider rsp = (RegisteredServiceProvider)uSkyBlock.getInstance().getServer().getServicesManager().getRegistration((Class)Permission.class);
+ if (rsp.getProvider() != null) {
+ VaultHandler.perms = (Permission)rsp.getProvider();
+ }
+ return VaultHandler.perms != null;
+ }
+
+ public static boolean setupEconomy() {
+ if (uSkyBlock.getInstance().getServer().getPluginManager().getPlugin("Vault") == null) {
+ return false;
+ }
+ final RegisteredServiceProvider rsp = (RegisteredServiceProvider)uSkyBlock.getInstance().getServer().getServicesManager().getRegistration((Class)Economy.class);
+ if (rsp == null) {
+ return false;
+ }
+ VaultHandler.econ = (Economy)rsp.getProvider();
+ return VaultHandler.econ != null;
}
- econ = (Economy)rsp.getProvider();
- return econ != null;
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/WorldEditHandler.java b/src/us/talabrek/ultimateskyblock/WorldEditHandler.java
index 1cc761e4c..e04c2f214 100644
--- a/src/us/talabrek/ultimateskyblock/WorldEditHandler.java
+++ b/src/us/talabrek/ultimateskyblock/WorldEditHandler.java
@@ -1,45 +1,33 @@
-package us.talabrek.ultimateskyblock;
-
-import com.sk89q.worldedit.CuboidClipboard;
-import com.sk89q.worldedit.EditSession;
-import com.sk89q.worldedit.MaxChangedBlocksException;
-import com.sk89q.worldedit.Vector;
-import com.sk89q.worldedit.bukkit.BukkitWorld;
-import com.sk89q.worldedit.bukkit.WorldEditPlugin;
-import com.sk89q.worldedit.data.DataException;
-import com.sk89q.worldedit.schematic.SchematicFormat;
-import java.io.File;
-import java.io.IOException;
-import org.bukkit.Location;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
-
-public class WorldEditHandler
-{
- public WorldEditHandler() {}
-
- public static WorldEditPlugin getWorldEdit()
- {
- Plugin plugin = uSkyBlock.getInstance().getServer().getPluginManager().getPlugin("WorldEdit");
- if ((plugin == null) || (!(plugin instanceof WorldEditPlugin))) {
- return null;
- }
- return (WorldEditPlugin)plugin;
- }
-
- public static boolean loadIslandSchematic(World world, File file, Location origin)
- throws DataException, IOException, MaxChangedBlocksException
- {
- Vector v = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
- SchematicFormat format = SchematicFormat.getFormat(file);
- if (format == null) {
- return false;
- }
- EditSession es = new EditSession(new BukkitWorld(world), 999999999);
- CuboidClipboard cc = format.load(file);
- cc.paste(es, v, false);
- return true;
- }
-}
+package us.talabrek.ultimateskyblock;
+
+import org.bukkit.Location;
+import org.bukkit.plugin.*;
+import org.bukkit.*;
+import com.sk89q.worldedit.schematic.*;
+import com.sk89q.worldedit.bukkit.*;
+import com.sk89q.worldedit.data.*;
+import java.io.*;
+import com.sk89q.worldedit.*;
+
+public class WorldEditHandler
+{
+ public static WorldEditPlugin getWorldEdit() {
+ final Plugin plugin = uSkyBlock.getInstance().getServer().getPluginManager().getPlugin("WorldEdit");
+ if (plugin == null || !(plugin instanceof WorldEditPlugin)) {
+ return null;
+ }
+ return (WorldEditPlugin)plugin;
+ }
+
+ public static boolean loadIslandSchematic(final World world, final File file, final Location origin) throws DataException, IOException, MaxChangedBlocksException {
+ final Vector v = new Vector(origin.getBlockX(), origin.getBlockY(), origin.getBlockZ());
+ final SchematicFormat format = SchematicFormat.getFormat(file);
+ if (format == null) {
+ return false;
+ }
+ final EditSession es = new EditSession((LocalWorld)new BukkitWorld(world), 999999999);
+ final CuboidClipboard cc = format.load(file);
+ cc.paste(es, v, false);
+ return true;
+ }
+}
diff --git a/src/us/talabrek/ultimateskyblock/WorldGuardHandler.java b/src/us/talabrek/ultimateskyblock/WorldGuardHandler.java
index f32376e67..23763c455 100644
--- a/src/us/talabrek/ultimateskyblock/WorldGuardHandler.java
+++ b/src/us/talabrek/ultimateskyblock/WorldGuardHandler.java
@@ -1,190 +1,153 @@
package us.talabrek.ultimateskyblock;
-import com.sk89q.worldedit.BlockVector;
-import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
-import com.sk89q.worldguard.domains.DefaultDomain;
-import com.sk89q.worldguard.protection.ApplicableRegionSet;
-import com.sk89q.worldguard.protection.flags.DefaultFlag;
-import com.sk89q.worldguard.protection.flags.StateFlag;
-import com.sk89q.worldguard.protection.flags.StringFlag;
-import com.sk89q.worldguard.protection.managers.RegionManager;
-import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
-import com.sk89q.worldguard.protection.regions.ProtectedRegion;
-import java.io.PrintStream;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
+import com.sk89q.worldguard.bukkit.*;
import org.bukkit.Location;
-import org.bukkit.Server;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginManager;
+import org.bukkit.plugin.*;
+import org.bukkit.entity.*;
+import com.sk89q.worldguard.domains.*;
+import org.bukkit.command.*;
+import com.sk89q.worldguard.protection.flags.*;
+import com.sk89q.worldguard.protection.regions.*;
+import com.sk89q.worldguard.protection.*;
+import java.util.*;
+import com.sk89q.worldedit.*;
+import org.bukkit.*;
public class WorldGuardHandler
{
- public WorldGuardHandler() {}
-
- public static WorldGuardPlugin getWorldGuard()
- {
- Plugin plugin = uSkyBlock.getInstance().getServer().getPluginManager().getPlugin("WorldGuard");
- if ((plugin == null) || (!(plugin instanceof WorldGuardPlugin))) {
- return null;
+ public static WorldGuardPlugin getWorldGuard() {
+ final Plugin plugin = uSkyBlock.getInstance().getServer().getPluginManager().getPlugin("WorldGuard");
+ if (plugin == null || !(plugin instanceof WorldGuardPlugin)) {
+ return null;
+ }
+ return (WorldGuardPlugin)plugin;
}
- return (WorldGuardPlugin)plugin;
- }
-
- public static void protectIsland(Player sender, String player, PlayerInfo pi)
- {
- try
- {
- if (Settings.island_protectWithWorldGuard) {
- if ((pi.getIslandLocation() != null) && (!getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(player + "Island")))
- {
- ProtectedRegion region = null;
- DefaultDomain owners = new DefaultDomain();
- region = new ProtectedCuboidRegion(player + "Island", getProtectionVectorLeft(pi.getIslandLocation()), getProtectionVectorRight(pi.getIslandLocation()));
- owners.addPlayer(player);
- region.setOwners(owners);
- region.setParent(getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion("__Global__"));
- region.setPriority(100);
- region.setFlag(DefaultFlag.GREET_MESSAGE, DefaultFlag.GREET_MESSAGE.parseInput(getWorldGuard(), sender, "§d** You are entering a protected island area. (" + player + ")"));
- region.setFlag(DefaultFlag.FAREWELL_MESSAGE, DefaultFlag.FAREWELL_MESSAGE.parseInput(getWorldGuard(), sender, "§d** You are leaving a protected island area. (" + player + ")"));
- region.setFlag(DefaultFlag.PVP, DefaultFlag.PVP.parseInput(getWorldGuard(), sender, Settings.island_allowPvP));
- region.setFlag(DefaultFlag.CHEST_ACCESS, DefaultFlag.CHEST_ACCESS.parseInput(getWorldGuard(), sender, "deny"));
- region.setFlag(DefaultFlag.USE, DefaultFlag.USE.parseInput(getWorldGuard(), sender, "deny"));
- region.setFlag(DefaultFlag.DESTROY_VEHICLE, DefaultFlag.DESTROY_VEHICLE.parseInput(getWorldGuard(), sender, "deny"));
- region.setFlag(DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, DefaultFlag.ENTITY_ITEM_FRAME_DESTROY.parseInput(getWorldGuard(), sender, "deny"));
- region.setFlag(DefaultFlag.ENTITY_PAINTING_DESTROY, DefaultFlag.ENTITY_PAINTING_DESTROY.parseInput(getWorldGuard(), sender, "deny"));
- ApplicableRegionSet set = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getApplicableRegions(pi.getIslandLocation());
- if (set.size() > 0) {
- for (ProtectedRegion regions : set) {
- if (!regions.getId().equalsIgnoreCase("__global__")) {
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).removeRegion(regions.getId());
- }
+
+ public static void protectIsland(final Player sender, final String player, final PlayerInfo pi) {
+ try {
+ if (Settings.island_protectWithWorldGuard) {
+ if (pi.getIslandLocation() != null && !getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ ProtectedRegion region = null;
+ final DefaultDomain owners = new DefaultDomain();
+ region = (ProtectedRegion)new ProtectedCuboidRegion(String.valueOf(player) + "Island", getProtectionVectorLeft(pi.getIslandLocation()), getProtectionVectorRight(pi.getIslandLocation()));
+ owners.addPlayer(player);
+ region.setOwners(owners);
+ region.setParent(getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion("__Global__"));
+ region.setPriority(100);
+ region.setFlag((Flag)DefaultFlag.GREET_MESSAGE, (Object)DefaultFlag.GREET_MESSAGE.parseInput(getWorldGuard(), (CommandSender)sender, "�d** You are entering a protected island area. (" + player + ")"));
+ region.setFlag((Flag)DefaultFlag.FAREWELL_MESSAGE, (Object)DefaultFlag.FAREWELL_MESSAGE.parseInput(getWorldGuard(), (CommandSender)sender, "�d** You are leaving a protected island area. (" + player + ")"));
+ region.setFlag((Flag)DefaultFlag.PVP, (Object)DefaultFlag.PVP.parseInput(getWorldGuard(), (CommandSender)sender, Settings.island_allowPvP));
+ region.setFlag((Flag)DefaultFlag.CHEST_ACCESS, (Object)DefaultFlag.CHEST_ACCESS.parseInput(getWorldGuard(), (CommandSender)sender, "deny"));
+ region.setFlag((Flag)DefaultFlag.USE, (Object)DefaultFlag.USE.parseInput(getWorldGuard(), (CommandSender)sender, "deny"));
+ region.setFlag((Flag)DefaultFlag.DESTROY_VEHICLE, (Object)DefaultFlag.DESTROY_VEHICLE.parseInput(getWorldGuard(), (CommandSender)sender, "deny"));
+ region.setFlag((Flag)DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, (Object)DefaultFlag.ENTITY_ITEM_FRAME_DESTROY.parseInput(getWorldGuard(), (CommandSender)sender, "deny"));
+ region.setFlag((Flag)DefaultFlag.ENTITY_PAINTING_DESTROY, (Object)DefaultFlag.ENTITY_PAINTING_DESTROY.parseInput(getWorldGuard(), (CommandSender)sender, "deny"));
+ final ApplicableRegionSet set = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getApplicableRegions(pi.getIslandLocation());
+ if (set.size() > 0) {
+ for (final ProtectedRegion regions : set) {
+ if (!regions.getId().equalsIgnoreCase("__global__")) {
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).removeRegion(regions.getId());
+ }
+ }
+ }
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).addRegion(region);
+ System.out.print("New protected region created for " + player + "'s Island by " + sender.getName());
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).save();
+ }
+ else {
+ sender.sendMessage("Player doesn't have an island or it's already protected!");
+ }
}
- }
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).addRegion(region);
- System.out.print("New protected region created for " + player + "'s Island by " + sender.getName());
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).save();
}
- else
- {
- sender.sendMessage("Player doesn't have an island or it's already protected!");
+ catch (Exception ex) {
+ System.out.print("ERROR: Failed to protect " + player + "'s Island (" + sender.getName() + ")");
+ ex.printStackTrace();
}
- }
- }
- catch (Exception ex)
- {
- System.out.print("ERROR: Failed to protect " + player + "'s Island (" + sender.getName() + ")");
- ex.printStackTrace();
}
- }
-
- public static void islandLock(CommandSender sender, String player)
- {
- try
- {
- if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(player + "Island"))
- {
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(player + "Island").setFlag(DefaultFlag.ENTRY, DefaultFlag.ENTRY.parseInput(getWorldGuard(), sender, "deny"));
- sender.sendMessage(ChatColor.YELLOW + "Your island is now locked. Only your party members may enter.");
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).save();
- }
- else
- {
- sender.sendMessage(ChatColor.RED + "You must be the party leader to lock your island!");
- }
- }
- catch (Exception ex)
- {
- System.out.print("ERROR: Failed to lock " + player + "'s Island (" + sender.getName() + ")");
- ex.printStackTrace();
+
+ public static void islandLock(final CommandSender sender, final String player) {
+ try {
+ if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(player) + "Island").setFlag((Flag)DefaultFlag.ENTRY, (Object)DefaultFlag.ENTRY.parseInput(getWorldGuard(), sender, "deny"));
+ sender.sendMessage(ChatColor.YELLOW + "Your island is now locked. Only your party members may enter.");
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).save();
+ }
+ else {
+ sender.sendMessage(ChatColor.RED + "You must be the party leader to lock your island!");
+ }
+ }
+ catch (Exception ex) {
+ System.out.print("ERROR: Failed to lock " + player + "'s Island (" + sender.getName() + ")");
+ ex.printStackTrace();
+ }
}
- }
-
- public static void islandUnlock(CommandSender sender, String player)
- {
- try
- {
- if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(player + "Island"))
- {
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(player + "Island").setFlag(DefaultFlag.ENTRY, DefaultFlag.ENTRY.parseInput(getWorldGuard(), sender, "allow"));
- sender.sendMessage(ChatColor.YELLOW + "Your island is unlocked and anyone may enter, however only you and your party members may build or remove blocks.");
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).save();
- }
- else
- {
- sender.sendMessage(ChatColor.RED + "You must be the party leader to unlock your island!");
- }
+
+ public static void islandUnlock(final CommandSender sender, final String player) {
+ try {
+ if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(player) + "Island").setFlag((Flag)DefaultFlag.ENTRY, (Object)DefaultFlag.ENTRY.parseInput(getWorldGuard(), sender, "allow"));
+ sender.sendMessage(ChatColor.YELLOW + "Your island is unlocked and anyone may enter, however only you and your party members may build or remove blocks.");
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).save();
+ }
+ else {
+ sender.sendMessage(ChatColor.RED + "You must be the party leader to unlock your island!");
+ }
+ }
+ catch (Exception ex) {
+ System.out.print("ERROR: Failed to unlock " + player + "'s Island (" + sender.getName() + ")");
+ ex.printStackTrace();
+ }
}
- catch (Exception ex)
- {
- System.out.print("ERROR: Failed to unlock " + player + "'s Island (" + sender.getName() + ")");
- ex.printStackTrace();
+
+ public static BlockVector getProtectionVectorLeft(final Location island) {
+ return new BlockVector(island.getX() + Settings.island_protectionRange / 2, 255.0, island.getZ() + Settings.island_protectionRange / 2);
}
- }
-
- public static BlockVector getProtectionVectorLeft(Location island)
- {
- return new BlockVector(island.getX() + Settings.island_protectionRange / 2, 255.0D, island.getZ() + Settings.island_protectionRange / 2);
- }
-
- public static BlockVector getProtectionVectorRight(Location island)
- {
- return new BlockVector(island.getX() - Settings.island_protectionRange / 2, 0.0D, island.getZ() - Settings.island_protectionRange / 2);
- }
-
- public static void removePlayerFromRegion(String owner, String player)
- {
- if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(owner + "Island"))
- {
- DefaultDomain owners = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(owner + "Island").getOwners();
- owners.removePlayer(player);
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(owner + "Island").setOwners(owners);
+
+ public static BlockVector getProtectionVectorRight(final Location island) {
+ return new BlockVector(island.getX() - Settings.island_protectionRange / 2, 0.0, island.getZ() - Settings.island_protectionRange / 2);
}
- }
-
- public static void addPlayerToOldRegion(String owner, String player)
- {
- if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(owner + "Island"))
- {
- DefaultDomain owners = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(owner + "Island").getOwners();
- owners.addPlayer(player);
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(owner + "Island").setOwners(owners);
+
+ public static void removePlayerFromRegion(final String owner, final String player) {
+ if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(owner) + "Island")) {
+ final DefaultDomain owners = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(owner) + "Island").getOwners();
+ owners.removePlayer(player);
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(owner) + "Island").setOwners(owners);
+ }
}
- }
-
- public static void resetPlayerRegion(String owner)
- {
- if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(owner + "Island"))
- {
- DefaultDomain owners = new DefaultDomain();
- owners.addPlayer(owner);
-
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(owner + "Island").setOwners(owners);
+
+ public static void addPlayerToOldRegion(final String owner, final String player) {
+ if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(owner) + "Island")) {
+ final DefaultDomain owners = getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(owner) + "Island").getOwners();
+ owners.addPlayer(player);
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(owner) + "Island").setOwners(owners);
+ }
}
- }
-
- public static void transferRegion(String owner, String player, CommandSender sender)
- {
- try
- {
- ProtectedRegion region2 = null;
- region2 = new ProtectedCuboidRegion(player + "Island", getWorldGuard().getRegionManager(Bukkit.getWorld("skyworld")).getRegion(owner + "Island").getMinimumPoint(), getWorldGuard().getRegionManager(Bukkit.getWorld(Settings.general_worldName)).getRegion(owner + "Island").getMaximumPoint());
- region2.setOwners(getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(owner + "Island").getOwners());
- region2.setParent(getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion("__Global__"));
- region2.setFlag(DefaultFlag.GREET_MESSAGE, DefaultFlag.GREET_MESSAGE.parseInput(getWorldGuard(), sender, "§d** You are entering a protected island area. (" + player + ")"));
- region2.setFlag(DefaultFlag.FAREWELL_MESSAGE, DefaultFlag.FAREWELL_MESSAGE.parseInput(getWorldGuard(), sender, "§d** You are leaving a protected island area. (" + player + ")"));
- region2.setFlag(DefaultFlag.PVP, DefaultFlag.PVP.parseInput(getWorldGuard(), sender, "deny"));
- region2.setFlag(DefaultFlag.DESTROY_VEHICLE, DefaultFlag.DESTROY_VEHICLE.parseInput(getWorldGuard(), sender, "deny"));
- region2.setFlag(DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, DefaultFlag.ENTITY_ITEM_FRAME_DESTROY.parseInput(getWorldGuard(), sender, "deny"));
- region2.setFlag(DefaultFlag.ENTITY_PAINTING_DESTROY, DefaultFlag.ENTITY_PAINTING_DESTROY.parseInput(getWorldGuard(), sender, "deny"));
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).removeRegion(owner + "Island");
- getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).addRegion(region2);
+
+ public static void resetPlayerRegion(final String owner) {
+ if (getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).hasRegion(String.valueOf(owner) + "Island")) {
+ final DefaultDomain owners = new DefaultDomain();
+ owners.addPlayer(owner);
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(owner) + "Island").setOwners(owners);
+ }
}
- catch (Exception e)
- {
- System.out.println("Error transferring WorldGuard Protected Region from (" + owner + ") to (" + player + ")");
+
+ public static void transferRegion(final String owner, final String player, final CommandSender sender) {
+ try {
+ ProtectedRegion region2 = null;
+ region2 = (ProtectedRegion)new ProtectedCuboidRegion(String.valueOf(player) + "Island", getWorldGuard().getRegionManager(Bukkit.getWorld("skyworld")).getRegion(String.valueOf(owner) + "Island").getMinimumPoint(), getWorldGuard().getRegionManager(Bukkit.getWorld(Settings.general_worldName)).getRegion(String.valueOf(owner) + "Island").getMaximumPoint());
+ region2.setOwners(getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion(String.valueOf(owner) + "Island").getOwners());
+ region2.setParent(getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).getRegion("__Global__"));
+ region2.setFlag((Flag)DefaultFlag.GREET_MESSAGE, (Object)DefaultFlag.GREET_MESSAGE.parseInput(getWorldGuard(), sender, "�d** You are entering a protected island area. (" + player + ")"));
+ region2.setFlag((Flag)DefaultFlag.FAREWELL_MESSAGE, (Object)DefaultFlag.FAREWELL_MESSAGE.parseInput(getWorldGuard(), sender, "�d** You are leaving a protected island area. (" + player + ")"));
+ region2.setFlag((Flag)DefaultFlag.PVP, (Object)DefaultFlag.PVP.parseInput(getWorldGuard(), sender, "deny"));
+ region2.setFlag((Flag)DefaultFlag.DESTROY_VEHICLE, (Object)DefaultFlag.DESTROY_VEHICLE.parseInput(getWorldGuard(), sender, "deny"));
+ region2.setFlag((Flag)DefaultFlag.ENTITY_ITEM_FRAME_DESTROY, (Object)DefaultFlag.ENTITY_ITEM_FRAME_DESTROY.parseInput(getWorldGuard(), sender, "deny"));
+ region2.setFlag((Flag)DefaultFlag.ENTITY_PAINTING_DESTROY, (Object)DefaultFlag.ENTITY_PAINTING_DESTROY.parseInput(getWorldGuard(), sender, "deny"));
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).removeRegion(String.valueOf(owner) + "Island");
+ getWorldGuard().getRegionManager(uSkyBlock.getSkyBlockWorld()).addRegion(region2);
+ }
+ catch (Exception e) {
+ System.out.println("Error transferring WorldGuard Protected Region from (" + owner + ") to (" + player + ")");
+ }
}
- }
}
diff --git a/src/us/talabrek/ultimateskyblock/uSkyBlock.java b/src/us/talabrek/ultimateskyblock/uSkyBlock.java
index 9184eedad..9937b3f87 100644
--- a/src/us/talabrek/ultimateskyblock/uSkyBlock.java
+++ b/src/us/talabrek/ultimateskyblock/uSkyBlock.java
@@ -1,4320 +1,3783 @@
-package us.talabrek.ultimateskyblock;
-
-import com.sk89q.worldedit.MaxChangedBlocksException;
-import com.sk89q.worldedit.data.DataException;
-import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
-import com.sk89q.worldguard.protection.managers.RegionManager;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.PrintStream;
-import java.text.DateFormat;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import net.milkbowl.vault.economy.Economy;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Server;
-import org.bukkit.World;
-import org.bukkit.World.Environment;
-import org.bukkit.WorldCreator;
-import org.bukkit.WorldType;
-import org.bukkit.block.Biome;
-import org.bukkit.block.Block;
-import org.bukkit.block.BlockFace;
-import org.bukkit.block.Chest;
-import org.bukkit.block.Dispenser;
-import org.bukkit.block.Furnace;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.PluginCommand;
-import org.bukkit.configuration.ConfigurationSection;
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.generator.ChunkGenerator;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.FurnaceInventory;
-import org.bukkit.inventory.Inventory;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.inventory.PlayerInventory;
-import org.bukkit.inventory.meta.ItemMeta;
-import org.bukkit.inventory.meta.SkullMeta;
-import org.bukkit.plugin.PluginDescriptionFile;
-import org.bukkit.plugin.PluginManager;
-import org.bukkit.plugin.java.JavaPlugin;
-import org.bukkit.scheduler.BukkitScheduler;
-
-public class uSkyBlock
- extends JavaPlugin
-{
- public PluginDescriptionFile pluginFile;
- public Logger log;
- Date date;
- public DecimalFormat df = new DecimalFormat(".#");
- private FileConfiguration levelConfig = null;
- private FileConfiguration lastIslandConfig = null;
- private FileConfiguration orphans = null;
- private FileConfiguration tempIsland = null;
- private FileConfiguration tempPlayer = null;
- private HashMap islands = new HashMap();
- private File levelConfigFile = null;
- private File orphanFile = null;
- private File lastIslandConfigFile = null;
- private File islandConfigFile = null;
- private File tempIslandFile = null;
- private File tempPlayerFile = null;
- public static World skyBlockWorld = null;
- private static uSkyBlock instance;
- public List removeList = new ArrayList();
- List rankDisplay;
- public FileConfiguration configPlugin;
- public File filePlugin;
- private Location lastIsland;
- private Stack orphaned = new Stack();
- private Stack tempOrphaned = new Stack();
- private Stack reverseOrphaned = new Stack();
- public File directoryPlayers;
- public File directoryIslands;
- private File directorySchematics;
- public File[] schemFile;
- public String pName;
- public Location islandTestLocation = null;
- LinkedHashMap topTen;
- HashMap infoCooldown = new HashMap();
- HashMap restartCooldown = new HashMap();
- HashMap biomeCooldown = new HashMap();
- HashMap activePlayers = new HashMap();
- LinkedHashMap> challenges = new LinkedHashMap();
- HashMap requiredList = new HashMap();
- public boolean purgeActive = false;
- private FileConfiguration skyblockData = null;
- private File skyblockDataFile = null;
- public Inventory GUIparty = null;
- public Inventory GUIpartyPlayer = null;
- public Inventory GUIisland = null;
- public Inventory GUIchallenge = null;
- public Inventory GUIbiome = null;
- public Inventory GUIlog = null;
- ItemStack pHead = new ItemStack(397, 1, (short)3);
- ItemStack sign = new ItemStack(323, 1);
- ItemStack biome = new ItemStack(6, 1, (short)3);
- ItemStack lock = new ItemStack(101, 1);
- ItemStack warpset = new ItemStack(90, 1);
- ItemStack warptoggle = new ItemStack(69, 1);
- ItemStack invite = new ItemStack(398, 1);
- ItemStack kick = new ItemStack(301, 1);
- ItemStack currentBiomeItem = null;
- ItemStack currentIslandItem = null;
- ItemStack currentChallengeItem = null;
- ItemStack currentLogItem = null;
- List lores = new ArrayList();
- Iterator tempIt;
- private ArrayList sfiles;
-
- public uSkyBlock() {}
-
- public void onDisable()
- {
- try
- {
- unloadPlayerFiles();
- if (this.lastIsland != null) {
- setLastIsland(this.lastIsland);
- }
- }
- catch (Exception e)
- {
- System.out.println("Something went wrong saving the island and/or party data!");
- e.printStackTrace();
- }
- this.log.info(this.pluginFile.getName() + " v" + this.pluginFile.getVersion() + " disabled.");
- }
-
- public void onEnable()
- {
- instance = this;
- saveDefaultConfig();
- saveDefaultLevelConfig();
- saveDefaultOrphans();
- this.pluginFile = getDescription();
- this.log = getLogger();
- this.pName = (ChatColor.WHITE + "[" + ChatColor.GREEN + this.pluginFile.getName() + ChatColor.WHITE + "] ");
-
-
-
-
-
-
-
- VaultHandler.setupEconomy();
- if (!getDataFolder().exists()) {
- getDataFolder().mkdir();
- }
- this.configPlugin = getConfig();
- this.filePlugin = new File(getDataFolder(), "config.yml");
- loadPluginConfig();
- loadLevelConfig();
- registerEvents();
- this.directoryPlayers = new File(getDataFolder() + File.separator + "players");
- this.directoryIslands = new File(getDataFolder() + File.separator + "islands");
- if (!this.directoryPlayers.exists())
- {
- this.directoryPlayers.mkdir();
- loadPlayerFiles();
- }
- else
- {
- loadPlayerFiles();
- }
- if (!this.directoryIslands.exists()) {
- this.directoryIslands.mkdir();
- }
- this.directorySchematics = new File(getDataFolder() + File.separator + "schematics");
- if (!this.directorySchematics.exists()) {
- this.directorySchematics.mkdir();
- }
- this.schemFile = this.directorySchematics.listFiles();
- if (this.schemFile == null) {
- System.out.print("[uSkyBlock] No schematic file loaded.");
- } else {
- System.out.print("[uSkyBlock] " + this.schemFile.length + " schematics loaded.");
- }
- getCommand("island").setExecutor(new IslandCommand());
- getCommand("challenges").setExecutor(new ChallengesCommand());
- getCommand("dev").setExecutor(new DevCommand());
- if (Settings.island_useTopTen) {
- getInstance().updateTopTen(getInstance().generateTopTen());
- }
- populateChallengeList();
- this.log.info(this.pluginFile.getName() + " v." + this.pluginFile.getVersion() + " enabled.");
- getInstance().getServer().getScheduler().runTaskLater(getInstance(), new uSkyBlock.1(this),
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 0L);
- }
-
- public static uSkyBlock getInstance()
- {
- return instance;
- }
-
- public void loadPlayerFiles()
- {
- int onlinePlayerCount = 0;
- onlinePlayerCount = Bukkit.getServer().getOnlinePlayers().length;
- Player[] onlinePlayers = Bukkit.getServer().getOnlinePlayers();
- for (int i = 0; i < onlinePlayerCount; i++) {
- if (onlinePlayers[i].isOnline())
- {
- File f = new File(getInstance().directoryPlayers, onlinePlayers[i].getName());
- PlayerInfo pi = new PlayerInfo(onlinePlayers[i].getName());
- if (f.exists())
- {
- PlayerInfo pi2 = getInstance().readPlayerFile(onlinePlayers[i].getName());
- if (pi2 != null)
- {
- pi.setIslandLocation(pi2.getIslandLocation());
- pi.setHomeLocation(pi2.getHomeLocation());
- pi.setHasIsland(pi2.getHasIsland());
- if (getInstance().getIslandConfig(pi.locationForParty()) == null) {
- getInstance().createIslandConfig(pi.locationForParty(), onlinePlayers[i].getName());
- }
- getInstance().clearIslandConfig(pi.locationForParty(), onlinePlayers[i].getName());
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- WorldGuardHandler.protectIsland(onlinePlayers[i], onlinePlayers[i].getName(), pi);
- }
- }
- f.delete();
- }
- getInstance().addActivePlayer(onlinePlayers[i].getName(), pi);
- if ((pi.getHasIsland()) && (getInstance().getTempIslandConfig(pi.locationForParty()) == null))
- {
- getInstance().createIslandConfig(pi.locationForParty(), onlinePlayers[i].getName());
- System.out.println("Creating new Config File");
- }
- getInstance().getIslandConfig(pi.locationForParty());
- }
- }
- System.out.print("Island Configs Loaded:");
- getInstance().displayIslandConfigs();
- }
-
- public void unloadPlayerFiles()
- {
- for (int i = 0; i < Bukkit.getServer().getOnlinePlayers().length; i++)
- {
- Player[] removedPlayers = Bukkit.getServer().getOnlinePlayers();
- if (getActivePlayers().containsKey(removedPlayers[i].getName())) {
- removeActivePlayer(removedPlayers[i].getName());
- }
- }
- }
-
- public void registerEvents()
- {
- PluginManager manager = getServer().getPluginManager();
-
-
- manager.registerEvents(new PlayerJoin(), this);
- if (!Settings.island_protectWithWorldGuard)
- {
- System.out.print("[uSkyBlock] Using built in protection.");
- manager.registerEvents(new ProtectionEvents(), getInstance());
- }
- else
- {
- System.out.print("[uSkyBlock] Using WorldGuard protection.");
- }
- }
-
- public void loadPluginConfig()
- {
- try
- {
- getConfig();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- try
- {
- Settings.general_maxPartySize = getConfig().getInt("options.general.maxPartySize");
- if (Settings.general_maxPartySize < 0) {
- Settings.general_maxPartySize = 0;
- }
- }
- catch (Exception e)
- {
- Settings.general_maxPartySize = 4;
- }
- try
- {
- Settings.island_distance = getConfig().getInt("options.island.distance");
- if (Settings.island_distance < 50) {
- Settings.island_distance = 50;
- }
- }
- catch (Exception e)
- {
- Settings.island_distance = 110;
- }
- try
- {
- Settings.island_protectionRange = getConfig().getInt("options.island.protectionRange");
- if (Settings.island_protectionRange > Settings.island_distance) {
- Settings.island_protectionRange = Settings.island_distance;
- }
- }
- catch (Exception e)
- {
- Settings.island_protectionRange = 100;
- }
- try
- {
- Settings.general_cooldownInfo = getConfig().getInt("options.general.cooldownInfo");
- if (Settings.general_cooldownInfo < 0) {
- Settings.general_cooldownInfo = 0;
- }
- }
- catch (Exception e)
- {
- Settings.general_cooldownInfo = 60;
- }
- try
- {
- Settings.general_biomeChange = getConfig().getInt("options.general.biomeChange");
- if (Settings.general_biomeChange < 0) {
- Settings.general_biomeChange = 0;
- }
- }
- catch (Exception e)
- {
- Settings.general_biomeChange = 3600;
- }
- try
- {
- Settings.general_cooldownRestart = getConfig().getInt("options.general.cooldownRestart");
- if (Settings.general_cooldownRestart < 0) {
- Settings.general_cooldownRestart = 0;
- }
- }
- catch (Exception e)
- {
- Settings.general_cooldownRestart = 60;
- }
- try
- {
- Settings.island_height = getConfig().getInt("options.island.height");
- if (Settings.island_height < 20) {
- Settings.island_height = 20;
- }
- }
- catch (Exception e)
- {
- Settings.island_height = 120;
- }
- try
- {
- Settings.challenges_rankLeeway = getConfig().getInt("options.challenges.rankLeeway");
- if (Settings.challenges_rankLeeway < 0) {
- Settings.challenges_rankLeeway = 0;
- }
- }
- catch (Exception e)
- {
- Settings.challenges_rankLeeway = 0;
- }
- if (!getConfig().contains("options.extras.obsidianToLava"))
- {
- getConfig().set("options.extras.obsidianToLava", Boolean.valueOf(true));
- saveConfig();
- }
- if (!getConfig().contains("options.general.spawnSize"))
- {
- getConfig().set("options.general.spawnSize", Integer.valueOf(50));
- saveConfig();
- }
- try
- {
- Settings.general_spawnSize = getConfig().getInt("options.general.spawnSize");
- if (Settings.general_spawnSize < 50) {
- Settings.general_spawnSize = 50;
- }
- }
- catch (Exception e)
- {
- Settings.general_spawnSize = 50;
- }
- String[] chestItemString = getConfig().getString("options.island.chestItems").split(" ");
- ItemStack[] tempChest = new ItemStack[chestItemString.length];
- String[] amountdata = new String[2];
- for (int i = 0; i < tempChest.length; i++)
- {
- amountdata = chestItemString[i].split(":");
- tempChest[i] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
- }
- Settings.island_chestItems = tempChest;
- Settings.island_allowPvP = getConfig().getString("options.island.allowPvP");
- Settings.island_schematicName = getConfig().getString("options.island.schematicName");
- if (!Settings.island_allowPvP.equalsIgnoreCase("allow")) {
- Settings.island_allowPvP = "deny";
- }
- Set permissionList = getConfig().getConfigurationSection("options.island.extraPermissions").getKeys(true);
- Settings.island_addExtraItems = getConfig().getBoolean("options.island.addExtraItems");
- Settings.extras_obsidianToLava = getConfig().getBoolean("options.extras.obsidianToLava");
- Settings.island_useIslandLevel = getConfig().getBoolean("options.island.useIslandLevel");
- Settings.island_extraPermissions = (String[])permissionList.toArray(new String[0]);
- Settings.island_protectWithWorldGuard = getConfig().getBoolean("options.island.protectWithWorldGuard");
- Settings.extras_sendToSpawn = getConfig().getBoolean("options.extras.sendToSpawn");
- Settings.island_useTopTen = getConfig().getBoolean("options.island.useTopTen");
-
- Settings.general_worldName = getConfig().getString("options.general.worldName");
- Settings.island_removeCreaturesByTeleport = getConfig().getBoolean("options.island.removeCreaturesByTeleport");
- Settings.island_allowIslandLock = getConfig().getBoolean("options.island.allowIslandLock");
- Settings.island_useOldIslands = getConfig().getBoolean("options.island.useOldIslands");
-
- Set challengeList = getConfig().getConfigurationSection("options.challenges.challengeList").getKeys(false);
- Settings.challenges_challengeList = challengeList;
- Settings.challenges_broadcastCompletion = getConfig().getBoolean("options.challenges.broadcastCompletion");
- Settings.challenges_broadcastText = getConfig().getString("options.challenges.broadcastText");
- Settings.challenges_challengeColor = getConfig().getString("options.challenges.challengeColor");
- Settings.challenges_enableEconomyPlugin = getConfig().getBoolean("options.challenges.enableEconomyPlugin");
- Settings.challenges_finishedColor = getConfig().getString("options.challenges.finishedColor");
- Settings.challenges_repeatableColor = getConfig().getString("options.challenges.repeatableColor");
- Settings.challenges_requirePreviousRank = getConfig().getBoolean("options.challenges.requirePreviousRank");
- Settings.challenges_allowChallenges = getConfig().getBoolean("options.challenges.allowChallenges");
- String[] rankListString = getConfig().getString("options.challenges.ranks").split(" ");
- Settings.challenges_ranks = rankListString;
- }
-
- public List readPartyFile()
- {
- File f = new File(getDataFolder(), "partylist.bin");
- if (!f.exists()) {
- return null;
- }
- try
- {
- FileInputStream fileIn = new FileInputStream(f);
- ObjectInputStream in = new ObjectInputStream(fileIn);
-
- List p = (List)in.readObject();
- in.close();
- fileIn.close();
- return p;
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- public void writePartyFile(List pi)
- {
- File f = new File(getDataFolder(), "partylist.bin");
- try
- {
- FileOutputStream fileOut = new FileOutputStream(f);
- ObjectOutputStream out = new ObjectOutputStream(fileOut);
- out.writeObject(pi);
- out.flush();
- out.close();
- fileOut.close();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- }
-
- public PlayerInfo readPlayerFile(String playerName)
- {
- File f = new File(this.directoryPlayers, playerName);
- if (!f.exists()) {
- return null;
- }
- try
- {
- FileInputStream fileIn = new FileInputStream(f);
- ObjectInputStream in = new ObjectInputStream(fileIn);
- PlayerInfo p = (PlayerInfo)in.readObject();
- in.close();
- fileIn.close();
- return p;
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- return null;
- }
-
- public boolean displayTopTen(Player player)
- {
- int i = 1;
- int playerrank = 0;
- player.sendMessage(ChatColor.YELLOW + "Displaying the top 10 islands:");
- if (this.topTen == null)
- {
- player.sendMessage(ChatColor.RED + "Top ten list not generated yet!");
- return false;
- }
- for (String playerName : this.topTen.keySet())
- {
- if (i <= 10) {
- player.sendMessage(ChatColor.GREEN + "#" + i + ": " + playerName + " - Island level " + ((Double)this.topTen.get(playerName)).intValue());
- }
- if (playerName.equalsIgnoreCase(player.getName())) {
- playerrank = i;
- }
- i++;
- }
- player.sendMessage(ChatColor.YELLOW + "Your rank is: " + ChatColor.WHITE + playerrank);
- return true;
- }
-
- public void updateTopTen(LinkedHashMap map)
- {
- this.topTen = map;
- }
-
- public Location getLocationString(String s)
- {
- if ((s == null) || (s.trim() == "")) {
- return null;
- }
- String[] parts = s.split(":");
- if (parts.length == 4)
- {
- World w = getServer().getWorld(parts[0]);
- int x = Integer.parseInt(parts[1]);
- int y = Integer.parseInt(parts[2]);
- int z = Integer.parseInt(parts[3]);
- return new Location(w, x, y, z);
- }
- return null;
- }
-
- public String getStringLocation(Location l)
- {
- if (l == null) {
- return "";
- }
- return l.getWorld().getName() + ":" + l.getBlockX() + ":" + l.getBlockY() + ":" + l.getBlockZ();
- }
-
- public void setStringbyPath(FileConfiguration fc, File f, String path, Object value)
- {
- fc.set(path, value.toString());
- try
- {
- fc.save(f);
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
-
- public String getStringbyPath(FileConfiguration fc, File file, String path, Object stdValue, boolean addMissing)
- {
- if (!fc.contains(path))
- {
- if (addMissing) {
- setStringbyPath(fc, file, path, stdValue);
- }
- return stdValue.toString();
- }
- return fc.getString(path);
- }
-
- public static World getSkyBlockWorld()
- {
- if (skyBlockWorld == null)
- {
- skyBlockWorld = WorldCreator.name(Settings.general_worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator(new SkyBlockChunkGenerator()).createWorld();
- if (Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) {
- Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "mv import " + Settings.general_worldName + " normal -g uSkyBlock");
- }
- }
- return skyBlockWorld;
- }
-
- public void clearOrphanedIsland()
- {
- while (hasOrphanedIsland()) {
- this.orphaned.pop();
- }
- }
-
- public void clearArmorContents(Player player)
- {
- player.getInventory().setArmorContents(new ItemStack[player.getInventory().getArmorContents().length]);
- }
-
- public void getAllFiles(String path)
- {
- File dirpath = new File(path);
- if (!dirpath.exists()) {
- return;
- }
- for (File f : dirpath.listFiles()) {
- try
- {
- if (!f.isDirectory()) {
- this.sfiles.add(f);
- } else {
- getAllFiles(f.getAbsolutePath());
- }
- }
- catch (Exception ex)
- {
- this.log.warning(ex.getMessage());
- }
- }
- }
-
- public Location getYLocation(Location l)
- {
- for (int y = 0; y < 254; y++)
- {
- int px = l.getBlockX();
- int py = y;
- int pz = l.getBlockZ();
- Block b1 = new Location(l.getWorld(), px, py, pz).getBlock();
- Block b2 = new Location(l.getWorld(), px, py + 1, pz).getBlock();
- Block b3 = new Location(l.getWorld(), px, py + 2, pz).getBlock();
- if ((!b1.getType().equals(Material.AIR)) && (b2.getType().equals(Material.AIR)) && (b3.getType().equals(Material.AIR))) {
- return b2.getLocation();
- }
- }
- return l;
- }
-
- public Location getSafeHomeLocation(PlayerInfo p)
- {
- Location home = null;
- if (p.getHomeLocation() == null)
- {
- if (p.getIslandLocation() != null) {
- home = p.getIslandLocation();
- }
- }
- else {
- home = p.getHomeLocation();
- }
- if (isSafeLocation(home)) {
- return home;
- }
- for (int y = home.getBlockY() + 25; y > 0; y--)
- {
- Location n = new Location(home.getWorld(), home.getBlockX(), y, home.getBlockZ());
- if (isSafeLocation(n)) {
- return n;
- }
- }
- for (int y = home.getBlockY(); y < 255; y++)
- {
- Location n = new Location(home.getWorld(), home.getBlockX(), y, home.getBlockZ());
- if (isSafeLocation(n)) {
- return n;
- }
- }
- Location island = p.getIslandLocation();
- if (isSafeLocation(island)) {
- return island;
- }
- for (int y = island.getBlockY() + 25; y > 0; y--)
- {
- Location n = new Location(island.getWorld(), island.getBlockX(), y, island.getBlockZ());
- if (isSafeLocation(n)) {
- return n;
- }
- }
- for (int y = island.getBlockY(); y < 255; y++)
- {
- Location n = new Location(island.getWorld(), island.getBlockX(), y, island.getBlockZ());
- if (isSafeLocation(n)) {
- return n;
- }
- }
- return p.getHomeLocation();
- }
-
- public Location getSafeWarpLocation(PlayerInfo p)
- {
- Location warp = null;
- getTempIslandConfig(p.locationForParty());
- if (this.tempIsland.getInt("general.warpLocationX") == 0)
- {
- if (p.getHomeLocation() == null)
- {
- if (p.getIslandLocation() != null) {
- warp = p.getIslandLocation();
- }
- }
- else {
- warp = p.getHomeLocation();
- }
- }
- else {
- warp = new Location(skyBlockWorld, this.tempIsland.getInt("general.warpLocationX"), this.tempIsland.getInt("general.warpLocationY"), this.tempIsland.getInt("general.warpLocationZ"));
- }
- if (warp == null)
- {
- System.out.print("Error warping player to " + p.getPlayerName() + "'s island.");
- return null;
- }
- if (isSafeLocation(warp)) {
- return warp;
- }
- for (int y = warp.getBlockY() + 25; y > 0; y--)
- {
- Location n = new Location(warp.getWorld(), warp.getBlockX(), y, warp.getBlockZ());
- if (isSafeLocation(n)) {
- return n;
- }
- }
- for (int y = warp.getBlockY(); y < 255; y++)
- {
- Location n = new Location(warp.getWorld(), warp.getBlockX(), y, warp.getBlockZ());
- if (isSafeLocation(n)) {
- return n;
- }
- }
- return null;
- }
-
- public boolean isSafeLocation(Location l)
- {
- if (l == null) {
- return false;
- }
- Block ground = l.getBlock().getRelative(BlockFace.DOWN);
- Block air1 = l.getBlock();
- Block air2 = l.getBlock().getRelative(BlockFace.UP);
- if (ground.getType().equals(Material.AIR)) {
- return false;
- }
- if (ground.getType().equals(Material.LAVA)) {
- return false;
- }
- if (ground.getType().equals(Material.STATIONARY_LAVA)) {
- return false;
- }
- if (ground.getType().equals(Material.CACTUS)) {
- return false;
- }
- if (((air1.getType().equals(Material.AIR)) || (air1.getType().equals(Material.CROPS)) || (air1.getType().equals(Material.LONG_GRASS)) || (air1.getType().equals(Material.RED_ROSE)) || (air1.getType().equals(Material.YELLOW_FLOWER)) || (air1.getType().equals(Material.DEAD_BUSH)) || (air1.getType().equals(Material.SIGN_POST)) || (air1.getType().equals(Material.SIGN))) && (air2.getType().equals(Material.AIR))) {
- return true;
- }
- return false;
- }
-
- public void removeCreatures(Location l)
- {
- if ((!Settings.island_removeCreaturesByTeleport) || (l == null)) {
- return;
- }
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -1; x <= 1; x++) {
- for (int z = -1; z <= 1; z++)
- {
- Chunk c = l.getWorld().getChunkAt(new Location(l.getWorld(), px + x * 16, py, pz + z * 16));
- for (Entity e : c.getEntities()) {
- if ((e.getType() == EntityType.SPIDER) || (e.getType() == EntityType.CREEPER) || (e.getType() == EntityType.ENDERMAN) || (e.getType() == EntityType.SKELETON) || (e.getType() == EntityType.ZOMBIE)) {
- e.remove();
- }
- }
- }
- }
- }
-
- public void deletePlayerIsland(String player)
- {
- if (!getActivePlayers().containsKey(player))
- {
- PlayerInfo pi = new PlayerInfo(player);
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- if (WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(player + "Island")) {
- WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(player + "Island");
- }
- }
- this.orphaned.push(pi.getIslandLocation());
- removeIsland(pi.getIslandLocation());
- deleteIslandConfig(pi.locationForParty());
- pi.removeFromIsland();
- saveOrphans();
- pi.savePlayerConfig(player);
- }
- else
- {
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- if (WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(player + "Island")) {
- WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(player + "Island");
- }
- }
- this.orphaned.push(((PlayerInfo)getActivePlayers().get(player)).getIslandLocation());
- removeIsland(((PlayerInfo)getActivePlayers().get(player)).getIslandLocation());
- deleteIslandConfig(((PlayerInfo)getActivePlayers().get(player)).locationForParty());
- PlayerInfo pi = new PlayerInfo(player);
- pi.removeFromIsland();
-
- addActivePlayer(player, pi);
- saveOrphans();
- }
- }
-
- public void restartPlayerIsland(Player player, Location next)
- {
- boolean hasIslandNow = false;
- if ((next.getBlockX() == 0) && (next.getBlockZ() == 0)) {
- return;
- }
- removeIsland(next);
- if ((getInstance().getSchemFile().length > 0) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldEdit")))
- {
- String cSchem = "";
- for (int i = 0; i < getInstance().getSchemFile().length; i++) {
- if (!hasIslandNow)
- {
- if (getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0) {
- cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
- } else {
- cSchem = getInstance().getSchemFile()[i].getName();
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.schematic." + cSchem, getSkyBlockWorld())) {
- try
- {
- if (WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
- {
- setChest(next, player);
- hasIslandNow = true;
- }
- }
- catch (MaxChangedBlocksException e)
- {
- e.printStackTrace();
- }
- catch (DataException e)
- {
- e.printStackTrace();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- if (!hasIslandNow) {
- for (int i = 0; i < getInstance().getSchemFile().length; i++)
- {
- if (getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0) {
- cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
- } else {
- cSchem = getInstance().getSchemFile()[i].getName();
- }
- if (cSchem.equalsIgnoreCase(Settings.island_schematicName)) {
- try
- {
- if (WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
- {
- setChest(next, player);
- hasIslandNow = true;
- }
- }
- catch (MaxChangedBlocksException e)
- {
- e.printStackTrace();
- }
- catch (DataException e)
- {
- e.printStackTrace();
- }
- catch (IOException e)
- {
- e.printStackTrace();
- }
- }
- }
- }
- }
- if (!hasIslandNow) {
- if (!Settings.island_useOldIslands) {
- generateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
- } else {
- oldGenerateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
- }
- }
- next.setY(Settings.island_height);
- System.out.println(next.getBlockY());
-
- setNewPlayerIsland(player, next);
- player.getInventory().clear();
- player.getEquipment().clear();
- getInstance().changePlayerBiome(player, "OCEAN");
- for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
- for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
- getSkyBlockWorld().refreshChunk((next.getBlockX() + x) / 16, (next.getBlockZ() + z) / 16);
- }
- }
- Iterator ents = player.getNearbyEntities(Settings.island_protectionRange / 2, 250.0D, Settings.island_protectionRange / 2).iterator();
- while (ents.hasNext())
- {
- Entity tempent = (Entity)ents.next();
- if (!(tempent instanceof Player)) {
- tempent.remove();
- }
- }
- }
-
- public void devDeletePlayerIsland(String player)
- {
- if (!getActivePlayers().containsKey(player))
- {
- PlayerInfo pi = new PlayerInfo(player);
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- if (WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(player + "Island")) {
- WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(player + "Island");
- }
- }
- pi = new PlayerInfo(player);
- pi.savePlayerConfig(player);
- }
- else
- {
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- if (WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(player + "Island")) {
- WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(player + "Island");
- }
- }
- PlayerInfo pi = new PlayerInfo(player);
- removeActivePlayer(player);
- addActivePlayer(player, pi);
- }
- }
-
- public boolean devSetPlayerIsland(Player sender, Location l, String player)
- {
- if (!getActivePlayers().containsKey(player))
- {
- PlayerInfo pi = new PlayerInfo(player);
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -10; x <= 10; x++) {
- for (int y = -10; y <= 10; y++) {
- for (int z = -10; z <= 10; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- if (b.getTypeId() == 7)
- {
- pi.setHomeLocation(new Location(l.getWorld(), px + x, py + y + 3, pz + z));
- pi.setHasIsland(true);
- pi.setIslandLocation(b.getLocation());
- pi.savePlayerConfig(player);
- getInstance().createIslandConfig(pi.locationForParty(), player);
- getInstance().clearIslandConfig(pi.locationForParty(), player);
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- WorldGuardHandler.protectIsland(sender, player, pi);
- }
- getInstance().getIslandConfig(pi.locationForParty());
- return true;
- }
- }
- }
- }
- }
- else
- {
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -10; x <= 10; x++) {
- for (int y = -10; y <= 10; y++) {
- for (int z = -10; z <= 10; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- if (b.getTypeId() == 7)
- {
- ((PlayerInfo)getActivePlayers().get(player)).setHomeLocation(new Location(l.getWorld(), px + x, py + y + 3, pz + z));
- ((PlayerInfo)getActivePlayers().get(player)).setHasIsland(true);
- ((PlayerInfo)getActivePlayers().get(player)).setIslandLocation(b.getLocation());
- PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player);
- removeActivePlayer(player);
- addActivePlayer(player, pi);
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- WorldGuardHandler.protectIsland(sender, player, pi);
- }
- return true;
- }
- }
- }
- }
- }
- return false;
- }
-
- public int orphanCount()
- {
- return this.orphaned.size();
- }
-
- public void removeIsland(Location loc)
- {
- if (loc != null)
- {
- Location l = loc;
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = Settings.island_protectionRange / 2 * -1; x <= Settings.island_protectionRange / 2; x++) {
- for (int y = 0; y <= 255; y++) {
- for (int z = Settings.island_protectionRange / 2 * -1; z <= Settings.island_protectionRange / 2; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- if (!b.getType().equals(Material.AIR))
- {
- if (b.getType().equals(Material.CHEST))
- {
- Chest c = (Chest)b.getState();
- ItemStack[] items = new ItemStack[c.getInventory().getContents().length];
- c.getInventory().setContents(items);
- }
- else if (b.getType().equals(Material.FURNACE))
- {
- Furnace f = (Furnace)b.getState();
- ItemStack[] items = new ItemStack[f.getInventory().getContents().length];
- f.getInventory().setContents(items);
- }
- else if (b.getType().equals(Material.DISPENSER))
- {
- Dispenser d = (Dispenser)b.getState();
- ItemStack[] items = new ItemStack[d.getInventory().getContents().length];
- d.getInventory().setContents(items);
- }
- b.setType(Material.AIR);
- }
- }
- }
- }
- }
- }
-
- public void removeIslandBlocks(Location loc)
- {
- if (loc != null)
- {
- System.out.print("Removing blocks from an abandoned island.");
- Location l = loc;
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -20; x <= 20; x++) {
- for (int y = -20; y <= 20; y++) {
- for (int z = -20; z <= 20; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- if (!b.getType().equals(Material.AIR))
- {
- if (b.getType().equals(Material.CHEST))
- {
- Chest c = (Chest)b.getState();
- ItemStack[] items = new ItemStack[c.getInventory().getContents().length];
- c.getInventory().setContents(items);
- }
- else if (b.getType().equals(Material.FURNACE))
- {
- Furnace f = (Furnace)b.getState();
- ItemStack[] items = new ItemStack[f.getInventory().getContents().length];
- f.getInventory().setContents(items);
- }
- else if (b.getType().equals(Material.DISPENSER))
- {
- Dispenser d = (Dispenser)b.getState();
- ItemStack[] items = new ItemStack[d.getInventory().getContents().length];
- d.getInventory().setContents(items);
- }
- b.setType(Material.AIR);
- }
- }
- }
- }
- }
- }
-
- public boolean hasParty(String playername)
- {
- if (getActivePlayers().containsKey(playername))
- {
- if (getIslandConfig(((PlayerInfo)getActivePlayers().get(playername)).locationForParty()).getInt("party.currentSize") > 1) {
- return true;
- }
- return false;
- }
- PlayerInfo pi = new PlayerInfo(playername);
- if (!pi.getHasIsland()) {
- return false;
- }
- if (getTempIslandConfig(pi.locationForParty()).getInt("party.currentSize") > 1) {
- return true;
- }
- return false;
- }
-
- public Location getLastIsland()
- {
- if (this.lastIsland.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
- return this.lastIsland;
- }
- setLastIsland(new Location(getSkyBlockWorld(), 0.0D, Settings.island_height, 0.0D));
- return new Location(getSkyBlockWorld(), 0.0D, Settings.island_height, 0.0D);
- }
-
- public void setLastIsland(Location island)
- {
- getLastIslandConfig().set("options.general.lastIslandX", Integer.valueOf(island.getBlockX()));
- getLastIslandConfig().set("options.general.lastIslandZ", Integer.valueOf(island.getBlockZ()));
- saveLastIslandConfig();
- this.lastIsland = island;
- }
-
- public boolean hasOrphanedIsland()
- {
- return !this.orphaned.empty();
- }
-
- public Location checkOrphan()
- {
- return (Location)this.orphaned.peek();
- }
-
- public Location getOrphanedIsland()
- {
- if (hasOrphanedIsland()) {
- return (Location)this.orphaned.pop();
- }
- return null;
- }
-
- public void addOrphan(Location island)
- {
- this.orphaned.push(island);
- }
-
- public void removeNextOrphan()
- {
- this.orphaned.pop();
- }
-
- public void saveOrphans()
- {
- String fullOrphan = "";
- this.tempOrphaned = ((Stack)this.orphaned.clone());
- while (!this.tempOrphaned.isEmpty()) {
- this.reverseOrphaned.push((Location)this.tempOrphaned.pop());
- }
- while (!this.reverseOrphaned.isEmpty())
- {
- Location tempLoc = (Location)this.reverseOrphaned.pop();
- fullOrphan = fullOrphan + tempLoc.getBlockX() + "," + tempLoc.getBlockZ() + ";";
- }
- getOrphans().set("orphans.list", fullOrphan);
- saveOrphansFile();
- }
-
- public void setupOrphans()
- {
- if (getOrphans().contains("orphans.list"))
- {
- String fullOrphan = getOrphans().getString("orphans.list");
- if (!fullOrphan.isEmpty())
- {
- String[] orphanArray = fullOrphan.split(";");
-
-
- this.orphaned = new Stack();
- for (int i = 0; i < orphanArray.length; i++)
- {
- String[] orphanXY = orphanArray[i].split(",");
- Location tempLoc = new Location(getSkyBlockWorld(), Integer.parseInt(orphanXY[0]), Settings.island_height, Integer.parseInt(orphanXY[1]));
- this.orphaned.push(tempLoc);
- }
- }
- }
- }
-
- public boolean homeTeleport(Player player)
- {
- Location homeSweetHome = null;
- if (getActivePlayers().containsKey(player.getName())) {
- homeSweetHome = getInstance().getSafeHomeLocation((PlayerInfo)getActivePlayers().get(player.getName()));
- }
- if (homeSweetHome == null)
- {
- player.performCommand("spawn");
- player.sendMessage(ChatColor.RED + "You are not part of an island. Returning you the spawn area!");
- return true;
- }
- getInstance().removeCreatures(homeSweetHome);
- player.teleport(homeSweetHome);
- player.sendMessage(ChatColor.GREEN + "Teleporting you to your island.");
- return true;
- }
-
- public boolean warpTeleport(Player player, PlayerInfo pi)
- {
- Location warpSweetWarp = null;
- if (pi == null)
- {
- player.sendMessage(ChatColor.RED + "That player does not exist!");
- return true;
- }
- warpSweetWarp = getInstance().getSafeWarpLocation(pi);
- if (warpSweetWarp == null)
- {
- player.sendMessage(ChatColor.RED + "Unable to warp you to that player's island!");
- return true;
- }
- player.teleport(warpSweetWarp);
- player.sendMessage(ChatColor.GREEN + "Teleporting you to " + pi.getPlayerName() + "'s island.");
- return true;
- }
-
- public boolean homeSet(Player player)
- {
- if (!player.getWorld().getName().equalsIgnoreCase(getSkyBlockWorld().getName()))
- {
- player.sendMessage(ChatColor.RED + "You must be closer to your island to set your skyblock home!");
- return true;
- }
- if (playerIsOnIsland(player))
- {
- if (getActivePlayers().containsKey(player.getName())) {
- ((PlayerInfo)getActivePlayers().get(player.getName())).setHomeLocation(player.getLocation());
- }
- player.sendMessage(ChatColor.GREEN + "Your skyblock home has been set to your current location.");
- return true;
- }
- player.sendMessage(ChatColor.RED + "You must be closer to your island to set your skyblock home!");
- return true;
- }
-
- public boolean warpSet(Player player)
- {
- if (!player.getWorld().getName().equalsIgnoreCase(getSkyBlockWorld().getName()))
- {
- player.sendMessage(ChatColor.RED + "You must be closer to your island to set your warp!");
- return true;
- }
- if (playerIsOnIsland(player))
- {
- if (getActivePlayers().containsKey(player.getName())) {
- setWarpLocation(((PlayerInfo)getActivePlayers().get(player.getName())).locationForParty(), player.getLocation());
- }
- player.sendMessage(ChatColor.GREEN + "Your skyblock incoming warp has been set to your current location.");
- return true;
- }
- player.sendMessage(ChatColor.RED + "You must be closer to your island to set your warp!");
- return true;
- }
-
- public boolean homeSet(String player, Location loc)
- {
- if (getActivePlayers().containsKey(player))
- {
- ((PlayerInfo)getActivePlayers().get(player)).setHomeLocation(loc);
- }
- else
- {
- PlayerInfo pi = new PlayerInfo(player);
- pi.setHomeLocation(loc);
- pi.savePlayerConfig(player);
- }
- return true;
- }
-
- public boolean playerIsOnIsland(Player player)
- {
- if (getActivePlayers().containsKey(player.getName()))
- {
- if (((PlayerInfo)getActivePlayers().get(player.getName())).getHasIsland()) {
- this.islandTestLocation = ((PlayerInfo)getActivePlayers().get(player.getName())).getIslandLocation();
- }
- if (this.islandTestLocation == null) {
- return false;
- }
- if ((player.getLocation().getX() > this.islandTestLocation.getX() - Settings.island_protectionRange / 2) && (player.getLocation().getX() < this.islandTestLocation.getX() + Settings.island_protectionRange / 2) &&
- (player.getLocation().getZ() > this.islandTestLocation.getZ() - Settings.island_protectionRange / 2) && (player.getLocation().getZ() < this.islandTestLocation.getZ() + Settings.island_protectionRange / 2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean locationIsOnIsland(Player player, Location loc)
- {
- if (getActivePlayers().containsKey(player.getName()))
- {
- if (((PlayerInfo)getActivePlayers().get(player.getName())).getHasIsland()) {
- this.islandTestLocation = ((PlayerInfo)getActivePlayers().get(player.getName())).getIslandLocation();
- }
- if (this.islandTestLocation == null) {
- return false;
- }
- if ((loc.getX() > this.islandTestLocation.getX() - Settings.island_protectionRange / 2) && (loc.getX() < this.islandTestLocation.getX() + Settings.island_protectionRange / 2) &&
- (loc.getZ() > this.islandTestLocation.getZ() - Settings.island_protectionRange / 2) && (loc.getZ() < this.islandTestLocation.getZ() + Settings.island_protectionRange / 2)) {
- return true;
- }
- }
- return false;
- }
-
- public boolean playerIsInSpawn(Player player)
- {
- if ((player.getLocation().getX() > Settings.general_spawnSize * -1) && (player.getLocation().getX() < Settings.general_spawnSize) && (player.getLocation().getZ() > Settings.general_spawnSize * -1) && (player.getLocation().getZ() < Settings.general_spawnSize)) {
- return true;
- }
- return false;
- }
-
- public boolean hasIsland(String playername)
- {
- if (getActivePlayers().containsKey(playername)) {
- return ((PlayerInfo)getActivePlayers().get(playername)).getHasIsland();
- }
- PlayerInfo pi = new PlayerInfo(playername);
- return pi.getHasIsland();
- }
-
- public Location getPlayerIsland(String playername)
- {
- if (getActivePlayers().containsKey(playername)) {
- return ((PlayerInfo)getActivePlayers().get(playername)).getIslandLocation();
- }
- PlayerInfo pi = new PlayerInfo(playername);
- if (!pi.getHasIsland()) {
- return null;
- }
- return pi.getIslandLocation();
- }
-
- public boolean islandAtLocation(Location loc)
- {
- if (loc == null) {
- return true;
- }
- int px = loc.getBlockX();
- int py = loc.getBlockY();
- int pz = loc.getBlockZ();
- for (int x = -2; x <= 2; x++) {
- for (int y = -50; y <= 50; y++) {
- for (int z = -2; z <= 2; z++)
- {
- Block b = new Location(loc.getWorld(), px + x, py + y, pz + z).getBlock();
- if (b.getTypeId() != 0) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public boolean islandInSpawn(Location loc)
- {
- if (loc == null) {
- return true;
- }
- if ((loc.getX() > -50.0D) && (loc.getX() < 50.0D) && (loc.getZ() > -50.0D) && (loc.getZ() < 50.0D)) {
- return true;
- }
- return false;
- }
-
- public ChunkGenerator getDefaultWorldGenerator(String worldName, String id)
- {
- return new SkyBlockChunkGenerator();
- }
-
- public Stack changeStackToFile(Stack stack)
- {
- Stack finishStack = new Stack();
- Stack tempStack = new Stack();
- while (!stack.isEmpty()) {
- tempStack.push((Location)stack.pop());
- }
- while (!tempStack.isEmpty()) {
- if (tempStack.peek() != null) {
- finishStack.push(new SerializableLocation((Location)tempStack.pop()));
- } else {
- tempStack.pop();
- }
- }
- return finishStack;
- }
-
- public Stack changestackfromfile(Stack stack)
- {
- Stack tempStack = new Stack();
- Stack finishStack = new Stack();
- while (!stack.isEmpty()) {
- tempStack.push((SerializableLocation)stack.pop());
- }
- while (!tempStack.isEmpty()) {
- if (tempStack.peek() != null) {
- finishStack.push(((SerializableLocation)tempStack.pop()).getLocation());
- } else {
- tempStack.pop();
- }
- }
- return finishStack;
- }
-
- public boolean largeIsland(Location l)
- {
- int blockcount = 0;
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -30; x <= 30; x++) {
- for (int y = -30; y <= 30; y++) {
- for (int z = -30; z <= 30; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- if ((b.getTypeId() != 0) && (b.getTypeId() != 8) && (b.getTypeId() != 10)) {
- if (blockcount > 200) {
- return true;
- }
- }
- }
- }
- }
- if (blockcount > 200) {
- return true;
- }
- return false;
- }
-
- public boolean clearAbandoned()
- {
- int numOffline = 0;
- OfflinePlayer[] oplayers = Bukkit.getServer().getOfflinePlayers();
- System.out.print("Attemping to add more orphans");
- for (int i = 0; i < oplayers.length; i++)
- {
- long offlineTime = oplayers[i].getLastPlayed();
- offlineTime = (System.currentTimeMillis() - offlineTime) / 3600000L;
- if ((offlineTime > 250L) && (getInstance().hasIsland(oplayers[i].getName())) && (offlineTime < 50000L))
- {
- PlayerInfo pi = new PlayerInfo(oplayers[i].getName());
- Location l = pi.getIslandLocation();
- int blockcount = 0;
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -30; x <= 30; x++) {
- for (int y = -30; y <= 30; y++) {
- for (int z = -30; z <= 30; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- if ((b.getTypeId() != 0) && (b.getTypeId() != 8) && (b.getTypeId() != 10)) {
- blockcount++;
- }
- }
- }
- }
- if (blockcount < 200)
- {
- numOffline++;
- WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(oplayers[i].getName() + "Island");
- this.orphaned.push(pi.getIslandLocation());
-
- pi.setHomeLocation(null);
- pi.setHasIsland(false);
- pi.setIslandLocation(null);
- pi.savePlayerConfig(pi.getPlayerName());
- }
- }
- }
- if (numOffline > 0)
- {
- System.out.print("Added " + numOffline + " new orphans.");
- saveOrphans();
- return true;
- }
- System.out.print("No new orphans to add!");
- return false;
- }
-
- public LinkedHashMap generateTopTen()
- {
- HashMap tempMap = new LinkedHashMap();
- File folder = this.directoryIslands;
- File[] listOfFiles = folder.listFiles();
- for (int i = 0; i < listOfFiles.length; i++) {
- if (getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")) != null) {
- if (getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getInt("general.level") > 0) {
- tempMap.put(getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getString("party.leader"), Double.valueOf(getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getInt("general.level")));
- }
- }
- }
- LinkedHashMap sortedMap = sortHashMapByValuesD(tempMap);
- return sortedMap;
- }
-
- public LinkedHashMap sortHashMapByValuesD(HashMap passedMap)
- {
- List mapKeys = new ArrayList(passedMap.keySet());
- List mapValues = new ArrayList(passedMap.values());
- Collections.sort(mapValues);
- Collections.reverse(mapValues);
- Collections.sort(mapKeys);
- Collections.reverse(mapKeys);
-
- LinkedHashMap sortedMap =
- new LinkedHashMap();
-
- Iterator valueIt = mapValues.iterator();
- while (valueIt.hasNext())
- {
- Double val = (Double)valueIt.next();
- Iterator keyIt = mapKeys.iterator();
- while (keyIt.hasNext())
- {
- String key = (String)keyIt.next();
- String comp1 = ((Double)passedMap.get(key)).toString();
- String comp2 = val.toString();
- if (comp1.equals(comp2))
- {
- passedMap.remove(key);
- mapKeys.remove(key);
- sortedMap.put(key, val);
- break;
- }
- }
- }
- return sortedMap;
- }
-
- public boolean onInfoCooldown(Player player)
- {
- if (this.infoCooldown.containsKey(player.getName()))
- {
- if (((Long)this.infoCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis()) {
- return true;
- }
- return false;
- }
- return false;
- }
-
- public boolean onBiomeCooldown(Player player)
- {
- if (this.biomeCooldown.containsKey(player.getName()))
- {
- if (((Long)this.biomeCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis()) {
- return true;
- }
- return false;
- }
- return false;
- }
-
- public boolean onRestartCooldown(Player player)
- {
- if (this.restartCooldown.containsKey(player.getName()))
- {
- if (((Long)this.restartCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis()) {
- return true;
- }
- return false;
- }
- return false;
- }
-
- public long getInfoCooldownTime(Player player)
- {
- if (this.infoCooldown.containsKey(player.getName()))
- {
- if (((Long)this.infoCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis()) {
- return ((Long)this.infoCooldown.get(player.getName())).longValue() - Calendar.getInstance().getTimeInMillis();
- }
- return 0L;
- }
- return 0L;
- }
-
- public long getBiomeCooldownTime(Player player)
- {
- if (this.biomeCooldown.containsKey(player.getName()))
- {
- if (((Long)this.biomeCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis()) {
- return ((Long)this.biomeCooldown.get(player.getName())).longValue() - Calendar.getInstance().getTimeInMillis();
- }
- return 0L;
- }
- return 0L;
- }
-
- public long getRestartCooldownTime(Player player)
- {
- if (this.restartCooldown.containsKey(player.getName()))
- {
- if (((Long)this.restartCooldown.get(player.getName())).longValue() > Calendar.getInstance().getTimeInMillis()) {
- return ((Long)this.restartCooldown.get(player.getName())).longValue() - Calendar.getInstance().getTimeInMillis();
- }
- return 0L;
- }
- return 0L;
- }
-
- public void setInfoCooldown(Player player)
- {
- this.infoCooldown.put(player.getName(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + Settings.general_cooldownInfo * 1000));
- }
-
- public void setBiomeCooldown(Player player)
- {
- this.biomeCooldown.put(player.getName(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + Settings.general_biomeChange * 1000));
- }
-
- public void setRestartCooldown(Player player)
- {
- this.restartCooldown.put(player.getName(), Long.valueOf(Calendar.getInstance().getTimeInMillis() + Settings.general_cooldownRestart * 1000));
- }
-
- public File[] getSchemFile()
- {
- return this.schemFile;
- }
-
- public boolean testForObsidian(Block block)
- {
- for (int x = -3; x <= 3; x++) {
- for (int y = -3; y <= 3; y++) {
- for (int z = -3; z <= 3; z++)
- {
- Block testBlock = getSkyBlockWorld().getBlockAt(block.getX() + x, block.getY() + y, block.getZ() + z);
- if (((x != 0) || (y != 0) || (z != 0)) && (testBlock.getType() == Material.OBSIDIAN)) {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- public void removeInactive(List removePlayerList)
- {
- getInstance().getServer().getScheduler().scheduleSyncRepeatingTask(getInstance(), new uSkyBlock.2(this),
-
-
-
-
-
-
-
-
-
- 0L, 200L);
- }
-
- public List getRemoveList()
- {
- return this.removeList;
- }
-
- public void addToRemoveList(String string)
- {
- this.removeList.add(string);
- }
-
- public void deleteFromRemoveList()
- {
- this.removeList.remove(0);
- }
-
- public boolean isPurgeActive()
- {
- return this.purgeActive;
- }
-
- public void activatePurge()
- {
- this.purgeActive = true;
- }
-
- public void deactivatePurge()
- {
- this.purgeActive = false;
- }
-
- public HashMap getActivePlayers()
- {
- return this.activePlayers;
- }
-
- public void addActivePlayer(String player, PlayerInfo pi)
- {
- this.activePlayers.put(player, pi);
- }
-
- public void removeActivePlayer(String player)
- {
- if (this.activePlayers.containsKey(player))
- {
- ((PlayerInfo)this.activePlayers.get(player)).savePlayerConfig(player);
-
- this.activePlayers.remove(player);
- System.out.print("Removing player from memory: " + player);
- }
- }
-
- public void populateChallengeList()
- {
- List templist = new ArrayList();
- for (int i = 0; i < Settings.challenges_ranks.length; i++)
- {
- this.challenges.put(Settings.challenges_ranks[i], templist);
- templist = new ArrayList();
- }
- Iterator itr = Settings.challenges_challengeList.iterator();
- while (itr.hasNext())
- {
- String tempString = (String)itr.next();
- if (this.challenges.containsKey(getConfig().getString("options.challenges.challengeList." + tempString + ".rankLevel"))) {
- ((List)this.challenges.get(getConfig().getString("options.challenges.challengeList." + tempString + ".rankLevel"))).add(tempString);
- }
- }
- }
-
- public String getChallengesFromRank(Player player, String rank)
- {
- this.rankDisplay = ((List)this.challenges.get(rank));
- String fullString = "";
- PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player.getName());
- Iterator itr = this.rankDisplay.iterator();
- while (itr.hasNext())
- {
- String tempString = (String)itr.next();
- if (pi.checkChallenge(tempString) > 0)
- {
- if (getConfig().getBoolean("options.challenges.challengeList." + tempString + ".repeatable")) {
- fullString = fullString + Settings.challenges_repeatableColor.replace('&', '§') + tempString + ChatColor.DARK_GRAY + " - ";
- } else {
- fullString = fullString + Settings.challenges_finishedColor.replace('&', '§') + tempString + ChatColor.DARK_GRAY + " - ";
- }
- }
- else {
- fullString = fullString + Settings.challenges_challengeColor.replace('&', '§') + tempString + ChatColor.DARK_GRAY + " - ";
- }
- }
- if (fullString.length() > 4) {
- fullString = fullString.substring(0, fullString.length() - 3);
- }
- return fullString;
- }
-
- public int checkRankCompletion(Player player, String rank)
- {
- if (!Settings.challenges_requirePreviousRank) {
- return 0;
- }
- this.rankDisplay = ((List)this.challenges.get(rank));
- int ranksCompleted = 0;
- PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player.getName());
- Iterator itr = this.rankDisplay.iterator();
- while (itr.hasNext())
- {
- String tempString = (String)itr.next();
- if (pi.checkChallenge(tempString) > 0) {
- ranksCompleted++;
- }
- }
- return this.rankDisplay.size() - Settings.challenges_rankLeeway - ranksCompleted;
- }
-
- public boolean isRankAvailable(Player player, String rank)
- {
- if (this.challenges.size() < 2) {
- return true;
- }
- for (int i = 0; i < Settings.challenges_ranks.length; i++) {
- if (Settings.challenges_ranks[i].equalsIgnoreCase(rank))
- {
- if (i == 0) {
- return true;
- }
- if (checkRankCompletion(player, Settings.challenges_ranks[(i - 1)]) <= 0) {
- return true;
- }
- }
- }
- return false;
- }
-
- public boolean checkIfCanCompleteChallenge(Player player, String challenge)
- {
- PlayerInfo pi = (PlayerInfo)getActivePlayers().get(player.getName());
- if (!isRankAvailable(player, getConfig().getString("options.challenges.challengeList." + challenge + ".rankLevel")))
- {
- player.sendMessage(ChatColor.RED + "You have not unlocked this challenge yet!");
- return false;
- }
- if (!pi.challengeExists(challenge))
- {
- player.sendMessage(ChatColor.RED + "Unknown challenge name (check spelling)!");
- return false;
- }
- if ((pi.checkChallenge(challenge) > 0) && (!getConfig().getBoolean("options.challenges.challengeList." + challenge + ".repeatable")))
- {
- player.sendMessage(ChatColor.RED + "This challenge is not repeatable!");
- return false;
- }
- if ((pi.checkChallenge(challenge) > 0) && ((getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onIsland")) || (getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onIsland"))))
- {
- player.sendMessage(ChatColor.RED + "This challenge is not repeatable!");
- return false;
- }
- if (getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onPlayer"))
- {
- if (!hasRequired(player, challenge, "onPlayer"))
- {
- player.sendMessage(ChatColor.RED + getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".description").toString()));
- player.sendMessage(ChatColor.RED + "You don't have enough of the required item(s)!");
- return false;
- }
- return true;
- }
- if (getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onIsland"))
- {
- if (!playerIsOnIsland(player)) {
- player.sendMessage(ChatColor.RED + "You must be on your island to do that!");
- }
- if (!hasRequired(player, challenge, "onIsland"))
- {
- player.sendMessage(ChatColor.RED + getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".description").toString()));
-
- player.sendMessage(ChatColor.RED + "You must be standing within 10 blocks of all required items.");
- return false;
- }
- return true;
- }
- if (getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("islandLevel"))
- {
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("general.level") >= getConfig().getInt("options.challenges.challengeList." + challenge + ".requiredItems")) {
- return true;
- }
- player.sendMessage(ChatColor.RED + "Your island must be level " + getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".requiredItems").toString()) + " to complete this challenge!");
- return false;
- }
- return false;
- }
-
- public boolean takeRequired(Player player, String challenge, String type)
- {
- if (type.equalsIgnoreCase("onPlayer"))
- {
- String[] reqList = getConfig().getString("options.challenges.challengeList." + challenge + ".requiredItems").split(" ");
-
-
- int reqItem = 0;
- int reqAmount = 0;
- int reqMod = -1;
- for (String s : reqList)
- {
- String[] sPart = s.split(":");
- if (sPart.length == 2)
- {
- reqItem = Integer.parseInt(sPart[0]);
- String[] sScale = sPart[1].split(";");
- if (sScale.length == 1) {
- reqAmount = Integer.parseInt(sPart[1]);
- } else if (sScale.length == 2) {
- if (sScale[1].charAt(0) == '+') {
- reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '*') {
- reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- } else if (sScale[1].charAt(0) == '-') {
- reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '/') {
- reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- }
- }
- if (!player.getInventory().contains(reqItem, reqAmount)) {
- return false;
- }
- player.getInventory().removeItem(new ItemStack[] { new ItemStack(reqItem, reqAmount) });
- }
- else if (sPart.length == 3)
- {
- reqItem = Integer.parseInt(sPart[0]);
- String[] sScale = sPart[2].split(";");
- if (sScale.length == 1) {
- reqAmount = Integer.parseInt(sPart[2]);
- } else if (sScale.length == 2) {
- if (sScale[1].charAt(0) == '+') {
- reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '*') {
- reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- } else if (sScale[1].charAt(0) == '-') {
- reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '/') {
- reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- }
- }
- reqMod = Integer.parseInt(sPart[1]);
- if (!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)reqMod), reqAmount)) {
- return false;
- }
- player.getInventory().removeItem(new ItemStack[] { new ItemStack(reqItem, reqAmount, (short)reqMod) });
- }
- }
- return true;
- }
- if (type.equalsIgnoreCase("onIsland")) {
- return true;
- }
- if (type.equalsIgnoreCase("islandLevel")) {
- return true;
- }
- return false;
- }
-
- public boolean hasRequired(Player player, String challenge, String type)
- {
- String[] reqList = getConfig().getString("options.challenges.challengeList." + challenge + ".requiredItems").split(" ");
- if (type.equalsIgnoreCase("onPlayer"))
- {
- int reqItem = 0;
- int reqAmount = 0;
- int reqMod = -1;
- for (String s : reqList)
- {
- String[] sPart = s.split(":");
- if (sPart.length == 2)
- {
- reqItem = Integer.parseInt(sPart[0]);
- String[] sScale = sPart[1].split(";");
- if (sScale.length == 1) {
- reqAmount = Integer.parseInt(sPart[1]);
- } else if (sScale.length == 2) {
- if (sScale[1].charAt(0) == '+') {
- reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '*') {
- reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- } else if (sScale[1].charAt(0) == '-') {
- reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '/') {
- reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- }
- }
- if (!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)0), reqAmount)) {
- return false;
- }
- }
- else if (sPart.length == 3)
- {
- reqItem = Integer.parseInt(sPart[0]);
- String[] sScale = sPart[2].split(";");
- if (sScale.length == 1) {
- reqAmount = Integer.parseInt(sPart[2]);
- } else if (sScale.length == 2) {
- if (sScale[1].charAt(0) == '+') {
- reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '*') {
- reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- } else if (sScale[1].charAt(0) == '-') {
- reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge);
- } else if (sScale[1].charAt(0) == '/') {
- reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challenge));
- }
- }
- reqMod = Integer.parseInt(sPart[1]);
- if (!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)reqMod), reqAmount)) {
- return false;
- }
- }
- }
- if (getConfig().getBoolean("options.challenges.challengeList." + challenge + ".takeItems")) {
- takeRequired(player, challenge, type);
- }
- return true;
- }
- if (type.equalsIgnoreCase("onIsland"))
- {
- int[][] neededItem = new int[reqList.length][2];
- for (int i = 0; i < reqList.length; i++)
- {
- String[] sPart = reqList[i].split(":");
- neededItem[i][0] = Integer.parseInt(sPart[0]);
- neededItem[i][1] = Integer.parseInt(sPart[1]);
- }
- Location l = player.getLocation();
- int px = l.getBlockX();
- int py = l.getBlockY();
- int pz = l.getBlockZ();
- for (int x = -10; x <= 10; x++) {
- for (int y = -3; y <= 10; y++) {
- for (int z = -10; z <= 10; z++)
- {
- Block b = new Location(l.getWorld(), px + x, py + y, pz + z).getBlock();
- for (int i = 0; i < neededItem.length; i++) {
- if (b.getTypeId() == neededItem[i][0]) {
- neededItem[i][1] -= 1;
- }
- }
- }
- }
- }
- for (int i = 0; i < neededItem.length; i++) {
- if (neededItem[i][1] > 0) {
- return false;
- }
- }
- return true;
- }
- return true;
- }
-
- public boolean giveReward(Player player, String challenge)
- {
- String[] permList = getConfig().getString("options.challenges.challengeList." + challenge.toLowerCase() + ".permissionReward").split(" ");
- double rewCurrency = 0.0D;
- player.sendMessage(ChatColor.GREEN + "You have completed the " + challenge + " challenge!");
- String[] rewList;
- if (((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallenge(challenge) == 0)
- {
- String[] rewList = getConfig().getString("options.challenges.challengeList." + challenge.toLowerCase() + ".itemReward").split(" ");
- if ((Settings.challenges_enableEconomyPlugin) && (VaultHandler.econ != null)) {
- rewCurrency = getConfig().getInt("options.challenges.challengeList." + challenge.toLowerCase() + ".currencyReward");
- }
- }
- else
- {
- rewList = getConfig().getString("options.challenges.challengeList." + challenge.toLowerCase() + ".repeatItemReward").split(" ");
- if ((Settings.challenges_enableEconomyPlugin) && (VaultHandler.econ != null)) {
- rewCurrency = getConfig().getInt("options.challenges.challengeList." + challenge.toLowerCase() + ".repeatCurrencyReward");
- }
- }
- int rewItem = 0;
- int rewAmount = 0;
- double rewBonus = 1.0D;
- int rewMod = -1;
- if ((Settings.challenges_enableEconomyPlugin) && (VaultHandler.econ != null))
- {
- if (VaultHandler.checkPerk(player.getName(), "group.memberplus", getSkyBlockWorld())) {
- rewBonus += 0.05D;
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.donor.all", getSkyBlockWorld())) {
- rewBonus += 0.05D;
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.donor.25", getSkyBlockWorld())) {
- rewBonus += 0.05D;
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.donor.50", getSkyBlockWorld())) {
- rewBonus += 0.05D;
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.donor.75", getSkyBlockWorld())) {
- rewBonus += 0.1D;
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.donor.100", getSkyBlockWorld())) {
- rewBonus += 0.2D;
- }
- VaultHandler.econ.depositPlayer(player.getName(), rewCurrency * rewBonus);
- if (((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallenge(challenge) > 0)
- {
- player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatXpReward"));
- player.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".repeatRewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".repeatXpReward").toString()));
- player.sendMessage(ChatColor.YELLOW + "Repeat currency reward: " + ChatColor.WHITE + this.df.format(getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".repeatCurrencyReward").toString()) * rewBonus) + " " + VaultHandler.econ.currencyNamePlural() + "§a(+" + this.df.format((rewBonus - 1.0D) * 100.0D) + "%)");
- }
- else
- {
- if (Settings.challenges_broadcastCompletion) {
- Bukkit.getServer().broadcastMessage(Settings.challenges_broadcastText.replace('&', '§') + player.getName() + " has completed the " + challenge + " challenge!");
- }
- player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".xpReward"));
- player.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".rewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".xpReward").toString()));
- player.sendMessage(ChatColor.YELLOW + "Currency reward: " + ChatColor.WHITE + this.df.format(getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".currencyReward").toString()) * rewBonus) + " " + VaultHandler.econ.currencyNamePlural() + "§a(+" + this.df.format((rewBonus - 1.0D) * 100.0D) + "%)");
- }
- }
- else if (((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallenge(challenge) > 0)
- {
- player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatXpReward"));
- player.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".repeatRewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".repeatXpReward").toString()));
- }
- else
- {
- if (Settings.challenges_broadcastCompletion) {
- Bukkit.getServer().broadcastMessage(Settings.challenges_broadcastText.replace('&', '§') + player.getName() + " has completed the " + challenge + " challenge!");
- }
- player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".xpReward"));
- player.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".rewardText").toString()).replace('&', '§'));
- player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challenge).append(".xpReward").toString()));
- }
- for (String s : permList) {
- if (!s.equalsIgnoreCase("none")) {
- if (!VaultHandler.checkPerk(player.getName(), s, player.getWorld())) {
- VaultHandler.addPerk(player, s);
- }
- }
- }
- for (String s : rewList)
- {
- String[] sPart = s.split(":");
- if (sPart.length == 2)
- {
- rewItem = Integer.parseInt(sPart[0]);
- rewAmount = Integer.parseInt(sPart[1]);
- player.getInventory().addItem(new ItemStack[] { new ItemStack(rewItem, rewAmount) });
- }
- else if (sPart.length == 3)
- {
- rewItem = Integer.parseInt(sPart[0]);
- rewAmount = Integer.parseInt(sPart[2]);
- rewMod = Integer.parseInt(sPart[1]);
- player.getInventory().addItem(new ItemStack[] { new ItemStack(rewItem, rewAmount, (short)rewMod) });
- }
- }
- ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).completeChallenge(challenge);
-
-
- return true;
- }
-
- public void reloadData()
- {
- if (this.skyblockDataFile == null) {
- this.skyblockDataFile = new File(getDataFolder(), "skyblockData.yml");
- }
- this.skyblockData = YamlConfiguration.loadConfiguration(this.skyblockDataFile);
-
-
- InputStream defConfigStream = getResource("skyblockData.yml");
- if (defConfigStream != null)
- {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
- this.skyblockData.setDefaults(defConfig);
- }
- }
-
- public FileConfiguration getData()
- {
- if (this.skyblockData == null) {
- reloadData();
- }
- return this.skyblockData;
- }
-
- double dReturns(double val, double scale)
- {
- if (val < 0.0D) {
- return -dReturns(-val, scale);
- }
- double mult = val / scale;
- double trinum = (Math.sqrt(8.0D * mult + 1.0D) - 1.0D) / 2.0D;
- return trinum * scale;
- }
-
- public void reloadLevelConfig()
- {
- if (this.levelConfigFile == null) {
- this.levelConfigFile = new File(getDataFolder(), "levelConfig.yml");
- }
- this.levelConfig = YamlConfiguration.loadConfiguration(this.levelConfigFile);
-
-
- InputStream defConfigStream = getResource("levelConfig.yml");
- if (defConfigStream != null)
- {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
- this.levelConfig.setDefaults(defConfig);
- }
- }
-
- public FileConfiguration getLevelConfig()
- {
- if (this.levelConfig == null) {
- reloadLevelConfig();
- }
- return this.levelConfig;
- }
-
- public void saveLevelConfig()
- {
- if ((this.levelConfig == null) || (this.levelConfigFile == null)) {
- return;
- }
- try
- {
- getLevelConfig().save(this.levelConfigFile);
- }
- catch (IOException ex)
- {
- getLogger().log(Level.SEVERE, "Could not save config to " + this.levelConfigFile, ex);
- }
- }
-
- public void saveDefaultLevelConfig()
- {
- if (this.levelConfigFile == null) {
- this.levelConfigFile = new File(getDataFolder(), "levelConfig.yml");
- }
- if (!this.levelConfigFile.exists()) {
- getInstance().saveResource("levelConfig.yml", false);
- }
- }
-
- public void loadLevelConfig()
- {
- try
- {
- getLevelConfig();
- }
- catch (Exception e)
- {
- e.printStackTrace();
- }
- for (int i = 1; i <= 255; i++)
- {
- if (getLevelConfig().contains("blockValues." + i)) {
- Settings.blockList[i] = getLevelConfig().getInt("blockValues." + i);
- } else {
- Settings.blockList[i] = getLevelConfig().getInt("general.default");
- }
- if (getLevelConfig().contains("blockLimits." + i)) {
- Settings.limitList[i] = getLevelConfig().getInt("blockLimits." + i);
- } else {
- Settings.limitList[i] = -1;
- }
- if (getLevelConfig().contains("diminishingReturns." + i)) {
- Settings.diminishingReturnsList[i] = getLevelConfig().getInt("diminishingReturns." + i);
- } else if (getLevelConfig().getBoolean("general.useDiminishingReturns")) {
- Settings.diminishingReturnsList[i] = getLevelConfig().getInt("general.defaultScale");
- } else {
- Settings.diminishingReturnsList[i] = -1;
- }
- }
- System.out.print(Settings.blockList[57]);
- System.out.print(Settings.diminishingReturnsList[57]);
- System.out.print(Settings.limitList[57]);
- }
-
- public void clearIslandConfig(String location, String leader)
- {
- getIslandConfig(location).set("general.level", Integer.valueOf(0));
- getIslandConfig(location).set("general.warpLocationX", Integer.valueOf(0));
- getIslandConfig(location).set("general.warpLocationY", Integer.valueOf(0));
- getIslandConfig(location).set("general.warpLocationZ", Integer.valueOf(0));
- getIslandConfig(location).set("general.warpActive", Boolean.valueOf(false));
- getIslandConfig(location).set("log.logPos", Integer.valueOf(1));
- getIslandConfig(location).set("log.1", "§d[skyblock] The island has been created.");
- setupPartyLeader(location, leader);
- }
-
- public void setupPartyLeader(String location, String leader)
- {
- getIslandConfig(location).createSection("party.members." + leader);
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + leader), "canChangeBiome");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + leader), "canToggleLock");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + leader), "canChangeWarp");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + leader), "canToggleWarp");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + leader), "canInviteOthers");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + leader), "canKickOthers");
- getIslandConfig(location).set("party.leader", leader);
- getIslandConfig(location).set("party.members." + leader + ".canChangeBiome", Boolean.valueOf(true));
- getIslandConfig(location).set("party.members." + leader + ".canToggleLock", Boolean.valueOf(true));
- getIslandConfig(location).set("party.members." + leader + ".canChangeWarp", Boolean.valueOf(true));
- getIslandConfig(location).set("party.members." + leader + ".canToggleWarp", Boolean.valueOf(true));
- getIslandConfig(location).set("party.members." + leader + ".canInviteOthers", Boolean.valueOf(true));
- getIslandConfig(location).set("party.members." + leader + ".canKickOthers", Boolean.valueOf(true));
- saveIslandConfig(location);
- }
-
- public void setupPartyMember(String location, String member)
- {
- getIslandConfig(location).createSection("party.members." + member);
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + member), "canChangeBiome");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + member), "canToggleLock");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + member), "canChangeWarp");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + member), "canToggleWarp");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + member), "canInviteOthers");
- getIslandConfig(location);FileConfiguration.createPath(getIslandConfig(location).getConfigurationSection("party.members." + member), "canKickOthers");
- getIslandConfig(location).set("party.members." + member + ".canChangeBiome", Boolean.valueOf(false));
- getIslandConfig(location).set("party.currentSize", Integer.valueOf(getIslandConfig(location).getInt("party.currentSize") + 1));
- getIslandConfig(location).set("party.members." + member + ".canToggleLock", Boolean.valueOf(false));
- getIslandConfig(location).set("party.members." + member + ".canChangeWarp", Boolean.valueOf(false));
- getIslandConfig(location).set("party.members." + member + ".canToggleWarp", Boolean.valueOf(false));
- getIslandConfig(location).set("party.members." + member + ".canInviteOthers", Boolean.valueOf(false));
- getIslandConfig(location).set("party.members." + member + ".canKickOthers", Boolean.valueOf(false));
- getIslandConfig(location).set("party.members." + member + ".canBanOthers", Boolean.valueOf(false));
- saveIslandConfig(location);
- }
-
- public void reloadIslandConfig(String location)
- {
- this.islandConfigFile = new File(this.directoryIslands, location + ".yml");
- this.islands.put(location, YamlConfiguration.loadConfiguration(this.islandConfigFile));
- InputStream defConfigStream = getResource("island.yml");
- if (defConfigStream != null)
- {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
- ((FileConfiguration)this.islands.get(location)).setDefaults(defConfig);
- }
- saveIslandConfig(location);
- }
-
- public FileConfiguration getTempIslandConfig(String location)
- {
- this.tempIslandFile = new File(this.directoryIslands, location + ".yml");
- this.tempIsland = YamlConfiguration.loadConfiguration(this.tempIslandFile);
- return this.tempIsland;
- }
-
- public FileConfiguration getCurrentPlayerConfig(String player)
- {
- this.tempPlayerFile = new File(this.directoryPlayers, player + ".yml");
- this.tempPlayer = YamlConfiguration.loadConfiguration(this.tempPlayerFile);
- return this.tempPlayer;
- }
-
- public void createIslandConfig(String location, String leader)
- {
- saveDefaultIslandsConfig(location);
- this.islandConfigFile = new File(this.directoryIslands, location + ".yml");
-
-
-
- InputStream defConfigStream = getResource("island.yml");
- if (defConfigStream != null)
- {
- this.islands.put(location, YamlConfiguration.loadConfiguration(defConfigStream));
- getIslandConfig(location);
- setupPartyLeader(location, leader);
- }
- }
-
- public FileConfiguration getIslandConfig(String location)
- {
- if (this.islands.get(location) == null) {
- reloadIslandConfig(location);
- }
- return (FileConfiguration)this.islands.get(location);
- }
-
- public void saveIslandConfig(String location)
- {
- if (this.islands.get(location) == null) {
- return;
- }
- try
- {
- this.islandConfigFile = new File(this.directoryIslands, location + ".yml");
- getIslandConfig(location).save(this.islandConfigFile);
- }
- catch (IOException ex)
- {
- getLogger().log(Level.SEVERE, "Could not save config to " + this.islandConfigFile, ex);
- }
- }
-
- public void deleteIslandConfig(String location)
- {
- this.islandConfigFile = new File(this.directoryIslands, location + ".yml");
- this.islandConfigFile.delete();
- }
-
- public void saveDefaultIslandsConfig(String location)
- {
- try
- {
- if (this.islandConfigFile == null)
- {
- this.islandConfigFile = new File(this.directoryIslands, location + ".yml");
- getIslandConfig(location).save(this.islandConfigFile);
- }
- }
- catch (IOException ex)
- {
- getLogger().log(Level.SEVERE, "Could not save config to " + this.islandConfigFile, ex);
- }
- }
-
- public void reloadLastIslandConfig()
- {
- if (this.lastIslandConfigFile == null) {
- this.lastIslandConfigFile = new File(getDataFolder(), "lastIslandConfig.yml");
- }
- this.lastIslandConfig = YamlConfiguration.loadConfiguration(this.lastIslandConfigFile);
-
-
- InputStream defConfigStream = getResource("lastIslandConfig.yml");
- if (defConfigStream != null)
- {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
- this.lastIslandConfig.setDefaults(defConfig);
- }
- }
-
- public FileConfiguration getLastIslandConfig()
- {
- if (this.lastIslandConfig == null) {
- reloadLastIslandConfig();
- }
- return this.lastIslandConfig;
- }
-
- public void saveLastIslandConfig()
- {
- if ((this.lastIslandConfig == null) || (this.lastIslandConfigFile == null)) {
- return;
- }
- try
- {
- getLastIslandConfig().save(this.lastIslandConfigFile);
- }
- catch (IOException ex)
- {
- getLogger().log(Level.SEVERE, "Could not save config to " + this.lastIslandConfigFile, ex);
- }
- }
-
- public void saveDefaultLastIslandConfig()
- {
- if (this.lastIslandConfigFile == null) {
- this.lastIslandConfigFile = new File(getDataFolder(), "lastIslandConfig.yml");
- }
- if (!this.lastIslandConfigFile.exists()) {
- getInstance().saveResource("lastIslandConfig.yml", false);
- }
- }
-
- public void reloadOrphans()
- {
- if (this.orphanFile == null) {
- this.orphanFile = new File(getDataFolder(), "orphans.yml");
- }
- this.orphans = YamlConfiguration.loadConfiguration(this.orphanFile);
-
-
- InputStream defConfigStream = getResource("orphans.yml");
- if (defConfigStream != null)
- {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
- this.orphans.setDefaults(defConfig);
- }
- }
-
- public FileConfiguration getOrphans()
- {
- if (this.orphans == null) {
- reloadOrphans();
- }
- return this.orphans;
- }
-
- public void saveOrphansFile()
- {
- if ((this.orphans == null) || (this.orphanFile == null)) {
- return;
- }
- try
- {
- getOrphans().save(this.orphanFile);
- }
- catch (IOException ex)
- {
- getLogger().log(Level.SEVERE, "Could not save config to " + this.orphanFile, ex);
- }
- }
-
- public void saveDefaultOrphans()
- {
- if (this.orphanFile == null) {
- this.orphanFile = new File(getDataFolder(), "orphans.yml");
- }
- if (!this.orphanFile.exists()) {
- getInstance().saveResource("orphans.yml", false);
- }
- }
-
- public boolean setBiome(Location loc, String bName)
- {
- int px = loc.getBlockX();
- int pz = loc.getBlockZ();
- Biome bType = Biome.OCEAN;
- if (bName.equalsIgnoreCase("jungle")) {
- bType = Biome.JUNGLE;
- } else if (bName.equalsIgnoreCase("hell")) {
- bType = Biome.HELL;
- } else if (bName.equalsIgnoreCase("sky")) {
- bType = Biome.SKY;
- } else if (bName.equalsIgnoreCase("mushroom")) {
- bType = Biome.MUSHROOM_ISLAND;
- } else if (bName.equalsIgnoreCase("ocean")) {
- bType = Biome.OCEAN;
- } else if (bName.equalsIgnoreCase("swampland")) {
- bType = Biome.SWAMPLAND;
- } else if (bName.equalsIgnoreCase("taiga")) {
- bType = Biome.TAIGA;
- } else if (bName.equalsIgnoreCase("desert")) {
- bType = Biome.DESERT;
- } else if (bName.equalsIgnoreCase("forest")) {
- bType = Biome.FOREST;
- } else {
- bType = Biome.OCEAN;
- }
- for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
- for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
- getSkyBlockWorld().loadChunk((px + x) / 16, (pz + z) / 16);
- }
- }
- for (int x = Settings.island_protectionRange / 2 * -1; x <= Settings.island_protectionRange / 2; x++) {
- for (int z = Settings.island_protectionRange / 2 * -1; z <= Settings.island_protectionRange / 2; z++) {
- getSkyBlockWorld().setBiome(px + x, pz + z, bType);
- }
- }
- for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
- for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
- getSkyBlockWorld().refreshChunk((px + x) / 16, (pz + z) / 16);
- }
- }
- if (bType == Biome.OCEAN) {
- return false;
- }
- return true;
- }
-
- public boolean changePlayerBiome(Player player, String bName)
- {
- if (VaultHandler.checkPerk(player.getName(), "usb.biome." + bName, player.getWorld()))
- {
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + player.getName() + ".canChangeBiome"))
- {
- setBiome(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).getIslandLocation(), bName);
- setConfigBiome(player, bName);
- return true;
- }
- return false;
- }
- return false;
- }
-
- public void listBiomes(Player player)
- {
- String biomeList = ", ";
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.ocean", getSkyBlockWorld())) {
- biomeList = "OCEAN, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.forest", getSkyBlockWorld())) {
- biomeList = biomeList + "FOREST, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.jungle", getSkyBlockWorld())) {
- biomeList = biomeList + "JUNGLE, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.desert", getSkyBlockWorld())) {
- biomeList = biomeList + "DESERT, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.taiga", getSkyBlockWorld())) {
- biomeList = biomeList + "TAIGA, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.swampland", getSkyBlockWorld())) {
- biomeList = biomeList + "SWAMPLAND, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.mushroom", getSkyBlockWorld())) {
- biomeList = biomeList + "MUSHROOM, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.hell", getSkyBlockWorld())) {
- biomeList = biomeList + "HELL, ";
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.sky", getSkyBlockWorld())) {
- biomeList = biomeList + "SKY, ";
- }
- player.sendMessage(ChatColor.YELLOW + "You have access to the following Biomes:");
- player.sendMessage(ChatColor.GREEN + biomeList.substring(0, biomeList.length() - 2));
- player.sendMessage(ChatColor.YELLOW + "Use /island biome to change your biome. You must wait " + Settings.general_biomeChange / 60 + " minutes between each biome change.");
- }
-
- public boolean createIsland(CommandSender sender, PlayerInfo pi)
- {
- System.out.println("Creating player island...");
- Player player = (Player)sender;
- Location last = getInstance().getLastIsland();
- last.setY(Settings.island_height);
- try
- {
- do
- {
- getInstance().removeNextOrphan();
- if (!getInstance().hasOrphanedIsland()) {
- break;
- }
- } while (getInstance().islandAtLocation(getInstance().checkOrphan()));
- while ((getInstance().hasOrphanedIsland()) && (!getInstance().checkOrphan().getWorld().getName().equalsIgnoreCase(Settings.general_worldName))) {
- getInstance().removeNextOrphan();
- }
- Location next;
- if ((getInstance().hasOrphanedIsland()) && (!getInstance().islandAtLocation(getInstance().checkOrphan())))
- {
- Location next = getInstance().getOrphanedIsland();
- getInstance().saveOrphans();
- }
- else
- {
- next = nextIslandLocation(last);
- getInstance().setLastIsland(next);
- while (getInstance().islandAtLocation(next)) {
- next = nextIslandLocation(next);
- }
- while (getInstance().islandInSpawn(next)) {
- next = nextIslandLocation(next);
- }
- getInstance().setLastIsland(next);
- }
- boolean hasIslandNow = false;
- if ((getInstance().getSchemFile().length > 0) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldEdit")))
- {
- String cSchem = "";
- for (int i = 0; i < getInstance().getSchemFile().length; i++) {
- if (!hasIslandNow)
- {
- if (getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0) {
- cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
- } else {
- cSchem = getInstance().getSchemFile()[i].getName();
- }
- if (VaultHandler.checkPerk(player.getName(), "usb.schematic." + cSchem, getSkyBlockWorld())) {
- if (WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
- {
- setChest(next, player);
- hasIslandNow = true;
- }
- }
- }
- }
- if (!hasIslandNow) {
- for (int i = 0; i < getInstance().getSchemFile().length; i++)
- {
- if (getInstance().getSchemFile()[i].getName().lastIndexOf('.') > 0) {
- cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf('.'));
- } else {
- cSchem = getInstance().getSchemFile()[i].getName();
- }
- if (cSchem.equalsIgnoreCase(Settings.island_schematicName)) {
- if (WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next))
- {
- setChest(next, player);
- hasIslandNow = true;
- }
- }
- }
- }
- }
- if (!hasIslandNow) {
- if (!Settings.island_useOldIslands) {
- generateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
- } else {
- oldGenerateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
- }
- }
- next.setY(Settings.island_height);
- System.out.println(next.getBlockY());
-
- System.out.println("Preparing to set new player information...");
- setNewPlayerIsland(player, next);
- System.out.println("Finished setting new player information.");
-
- player.getInventory().clear();
- player.getEquipment().clear();
- System.out.println("Preparing to set initial player biome...");
- getInstance().changePlayerBiome(player, "OCEAN");
- System.out.println("Finished setting initial player biome.");
- for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
- for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
- getSkyBlockWorld().refreshChunk((next.getBlockX() + x) / 16, (next.getBlockZ() + z) / 16);
- }
- }
- Iterator ents = player.getNearbyEntities(50.0D, 250.0D, 50.0D).iterator();
- while (ents.hasNext())
- {
- Entity tempent = (Entity)ents.next();
- if (!(tempent instanceof Player)) {
- tempent.remove();
- }
- }
- if ((Settings.island_protectWithWorldGuard) && (Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard"))) {
- WorldGuardHandler.protectIsland(player, sender.getName(), pi);
- }
- }
- catch (Exception ex)
- {
- player.sendMessage("Could not create your Island. Pleace contact a server moderator.");
- ex.printStackTrace();
- return false;
- }
- System.out.println("Finished creating player island.");
- return true;
- }
-
- public void generateIslandBlocks(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
- Block blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(7);
- islandLayer1(x, z, player, world);
- islandLayer2(x, z, player, world);
- islandLayer3(x, z, player, world);
- islandLayer4(x, z, player, world);
- islandExtras(x, z, player, world);
- }
-
- public void oldGenerateIslandBlocks(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
- for (int x_operate = x; x_operate < x + 3; x_operate++) {
- for (int y_operate = y; y_operate < y + 3; y_operate++) {
- for (int z_operate = z; z_operate < z + 6; z_operate++)
- {
- Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
- blockToChange.setTypeId(2);
- }
- }
- }
- for (int x_operate = x + 3; x_operate < x + 6; x_operate++) {
- for (int y_operate = y; y_operate < y + 3; y_operate++) {
- for (int z_operate = z + 3; z_operate < z + 6; z_operate++)
- {
- Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
- blockToChange.setTypeId(2);
- }
- }
- }
- for (int x_operate = x + 3; x_operate < x + 7; x_operate++) {
- for (int y_operate = y + 7; y_operate < y + 10; y_operate++) {
- for (int z_operate = z + 3; z_operate < z + 7; z_operate++)
- {
- Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
- blockToChange.setTypeId(18);
- }
- }
- }
- for (int y_operate = y + 3; y_operate < y + 9; y_operate++)
- {
- Block blockToChange = world.getBlockAt(x + 5, y_operate, z + 5);
- blockToChange.setTypeId(17);
- }
- Block blockToChange = world.getBlockAt(x + 1, y + 3, z + 1);
- blockToChange.setTypeId(54);
- Chest chest = (Chest)blockToChange.getState();
- Inventory inventory = chest.getInventory();
- inventory.clear();
- inventory.setContents(Settings.island_chestItems);
- if (Settings.island_addExtraItems) {
- for (int i = 0; i < Settings.island_extraPermissions.length; i++) {
- if (VaultHandler.checkPerk(player.getName(), "usb." + Settings.island_extraPermissions[i], player.getWorld()))
- {
- String[] chestItemString = getInstance().getConfig().getString("options.island.extraPermissions." + Settings.island_extraPermissions[i]).split(" ");
- ItemStack[] tempChest = new ItemStack[chestItemString.length];
- String[] amountdata = new String[2];
- for (int j = 0; j < chestItemString.length; j++)
- {
- amountdata = chestItemString[j].split(":");
- tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
- inventory.addItem(new ItemStack[] { tempChest[j] });
- }
- }
- }
- }
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(7);
-
-
- blockToChange = world.getBlockAt(x + 2, y + 1, z + 1);
- blockToChange.setTypeId(12);
- blockToChange = world.getBlockAt(x + 2, y + 1, z + 2);
- blockToChange.setTypeId(12);
- blockToChange = world.getBlockAt(x + 2, y + 1, z + 3);
- blockToChange.setTypeId(12);
- }
-
- private Location nextIslandLocation(Location lastIsland)
- {
- int x = (int)lastIsland.getX();
- int z = (int)lastIsland.getZ();
- Location nextPos = lastIsland;
- if (x < z)
- {
- if (-1 * x < z)
- {
- nextPos.setX(nextPos.getX() + Settings.island_distance);
- return nextPos;
- }
- nextPos.setZ(nextPos.getZ() + Settings.island_distance);
- return nextPos;
- }
- if (x > z)
- {
- if (-1 * x >= z)
- {
- nextPos.setX(nextPos.getX() - Settings.island_distance);
- return nextPos;
- }
- nextPos.setZ(nextPos.getZ() - Settings.island_distance);
- return nextPos;
- }
- if (x <= 0)
- {
- nextPos.setZ(nextPos.getZ() + Settings.island_distance);
- return nextPos;
- }
- nextPos.setZ(nextPos.getZ() - Settings.island_distance);
- return nextPos;
- }
-
- private void islandLayer1(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
- y = Settings.island_height + 4;
- for (int x_operate = x - 3; x_operate <= x + 3; x_operate++) {
- for (int z_operate = z - 3; z_operate <= z + 3; z_operate++)
- {
- Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
- blockToChange.setTypeId(2);
- }
- }
- Block blockToChange = world.getBlockAt(x - 3, y, z + 3);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x - 3, y, z - 3);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x + 3, y, z - 3);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x + 3, y, z + 3);
- blockToChange.setTypeId(0);
- }
-
- private void islandLayer2(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
- y = Settings.island_height + 3;
- for (int x_operate = x - 2; x_operate <= x + 2; x_operate++) {
- for (int z_operate = z - 2; z_operate <= z + 2; z_operate++)
- {
- Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
- blockToChange.setTypeId(3);
- }
- }
- Block blockToChange = world.getBlockAt(x - 3, y, z);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x + 3, y, z);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z - 3);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z + 3);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(12);
- }
-
- private void islandLayer3(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
- y = Settings.island_height + 2;
- for (int x_operate = x - 1; x_operate <= x + 1; x_operate++) {
- for (int z_operate = z - 1; z_operate <= z + 1; z_operate++)
- {
- Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
- blockToChange.setTypeId(3);
- }
- }
- Block blockToChange = world.getBlockAt(x - 2, y, z);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x + 2, y, z);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z - 2);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z + 2);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(12);
- }
-
- private void islandLayer4(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
- y = Settings.island_height + 1;
- Block blockToChange = world.getBlockAt(x - 1, y, z);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x + 1, y, z);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z - 1);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z + 1);
- blockToChange.setTypeId(3);
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(12);
- }
-
- private void islandExtras(int x, int z, Player player, World world)
- {
- int y = Settings.island_height;
-
- Block blockToChange = world.getBlockAt(x, y + 5, z);
- blockToChange.setTypeId(17);
- blockToChange = world.getBlockAt(x, y + 6, z);
- blockToChange.setTypeId(17);
- blockToChange = world.getBlockAt(x, y + 7, z);
- blockToChange.setTypeId(17);
- y = Settings.island_height + 8;
- for (int x_operate = x - 2; x_operate <= x + 2; x_operate++) {
- for (int z_operate = z - 2; z_operate <= z + 2; z_operate++)
- {
- blockToChange = world.getBlockAt(x_operate, y, z_operate);
- blockToChange.setTypeId(18);
- }
- }
- blockToChange = world.getBlockAt(x + 2, y, z + 2);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x + 2, y, z - 2);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x - 2, y, z + 2);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x - 2, y, z - 2);
- blockToChange.setTypeId(0);
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(17);
- y = Settings.island_height + 9;
- for (int x_operate = x - 1; x_operate <= x + 1; x_operate++) {
- for (int z_operate = z - 1; z_operate <= z + 1; z_operate++)
- {
- blockToChange = world.getBlockAt(x_operate, y, z_operate);
- blockToChange.setTypeId(18);
- }
- }
- blockToChange = world.getBlockAt(x - 2, y, z);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x + 2, y, z);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x, y, z - 2);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x, y, z + 2);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(17);
- y = Settings.island_height + 10;
- blockToChange = world.getBlockAt(x - 1, y, z);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x + 1, y, z);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x, y, z - 1);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x, y, z + 1);
- blockToChange.setTypeId(18);
- blockToChange = world.getBlockAt(x, y, z);
- blockToChange.setTypeId(17);
- blockToChange = world.getBlockAt(x, y + 1, z);
- blockToChange.setTypeId(18);
-
- blockToChange = world.getBlockAt(x, Settings.island_height + 5, z + 1);
- blockToChange.setTypeId(54);
- Chest chest = (Chest)blockToChange.getState();
- Inventory inventory = chest.getInventory();
- inventory.clear();
- inventory.setContents(Settings.island_chestItems);
- if (Settings.island_addExtraItems) {
- for (int i = 0; i < Settings.island_extraPermissions.length; i++) {
- if (VaultHandler.checkPerk(player.getName(), "usb." + Settings.island_extraPermissions[i], player.getWorld()))
- {
- String[] chestItemString = getInstance().getConfig().getString("options.island.extraPermissions." + Settings.island_extraPermissions[i]).split(" ");
- ItemStack[] tempChest = new ItemStack[chestItemString.length];
- String[] amountdata = new String[2];
- for (int j = 0; j < chestItemString.length; j++)
- {
- amountdata = chestItemString[j].split(":");
- tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
- inventory.addItem(new ItemStack[] { tempChest[j] });
- }
- }
- }
- }
- }
-
- public void setChest(Location loc, Player player)
- {
- for (int x = -15; x <= 15; x++) {
- for (int y = -15; y <= 15; y++) {
- for (int z = -15; z <= 15; z++) {
- if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 54)
- {
- Block blockToChange = getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
- Chest chest = (Chest)blockToChange.getState();
- Inventory inventory = chest.getInventory();
- inventory.clear();
- inventory.setContents(Settings.island_chestItems);
- if (Settings.island_addExtraItems) {
- for (int i = 0; i < Settings.island_extraPermissions.length; i++) {
- if (VaultHandler.checkPerk(player.getName(), "usb." + Settings.island_extraPermissions[i], player.getWorld()))
- {
- String[] chestItemString = getInstance().getConfig().getString("options.island.extraPermissions." + Settings.island_extraPermissions[i]).split(" ");
- ItemStack[] tempChest = new ItemStack[chestItemString.length];
- String[] amountdata = new String[2];
- for (int j = 0; j < chestItemString.length; j++)
- {
- amountdata = chestItemString[j].split(":");
- tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
- inventory.addItem(new ItemStack[] { tempChest[j] });
- }
- }
- }
- }
- }
- }
- }
- }
- }
-
- public Location getChestSpawnLoc(Location loc, Player player)
- {
- for (int x = -15; x <= 15; x++) {
- for (int y = -15; y <= 15; y++) {
- for (int z = -15; z <= 15; z++) {
- if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 54)
- {
- if ((getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + (z + 1)).getTypeId() == 0) &&
- (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + (y - 1), loc.getBlockZ() + (z + 1)).getTypeId() != 0)) {
- return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
- }
- if ((getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + (z - 1)).getTypeId() == 0) &&
- (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + (y - 1), loc.getBlockZ() + (z - 1)).getTypeId() != 0)) {
- return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
- }
- if ((getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x + 1), loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 0) &&
- (getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x + 1), loc.getBlockY() + (y - 1), loc.getBlockZ() + z).getTypeId() != 0)) {
- return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
- }
- if ((getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x - 1), loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 0) &&
- (getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x - 1), loc.getBlockY() + (y - 1), loc.getBlockZ() + z).getTypeId() != 0)) {
- return new Location(getSkyBlockWorld(), loc.getBlockX() + x, loc.getBlockY() + (y + 1), loc.getBlockZ() + (z + 1));
- }
- loc.setY(loc.getY() + 1.0D);
- return loc;
- }
- }
- }
- }
- return loc;
- }
-
- private void setNewPlayerIsland(Player player, Location loc)
- {
- ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).startNewIsland(loc);
- player.teleport(getChestSpawnLoc(loc, player));
- if (getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()) == null) {
- createIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty(), player.getName());
- }
- clearIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty(), player.getName());
- getInstance().updatePartyNumber(player);
- getInstance().homeSet(player);
- ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).savePlayerConfig(player.getName());
- }
-
- public void setWarpLocation(String location, Location loc)
- {
- getIslandConfig(location).set("general.warpLocationX", Integer.valueOf(loc.getBlockX()));
- getIslandConfig(location).set("general.warpLocationY", Integer.valueOf(loc.getBlockY()));
- getIslandConfig(location).set("general.warpLocationZ", Integer.valueOf(loc.getBlockZ()));
- getIslandConfig(location).set("general.warpActive", Boolean.valueOf(true));
- saveIslandConfig(location);
- }
-
- public void buildIslandList()
- {
- File folder = getInstance().directoryPlayers;
- File[] listOfFiles = folder.listFiles();
-
- System.out.print(ChatColor.YELLOW + "[uSkyBlock] Building a new island list...");
- for (int i = 0; i < listOfFiles.length; i++)
- {
- PlayerInfo pi = new PlayerInfo(listOfFiles[i].getName());
- if (pi.getHasIsland())
- {
- System.out.print("Creating new island file for " + pi.getPlayerName());
- createIslandConfig(pi.locationForParty(), pi.getPlayerName());
- saveIslandConfig(pi.locationForParty());
- }
- }
- for (int i = 0; i < listOfFiles.length; i++)
- {
- PlayerInfo pi = new PlayerInfo(listOfFiles[i].getName());
- if (!pi.getHasIsland()) {
- if (pi.getPartyIslandLocation() != null) {
- if (getTempIslandConfig(pi.locationForPartyOld()) != null) {
- if (!getTempIslandConfig(pi.locationForPartyOld()).contains("party.members." + pi.getPlayerName()))
- {
- setupPartyMember(pi.locationForPartyOld(), pi.getPlayerName());
- saveIslandConfig(pi.locationForParty());
- }
- }
- }
- }
- }
- System.out.print(ChatColor.YELLOW + "[uSkyBlock] Party list completed.");
- }
-
- public void removeIslandConfig(String location)
- {
- this.islands.remove(location);
- }
-
- public void displayIslandConfigs()
- {
- Iterator islandList = this.islands.keySet().iterator();
- while (islandList.hasNext()) {
- System.out.print((String)islandList.next());
- }
- }
-
- public void updatePartyNumber(Player player)
- {
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 8) {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.partysize", player.getWorld()))
- {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(8));
- getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
- return;
- }
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 7) {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.party3", player.getWorld()))
- {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(7));
- getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
- return;
- }
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 6) {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.party2", player.getWorld()))
- {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(6));
- getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
- return;
- }
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize") < 5) {
- if (VaultHandler.checkPerk(player.getName(), "usb.extra.party1", player.getWorld()))
- {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.maxSize", Integer.valueOf(5));
- getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
- return;
- }
- }
- }
-
- public void changePlayerPermission(Player player, String playername, String perm)
- {
- if (!getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).contains("party.members." + playername + "." + perm)) {
- return;
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + playername + "." + perm)) {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.members." + playername + "." + perm, Boolean.valueOf(false));
- } else {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).set("party.members." + playername + "." + perm, Boolean.valueOf(true));
- }
- getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty());
- }
-
- public boolean checkForOnlineMembers(Player p)
- {
- Iterator temp = getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty()).getConfigurationSection("party.members").getKeys(false).iterator();
- while (temp.hasNext())
- {
- String tString = (String)temp.next();
- if ((Bukkit.getPlayer(tString) != null) && (!Bukkit.getPlayer(tString).getName().equalsIgnoreCase(p.getName()))) {
- return true;
- }
- }
- return false;
- }
-
- public boolean checkCurrentBiome(Player p, String biome)
- {
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty()).getString("general.biome").equalsIgnoreCase(biome)) {
- return true;
- }
- return false;
- }
-
- public void setConfigBiome(Player p, String biome)
- {
- getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty()).set("general.biome", biome);
- getInstance().saveIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(p.getName())).locationForParty());
- }
-
- public Inventory displayPartyPlayerGUI(Player player, String pname)
- {
- this.GUIpartyPlayer = Bukkit.createInventory(null, 9, pname + " ");
- ItemStack pHead = new ItemStack(397, 1, (short)3);
- SkullMeta meta3 = (SkullMeta)pHead.getItemMeta();
- ItemMeta meta4 = this.sign.getItemMeta();
- meta4.setDisplayName("§hPlayer Permissions");
- this.lores.add("§eClick here to return to");
- this.lores.add("§eyour island group's info.");
- meta4.setLore(this.lores);
- this.sign.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.sign });
- this.lores.clear();
- meta3.setDisplayName(pname + "'s Permissions");
- this.lores.add("§eHover over an icon to view");
- this.lores.add("§ea permission. Change the");
- this.lores.add("§epermission by clicking it.");
- meta3.setLore(this.lores);
- pHead.setItemMeta(meta3);
- this.GUIpartyPlayer.addItem(new ItemStack[] { pHead });
- this.lores.clear();
-
- meta4 = this.biome.getItemMeta();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + pname + ".canChangeBiome"))
- {
- meta4.setDisplayName("§aChange Biome");
- this.lores.add("§fThis player §acan§f change the");
- this.lores.add("§fisland's biome. Click here");
- this.lores.add("§fto remove this permission.");
- }
- else
- {
- meta4.setDisplayName("§cChange Biome");
- this.lores.add("§fThis player §ccannot§f change the");
- this.lores.add("§fisland's biome. Click here");
- this.lores.add("§fto grant this permission.");
- }
- meta4.setLore(this.lores);
- this.biome.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.biome });
- this.lores.clear();
-
- meta4 = this.lock.getItemMeta();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + pname + ".canToggleLock"))
- {
- meta4.setDisplayName("§aToggle Island Lock");
- this.lores.add("§fThis player §acan§f toggle the");
- this.lores.add("§fisland's lock, which prevents");
- this.lores.add("§fnon-group members from entering.");
- this.lores.add("§fClick here to remove this permission.");
- }
- else
- {
- meta4.setDisplayName("§cToggle Island Lock");
- this.lores.add("§fThis player §ccannot§f toggle the");
- this.lores.add("§fisland's lock, which prevents");
- this.lores.add("§fnon-group members from entering.");
- this.lores.add("§fClick here to add this permission");
- }
- meta4.setLore(this.lores);
- this.lock.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.lock });
- this.lores.clear();
-
- meta4 = this.warpset.getItemMeta();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + pname + ".canChangeWarp"))
- {
- meta4.setDisplayName("§aSet Island Warp");
- this.lores.add("§fThis player §acan§f set the");
- this.lores.add("§fisland's warp, which allows");
- this.lores.add("§fnon-group members to teleport");
- this.lores.add("§fto the island. Click here to");
- this.lores.add("§fremove this permission.");
- }
- else
- {
- meta4.setDisplayName("§cSet Island Warp");
- this.lores.add("§fThis player §ccannot§f set the");
- this.lores.add("§fisland's warp, which allows");
- this.lores.add("§fnon-group members to teleport");
- this.lores.add("§fto the island. Click here to");
- this.lores.add("§fadd this permission.");
- }
- meta4.setLore(this.lores);
- this.warpset.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.warpset });
- this.lores.clear();
-
- meta4 = this.warptoggle.getItemMeta();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + pname + ".canToggleWarp"))
- {
- meta4.setDisplayName("§aToggle Island Warp");
- this.lores.add("§fThis player §acan§f toggle the");
- this.lores.add("§fisland's warp, allowing them");
- this.lores.add("§fto turn it on or off at anytime.");
- this.lores.add("§fbut not set the location. Click");
- this.lores.add("§fhere to remove this permission.");
- }
- else
- {
- meta4.setDisplayName("§cToggle Island Warp");
- this.lores.add("§fThis player §ccannot§f toggle the");
- this.lores.add("§fisland's warp, allowing them");
- this.lores.add("§fto turn it on or off at anytime,");
- this.lores.add("§fbut not set the location. Click");
- this.lores.add("§fhere to add this permission.");
- }
- meta4.setLore(this.lores);
- this.warptoggle.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.warptoggle });
- this.lores.clear();
-
- meta4 = this.invite.getItemMeta();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + pname + ".canInviteOthers"))
- {
- meta4.setDisplayName("§aInvite Players");
- this.lores.add("§fThis player §acan§f invite");
- this.lores.add("§fother players to the island if");
- this.lores.add("§fthere is enough room for more");
- this.lores.add("§fmembers. Click here to remove");
- this.lores.add("§fthis permission.");
- }
- else
- {
- meta4.setDisplayName("§cInvite Players");
- this.lores.add("§fThis player §ccannot§f invite");
- this.lores.add("§fother players to the island.");
- this.lores.add("§fClick here to add this permission.");
- }
- meta4.setLore(this.lores);
- this.invite.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.invite });
- this.lores.clear();
-
- meta4 = this.kick.getItemMeta();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + pname + ".canKickOthers"))
- {
- meta4.setDisplayName("§aKick Players");
- this.lores.add("§fThis player §acan§f kick");
- this.lores.add("§fother players from the island,");
- this.lores.add("§fbut they are unable to kick");
- this.lores.add("§fthe island leader. Click here");
- this.lores.add("§fto remove this permission.");
- }
- else
- {
- meta4.setDisplayName("§cKick Players");
- this.lores.add("§fThis player §ccannot§f kick");
- this.lores.add("§fother players from the island.");
- this.lores.add("§fClick here to add this permission.");
- }
- meta4.setLore(this.lores);
- this.kick.setItemMeta(meta4);
- this.GUIpartyPlayer.addItem(new ItemStack[] { this.kick });
- this.lores.clear();
- return this.GUIpartyPlayer;
- }
-
- public Inventory displayPartyGUI(Player player)
- {
- this.GUIparty = Bukkit.createInventory(null, 18, "§9Island Group Members");
-
- Set memberList = getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getConfigurationSection("party.members").getKeys(false);
- this.tempIt = memberList.iterator();
- SkullMeta meta3 = (SkullMeta)this.pHead.getItemMeta();
- ItemMeta meta4 = this.sign.getItemMeta();
- meta4.setDisplayName("§aGroup Info");
- this.lores.add("Group Members: §2" + getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.currentSize") + "§7/§e" + getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize"));
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.currentSize") < getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize")) {
- this.lores.add("§aMore players can be invited to this island.");
- } else {
- this.lores.add("§cThis island is full.");
- }
- this.lores.add("§eHover over a player's icon to");
- this.lores.add("§eview their permissions. The");
- this.lores.add("§eleader can change permissions");
- this.lores.add("§eby clicking a player's icon.");
- meta4.setLore(this.lores);
- this.sign.setItemMeta(meta4);
- this.GUIparty.addItem(new ItemStack[] { this.sign });
- this.lores.clear();
- while (this.tempIt.hasNext())
- {
- String temp = (String)this.tempIt.next();
- if (temp.equalsIgnoreCase(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader")))
- {
- meta3.setDisplayName("§f" + temp);
- this.lores.add("§a§lLeader");
- this.lores.add("§aCan §fchange the island's biome.");
- this.lores.add("§aCan §flock/unlock the island.");
- this.lores.add("§aCan §fset the island's warp.");
- this.lores.add("§aCan §ftoggle the island's warp.");
- this.lores.add("§aCan §finvite others to the island.");
- this.lores.add("§aCan §fkick others from the island.");
- meta3.setLore(this.lores);
- this.lores.clear();
- }
- else
- {
- meta3.setDisplayName("§f" + temp);
- this.lores.add("§e§lMember");
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + temp + ".canChangeBiome")) {
- this.lores.add("§aCan §fchange the island's biome.");
- } else {
- this.lores.add("§cCannot §fchange the island's biome.");
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + temp + ".canToggleLock")) {
- this.lores.add("§aCan §flock/unlock the island.");
- } else {
- this.lores.add("§cCannot §flock/unlock the island.");
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + temp + ".canChangeWarp")) {
- this.lores.add("§aCan §fset the island's warp.");
- } else {
- this.lores.add("§cCannot §fset the island's warp.");
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + temp + ".canToggleWarp")) {
- this.lores.add("§aCan §ftoggle the island's warp.");
- } else {
- this.lores.add("§cCannot §ftoggle the island's warp.");
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + temp + ".canInviteOthers")) {
- this.lores.add("§aCan §finvite others to the island.");
- } else {
- this.lores.add("§cCannot §finvite others to the island.");
- }
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + temp + ".canKickOthers")) {
- this.lores.add("§aCan §fkick others from the island.");
- } else {
- this.lores.add("§cCannot §fkick others from the island.");
- }
- if (player.getName().equalsIgnoreCase(getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader"))) {
- this.lores.add("§e");
- }
- meta3.setLore(this.lores);
- this.lores.clear();
- }
- meta3.setOwner(temp);
- this.pHead.setItemMeta(meta3);
- this.GUIparty.addItem(new ItemStack[] { this.pHead });
- }
- return this.GUIparty;
- }
-
- public Inventory displayLogGUI(Player player)
- {
- this.GUIlog = Bukkit.createInventory(null, 9, "§9Island Log");
- ItemMeta meta4 = this.sign.getItemMeta();
- meta4.setDisplayName("§lIsland Log");
- this.lores.add("§eClick here to return to");
- this.lores.add("§ethe main island screen.");
- meta4.setLore(this.lores);
- this.sign.setItemMeta(meta4);
- this.GUIlog.addItem(new ItemStack[] { this.sign });
- this.lores.clear();
- this.currentLogItem = new ItemStack(Material.BOOK_AND_QUILL, 1);
- meta4 = this.currentLogItem.getItemMeta();
- meta4.setDisplayName("§e§lIsland Log");
- for (int i = 1; i <= 10; i++) {
- if (getInstance().getIslandConfig(((PlayerInfo)getActivePlayers().get(player.getName())).locationForParty()).contains("log." + i)) {
- this.lores.add(getInstance().getIslandConfig(((PlayerInfo)getActivePlayers().get(player.getName())).locationForParty()).getString("log." + i));
- }
- }
- meta4.setLore(this.lores);
- this.currentLogItem.setItemMeta(meta4);
- this.GUIlog.setItem(8, this.currentLogItem);
- this.lores.clear();
- return this.GUIlog;
- }
-
- public Inventory displayBiomeGUI(Player player)
- {
- this.GUIbiome = Bukkit.createInventory(null, 18, "§9Island Biome");
-
- ItemMeta meta4 = this.sign.getItemMeta();
- meta4.setDisplayName("§hIsland Biome");
- this.lores.add("§eClick here to return to");
- this.lores.add("§ethe main island screen.");
- meta4.setLore(this.lores);
- this.sign.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.sign });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.WATER, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.ocean", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Ocean");
- this.lores.add("§fThe ocean biome is the basic");
- this.lores.add("§fstarting biome for all islands.");
- this.lores.add("§fpassive mobs like animals will");
- this.lores.add("§fnot spawn. Hostile mobs will");
- this.lores.add("§fspawn normally.");
- if (checkCurrentBiome(player, "OCEAN")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Ocean");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The ocean biome is the basic");
- this.lores.add("§7starting biome for all islands.");
- this.lores.add("§7passive mobs like animals will");
- this.lores.add("§7not spawn. Hostile mobs will");
- this.lores.add("§7spawn normally.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.SAPLING, 1, (short)1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.forst", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Forest");
- this.lores.add("§fThe forest biome will allow");
- this.lores.add("§fyour island to spawn passive.");
- this.lores.add("§fmobs like animals (including");
- this.lores.add("§fwolves). Hostile mobs will");
- this.lores.add("§fspawn normally.");
- if (checkCurrentBiome(player, "FOREST")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Forest");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The forest biome will allow");
- this.lores.add("§7your island to spawn passive.");
- this.lores.add("§7mobs like animals (including");
- this.lores.add("§7wolves). Hostile mobs will");
- this.lores.add("§7spawn normally.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.SAND, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.desert", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Desert");
- this.lores.add("§fThe desert biome makes it so");
- this.lores.add("§fthat there is no rain or snow");
- this.lores.add("§fon your island. Passive mobs");
- this.lores.add("§fwon't spawn. Hostile mobs will");
- this.lores.add("§fspawn normally.");
- if (checkCurrentBiome(player, "DESERT")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Desert");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The desert biome makes it so");
- this.lores.add("§7that there is no rain or snow");
- this.lores.add("§7on your island. Passive mobs");
- this.lores.add("§7won't spawn. Hostile mobs will");
- this.lores.add("§7spawn normally.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.SAPLING, 1, (short)3);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.jungle", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Jungle");
- this.lores.add("§fThe jungle biome is bright");
- this.lores.add("§fand colorful. Passive mobs");
- this.lores.add("§f(including ocelots) will");
- this.lores.add("§fspawn. Hostile mobs will");
- this.lores.add("§fspawn normally.");
- if (checkCurrentBiome(player, "JUNGLE")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Jungle");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The jungle biome is bright");
- this.lores.add("§7and colorful. Passive mobs");
- this.lores.add("§7(including ocelots) will");
- this.lores.add("§7spawn. Hostile mobs will");
- this.lores.add("§7spawn normally.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.WATER_LILY, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.swampland", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Swampland");
- this.lores.add("§fThe swamp biome is dark");
- this.lores.add("§fand dull. Passive mobs");
- this.lores.add("§fwill spawn normally and");
- this.lores.add("§fslimes have a small chance");
- this.lores.add("§fto spawn at night depending");
- this.lores.add("§fon the moon phase.");
- if (checkCurrentBiome(player, "SWAMPLAND")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Swampland");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The swamp biome is dark");
- this.lores.add("§7and dull. Passive mobs");
- this.lores.add("§7will spawn normally and");
- this.lores.add("§7slimes have a small chance");
- this.lores.add("§7to spawn at night depending");
- this.lores.add("§7on the moon phase.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.SNOW, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.taiga", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Taiga");
- this.lores.add("§fThe taiga biome has snow");
- this.lores.add("§finstead of rain. Passive");
- this.lores.add("§fmobs will spawn normally");
- this.lores.add("§f(including wolves) and");
- this.lores.add("§fhostile mobs will spawn.");
- if (checkCurrentBiome(player, "TAIGA")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Taiga");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The taiga biome has snow");
- this.lores.add("§7instead of rain. Passive");
- this.lores.add("§7mobs will spawn normally");
- this.lores.add("§7(including wolves) and");
- this.lores.add("§7hostile mobs will spawn.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.RED_MUSHROOM, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.mushroom", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Mushroom");
- this.lores.add("§fThe mushroom biome is");
- this.lores.add("§fbright and colorful.");
- this.lores.add("§fMooshrooms are the only");
- this.lores.add("§fmobs that will spawn.");
- this.lores.add("§fNo other passive or");
- this.lores.add("§fhostile mobs will spawn.");
- if (checkCurrentBiome(player, "MUSHROOM")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Mushroom");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The mushroom biome is");
- this.lores.add("§7bright and colorful.");
- this.lores.add("§7Mooshrooms are the only");
- this.lores.add("§7mobs that will spawn.");
- this.lores.add("§7No other passive or");
- this.lores.add("§7hostile mobs will spawn.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.FIRE, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.hell", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Hell(Nether)");
- this.lores.add("§fThe hell biome looks");
- this.lores.add("§fdark and dead. Some");
- this.lores.add("§fmobs from the nether will");
- this.lores.add("§fspawn in this biome");
- this.lores.add("§f(excluding ghasts and");
- this.lores.add("§fblazes).");
- if (checkCurrentBiome(player, "HELL")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Hell(Nether)");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The hell biome looks");
- this.lores.add("§7dark and dead. Some");
- this.lores.add("§7mobs from the nether will");
- this.lores.add("§7spawn in this biome");
- this.lores.add("§7(excluding ghasts and");
- this.lores.add("§7blazes).");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
-
- this.currentBiomeItem = new ItemStack(Material.EYE_OF_ENDER, 1);
- meta4 = this.currentBiomeItem.getItemMeta();
- if (VaultHandler.checkPerk(player.getName(), "usb.biome.sky", player.getWorld()))
- {
- meta4.setDisplayName("§aBiome: Sky(End)");
- this.lores.add("§fThe sky biome gives your");
- this.lores.add("§fisland a special dark sky.");
- this.lores.add("§fOnly endermen will spawn");
- this.lores.add("§fin this biome.");
- if (checkCurrentBiome(player, "SKY")) {
- this.lores.add("§2§lThis is your current biome.");
- } else {
- this.lores.add("§e§lClick to change to this biome.");
- }
- }
- else
- {
- meta4.setDisplayName("§8Biome: Sky(End)");
- this.lores.add("§cYou cannot use this biome.");
- this.lores.add("§7The sky biome gives your");
- this.lores.add("§7island a special dark sky.");
- this.lores.add("§7Only endermen will spawn");
- this.lores.add("§7in this biome.");
- }
- meta4.setLore(this.lores);
- this.currentBiomeItem.setItemMeta(meta4);
- this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
- this.lores.clear();
- return this.GUIbiome;
- }
-
- public Inventory displayChallengeGUI(Player player)
- {
- this.GUIchallenge = Bukkit.createInventory(null, 36, "§9Challenge Menu");
- PlayerInfo pi = (PlayerInfo)getInstance().getActivePlayers().get(player.getName());
- populateChallengeRank(player, 0, Material.DIRT, 0, pi);
- populateChallengeRank(player, 1, Material.IRON_BLOCK, 9, pi);
- populateChallengeRank(player, 2, Material.GOLD_BLOCK, 18, pi);
- populateChallengeRank(player, 3, Material.DIAMOND_BLOCK, 27, pi);
- return this.GUIchallenge;
- }
-
- public Inventory displayIslandGUI(Player player)
- {
- this.GUIisland = Bukkit.createInventory(null, 18, "§9Island Menu");
- if (hasIsland(player.getName()))
- {
- this.currentIslandItem = new ItemStack(Material.ENDER_PORTAL, 1);
- ItemMeta meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lReturn Home");
- this.lores.add("§fReturn to your island's home");
- this.lores.add("§fpoint. You can change your home");
- this.lores.add("§fpoint to any location on your");
- this.lores.add("§fisland using §b/island sethome");
- this.lores.add("§e§lClick here to return home.");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.DIAMOND_ORE, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lChallenges");
- this.lores.add("§fView a list of challenges that");
- this.lores.add("§fyou can complete on your island");
- this.lores.add("§fto earn skybucks, items, perks,");
- this.lores.add("§fand titles.");
- this.lores.add("§e§lClick here to view challenges.");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.EXP_BOTTLE, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lIsland Level");
- this.lores.add("§eCurrent Level: §a" + showIslandLevel(player));
- this.lores.add("§fGain island levels by expanding");
- this.lores.add("§fyour skyblock and completing");
- this.lores.add("§fcertain challenges. Rarer blocks");
- this.lores.add("§fwill add more to your level.");
- this.lores.add("§e§lClick here to refresh.");
- this.lores.add("§e§l(must be on island)");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
- SkullMeta meta3 = (SkullMeta)this.currentIslandItem.getItemMeta();
- meta3.setDisplayName("§a§lIsland Group");
- this.lores.add("§eMembers: §2" + showCurrentMembers(player) + "/" + showMaxMembers(player));
- this.lores.add("§fView the members of your island");
- this.lores.add("§fgroup and their permissions. If");
- this.lores.add("§fyou are the island leader, you");
- this.lores.add("§fcan change the member permissions.");
- this.lores.add("§e§lClick here to view or change.");
- meta3.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta3);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.SAPLING, 1, (short)3);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lChange Island Biome");
- this.lores.add("§eCurrent Biome: §b" + getCurrentBiome(player).toUpperCase());
- this.lores.add("§fThe island biome affects things");
- this.lores.add("§flike grass color and spawning");
- this.lores.add("§fof both animals and monsters.");
- if (checkIslandPermission(player, "canChangeBiome")) {
- this.lores.add("§e§lClick here to change biomes.");
- } else {
- this.lores.add("§c§lYou can't change the biome.");
- }
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.IRON_FENCE, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lIsland Lock");
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("general.locked"))
- {
- this.lores.add("§eLock Status: §aActive");
- this.lores.add("§fYour island is currently §clocked.");
- this.lores.add("§fPlayers outside of your group");
- this.lores.add("§fare unable to enter your island.");
- if (checkIslandPermission(player, "canToggleLock")) {
- this.lores.add("§e§lClick here to unlock your island.");
- } else {
- this.lores.add("§c§lYou can't change the lock.");
- }
- }
- else
- {
- this.lores.add("§eLock Status: §8Inactive");
- this.lores.add("§fYour island is currently §aunlocked.");
- this.lores.add("§fAll players are able to enter your");
- this.lores.add("§fisland, but only you and your group");
- this.lores.add("§fmembers may build there.");
- if (checkIslandPermission(player, "canToggleLock")) {
- this.lores.add("§e§lClick here to lock your island.");
- } else {
- this.lores.add("§c§lYou can't change the lock.");
- }
- }
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("general.warpActive"))
- {
- this.currentIslandItem = new ItemStack(Material.PORTAL, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lIsland Warp");
- this.lores.add("§eWarp Status: §aActive");
- this.lores.add("§fOther players may warp to your");
- this.lores.add("§fisland at anytime to the point");
- this.lores.add("§fyou set using §d/island setwarp.");
- if ((checkIslandPermission(player, "canToggleWarp")) && (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", getSkyBlockWorld()))) {
- this.lores.add("§e§lClick here to deactivate.");
- } else {
- this.lores.add("§c§lYou can't change the warp.");
- }
- }
- else
- {
- this.currentIslandItem = new ItemStack(Material.ENDER_STONE, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lIsland Warp");
- this.lores.add("§eWarp Status: §8Inactive");
- this.lores.add("§fOther players can't warp to your");
- this.lores.add("§fisland. Set a warp point using");
- this.lores.add("§d/island setwarp §fbefore activating.");
- if ((checkIslandPermission(player, "canToggleWarp")) && (VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", getSkyBlockWorld()))) {
- this.lores.add("§e§lClick here to activate.");
- } else {
- this.lores.add("§c§lYou can't change the warp.");
- }
- }
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.CHEST, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lBuy Perks");
- this.lores.add("§fVisit the perk shop to buy");
- this.lores.add("§fspecial abilities for your");
- this.lores.add("§fisland and character, as well");
- this.lores.add("§fas titles and more.");
- this.lores.add("§e§lClick here to open the shop!");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.ENDER_CHEST, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lBuy Donor Perks");
- this.lores.add("§fThis special perk shop is");
- this.lores.add("§fonly available to donors!");
- if (VaultHandler.checkPerk(player.getName(), "group.donor", player.getWorld())) {
- this.lores.add("§e§lClick here to open the shop!");
- } else {
- this.lores.add("§a§lClick here to become a donor!");
- }
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.setItem(16, this.currentIslandItem);
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.BOOK_AND_QUILL, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lIsland Log");
- this.lores.add("§fView a log of events from");
- this.lores.add("§fyour island such as member,");
- this.lores.add("§fbiome, and warp changes.");
- this.lores.add("§e§lClick to view the log.");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.BED, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lChange Home Location");
- this.lores.add("§fWhen you teleport to your");
- this.lores.add("§fisland you will be taken to");
- this.lores.add("§fthis location.");
- this.lores.add("§e§lClick here to change.");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.HOPPER, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lChange Warp Location");
- this.lores.add("§fWhen your warp is activated,");
- this.lores.add("§fother players will be taken to");
- this.lores.add("§fthis point when they teleport");
- this.lores.add("§fto your island.");
- this.lores.add("§e§lClick here to change.");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.setItem(15, this.currentIslandItem);
- this.lores.clear();
- }
- else if (VaultHandler.checkPerk(player.getName(), "group.member", getSkyBlockWorld()))
- {
- this.currentIslandItem = new ItemStack(Material.GRASS, 1);
- ItemMeta meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lStart an Island");
- this.lores.add("§fStart your skyblock journey");
- this.lores.add("§fby starting your own island.");
- this.lores.add("§fComplete challenges to earn");
- this.lores.add("§fitems and skybucks to help");
- this.lores.add("§fexpand your skyblock. You can");
- this.lores.add("§finvite others to join in");
- this.lores.add("§fbuilding your island empire!");
- this.lores.add("§e§lClick here to start!");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
- SkullMeta meta3 = (SkullMeta)this.currentIslandItem.getItemMeta();
- meta3.setDisplayName("§a§lJoin an Island");
- this.lores.add("§fWant to join another player's");
- this.lores.add("§fisland instead of starting");
- this.lores.add("§fyour own? If another player");
- this.lores.add("§finvites you to their island");
- this.lores.add("§fyou can click here or use");
- this.lores.add("§e/island accept §fto join them.");
- this.lores.add("§e§lClick here to accept an invite!");
- this.lores.add("§e§l(You must be invited first)");
- meta3.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta3);
- this.GUIisland.setItem(4, this.currentIslandItem);
- this.lores.clear();
-
- this.currentIslandItem = new ItemStack(Material.SIGN, 1);
- meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lIsland Help");
- this.lores.add("§fNeed help with skyblock");
- this.lores.add("§fconcepts or commands? View");
- this.lores.add("§fdetails about them here.");
- this.lores.add("§e§lClick here for help!");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.setItem(8, this.currentIslandItem);
- this.lores.clear();
- }
- else
- {
- this.currentIslandItem = new ItemStack(Material.BOOK, 1);
- ItemMeta meta4 = this.currentIslandItem.getItemMeta();
- meta4.setDisplayName("§a§lWelcome to the Server!");
- this.lores.add("§fPlease read and accept the");
- this.lores.add("§fserver rules to become a");
- this.lores.add("§fmember and start your skyblock.");
- this.lores.add("§e§lClick here to read!");
- meta4.setLore(this.lores);
- this.currentIslandItem.setItemMeta(meta4);
- this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
- this.lores.clear();
- }
- return this.GUIisland;
- }
-
- public boolean isPartyLeader(Player player)
- {
- if (getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("party.leader").equalsIgnoreCase(player.getName())) {
- return true;
- }
- return false;
- }
-
- public boolean checkIslandPermission(Player player, String permission)
- {
- return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getBoolean("party.members." + player.getName() + "." + permission);
- }
-
- public String getCurrentBiome(Player player)
- {
- return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getString("general.biome");
- }
-
- public int showIslandLevel(Player player)
- {
- return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("general.level");
- }
-
- public int showCurrentMembers(Player player)
- {
- return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.currentSize");
- }
-
- public int showMaxMembers(Player player)
- {
- return getInstance().getIslandConfig(((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).locationForParty()).getInt("party.maxSize");
- }
-
- public void populateChallengeRank(Player player, int rankIndex, Material mat, int location, PlayerInfo pi)
- {
- int rankComplete = 0;
- this.currentChallengeItem = new ItemStack(mat, 1);
- ItemMeta meta4 = this.currentChallengeItem.getItemMeta();
- meta4.setDisplayName("§e§lRank: " + Settings.challenges_ranks[rankIndex]);
- this.lores.add("§fComplete most challenges in");
- this.lores.add("§fthis rank to unlock the next rank.");
- meta4.setLore(this.lores);
- this.currentChallengeItem.setItemMeta(meta4);
- this.GUIchallenge.setItem(location, this.currentChallengeItem);
- this.lores.clear();
- String[] challengeList = getChallengesFromRank(player, Settings.challenges_ranks[rankIndex]).split(" - ");
- for (int i = 0; i < challengeList.length; i++)
- {
- if (rankIndex > 0)
- {
- rankComplete = getInstance().checkRankCompletion(player, Settings.challenges_ranks[(rankIndex - 1)]);
- if (rankComplete > 0)
- {
- this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)14);
- meta4 = this.currentChallengeItem.getItemMeta();
- meta4.setDisplayName("§4§lLocked Challenge");
- this.lores.add("§7Complete " + rankComplete + " more " + Settings.challenges_ranks[(rankIndex - 1)] + " challenges");
- this.lores.add("§7to unlock this rank.");
- meta4.setLore(this.lores);
- this.currentChallengeItem.setItemMeta(meta4);
- this.GUIchallenge.setItem(++location, this.currentChallengeItem);
- this.lores.clear();
- continue;
- }
- }
- if (challengeList[i].charAt(1) == 'e')
- {
- this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)4);
- meta4 = this.currentChallengeItem.getItemMeta();
- meta4.setDisplayName(challengeList[i].replace("§e", "§e§l"));
- challengeList[i] = challengeList[i].replace("§e", "");
- challengeList[i] = challengeList[i].replace("§8", "");
- }
- else if (challengeList[i].charAt(1) == 'a')
- {
- if (!getInstance().getConfig().contains("options.challenges.challengeList." + challengeList[i].replace("§a", "").replace("§2", "").replace("§e", "").replace("§8", "").toLowerCase() + ".displayItem")) {
- this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)5);
- } else {
- this.currentChallengeItem = new ItemStack(Material.getMaterial(getInstance().getConfig().getInt("options.challenges.challengeList." + challengeList[i].replace("§a", "").replace("§2", "").replace("§e", "").replace("§8", "").toLowerCase() + ".displayItem")), 1);
- }
- meta4 = this.currentChallengeItem.getItemMeta();
- meta4.setDisplayName(challengeList[i].replace("§a", "§a§l"));
- challengeList[i] = challengeList[i].replace("§a", "");
- challengeList[i] = challengeList[i].replace("§8", "");
- }
- else if (challengeList[i].charAt(1) == '2')
- {
- this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)13);
- meta4 = this.currentChallengeItem.getItemMeta();
- meta4.setDisplayName(challengeList[i].replace("§2", "§2§l"));
- challengeList[i] = challengeList[i].replace("§2", "");
- challengeList[i] = challengeList[i].replace("§8", "");
- }
- else
- {
- this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)4);
- meta4 = this.currentChallengeItem.getItemMeta();
- meta4.setDisplayName(challengeList[i].replace("§e", "§e§l"));
- challengeList[i] = challengeList[i].replace("§e", "");
- challengeList[i] = challengeList[i].replace("§8", "");
- }
- this.lores.add("§7" + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".description").toString()));
- this.lores.add("§eThis challenge requires the following:");
- String[] reqList = getConfig().getString("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".requiredItems").split(" ");
-
-
- int reqItem = 0;
- int reqAmount = 0;
- int reqMod = -1;
- for (String s : reqList)
- {
- String[] sPart = s.split(":");
- if (sPart.length == 2)
- {
- reqItem = Integer.parseInt(sPart[0]);
- String[] sScale = sPart[1].split(";");
- if (sScale.length == 1) {
- reqAmount = Integer.parseInt(sPart[1]);
- } else if (sScale.length == 2) {
- if (sScale[1].charAt(0) == '+') {
- reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
- } else if (sScale[1].charAt(0) == '*') {
- reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
- } else if (sScale[1].charAt(0) == '-') {
- reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
- } else if (sScale[1].charAt(0) == '/') {
- reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
- }
- }
- }
- else if (sPart.length == 3)
- {
- reqItem = Integer.parseInt(sPart[0]);
- String[] sScale = sPart[2].split(";");
- if (sScale.length == 1) {
- reqAmount = Integer.parseInt(sPart[2]);
- } else if (sScale.length == 2) {
- if (sScale[1].charAt(0) == '+') {
- reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
- } else if (sScale[1].charAt(0) == '*') {
- reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
- } else if (sScale[1].charAt(0) == '-') {
- reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase());
- } else if (sScale[1].charAt(0) == '/') {
- reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * ((PlayerInfo)getInstance().getActivePlayers().get(player.getName())).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
- }
- }
- reqMod = Integer.parseInt(sPart[1]);
- }
- ItemStack newItem = new ItemStack(reqItem, reqAmount, (short)reqMod);
- this.lores.add("§f" + newItem.getAmount() + " " + newItem.getType().toString());
- }
- if ((pi.checkChallenge(challengeList[i].toLowerCase()) > 0) && (getInstance().getConfig().getBoolean("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatable")))
- {
- if (pi.onChallengeCooldown(challengeList[i].toLowerCase())) {
- if (pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 86400000L >= 1L)
- {
- int days = (int)pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 86400000;
- this.lores.add("§4Requirements will reset in " + days + " days.");
- }
- else
- {
- int hours = (int)pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 3600000;
- this.lores.add("§4Requirements will reset in " + hours + " hours.");
- }
- }
- this.lores.add("§6Item Reward: §a" + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".repeatRewardText").toString()));
- this.lores.add("§6Currency Reward: §a" + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".repeatCurrencyReward").toString()));
- this.lores.add("§6Exp Reward: §a" + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".repeatXpReward").toString()));
- this.lores.add("§dTotal times completed: §f" + pi.getChallenge(challengeList[i].toLowerCase()).getTimesCompleted());
- this.lores.add("§e§lClick to complete this challenge.");
- }
- else
- {
- this.lores.add("§6Item Reward: §a" + getInstance().getConfig().getString(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".rewardText").toString()));
- this.lores.add("§6Currency Reward: §a" + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".currencyReward").toString()));
- this.lores.add("§6Exp Reward: §a" + getInstance().getConfig().getInt(new StringBuilder("options.challenges.challengeList.").append(challengeList[i].toLowerCase()).append(".xpReward").toString()));
- if (getInstance().getConfig().getBoolean("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatable")) {
- this.lores.add("§e§lClick to complete this challenge.");
- } else {
- this.lores.add("§4§lYou can't repeat this challenge.");
- }
- }
- meta4.setLore(this.lores);
- this.currentChallengeItem.setItemMeta(meta4);
- this.GUIchallenge.setItem(++location, this.currentChallengeItem);
- this.lores.clear();
- }
- }
-
- public void sendMessageToIslandGroup(String location, String message)
- {
- Iterator temp = getInstance().getIslandConfig(location).getConfigurationSection("party.members").getKeys(false).iterator();
-
- this.date = new Date();
- String myDateString = DateFormat.getDateInstance(3).format(this.date).toString();
- String dateTxt = myDateString;
- int currentLogPos = getInstance().getIslandConfig(location).getInt("log.logPos");
- while (temp.hasNext())
- {
- String player = (String)temp.next();
- if (Bukkit.getPlayer(player) != null) {
- Bukkit.getPlayer(player).sendMessage("§d[skyblock] " + message);
- }
- }
- getInstance().getIslandConfig(location).set("log." + ++currentLogPos, "§d[" + dateTxt + "] " + message);
- if (currentLogPos < 10) {
- getInstance().getIslandConfig(location).set("log.logPos", Integer.valueOf(currentLogPos));
- } else {
- getInstance().getIslandConfig(location).set("log.logPos", Integer.valueOf(0));
- }
- }
-}
+package us.talabrek.ultimateskyblock;
+
+import org.bukkit.Location;
+import org.bukkit.plugin.java.*;
+import org.bukkit.event.*;
+import org.bukkit.plugin.*;
+import java.io.*;
+import org.bukkit.generator.*;
+import org.bukkit.command.*;
+import org.bukkit.entity.*;
+import com.sk89q.worldedit.*;
+import com.sk89q.worldedit.data.*;
+import org.bukkit.*;
+import java.util.*;
+import org.bukkit.configuration.file.*;
+import org.bukkit.configuration.*;
+import java.util.logging.*;
+import org.bukkit.block.*;
+import org.bukkit.inventory.*;
+import org.bukkit.inventory.meta.*;
+import java.text.*;
+
+public class uSkyBlock extends JavaPlugin
+{
+ public PluginDescriptionFile pluginFile;
+ public Logger log;
+ Date date;
+ public DecimalFormat df;
+ private FileConfiguration levelConfig;
+ private FileConfiguration lastIslandConfig;
+ private FileConfiguration orphans;
+ private FileConfiguration tempIsland;
+ private FileConfiguration tempPlayer;
+ private HashMap islands;
+ private File levelConfigFile;
+ private File orphanFile;
+ private File lastIslandConfigFile;
+ private File islandConfigFile;
+ private File tempIslandFile;
+ private File tempPlayerFile;
+ public static World skyBlockWorld;
+ private static uSkyBlock instance;
+ public List removeList;
+ List rankDisplay;
+ public FileConfiguration configPlugin;
+ public File filePlugin;
+ private Location lastIsland;
+ private Stack orphaned;
+ private Stack tempOrphaned;
+ private Stack reverseOrphaned;
+ public File directoryPlayers;
+ public File directoryIslands;
+ private File directorySchematics;
+ public File[] schemFile;
+ public String pName;
+ public Location islandTestLocation;
+ LinkedHashMap topTen;
+ HashMap infoCooldown;
+ HashMap restartCooldown;
+ HashMap biomeCooldown;
+ HashMap activePlayers;
+ LinkedHashMap> challenges;
+ HashMap requiredList;
+ public boolean purgeActive;
+ private FileConfiguration skyblockData;
+ private File skyblockDataFile;
+ public Inventory GUIparty;
+ public Inventory GUIpartyPlayer;
+ public Inventory GUIisland;
+ public Inventory GUIchallenge;
+ public Inventory GUIbiome;
+ public Inventory GUIlog;
+ ItemStack pHead;
+ ItemStack sign;
+ ItemStack biome;
+ ItemStack lock;
+ ItemStack warpset;
+ ItemStack warptoggle;
+ ItemStack invite;
+ ItemStack kick;
+ ItemStack currentBiomeItem;
+ ItemStack currentIslandItem;
+ ItemStack currentChallengeItem;
+ ItemStack currentLogItem;
+ List lores;
+ Iterator tempIt;
+ private ArrayList sfiles;
+
+ static {
+ uSkyBlock.skyBlockWorld = null;
+ }
+
+ public uSkyBlock() {
+ super();
+ this.df = new DecimalFormat(".#");
+ this.levelConfig = null;
+ this.lastIslandConfig = null;
+ this.orphans = null;
+ this.tempIsland = null;
+ this.tempPlayer = null;
+ this.islands = new HashMap();
+ this.levelConfigFile = null;
+ this.orphanFile = null;
+ this.lastIslandConfigFile = null;
+ this.islandConfigFile = null;
+ this.tempIslandFile = null;
+ this.tempPlayerFile = null;
+ this.removeList = new ArrayList();
+ this.orphaned = new Stack();
+ this.tempOrphaned = new Stack();
+ this.reverseOrphaned = new Stack();
+ this.islandTestLocation = null;
+ this.infoCooldown = new HashMap();
+ this.restartCooldown = new HashMap();
+ this.biomeCooldown = new HashMap();
+ this.activePlayers = new HashMap();
+ this.challenges = new LinkedHashMap>();
+ this.requiredList = new HashMap();
+ this.purgeActive = false;
+ this.skyblockData = null;
+ this.skyblockDataFile = null;
+ this.GUIparty = null;
+ this.GUIpartyPlayer = null;
+ this.GUIisland = null;
+ this.GUIchallenge = null;
+ this.GUIbiome = null;
+ this.GUIlog = null;
+ this.pHead = new ItemStack(397, 1, (short)3);
+ this.sign = new ItemStack(323, 1);
+ this.biome = new ItemStack(6, 1, (short)3);
+ this.lock = new ItemStack(101, 1);
+ this.warpset = new ItemStack(90, 1);
+ this.warptoggle = new ItemStack(69, 1);
+ this.invite = new ItemStack(398, 1);
+ this.kick = new ItemStack(301, 1);
+ this.currentBiomeItem = null;
+ this.currentIslandItem = null;
+ this.currentChallengeItem = null;
+ this.currentLogItem = null;
+ this.lores = new ArrayList();
+ }
+
+ public void onDisable() {
+ try {
+ this.unloadPlayerFiles();
+ if (this.lastIsland != null) {
+ this.setLastIsland(this.lastIsland);
+ }
+ }
+ catch (Exception e) {
+ System.out.println("Something went wrong saving the island and/or party data!");
+ e.printStackTrace();
+ }
+ this.log.info(String.valueOf(this.pluginFile.getName()) + " v" + this.pluginFile.getVersion() + " disabled.");
+ }
+
+ public void onEnable() {
+ (uSkyBlock.instance = this).saveDefaultConfig();
+ this.saveDefaultLevelConfig();
+ this.saveDefaultOrphans();
+ this.pluginFile = this.getDescription();
+ this.log = this.getLogger();
+ this.pName = ChatColor.WHITE + "[" + ChatColor.GREEN + this.pluginFile.getName() + ChatColor.WHITE + "] ";
+ VaultHandler.setupEconomy();
+ if (!this.getDataFolder().exists()) {
+ this.getDataFolder().mkdir();
+ }
+ this.configPlugin = this.getConfig();
+ this.filePlugin = new File(this.getDataFolder(), "config.yml");
+ this.loadPluginConfig();
+ this.loadLevelConfig();
+ this.registerEvents();
+ this.directoryPlayers = new File(this.getDataFolder() + File.separator + "players");
+ this.directoryIslands = new File(this.getDataFolder() + File.separator + "islands");
+ if (!this.directoryPlayers.exists()) {
+ this.directoryPlayers.mkdir();
+ this.loadPlayerFiles();
+ }
+ else {
+ this.loadPlayerFiles();
+ }
+ if (!this.directoryIslands.exists()) {
+ this.directoryIslands.mkdir();
+ }
+ this.directorySchematics = new File(this.getDataFolder() + File.separator + "schematics");
+ if (!this.directorySchematics.exists()) {
+ this.directorySchematics.mkdir();
+ }
+ this.schemFile = this.directorySchematics.listFiles();
+ if (this.schemFile == null) {
+ System.out.print("[uSkyBlock] No schematic file loaded.");
+ }
+ else {
+ System.out.print("[uSkyBlock] " + this.schemFile.length + " schematics loaded.");
+ }
+ this.getCommand("island").setExecutor((CommandExecutor)new IslandCommand());
+ this.getCommand("challenges").setExecutor((CommandExecutor)new ChallengesCommand());
+ this.getCommand("dev").setExecutor((CommandExecutor)new DevCommand());
+ if (Settings.island_useTopTen) {
+ getInstance().updateTopTen(getInstance().generateTopTen());
+ }
+ this.populateChallengeList();
+ this.log.info(String.valueOf(this.pluginFile.getName()) + " v." + this.pluginFile.getVersion() + " enabled.");
+ getInstance().getServer().getScheduler().runTaskLater((Plugin)getInstance(), (Runnable)new Runnable() {
+ @Override
+ public void run() {
+ if (Bukkit.getServer().getPluginManager().isPluginEnabled("Vault")) {
+ System.out.print("[uSkyBlock] Using vault for permissions");
+ VaultHandler.setupPermissions();
+ try {
+ if (!uSkyBlock.this.getLastIslandConfig().contains("options.general.lastIslandX") && uSkyBlock.this.getConfig().contains("options.general.lastIslandX")) {
+ uSkyBlock.this.getLastIslandConfig();
+ FileConfiguration.createPath(uSkyBlock.this.getLastIslandConfig().getConfigurationSection("options.general"), "lastIslandX");
+ uSkyBlock.this.getLastIslandConfig();
+ FileConfiguration.createPath(uSkyBlock.this.getLastIslandConfig().getConfigurationSection("options.general"), "lastIslandZ");
+ uSkyBlock.this.getLastIslandConfig().set("options.general.lastIslandX", (Object)uSkyBlock.this.getConfig().getInt("options.general.lastIslandX"));
+ uSkyBlock.this.getLastIslandConfig().set("options.general.lastIslandZ", (Object)uSkyBlock.this.getConfig().getInt("options.general.lastIslandZ"));
+ uSkyBlock.this.saveLastIslandConfig();
+ }
+ uSkyBlock.access$0(uSkyBlock.this, new Location(uSkyBlock.getSkyBlockWorld(), (double)uSkyBlock.this.getLastIslandConfig().getInt("options.general.lastIslandX"), (double)Settings.island_height, (double)uSkyBlock.this.getLastIslandConfig().getInt("options.general.lastIslandZ")));
+ }
+ catch (Exception e) {
+ uSkyBlock.access$0(uSkyBlock.this, new Location(uSkyBlock.getSkyBlockWorld(), (double)uSkyBlock.this.getConfig().getInt("options.general.lastIslandX"), (double)Settings.island_height, (double)uSkyBlock.this.getConfig().getInt("options.general.lastIslandZ")));
+ }
+ if (uSkyBlock.this.lastIsland == null) {
+ uSkyBlock.access$0(uSkyBlock.this, new Location(uSkyBlock.getSkyBlockWorld(), 0.0, (double)Settings.island_height, 0.0));
+ }
+ if (Settings.island_protectWithWorldGuard && !Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ final PluginManager manager = uSkyBlock.getInstance().getServer().getPluginManager();
+ System.out.print("[uSkyBlock] WorldGuard not loaded! Using built in protection.");
+ manager.registerEvents((Listener)new ProtectionEvents(), (Plugin)uSkyBlock.getInstance());
+ }
+ uSkyBlock.getInstance().setupOrphans();
+ }
+ }
+ }, 0L);
+ }
+
+ public static uSkyBlock getInstance() {
+ return uSkyBlock.instance;
+ }
+
+ public void loadPlayerFiles() {
+ int onlinePlayerCount = 0;
+ onlinePlayerCount = Bukkit.getServer().getOnlinePlayers().size();
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ if (player.isOnline()) {
+ final File f = new File(getInstance().directoryPlayers, player.getName());
+ final PlayerInfo pi = new PlayerInfo(player.getName());
+ if (f.exists()) {
+ final PlayerInfo pi2 = getInstance().readPlayerFile(player.getName());
+ if (pi2 != null) {
+ pi.setIslandLocation(pi2.getIslandLocation());
+ pi.setHomeLocation(pi2.getHomeLocation());
+ pi.setHasIsland(pi2.getHasIsland());
+ if (getInstance().getIslandConfig(pi.locationForParty()) == null) {
+ getInstance().createIslandConfig(pi.locationForParty(), player.getName());
+ }
+ getInstance().clearIslandConfig(pi.locationForParty(), player.getName());
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ WorldGuardHandler.protectIsland(player, player.getName(), pi);
+ }
+ }
+ f.delete();
+ }
+ getInstance().addActivePlayer(player.getName(), pi);
+ if (pi.getHasIsland() && getInstance().getTempIslandConfig(pi.locationForParty()) == null) {
+ getInstance().createIslandConfig(pi.locationForParty(), player.getName());
+ System.out.println("Creating new Config File");
+ }
+ getInstance().getIslandConfig(pi.locationForParty());
+ }
+ }
+ System.out.print("Island Configs Loaded:");
+ getInstance().displayIslandConfigs();
+ }
+
+
+ // TODO: UUID support
+ public void unloadPlayerFiles() {
+ for (Player player : Bukkit.getServer().getOnlinePlayers()) {
+ if (this.getActivePlayers().containsKey(player.getName())) {
+ this.removeActivePlayer(player.getName());
+ }
+ }
+ }
+
+ public void registerEvents() {
+ final PluginManager manager = this.getServer().getPluginManager();
+ manager.registerEvents((Listener)new PlayerJoin(), (Plugin)this);
+ if (!Settings.island_protectWithWorldGuard) {
+ System.out.print("[uSkyBlock] Using built in protection.");
+ manager.registerEvents((Listener)new ProtectionEvents(), (Plugin)getInstance());
+ }
+ else {
+ System.out.print("[uSkyBlock] Using WorldGuard protection.");
+ }
+ }
+
+ public void loadPluginConfig() {
+ try {
+ this.getConfig();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ Settings.general_maxPartySize = this.getConfig().getInt("options.general.maxPartySize");
+ if (Settings.general_maxPartySize < 0) {
+ Settings.general_maxPartySize = 0;
+ }
+ }
+ catch (Exception e) {
+ Settings.general_maxPartySize = 4;
+ }
+ try {
+ Settings.island_distance = this.getConfig().getInt("options.island.distance");
+ if (Settings.island_distance < 50) {
+ Settings.island_distance = 50;
+ }
+ }
+ catch (Exception e) {
+ Settings.island_distance = 110;
+ }
+ try {
+ Settings.island_protectionRange = this.getConfig().getInt("options.island.protectionRange");
+ if (Settings.island_protectionRange > Settings.island_distance) {
+ Settings.island_protectionRange = Settings.island_distance;
+ }
+ }
+ catch (Exception e) {
+ Settings.island_protectionRange = 100;
+ }
+ try {
+ Settings.general_cooldownInfo = this.getConfig().getInt("options.general.cooldownInfo");
+ if (Settings.general_cooldownInfo < 0) {
+ Settings.general_cooldownInfo = 0;
+ }
+ }
+ catch (Exception e) {
+ Settings.general_cooldownInfo = 60;
+ }
+ try {
+ Settings.general_biomeChange = this.getConfig().getInt("options.general.biomeChange");
+ if (Settings.general_biomeChange < 0) {
+ Settings.general_biomeChange = 0;
+ }
+ }
+ catch (Exception e) {
+ Settings.general_biomeChange = 3600;
+ }
+ try {
+ Settings.general_cooldownRestart = this.getConfig().getInt("options.general.cooldownRestart");
+ if (Settings.general_cooldownRestart < 0) {
+ Settings.general_cooldownRestart = 0;
+ }
+ }
+ catch (Exception e) {
+ Settings.general_cooldownRestart = 60;
+ }
+ try {
+ Settings.island_height = this.getConfig().getInt("options.island.height");
+ if (Settings.island_height < 20) {
+ Settings.island_height = 20;
+ }
+ }
+ catch (Exception e) {
+ Settings.island_height = 120;
+ }
+ try {
+ Settings.challenges_rankLeeway = this.getConfig().getInt("options.challenges.rankLeeway");
+ if (Settings.challenges_rankLeeway < 0) {
+ Settings.challenges_rankLeeway = 0;
+ }
+ }
+ catch (Exception e) {
+ Settings.challenges_rankLeeway = 0;
+ }
+ if (!this.getConfig().contains("options.extras.obsidianToLava")) {
+ this.getConfig().set("options.extras.obsidianToLava", (Object)true);
+ this.saveConfig();
+ }
+ if (!this.getConfig().contains("options.general.spawnSize")) {
+ this.getConfig().set("options.general.spawnSize", (Object)50);
+ this.saveConfig();
+ }
+ try {
+ Settings.general_spawnSize = this.getConfig().getInt("options.general.spawnSize");
+ if (Settings.general_spawnSize < 50) {
+ Settings.general_spawnSize = 50;
+ }
+ }
+ catch (Exception e) {
+ Settings.general_spawnSize = 50;
+ }
+ final String[] chestItemString = this.getConfig().getString("options.island.chestItems").split(" ");
+ final ItemStack[] tempChest = new ItemStack[chestItemString.length];
+ String[] amountdata = new String[2];
+ for (int i = 0; i < tempChest.length; ++i) {
+ amountdata = chestItemString[i].split(":");
+ tempChest[i] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
+ }
+ Settings.island_chestItems = tempChest;
+ Settings.island_allowPvP = this.getConfig().getString("options.island.allowPvP");
+ Settings.island_schematicName = this.getConfig().getString("options.island.schematicName");
+ if (!Settings.island_allowPvP.equalsIgnoreCase("allow")) {
+ Settings.island_allowPvP = "deny";
+ }
+ final Set permissionList = (Set)this.getConfig().getConfigurationSection("options.island.extraPermissions").getKeys(true);
+ Settings.island_addExtraItems = this.getConfig().getBoolean("options.island.addExtraItems");
+ Settings.extras_obsidianToLava = this.getConfig().getBoolean("options.extras.obsidianToLava");
+ Settings.island_useIslandLevel = this.getConfig().getBoolean("options.island.useIslandLevel");
+ Settings.island_extraPermissions = permissionList.toArray(new String[0]);
+ Settings.island_protectWithWorldGuard = this.getConfig().getBoolean("options.island.protectWithWorldGuard");
+ Settings.extras_sendToSpawn = this.getConfig().getBoolean("options.extras.sendToSpawn");
+ Settings.island_useTopTen = this.getConfig().getBoolean("options.island.useTopTen");
+ Settings.general_worldName = this.getConfig().getString("options.general.worldName");
+ Settings.island_removeCreaturesByTeleport = this.getConfig().getBoolean("options.island.removeCreaturesByTeleport");
+ Settings.island_allowIslandLock = this.getConfig().getBoolean("options.island.allowIslandLock");
+ Settings.island_useOldIslands = this.getConfig().getBoolean("options.island.useOldIslands");
+ final Set challengeList = Settings.challenges_challengeList = (Set)this.getConfig().getConfigurationSection("options.challenges.challengeList").getKeys(false);
+ Settings.challenges_broadcastCompletion = this.getConfig().getBoolean("options.challenges.broadcastCompletion");
+ Settings.challenges_broadcastText = this.getConfig().getString("options.challenges.broadcastText");
+ Settings.challenges_challengeColor = this.getConfig().getString("options.challenges.challengeColor");
+ Settings.challenges_enableEconomyPlugin = this.getConfig().getBoolean("options.challenges.enableEconomyPlugin");
+ Settings.challenges_finishedColor = this.getConfig().getString("options.challenges.finishedColor");
+ Settings.challenges_repeatableColor = this.getConfig().getString("options.challenges.repeatableColor");
+ Settings.challenges_requirePreviousRank = this.getConfig().getBoolean("options.challenges.requirePreviousRank");
+ Settings.challenges_allowChallenges = this.getConfig().getBoolean("options.challenges.allowChallenges");
+ final String[] rankListString = Settings.challenges_ranks = this.getConfig().getString("options.challenges.ranks").split(" ");
+ }
+
+ public List readPartyFile() {
+ final File f = new File(this.getDataFolder(), "partylist.bin");
+ if (!f.exists()) {
+ return null;
+ }
+ try {
+ final FileInputStream fileIn = new FileInputStream(f);
+ final ObjectInputStream in = new ObjectInputStream(fileIn);
+ final List p = (List)in.readObject();
+ in.close();
+ fileIn.close();
+ return p;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public void writePartyFile(final List pi) {
+ final File f = new File(this.getDataFolder(), "partylist.bin");
+ try {
+ final FileOutputStream fileOut = new FileOutputStream(f);
+ final ObjectOutputStream out = new ObjectOutputStream(fileOut);
+ out.writeObject(pi);
+ out.flush();
+ out.close();
+ fileOut.close();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public PlayerInfo readPlayerFile(final String playerName) {
+ final File f = new File(this.directoryPlayers, playerName);
+ if (!f.exists()) {
+ return null;
+ }
+ try {
+ final FileInputStream fileIn = new FileInputStream(f);
+ final ObjectInputStream in = new ObjectInputStream(fileIn);
+ final PlayerInfo p = (PlayerInfo)in.readObject();
+ in.close();
+ fileIn.close();
+ return p;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ }
+
+ public boolean displayTopTen(final Player player) {
+ int i = 1;
+ int playerrank = 0;
+ player.sendMessage(ChatColor.YELLOW + "Displaying the top 10 islands:");
+ if (topTen == null) {
+ player.sendMessage(ChatColor.RED + "Top ten list not generated yet!");
+ return false;
+ }
+ for (final String playerName : topTen.keySet()) {
+ if (i <= 10) {
+ player.sendMessage(ChatColor.GREEN + "#" + i + ": " + playerName + " - Island level " + topTen.get(playerName));
+ }
+ if (playerName.equalsIgnoreCase(player.getName())) {
+ playerrank = i;
+ }
+ ++i;
+ }
+ player.sendMessage(ChatColor.YELLOW + "Your rank is: " + ChatColor.WHITE + playerrank);
+ return true;
+ }
+
+ public void updateTopTen(final LinkedHashMap map) {
+ this.topTen = map;
+ }
+
+ public Location getLocationString(final String s) {
+ if (s == null || s.trim() == "") {
+ return null;
+ }
+ final String[] parts = s.split(":");
+ if (parts.length == 4) {
+ final World w = this.getServer().getWorld(parts[0]);
+ final int x = Integer.parseInt(parts[1]);
+ final int y = Integer.parseInt(parts[2]);
+ final int z = Integer.parseInt(parts[3]);
+ return new Location(w, (double)x, (double)y, (double)z);
+ }
+ return null;
+ }
+
+ public String getStringLocation(final Location l) {
+ if (l == null) {
+ return "";
+ }
+ return String.valueOf(l.getWorld().getName()) + ":" + l.getBlockX() + ":" + l.getBlockY() + ":" + l.getBlockZ();
+ }
+
+ public void setStringbyPath(final FileConfiguration fc, final File f, final String path, final Object value) {
+ fc.set(path, (Object)value.toString());
+ try {
+ fc.save(f);
+ }
+ catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public String getStringbyPath(final FileConfiguration fc, final File file, final String path, final Object stdValue, final boolean addMissing) {
+ if (!fc.contains(path)) {
+ if (addMissing) {
+ this.setStringbyPath(fc, file, path, stdValue);
+ }
+ return stdValue.toString();
+ }
+ return fc.getString(path);
+ }
+
+ public static World getSkyBlockWorld() {
+ if (uSkyBlock.skyBlockWorld == null) {
+ uSkyBlock.skyBlockWorld = WorldCreator.name(Settings.general_worldName).type(WorldType.FLAT).environment(World.Environment.NORMAL).generator((ChunkGenerator)new SkyBlockChunkGenerator()).createWorld();
+ if (Bukkit.getServer().getPluginManager().isPluginEnabled("Multiverse-Core")) {
+ Bukkit.getServer().dispatchCommand((CommandSender)Bukkit.getConsoleSender(), "mv import " + Settings.general_worldName + " normal -g uSkyBlock");
+ }
+ }
+ return uSkyBlock.skyBlockWorld;
+ }
+
+ public void clearOrphanedIsland() {
+ while (this.hasOrphanedIsland()) {
+ this.orphaned.pop();
+ }
+ }
+
+ public void clearArmorContents(final Player player) {
+ player.getInventory().setArmorContents(new ItemStack[player.getInventory().getArmorContents().length]);
+ }
+
+ public void getAllFiles(final String path) {
+ final File dirpath = new File(path);
+ if (!dirpath.exists()) {
+ return;
+ }
+ File[] listFiles;
+ for (int length = (listFiles = dirpath.listFiles()).length, i = 0; i < length; ++i) {
+ final File f = listFiles[i];
+ try {
+ if (!f.isDirectory()) {
+ this.sfiles.add(f);
+ }
+ else {
+ this.getAllFiles(f.getAbsolutePath());
+ }
+ }
+ catch (Exception ex) {
+ this.log.warning(ex.getMessage());
+ }
+ }
+ }
+
+ public Location getYLocation(final Location l) {
+ for (int y = 0; y < 254; ++y) {
+ final int px = l.getBlockX();
+ final int py = y;
+ final int pz = l.getBlockZ();
+ final Block b1 = new Location(l.getWorld(), (double)px, (double)py, (double)pz).getBlock();
+ final Block b2 = new Location(l.getWorld(), (double)px, (double)(py + 1), (double)pz).getBlock();
+ final Block b3 = new Location(l.getWorld(), (double)px, (double)(py + 2), (double)pz).getBlock();
+ if (!b1.getType().equals((Object)Material.AIR) && b2.getType().equals((Object)Material.AIR) && b3.getType().equals((Object)Material.AIR)) {
+ return b2.getLocation();
+ }
+ }
+ return l;
+ }
+
+ public Location getSafeHomeLocation(final PlayerInfo p) {
+ Location home = null;
+ if (p.getHomeLocation() == null) {
+ if (p.getIslandLocation() != null) {
+ home = p.getIslandLocation();
+ }
+ }
+ else {
+ home = p.getHomeLocation();
+ }
+ if (this.isSafeLocation(home)) {
+ return home;
+ }
+ for (int y = home.getBlockY() + 25; y > 0; --y) {
+ final Location n = new Location(home.getWorld(), (double)home.getBlockX(), (double)y, (double)home.getBlockZ());
+ if (this.isSafeLocation(n)) {
+ return n;
+ }
+ }
+ for (int y = home.getBlockY(); y < 255; ++y) {
+ final Location n = new Location(home.getWorld(), (double)home.getBlockX(), (double)y, (double)home.getBlockZ());
+ if (this.isSafeLocation(n)) {
+ return n;
+ }
+ }
+ final Location island = p.getIslandLocation();
+ if (this.isSafeLocation(island)) {
+ return island;
+ }
+ for (int y2 = island.getBlockY() + 25; y2 > 0; --y2) {
+ final Location n2 = new Location(island.getWorld(), (double)island.getBlockX(), (double)y2, (double)island.getBlockZ());
+ if (this.isSafeLocation(n2)) {
+ return n2;
+ }
+ }
+ for (int y2 = island.getBlockY(); y2 < 255; ++y2) {
+ final Location n2 = new Location(island.getWorld(), (double)island.getBlockX(), (double)y2, (double)island.getBlockZ());
+ if (this.isSafeLocation(n2)) {
+ return n2;
+ }
+ }
+ return p.getHomeLocation();
+ }
+
+ public Location getSafeWarpLocation(final PlayerInfo p) {
+ Location warp = null;
+ this.getTempIslandConfig(p.locationForParty());
+ if (this.tempIsland.getInt("general.warpLocationX") == 0) {
+ if (p.getHomeLocation() == null) {
+ if (p.getIslandLocation() != null) {
+ warp = p.getIslandLocation();
+ }
+ }
+ else {
+ warp = p.getHomeLocation();
+ }
+ }
+ else {
+ warp = new Location(uSkyBlock.skyBlockWorld, (double)this.tempIsland.getInt("general.warpLocationX"), (double)this.tempIsland.getInt("general.warpLocationY"), (double)this.tempIsland.getInt("general.warpLocationZ"));
+ }
+ if (warp == null) {
+ System.out.print("Error warping player to " + p.getPlayerName() + "'s island.");
+ return null;
+ }
+ if (this.isSafeLocation(warp)) {
+ return warp;
+ }
+ for (int y = warp.getBlockY() + 25; y > 0; --y) {
+ final Location n = new Location(warp.getWorld(), (double)warp.getBlockX(), (double)y, (double)warp.getBlockZ());
+ if (this.isSafeLocation(n)) {
+ return n;
+ }
+ }
+ for (int y = warp.getBlockY(); y < 255; ++y) {
+ final Location n = new Location(warp.getWorld(), (double)warp.getBlockX(), (double)y, (double)warp.getBlockZ());
+ if (this.isSafeLocation(n)) {
+ return n;
+ }
+ }
+ return null;
+ }
+
+ public boolean isSafeLocation(final Location l) {
+ if (l == null) {
+ return false;
+ }
+ final Block ground = l.getBlock().getRelative(BlockFace.DOWN);
+ final Block air1 = l.getBlock();
+ final Block air2 = l.getBlock().getRelative(BlockFace.UP);
+ return !ground.getType().equals((Object)Material.AIR) && !ground.getType().equals((Object)Material.LAVA) && !ground.getType().equals((Object)Material.STATIONARY_LAVA) && !ground.getType().equals((Object)Material.CACTUS) && ((air1.getType().equals((Object)Material.AIR) || air1.getType().equals((Object)Material.CROPS) || air1.getType().equals((Object)Material.LONG_GRASS) || air1.getType().equals((Object)Material.RED_ROSE) || air1.getType().equals((Object)Material.YELLOW_FLOWER) || air1.getType().equals((Object)Material.DEAD_BUSH) || air1.getType().equals((Object)Material.SIGN_POST) || air1.getType().equals((Object)Material.SIGN)) && air2.getType().equals((Object)Material.AIR));
+ }
+
+ public void removeCreatures(final Location l) {
+ if (!Settings.island_removeCreaturesByTeleport || l == null) {
+ return;
+ }
+ final int px = l.getBlockX();
+ final int py = l.getBlockY();
+ final int pz = l.getBlockZ();
+ for (int x = -1; x <= 1; ++x) {
+ for (int z = -1; z <= 1; ++z) {
+ final Chunk c = l.getWorld().getChunkAt(new Location(l.getWorld(), (double)(px + x * 16), (double)py, (double)(pz + z * 16)));
+ Entity[] entities;
+ for (int length = (entities = c.getEntities()).length, i = 0; i < length; ++i) {
+ final Entity e = entities[i];
+ if (e.getType() == EntityType.SPIDER || e.getType() == EntityType.CREEPER || e.getType() == EntityType.ENDERMAN || e.getType() == EntityType.SKELETON || e.getType() == EntityType.ZOMBIE) {
+ e.remove();
+ }
+ }
+ }
+ }
+ }
+
+ public void deletePlayerIsland(final String player) {
+ if (!this.getActivePlayers().containsKey(player)) {
+ final PlayerInfo pi = new PlayerInfo(player);
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(String.valueOf(player) + "Island");
+ }
+ this.orphaned.push(pi.getIslandLocation());
+ this.removeIsland(pi.getIslandLocation());
+ this.deleteIslandConfig(pi.locationForParty());
+ pi.removeFromIsland();
+ this.saveOrphans();
+ pi.savePlayerConfig(player);
+ }
+ else {
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(String.valueOf(player) + "Island");
+ }
+ this.orphaned.push(this.getActivePlayers().get(player).getIslandLocation());
+ this.removeIsland(this.getActivePlayers().get(player).getIslandLocation());
+ this.deleteIslandConfig(this.getActivePlayers().get(player).locationForParty());
+ final PlayerInfo pi = new PlayerInfo(player);
+ pi.removeFromIsland();
+ this.addActivePlayer(player, pi);
+ this.saveOrphans();
+ }
+ }
+
+ public void restartPlayerIsland(final Player player, final Location next) {
+ boolean hasIslandNow = false;
+ if (next.getBlockX() == 0 && next.getBlockZ() == 0) {
+ return;
+ }
+ this.removeIsland(next);
+ if (getInstance().getSchemFile().length > 0 && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
+ String cSchem = "";
+ for (int i = 0; i < getInstance().getSchemFile().length; ++i) {
+ if (!hasIslandNow) {
+ if (getInstance().getSchemFile()[i].getName().lastIndexOf(46) > 0) {
+ cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf(46));
+ }
+ else {
+ cSchem = getInstance().getSchemFile()[i].getName();
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.schematic." + cSchem, getSkyBlockWorld())) {
+ try {
+ if (WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next)) {
+ this.setChest(next, player);
+ hasIslandNow = true;
+ }
+ }
+ catch (MaxChangedBlocksException e) {
+ e.printStackTrace();
+ }
+ catch (DataException e2) {
+ e2.printStackTrace();
+ }
+ catch (IOException e3) {
+ e3.printStackTrace();
+ }
+ }
+ }
+ }
+ if (!hasIslandNow) {
+ for (int i = 0; i < getInstance().getSchemFile().length; ++i) {
+ if (getInstance().getSchemFile()[i].getName().lastIndexOf(46) > 0) {
+ cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf(46));
+ }
+ else {
+ cSchem = getInstance().getSchemFile()[i].getName();
+ }
+ if (cSchem.equalsIgnoreCase(Settings.island_schematicName)) {
+ try {
+ if (WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next)) {
+ this.setChest(next, player);
+ hasIslandNow = true;
+ }
+ }
+ catch (MaxChangedBlocksException e) {
+ e.printStackTrace();
+ }
+ catch (DataException e2) {
+ e2.printStackTrace();
+ }
+ catch (IOException e3) {
+ e3.printStackTrace();
+ }
+ }
+ }
+ }
+ }
+ if (!hasIslandNow) {
+ if (!Settings.island_useOldIslands) {
+ this.generateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
+ }
+ else {
+ this.oldGenerateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
+ }
+ }
+ next.setY((double)Settings.island_height);
+ System.out.println(next.getBlockY());
+ this.setNewPlayerIsland(player, next);
+ player.getInventory().clear();
+ player.getEquipment().clear();
+ getInstance().changePlayerBiome(player, "OCEAN");
+ for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
+ for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
+ getSkyBlockWorld().refreshChunk((next.getBlockX() + x) / 16, (next.getBlockZ() + z) / 16);
+ }
+ }
+ for (final Entity tempent : player.getNearbyEntities((double)(Settings.island_protectionRange / 2), 250.0, (double)(Settings.island_protectionRange / 2))) {
+ if (!(tempent instanceof Player)) {
+ tempent.remove();
+ }
+ }
+ }
+
+ public void devDeletePlayerIsland(final String player) {
+ if (!this.getActivePlayers().containsKey(player)) {
+ PlayerInfo pi = new PlayerInfo(player);
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(String.valueOf(player) + "Island");
+ }
+ pi = new PlayerInfo(player);
+ pi.savePlayerConfig(player);
+ }
+ else {
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard") && WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).hasRegion(String.valueOf(player) + "Island")) {
+ WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(String.valueOf(player) + "Island");
+ }
+ final PlayerInfo pi = new PlayerInfo(player);
+ this.removeActivePlayer(player);
+ this.addActivePlayer(player, pi);
+ }
+ }
+
+ public boolean devSetPlayerIsland(final Player sender, final Location l, final String player) {
+ if (!this.getActivePlayers().containsKey(player)) {
+ final PlayerInfo pi = new PlayerInfo(player);
+ final int px = l.getBlockX();
+ final int py = l.getBlockY();
+ final int pz = l.getBlockZ();
+ for (int x = -10; x <= 10; ++x) {
+ for (int y = -10; y <= 10; ++y) {
+ for (int z = -10; z <= 10; ++z) {
+ final Block b = new Location(l.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ if (b.getTypeId() == 7) {
+ pi.setHomeLocation(new Location(l.getWorld(), (double)(px + x), (double)(py + y + 3), (double)(pz + z)));
+ pi.setHasIsland(true);
+ pi.setIslandLocation(b.getLocation());
+ pi.savePlayerConfig(player);
+ getInstance().createIslandConfig(pi.locationForParty(), player);
+ getInstance().clearIslandConfig(pi.locationForParty(), player);
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ WorldGuardHandler.protectIsland(sender, player, pi);
+ }
+ getInstance().getIslandConfig(pi.locationForParty());
+ return true;
+ }
+ }
+ }
+ }
+ }
+ else {
+ final int px2 = l.getBlockX();
+ final int py2 = l.getBlockY();
+ final int pz2 = l.getBlockZ();
+ for (int x2 = -10; x2 <= 10; ++x2) {
+ for (int y2 = -10; y2 <= 10; ++y2) {
+ for (int z2 = -10; z2 <= 10; ++z2) {
+ final Block b2 = new Location(l.getWorld(), (double)(px2 + x2), (double)(py2 + y2), (double)(pz2 + z2)).getBlock();
+ if (b2.getTypeId() == 7) {
+ this.getActivePlayers().get(player).setHomeLocation(new Location(l.getWorld(), (double)(px2 + x2), (double)(py2 + y2 + 3), (double)(pz2 + z2)));
+ this.getActivePlayers().get(player).setHasIsland(true);
+ this.getActivePlayers().get(player).setIslandLocation(b2.getLocation());
+ final PlayerInfo pi2 = this.getActivePlayers().get(player);
+ this.removeActivePlayer(player);
+ this.addActivePlayer(player, pi2);
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ WorldGuardHandler.protectIsland(sender, player, pi2);
+ }
+ return true;
+ }
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public int orphanCount() {
+ return this.orphaned.size();
+ }
+
+ public void removeIsland(final Location loc) {
+ if (loc != null) {
+ final int px = loc.getBlockX();
+ final int py = loc.getBlockY();
+ final int pz = loc.getBlockZ();
+ for (int x = Settings.island_protectionRange / 2 * -1; x <= Settings.island_protectionRange / 2; ++x) {
+ for (int y = 0; y <= 255; ++y) {
+ for (int z = Settings.island_protectionRange / 2 * -1; z <= Settings.island_protectionRange / 2; ++z) {
+ final Block b = new Location(loc.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ if (!b.getType().equals((Object)Material.AIR)) {
+ if (b.getType().equals((Object)Material.CHEST)) {
+ final Chest c = (Chest)b.getState();
+ final ItemStack[] items = new ItemStack[c.getInventory().getContents().length];
+ c.getInventory().setContents(items);
+ }
+ else if (b.getType().equals((Object)Material.FURNACE)) {
+ final Furnace f = (Furnace)b.getState();
+ final ItemStack[] items = new ItemStack[f.getInventory().getContents().length];
+ f.getInventory().setContents(items);
+ }
+ else if (b.getType().equals((Object)Material.DISPENSER)) {
+ final Dispenser d = (Dispenser)b.getState();
+ final ItemStack[] items = new ItemStack[d.getInventory().getContents().length];
+ d.getInventory().setContents(items);
+ }
+ b.setType(Material.AIR);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public void removeIslandBlocks(final Location loc) {
+ if (loc != null) {
+ System.out.print("Removing blocks from an abandoned island.");
+ final int px = loc.getBlockX();
+ final int py = loc.getBlockY();
+ final int pz = loc.getBlockZ();
+ for (int x = -20; x <= 20; ++x) {
+ for (int y = -20; y <= 20; ++y) {
+ for (int z = -20; z <= 20; ++z) {
+ final Block b = new Location(loc.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ if (!b.getType().equals((Object)Material.AIR)) {
+ if (b.getType().equals((Object)Material.CHEST)) {
+ final Chest c = (Chest)b.getState();
+ final ItemStack[] items = new ItemStack[c.getInventory().getContents().length];
+ c.getInventory().setContents(items);
+ }
+ else if (b.getType().equals((Object)Material.FURNACE)) {
+ final Furnace f = (Furnace)b.getState();
+ final ItemStack[] items = new ItemStack[f.getInventory().getContents().length];
+ f.getInventory().setContents(items);
+ }
+ else if (b.getType().equals((Object)Material.DISPENSER)) {
+ final Dispenser d = (Dispenser)b.getState();
+ final ItemStack[] items = new ItemStack[d.getInventory().getContents().length];
+ d.getInventory().setContents(items);
+ }
+ b.setType(Material.AIR);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public boolean hasParty(final String playername) {
+ if (this.getActivePlayers().containsKey(playername)) {
+ return this.getIslandConfig(this.getActivePlayers().get(playername).locationForParty()).getInt("party.currentSize") > 1;
+ }
+ final PlayerInfo pi = new PlayerInfo(playername);
+ return pi.getHasIsland() && this.getTempIslandConfig(pi.locationForParty()).getInt("party.currentSize") > 1;
+ }
+
+ public Location getLastIsland() {
+ if (this.lastIsland.getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
+ return this.lastIsland;
+ }
+ this.setLastIsland(new Location(getSkyBlockWorld(), 0.0, (double)Settings.island_height, 0.0));
+ return new Location(getSkyBlockWorld(), 0.0, (double)Settings.island_height, 0.0);
+ }
+
+ public void setLastIsland(final Location island) {
+ this.getLastIslandConfig().set("options.general.lastIslandX", (Object)island.getBlockX());
+ this.getLastIslandConfig().set("options.general.lastIslandZ", (Object)island.getBlockZ());
+ this.saveLastIslandConfig();
+ this.lastIsland = island;
+ }
+
+ public boolean hasOrphanedIsland() {
+ return !this.orphaned.empty();
+ }
+
+ public Location checkOrphan() {
+ return this.orphaned.peek();
+ }
+
+ public Location getOrphanedIsland() {
+ if (this.hasOrphanedIsland()) {
+ return this.orphaned.pop();
+ }
+ return null;
+ }
+
+ public void addOrphan(final Location island) {
+ this.orphaned.push(island);
+ }
+
+ public void removeNextOrphan() {
+ this.orphaned.pop();
+ }
+
+ public void saveOrphans() {
+ String fullOrphan = "";
+ this.tempOrphaned = (Stack)this.orphaned.clone();
+ while (!this.tempOrphaned.isEmpty()) {
+ this.reverseOrphaned.push(this.tempOrphaned.pop());
+ }
+ while (!this.reverseOrphaned.isEmpty()) {
+ final Location tempLoc = this.reverseOrphaned.pop();
+ fullOrphan = String.valueOf(fullOrphan) + tempLoc.getBlockX() + "," + tempLoc.getBlockZ() + ";";
+ }
+ this.getOrphans().set("orphans.list", (Object)fullOrphan);
+ this.saveOrphansFile();
+ }
+
+ public void setupOrphans() {
+ if (this.getOrphans().contains("orphans.list")) {
+ final String fullOrphan = this.getOrphans().getString("orphans.list");
+ if (!fullOrphan.isEmpty()) {
+ final String[] orphanArray = fullOrphan.split(";");
+ this.orphaned = new Stack();
+ for (int i = 0; i < orphanArray.length; ++i) {
+ final String[] orphanXY = orphanArray[i].split(",");
+ final Location tempLoc = new Location(getSkyBlockWorld(), (double)Integer.parseInt(orphanXY[0]), (double)Settings.island_height, (double)Integer.parseInt(orphanXY[1]));
+ this.orphaned.push(tempLoc);
+ }
+ }
+ }
+ }
+
+ public boolean homeTeleport(final Player player) {
+ Location homeSweetHome = null;
+ if (this.getActivePlayers().containsKey(player.getName())) {
+ homeSweetHome = getInstance().getSafeHomeLocation(this.getActivePlayers().get(player.getName()));
+ }
+ if (homeSweetHome == null) {
+ player.performCommand("spawn");
+ player.sendMessage(ChatColor.RED + "You are not part of an island. Returning you the spawn area!");
+ return true;
+ }
+ getInstance().removeCreatures(homeSweetHome);
+ player.teleport(homeSweetHome);
+ player.sendMessage(ChatColor.GREEN + "Teleporting you to your island.");
+ return true;
+ }
+
+ public boolean warpTeleport(final Player player, final PlayerInfo pi) {
+ Location warpSweetWarp = null;
+ if (pi == null) {
+ player.sendMessage(ChatColor.RED + "That player does not exist!");
+ return true;
+ }
+ warpSweetWarp = getInstance().getSafeWarpLocation(pi);
+ if (warpSweetWarp == null) {
+ player.sendMessage(ChatColor.RED + "Unable to warp you to that player's island!");
+ return true;
+ }
+ player.teleport(warpSweetWarp);
+ player.sendMessage(ChatColor.GREEN + "Teleporting you to " + pi.getPlayerName() + "'s island.");
+ return true;
+ }
+
+ public boolean homeSet(final Player player) {
+ if (!player.getWorld().getName().equalsIgnoreCase(getSkyBlockWorld().getName())) {
+ player.sendMessage(ChatColor.RED + "You must be closer to your island to set your skyblock home!");
+ return true;
+ }
+ if (this.playerIsOnIsland(player)) {
+ if (this.getActivePlayers().containsKey(player.getName())) {
+ this.getActivePlayers().get(player.getName()).setHomeLocation(player.getLocation());
+ }
+ player.sendMessage(ChatColor.GREEN + "Your skyblock home has been set to your current location.");
+ return true;
+ }
+ player.sendMessage(ChatColor.RED + "You must be closer to your island to set your skyblock home!");
+ return true;
+ }
+
+ public boolean warpSet(final Player player) {
+ if (!player.getWorld().getName().equalsIgnoreCase(getSkyBlockWorld().getName())) {
+ player.sendMessage(ChatColor.RED + "You must be closer to your island to set your warp!");
+ return true;
+ }
+ if (this.playerIsOnIsland(player)) {
+ if (this.getActivePlayers().containsKey(player.getName())) {
+ this.setWarpLocation(this.getActivePlayers().get(player.getName()).locationForParty(), player.getLocation());
+ }
+ player.sendMessage(ChatColor.GREEN + "Your skyblock incoming warp has been set to your current location.");
+ return true;
+ }
+ player.sendMessage(ChatColor.RED + "You must be closer to your island to set your warp!");
+ return true;
+ }
+
+ public boolean homeSet(final String player, final Location loc) {
+ if (this.getActivePlayers().containsKey(player)) {
+ this.getActivePlayers().get(player).setHomeLocation(loc);
+ }
+ else {
+ final PlayerInfo pi = new PlayerInfo(player);
+ pi.setHomeLocation(loc);
+ pi.savePlayerConfig(player);
+ }
+ return true;
+ }
+
+ public boolean playerIsOnIsland(final Player player) {
+ if (this.getActivePlayers().containsKey(player.getName())) {
+ if (this.getActivePlayers().get(player.getName()).getHasIsland()) {
+ this.islandTestLocation = this.getActivePlayers().get(player.getName()).getIslandLocation();
+ }
+ if (this.islandTestLocation == null) {
+ return false;
+ }
+ if (player.getLocation().getX() > this.islandTestLocation.getX() - Settings.island_protectionRange / 2 && player.getLocation().getX() < this.islandTestLocation.getX() + Settings.island_protectionRange / 2 && player.getLocation().getZ() > this.islandTestLocation.getZ() - Settings.island_protectionRange / 2 && player.getLocation().getZ() < this.islandTestLocation.getZ() + Settings.island_protectionRange / 2) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean locationIsOnIsland(final Player player, final Location loc) {
+ if (this.getActivePlayers().containsKey(player.getName())) {
+ if (this.getActivePlayers().get(player.getName()).getHasIsland()) {
+ this.islandTestLocation = this.getActivePlayers().get(player.getName()).getIslandLocation();
+ }
+ if (this.islandTestLocation == null) {
+ return false;
+ }
+ if (loc.getX() > this.islandTestLocation.getX() - Settings.island_protectionRange / 2 && loc.getX() < this.islandTestLocation.getX() + Settings.island_protectionRange / 2 && loc.getZ() > this.islandTestLocation.getZ() - Settings.island_protectionRange / 2 && loc.getZ() < this.islandTestLocation.getZ() + Settings.island_protectionRange / 2) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean playerIsInSpawn(final Player player) {
+ return player.getLocation().getX() > Settings.general_spawnSize * -1 && player.getLocation().getX() < Settings.general_spawnSize && player.getLocation().getZ() > Settings.general_spawnSize * -1 && player.getLocation().getZ() < Settings.general_spawnSize;
+ }
+
+ public boolean hasIsland(final String playername) {
+ if (this.getActivePlayers().containsKey(playername)) {
+ return this.getActivePlayers().get(playername).getHasIsland();
+ }
+ final PlayerInfo pi = new PlayerInfo(playername);
+ return pi.getHasIsland();
+ }
+
+ public Location getPlayerIsland(final String playername) {
+ if (this.getActivePlayers().containsKey(playername)) {
+ return this.getActivePlayers().get(playername).getIslandLocation();
+ }
+ final PlayerInfo pi = new PlayerInfo(playername);
+ if (!pi.getHasIsland()) {
+ return null;
+ }
+ return pi.getIslandLocation();
+ }
+
+ public boolean islandAtLocation(final Location loc) {
+ if (loc == null) {
+ return true;
+ }
+ final int px = loc.getBlockX();
+ final int py = loc.getBlockY();
+ final int pz = loc.getBlockZ();
+ for (int x = -2; x <= 2; ++x) {
+ for (int y = -50; y <= 50; ++y) {
+ for (int z = -2; z <= 2; ++z) {
+ final Block b = new Location(loc.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ if (b.getTypeId() != 0) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean islandInSpawn(final Location loc) {
+ return loc == null || (loc.getX() > -50.0 && loc.getX() < 50.0 && loc.getZ() > -50.0 && loc.getZ() < 50.0);
+ }
+
+ public ChunkGenerator getDefaultWorldGenerator(final String worldName, final String id) {
+ return new SkyBlockChunkGenerator();
+ }
+
+ public Stack changeStackToFile(final Stack stack) {
+ final Stack finishStack = new Stack();
+ final Stack tempStack = new Stack();
+ while (!stack.isEmpty()) {
+ tempStack.push(stack.pop());
+ }
+ while (!tempStack.isEmpty()) {
+ if (tempStack.peek() != null) {
+ finishStack.push(new SerializableLocation(tempStack.pop()));
+ }
+ else {
+ tempStack.pop();
+ }
+ }
+ return finishStack;
+ }
+
+ public Stack changestackfromfile(final Stack stack) {
+ final Stack tempStack = new Stack();
+ final Stack finishStack = new Stack();
+ while (!stack.isEmpty()) {
+ tempStack.push(stack.pop());
+ }
+ while (!tempStack.isEmpty()) {
+ if (tempStack.peek() != null) {
+ finishStack.push(tempStack.pop().getLocation());
+ }
+ else {
+ tempStack.pop();
+ }
+ }
+ return finishStack;
+ }
+
+ public boolean largeIsland(final Location l) {
+ final int blockcount = 0;
+ final int px = l.getBlockX();
+ final int py = l.getBlockY();
+ final int pz = l.getBlockZ();
+ for (int x = -30; x <= 30; ++x) {
+ for (int y = -30; y <= 30; ++y) {
+ for (int z = -30; z <= 30; ++z) {
+ final Block b = new Location(l.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ if (b.getTypeId() != 0 && b.getTypeId() != 8 && b.getTypeId() != 10 && blockcount > 200) {
+ return true;
+ }
+ }
+ }
+ }
+ return blockcount > 200;
+ }
+
+ public boolean clearAbandoned() {
+ int numOffline = 0;
+ final OfflinePlayer[] oplayers = Bukkit.getServer().getOfflinePlayers();
+ System.out.print("Attemping to add more orphans");
+ for (int i = 0; i < oplayers.length; ++i) {
+ long offlineTime = oplayers[i].getLastPlayed();
+ offlineTime = (System.currentTimeMillis() - offlineTime) / 3600000L;
+ if (offlineTime > 250L && getInstance().hasIsland(oplayers[i].getName()) && offlineTime < 50000L) {
+ final PlayerInfo pi = new PlayerInfo(oplayers[i].getName());
+ final Location l = pi.getIslandLocation();
+ int blockcount = 0;
+ final int px = l.getBlockX();
+ final int py = l.getBlockY();
+ final int pz = l.getBlockZ();
+ for (int x = -30; x <= 30; ++x) {
+ for (int y = -30; y <= 30; ++y) {
+ for (int z = -30; z <= 30; ++z) {
+ final Block b = new Location(l.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ if (b.getTypeId() != 0 && b.getTypeId() != 8 && b.getTypeId() != 10) {
+ ++blockcount;
+ }
+ }
+ }
+ }
+ if (blockcount < 200) {
+ ++numOffline;
+ WorldGuardHandler.getWorldGuard().getRegionManager(getSkyBlockWorld()).removeRegion(String.valueOf(oplayers[i].getName()) + "Island");
+ this.orphaned.push(pi.getIslandLocation());
+ pi.setHomeLocation(null);
+ pi.setHasIsland(false);
+ pi.setIslandLocation(null);
+ pi.savePlayerConfig(pi.getPlayerName());
+ }
+ }
+ }
+ if (numOffline > 0) {
+ System.out.print("Added " + numOffline + " new orphans.");
+ this.saveOrphans();
+ return true;
+ }
+ System.out.print("No new orphans to add!");
+ return false;
+ }
+
+ public LinkedHashMap generateTopTen() {
+ final HashMap tempMap = new LinkedHashMap();
+ final File folder = this.directoryIslands;
+ final File[] listOfFiles = folder.listFiles();
+ for (int i = 0; i < listOfFiles.length; ++i) {
+ if (this.getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")) != null && this.getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getInt("general.level") > 0) {
+ tempMap.put(this.getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getString("party.leader"), (double)this.getTempIslandConfig(listOfFiles[i].getName().replaceAll(".yml", "")).getInt("general.level"));
+ }
+ }
+ final LinkedHashMap sortedMap = this.sortHashMapByValuesD(tempMap);
+ return sortedMap;
+ }
+
+ public LinkedHashMap sortHashMapByValuesD(final HashMap passedMap) {
+ final List mapKeys = new ArrayList(passedMap.keySet());
+ final List mapValues = new ArrayList(passedMap.values());
+ Collections.sort(mapValues);
+ Collections.reverse(mapValues);
+ Collections.sort(mapKeys);
+ Collections.reverse(mapKeys);
+ final LinkedHashMap sortedMap = new LinkedHashMap();
+ for (final Double val : mapValues) {
+ for (final String key : mapKeys) {
+ final String comp1 = passedMap.get(key).toString();
+ final String comp2 = val.toString();
+ if (comp1.equals(comp2)) {
+ passedMap.remove(key);
+ mapKeys.remove(key);
+ sortedMap.put(key, val);
+ break;
+ }
+ }
+ }
+ return sortedMap;
+ }
+
+ public boolean onInfoCooldown(final Player player) {
+ return this.infoCooldown.containsKey(player.getName()) && this.infoCooldown.get(player.getName()) > Calendar.getInstance().getTimeInMillis();
+ }
+
+ public boolean onBiomeCooldown(final Player player) {
+ return this.biomeCooldown.containsKey(player.getName()) && this.biomeCooldown.get(player.getName()) > Calendar.getInstance().getTimeInMillis();
+ }
+
+ public boolean onRestartCooldown(final Player player) {
+ return this.restartCooldown.containsKey(player.getName()) && this.restartCooldown.get(player.getName()) > Calendar.getInstance().getTimeInMillis();
+ }
+
+ public long getInfoCooldownTime(final Player player) {
+ if (!this.infoCooldown.containsKey(player.getName())) {
+ return 0L;
+ }
+ if (this.infoCooldown.get(player.getName()) > Calendar.getInstance().getTimeInMillis()) {
+ return this.infoCooldown.get(player.getName()) - Calendar.getInstance().getTimeInMillis();
+ }
+ return 0L;
+ }
+
+ public long getBiomeCooldownTime(final Player player) {
+ if (!this.biomeCooldown.containsKey(player.getName())) {
+ return 0L;
+ }
+ if (this.biomeCooldown.get(player.getName()) > Calendar.getInstance().getTimeInMillis()) {
+ return this.biomeCooldown.get(player.getName()) - Calendar.getInstance().getTimeInMillis();
+ }
+ return 0L;
+ }
+
+ public long getRestartCooldownTime(final Player player) {
+ if (!this.restartCooldown.containsKey(player.getName())) {
+ return 0L;
+ }
+ if (this.restartCooldown.get(player.getName()) > Calendar.getInstance().getTimeInMillis()) {
+ return this.restartCooldown.get(player.getName()) - Calendar.getInstance().getTimeInMillis();
+ }
+ return 0L;
+ }
+
+ public void setInfoCooldown(final Player player) {
+ this.infoCooldown.put(player.getName(), Calendar.getInstance().getTimeInMillis() + Settings.general_cooldownInfo * 1000);
+ }
+
+ public void setBiomeCooldown(final Player player) {
+ this.biomeCooldown.put(player.getName(), Calendar.getInstance().getTimeInMillis() + Settings.general_biomeChange * 1000);
+ }
+
+ public void setRestartCooldown(final Player player) {
+ this.restartCooldown.put(player.getName(), Calendar.getInstance().getTimeInMillis() + Settings.general_cooldownRestart * 1000);
+ }
+
+ public File[] getSchemFile() {
+ return this.schemFile;
+ }
+
+ public boolean testForObsidian(final Block block) {
+ for (int x = -3; x <= 3; ++x) {
+ for (int y = -3; y <= 3; ++y) {
+ for (int z = -3; z <= 3; ++z) {
+ final Block testBlock = getSkyBlockWorld().getBlockAt(block.getX() + x, block.getY() + y, block.getZ() + z);
+ if ((x != 0 || y != 0 || z != 0) && testBlock.getType() == Material.OBSIDIAN) {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public void removeInactive(final List removePlayerList) {
+ getInstance().getServer().getScheduler().scheduleSyncRepeatingTask((Plugin)getInstance(), (Runnable)new Runnable() {
+ @Override
+ public void run() {
+ if (uSkyBlock.getInstance().getRemoveList().size() > 0 && !uSkyBlock.getInstance().isPurgeActive()) {
+ uSkyBlock.getInstance().deletePlayerIsland(uSkyBlock.getInstance().getRemoveList().get(0));
+ System.out.print("[uSkyBlock] Purge: Removing " + uSkyBlock.getInstance().getRemoveList().get(0) + "'s island");
+ uSkyBlock.getInstance().deleteFromRemoveList();
+ }
+ }
+ }, 0L, 200L);
+ }
+
+ public List getRemoveList() {
+ return this.removeList;
+ }
+
+ public void addToRemoveList(final String string) {
+ this.removeList.add(string);
+ }
+
+ public void deleteFromRemoveList() {
+ this.removeList.remove(0);
+ }
+
+ public boolean isPurgeActive() {
+ return this.purgeActive;
+ }
+
+ public void activatePurge() {
+ this.purgeActive = true;
+ }
+
+ public void deactivatePurge() {
+ this.purgeActive = false;
+ }
+
+ public HashMap getActivePlayers() {
+ return this.activePlayers;
+ }
+
+ public void addActivePlayer(final String player, final PlayerInfo pi) {
+ this.activePlayers.put(player, pi);
+ }
+
+ public void removeActivePlayer(final String player) {
+ if (this.activePlayers.containsKey(player)) {
+ this.activePlayers.get(player).savePlayerConfig(player);
+ this.activePlayers.remove(player);
+ System.out.print("Removing player from memory: " + player);
+ }
+ }
+
+ public void populateChallengeList() {
+ List templist = new ArrayList();
+ for (int i = 0; i < Settings.challenges_ranks.length; ++i) {
+ this.challenges.put(Settings.challenges_ranks[i], templist);
+ templist = new ArrayList();
+ }
+ for (final String tempString : Settings.challenges_challengeList) {
+ if (this.challenges.containsKey(this.getConfig().getString("options.challenges.challengeList." + tempString + ".rankLevel"))) {
+ this.challenges.get(this.getConfig().getString("options.challenges.challengeList." + tempString + ".rankLevel")).add(tempString);
+ }
+ }
+ }
+
+ public String getChallengesFromRank(final Player player, final String rank) {
+ this.rankDisplay = this.challenges.get(rank);
+ String fullString = "";
+ final PlayerInfo pi = this.getActivePlayers().get(player.getName());
+ for (final String tempString : this.rankDisplay) {
+ if (pi.checkChallenge(tempString) > 0) {
+ if (this.getConfig().getBoolean("options.challenges.challengeList." + tempString + ".repeatable")) {
+ fullString = String.valueOf(fullString) + Settings.challenges_repeatableColor + tempString + ChatColor.DARK_GRAY + " - ";
+ }
+ else {
+ fullString = String.valueOf(fullString) + Settings.challenges_finishedColor + tempString + ChatColor.DARK_GRAY + " - ";
+ }
+ }
+ else {
+ fullString = String.valueOf(fullString) + Settings.challenges_challengeColor + tempString + ChatColor.DARK_GRAY + " - ";
+ }
+ }
+ if (fullString.length() > 4) {
+ fullString = fullString.substring(0, fullString.length() - 3);
+ }
+ return fullString;
+ }
+
+ public int checkRankCompletion(final Player player, final String rank) {
+ if (!Settings.challenges_requirePreviousRank) {
+ return 0;
+ }
+ this.rankDisplay = this.challenges.get(rank);
+ int ranksCompleted = 0;
+ final PlayerInfo pi = this.getActivePlayers().get(player.getName());
+ for (final String tempString : this.rankDisplay) {
+ if (pi.checkChallenge(tempString) > 0) {
+ ++ranksCompleted;
+ }
+ }
+ return this.rankDisplay.size() - Settings.challenges_rankLeeway - ranksCompleted;
+ }
+
+ public boolean isRankAvailable(final Player player, final String rank) {
+ if (this.challenges.size() < 2) {
+ return true;
+ }
+ for (int i = 0; i < Settings.challenges_ranks.length; ++i) {
+ if (Settings.challenges_ranks[i].equalsIgnoreCase(rank)) {
+ if (i == 0) {
+ return true;
+ }
+ if (this.checkRankCompletion(player, Settings.challenges_ranks[i - 1]) <= 0) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean checkIfCanCompleteChallenge(final Player player, final String challenge) {
+ final PlayerInfo pi = this.getActivePlayers().get(player.getName());
+ if (!this.isRankAvailable(player, this.getConfig().getString("options.challenges.challengeList." + challenge + ".rankLevel"))) {
+ player.sendMessage(ChatColor.RED + "You have not unlocked this challenge yet!");
+ return false;
+ }
+ if (!pi.challengeExists(challenge)) {
+ player.sendMessage(ChatColor.RED + "Unknown challenge name (check spelling)!");
+ return false;
+ }
+ if (pi.checkChallenge(challenge) > 0 && !this.getConfig().getBoolean("options.challenges.challengeList." + challenge + ".repeatable")) {
+ player.sendMessage(ChatColor.RED + "This challenge is not repeatable!");
+ return false;
+ }
+ if (pi.checkChallenge(challenge) > 0 && (this.getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onIsland") || this.getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onIsland"))) {
+ player.sendMessage(ChatColor.RED + "This challenge is not repeatable!");
+ return false;
+ }
+ if (this.getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onPlayer")) {
+ if (!this.hasRequired(player, challenge, "onPlayer")) {
+ player.sendMessage(ChatColor.RED + this.getConfig().getString("options.challenges.challengeList." + challenge + ".description"));
+ player.sendMessage(ChatColor.RED + "You don't have enough of the required item(s)!");
+ return false;
+ }
+ return true;
+ }
+ else if (this.getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("onIsland")) {
+ if (!this.playerIsOnIsland(player)) {
+ player.sendMessage(ChatColor.RED + "You must be on your island to do that!");
+ }
+ if (!this.hasRequired(player, challenge, "onIsland")) {
+ player.sendMessage(ChatColor.RED + this.getConfig().getString("options.challenges.challengeList." + challenge + ".description"));
+ player.sendMessage(ChatColor.RED + "You must be standing within 10 blocks of all required items.");
+ return false;
+ }
+ return true;
+ }
+ else {
+ if (!this.getConfig().getString("options.challenges.challengeList." + challenge + ".type").equalsIgnoreCase("islandLevel")) {
+ return false;
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("general.level") >= this.getConfig().getInt("options.challenges.challengeList." + challenge + ".requiredItems")) {
+ return true;
+ }
+ player.sendMessage(ChatColor.RED + "Your island must be level " + this.getConfig().getInt("options.challenges.challengeList." + challenge + ".requiredItems") + " to complete this challenge!");
+ return false;
+ }
+ }
+
+ public boolean takeRequired(final Player player, final String challenge, final String type) {
+ if (type.equalsIgnoreCase("onPlayer")) {
+ final String[] reqList = this.getConfig().getString("options.challenges.challengeList." + challenge + ".requiredItems").split(" ");
+ int reqItem = 0;
+ int reqAmount = 0;
+ int reqMod = -1;
+ String[] array;
+ for (int length = (array = reqList).length, i = 0; i < length; ++i) {
+ final String s = array[i];
+ final String[] sPart = s.split(":");
+ if (sPart.length == 2) {
+ reqItem = Integer.parseInt(sPart[0]);
+ final String[] sScale = sPart[1].split(";");
+ if (sScale.length == 1) {
+ reqAmount = Integer.parseInt(sPart[1]);
+ }
+ else if (sScale.length == 2) {
+ if (sScale[1].charAt(0) == '+') {
+ reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '*') {
+ reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ else if (sScale[1].charAt(0) == '-') {
+ reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '/') {
+ reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ }
+ if (!player.getInventory().contains(reqItem, reqAmount)) {
+ return false;
+ }
+ player.getInventory().removeItem(new ItemStack[] { new ItemStack(reqItem, reqAmount) });
+ }
+ else if (sPart.length == 3) {
+ reqItem = Integer.parseInt(sPart[0]);
+ final String[] sScale = sPart[2].split(";");
+ if (sScale.length == 1) {
+ reqAmount = Integer.parseInt(sPart[2]);
+ }
+ else if (sScale.length == 2) {
+ if (sScale[1].charAt(0) == '+') {
+ reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '*') {
+ reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ else if (sScale[1].charAt(0) == '-') {
+ reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '/') {
+ reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ }
+ reqMod = Integer.parseInt(sPart[1]);
+ if (!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)reqMod), reqAmount)) {
+ return false;
+ }
+ player.getInventory().removeItem(new ItemStack[] { new ItemStack(reqItem, reqAmount, (short)reqMod) });
+ }
+ }
+ return true;
+ }
+ return type.equalsIgnoreCase("onIsland") || type.equalsIgnoreCase("islandLevel");
+ }
+
+ public boolean hasRequired(final Player player, final String challenge, final String type) {
+ final String[] reqList = this.getConfig().getString("options.challenges.challengeList." + challenge + ".requiredItems").split(" ");
+ if (type.equalsIgnoreCase("onPlayer")) {
+ int reqItem = 0;
+ int reqAmount = 0;
+ int reqMod = -1;
+ String[] array;
+ for (int length = (array = reqList).length, n = 0; n < length; ++n) {
+ final String s = array[n];
+ final String[] sPart = s.split(":");
+ if (sPart.length == 2) {
+ reqItem = Integer.parseInt(sPart[0]);
+ final String[] sScale = sPart[1].split(";");
+ if (sScale.length == 1) {
+ reqAmount = Integer.parseInt(sPart[1]);
+ }
+ else if (sScale.length == 2) {
+ if (sScale[1].charAt(0) == '+') {
+ reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '*') {
+ reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ else if (sScale[1].charAt(0) == '-') {
+ reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '/') {
+ reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ }
+ if (!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)0), reqAmount)) {
+ return false;
+ }
+ }
+ else if (sPart.length == 3) {
+ reqItem = Integer.parseInt(sPart[0]);
+ final String[] sScale = sPart[2].split(";");
+ if (sScale.length == 1) {
+ reqAmount = Integer.parseInt(sPart[2]);
+ }
+ else if (sScale.length == 2) {
+ if (sScale[1].charAt(0) == '+') {
+ reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '*') {
+ reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ else if (sScale[1].charAt(0) == '-') {
+ reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge);
+ }
+ else if (sScale[1].charAt(0) == '/') {
+ reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challenge));
+ }
+ }
+ reqMod = Integer.parseInt(sPart[1]);
+ if (!player.getInventory().containsAtLeast(new ItemStack(reqItem, reqAmount, (short)reqMod), reqAmount)) {
+ return false;
+ }
+ }
+ }
+ if (this.getConfig().getBoolean("options.challenges.challengeList." + challenge + ".takeItems")) {
+ this.takeRequired(player, challenge, type);
+ }
+ return true;
+ }
+ if (type.equalsIgnoreCase("onIsland")) {
+ final int[][] neededItem = new int[reqList.length][2];
+ for (int i = 0; i < reqList.length; ++i) {
+ final String[] sPart = reqList[i].split(":");
+ neededItem[i][0] = Integer.parseInt(sPart[0]);
+ neededItem[i][1] = Integer.parseInt(sPart[1]);
+ }
+ final Location l = player.getLocation();
+ final int px = l.getBlockX();
+ final int py = l.getBlockY();
+ final int pz = l.getBlockZ();
+ for (int x = -10; x <= 10; ++x) {
+ for (int y = -3; y <= 10; ++y) {
+ for (int z = -10; z <= 10; ++z) {
+ final Block b = new Location(l.getWorld(), (double)(px + x), (double)(py + y), (double)(pz + z)).getBlock();
+ for (int j = 0; j < neededItem.length; ++j) {
+ if (b.getTypeId() == neededItem[j][0]) {
+ final int[] array2 = neededItem[j];
+ final int n2 = 1;
+ --array2[n2];
+ }
+ }
+ }
+ }
+ }
+ for (int k = 0; k < neededItem.length; ++k) {
+ if (neededItem[k][1] > 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return true;
+ }
+
+ public boolean giveReward(final Player player, final String challenge) {
+ final String[] permList = this.getConfig().getString("options.challenges.challengeList." + challenge.toLowerCase() + ".permissionReward").split(" ");
+ double rewCurrency = 0.0;
+ player.sendMessage(ChatColor.GREEN + "You have completed the " + challenge + " challenge!");
+ String[] rewList;
+ if (getInstance().getActivePlayers().get(player.getName()).checkChallenge(challenge) == 0) {
+ rewList = this.getConfig().getString("options.challenges.challengeList." + challenge.toLowerCase() + ".itemReward").split(" ");
+ if (Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null) {
+ rewCurrency = this.getConfig().getInt("options.challenges.challengeList." + challenge.toLowerCase() + ".currencyReward");
+ }
+ }
+ else {
+ rewList = this.getConfig().getString("options.challenges.challengeList." + challenge.toLowerCase() + ".repeatItemReward").split(" ");
+ if (Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null) {
+ rewCurrency = this.getConfig().getInt("options.challenges.challengeList." + challenge.toLowerCase() + ".repeatCurrencyReward");
+ }
+ }
+ int rewItem = 0;
+ int rewAmount = 0;
+ double rewBonus = 1.0;
+ int rewMod = -1;
+ if (Settings.challenges_enableEconomyPlugin && VaultHandler.econ != null) {
+ if (VaultHandler.checkPerk(player.getName(), "group.memberplus", getSkyBlockWorld())) {
+ rewBonus += 0.05;
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.donor.all", getSkyBlockWorld())) {
+ rewBonus += 0.05;
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.donor.25", getSkyBlockWorld())) {
+ rewBonus += 0.05;
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.donor.50", getSkyBlockWorld())) {
+ rewBonus += 0.05;
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.donor.75", getSkyBlockWorld())) {
+ rewBonus += 0.1;
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.donor.100", getSkyBlockWorld())) {
+ rewBonus += 0.2;
+ }
+ VaultHandler.econ.depositPlayer(player.getName(), rewCurrency * rewBonus);
+ if (getInstance().getActivePlayers().get(player.getName()).checkChallenge(challenge) > 0) {
+ player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatXpReward"));
+ player.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString("options.challenges.challengeList." + challenge + ".repeatRewardText"));
+ player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatXpReward"));
+ player.sendMessage(ChatColor.YELLOW + "Repeat currency reward: " + ChatColor.WHITE + this.df.format(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatCurrencyReward") * rewBonus) + " " + VaultHandler.econ.currencyNamePlural() + "�a(+" + this.df.format((rewBonus - 1.0) * 100.0) + "%)");
+ }
+ else {
+ if (Settings.challenges_broadcastCompletion) {
+ Bukkit.getServer().broadcastMessage(String.valueOf(Settings.challenges_broadcastText) + player.getName() + " has completed the " + challenge + " challenge!");
+ }
+ player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".xpReward"));
+ player.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString("options.challenges.challengeList." + challenge + ".rewardText"));
+ player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".xpReward"));
+ player.sendMessage(ChatColor.YELLOW + "Currency reward: " + ChatColor.WHITE + this.df.format(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".currencyReward") * rewBonus) + " " + VaultHandler.econ.currencyNamePlural() + "�a(+" + this.df.format((rewBonus - 1.0) * 100.0) + "%)");
+ }
+ }
+ else if (getInstance().getActivePlayers().get(player.getName()).checkChallenge(challenge) > 0) {
+ player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatXpReward"));
+ player.sendMessage(ChatColor.YELLOW + "Repeat reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString("options.challenges.challengeList." + challenge + ".repeatRewardText"));
+ player.sendMessage(ChatColor.YELLOW + "Repeat exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".repeatXpReward"));
+ }
+ else {
+ if (Settings.challenges_broadcastCompletion) {
+ Bukkit.getServer().broadcastMessage(String.valueOf(Settings.challenges_broadcastText) + player.getName() + " has completed the " + challenge + " challenge!");
+ }
+ player.giveExp(getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".xpReward"));
+ player.sendMessage(ChatColor.YELLOW + "Reward(s): " + ChatColor.WHITE + getInstance().getConfig().getString("options.challenges.challengeList." + challenge + ".rewardText"));
+ player.sendMessage(ChatColor.YELLOW + "Exp reward: " + ChatColor.WHITE + getInstance().getConfig().getInt("options.challenges.challengeList." + challenge + ".xpReward"));
+ }
+ String[] array;
+ for (int length = (array = permList).length, i = 0; i < length; ++i) {
+ final String s = array[i];
+ if (!s.equalsIgnoreCase("none") && !VaultHandler.checkPerk(player.getName(), s, player.getWorld())) {
+ VaultHandler.addPerk(player, s);
+ }
+ }
+ String[] array2;
+ for (int length2 = (array2 = rewList).length, j = 0; j < length2; ++j) {
+ final String s = array2[j];
+ final String[] sPart = s.split(":");
+ if (sPart.length == 2) {
+ rewItem = Integer.parseInt(sPart[0]);
+ rewAmount = Integer.parseInt(sPart[1]);
+ player.getInventory().addItem(new ItemStack[] { new ItemStack(rewItem, rewAmount) });
+ }
+ else if (sPart.length == 3) {
+ rewItem = Integer.parseInt(sPart[0]);
+ rewAmount = Integer.parseInt(sPart[2]);
+ rewMod = Integer.parseInt(sPart[1]);
+ player.getInventory().addItem(new ItemStack[] { new ItemStack(rewItem, rewAmount, (short)rewMod) });
+ }
+ }
+ getInstance().getActivePlayers().get(player.getName()).completeChallenge(challenge);
+ return true;
+ }
+
+ public void reloadData() {
+ if (this.skyblockDataFile == null) {
+ this.skyblockDataFile = new File(this.getDataFolder(), "skyblockData.yml");
+ }
+ this.skyblockData = (FileConfiguration)YamlConfiguration.loadConfiguration(this.skyblockDataFile);
+ final InputStream defConfigStream = this.getResource("skyblockData.yml");
+ if (defConfigStream != null) {
+ final YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ this.skyblockData.setDefaults((Configuration)defConfig);
+ }
+ }
+
+ public FileConfiguration getData() {
+ if (this.skyblockData == null) {
+ this.reloadData();
+ }
+ return this.skyblockData;
+ }
+
+ double dReturns(final double val, final double scale) {
+ if (val < 0.0) {
+ return -this.dReturns(-val, scale);
+ }
+ final double mult = val / scale;
+ final double trinum = (Math.sqrt(8.0 * mult + 1.0) - 1.0) / 2.0;
+ return trinum * scale;
+ }
+
+ public void reloadLevelConfig() {
+ if (this.levelConfigFile == null) {
+ this.levelConfigFile = new File(this.getDataFolder(), "levelConfig.yml");
+ }
+ this.levelConfig = (FileConfiguration)YamlConfiguration.loadConfiguration(this.levelConfigFile);
+ final InputStream defConfigStream = this.getResource("levelConfig.yml");
+ if (defConfigStream != null) {
+ final YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ this.levelConfig.setDefaults((Configuration)defConfig);
+ }
+ }
+
+ public FileConfiguration getLevelConfig() {
+ if (this.levelConfig == null) {
+ this.reloadLevelConfig();
+ }
+ return this.levelConfig;
+ }
+
+ public void saveLevelConfig() {
+ if (this.levelConfig == null || this.levelConfigFile == null) {
+ return;
+ }
+ try {
+ this.getLevelConfig().save(this.levelConfigFile);
+ }
+ catch (IOException ex) {
+ this.getLogger().log(Level.SEVERE, "Could not save config to " + this.levelConfigFile, ex);
+ }
+ }
+
+ public void saveDefaultLevelConfig() {
+ if (this.levelConfigFile == null) {
+ this.levelConfigFile = new File(this.getDataFolder(), "levelConfig.yml");
+ }
+ if (!this.levelConfigFile.exists()) {
+ getInstance().saveResource("levelConfig.yml", false);
+ }
+ }
+
+ public void loadLevelConfig() {
+ try {
+ this.getLevelConfig();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ for (int i = 1; i <= 255; ++i) {
+ if (this.getLevelConfig().contains("blockValues." + i)) {
+ Settings.blockList[i] = this.getLevelConfig().getInt("blockValues." + i);
+ }
+ else {
+ Settings.blockList[i] = this.getLevelConfig().getInt("general.default");
+ }
+ if (this.getLevelConfig().contains("blockLimits." + i)) {
+ Settings.limitList[i] = this.getLevelConfig().getInt("blockLimits." + i);
+ }
+ else {
+ Settings.limitList[i] = -1;
+ }
+ if (this.getLevelConfig().contains("diminishingReturns." + i)) {
+ Settings.diminishingReturnsList[i] = this.getLevelConfig().getInt("diminishingReturns." + i);
+ }
+ else if (this.getLevelConfig().getBoolean("general.useDiminishingReturns")) {
+ Settings.diminishingReturnsList[i] = this.getLevelConfig().getInt("general.defaultScale");
+ }
+ else {
+ Settings.diminishingReturnsList[i] = -1;
+ }
+ }
+ System.out.print(Settings.blockList[57]);
+ System.out.print(Settings.diminishingReturnsList[57]);
+ System.out.print(Settings.limitList[57]);
+ }
+
+ public void clearIslandConfig(final String location, final String leader) {
+ this.getIslandConfig(location).set("general.level", (Object)0);
+ this.getIslandConfig(location).set("general.warpLocationX", (Object)0);
+ this.getIslandConfig(location).set("general.warpLocationY", (Object)0);
+ this.getIslandConfig(location).set("general.warpLocationZ", (Object)0);
+ this.getIslandConfig(location).set("general.warpActive", (Object)false);
+ this.getIslandConfig(location).set("log.logPos", (Object)1);
+ this.getIslandConfig(location).set("log.1", (Object)"�d[skyblock] The island has been created.");
+ this.setupPartyLeader(location, leader);
+ }
+
+ public void setupPartyLeader(final String location, final String leader) {
+ this.getIslandConfig(location).createSection("party.members." + leader);
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + leader), "canChangeBiome");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + leader), "canToggleLock");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + leader), "canChangeWarp");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + leader), "canToggleWarp");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + leader), "canInviteOthers");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + leader), "canKickOthers");
+ this.getIslandConfig(location).set("party.leader", (Object)leader);
+ this.getIslandConfig(location).set("party.members." + leader + ".canChangeBiome", (Object)true);
+ this.getIslandConfig(location).set("party.members." + leader + ".canToggleLock", (Object)true);
+ this.getIslandConfig(location).set("party.members." + leader + ".canChangeWarp", (Object)true);
+ this.getIslandConfig(location).set("party.members." + leader + ".canToggleWarp", (Object)true);
+ this.getIslandConfig(location).set("party.members." + leader + ".canInviteOthers", (Object)true);
+ this.getIslandConfig(location).set("party.members." + leader + ".canKickOthers", (Object)true);
+ this.saveIslandConfig(location);
+ }
+
+ public void setupPartyMember(final String location, final String member) {
+ this.getIslandConfig(location).createSection("party.members." + member);
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + member), "canChangeBiome");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + member), "canToggleLock");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + member), "canChangeWarp");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + member), "canToggleWarp");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + member), "canInviteOthers");
+ this.getIslandConfig(location);
+ FileConfiguration.createPath(this.getIslandConfig(location).getConfigurationSection("party.members." + member), "canKickOthers");
+ this.getIslandConfig(location).set("party.members." + member + ".canChangeBiome", (Object)false);
+ this.getIslandConfig(location).set("party.currentSize", (Object)(this.getIslandConfig(location).getInt("party.currentSize") + 1));
+ this.getIslandConfig(location).set("party.members." + member + ".canToggleLock", (Object)false);
+ this.getIslandConfig(location).set("party.members." + member + ".canChangeWarp", (Object)false);
+ this.getIslandConfig(location).set("party.members." + member + ".canToggleWarp", (Object)false);
+ this.getIslandConfig(location).set("party.members." + member + ".canInviteOthers", (Object)false);
+ this.getIslandConfig(location).set("party.members." + member + ".canKickOthers", (Object)false);
+ this.getIslandConfig(location).set("party.members." + member + ".canBanOthers", (Object)false);
+ this.saveIslandConfig(location);
+ }
+
+ public void reloadIslandConfig(final String location) {
+ this.islandConfigFile = new File(this.directoryIslands, String.valueOf(location) + ".yml");
+ this.islands.put(location, (FileConfiguration)YamlConfiguration.loadConfiguration(this.islandConfigFile));
+ final InputStream defConfigStream = this.getResource("island.yml");
+ if (defConfigStream != null) {
+ final YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ this.islands.get(location).setDefaults((Configuration)defConfig);
+ }
+ this.saveIslandConfig(location);
+ }
+
+ public FileConfiguration getTempIslandConfig(final String location) {
+ this.tempIslandFile = new File(this.directoryIslands, String.valueOf(location) + ".yml");
+ return this.tempIsland = (FileConfiguration)YamlConfiguration.loadConfiguration(this.tempIslandFile);
+ }
+
+ public FileConfiguration getCurrentPlayerConfig(final String player) {
+ this.tempPlayerFile = new File(this.directoryPlayers, String.valueOf(player) + ".yml");
+ return this.tempPlayer = (FileConfiguration)YamlConfiguration.loadConfiguration(this.tempPlayerFile);
+ }
+
+ public void createIslandConfig(final String location, final String leader) {
+ this.saveDefaultIslandsConfig(location);
+ this.islandConfigFile = new File(this.directoryIslands, String.valueOf(location) + ".yml");
+ final InputStream defConfigStream = this.getResource("island.yml");
+ if (defConfigStream != null) {
+ this.islands.put(location, (FileConfiguration)YamlConfiguration.loadConfiguration(defConfigStream));
+ this.getIslandConfig(location);
+ this.setupPartyLeader(location, leader);
+ }
+ }
+
+ public FileConfiguration getIslandConfig(final String location) {
+ if (this.islands.get(location) == null) {
+ this.reloadIslandConfig(location);
+ }
+ return this.islands.get(location);
+ }
+
+ public void saveIslandConfig(final String location) {
+ if (this.islands.get(location) == null) {
+ return;
+ }
+ try {
+ this.islandConfigFile = new File(this.directoryIslands, String.valueOf(location) + ".yml");
+ this.getIslandConfig(location).save(this.islandConfigFile);
+ }
+ catch (IOException ex) {
+ this.getLogger().log(Level.SEVERE, "Could not save config to " + this.islandConfigFile, ex);
+ }
+ }
+
+ public void deleteIslandConfig(final String location) {
+ (this.islandConfigFile = new File(this.directoryIslands, String.valueOf(location) + ".yml")).delete();
+ }
+
+ public void saveDefaultIslandsConfig(final String location) {
+ try {
+ if (this.islandConfigFile == null) {
+ this.islandConfigFile = new File(this.directoryIslands, String.valueOf(location) + ".yml");
+ this.getIslandConfig(location).save(this.islandConfigFile);
+ }
+ }
+ catch (IOException ex) {
+ this.getLogger().log(Level.SEVERE, "Could not save config to " + this.islandConfigFile, ex);
+ }
+ }
+
+ public void reloadLastIslandConfig() {
+ if (this.lastIslandConfigFile == null) {
+ this.lastIslandConfigFile = new File(this.getDataFolder(), "lastIslandConfig.yml");
+ }
+ this.lastIslandConfig = (FileConfiguration)YamlConfiguration.loadConfiguration(this.lastIslandConfigFile);
+ final InputStream defConfigStream = this.getResource("lastIslandConfig.yml");
+ if (defConfigStream != null) {
+ final YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ this.lastIslandConfig.setDefaults((Configuration)defConfig);
+ }
+ }
+
+ public FileConfiguration getLastIslandConfig() {
+ if (this.lastIslandConfig == null) {
+ this.reloadLastIslandConfig();
+ }
+ return this.lastIslandConfig;
+ }
+
+ public void saveLastIslandConfig() {
+ if (this.lastIslandConfig == null || this.lastIslandConfigFile == null) {
+ return;
+ }
+ try {
+ this.getLastIslandConfig().save(this.lastIslandConfigFile);
+ }
+ catch (IOException ex) {
+ this.getLogger().log(Level.SEVERE, "Could not save config to " + this.lastIslandConfigFile, ex);
+ }
+ }
+
+ public void saveDefaultLastIslandConfig() {
+ if (this.lastIslandConfigFile == null) {
+ this.lastIslandConfigFile = new File(this.getDataFolder(), "lastIslandConfig.yml");
+ }
+ if (!this.lastIslandConfigFile.exists()) {
+ getInstance().saveResource("lastIslandConfig.yml", false);
+ }
+ }
+
+ public void reloadOrphans() {
+ if (this.orphanFile == null) {
+ this.orphanFile = new File(this.getDataFolder(), "orphans.yml");
+ }
+ this.orphans = (FileConfiguration)YamlConfiguration.loadConfiguration(this.orphanFile);
+ final InputStream defConfigStream = this.getResource("orphans.yml");
+ if (defConfigStream != null) {
+ final YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ this.orphans.setDefaults((Configuration)defConfig);
+ }
+ }
+
+ public FileConfiguration getOrphans() {
+ if (this.orphans == null) {
+ this.reloadOrphans();
+ }
+ return this.orphans;
+ }
+
+ public void saveOrphansFile() {
+ if (this.orphans == null || this.orphanFile == null) {
+ return;
+ }
+ try {
+ this.getOrphans().save(this.orphanFile);
+ }
+ catch (IOException ex) {
+ this.getLogger().log(Level.SEVERE, "Could not save config to " + this.orphanFile, ex);
+ }
+ }
+
+ public void saveDefaultOrphans() {
+ if (this.orphanFile == null) {
+ this.orphanFile = new File(this.getDataFolder(), "orphans.yml");
+ }
+ if (!this.orphanFile.exists()) {
+ getInstance().saveResource("orphans.yml", false);
+ }
+ }
+
+ public boolean setBiome(final Location loc, final String bName) {
+ final int px = loc.getBlockX();
+ final int pz = loc.getBlockZ();
+ Biome bType = Biome.OCEAN;
+ if (bName.equalsIgnoreCase("jungle")) {
+ bType = Biome.JUNGLE;
+ }
+ else if (bName.equalsIgnoreCase("hell")) {
+ bType = Biome.HELL;
+ }
+ else if (bName.equalsIgnoreCase("sky")) {
+ bType = Biome.SKY;
+ }
+ else if (bName.equalsIgnoreCase("mushroom")) {
+ bType = Biome.MUSHROOM_ISLAND;
+ }
+ else if (bName.equalsIgnoreCase("ocean")) {
+ bType = Biome.OCEAN;
+ }
+ else if (bName.equalsIgnoreCase("swampland")) {
+ bType = Biome.SWAMPLAND;
+ }
+ else if (bName.equalsIgnoreCase("taiga")) {
+ bType = Biome.TAIGA;
+ }
+ else if (bName.equalsIgnoreCase("desert")) {
+ bType = Biome.DESERT;
+ }
+ else if (bName.equalsIgnoreCase("forest")) {
+ bType = Biome.FOREST;
+ }
+ else {
+ bType = Biome.OCEAN;
+ }
+ for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
+ for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
+ getSkyBlockWorld().loadChunk((px + x) / 16, (pz + z) / 16);
+ }
+ }
+ for (int x = Settings.island_protectionRange / 2 * -1; x <= Settings.island_protectionRange / 2; ++x) {
+ for (int z = Settings.island_protectionRange / 2 * -1; z <= Settings.island_protectionRange / 2; ++z) {
+ getSkyBlockWorld().setBiome(px + x, pz + z, bType);
+ }
+ }
+ for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
+ for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
+ getSkyBlockWorld().refreshChunk((px + x) / 16, (pz + z) / 16);
+ }
+ }
+ return bType != Biome.OCEAN;
+ }
+
+ public boolean changePlayerBiome(final Player player, final String bName) {
+ if (!VaultHandler.checkPerk(player.getName(), "usb.biome." + bName, player.getWorld())) {
+ return false;
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + player.getName() + ".canChangeBiome")) {
+ this.setBiome(getInstance().getActivePlayers().get(player.getName()).getIslandLocation(), bName);
+ this.setConfigBiome(player, bName);
+ return true;
+ }
+ return false;
+ }
+
+ public void listBiomes(final Player player) {
+ String biomeList = ", ";
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.ocean", getSkyBlockWorld())) {
+ biomeList = "OCEAN, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.forest", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "FOREST, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.jungle", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "JUNGLE, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.desert", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "DESERT, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.taiga", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "TAIGA, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.swampland", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "SWAMPLAND, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.mushroom", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "MUSHROOM, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.hell", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "HELL, ";
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.sky", getSkyBlockWorld())) {
+ biomeList = String.valueOf(biomeList) + "SKY, ";
+ }
+ player.sendMessage(ChatColor.YELLOW + "You have access to the following Biomes:");
+ player.sendMessage(ChatColor.GREEN + biomeList.substring(0, biomeList.length() - 2));
+ player.sendMessage(ChatColor.YELLOW + "Use /island biome to change your biome. You must wait " + Settings.general_biomeChange / 60 + " minutes between each biome change.");
+ }
+
+ public boolean createIsland(final CommandSender sender, final PlayerInfo pi) {
+ System.out.println("Creating player island...");
+ final Player player = (Player)sender;
+ final Location last = getInstance().getLastIsland();
+ last.setY((double)Settings.island_height);
+ try {
+ while (getInstance().hasOrphanedIsland()) {
+ if (!getInstance().islandAtLocation(getInstance().checkOrphan())) {
+ break;
+ }
+ getInstance().removeNextOrphan();
+ }
+ while (getInstance().hasOrphanedIsland() && !getInstance().checkOrphan().getWorld().getName().equalsIgnoreCase(Settings.general_worldName)) {
+ getInstance().removeNextOrphan();
+ }
+ Location next;
+ if (getInstance().hasOrphanedIsland() && !getInstance().islandAtLocation(getInstance().checkOrphan())) {
+ next = getInstance().getOrphanedIsland();
+ getInstance().saveOrphans();
+ }
+ else {
+ next = this.nextIslandLocation(last);
+ getInstance().setLastIsland(next);
+ while (getInstance().islandAtLocation(next)) {
+ next = this.nextIslandLocation(next);
+ }
+ while (getInstance().islandInSpawn(next)) {
+ next = this.nextIslandLocation(next);
+ }
+ getInstance().setLastIsland(next);
+ }
+ boolean hasIslandNow = false;
+ if (getInstance().getSchemFile().length > 0 && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldEdit")) {
+ String cSchem = "";
+ for (int i = 0; i < getInstance().getSchemFile().length; ++i) {
+ if (!hasIslandNow) {
+ if (getInstance().getSchemFile()[i].getName().lastIndexOf(46) > 0) {
+ cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf(46));
+ }
+ else {
+ cSchem = getInstance().getSchemFile()[i].getName();
+ }
+ if (VaultHandler.checkPerk(player.getName(), "usb.schematic." + cSchem, getSkyBlockWorld()) && WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next)) {
+ this.setChest(next, player);
+ hasIslandNow = true;
+ }
+ }
+ }
+ if (!hasIslandNow) {
+ for (int i = 0; i < getInstance().getSchemFile().length; ++i) {
+ if (getInstance().getSchemFile()[i].getName().lastIndexOf(46) > 0) {
+ cSchem = getInstance().getSchemFile()[i].getName().substring(0, getInstance().getSchemFile()[i].getName().lastIndexOf(46));
+ }
+ else {
+ cSchem = getInstance().getSchemFile()[i].getName();
+ }
+ if (cSchem.equalsIgnoreCase(Settings.island_schematicName) && WorldEditHandler.loadIslandSchematic(getSkyBlockWorld(), getInstance().getSchemFile()[i], next)) {
+ this.setChest(next, player);
+ hasIslandNow = true;
+ }
+ }
+ }
+ }
+ if (!hasIslandNow) {
+ if (!Settings.island_useOldIslands) {
+ this.generateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
+ }
+ else {
+ this.oldGenerateIslandBlocks(next.getBlockX(), next.getBlockZ(), player, getSkyBlockWorld());
+ }
+ }
+ next.setY((double)Settings.island_height);
+ System.out.println(next.getBlockY());
+ System.out.println("Preparing to set new player information...");
+ this.setNewPlayerIsland(player, next);
+ System.out.println("Finished setting new player information.");
+ player.getInventory().clear();
+ player.getEquipment().clear();
+ System.out.println("Preparing to set initial player biome...");
+ getInstance().changePlayerBiome(player, "OCEAN");
+ System.out.println("Finished setting initial player biome.");
+ for (int x = Settings.island_protectionRange / 2 * -1 - 16; x <= Settings.island_protectionRange / 2 + 16; x += 16) {
+ for (int z = Settings.island_protectionRange / 2 * -1 - 16; z <= Settings.island_protectionRange / 2 + 16; z += 16) {
+ getSkyBlockWorld().refreshChunk((next.getBlockX() + x) / 16, (next.getBlockZ() + z) / 16);
+ }
+ }
+ for (final Entity tempent : player.getNearbyEntities(50.0, 250.0, 50.0)) {
+ if (!(tempent instanceof Player)) {
+ tempent.remove();
+ }
+ }
+ if (Settings.island_protectWithWorldGuard && Bukkit.getServer().getPluginManager().isPluginEnabled("WorldGuard")) {
+ WorldGuardHandler.protectIsland(player, sender.getName(), pi);
+ }
+ }
+ catch (Exception ex) {
+ player.sendMessage("Could not create your Island. Pleace contact a server moderator.");
+ ex.printStackTrace();
+ return false;
+ }
+ System.out.println("Finished creating player island.");
+ return true;
+ }
+
+ public void generateIslandBlocks(final int x, final int z, final Player player, final World world) {
+ final int y = Settings.island_height;
+ final Block blockToChange = world.getBlockAt(x, y, z);
+ blockToChange.setTypeId(7);
+ this.islandLayer1(x, z, player, world);
+ this.islandLayer2(x, z, player, world);
+ this.islandLayer3(x, z, player, world);
+ this.islandLayer4(x, z, player, world);
+ this.islandExtras(x, z, player, world);
+ }
+
+ public void oldGenerateIslandBlocks(final int x, final int z, final Player player, final World world) {
+ final int y = Settings.island_height;
+ for (int x_operate = x; x_operate < x + 3; ++x_operate) {
+ for (int y_operate = y; y_operate < y + 3; ++y_operate) {
+ for (int z_operate = z; z_operate < z + 6; ++z_operate) {
+ final Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
+ blockToChange.setTypeId(2);
+ }
+ }
+ }
+ for (int x_operate = x + 3; x_operate < x + 6; ++x_operate) {
+ for (int y_operate = y; y_operate < y + 3; ++y_operate) {
+ for (int z_operate = z + 3; z_operate < z + 6; ++z_operate) {
+ final Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
+ blockToChange.setTypeId(2);
+ }
+ }
+ }
+ for (int x_operate = x + 3; x_operate < x + 7; ++x_operate) {
+ for (int y_operate = y + 7; y_operate < y + 10; ++y_operate) {
+ for (int z_operate = z + 3; z_operate < z + 7; ++z_operate) {
+ final Block blockToChange = world.getBlockAt(x_operate, y_operate, z_operate);
+ blockToChange.setTypeId(18);
+ }
+ }
+ }
+ for (int y_operate2 = y + 3; y_operate2 < y + 9; ++y_operate2) {
+ final Block blockToChange2 = world.getBlockAt(x + 5, y_operate2, z + 5);
+ blockToChange2.setTypeId(17);
+ }
+ Block blockToChange3 = world.getBlockAt(x + 1, y + 3, z + 1);
+ blockToChange3.setTypeId(54);
+ final Chest chest = (Chest)blockToChange3.getState();
+ final Inventory inventory = chest.getInventory();
+ inventory.clear();
+ inventory.setContents(Settings.island_chestItems);
+ if (Settings.island_addExtraItems) {
+ for (int i = 0; i < Settings.island_extraPermissions.length; ++i) {
+ if (VaultHandler.checkPerk(player.getName(), "usb." + Settings.island_extraPermissions[i], player.getWorld())) {
+ final String[] chestItemString = getInstance().getConfig().getString("options.island.extraPermissions." + Settings.island_extraPermissions[i]).split(" ");
+ final ItemStack[] tempChest = new ItemStack[chestItemString.length];
+ String[] amountdata = new String[2];
+ for (int j = 0; j < chestItemString.length; ++j) {
+ amountdata = chestItemString[j].split(":");
+ tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
+ inventory.addItem(new ItemStack[] { tempChest[j] });
+ }
+ }
+ }
+ }
+ blockToChange3 = world.getBlockAt(x, y, z);
+ blockToChange3.setTypeId(7);
+ blockToChange3 = world.getBlockAt(x + 2, y + 1, z + 1);
+ blockToChange3.setTypeId(12);
+ blockToChange3 = world.getBlockAt(x + 2, y + 1, z + 2);
+ blockToChange3.setTypeId(12);
+ blockToChange3 = world.getBlockAt(x + 2, y + 1, z + 3);
+ blockToChange3.setTypeId(12);
+ }
+
+ private Location nextIslandLocation(final Location lastIsland) {
+ final int x = (int)lastIsland.getX();
+ final int z = (int)lastIsland.getZ();
+ if (x < z) {
+ if (-1 * x < z) {
+ lastIsland.setX(lastIsland.getX() + Settings.island_distance);
+ return lastIsland;
+ }
+ lastIsland.setZ(lastIsland.getZ() + Settings.island_distance);
+ return lastIsland;
+ }
+ else if (x > z) {
+ if (-1 * x >= z) {
+ lastIsland.setX(lastIsland.getX() - Settings.island_distance);
+ return lastIsland;
+ }
+ lastIsland.setZ(lastIsland.getZ() - Settings.island_distance);
+ return lastIsland;
+ }
+ else {
+ if (x <= 0) {
+ lastIsland.setZ(lastIsland.getZ() + Settings.island_distance);
+ return lastIsland;
+ }
+ lastIsland.setZ(lastIsland.getZ() - Settings.island_distance);
+ return lastIsland;
+ }
+ }
+
+ private void islandLayer1(final int x, final int z, final Player player, final World world) {
+ int y = Settings.island_height;
+ y = Settings.island_height + 4;
+ for (int x_operate = x - 3; x_operate <= x + 3; ++x_operate) {
+ for (int z_operate = z - 3; z_operate <= z + 3; ++z_operate) {
+ final Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
+ blockToChange.setTypeId(2);
+ }
+ }
+ Block blockToChange2 = world.getBlockAt(x - 3, y, z + 3);
+ blockToChange2.setTypeId(0);
+ blockToChange2 = world.getBlockAt(x - 3, y, z - 3);
+ blockToChange2.setTypeId(0);
+ blockToChange2 = world.getBlockAt(x + 3, y, z - 3);
+ blockToChange2.setTypeId(0);
+ blockToChange2 = world.getBlockAt(x + 3, y, z + 3);
+ blockToChange2.setTypeId(0);
+ }
+
+ private void islandLayer2(final int x, final int z, final Player player, final World world) {
+ int y = Settings.island_height;
+ y = Settings.island_height + 3;
+ for (int x_operate = x - 2; x_operate <= x + 2; ++x_operate) {
+ for (int z_operate = z - 2; z_operate <= z + 2; ++z_operate) {
+ final Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
+ blockToChange.setTypeId(3);
+ }
+ }
+ Block blockToChange2 = world.getBlockAt(x - 3, y, z);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x + 3, y, z);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x, y, z - 3);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x, y, z + 3);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x, y, z);
+ blockToChange2.setTypeId(12);
+ }
+
+ private void islandLayer3(final int x, final int z, final Player player, final World world) {
+ int y = Settings.island_height;
+ y = Settings.island_height + 2;
+ for (int x_operate = x - 1; x_operate <= x + 1; ++x_operate) {
+ for (int z_operate = z - 1; z_operate <= z + 1; ++z_operate) {
+ final Block blockToChange = world.getBlockAt(x_operate, y, z_operate);
+ blockToChange.setTypeId(3);
+ }
+ }
+ Block blockToChange2 = world.getBlockAt(x - 2, y, z);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x + 2, y, z);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x, y, z - 2);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x, y, z + 2);
+ blockToChange2.setTypeId(3);
+ blockToChange2 = world.getBlockAt(x, y, z);
+ blockToChange2.setTypeId(12);
+ }
+
+ private void islandLayer4(final int x, final int z, final Player player, final World world) {
+ int y = Settings.island_height;
+ y = Settings.island_height + 1;
+ Block blockToChange = world.getBlockAt(x - 1, y, z);
+ blockToChange.setTypeId(3);
+ blockToChange = world.getBlockAt(x + 1, y, z);
+ blockToChange.setTypeId(3);
+ blockToChange = world.getBlockAt(x, y, z - 1);
+ blockToChange.setTypeId(3);
+ blockToChange = world.getBlockAt(x, y, z + 1);
+ blockToChange.setTypeId(3);
+ blockToChange = world.getBlockAt(x, y, z);
+ blockToChange.setTypeId(12);
+ }
+
+ private void islandExtras(final int x, final int z, final Player player, final World world) {
+ int y = Settings.island_height;
+ Block blockToChange = world.getBlockAt(x, y + 5, z);
+ blockToChange.setTypeId(17);
+ blockToChange = world.getBlockAt(x, y + 6, z);
+ blockToChange.setTypeId(17);
+ blockToChange = world.getBlockAt(x, y + 7, z);
+ blockToChange.setTypeId(17);
+ y = Settings.island_height + 8;
+ for (int x_operate = x - 2; x_operate <= x + 2; ++x_operate) {
+ for (int z_operate = z - 2; z_operate <= z + 2; ++z_operate) {
+ blockToChange = world.getBlockAt(x_operate, y, z_operate);
+ blockToChange.setTypeId(18);
+ }
+ }
+ blockToChange = world.getBlockAt(x + 2, y, z + 2);
+ blockToChange.setTypeId(0);
+ blockToChange = world.getBlockAt(x + 2, y, z - 2);
+ blockToChange.setTypeId(0);
+ blockToChange = world.getBlockAt(x - 2, y, z + 2);
+ blockToChange.setTypeId(0);
+ blockToChange = world.getBlockAt(x - 2, y, z - 2);
+ blockToChange.setTypeId(0);
+ blockToChange = world.getBlockAt(x, y, z);
+ blockToChange.setTypeId(17);
+ y = Settings.island_height + 9;
+ for (int x_operate = x - 1; x_operate <= x + 1; ++x_operate) {
+ for (int z_operate = z - 1; z_operate <= z + 1; ++z_operate) {
+ blockToChange = world.getBlockAt(x_operate, y, z_operate);
+ blockToChange.setTypeId(18);
+ }
+ }
+ blockToChange = world.getBlockAt(x - 2, y, z);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x + 2, y, z);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, y, z - 2);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, y, z + 2);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, y, z);
+ blockToChange.setTypeId(17);
+ y = Settings.island_height + 10;
+ blockToChange = world.getBlockAt(x - 1, y, z);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x + 1, y, z);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, y, z - 1);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, y, z + 1);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, y, z);
+ blockToChange.setTypeId(17);
+ blockToChange = world.getBlockAt(x, y + 1, z);
+ blockToChange.setTypeId(18);
+ blockToChange = world.getBlockAt(x, Settings.island_height + 5, z + 1);
+ blockToChange.setTypeId(54);
+ final Chest chest = (Chest)blockToChange.getState();
+ final Inventory inventory = chest.getInventory();
+ inventory.clear();
+ inventory.setContents(Settings.island_chestItems);
+ if (Settings.island_addExtraItems) {
+ for (int i = 0; i < Settings.island_extraPermissions.length; ++i) {
+ if (VaultHandler.checkPerk(player.getName(), "usb." + Settings.island_extraPermissions[i], player.getWorld())) {
+ final String[] chestItemString = getInstance().getConfig().getString("options.island.extraPermissions." + Settings.island_extraPermissions[i]).split(" ");
+ final ItemStack[] tempChest = new ItemStack[chestItemString.length];
+ String[] amountdata = new String[2];
+ for (int j = 0; j < chestItemString.length; ++j) {
+ amountdata = chestItemString[j].split(":");
+ tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
+ inventory.addItem(new ItemStack[] { tempChest[j] });
+ }
+ }
+ }
+ }
+ }
+
+ public void setChest(final Location loc, final Player player) {
+ for (int x = -15; x <= 15; ++x) {
+ for (int y = -15; y <= 15; ++y) {
+ for (int z = -15; z <= 15; ++z) {
+ if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 54) {
+ final Block blockToChange = getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z);
+ final Chest chest = (Chest)blockToChange.getState();
+ final Inventory inventory = chest.getInventory();
+ inventory.clear();
+ inventory.setContents(Settings.island_chestItems);
+ if (Settings.island_addExtraItems) {
+ for (int i = 0; i < Settings.island_extraPermissions.length; ++i) {
+ if (VaultHandler.checkPerk(player.getName(), "usb." + Settings.island_extraPermissions[i], player.getWorld())) {
+ final String[] chestItemString = getInstance().getConfig().getString("options.island.extraPermissions." + Settings.island_extraPermissions[i]).split(" ");
+ final ItemStack[] tempChest = new ItemStack[chestItemString.length];
+ String[] amountdata = new String[2];
+ for (int j = 0; j < chestItemString.length; ++j) {
+ amountdata = chestItemString[j].split(":");
+ tempChest[j] = new ItemStack(Integer.parseInt(amountdata[0]), Integer.parseInt(amountdata[1]));
+ inventory.addItem(new ItemStack[] { tempChest[j] });
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ public Location getChestSpawnLoc(final Location loc, final Player player) {
+ for (int x = -15; x <= 15; ++x) {
+ for (int y = -15; y <= 15; ++y) {
+ int z = -15;
+ while (z <= 15) {
+ if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 54) {
+ if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + (z + 1)).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + (y - 1), loc.getBlockZ() + (z + 1)).getTypeId() != 0) {
+ return new Location(getSkyBlockWorld(), (double)(loc.getBlockX() + x), (double)(loc.getBlockY() + (y + 1)), (double)(loc.getBlockZ() + (z + 1)));
+ }
+ if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + y, loc.getBlockZ() + (z - 1)).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + x, loc.getBlockY() + (y - 1), loc.getBlockZ() + (z - 1)).getTypeId() != 0) {
+ return new Location(getSkyBlockWorld(), (double)(loc.getBlockX() + x), (double)(loc.getBlockY() + (y + 1)), (double)(loc.getBlockZ() + (z + 1)));
+ }
+ if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x + 1), loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x + 1), loc.getBlockY() + (y - 1), loc.getBlockZ() + z).getTypeId() != 0) {
+ return new Location(getSkyBlockWorld(), (double)(loc.getBlockX() + x), (double)(loc.getBlockY() + (y + 1)), (double)(loc.getBlockZ() + (z + 1)));
+ }
+ if (getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x - 1), loc.getBlockY() + y, loc.getBlockZ() + z).getTypeId() == 0 && getSkyBlockWorld().getBlockAt(loc.getBlockX() + (x - 1), loc.getBlockY() + (y - 1), loc.getBlockZ() + z).getTypeId() != 0) {
+ return new Location(getSkyBlockWorld(), (double)(loc.getBlockX() + x), (double)(loc.getBlockY() + (y + 1)), (double)(loc.getBlockZ() + (z + 1)));
+ }
+ loc.setY(loc.getY() + 1.0);
+ return loc;
+ }
+ else {
+ ++z;
+ }
+ }
+ }
+ }
+ return loc;
+ }
+
+ private void setNewPlayerIsland(final Player player, final Location loc) {
+ getInstance().getActivePlayers().get(player.getName()).startNewIsland(loc);
+ player.teleport(this.getChestSpawnLoc(loc, player));
+ if (this.getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()) == null) {
+ this.createIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty(), player.getName());
+ }
+ this.clearIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty(), player.getName());
+ getInstance().updatePartyNumber(player);
+ getInstance().homeSet(player);
+ getInstance().getActivePlayers().get(player.getName()).savePlayerConfig(player.getName());
+ }
+
+ public void setWarpLocation(final String location, final Location loc) {
+ this.getIslandConfig(location).set("general.warpLocationX", (Object)loc.getBlockX());
+ this.getIslandConfig(location).set("general.warpLocationY", (Object)loc.getBlockY());
+ this.getIslandConfig(location).set("general.warpLocationZ", (Object)loc.getBlockZ());
+ this.getIslandConfig(location).set("general.warpActive", (Object)true);
+ this.saveIslandConfig(location);
+ }
+
+ public void buildIslandList() {
+ final File folder = getInstance().directoryPlayers;
+ final File[] listOfFiles = folder.listFiles();
+ System.out.print(ChatColor.YELLOW + "[uSkyBlock] Building a new island list...");
+ for (int i = 0; i < listOfFiles.length; ++i) {
+ final PlayerInfo pi = new PlayerInfo(listOfFiles[i].getName());
+ if (pi.getHasIsland()) {
+ System.out.print("Creating new island file for " + pi.getPlayerName());
+ this.createIslandConfig(pi.locationForParty(), pi.getPlayerName());
+ this.saveIslandConfig(pi.locationForParty());
+ }
+ }
+ for (int i = 0; i < listOfFiles.length; ++i) {
+ final PlayerInfo pi = new PlayerInfo(listOfFiles[i].getName());
+ if (!pi.getHasIsland() && pi.getPartyIslandLocation() != null && this.getTempIslandConfig(pi.locationForPartyOld()) != null && !this.getTempIslandConfig(pi.locationForPartyOld()).contains("party.members." + pi.getPlayerName())) {
+ this.setupPartyMember(pi.locationForPartyOld(), pi.getPlayerName());
+ this.saveIslandConfig(pi.locationForParty());
+ }
+ }
+ System.out.print(ChatColor.YELLOW + "[uSkyBlock] Party list completed.");
+ }
+
+ public void removeIslandConfig(final String location) {
+ this.islands.remove(location);
+ }
+
+ public void displayIslandConfigs() {
+ final Iterator islandList = this.islands.keySet().iterator();
+ while (islandList.hasNext()) {
+ System.out.print(islandList.next());
+ }
+ }
+
+ public void updatePartyNumber(final Player player) {
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize") < 8 && VaultHandler.checkPerk(player.getName(), "usb.extra.partysize", player.getWorld())) {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).set("party.maxSize", (Object)8);
+ getInstance().saveIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty());
+ return;
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize") < 7 && VaultHandler.checkPerk(player.getName(), "usb.extra.party3", player.getWorld())) {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).set("party.maxSize", (Object)7);
+ getInstance().saveIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty());
+ return;
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize") < 6 && VaultHandler.checkPerk(player.getName(), "usb.extra.party2", player.getWorld())) {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).set("party.maxSize", (Object)6);
+ getInstance().saveIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty());
+ return;
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize") < 5 && VaultHandler.checkPerk(player.getName(), "usb.extra.party1", player.getWorld())) {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).set("party.maxSize", (Object)5);
+ getInstance().saveIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty());
+ }
+ }
+
+ public void changePlayerPermission(final Player player, final String playername, final String perm) {
+ if (!getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).contains("party.members." + playername + "." + perm)) {
+ return;
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + playername + "." + perm)) {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).set("party.members." + playername + "." + perm, (Object)false);
+ }
+ else {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).set("party.members." + playername + "." + perm, (Object)true);
+ }
+ getInstance().saveIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty());
+ }
+
+ public boolean checkForOnlineMembers(final Player p) {
+ for (final String tString : getInstance().getIslandConfig(getInstance().getActivePlayers().get(p.getName()).locationForParty()).getConfigurationSection("party.members").getKeys(false)) {
+ if (Bukkit.getPlayer(tString) != null && !Bukkit.getPlayer(tString).getName().equalsIgnoreCase(p.getName())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public boolean checkCurrentBiome(final Player p, final String biome) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(p.getName()).locationForParty()).getString("general.biome").equalsIgnoreCase(biome);
+ }
+
+ public void setConfigBiome(final Player p, final String biome) {
+ getInstance().getIslandConfig(getInstance().getActivePlayers().get(p.getName()).locationForParty()).set("general.biome", (Object)biome);
+ getInstance().saveIslandConfig(getInstance().getActivePlayers().get(p.getName()).locationForParty());
+ }
+
+ public Inventory displayPartyPlayerGUI(final Player player, final String pname) {
+ this.GUIpartyPlayer = Bukkit.createInventory((InventoryHolder)null, 9, String.valueOf(pname) + " ");
+ final ItemStack pHead = new ItemStack(397, 1, (short)3);
+ final SkullMeta meta3 = (SkullMeta)pHead.getItemMeta();
+ ItemMeta meta2 = this.sign.getItemMeta();
+ meta2.setDisplayName("�hPlayer Permissions");
+ this.lores.add("�eClick here to return to");
+ this.lores.add("�eyour island group's info.");
+ meta2.setLore((List)this.lores);
+ this.sign.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.sign });
+ this.lores.clear();
+ meta3.setDisplayName(String.valueOf(pname) + "'s Permissions");
+ this.lores.add("�eHover over an icon to view");
+ this.lores.add("�ea permission. Change the");
+ this.lores.add("�epermission by clicking it.");
+ meta3.setLore((List)this.lores);
+ pHead.setItemMeta((ItemMeta)meta3);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { pHead });
+ this.lores.clear();
+ meta2 = this.biome.getItemMeta();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + pname + ".canChangeBiome")) {
+ meta2.setDisplayName("�aChange Biome");
+ this.lores.add("�fThis player �acan�f change the");
+ this.lores.add("�fisland's biome. Click here");
+ this.lores.add("�fto remove this permission.");
+ }
+ else {
+ meta2.setDisplayName("�cChange Biome");
+ this.lores.add("�fThis player �ccannot�f change the");
+ this.lores.add("�fisland's biome. Click here");
+ this.lores.add("�fto grant this permission.");
+ }
+ meta2.setLore((List)this.lores);
+ this.biome.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.biome });
+ this.lores.clear();
+ meta2 = this.lock.getItemMeta();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + pname + ".canToggleLock")) {
+ meta2.setDisplayName("�aToggle Island Lock");
+ this.lores.add("�fThis player �acan�f toggle the");
+ this.lores.add("�fisland's lock, which prevents");
+ this.lores.add("�fnon-group members from entering.");
+ this.lores.add("�fClick here to remove this permission.");
+ }
+ else {
+ meta2.setDisplayName("�cToggle Island Lock");
+ this.lores.add("�fThis player �ccannot�f toggle the");
+ this.lores.add("�fisland's lock, which prevents");
+ this.lores.add("�fnon-group members from entering.");
+ this.lores.add("�fClick here to add this permission");
+ }
+ meta2.setLore((List)this.lores);
+ this.lock.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.lock });
+ this.lores.clear();
+ meta2 = this.warpset.getItemMeta();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + pname + ".canChangeWarp")) {
+ meta2.setDisplayName("�aSet Island Warp");
+ this.lores.add("�fThis player �acan�f set the");
+ this.lores.add("�fisland's warp, which allows");
+ this.lores.add("�fnon-group members to teleport");
+ this.lores.add("�fto the island. Click here to");
+ this.lores.add("�fremove this permission.");
+ }
+ else {
+ meta2.setDisplayName("�cSet Island Warp");
+ this.lores.add("�fThis player �ccannot�f set the");
+ this.lores.add("�fisland's warp, which allows");
+ this.lores.add("�fnon-group members to teleport");
+ this.lores.add("�fto the island. Click here to");
+ this.lores.add("�fadd this permission.");
+ }
+ meta2.setLore((List)this.lores);
+ this.warpset.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.warpset });
+ this.lores.clear();
+ meta2 = this.warptoggle.getItemMeta();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + pname + ".canToggleWarp")) {
+ meta2.setDisplayName("�aToggle Island Warp");
+ this.lores.add("�fThis player �acan�f toggle the");
+ this.lores.add("�fisland's warp, allowing them");
+ this.lores.add("�fto turn it on or off at anytime.");
+ this.lores.add("�fbut not set the location. Click");
+ this.lores.add("�fhere to remove this permission.");
+ }
+ else {
+ meta2.setDisplayName("�cToggle Island Warp");
+ this.lores.add("�fThis player �ccannot�f toggle the");
+ this.lores.add("�fisland's warp, allowing them");
+ this.lores.add("�fto turn it on or off at anytime,");
+ this.lores.add("�fbut not set the location. Click");
+ this.lores.add("�fhere to add this permission.");
+ }
+ meta2.setLore((List)this.lores);
+ this.warptoggle.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.warptoggle });
+ this.lores.clear();
+ meta2 = this.invite.getItemMeta();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + pname + ".canInviteOthers")) {
+ meta2.setDisplayName("�aInvite Players");
+ this.lores.add("�fThis player �acan�f invite");
+ this.lores.add("�fother players to the island if");
+ this.lores.add("�fthere is enough room for more");
+ this.lores.add("�fmembers. Click here to remove");
+ this.lores.add("�fthis permission.");
+ }
+ else {
+ meta2.setDisplayName("�cInvite Players");
+ this.lores.add("�fThis player �ccannot�f invite");
+ this.lores.add("�fother players to the island.");
+ this.lores.add("�fClick here to add this permission.");
+ }
+ meta2.setLore((List)this.lores);
+ this.invite.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.invite });
+ this.lores.clear();
+ meta2 = this.kick.getItemMeta();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + pname + ".canKickOthers")) {
+ meta2.setDisplayName("�aKick Players");
+ this.lores.add("�fThis player �acan�f kick");
+ this.lores.add("�fother players from the island,");
+ this.lores.add("�fbut they are unable to kick");
+ this.lores.add("�fthe island leader. Click here");
+ this.lores.add("�fto remove this permission.");
+ }
+ else {
+ meta2.setDisplayName("�cKick Players");
+ this.lores.add("�fThis player �ccannot�f kick");
+ this.lores.add("�fother players from the island.");
+ this.lores.add("�fClick here to add this permission.");
+ }
+ meta2.setLore((List)this.lores);
+ this.kick.setItemMeta(meta2);
+ this.GUIpartyPlayer.addItem(new ItemStack[] { this.kick });
+ this.lores.clear();
+ return this.GUIpartyPlayer;
+ }
+
+ public Inventory displayPartyGUI(final Player player) {
+ this.GUIparty = Bukkit.createInventory((InventoryHolder)null, 18, "�9Island Group Members");
+ final Set memberList = (Set)getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getConfigurationSection("party.members").getKeys(false);
+ this.tempIt = memberList.iterator();
+ final SkullMeta meta3 = (SkullMeta)this.pHead.getItemMeta();
+ final ItemMeta meta2 = this.sign.getItemMeta();
+ meta2.setDisplayName("�aGroup Info");
+ this.lores.add("Group Members: �2" + getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.currentSize") + "�7/�e" + getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize"));
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.currentSize") < getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize")) {
+ this.lores.add("�aMore players can be invited to this island.");
+ }
+ else {
+ this.lores.add("�cThis island is full.");
+ }
+ this.lores.add("�eHover over a player's icon to");
+ this.lores.add("�eview their permissions. The");
+ this.lores.add("�eleader can change permissions");
+ this.lores.add("�eby clicking a player's icon.");
+ meta2.setLore((List)this.lores);
+ this.sign.setItemMeta(meta2);
+ this.GUIparty.addItem(new ItemStack[] { this.sign });
+ this.lores.clear();
+ while (this.tempIt.hasNext()) {
+ final String temp = this.tempIt.next();
+ if (temp.equalsIgnoreCase(getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getString("party.leader"))) {
+ meta3.setDisplayName("�f" + temp);
+ this.lores.add("�a�lLeader");
+ this.lores.add("�aCan �fchange the island's biome.");
+ this.lores.add("�aCan �flock/unlock the island.");
+ this.lores.add("�aCan �fset the island's warp.");
+ this.lores.add("�aCan �ftoggle the island's warp.");
+ this.lores.add("�aCan �finvite others to the island.");
+ this.lores.add("�aCan �fkick others from the island.");
+ meta3.setLore((List)this.lores);
+ this.lores.clear();
+ }
+ else {
+ meta3.setDisplayName("�f" + temp);
+ this.lores.add("�e�lMember");
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + temp + ".canChangeBiome")) {
+ this.lores.add("�aCan �fchange the island's biome.");
+ }
+ else {
+ this.lores.add("�cCannot �fchange the island's biome.");
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + temp + ".canToggleLock")) {
+ this.lores.add("�aCan �flock/unlock the island.");
+ }
+ else {
+ this.lores.add("�cCannot �flock/unlock the island.");
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + temp + ".canChangeWarp")) {
+ this.lores.add("�aCan �fset the island's warp.");
+ }
+ else {
+ this.lores.add("�cCannot �fset the island's warp.");
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + temp + ".canToggleWarp")) {
+ this.lores.add("�aCan �ftoggle the island's warp.");
+ }
+ else {
+ this.lores.add("�cCannot �ftoggle the island's warp.");
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + temp + ".canInviteOthers")) {
+ this.lores.add("�aCan �finvite others to the island.");
+ }
+ else {
+ this.lores.add("�cCannot �finvite others to the island.");
+ }
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + temp + ".canKickOthers")) {
+ this.lores.add("�aCan �fkick others from the island.");
+ }
+ else {
+ this.lores.add("�cCannot �fkick others from the island.");
+ }
+ if (player.getName().equalsIgnoreCase(getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getString("party.leader"))) {
+ this.lores.add("�e");
+ }
+ meta3.setLore((List)this.lores);
+ this.lores.clear();
+ }
+ meta3.setOwner(temp);
+ this.pHead.setItemMeta((ItemMeta)meta3);
+ this.GUIparty.addItem(new ItemStack[] { this.pHead });
+ }
+ return this.GUIparty;
+ }
+
+ public Inventory displayLogGUI(final Player player) {
+ this.GUIlog = Bukkit.createInventory((InventoryHolder)null, 9, "�9Island Log");
+ ItemMeta meta4 = this.sign.getItemMeta();
+ meta4.setDisplayName("�lIsland Log");
+ this.lores.add("�eClick here to return to");
+ this.lores.add("�ethe main island screen.");
+ meta4.setLore((List)this.lores);
+ this.sign.setItemMeta(meta4);
+ this.GUIlog.addItem(new ItemStack[] { this.sign });
+ this.lores.clear();
+ this.currentLogItem = new ItemStack(Material.BOOK_AND_QUILL, 1);
+ meta4 = this.currentLogItem.getItemMeta();
+ meta4.setDisplayName("�e�lIsland Log");
+ for (int i = 1; i <= 10; ++i) {
+ if (getInstance().getIslandConfig(this.getActivePlayers().get(player.getName()).locationForParty()).contains("log." + i)) {
+ this.lores.add(getInstance().getIslandConfig(this.getActivePlayers().get(player.getName()).locationForParty()).getString("log." + i));
+ }
+ }
+ meta4.setLore((List)this.lores);
+ this.currentLogItem.setItemMeta(meta4);
+ this.GUIlog.setItem(8, this.currentLogItem);
+ this.lores.clear();
+ return this.GUIlog;
+ }
+
+ public Inventory displayBiomeGUI(final Player player) {
+ this.GUIbiome = Bukkit.createInventory((InventoryHolder)null, 18, "�9Island Biome");
+ ItemMeta meta4 = this.sign.getItemMeta();
+ meta4.setDisplayName("�hIsland Biome");
+ this.lores.add("�eClick here to return to");
+ this.lores.add("�ethe main island screen.");
+ meta4.setLore((List)this.lores);
+ this.sign.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.sign });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.WATER, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.ocean", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Ocean");
+ this.lores.add("�fThe ocean biome is the basic");
+ this.lores.add("�fstarting biome for all islands.");
+ this.lores.add("�fpassive mobs like animals will");
+ this.lores.add("�fnot spawn. Hostile mobs will");
+ this.lores.add("�fspawn normally.");
+ if (this.checkCurrentBiome(player, "OCEAN")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Ocean");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The ocean biome is the basic");
+ this.lores.add("�7starting biome for all islands.");
+ this.lores.add("�7passive mobs like animals will");
+ this.lores.add("�7not spawn. Hostile mobs will");
+ this.lores.add("�7spawn normally.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.SAPLING, 1, (short)1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.forst", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Forest");
+ this.lores.add("�fThe forest biome will allow");
+ this.lores.add("�fyour island to spawn passive.");
+ this.lores.add("�fmobs like animals (including");
+ this.lores.add("�fwolves). Hostile mobs will");
+ this.lores.add("�fspawn normally.");
+ if (this.checkCurrentBiome(player, "FOREST")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Forest");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The forest biome will allow");
+ this.lores.add("�7your island to spawn passive.");
+ this.lores.add("�7mobs like animals (including");
+ this.lores.add("�7wolves). Hostile mobs will");
+ this.lores.add("�7spawn normally.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.SAND, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.desert", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Desert");
+ this.lores.add("�fThe desert biome makes it so");
+ this.lores.add("�fthat there is no rain or snow");
+ this.lores.add("�fon your island. Passive mobs");
+ this.lores.add("�fwon't spawn. Hostile mobs will");
+ this.lores.add("�fspawn normally.");
+ if (this.checkCurrentBiome(player, "DESERT")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Desert");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The desert biome makes it so");
+ this.lores.add("�7that there is no rain or snow");
+ this.lores.add("�7on your island. Passive mobs");
+ this.lores.add("�7won't spawn. Hostile mobs will");
+ this.lores.add("�7spawn normally.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.SAPLING, 1, (short)3);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.jungle", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Jungle");
+ this.lores.add("�fThe jungle biome is bright");
+ this.lores.add("�fand colorful. Passive mobs");
+ this.lores.add("�f(including ocelots) will");
+ this.lores.add("�fspawn. Hostile mobs will");
+ this.lores.add("�fspawn normally.");
+ if (this.checkCurrentBiome(player, "JUNGLE")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Jungle");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The jungle biome is bright");
+ this.lores.add("�7and colorful. Passive mobs");
+ this.lores.add("�7(including ocelots) will");
+ this.lores.add("�7spawn. Hostile mobs will");
+ this.lores.add("�7spawn normally.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.WATER_LILY, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.swampland", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Swampland");
+ this.lores.add("�fThe swamp biome is dark");
+ this.lores.add("�fand dull. Passive mobs");
+ this.lores.add("�fwill spawn normally and");
+ this.lores.add("�fslimes have a small chance");
+ this.lores.add("�fto spawn at night depending");
+ this.lores.add("�fon the moon phase.");
+ if (this.checkCurrentBiome(player, "SWAMPLAND")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Swampland");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The swamp biome is dark");
+ this.lores.add("�7and dull. Passive mobs");
+ this.lores.add("�7will spawn normally and");
+ this.lores.add("�7slimes have a small chance");
+ this.lores.add("�7to spawn at night depending");
+ this.lores.add("�7on the moon phase.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.SNOW, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.taiga", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Taiga");
+ this.lores.add("�fThe taiga biome has snow");
+ this.lores.add("�finstead of rain. Passive");
+ this.lores.add("�fmobs will spawn normally");
+ this.lores.add("�f(including wolves) and");
+ this.lores.add("�fhostile mobs will spawn.");
+ if (this.checkCurrentBiome(player, "TAIGA")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Taiga");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The taiga biome has snow");
+ this.lores.add("�7instead of rain. Passive");
+ this.lores.add("�7mobs will spawn normally");
+ this.lores.add("�7(including wolves) and");
+ this.lores.add("�7hostile mobs will spawn.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.RED_MUSHROOM, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.mushroom", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Mushroom");
+ this.lores.add("�fThe mushroom biome is");
+ this.lores.add("�fbright and colorful.");
+ this.lores.add("�fMooshrooms are the only");
+ this.lores.add("�fmobs that will spawn.");
+ this.lores.add("�fNo other passive or");
+ this.lores.add("�fhostile mobs will spawn.");
+ if (this.checkCurrentBiome(player, "MUSHROOM")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Mushroom");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The mushroom biome is");
+ this.lores.add("�7bright and colorful.");
+ this.lores.add("�7Mooshrooms are the only");
+ this.lores.add("�7mobs that will spawn.");
+ this.lores.add("�7No other passive or");
+ this.lores.add("�7hostile mobs will spawn.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.FIRE, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.hell", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Hell(Nether)");
+ this.lores.add("�fThe hell biome looks");
+ this.lores.add("�fdark and dead. Some");
+ this.lores.add("�fmobs from the nether will");
+ this.lores.add("�fspawn in this biome");
+ this.lores.add("�f(excluding ghasts and");
+ this.lores.add("�fblazes).");
+ if (this.checkCurrentBiome(player, "HELL")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Hell(Nether)");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The hell biome looks");
+ this.lores.add("�7dark and dead. Some");
+ this.lores.add("�7mobs from the nether will");
+ this.lores.add("�7spawn in this biome");
+ this.lores.add("�7(excluding ghasts and");
+ this.lores.add("�7blazes).");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ this.currentBiomeItem = new ItemStack(Material.EYE_OF_ENDER, 1);
+ meta4 = this.currentBiomeItem.getItemMeta();
+ if (VaultHandler.checkPerk(player.getName(), "usb.biome.sky", player.getWorld())) {
+ meta4.setDisplayName("�aBiome: Sky(End)");
+ this.lores.add("�fThe sky biome gives your");
+ this.lores.add("�fisland a special dark sky.");
+ this.lores.add("�fOnly endermen will spawn");
+ this.lores.add("�fin this biome.");
+ if (this.checkCurrentBiome(player, "SKY")) {
+ this.lores.add("�2�lThis is your current biome.");
+ }
+ else {
+ this.lores.add("�e�lClick to change to this biome.");
+ }
+ }
+ else {
+ meta4.setDisplayName("�8Biome: Sky(End)");
+ this.lores.add("�cYou cannot use this biome.");
+ this.lores.add("�7The sky biome gives your");
+ this.lores.add("�7island a special dark sky.");
+ this.lores.add("�7Only endermen will spawn");
+ this.lores.add("�7in this biome.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentBiomeItem.setItemMeta(meta4);
+ this.GUIbiome.addItem(new ItemStack[] { this.currentBiomeItem });
+ this.lores.clear();
+ return this.GUIbiome;
+ }
+
+ public Inventory displayChallengeGUI(final Player player) {
+ this.GUIchallenge = Bukkit.createInventory((InventoryHolder)null, 36, "�9Challenge Menu");
+ final PlayerInfo pi = getInstance().getActivePlayers().get(player.getName());
+ this.populateChallengeRank(player, 0, Material.DIRT, 0, pi);
+ this.populateChallengeRank(player, 1, Material.IRON_BLOCK, 9, pi);
+ this.populateChallengeRank(player, 2, Material.GOLD_BLOCK, 18, pi);
+ this.populateChallengeRank(player, 3, Material.DIAMOND_BLOCK, 27, pi);
+ return this.GUIchallenge;
+ }
+
+ public Inventory displayIslandGUI(final Player player) {
+ this.GUIisland = Bukkit.createInventory((InventoryHolder)null, 18, "�9Island Menu");
+ if (this.hasIsland(player.getName())) {
+ this.currentIslandItem = new ItemStack(Material.ENDER_PORTAL, 1);
+ ItemMeta meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lReturn Home");
+ this.lores.add("�fReturn to your island's home");
+ this.lores.add("�fpoint. You can change your home");
+ this.lores.add("�fpoint to any location on your");
+ this.lores.add("�fisland using �b/island sethome");
+ this.lores.add("�e�lClick here to return home.");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.DIAMOND_ORE, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lChallenges");
+ this.lores.add("�fView a list of challenges that");
+ this.lores.add("�fyou can complete on your island");
+ this.lores.add("�fto earn skybucks, items, perks,");
+ this.lores.add("�fand titles.");
+ this.lores.add("�e�lClick here to view challenges.");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.EXP_BOTTLE, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lIsland Level");
+ this.lores.add("�eCurrent Level: �a" + this.showIslandLevel(player));
+ this.lores.add("�fGain island levels by expanding");
+ this.lores.add("�fyour skyblock and completing");
+ this.lores.add("�fcertain challenges. Rarer blocks");
+ this.lores.add("�fwill add more to your level.");
+ this.lores.add("�e�lClick here to refresh.");
+ this.lores.add("�e�l(must be on island)");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
+ final SkullMeta meta2 = (SkullMeta)this.currentIslandItem.getItemMeta();
+ meta2.setDisplayName("�a�lIsland Group");
+ this.lores.add("�eMembers: �2" + this.showCurrentMembers(player) + "/" + this.showMaxMembers(player));
+ this.lores.add("�fView the members of your island");
+ this.lores.add("�fgroup and their permissions. If");
+ this.lores.add("�fyou are the island leader, you");
+ this.lores.add("�fcan change the member permissions.");
+ this.lores.add("�e�lClick here to view or change.");
+ meta2.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta((ItemMeta)meta2);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.SAPLING, 1, (short)3);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lChange Island Biome");
+ this.lores.add("�eCurrent Biome: �b" + this.getCurrentBiome(player).toUpperCase());
+ this.lores.add("�fThe island biome affects things");
+ this.lores.add("�flike grass color and spawning");
+ this.lores.add("�fof both animals and monsters.");
+ if (this.checkIslandPermission(player, "canChangeBiome")) {
+ this.lores.add("�e�lClick here to change biomes.");
+ }
+ else {
+ this.lores.add("�c�lYou can't change the biome.");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.IRON_FENCE, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lIsland Lock");
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("general.locked")) {
+ this.lores.add("�eLock Status: �aActive");
+ this.lores.add("�fYour island is currently �clocked.");
+ this.lores.add("�fPlayers outside of your group");
+ this.lores.add("�fare unable to enter your island.");
+ if (this.checkIslandPermission(player, "canToggleLock")) {
+ this.lores.add("�e�lClick here to unlock your island.");
+ }
+ else {
+ this.lores.add("�c�lYou can't change the lock.");
+ }
+ }
+ else {
+ this.lores.add("�eLock Status: �8Inactive");
+ this.lores.add("�fYour island is currently �aunlocked.");
+ this.lores.add("�fAll players are able to enter your");
+ this.lores.add("�fisland, but only you and your group");
+ this.lores.add("�fmembers may build there.");
+ if (this.checkIslandPermission(player, "canToggleLock")) {
+ this.lores.add("�e�lClick here to lock your island.");
+ }
+ else {
+ this.lores.add("�c�lYou can't change the lock.");
+ }
+ }
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ if (getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("general.warpActive")) {
+ this.currentIslandItem = new ItemStack(Material.PORTAL, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lIsland Warp");
+ this.lores.add("�eWarp Status: �aActive");
+ this.lores.add("�fOther players may warp to your");
+ this.lores.add("�fisland at anytime to the point");
+ this.lores.add("�fyou set using �d/island setwarp.");
+ if (this.checkIslandPermission(player, "canToggleWarp") && VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", getSkyBlockWorld())) {
+ this.lores.add("�e�lClick here to deactivate.");
+ }
+ else {
+ this.lores.add("�c�lYou can't change the warp.");
+ }
+ }
+ else {
+ this.currentIslandItem = new ItemStack(Material.ENDER_STONE, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lIsland Warp");
+ this.lores.add("�eWarp Status: �8Inactive");
+ this.lores.add("�fOther players can't warp to your");
+ this.lores.add("�fisland. Set a warp point using");
+ this.lores.add("�d/island setwarp �fbefore activating.");
+ if (this.checkIslandPermission(player, "canToggleWarp") && VaultHandler.checkPerk(player.getName(), "usb.extra.addwarp", getSkyBlockWorld())) {
+ this.lores.add("�e�lClick here to activate.");
+ }
+ else {
+ this.lores.add("�c�lYou can't change the warp.");
+ }
+ }
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.CHEST, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lBuy Perks");
+ this.lores.add("�fVisit the perk shop to buy");
+ this.lores.add("�fspecial abilities for your");
+ this.lores.add("�fisland and character, as well");
+ this.lores.add("�fas titles and more.");
+ this.lores.add("�e�lClick here to open the shop!");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.ENDER_CHEST, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lBuy Donor Perks");
+ this.lores.add("�fThis special perk shop is");
+ this.lores.add("�fonly available to donors!");
+ if (VaultHandler.checkPerk(player.getName(), "group.donor", player.getWorld())) {
+ this.lores.add("�e�lClick here to open the shop!");
+ }
+ else {
+ this.lores.add("�a�lClick here to become a donor!");
+ }
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.setItem(16, this.currentIslandItem);
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.BOOK_AND_QUILL, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lIsland Log");
+ this.lores.add("�fView a log of events from");
+ this.lores.add("�fyour island such as member,");
+ this.lores.add("�fbiome, and warp changes.");
+ this.lores.add("�e�lClick to view the log.");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.BED, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lChange Home Location");
+ this.lores.add("�fWhen you teleport to your");
+ this.lores.add("�fisland you will be taken to");
+ this.lores.add("�fthis location.");
+ this.lores.add("�e�lClick here to change.");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.HOPPER, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lChange Warp Location");
+ this.lores.add("�fWhen your warp is activated,");
+ this.lores.add("�fother players will be taken to");
+ this.lores.add("�fthis point when they teleport");
+ this.lores.add("�fto your island.");
+ this.lores.add("�e�lClick here to change.");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.setItem(15, this.currentIslandItem);
+ this.lores.clear();
+ }
+ else if (VaultHandler.checkPerk(player.getName(), "group.member", getSkyBlockWorld())) {
+ this.currentIslandItem = new ItemStack(Material.GRASS, 1);
+ ItemMeta meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lStart an Island");
+ this.lores.add("�fStart your skyblock journey");
+ this.lores.add("�fby starting your own island.");
+ this.lores.add("�fComplete challenges to earn");
+ this.lores.add("�fitems and skybucks to help");
+ this.lores.add("�fexpand your skyblock. You can");
+ this.lores.add("�finvite others to join in");
+ this.lores.add("�fbuilding your island empire!");
+ this.lores.add("�e�lClick here to start!");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.SKULL_ITEM, 1, (short)3);
+ final SkullMeta meta2 = (SkullMeta)this.currentIslandItem.getItemMeta();
+ meta2.setDisplayName("�a�lJoin an Island");
+ this.lores.add("�fWant to join another player's");
+ this.lores.add("�fisland instead of starting");
+ this.lores.add("�fyour own? If another player");
+ this.lores.add("�finvites you to their island");
+ this.lores.add("�fyou can click here or use");
+ this.lores.add("�e/island accept �fto join them.");
+ this.lores.add("�e�lClick here to accept an invite!");
+ this.lores.add("�e�l(You must be invited first)");
+ meta2.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta((ItemMeta)meta2);
+ this.GUIisland.setItem(4, this.currentIslandItem);
+ this.lores.clear();
+ this.currentIslandItem = new ItemStack(Material.SIGN, 1);
+ meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lIsland Help");
+ this.lores.add("�fNeed help with skyblock");
+ this.lores.add("�fconcepts or commands? View");
+ this.lores.add("�fdetails about them here.");
+ this.lores.add("�e�lClick here for help!");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.setItem(8, this.currentIslandItem);
+ this.lores.clear();
+ }
+ else {
+ this.currentIslandItem = new ItemStack(Material.BOOK, 1);
+ final ItemMeta meta4 = this.currentIslandItem.getItemMeta();
+ meta4.setDisplayName("�a�lWelcome to the Server!");
+ this.lores.add("�fPlease read and accept the");
+ this.lores.add("�fserver rules to become a");
+ this.lores.add("�fmember and start your skyblock.");
+ this.lores.add("�e�lClick here to read!");
+ meta4.setLore((List)this.lores);
+ this.currentIslandItem.setItemMeta(meta4);
+ this.GUIisland.addItem(new ItemStack[] { this.currentIslandItem });
+ this.lores.clear();
+ }
+ return this.GUIisland;
+ }
+
+ public boolean isPartyLeader(final Player player) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getString("party.leader").equalsIgnoreCase(player.getName());
+ }
+
+ public boolean checkIslandPermission(final Player player, final String permission) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getBoolean("party.members." + player.getName() + "." + permission);
+ }
+
+ public String getCurrentBiome(final Player player) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getString("general.biome");
+ }
+
+ public int showIslandLevel(final Player player) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("general.level");
+ }
+
+ public int showCurrentMembers(final Player player) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.currentSize");
+ }
+
+ public int showMaxMembers(final Player player) {
+ return getInstance().getIslandConfig(getInstance().getActivePlayers().get(player.getName()).locationForParty()).getInt("party.maxSize");
+ }
+
+ public void populateChallengeRank(final Player player, final int rankIndex, final Material mat, int location, final PlayerInfo pi) {
+ int rankComplete = 0;
+ this.currentChallengeItem = new ItemStack(mat, 1);
+ ItemMeta meta4 = this.currentChallengeItem.getItemMeta();
+ meta4.setDisplayName("�e�lRank: " + Settings.challenges_ranks[rankIndex]);
+ this.lores.add("�fComplete most challenges in");
+ this.lores.add("�fthis rank to unlock the next rank.");
+ meta4.setLore((List)this.lores);
+ this.currentChallengeItem.setItemMeta(meta4);
+ this.GUIchallenge.setItem(location, this.currentChallengeItem);
+ this.lores.clear();
+ final String[] challengeList = this.getChallengesFromRank(player, Settings.challenges_ranks[rankIndex]).split(" - ");
+ for (int i = 0; i < challengeList.length; ++i) {
+ if (rankIndex > 0) {
+ rankComplete = getInstance().checkRankCompletion(player, Settings.challenges_ranks[rankIndex - 1]);
+ if (rankComplete > 0) {
+ this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)14);
+ meta4 = this.currentChallengeItem.getItemMeta();
+ meta4.setDisplayName("�4�lLocked Challenge");
+ this.lores.add("�7Complete " + rankComplete + " more " + Settings.challenges_ranks[rankIndex - 1] + " challenges");
+ this.lores.add("�7to unlock this rank.");
+ meta4.setLore((List)this.lores);
+ this.currentChallengeItem.setItemMeta(meta4);
+ this.GUIchallenge.setItem(++location, this.currentChallengeItem);
+ this.lores.clear();
+ continue;
+ }
+ }
+ if (challengeList[i].charAt(1) == 'e') {
+ this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)4);
+ meta4 = this.currentChallengeItem.getItemMeta();
+ meta4.setDisplayName(challengeList[i].replace("�e", "�e�l"));
+ challengeList[i] = challengeList[i].replace("�e", "");
+ challengeList[i] = challengeList[i].replace("�8", "");
+ }
+ else if (challengeList[i].charAt(1) == 'a') {
+ if (!getInstance().getConfig().contains("options.challenges.challengeList." + challengeList[i].replace("�a", "").replace("�2", "").replace("�e", "").replace("�8", "").toLowerCase() + ".displayItem")) {
+ this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)5);
+ }
+ else {
+ this.currentChallengeItem = new ItemStack(Material.getMaterial(getInstance().getConfig().getInt("options.challenges.challengeList." + challengeList[i].replace("�a", "").replace("�2", "").replace("�e", "").replace("�8", "").toLowerCase() + ".displayItem")), 1);
+ }
+ meta4 = this.currentChallengeItem.getItemMeta();
+ meta4.setDisplayName(challengeList[i].replace("�a", "�a�l"));
+ challengeList[i] = challengeList[i].replace("�a", "");
+ challengeList[i] = challengeList[i].replace("�8", "");
+ }
+ else if (challengeList[i].charAt(1) == '2') {
+ this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)13);
+ meta4 = this.currentChallengeItem.getItemMeta();
+ meta4.setDisplayName(challengeList[i].replace("�2", "�2�l"));
+ challengeList[i] = challengeList[i].replace("�2", "");
+ challengeList[i] = challengeList[i].replace("�8", "");
+ }
+ else {
+ this.currentChallengeItem = new ItemStack(Material.STAINED_GLASS_PANE, 1, (short)4);
+ meta4 = this.currentChallengeItem.getItemMeta();
+ meta4.setDisplayName(challengeList[i].replace("�e", "�e�l"));
+ challengeList[i] = challengeList[i].replace("�e", "");
+ challengeList[i] = challengeList[i].replace("�8", "");
+ }
+ this.lores.add("�7" + getInstance().getConfig().getString("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".description"));
+ this.lores.add("�eThis challenge requires the following:");
+ final String[] reqList = this.getConfig().getString("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".requiredItems").split(" ");
+ int reqItem = 0;
+ int reqAmount = 0;
+ int reqMod = -1;
+ String[] array;
+ for (int length = (array = reqList).length, j = 0; j < length; ++j) {
+ final String s = array[j];
+ final String[] sPart = s.split(":");
+ if (sPart.length == 2) {
+ reqItem = Integer.parseInt(sPart[0]);
+ final String[] sScale = sPart[1].split(";");
+ if (sScale.length == 1) {
+ reqAmount = Integer.parseInt(sPart[1]);
+ }
+ else if (sScale.length == 2) {
+ if (sScale[1].charAt(0) == '+') {
+ reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase());
+ }
+ else if (sScale[1].charAt(0) == '*') {
+ reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
+ }
+ else if (sScale[1].charAt(0) == '-') {
+ reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase());
+ }
+ else if (sScale[1].charAt(0) == '/') {
+ reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
+ }
+ }
+ }
+ else if (sPart.length == 3) {
+ reqItem = Integer.parseInt(sPart[0]);
+ final String[] sScale = sPart[2].split(";");
+ if (sScale.length == 1) {
+ reqAmount = Integer.parseInt(sPart[2]);
+ }
+ else if (sScale.length == 2) {
+ if (sScale[1].charAt(0) == '+') {
+ reqAmount = Integer.parseInt(sScale[0]) + Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase());
+ }
+ else if (sScale[1].charAt(0) == '*') {
+ reqAmount = Integer.parseInt(sScale[0]) * (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
+ }
+ else if (sScale[1].charAt(0) == '-') {
+ reqAmount = Integer.parseInt(sScale[0]) - Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase());
+ }
+ else if (sScale[1].charAt(0) == '/') {
+ reqAmount = Integer.parseInt(sScale[0]) / (Integer.parseInt(sScale[1].substring(1)) * getInstance().getActivePlayers().get(player.getName()).checkChallengeSinceTimer(challengeList[i].toLowerCase()));
+ }
+ }
+ reqMod = Integer.parseInt(sPart[1]);
+ }
+ final ItemStack newItem = new ItemStack(reqItem, reqAmount, (short)reqMod);
+ this.lores.add("�f" + newItem.getAmount() + " " + newItem.getType().toString());
+ }
+ if (pi.checkChallenge(challengeList[i].toLowerCase()) > 0 && getInstance().getConfig().getBoolean("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatable")) {
+ if (pi.onChallengeCooldown(challengeList[i].toLowerCase())) {
+ if (pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 86400000L >= 1L) {
+ final int days = (int)pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 86400000;
+ this.lores.add("�4Requirements will reset in " + days + " days.");
+ }
+ else {
+ final int hours = (int)pi.getChallengeCooldownTime(challengeList[i].toLowerCase()) / 3600000;
+ this.lores.add("�4Requirements will reset in " + hours + " hours.");
+ }
+ }
+ this.lores.add("�6Item Reward: �a" + getInstance().getConfig().getString("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatRewardText"));
+ this.lores.add("�6Currency Reward: �a" + getInstance().getConfig().getInt("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatCurrencyReward"));
+ this.lores.add("�6Exp Reward: �a" + getInstance().getConfig().getInt("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatXpReward"));
+ this.lores.add("�dTotal times completed: �f" + pi.getChallenge(challengeList[i].toLowerCase()).getTimesCompleted());
+ this.lores.add("�e�lClick to complete this challenge.");
+ }
+ else {
+ this.lores.add("�6Item Reward: �a" + getInstance().getConfig().getString("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".rewardText"));
+ this.lores.add("�6Currency Reward: �a" + getInstance().getConfig().getInt("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".currencyReward"));
+ this.lores.add("�6Exp Reward: �a" + getInstance().getConfig().getInt("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".xpReward"));
+ if (getInstance().getConfig().getBoolean("options.challenges.challengeList." + challengeList[i].toLowerCase() + ".repeatable")) {
+ this.lores.add("�e�lClick to complete this challenge.");
+ }
+ else {
+ this.lores.add("�4�lYou can't repeat this challenge.");
+ }
+ }
+ meta4.setLore((List)this.lores);
+ this.currentChallengeItem.setItemMeta(meta4);
+ this.GUIchallenge.setItem(++location, this.currentChallengeItem);
+ this.lores.clear();
+ }
+ }
+
+ public void sendMessageToIslandGroup(final String location, final String message) {
+ final Iterator temp = getInstance().getIslandConfig(location).getConfigurationSection("party.members").getKeys(false).iterator();
+ this.date = new Date();
+ final String dateTxt;
+ final String myDateString = dateTxt = DateFormat.getDateInstance(3).format(this.date).toString();
+ int currentLogPos = getInstance().getIslandConfig(location).getInt("log.logPos");
+ while (temp.hasNext()) {
+ final String player = temp.next();
+ if (Bukkit.getPlayer(player) != null) {
+ Bukkit.getPlayer(player).sendMessage("�d[skyblock] " + message);
+ }
+ }
+ getInstance().getIslandConfig(location).set("log." + ++currentLogPos, (Object)("�d[" + dateTxt + "] " + message));
+ if (currentLogPos < 10) {
+ getInstance().getIslandConfig(location).set("log.logPos", (Object)currentLogPos);
+ }
+ else {
+ getInstance().getIslandConfig(location).set("log.logPos", (Object)0);
+ }
+ }
+
+ static /* synthetic */ void access$0(final uSkyBlock uSkyBlock, final Location lastIsland) {
+ uSkyBlock.lastIsland = lastIsland;
+ }
+}