diff --git a/Advanced Portals/.classpath b/Advanced Portals/.classpath
deleted file mode 100644
index 1ed8c2fe..00000000
--- a/Advanced Portals/.classpath
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/Advanced Portals/.gitignore b/Advanced Portals/.gitignore
deleted file mode 100644
index 5e56e040..00000000
--- a/Advanced Portals/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/bin
diff --git a/Advanced Portals/.project b/Advanced Portals/.project
deleted file mode 100644
index e6649c96..00000000
--- a/Advanced Portals/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-
-
- Advanced Portals
-
-
-
-
-
- org.eclipse.jdt.core.javabuilder
-
-
-
-
-
- org.eclipse.jdt.core.javanature
-
-
diff --git a/Advanced Portals/src/Config.yml b/src/Config.yml
similarity index 96%
rename from Advanced Portals/src/Config.yml
rename to src/Config.yml
index b578d44d..43159244 100644
--- a/Advanced Portals/src/Config.yml
+++ b/src/Config.yml
@@ -1,67 +1,67 @@
-# Advanced Portals Config
-
-# To set this file back to its default state just delete it and reload the server or restart it!
-
-
-
-# Set to true if you want the normal axes to work normally but the ones gived with /portals selector or wand will still work though
-# It can be usefull if people with permission want to use an iron axe on a survival server
-UseOnlyServerMadeAxe: false
-
-# Preferably an item and not a block but it shouldnt matter
-AxeItemId: IRON_AXE
-
-# Will be implemented so you can give yourself the portal block and build manually with it so its easier to make portals with the portal block.
-CanBuildPortalBlock: true
-
-# Defines if portals protect themselves
-PortalProtection: true
-
-# How many blocks around the portals will be protected from griefing or destruction
-PortalProtectionRadius: 5
-
-# What the default trigger block is for portals if nothing is defined.
-DefaultPortalTriggerBlock: PORTAL
-
-# This stops all water flowing inside a portal area(can be disabled if something like world edit is handelling the water flow or you dont want it active)
-# you want to
-StopWaterFlow: true
-
-# This must be a placeable block or it will not work and may even crash
-ShowSelectionBlockID: STAINED_GLASS
-ShowSelectionBlockData: 14
-
-# WarpEffect
-# 0 = disabled(no particles)
-# 1 = Eye of ender explode efffect(loads of portal particles)
-WarpParticles: 1
-
-# WarpSound generally suggested to keep the same as warpeffect but can usually be used for just the sound and no particle effects
-# 0 = disabled(no sound)
-# 1 = Enderman Warp Sound
-WarpSound: 1
-
-# In case you want to show the bungee attempting warp message
-ShowBungeeWarpMessage: false
-
-# This changes how long the show seletion lasts in seconds
-
-ShowSelectionShowDuration: 10
-
-# If a player is riding a entity, warp the entity too?(unless its a bungee portal)
-
-WarpRiddenEntity: true
-
-# Use the default warp messages for portals
-PortalWarpMessages: true
-
-# Use plugin name in the warp messages
-UseWarpPrefix: true
-
-# If this is true a custom prefix can be used
-
-UseCustomPrefix: false
-
-CustomPrefix: '[Test]'
-
-
+# Advanced Portals Config
+
+# To set this file back to its default state just delete it and reload the server or restart it!
+
+
+
+# Set to true if you want the normal axes to work normally but the ones gived with /portals selector or wand will still work though
+# It can be usefull if people with permission want to use an iron axe on a survival server
+UseOnlyServerMadeAxe: false
+
+# Preferably an item and not a block but it shouldnt matter
+AxeItemId: IRON_AXE
+
+# Will be implemented so you can give yourself the portal block and build manually with it so its easier to make portals with the portal block.
+CanBuildPortalBlock: true
+
+# Defines if portals protect themselves
+PortalProtection: true
+
+# How many blocks around the portals will be protected from griefing or destruction
+PortalProtectionRadius: 5
+
+# What the default trigger block is for portals if nothing is defined.
+DefaultPortalTriggerBlock: PORTAL
+
+# This stops all water flowing inside a portal area(can be disabled if something like world edit is handelling the water flow or you dont want it active)
+# you want to
+StopWaterFlow: true
+
+# This must be a placeable block or it will not work and may even crash
+ShowSelectionBlockID: STAINED_GLASS
+ShowSelectionBlockData: 14
+
+# WarpEffect
+# 0 = disabled(no particles)
+# 1 = Eye of ender explode efffect(loads of portal particles)
+WarpParticles: 1
+
+# WarpSound generally suggested to keep the same as warpeffect but can usually be used for just the sound and no particle effects
+# 0 = disabled(no sound)
+# 1 = Enderman Warp Sound
+WarpSound: 1
+
+# In case you want to show the bungee attempting warp message
+ShowBungeeWarpMessage: false
+
+# This changes how long the show seletion lasts in seconds
+
+ShowSelectionShowDuration: 10
+
+# If a player is riding a entity, warp the entity too?(unless its a bungee portal)
+
+WarpRiddenEntity: true
+
+# Use the default warp messages for portals
+PortalWarpMessages: true
+
+# Use plugin name in the warp messages
+UseWarpPrefix: true
+
+# If this is true a custom prefix can be used
+
+UseCustomPrefix: false
+
+CustomPrefix: '[Test]'
+
+
diff --git a/Advanced Portals/src/Destinations.yml b/src/Destinations.yml
similarity index 93%
rename from Advanced Portals/src/Destinations.yml
rename to src/Destinations.yml
index a5bee0ff..2d66a84b 100644
--- a/Advanced Portals/src/Destinations.yml
+++ b/src/Destinations.yml
@@ -1,7 +1,7 @@
-
-# ExampleDestination:
-# world: it will be the world name
-# pos:
-# X:
-# Y:
-# Z:
+
+# ExampleDestination:
+# world: it will be the world name
+# pos:
+# X:
+# Y:
+# Z:
diff --git a/Advanced Portals/src/Portals.yml b/src/Portals.yml
similarity index 97%
rename from Advanced Portals/src/Portals.yml
rename to src/Portals.yml
index 794a7faa..2238a585 100644
--- a/Advanced Portals/src/Portals.yml
+++ b/src/Portals.yml
@@ -1,19 +1,19 @@
-
-# ExamplePortal:
-# world: it will be the world name
-# triggerblock: LAVA # will only be used if the hastriggerblock is true and can be id or text
-# pos1: # dont mess with the data here, if you do it may stop the portal from working.
-# X:
-# Y:
-# Z:
-# pos2:
-# X:
-# Y:
-# Z:
-# destination:
-# issetpoint: true # if this was false point name would not be used and the coordinates would be saved here, it just adds more customisation.
-# pointname: examplepoint # if issetpoint is false this wont be here and tppos will be.
-# tppos:
-# X:
-# Y:
-# Z:
+
+# ExamplePortal:
+# world: it will be the world name
+# triggerblock: LAVA # will only be used if the hastriggerblock is true and can be id or text
+# pos1: # dont mess with the data here, if you do it may stop the portal from working.
+# X:
+# Y:
+# Z:
+# pos2:
+# X:
+# Y:
+# Z:
+# destination:
+# issetpoint: true # if this was false point name would not be used and the coordinates would be saved here, it just adds more customisation.
+# pointname: examplepoint # if issetpoint is false this wont be here and tppos will be.
+# tppos:
+# X:
+# Y:
+# Z:
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java b/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java
similarity index 100%
rename from Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsCommand.java
rename to src/com/sekwah/advancedportals/AdvancedPortalsCommand.java
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java b/src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java
rename to src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java
index 21702314..4c8b35d6 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java
+++ b/src/com/sekwah/advancedportals/AdvancedPortalsPlugin.java
@@ -1,106 +1,106 @@
-package com.sekwah.advancedportals;
-
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-
-import org.bukkit.plugin.java.JavaPlugin;
-
-import com.sekwah.advancedportals.DataCollector.DataCollector;
-import com.sekwah.advancedportals.compat.NMS;
-import com.sekwah.advancedportals.destinations.Destination;
-import com.sekwah.advancedportals.metrics.Metrics;
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-public class AdvancedPortalsPlugin extends JavaPlugin {
-
- public NMS nmsAccess;
-
- public void onEnable() {
-
- try {
- Metrics metrics = new Metrics(this);
- metrics.start();
- } catch (IOException e) {
- // Failed to submit the stats :-(
- }
-
- this.getServer().getConsoleSender().sendMessage("§aAdvanced portals have been sucsessfully enabled!");
-
- String packageName = getServer().getClass().getPackage().getName();
- String[] packageSplit = packageName.split("\\.");
- String version = packageSplit[packageSplit.length - 1];
-
- try {
- Class> nmsClass = Class.forName("com.sekwah.advancedportals.compat." + version);
- if(NMS.class.isAssignableFrom(nmsClass)){
- this.nmsAccess = (NMS) nmsClass.getConstructor().newInstance();
- }else
- {
- System.out.println("Something went wrong, please notify the author and tell them this version v:" + version);
- this.setEnabled(false);
- }
- } catch (ClassNotFoundException e) {
- System.out.println("This version of craftbukkit is not yet supported, please notify the author and give them this version v:" + version);
- this.setEnabled(false);
- } catch (InstantiationException e) {
- e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (IllegalArgumentException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- } catch (SecurityException e) {
- e.printStackTrace();
- }
-
- new Assets(this);
-
- // Opens a channel that messages bungeeCord
- this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
-
- // thanks to the new config accessor code the config.saveDefaultConfig(); will now
- // only copy the file if it doesnt exist!
- ConfigAccessor config = new ConfigAccessor(this, "Config.yml");
- config.saveDefaultConfig();
-
- ConfigAccessor portalconfig = new ConfigAccessor(this, "Portals.yml");
- portalconfig.saveDefaultConfig();
-
- ConfigAccessor destinationconfig = new ConfigAccessor(this, "Destinations.yml");
- destinationconfig.saveDefaultConfig();
-
-
- // Loads the portal and destination editors
- new Portal(this);
- new Destination(this);
-
- new DataCollector(this);
-
- // These register the commands
- new AdvancedPortalsCommand(this);
- new DestinationCommand(this);
- new WarpCommand(this);
-
-
- // These register the listeners
- new Listeners(this);
-
- new FlowStopper(this);
- new PortalProtect(this);
- new PortalPlacer(this);
-
- Selection.LoadData(this);
-
- DataCollector.setupMetrics();
- }
-
-
- public void onDisable() {
- this.getServer().getConsoleSender().sendMessage("§cAdvanced portals are being disabled!");
- }
-
-
-}
+package com.sekwah.advancedportals;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import org.bukkit.plugin.java.JavaPlugin;
+
+import com.sekwah.advancedportals.DataCollector.DataCollector;
+import com.sekwah.advancedportals.compat.NMS;
+import com.sekwah.advancedportals.destinations.Destination;
+import com.sekwah.advancedportals.metrics.Metrics;
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+public class AdvancedPortalsPlugin extends JavaPlugin {
+
+ public NMS nmsAccess;
+
+ public void onEnable() {
+
+ try {
+ Metrics metrics = new Metrics(this);
+ metrics.start();
+ } catch (IOException e) {
+ // Failed to submit the stats :-(
+ }
+
+ this.getServer().getConsoleSender().sendMessage("§aAdvanced portals have been sucsessfully enabled!");
+
+ String packageName = getServer().getClass().getPackage().getName();
+ String[] packageSplit = packageName.split("\\.");
+ String version = packageSplit[packageSplit.length - 1];
+
+ try {
+ Class> nmsClass = Class.forName("com.sekwah.advancedportals.compat." + version);
+ if(NMS.class.isAssignableFrom(nmsClass)){
+ this.nmsAccess = (NMS) nmsClass.getConstructor().newInstance();
+ }else
+ {
+ System.out.println("Something went wrong, please notify the author and tell them this version v:" + version);
+ this.setEnabled(false);
+ }
+ } catch (ClassNotFoundException e) {
+ System.out.println("This version of craftbukkit is not yet supported, please notify the author and give them this version v:" + version);
+ this.setEnabled(false);
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (IllegalArgumentException e) {
+ e.printStackTrace();
+ } catch (InvocationTargetException e) {
+ e.printStackTrace();
+ } catch (NoSuchMethodException e) {
+ e.printStackTrace();
+ } catch (SecurityException e) {
+ e.printStackTrace();
+ }
+
+ new Assets(this);
+
+ // Opens a channel that messages bungeeCord
+ this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
+
+ // thanks to the new config accessor code the config.saveDefaultConfig(); will now
+ // only copy the file if it doesnt exist!
+ ConfigAccessor config = new ConfigAccessor(this, "Config.yml");
+ config.saveDefaultConfig();
+
+ ConfigAccessor portalconfig = new ConfigAccessor(this, "Portals.yml");
+ portalconfig.saveDefaultConfig();
+
+ ConfigAccessor destinationconfig = new ConfigAccessor(this, "Destinations.yml");
+ destinationconfig.saveDefaultConfig();
+
+
+ // Loads the portal and destination editors
+ new Portal(this);
+ new Destination(this);
+
+ new DataCollector(this);
+
+ // These register the commands
+ new AdvancedPortalsCommand(this);
+ new DestinationCommand(this);
+ new WarpCommand(this);
+
+
+ // These register the listeners
+ new Listeners(this);
+
+ new FlowStopper(this);
+ new PortalProtect(this);
+ new PortalPlacer(this);
+
+ Selection.LoadData(this);
+
+ DataCollector.setupMetrics();
+ }
+
+
+ public void onDisable() {
+ this.getServer().getConsoleSender().sendMessage("§cAdvanced portals are being disabled!");
+ }
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/Assets.java b/src/com/sekwah/advancedportals/Assets.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/Assets.java
rename to src/com/sekwah/advancedportals/Assets.java
index f1d8db92..fc00d041 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/Assets.java
+++ b/src/com/sekwah/advancedportals/Assets.java
@@ -1,15 +1,15 @@
-package com.sekwah.advancedportals;
-
-public class Assets {
-
- public static int currentWarpParticles = 0;
-
- public static int currentWarpSound = 0;
-
- public Assets(AdvancedPortalsPlugin plugin) {
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- currentWarpParticles = config.getConfig().getInt("WarpParticles");
- currentWarpSound = config.getConfig().getInt("WarpSound");
- }
-
-}
+package com.sekwah.advancedportals;
+
+public class Assets {
+
+ public static int currentWarpParticles = 0;
+
+ public static int currentWarpSound = 0;
+
+ public Assets(AdvancedPortalsPlugin plugin) {
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ currentWarpParticles = config.getConfig().getInt("WarpParticles");
+ currentWarpSound = config.getConfig().getInt("WarpSound");
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/ConfigAccessor.java b/src/com/sekwah/advancedportals/ConfigAccessor.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/ConfigAccessor.java
rename to src/com/sekwah/advancedportals/ConfigAccessor.java
index 3cc8b977..1902f03f 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/ConfigAccessor.java
+++ b/src/com/sekwah/advancedportals/ConfigAccessor.java
@@ -1,82 +1,82 @@
-package com.sekwah.advancedportals;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.logging.Level;
-
-import org.bukkit.configuration.file.FileConfiguration;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.java.JavaPlugin;
-
-public class ConfigAccessor {
-
- private final String fileName;
- private final JavaPlugin plugin;
-
- private File configFile;
- private FileConfiguration fileConfiguration;
-
- public ConfigAccessor(JavaPlugin plugin, String fileName) {
- if (!plugin.isInitialized())
- throw new IllegalArgumentException("plugin must be initiaized");
- this.plugin = plugin;
- this.fileName = fileName;
- }
-
- // gets all of the
- public void reloadConfig() {
- if (configFile == null) {
- File dataFolder = plugin.getDataFolder();
- if (dataFolder == null)
- throw new IllegalStateException();
- configFile = new File(dataFolder, fileName);
- }
- fileConfiguration = YamlConfiguration.loadConfiguration(configFile);
-
- // Look for defaults in the jar
- InputStream defConfigStream = plugin.getResource(fileName);
- if (defConfigStream != null) {
- YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
- fileConfiguration.setDefaults(defConfig);
- }
- }
-
- public FileConfiguration getConfig() {
- if (fileConfiguration == null) {
- this.reloadConfig();
- }
- return fileConfiguration;
- }
-
- // Saves all the data to the selected yml file
- public void saveConfig() {
- if (fileConfiguration == null || configFile == null) {
- return;
- } else {
- try {
- getConfig().save(configFile);
- } catch (IOException ex) {
- plugin.getLogger().log(Level.SEVERE, "Could not save config to " + configFile, ex);
- }
- }
- }
-
- // Saves
- /**public void saveDefaultConfig() {
- if (!configFile.exists()) {
- this.plugin.saveResource(fileName, false);
- }
- }*/
-
- // New save default config saving code, it checks if the needed config is in the jar file before
- // overriding it.
- public void saveDefaultConfig() {
- if (configFile == null) {
- configFile = new File(plugin.getDataFolder(), fileName);
- }
- if (!configFile.exists()) {
- plugin.saveResource(fileName, false);
- }
- }
-
+package com.sekwah.advancedportals;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Level;
+
+import org.bukkit.configuration.file.FileConfiguration;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.java.JavaPlugin;
+
+public class ConfigAccessor {
+
+ private final String fileName;
+ private final JavaPlugin plugin;
+
+ private File configFile;
+ private FileConfiguration fileConfiguration;
+
+ public ConfigAccessor(JavaPlugin plugin, String fileName) {
+ if (!plugin.isInitialized())
+ throw new IllegalArgumentException("plugin must be initiaized");
+ this.plugin = plugin;
+ this.fileName = fileName;
+ }
+
+ // gets all of the
+ public void reloadConfig() {
+ if (configFile == null) {
+ File dataFolder = plugin.getDataFolder();
+ if (dataFolder == null)
+ throw new IllegalStateException();
+ configFile = new File(dataFolder, fileName);
+ }
+ fileConfiguration = YamlConfiguration.loadConfiguration(configFile);
+
+ // Look for defaults in the jar
+ InputStream defConfigStream = plugin.getResource(fileName);
+ if (defConfigStream != null) {
+ YamlConfiguration defConfig = YamlConfiguration.loadConfiguration(defConfigStream);
+ fileConfiguration.setDefaults(defConfig);
+ }
+ }
+
+ public FileConfiguration getConfig() {
+ if (fileConfiguration == null) {
+ this.reloadConfig();
+ }
+ return fileConfiguration;
+ }
+
+ // Saves all the data to the selected yml file
+ public void saveConfig() {
+ if (fileConfiguration == null || configFile == null) {
+ return;
+ } else {
+ try {
+ getConfig().save(configFile);
+ } catch (IOException ex) {
+ plugin.getLogger().log(Level.SEVERE, "Could not save config to " + configFile, ex);
+ }
+ }
+ }
+
+ // Saves
+ /**public void saveDefaultConfig() {
+ if (!configFile.exists()) {
+ this.plugin.saveResource(fileName, false);
+ }
+ }*/
+
+ // New save default config saving code, it checks if the needed config is in the jar file before
+ // overriding it.
+ public void saveDefaultConfig() {
+ if (configFile == null) {
+ configFile = new File(plugin.getDataFolder(), fileName);
+ }
+ if (!configFile.exists()) {
+ plugin.saveResource(fileName, false);
+ }
+ }
+
}
\ No newline at end of file
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/DataCollector/DataCollector.java b/src/com/sekwah/advancedportals/DataCollector/DataCollector.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/DataCollector/DataCollector.java
rename to src/com/sekwah/advancedportals/DataCollector/DataCollector.java
index 1d533e0f..90f02fc7 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/DataCollector/DataCollector.java
+++ b/src/com/sekwah/advancedportals/DataCollector/DataCollector.java
@@ -1,77 +1,77 @@
-package com.sekwah.advancedportals.DataCollector;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Level;
-
-import com.sekwah.advancedportals.AdvancedPortalsPlugin;
-import com.sekwah.advancedportals.destinations.Destination;
-import com.sekwah.advancedportals.metrics.Metrics;
-import com.sekwah.advancedportals.metrics.Metrics.Graph;
-import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-import org.bukkit.Material;
-
-public class DataCollector {
-
- private static AdvancedPortalsPlugin plugin;
-
- public DataCollector(AdvancedPortalsPlugin plugin) {
- DataCollector.plugin = plugin;
- }
-
- /**
- *
- * This is currently being tested as it doesn't fully work at the moment.
- *
- */
-
- /**public static void playerWarped() {
- try {
- Metrics metrics = new Metrics(plugin);
-
- Graph TotalWarps = metrics.createGraph("Total Warps");
-
- TotalWarps.addPlotter(new Metrics.Plotter("Internal Warps") {
-
- @Override
- public int getValue() {
- return 1; // number of warps
- }
-
- });
-
- metrics.start();
- } catch (IOException e) {
- plugin.getLogger().log(Level.SEVERE, "Could not submit data", e);
- }
- }*/
-
- public static void setupMetrics() {
-
- try {
- Metrics metrics = new Metrics(plugin);
- Graph TotalWarps = metrics.createGraph("Portal Trigger Blocks");
-
- /**List MaterialList = new ArrayList();
- for(AdvancedPortal portal : Portal.Portals){
- MaterialList.add(portal.trigger);
- }*/
-
- /**TotalWarps.addPlotter(new Metrics.Plotter(triggerName) {
-
- @Override
- public int getValue() {
- return 1; // number of portals created
- }
-
- });*/
-
- } catch (IOException e) {
- plugin.getLogger().log(Level.SEVERE, "Could not submit data", e);
- }
- }
-
-}
+package com.sekwah.advancedportals.DataCollector;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+
+import com.sekwah.advancedportals.AdvancedPortalsPlugin;
+import com.sekwah.advancedportals.destinations.Destination;
+import com.sekwah.advancedportals.metrics.Metrics;
+import com.sekwah.advancedportals.metrics.Metrics.Graph;
+import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+import org.bukkit.Material;
+
+public class DataCollector {
+
+ private static AdvancedPortalsPlugin plugin;
+
+ public DataCollector(AdvancedPortalsPlugin plugin) {
+ DataCollector.plugin = plugin;
+ }
+
+ /**
+ *
+ * This is currently being tested as it doesn't fully work at the moment.
+ *
+ */
+
+ /**public static void playerWarped() {
+ try {
+ Metrics metrics = new Metrics(plugin);
+
+ Graph TotalWarps = metrics.createGraph("Total Warps");
+
+ TotalWarps.addPlotter(new Metrics.Plotter("Internal Warps") {
+
+ @Override
+ public int getValue() {
+ return 1; // number of warps
+ }
+
+ });
+
+ metrics.start();
+ } catch (IOException e) {
+ plugin.getLogger().log(Level.SEVERE, "Could not submit data", e);
+ }
+ }*/
+
+ public static void setupMetrics() {
+
+ try {
+ Metrics metrics = new Metrics(plugin);
+ Graph TotalWarps = metrics.createGraph("Portal Trigger Blocks");
+
+ /**List MaterialList = new ArrayList();
+ for(AdvancedPortal portal : Portal.Portals){
+ MaterialList.add(portal.trigger);
+ }*/
+
+ /**TotalWarps.addPlotter(new Metrics.Plotter(triggerName) {
+
+ @Override
+ public int getValue() {
+ return 1; // number of portals created
+ }
+
+ });*/
+
+ } catch (IOException e) {
+ plugin.getLogger().log(Level.SEVERE, "Could not submit data", e);
+ }
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/DestinationCommand.java b/src/com/sekwah/advancedportals/DestinationCommand.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/DestinationCommand.java
rename to src/com/sekwah/advancedportals/DestinationCommand.java
index 2e22eb14..d79c76eb 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/DestinationCommand.java
+++ b/src/com/sekwah/advancedportals/DestinationCommand.java
@@ -1,162 +1,162 @@
-package com.sekwah.advancedportals;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.bukkit.Material;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import com.sekwah.advancedportals.destinations.Destination;
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-public class DestinationCommand implements CommandExecutor, TabCompleter {
-
- private AdvancedPortalsPlugin plugin;
-
- public DestinationCommand(AdvancedPortalsPlugin plugin) {
- this.plugin = plugin;
-
- plugin.getCommand("destination").setExecutor(this);
- }
-
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
- if(args.length > 0){
- if(args[0].toLowerCase().equals("create")){
- if(sender.hasPermission("AdvancedPortals.create")){
- if(args.length > 1){
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
- String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");
- if(posX == null){
- sender.sendMessage("§a[§eAdvancedPortals§a] You have created a new destination called §e" + args[1] + "!");
- Player player = sender.getServer().getPlayer(sender.getName());
- Destination.create(player.getLocation(), args[1]);
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] A destination by that name already exists!");
- }
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] Please state the name of the destination you would like to create!");
- }
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to create portals so you cannot give yourself a §ePortal Region Selector§c!");
- }
- }
- else if(args[0].toLowerCase().equals("remove")) {
- ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Destinations.yml");
- if(args.length > 1){
- String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
- if(posX != null){
- Destination.remove(args[1]);
- sender.sendMessage("§c[§7AdvancedPortals§c] The portal §e" + args[1] + "§c has been removed!");
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] No portal by that name exists.");
- }
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] You need to state the name of the destination you wish to remove.");
- }
- }
- else if(args[0].toLowerCase().equals("goto") || args[0].toLowerCase().equals("warp")) {
- if(args.length > 1){
- System.out.println(args[1]);
- ConfigAccessor configDesti = new ConfigAccessor(plugin, "Destinations.yml");
- if(configDesti.getConfig().getString(args[1] + ".world") != null){
- Destination.warp(sender, args[1]);
- sender.sendMessage("§a[§eAdvancedPortals§a] You have been warped to §e" + args[1] + "§a.");
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] No destination by that name exists.");
- }
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] You need to state the name of the destination you wish to teleport to.");
- }
- }
- else if(args[0].toLowerCase().equals("list")) {
- List destiList = Destination.destiList();
- if(destiList.size() >= 1){
- if(args.length > 1){
- try
- {
- int page = Integer.parseInt(args[1]);
- if(page * 5 >= destiList.size() - 5){ // add this if statement so that the user cant select a list page higher than the max
- if((int) destiList.size() / 5 == destiList.size()){
-
- }
- }
- sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
- for(int i = (page - 1) * 5; i < page * 5; i++){
- if(i > destiList.size()){
- break;
- }
- sender.sendMessage(" §e" + destiList.get(i));
- }
- return true;
- }
- catch(Exception e)
- {
- }
- }
-
- sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
- for(int i = 0; i < 5; i++){
- if(i > destiList.size()){
- break;
- }
- sender.sendMessage(" §e" + destiList.get(i));
- }
-
- sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
- for(int i = 0; i < 5; i++){
- if(i > destiList.size()){
- break;
- }
- sender.sendMessage(" §e" + destiList.get(i));
- }
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] There are currently no defined destinations.");
- }
- }
- }
- else{
- sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + ", if you do not know what you can put or would like some help with the commands please type /" + command + " help");
- }
- return true;
- }
-
-
- @Override
- public List onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
- LinkedList autoComplete = new LinkedList();
-
- if(sender.hasPermission("AdvancedPortals.CreatePortal")){
- if(args.length == 1){
- autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
- }
- else if(args[0].toLowerCase().equals("create")){
- }
- }
- Collections.sort(autoComplete);
- for(Object result: autoComplete.toArray()){
- if(!result.toString().startsWith(args[args.length - 1])){
- autoComplete.remove(result);
- }
- }
- return autoComplete;
- }
-
-
-}
+package com.sekwah.advancedportals;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.bukkit.Material;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabCompleter;
+import org.bukkit.entity.Player;
+
+import com.sekwah.advancedportals.destinations.Destination;
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+public class DestinationCommand implements CommandExecutor, TabCompleter {
+
+ private AdvancedPortalsPlugin plugin;
+
+ public DestinationCommand(AdvancedPortalsPlugin plugin) {
+ this.plugin = plugin;
+
+ plugin.getCommand("destination").setExecutor(this);
+ }
+
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
+ if(args.length > 0){
+ if(args[0].toLowerCase().equals("create")){
+ if(sender.hasPermission("AdvancedPortals.create")){
+ if(args.length > 1){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+ String posX = config.getConfig().getString(args[1].toLowerCase() + ".pos.X");
+ if(posX == null){
+ sender.sendMessage("§a[§eAdvancedPortals§a] You have created a new destination called §e" + args[1] + "!");
+ Player player = sender.getServer().getPlayer(sender.getName());
+ Destination.create(player.getLocation(), args[1]);
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] A destination by that name already exists!");
+ }
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] Please state the name of the destination you would like to create!");
+ }
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to create portals so you cannot give yourself a §ePortal Region Selector§c!");
+ }
+ }
+ else if(args[0].toLowerCase().equals("remove")) {
+ ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Destinations.yml");
+ if(args.length > 1){
+ String posX = portalConfig.getConfig().getString(args[1] + ".pos1.X");
+ if(posX != null){
+ Destination.remove(args[1]);
+ sender.sendMessage("§c[§7AdvancedPortals§c] The portal §e" + args[1] + "§c has been removed!");
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] No portal by that name exists.");
+ }
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] You need to state the name of the destination you wish to remove.");
+ }
+ }
+ else if(args[0].toLowerCase().equals("goto") || args[0].toLowerCase().equals("warp")) {
+ if(args.length > 1){
+ System.out.println(args[1]);
+ ConfigAccessor configDesti = new ConfigAccessor(plugin, "Destinations.yml");
+ if(configDesti.getConfig().getString(args[1] + ".world") != null){
+ Destination.warp(sender, args[1]);
+ sender.sendMessage("§a[§eAdvancedPortals§a] You have been warped to §e" + args[1] + "§a.");
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] No destination by that name exists.");
+ }
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] You need to state the name of the destination you wish to teleport to.");
+ }
+ }
+ else if(args[0].toLowerCase().equals("list")) {
+ List destiList = Destination.destiList();
+ if(destiList.size() >= 1){
+ if(args.length > 1){
+ try
+ {
+ int page = Integer.parseInt(args[1]);
+ if(page * 5 >= destiList.size() - 5){ // add this if statement so that the user cant select a list page higher than the max
+ if((int) destiList.size() / 5 == destiList.size()){
+
+ }
+ }
+ sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
+ for(int i = (page - 1) * 5; i < page * 5; i++){
+ if(i > destiList.size()){
+ break;
+ }
+ sender.sendMessage(" §e" + destiList.get(i));
+ }
+ return true;
+ }
+ catch(Exception e)
+ {
+ }
+ }
+
+ sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
+ for(int i = 0; i < 5; i++){
+ if(i > destiList.size()){
+ break;
+ }
+ sender.sendMessage(" §e" + destiList.get(i));
+ }
+
+ sender.sendMessage("§a[§eAdvancedPortals§a] Showing destinations page 1 of 1");
+ for(int i = 0; i < 5; i++){
+ if(i > destiList.size()){
+ break;
+ }
+ sender.sendMessage(" §e" + destiList.get(i));
+ }
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] There are currently no defined destinations.");
+ }
+ }
+ }
+ else{
+ sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + ", if you do not know what you can put or would like some help with the commands please type /" + command + " help");
+ }
+ return true;
+ }
+
+
+ @Override
+ public List onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
+ LinkedList autoComplete = new LinkedList();
+
+ if(sender.hasPermission("AdvancedPortals.CreatePortal")){
+ if(args.length == 1){
+ autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
+ }
+ else if(args[0].toLowerCase().equals("create")){
+ }
+ }
+ Collections.sort(autoComplete);
+ for(Object result: autoComplete.toArray()){
+ if(!result.toString().startsWith(args[args.length - 1])){
+ autoComplete.remove(result);
+ }
+ }
+ return autoComplete;
+ }
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/FlowStopper.java b/src/com/sekwah/advancedportals/FlowStopper.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/FlowStopper.java
rename to src/com/sekwah/advancedportals/FlowStopper.java
index 85146dd6..bda66204 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/FlowStopper.java
+++ b/src/com/sekwah/advancedportals/FlowStopper.java
@@ -1,72 +1,72 @@
-package com.sekwah.advancedportals;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.BlockFromToEvent;
-
-import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-public class FlowStopper implements Listener {
-
- @SuppressWarnings("unused")
- private final AdvancedPortalsPlugin plugin;
-
- // The needed config values will be stored so they are easier to access later
- // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
- private boolean WaterFlow = true;
-
- public FlowStopper(AdvancedPortalsPlugin plugin) {
- this.plugin = plugin;
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- this.WaterFlow = config.getConfig().getBoolean("StopWaterFlow");
-
- if(WaterFlow){
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void onBlockFromTo(BlockFromToEvent event) {
- // when checking positions check the block and the to block
- Block blockTo = event.getToBlock();
- Block block = event.getBlock();
-
- AdvancedPortal[] portals = Portal.Portals;
- int portalId = 0;
- for(Object portal : portals){
- if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + 3D) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= block.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX() - 3D) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= block.getZ()){
-
- event.setCancelled(true);
-
- }
- }
-
- }
-
- if(Portal.Portals[portalId].worldName.equals(blockTo.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + 3D) >= blockTo.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= blockTo.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= blockTo.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX() - 3D) <= blockTo.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= blockTo.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= blockTo.getZ()){
-
- event.setCancelled(true);
-
- }
- }
-
- }
- portalId++;
- }
- }
-
-
-}
+package com.sekwah.advancedportals;
+
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockFromToEvent;
+
+import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+public class FlowStopper implements Listener {
+
+ @SuppressWarnings("unused")
+ private final AdvancedPortalsPlugin plugin;
+
+ // The needed config values will be stored so they are easier to access later
+ // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
+ private boolean WaterFlow = true;
+
+ public FlowStopper(AdvancedPortalsPlugin plugin) {
+ this.plugin = plugin;
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ this.WaterFlow = config.getConfig().getBoolean("StopWaterFlow");
+
+ if(WaterFlow){
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void onBlockFromTo(BlockFromToEvent event) {
+ // when checking positions check the block and the to block
+ Block blockTo = event.getToBlock();
+ Block block = event.getBlock();
+
+ AdvancedPortal[] portals = Portal.Portals;
+ int portalId = 0;
+ for(Object portal : portals){
+ if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + 3D) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= block.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX() - 3D) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= block.getZ()){
+
+ event.setCancelled(true);
+
+ }
+ }
+
+ }
+
+ if(Portal.Portals[portalId].worldName.equals(blockTo.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + 3D) >= blockTo.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= blockTo.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= blockTo.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX() - 3D) <= blockTo.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= blockTo.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= blockTo.getZ()){
+
+ event.setCancelled(true);
+
+ }
+ }
+
+ }
+ portalId++;
+ }
+ }
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/Listeners.java b/src/com/sekwah/advancedportals/Listeners.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/Listeners.java
rename to src/com/sekwah/advancedportals/Listeners.java
index b5d01619..623ec215 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/Listeners.java
+++ b/src/com/sekwah/advancedportals/Listeners.java
@@ -1,265 +1,265 @@
-package com.sekwah.advancedportals;
-
-import org.bukkit.Bukkit;
-import org.bukkit.GameMode;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-import org.bukkit.entity.Player;
-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.player.PlayerInteractEvent;
-import org.bukkit.event.player.PlayerMoveEvent;
-import org.bukkit.event.player.PlayerPortalEvent;
-import org.bukkit.metadata.FixedMetadataValue;
-
-import com.sekwah.advancedportals.DataCollector.DataCollector;
-import com.sekwah.advancedportals.events.WarpEvent;
-import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-public class Listeners implements Listener {
-
- private final AdvancedPortalsPlugin plugin;
-
- private boolean DefaultPortalMessages = true;
-
- // The needed config values will be stored so they are easier to access later
- // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
- private static boolean UseOnlyServerAxe = false;
-
- private static Material WandMaterial;
-
- private static boolean ShowBungeeMessage;
-
- @SuppressWarnings("deprecation")
- public Listeners(AdvancedPortalsPlugin plugin) {
- this.plugin = plugin;
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
-
- String ItemID = config.getConfig().getString("AxeItemId");
-
- DefaultPortalMessages = config.getConfig().getBoolean("PortalWarpMessages");
-
- try
- {
- WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
- }
- catch(Exception e)
- {
- WandMaterial = Material.getMaterial(ItemID);
- }
-
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
-
- @SuppressWarnings("deprecation")
- public static void reloadValues(AdvancedPortalsPlugin plugin) {
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
-
- ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
-
- String ItemID = config.getConfig().getString("AxeItemId");
-
- try
- {
- WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
- }
- catch(Exception e)
- {
- WandMaterial = Material.getMaterial(ItemID);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onMoveEvent(PlayerMoveEvent event) {
- // will check if the player is in the portal or not.
- if(Portal.portalsActive){
- Player player = event.getPlayer();
- Location fromloc = event.getFrom();
- Location loc = event.getTo();
- Location eyeloc = event.getTo();
- //System.out.println(loc.getBlock().getType()); // for debugging, remove or comment out when not needed
- eyeloc.setY(eyeloc.getY() + player.getEyeHeight());
- AdvancedPortal[] portals = Portal.Portals;
- int portalId = 0;
- for(AdvancedPortal portal : portals){
- if(Portal.Portals[portalId].worldName.equals(loc.getWorld().getName())){
- if(Portal.Portals[portalId].trigger.equals(loc.getBlock().getType())
- || Portal.Portals[portalId].trigger.equals(eyeloc.getBlock().getType())){
- if((Portal.Portals[portalId].pos1.getX() + 1D) >= loc.getX() && (Portal.Portals[portalId].pos1.getY() + 1D) >= loc.getY() && (Portal.Portals[portalId].pos1.getZ() + 1D) >= loc.getZ()){
- if(Portal.Portals[portalId].pos2.getX() <= loc.getX() && Portal.Portals[portalId].pos2.getY() <= loc.getY() && Portal.Portals[portalId].pos2.getZ() <= loc.getZ()){
-
-
- WarpEvent warpEvent = new WarpEvent(player, portal.portalName);
- plugin.getServer().getPluginManager().callEvent(event);
-
- if (!event.isCancelled()) {
- boolean warped = Portal.activate(player, portal.portalName);
- if(DefaultPortalMessages && warped){
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
- player.sendMessage("");
- player.sendMessage("§a[§eAdvancedPortals§a] You have warped to §e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination") + ".");
- player.sendMessage("");
- }
-
- if(!warped){
- player.teleport(fromloc);
- event.setCancelled(true);
- }
- }
- else{
-
- }
-
-
- if(Portal.Portals[portalId].trigger.equals(Material.PORTAL)){
- final Player finalplayer = event.getPlayer();
- if(player.getGameMode().equals(GameMode.CREATIVE)){
- player.setMetadata("HasWarped", new FixedMetadataValue(plugin, true));
- Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- finalplayer.removeMetadata("HasWarped", plugin);
- }
- }, 10);
- }
- }
-
- }
- }
-
- }
- }
- portalId++;
- }
-
- }
-
- }
-
- @SuppressWarnings("deprecation")
- @EventHandler
- public void onPortalEvent(PlayerPortalEvent event) {
-
- if(Portal.portalsActive){
- Player player = event.getPlayer();
-
- if(player.hasMetadata("HasWarped")){
- event.setCancelled(true);
- return;
- }
-
- Location loc = player.getLocation();
- Object[] portals = Portal.Portals;
- int portalId = 0;
- for(Object portal : portals){
- if(Portal.Portals[portalId].worldName.equals(player.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + 1D) >= loc.getX() && (Portal.Portals[portalId].pos1.getY() + 1D) >= loc.getY() && (Portal.Portals[portalId].pos1.getZ() + 1D) >= loc.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX()) <= loc.getX() && (Portal.Portals[portalId].pos2.getY()) <= loc.getY() && (Portal.Portals[portalId].pos2.getZ()) <= loc.getZ()){
-
- event.setCancelled(true);
-
- }
- }
-
- }
- portalId++;
- }
-
- }
-
- }
-
- @SuppressWarnings("deprecation")
- @EventHandler
- public void oniteminteract(PlayerInteractEvent event) {
- // will detect if the player is using an axe so the points of a portal can be set
- // also any other detections such as sign interaction or basic block protection
- Player player = event.getPlayer();
-
- if(player.hasMetadata("selectingPortal") && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)){
- Block block = event.getClickedBlock();
- Object[] portals = Portal.Portals;
- int portalId = 0;
- for(Object portal : portals){
- if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + 3D) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= block.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX() - 3D) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= block.getZ()){
- player.sendMessage("§a[§eAdvancedPortals§a] You have selected: §e" + Portal.Portals[portalId].portalName);
- // TODO add code somewhere so when a portal is removed or changed if someone has it selected it notifies them
- // or removed their selections and tells them, maybe not before this update.
- player.removeMetadata("selectingPortal", plugin);
- player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, Portal.Portals[portalId].portalName)); // adds the name to the metadata of the character
- event.setCancelled(true);
- player.removeMetadata("selectingPortal", plugin);
- return;
-
- }
- }
-
- }
- portalId++;
- }
- player.sendMessage("§c[§7AdvancedPortals§c] No portal was selected - if you would like to stop selecting please type §e/portal select §cagain!");
- event.setCancelled(true);
- return;
- }
-
- if(player.hasPermission("AdvancedPortals.CreatePortal")){
-
- // UseOnlyServerMadeAxe being set to true makes is so only the axe generated by the server can be used so other iron axes can be used normally,
- // by default its false but it is a nice feature in case the user wants to use the axe normally too, such as a admin playing survival or it being used
- // as a weapon.
- if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§ePortal Region Selector")) && event.getPlayer().getItemInHand().getTypeId() == WandMaterial.getId()) {
-
- // This checks if the action was a left or right click and if it was directly effecting a block.
- if(event.getAction() == Action.LEFT_CLICK_BLOCK) {
- Location blockloc = event.getClickedBlock().getLocation();
- // stores the selection as metadata on the character so then it isn't saved anywhere, if the player logs out it will
- // have to be selected again if the player joins, also it does not affect any other players.
- player.setMetadata("Pos1X", new FixedMetadataValue(plugin, blockloc.getBlockX()));
- player.setMetadata("Pos1Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));
- player.setMetadata("Pos1Z", new FixedMetadataValue(plugin, blockloc.getBlockZ()));
- player.setMetadata("Pos1World", new FixedMetadataValue(plugin, blockloc.getWorld().getName()));
- player.sendMessage("§eYou have selected pos1! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
-
- // Stops the event so the block is not damaged
- event.setCancelled(true);
-
- // Returns the event so no more code is executed(stops unnecessary code being executed)
- return;
- }
- else if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
- Location blockloc = event.getClickedBlock().getLocation();
- player.setMetadata("Pos2X", new FixedMetadataValue(plugin, blockloc.getBlockX()));
- player.setMetadata("Pos2Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));
- player.setMetadata("Pos2Z", new FixedMetadataValue(plugin, blockloc.getBlockZ()));
- player.setMetadata("Pos2World", new FixedMetadataValue(plugin, blockloc.getWorld().getName()));
- player.sendMessage("§eYou have selected pos2! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
-
- // Stops the event so the block is not interacted with
- event.setCancelled(true);
-
- // Returns the event so no more code is executed(stops unnecessary code being executed)
- return;
- }
-
- }
-
- }
-
- }
-
-
-
-}
+package com.sekwah.advancedportals;
+
+import org.bukkit.Bukkit;
+import org.bukkit.GameMode;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+import org.bukkit.entity.Player;
+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.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.event.player.PlayerPortalEvent;
+import org.bukkit.metadata.FixedMetadataValue;
+
+import com.sekwah.advancedportals.DataCollector.DataCollector;
+import com.sekwah.advancedportals.events.WarpEvent;
+import com.sekwah.advancedportals.portalcontrolls.AdvancedPortal;
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+public class Listeners implements Listener {
+
+ private final AdvancedPortalsPlugin plugin;
+
+ private boolean DefaultPortalMessages = true;
+
+ // The needed config values will be stored so they are easier to access later
+ // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
+ private static boolean UseOnlyServerAxe = false;
+
+ private static Material WandMaterial;
+
+ private static boolean ShowBungeeMessage;
+
+ @SuppressWarnings("deprecation")
+ public Listeners(AdvancedPortalsPlugin plugin) {
+ this.plugin = plugin;
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
+
+ String ItemID = config.getConfig().getString("AxeItemId");
+
+ DefaultPortalMessages = config.getConfig().getBoolean("PortalWarpMessages");
+
+ try
+ {
+ WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
+ }
+ catch(Exception e)
+ {
+ WandMaterial = Material.getMaterial(ItemID);
+ }
+
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void reloadValues(AdvancedPortalsPlugin plugin) {
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ UseOnlyServerAxe = config.getConfig().getBoolean("UseOnlyServerMadeAxe");
+
+ ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
+
+ String ItemID = config.getConfig().getString("AxeItemId");
+
+ try
+ {
+ WandMaterial = Material.getMaterial(Integer.parseInt(ItemID));
+ }
+ catch(Exception e)
+ {
+ WandMaterial = Material.getMaterial(ItemID);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onMoveEvent(PlayerMoveEvent event) {
+ // will check if the player is in the portal or not.
+ if(Portal.portalsActive){
+ Player player = event.getPlayer();
+ Location fromloc = event.getFrom();
+ Location loc = event.getTo();
+ Location eyeloc = event.getTo();
+ //System.out.println(loc.getBlock().getType()); // for debugging, remove or comment out when not needed
+ eyeloc.setY(eyeloc.getY() + player.getEyeHeight());
+ AdvancedPortal[] portals = Portal.Portals;
+ int portalId = 0;
+ for(AdvancedPortal portal : portals){
+ if(Portal.Portals[portalId].worldName.equals(loc.getWorld().getName())){
+ if(Portal.Portals[portalId].trigger.equals(loc.getBlock().getType())
+ || Portal.Portals[portalId].trigger.equals(eyeloc.getBlock().getType())){
+ if((Portal.Portals[portalId].pos1.getX() + 1D) >= loc.getX() && (Portal.Portals[portalId].pos1.getY() + 1D) >= loc.getY() && (Portal.Portals[portalId].pos1.getZ() + 1D) >= loc.getZ()){
+ if(Portal.Portals[portalId].pos2.getX() <= loc.getX() && Portal.Portals[portalId].pos2.getY() <= loc.getY() && Portal.Portals[portalId].pos2.getZ() <= loc.getZ()){
+
+
+ WarpEvent warpEvent = new WarpEvent(player, portal.portalName);
+ plugin.getServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
+ boolean warped = Portal.activate(player, portal.portalName);
+ if(DefaultPortalMessages && warped){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+ player.sendMessage("");
+ player.sendMessage("§a[§eAdvancedPortals§a] You have warped to §e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination") + ".");
+ player.sendMessage("");
+ }
+
+ if(!warped){
+ player.teleport(fromloc);
+ event.setCancelled(true);
+ }
+ }
+ else{
+
+ }
+
+
+ if(Portal.Portals[portalId].trigger.equals(Material.PORTAL)){
+ final Player finalplayer = event.getPlayer();
+ if(player.getGameMode().equals(GameMode.CREATIVE)){
+ player.setMetadata("HasWarped", new FixedMetadataValue(plugin, true));
+ Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ finalplayer.removeMetadata("HasWarped", plugin);
+ }
+ }, 10);
+ }
+ }
+
+ }
+ }
+
+ }
+ }
+ portalId++;
+ }
+
+ }
+
+ }
+
+ @SuppressWarnings("deprecation")
+ @EventHandler
+ public void onPortalEvent(PlayerPortalEvent event) {
+
+ if(Portal.portalsActive){
+ Player player = event.getPlayer();
+
+ if(player.hasMetadata("HasWarped")){
+ event.setCancelled(true);
+ return;
+ }
+
+ Location loc = player.getLocation();
+ Object[] portals = Portal.Portals;
+ int portalId = 0;
+ for(Object portal : portals){
+ if(Portal.Portals[portalId].worldName.equals(player.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + 1D) >= loc.getX() && (Portal.Portals[portalId].pos1.getY() + 1D) >= loc.getY() && (Portal.Portals[portalId].pos1.getZ() + 1D) >= loc.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX()) <= loc.getX() && (Portal.Portals[portalId].pos2.getY()) <= loc.getY() && (Portal.Portals[portalId].pos2.getZ()) <= loc.getZ()){
+
+ event.setCancelled(true);
+
+ }
+ }
+
+ }
+ portalId++;
+ }
+
+ }
+
+ }
+
+ @SuppressWarnings("deprecation")
+ @EventHandler
+ public void oniteminteract(PlayerInteractEvent event) {
+ // will detect if the player is using an axe so the points of a portal can be set
+ // also any other detections such as sign interaction or basic block protection
+ Player player = event.getPlayer();
+
+ if(player.hasMetadata("selectingPortal") && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)){
+ Block block = event.getClickedBlock();
+ Object[] portals = Portal.Portals;
+ int portalId = 0;
+ for(Object portal : portals){
+ if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + 3D) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + 3D) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + 3D) >= block.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX() - 3D) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - 3D) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - 3D) <= block.getZ()){
+ player.sendMessage("§a[§eAdvancedPortals§a] You have selected: §e" + Portal.Portals[portalId].portalName);
+ // TODO add code somewhere so when a portal is removed or changed if someone has it selected it notifies them
+ // or removed their selections and tells them, maybe not before this update.
+ player.removeMetadata("selectingPortal", plugin);
+ player.setMetadata("selectedPortal", new FixedMetadataValue(plugin, Portal.Portals[portalId].portalName)); // adds the name to the metadata of the character
+ event.setCancelled(true);
+ player.removeMetadata("selectingPortal", plugin);
+ return;
+
+ }
+ }
+
+ }
+ portalId++;
+ }
+ player.sendMessage("§c[§7AdvancedPortals§c] No portal was selected - if you would like to stop selecting please type §e/portal select §cagain!");
+ event.setCancelled(true);
+ return;
+ }
+
+ if(player.hasPermission("AdvancedPortals.CreatePortal")){
+
+ // UseOnlyServerMadeAxe being set to true makes is so only the axe generated by the server can be used so other iron axes can be used normally,
+ // by default its false but it is a nice feature in case the user wants to use the axe normally too, such as a admin playing survival or it being used
+ // as a weapon.
+ if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§ePortal Region Selector")) && event.getPlayer().getItemInHand().getTypeId() == WandMaterial.getId()) {
+
+ // This checks if the action was a left or right click and if it was directly effecting a block.
+ if(event.getAction() == Action.LEFT_CLICK_BLOCK) {
+ Location blockloc = event.getClickedBlock().getLocation();
+ // stores the selection as metadata on the character so then it isn't saved anywhere, if the player logs out it will
+ // have to be selected again if the player joins, also it does not affect any other players.
+ player.setMetadata("Pos1X", new FixedMetadataValue(plugin, blockloc.getBlockX()));
+ player.setMetadata("Pos1Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));
+ player.setMetadata("Pos1Z", new FixedMetadataValue(plugin, blockloc.getBlockZ()));
+ player.setMetadata("Pos1World", new FixedMetadataValue(plugin, blockloc.getWorld().getName()));
+ player.sendMessage("§eYou have selected pos1! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
+
+ // Stops the event so the block is not damaged
+ event.setCancelled(true);
+
+ // Returns the event so no more code is executed(stops unnecessary code being executed)
+ return;
+ }
+ else if(event.getAction() == Action.RIGHT_CLICK_BLOCK) {
+ Location blockloc = event.getClickedBlock().getLocation();
+ player.setMetadata("Pos2X", new FixedMetadataValue(plugin, blockloc.getBlockX()));
+ player.setMetadata("Pos2Y", new FixedMetadataValue(plugin, blockloc.getBlockY()));
+ player.setMetadata("Pos2Z", new FixedMetadataValue(plugin, blockloc.getBlockZ()));
+ player.setMetadata("Pos2World", new FixedMetadataValue(plugin, blockloc.getWorld().getName()));
+ player.sendMessage("§eYou have selected pos2! X:" + blockloc.getBlockX() + " Y:" + blockloc.getBlockY() + " Z:" + blockloc.getBlockZ() + " World: " + blockloc.getWorld().getName());
+
+ // Stops the event so the block is not interacted with
+ event.setCancelled(true);
+
+ // Returns the event so no more code is executed(stops unnecessary code being executed)
+ return;
+ }
+
+ }
+
+ }
+
+ }
+
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/PluginMessages.java b/src/com/sekwah/advancedportals/PluginMessages.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/PluginMessages.java
rename to src/com/sekwah/advancedportals/PluginMessages.java
index 7b912fa5..ecfdb6fe 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/PluginMessages.java
+++ b/src/com/sekwah/advancedportals/PluginMessages.java
@@ -1,19 +1,19 @@
-package com.sekwah.advancedportals;
-
-import org.bukkit.command.CommandSender;
-
-public class PluginMessages {
-
- // This class is so then the common messages in commands or just messages over the commands are the same and can be
- // easily changed.
-
- public static void UnknownCommand(CommandSender sender, String command) {
- sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n");
- sender.sendMessage("§cIf you do not know what you can put or would like some help with the commands please type §e" + '"' + "§e/" + command + " help" + '"' + "§c\n");
- }
-
- public static void NoPermission(CommandSender sender, String command) {
- sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to perform that command!");
- }
-
-}
+package com.sekwah.advancedportals;
+
+import org.bukkit.command.CommandSender;
+
+public class PluginMessages {
+
+ // This class is so then the common messages in commands or just messages over the commands are the same and can be
+ // easily changed.
+
+ public static void UnknownCommand(CommandSender sender, String command) {
+ sender.sendMessage("§c[§7AdvancedPortals§c] You need to type something after /" + command + "\n");
+ sender.sendMessage("§cIf you do not know what you can put or would like some help with the commands please type §e" + '"' + "§e/" + command + " help" + '"' + "§c\n");
+ }
+
+ public static void NoPermission(CommandSender sender, String command) {
+ sender.sendMessage("§c[§7AdvancedPortals§c] You do not have permission to perform that command!");
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/PortalPlacer.java b/src/com/sekwah/advancedportals/PortalPlacer.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/PortalPlacer.java
rename to src/com/sekwah/advancedportals/PortalPlacer.java
index c0489600..76992413 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/PortalPlacer.java
+++ b/src/com/sekwah/advancedportals/PortalPlacer.java
@@ -1,40 +1,40 @@
-package com.sekwah.advancedportals;
-
-import org.bukkit.Material;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.BlockPhysicsEvent;
-
-public class PortalPlacer implements Listener {
-
- @SuppressWarnings("unused")
- private final AdvancedPortalsPlugin plugin;
-
- // The needed config values will be stored so they are easier to access later
- // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
- private boolean PortalPlace = true;
-
- public PortalPlacer(AdvancedPortalsPlugin plugin) {
- this.plugin = plugin;
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- this.PortalPlace = config.getConfig().getBoolean("CanBuildPortalBlock");
-
- if(PortalPlace){
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onBlockPhysics(BlockPhysicsEvent event) {
- Material material = event.getBlock().getType();
- if (material == Material.PORTAL)
- {
- event.getChangedType();
- event.setCancelled(true);
- }
- }
-
-
-}
+package com.sekwah.advancedportals;
+
+import org.bukkit.Material;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockPhysicsEvent;
+
+public class PortalPlacer implements Listener {
+
+ @SuppressWarnings("unused")
+ private final AdvancedPortalsPlugin plugin;
+
+ // The needed config values will be stored so they are easier to access later
+ // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
+ private boolean PortalPlace = true;
+
+ public PortalPlacer(AdvancedPortalsPlugin plugin) {
+ this.plugin = plugin;
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ this.PortalPlace = config.getConfig().getBoolean("CanBuildPortalBlock");
+
+ if(PortalPlace){
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGHEST)
+ public void onBlockPhysics(BlockPhysicsEvent event) {
+ Material material = event.getBlock().getType();
+ if (material == Material.PORTAL)
+ {
+ event.getChangedType();
+ event.setCancelled(true);
+ }
+ }
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/PortalProtect.java b/src/com/sekwah/advancedportals/PortalProtect.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/PortalProtect.java
rename to src/com/sekwah/advancedportals/PortalProtect.java
index 74f66d9f..48c41d3d 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/PortalProtect.java
+++ b/src/com/sekwah/advancedportals/PortalProtect.java
@@ -1,118 +1,118 @@
-package com.sekwah.advancedportals;
-
-import java.util.List;
-
-import org.bukkit.Material;
-import org.bukkit.block.Block;
-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.BlockEvent;
-import org.bukkit.event.block.BlockPhysicsEvent;
-import org.bukkit.event.block.BlockPlaceEvent;
-import org.bukkit.event.entity.EntityExplodeEvent;
-
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-public class PortalProtect implements Listener {
-
- private final AdvancedPortalsPlugin plugin;
-
- // The needed config values will be stored so they are easier to access later
- // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
- private boolean PortalProtect = true;
-
- private double PortalProtectionRadius = 5D;
-
- public PortalProtect(AdvancedPortalsPlugin plugin) {
- this.plugin = plugin;
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- this.PortalProtect = config.getConfig().getBoolean("PortalProtection");
-
- this.PortalProtectionRadius = config.getConfig().getDouble("PortalProtectionRadius");
-
- if(PortalProtect){
- plugin.getServer().getPluginManager().registerEvents(this, plugin);
- }
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void onBlockBreak(BlockBreakEvent event){
-
- if(!event.getPlayer().hasPermission("advancedportals.build")){
- Block block = event.getBlock();
-
- Object[] portals = Portal.Portals;
- int portalId = 0;
- for(Object portal : portals){
- if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX() - PortalProtectionRadius) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - PortalProtectionRadius) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - PortalProtectionRadius) <= block.getZ()){
-
- event.setCancelled(true);
-
- }
- }
-
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void onBlockPlace(BlockPlaceEvent event){
-
- if(!event.getPlayer().hasPermission("advancedportals.build")){
- Block block = event.getBlock();
-
- Object[] portals = Portal.Portals;
- int portalId = 0;
- for(Object portal : portals){
- if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX() - PortalProtectionRadius) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - PortalProtectionRadius) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - PortalProtectionRadius) <= block.getZ()){
-
- event.setCancelled(true);
-
- }
- }
-
- }
- }
- }
- }
-
- @EventHandler(priority = EventPriority.HIGH)
- public void onExplosion(EntityExplodeEvent event){
- List blockList = event.blockList();
- for (int i = 0; i < blockList.size(); i++) {
- Block block = blockList.get(i);
- Object[] portals = Portal.Portals;
- int portalId = 0;
- for(Object portal : portals){ // change for format for(int i = 0; i < portals.length; i++){
- if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
-
- if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){
-
- if((Portal.Portals[portalId].pos2.getX() - PortalProtectionRadius) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - PortalProtectionRadius) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - PortalProtectionRadius) <= block.getZ()){
- blockList.remove(i);
- i--;
-
- }
-
- }
-
- }
- portalId++;
- }
- }
- }
-
-
-}
+package com.sekwah.advancedportals;
+
+import java.util.List;
+
+import org.bukkit.Material;
+import org.bukkit.block.Block;
+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.BlockEvent;
+import org.bukkit.event.block.BlockPhysicsEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+public class PortalProtect implements Listener {
+
+ private final AdvancedPortalsPlugin plugin;
+
+ // The needed config values will be stored so they are easier to access later
+ // an example is in the interact event in this if statement if((!UseOnlyServerAxe || event.getItem().getItemMeta().getDisplayName().equals("§eP...
+ private boolean PortalProtect = true;
+
+ private double PortalProtectionRadius = 5D;
+
+ public PortalProtect(AdvancedPortalsPlugin plugin) {
+ this.plugin = plugin;
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ this.PortalProtect = config.getConfig().getBoolean("PortalProtection");
+
+ this.PortalProtectionRadius = config.getConfig().getDouble("PortalProtectionRadius");
+
+ if(PortalProtect){
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void onBlockBreak(BlockBreakEvent event){
+
+ if(!event.getPlayer().hasPermission("advancedportals.build")){
+ Block block = event.getBlock();
+
+ Object[] portals = Portal.Portals;
+ int portalId = 0;
+ for(Object portal : portals){
+ if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX() - PortalProtectionRadius) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - PortalProtectionRadius) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - PortalProtectionRadius) <= block.getZ()){
+
+ event.setCancelled(true);
+
+ }
+ }
+
+ }
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void onBlockPlace(BlockPlaceEvent event){
+
+ if(!event.getPlayer().hasPermission("advancedportals.build")){
+ Block block = event.getBlock();
+
+ Object[] portals = Portal.Portals;
+ int portalId = 0;
+ for(Object portal : portals){
+ if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX() - PortalProtectionRadius) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - PortalProtectionRadius) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - PortalProtectionRadius) <= block.getZ()){
+
+ event.setCancelled(true);
+
+ }
+ }
+
+ }
+ }
+ }
+ }
+
+ @EventHandler(priority = EventPriority.HIGH)
+ public void onExplosion(EntityExplodeEvent event){
+ List blockList = event.blockList();
+ for (int i = 0; i < blockList.size(); i++) {
+ Block block = blockList.get(i);
+ Object[] portals = Portal.Portals;
+ int portalId = 0;
+ for(Object portal : portals){ // change for format for(int i = 0; i < portals.length; i++){
+ if(Portal.Portals[portalId].worldName.equals(block.getWorld().getName())){
+
+ if((Portal.Portals[portalId].pos1.getX() + PortalProtectionRadius) >= block.getX() && (Portal.Portals[portalId].pos1.getY() + PortalProtectionRadius) >= block.getY() && (Portal.Portals[portalId].pos1.getZ() + PortalProtectionRadius) >= block.getZ()){
+
+ if((Portal.Portals[portalId].pos2.getX() - PortalProtectionRadius) <= block.getX() && (Portal.Portals[portalId].pos2.getY() - PortalProtectionRadius) <= block.getY() && (Portal.Portals[portalId].pos2.getZ() - PortalProtectionRadius) <= block.getZ()){
+ blockList.remove(i);
+ i--;
+
+ }
+
+ }
+
+ }
+ portalId++;
+ }
+ }
+ }
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/Selection.java b/src/com/sekwah/advancedportals/Selection.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/Selection.java
rename to src/com/sekwah/advancedportals/Selection.java
index d89d0fda..d615e149 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/Selection.java
+++ b/src/com/sekwah/advancedportals/Selection.java
@@ -1,280 +1,280 @@
-package com.sekwah.advancedportals;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.entity.Player;
-
-public class Selection {
-
- public static Material blockType = Material.WOOL;
- public static int timeout = 10;
- public static byte metadata = 14;
-
- @SuppressWarnings("deprecation")
- public static void LoadData(AdvancedPortalsPlugin plugin) {
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
-
- timeout = config.getConfig().getInt("ShowSelectionShowDuration");
-
- String BlockID = config.getConfig().getString("ShowSelectionBlockID");
- try
- {
- blockType = Material.getMaterial(Integer.parseInt(BlockID));
- }
- catch(Exception e)
- {
- blockType = Material.getMaterial(BlockID);
- }
-
- if(blockType == null){
- blockType = Material.STAINED_GLASS;
- }
-
- metadata = (byte) config.getConfig().getInt("ShowSelectionBlockData");
- }
-
- @SuppressWarnings("deprecation")
- public static void Show(final Player player, final AdvancedPortalsPlugin plugin, String portalName) {
-
- ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Portals.yml");
-
- int LowX = portalConfig.getConfig().getInt(portalName + ".pos2.X");
- int LowY = portalConfig.getConfig().getInt(portalName + ".pos2.Y");
- int LowZ = portalConfig.getConfig().getInt(portalName + ".pos2.Z");
-
- int HighX = portalConfig.getConfig().getInt(portalName + ".pos1.X");
- int HighY = portalConfig.getConfig().getInt(portalName + ".pos1.Y");
- int HighZ = portalConfig.getConfig().getInt(portalName + ".pos1.Z");
-
- final Location pos1 = new Location(player.getWorld(), LowX, LowY, LowZ);
- final Location pos2 = new Location(player.getWorld(), HighX, HighY, HighZ);
-
- /*
- * There are alot of for loops at the moment, when i find an easier way to do these other that a load of if statements
- * then i will change it, but for now its the best way i can think of for doing this.
- */
-
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, LowY, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, LowY, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), LowX, LowY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), HighX, LowY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), LowX, y, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), LowX, y, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), HighX, y, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), HighX, y, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, HighY, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, HighY, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), LowX, HighY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), HighX, HighY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
-
-
- Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- Selection.Hide(player, plugin, pos1, pos2);
- }
- }, timeout * 20);
-
- }
-
- @SuppressWarnings("deprecation")
- public static void Show(final Player player, final AdvancedPortalsPlugin plugin) {
-
- int LowX = 0;
- int LowY = 0;
- int LowZ = 0;
-
- int HighX = 0;
- int HighY = 0;
- int HighZ = 0;
-
- if(player.getMetadata("Pos1X").get(0).asInt() > player.getMetadata("Pos2X").get(0).asInt()){
- LowX = player.getMetadata("Pos2X").get(0).asInt();
- HighX = player.getMetadata("Pos1X").get(0).asInt();
- }
- else{
- LowX = player.getMetadata("Pos1X").get(0).asInt();
- HighX = player.getMetadata("Pos2X").get(0).asInt();
- }
- if(player.getMetadata("Pos1Y").get(0).asInt() > player.getMetadata("Pos2Y").get(0).asInt()){
- LowY = player.getMetadata("Pos2Y").get(0).asInt();
- HighY = player.getMetadata("Pos1Y").get(0).asInt();
- }
- else{
- LowY = player.getMetadata("Pos1Y").get(0).asInt();
- HighY = player.getMetadata("Pos2Y").get(0).asInt();
- }
- if(player.getMetadata("Pos1Z").get(0).asInt() > player.getMetadata("Pos2Z").get(0).asInt()){
- LowZ = player.getMetadata("Pos2Z").get(0).asInt();
- HighZ = player.getMetadata("Pos1Z").get(0).asInt();
- }
- else{
- LowZ = player.getMetadata("Pos1Z").get(0).asInt();
- HighZ = player.getMetadata("Pos2Z").get(0).asInt();
- }
-
- final Location pos1 = new Location(player.getWorld(), LowX, LowY, LowZ);
- final Location pos2 = new Location(player.getWorld(), HighX, HighY, HighZ);
-
- /*
- * There are alot of for loops at the moment, when i find an easier way to do these other that a load of if statements
- * then i will change it, but for now its the best way i can think of for doing this.
- */
-
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, LowY, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, LowY, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), LowX, LowY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), HighX, LowY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), LowX, y, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), LowX, y, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), HighX, y, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), HighX, y, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, HighY, HighZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, HighY, LowZ);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), LowX, HighY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), HighX, HighY, z);
- player.sendBlockChange(loc, blockType, metadata);
- }
-
-
- Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
- public void run(){
- Selection.Hide(player, plugin, pos1, pos2);
- }
- }, timeout * 20);
-
- }
-
- @SuppressWarnings("deprecation")
- protected static void Hide(Player player, AdvancedPortalsPlugin plugin, Location pos1, Location pos2) {
-
- int LowX = pos1.getBlockX();
- int LowY = pos1.getBlockY();
- int LowZ = pos1.getBlockZ();
-
- int HighX = pos2.getBlockX();
- int HighY = pos2.getBlockY();
- int HighZ = pos2.getBlockZ();
-
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, LowY, LowZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, LowY, HighZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), LowX, LowY, z);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), HighX, LowY, z);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), LowX, y, LowZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), LowX, y, HighZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), HighX, y, LowZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int y = LowY; y <= HighY; y++){
- Location loc = new Location(player.getWorld(), HighX, y, HighZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, HighY, HighZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int x = LowX; x <= HighX; x++){
- Location loc = new Location(player.getWorld(), x, HighY, LowZ);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), LowX, HighY, z);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
- for(int z = LowZ; z <= HighZ; z++){
- Location loc = new Location(player.getWorld(), HighX, HighY, z);
- player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
- }
-
- }
-
-}
+package com.sekwah.advancedportals;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.entity.Player;
+
+public class Selection {
+
+ public static Material blockType = Material.WOOL;
+ public static int timeout = 10;
+ public static byte metadata = 14;
+
+ @SuppressWarnings("deprecation")
+ public static void LoadData(AdvancedPortalsPlugin plugin) {
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+
+ timeout = config.getConfig().getInt("ShowSelectionShowDuration");
+
+ String BlockID = config.getConfig().getString("ShowSelectionBlockID");
+ try
+ {
+ blockType = Material.getMaterial(Integer.parseInt(BlockID));
+ }
+ catch(Exception e)
+ {
+ blockType = Material.getMaterial(BlockID);
+ }
+
+ if(blockType == null){
+ blockType = Material.STAINED_GLASS;
+ }
+
+ metadata = (byte) config.getConfig().getInt("ShowSelectionBlockData");
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void Show(final Player player, final AdvancedPortalsPlugin plugin, String portalName) {
+
+ ConfigAccessor portalConfig = new ConfigAccessor(plugin, "Portals.yml");
+
+ int LowX = portalConfig.getConfig().getInt(portalName + ".pos2.X");
+ int LowY = portalConfig.getConfig().getInt(portalName + ".pos2.Y");
+ int LowZ = portalConfig.getConfig().getInt(portalName + ".pos2.Z");
+
+ int HighX = portalConfig.getConfig().getInt(portalName + ".pos1.X");
+ int HighY = portalConfig.getConfig().getInt(portalName + ".pos1.Y");
+ int HighZ = portalConfig.getConfig().getInt(portalName + ".pos1.Z");
+
+ final Location pos1 = new Location(player.getWorld(), LowX, LowY, LowZ);
+ final Location pos2 = new Location(player.getWorld(), HighX, HighY, HighZ);
+
+ /*
+ * There are alot of for loops at the moment, when i find an easier way to do these other that a load of if statements
+ * then i will change it, but for now its the best way i can think of for doing this.
+ */
+
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, LowY, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, LowY, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), LowX, LowY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), HighX, LowY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), LowX, y, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), LowX, y, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), HighX, y, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), HighX, y, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, HighY, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, HighY, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), LowX, HighY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), HighX, HighY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+
+
+ Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ Selection.Hide(player, plugin, pos1, pos2);
+ }
+ }, timeout * 20);
+
+ }
+
+ @SuppressWarnings("deprecation")
+ public static void Show(final Player player, final AdvancedPortalsPlugin plugin) {
+
+ int LowX = 0;
+ int LowY = 0;
+ int LowZ = 0;
+
+ int HighX = 0;
+ int HighY = 0;
+ int HighZ = 0;
+
+ if(player.getMetadata("Pos1X").get(0).asInt() > player.getMetadata("Pos2X").get(0).asInt()){
+ LowX = player.getMetadata("Pos2X").get(0).asInt();
+ HighX = player.getMetadata("Pos1X").get(0).asInt();
+ }
+ else{
+ LowX = player.getMetadata("Pos1X").get(0).asInt();
+ HighX = player.getMetadata("Pos2X").get(0).asInt();
+ }
+ if(player.getMetadata("Pos1Y").get(0).asInt() > player.getMetadata("Pos2Y").get(0).asInt()){
+ LowY = player.getMetadata("Pos2Y").get(0).asInt();
+ HighY = player.getMetadata("Pos1Y").get(0).asInt();
+ }
+ else{
+ LowY = player.getMetadata("Pos1Y").get(0).asInt();
+ HighY = player.getMetadata("Pos2Y").get(0).asInt();
+ }
+ if(player.getMetadata("Pos1Z").get(0).asInt() > player.getMetadata("Pos2Z").get(0).asInt()){
+ LowZ = player.getMetadata("Pos2Z").get(0).asInt();
+ HighZ = player.getMetadata("Pos1Z").get(0).asInt();
+ }
+ else{
+ LowZ = player.getMetadata("Pos1Z").get(0).asInt();
+ HighZ = player.getMetadata("Pos2Z").get(0).asInt();
+ }
+
+ final Location pos1 = new Location(player.getWorld(), LowX, LowY, LowZ);
+ final Location pos2 = new Location(player.getWorld(), HighX, HighY, HighZ);
+
+ /*
+ * There are alot of for loops at the moment, when i find an easier way to do these other that a load of if statements
+ * then i will change it, but for now its the best way i can think of for doing this.
+ */
+
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, LowY, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, LowY, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), LowX, LowY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), HighX, LowY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), LowX, y, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), LowX, y, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), HighX, y, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), HighX, y, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, HighY, HighZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, HighY, LowZ);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), LowX, HighY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), HighX, HighY, z);
+ player.sendBlockChange(loc, blockType, metadata);
+ }
+
+
+ Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, new Runnable(){
+ public void run(){
+ Selection.Hide(player, plugin, pos1, pos2);
+ }
+ }, timeout * 20);
+
+ }
+
+ @SuppressWarnings("deprecation")
+ protected static void Hide(Player player, AdvancedPortalsPlugin plugin, Location pos1, Location pos2) {
+
+ int LowX = pos1.getBlockX();
+ int LowY = pos1.getBlockY();
+ int LowZ = pos1.getBlockZ();
+
+ int HighX = pos2.getBlockX();
+ int HighY = pos2.getBlockY();
+ int HighZ = pos2.getBlockZ();
+
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, LowY, LowZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, LowY, HighZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), LowX, LowY, z);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), HighX, LowY, z);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), LowX, y, LowZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), LowX, y, HighZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), HighX, y, LowZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int y = LowY; y <= HighY; y++){
+ Location loc = new Location(player.getWorld(), HighX, y, HighZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, HighY, HighZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int x = LowX; x <= HighX; x++){
+ Location loc = new Location(player.getWorld(), x, HighY, LowZ);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), LowX, HighY, z);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+ for(int z = LowZ; z <= HighZ; z++){
+ Location loc = new Location(player.getWorld(), HighX, HighY, z);
+ player.sendBlockChange(loc, loc.getBlock().getType(), (byte) loc.getBlock().getData());
+ }
+
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/WarpCommand.java b/src/com/sekwah/advancedportals/WarpCommand.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/WarpCommand.java
rename to src/com/sekwah/advancedportals/WarpCommand.java
index de32a883..d6ac304c 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/WarpCommand.java
+++ b/src/com/sekwah/advancedportals/WarpCommand.java
@@ -1,72 +1,72 @@
-package com.sekwah.advancedportals;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.bukkit.OfflinePlayer;
-import org.bukkit.command.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import com.sekwah.advancedportals.destinations.Destination;
-
-public class WarpCommand implements CommandExecutor, TabCompleter {
-
- private AdvancedPortalsPlugin plugin;
-
- public WarpCommand(AdvancedPortalsPlugin plugin) {
- this.plugin = plugin;
-
- plugin.getCommand("warp").setExecutor(this);
- }
-
-
- @Override
- public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
- if(args.length > 0){
- if(Destination.warp(sender, args[0], false)){
- sender.sendMessage("");
- sender.sendMessage("§a[§eAdvancedPortals§a] You have been warped to §e" + args[0] + ".");
- sender.sendMessage("");
- }
- else{
- sender.sendMessage("");
- sender.sendMessage("§c[§7AdvancedPortals§c] The destination you tried to warp to does not exist!");
- sender.sendMessage("");
- }
- }
- else{
- sender.sendMessage("");
- sender.sendMessage("§c[§7AdvancedPortals§c] You need to type a destination after /" + command + "!");
- sender.sendMessage("");
- }
- return true;
- }
-
-
- @Override
- public List onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
- LinkedList autoComplete = new LinkedList();
-
- if(sender.hasPermission("AdvancedPortals.CreatePortal")){
- if(args.length == 1){
- autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
- }
- else if(args[0].toLowerCase().equals("create")){
- }
- }
- Collections.sort(autoComplete);
- for(Object result: autoComplete.toArray()){
- if(!result.toString().startsWith(args[args.length - 1])){
- autoComplete.remove(result);
- }
- }
- return autoComplete;
- }
-
-
-}
+package com.sekwah.advancedportals;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.bukkit.OfflinePlayer;
+import org.bukkit.command.Command;
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabCompleter;
+import org.bukkit.entity.Player;
+
+import com.sekwah.advancedportals.destinations.Destination;
+
+public class WarpCommand implements CommandExecutor, TabCompleter {
+
+ private AdvancedPortalsPlugin plugin;
+
+ public WarpCommand(AdvancedPortalsPlugin plugin) {
+ this.plugin = plugin;
+
+ plugin.getCommand("warp").setExecutor(this);
+ }
+
+
+ @Override
+ public boolean onCommand(CommandSender sender, Command cmd, String command, String[] args) {
+ if(args.length > 0){
+ if(Destination.warp(sender, args[0], false)){
+ sender.sendMessage("");
+ sender.sendMessage("§a[§eAdvancedPortals§a] You have been warped to §e" + args[0] + ".");
+ sender.sendMessage("");
+ }
+ else{
+ sender.sendMessage("");
+ sender.sendMessage("§c[§7AdvancedPortals§c] The destination you tried to warp to does not exist!");
+ sender.sendMessage("");
+ }
+ }
+ else{
+ sender.sendMessage("");
+ sender.sendMessage("§c[§7AdvancedPortals§c] You need to type a destination after /" + command + "!");
+ sender.sendMessage("");
+ }
+ return true;
+ }
+
+
+ @Override
+ public List onTabComplete(CommandSender sender, Command cmd, String command, String[] args) {
+ LinkedList autoComplete = new LinkedList();
+
+ if(sender.hasPermission("AdvancedPortals.CreatePortal")){
+ if(args.length == 1){
+ autoComplete.addAll(Arrays.asList("create", "goto", "redefine", "move", "rename", "remove"));
+ }
+ else if(args[0].toLowerCase().equals("create")){
+ }
+ }
+ Collections.sort(autoComplete);
+ for(Object result: autoComplete.toArray()){
+ if(!result.toString().startsWith(args[args.length - 1])){
+ autoComplete.remove(result);
+ }
+ }
+ return autoComplete;
+ }
+
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/compat/NMS.java b/src/com/sekwah/advancedportals/compat/NMS.java
similarity index 94%
rename from Advanced Portals/src/com/sekwah/advancedportals/compat/NMS.java
rename to src/com/sekwah/advancedportals/compat/NMS.java
index a4390cf7..4f025395 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/compat/NMS.java
+++ b/src/com/sekwah/advancedportals/compat/NMS.java
@@ -1,9 +1,9 @@
-package com.sekwah.advancedportals.compat;
-
-import org.bukkit.entity.Player;
-
-public interface NMS {
-
- public void sendRawMessage(String rawMessage, Player player);
-
-}
+package com.sekwah.advancedportals.compat;
+
+import org.bukkit.entity.Player;
+
+public interface NMS {
+
+ public void sendRawMessage(String rawMessage, Player player);
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R1.java b/src/com/sekwah/advancedportals/compat/v1_7_R1.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R1.java
rename to src/com/sekwah/advancedportals/compat/v1_7_R1.java
index 06ee2a41..6d2cdc0e 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R1.java
+++ b/src/com/sekwah/advancedportals/compat/v1_7_R1.java
@@ -1,19 +1,19 @@
-package com.sekwah.advancedportals.compat;
-
-import net.minecraft.server.v1_7_R1.ChatSerializer;
-import net.minecraft.server.v1_7_R1.IChatBaseComponent;
-import net.minecraft.server.v1_7_R1.PacketPlayOutChat;
-
-import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-public class v1_7_R1 implements NMS {
-
- @Override
- public void sendRawMessage(String rawMessage, Player player) {
- IChatBaseComponent comp = ChatSerializer.a(rawMessage);
- PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
-
-}
+package com.sekwah.advancedportals.compat;
+
+import net.minecraft.server.v1_7_R1.ChatSerializer;
+import net.minecraft.server.v1_7_R1.IChatBaseComponent;
+import net.minecraft.server.v1_7_R1.PacketPlayOutChat;
+
+import org.bukkit.craftbukkit.v1_7_R1.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class v1_7_R1 implements NMS {
+
+ @Override
+ public void sendRawMessage(String rawMessage, Player player) {
+ IChatBaseComponent comp = ChatSerializer.a(rawMessage);
+ PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R2.java b/src/com/sekwah/advancedportals/compat/v1_7_R2.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R2.java
rename to src/com/sekwah/advancedportals/compat/v1_7_R2.java
index 1e2cd32f..6b689879 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R2.java
+++ b/src/com/sekwah/advancedportals/compat/v1_7_R2.java
@@ -1,19 +1,19 @@
-package com.sekwah.advancedportals.compat;
-
-import net.minecraft.server.v1_7_R2.ChatSerializer;
-import net.minecraft.server.v1_7_R2.IChatBaseComponent;
-import net.minecraft.server.v1_7_R2.PacketPlayOutChat;
-
-import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-public class v1_7_R2 implements NMS {
-
- @Override
- public void sendRawMessage(String rawMessage, Player player) {
- IChatBaseComponent comp = ChatSerializer.a(rawMessage);
- PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
-
-}
+package com.sekwah.advancedportals.compat;
+
+import net.minecraft.server.v1_7_R2.ChatSerializer;
+import net.minecraft.server.v1_7_R2.IChatBaseComponent;
+import net.minecraft.server.v1_7_R2.PacketPlayOutChat;
+
+import org.bukkit.craftbukkit.v1_7_R2.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class v1_7_R2 implements NMS {
+
+ @Override
+ public void sendRawMessage(String rawMessage, Player player) {
+ IChatBaseComponent comp = ChatSerializer.a(rawMessage);
+ PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R3.java b/src/com/sekwah/advancedportals/compat/v1_7_R3.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R3.java
rename to src/com/sekwah/advancedportals/compat/v1_7_R3.java
index e6dd2512..80d44502 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R3.java
+++ b/src/com/sekwah/advancedportals/compat/v1_7_R3.java
@@ -1,19 +1,19 @@
-package com.sekwah.advancedportals.compat;
-
-import net.minecraft.server.v1_7_R3.ChatSerializer;
-import net.minecraft.server.v1_7_R3.IChatBaseComponent;
-import net.minecraft.server.v1_7_R3.PacketPlayOutChat;
-
-import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-public class v1_7_R3 implements NMS {
-
- @Override
- public void sendRawMessage(String rawMessage, Player player) {
- IChatBaseComponent comp = ChatSerializer.a(rawMessage);
- PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
-
-}
+package com.sekwah.advancedportals.compat;
+
+import net.minecraft.server.v1_7_R3.ChatSerializer;
+import net.minecraft.server.v1_7_R3.IChatBaseComponent;
+import net.minecraft.server.v1_7_R3.PacketPlayOutChat;
+
+import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class v1_7_R3 implements NMS {
+
+ @Override
+ public void sendRawMessage(String rawMessage, Player player) {
+ IChatBaseComponent comp = ChatSerializer.a(rawMessage);
+ PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R4.java b/src/com/sekwah/advancedportals/compat/v1_7_R4.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R4.java
rename to src/com/sekwah/advancedportals/compat/v1_7_R4.java
index fdcb26ca..ddd327ad 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/compat/v1_7_R4.java
+++ b/src/com/sekwah/advancedportals/compat/v1_7_R4.java
@@ -1,19 +1,19 @@
-package com.sekwah.advancedportals.compat;
-
-import net.minecraft.server.v1_7_R4.ChatSerializer;
-import net.minecraft.server.v1_7_R4.IChatBaseComponent;
-import net.minecraft.server.v1_7_R4.PacketPlayOutChat;
-
-import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
-import org.bukkit.entity.Player;
-
-public class v1_7_R4 implements NMS {
-
- @Override
- public void sendRawMessage(String rawMessage, Player player) {
- IChatBaseComponent comp = ChatSerializer.a(rawMessage);
- PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
- ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
- }
-
-}
+package com.sekwah.advancedportals.compat;
+
+import net.minecraft.server.v1_7_R4.ChatSerializer;
+import net.minecraft.server.v1_7_R4.IChatBaseComponent;
+import net.minecraft.server.v1_7_R4.PacketPlayOutChat;
+
+import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
+import org.bukkit.entity.Player;
+
+public class v1_7_R4 implements NMS {
+
+ @Override
+ public void sendRawMessage(String rawMessage, Player player) {
+ IChatBaseComponent comp = ChatSerializer.a(rawMessage);
+ PacketPlayOutChat packet = new PacketPlayOutChat(comp, true);
+ ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/destinations/Destination.java b/src/com/sekwah/advancedportals/destinations/Destination.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/destinations/Destination.java
rename to src/com/sekwah/advancedportals/destinations/Destination.java
index edf44416..2c38156b 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/destinations/Destination.java
+++ b/src/com/sekwah/advancedportals/destinations/Destination.java
@@ -1,206 +1,206 @@
-package com.sekwah.advancedportals.destinations;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.logging.Level;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-
-import com.mysql.jdbc.Util;
-import com.sekwah.advancedportals.AdvancedPortalsPlugin;
-import com.sekwah.advancedportals.ConfigAccessor;
-import com.sekwah.advancedportals.effects.WarpEffects;
-
-public class Destination {
-
- private static AdvancedPortalsPlugin plugin;
-
- public Destination(AdvancedPortalsPlugin plugin) {
- Destination.plugin = plugin;
- }
-
- public static void create(Location location, String name){
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
-
- config.getConfig().set(name.toLowerCase() + ".world", location.getWorld().getName());
-
- config.getConfig().set(name.toLowerCase() + ".pos.X", location.getX());
- config.getConfig().set(name.toLowerCase() + ".pos.Y", location.getY());
- config.getConfig().set(name.toLowerCase() + ".pos.Z", location.getZ());
-
- config.getConfig().set(name.toLowerCase() + ".pos.pitch", location.getPitch());
- config.getConfig().set(name.toLowerCase() + ".pos.yaw", location.getYaw());
-
- config.saveConfig();
- }
-
- public static void move(Location location, String name){
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
-
- config.getConfig().set(name.toLowerCase() + ".world", location.getWorld().getName());
-
- config.getConfig().set(name.toLowerCase() + ".pos.X", location.getX());
- config.getConfig().set(name.toLowerCase() + ".pos.Y", location.getY());
- config.getConfig().set(name.toLowerCase() + ".pos.Z", location.getZ());
-
- config.getConfig().set(name.toLowerCase() + ".pos.pitch", location.getPitch());
- config.getConfig().set(name.toLowerCase() + ".pos.yaw", location.getYaw());
-
- config.saveConfig();
- }
-
- public static void rename(String oldName, String newName){
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
-
- config.getConfig().set(newName.toLowerCase() + ".world", config.getConfig().getString(oldName + ".world"));
-
- config.getConfig().set(newName.toLowerCase() + ".pos.X", config.getConfig().getDouble(oldName + ".pos.X"));
- config.getConfig().set(newName.toLowerCase() + ".pos.Y", config.getConfig().getDouble(oldName + ".pos.Y"));
- config.getConfig().set(newName.toLowerCase() + ".pos.Z", config.getConfig().getDouble(oldName + ".pos.Z"));
-
- config.getConfig().set(newName.toLowerCase() + ".pos.pitch", config.getConfig().getDouble(oldName + ".pos.pitch"));
- config.getConfig().set(newName.toLowerCase() + ".pos.yaw", config.getConfig().getDouble(oldName + ".pos.yaw"));
-
- remove(oldName);
-
- config.saveConfig();
- }
-
- public static void remove(String name){
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
-
- config.getConfig().set(name.toLowerCase() + ".world", null);
-
- config.getConfig().set(name.toLowerCase() + ".pos.X", null);
- config.getConfig().set(name.toLowerCase() + ".pos.Y", null);
- config.getConfig().set(name.toLowerCase() + ".pos.Z", null);
-
- config.getConfig().set(name.toLowerCase() + ".pos.pitch", null);
- config.getConfig().set(name.toLowerCase() + ".pos.yaw", null);
-
- config.getConfig().set(name.toLowerCase() + ".pos", null);
-
- config.getConfig().set(name.toLowerCase(), null);
-
- config.saveConfig();
- }
-
- public static boolean warp(Player player, String name, boolean senderror){
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
- if(config.getConfig().getString(name + ".world") != null){
- Location loc = player.getLocation();
- if(Bukkit.getWorld(config.getConfig().getString(name + ".world")) != null){
- loc.setWorld(Bukkit.getWorld(config.getConfig().getString(name + ".world")));
-
- loc.setX(config.getConfig().getDouble(name + ".pos.X"));
- loc.setY(config.getConfig().getDouble(name + ".pos.Y"));
- loc.setZ(config.getConfig().getDouble(name + ".pos.Z"));
-
- loc.setPitch((float) config.getConfig().getDouble(name + ".pos.pitch"));
- loc.setYaw((float) config.getConfig().getDouble(name + ".pos.yaw"));
-
- WarpEffects.activateParticles(player);
- WarpEffects.activateSound(player);
- Chunk c = loc.getChunk();
- Entity riding = player.getVehicle();
- if (!c.isLoaded()) c.load();
- if(player.getVehicle() != null){
- riding.eject();
- riding.teleport(loc);
- player.teleport(loc);
- riding.setPassenger(player);
- }
- else{
- player.teleport(loc);
- }
- WarpEffects.activateParticles(player);
- WarpEffects.activateSound(player);
-
-
- return true;
- }
- else{
- if(senderror){
- player.sendMessage("§c[§7AdvancedPortals§c] The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
- plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' is linked to the world "
- + config.getConfig().getString(name + ".world") + " which doesnt seem to exist any more!");
- }
- return false;
- }
- }
- else{
- if(senderror){
- player.sendMessage("§c[§7AdvancedPortals§c] There has been a problem warping you to the selected destination!");
- plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' has just had a warp "
- + "attempt and either the data is corrupt or that destination doesn't exist!");
- }
- return false;
- }
-
- }
-
- /**
- * Same as other warp but changes sender to player for you.
- *
- * @param sender
- * @param name
- * @return
- */
- public static boolean warp(Player player, String name) {
- return warp(player, name, true);
-
- }
-
- /**
- * Same as other warp but changes sender to player for you.
- *
- * @param sender
- * @param name
- * @return
- */
- public static boolean warp(CommandSender sender, String name, boolean senderror) {
- Player player = (Player)sender;
- return warp(player, name, senderror);
-
- }
-
- /**
- * Same as other warp but changes sender to player for you.
- *
- * @param sender
- * @param name
- * @return
- */
- public static boolean warp(CommandSender sender, String name) {
- Player player = (Player)sender;
- return warp(player, name, true);
-
- }
-
- public static List destiList(){
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
-
- LinkedList destiList = new LinkedList();
-
- Set destiSet = config.getConfig().getKeys(false);
- if(destiSet.size() > 0){;
- for(Object desti: destiSet.toArray()){
- destiSet.add(desti.toString());
- }
- }
-
- Collections.sort(destiList);
- return destiList;
- }
-}
+package com.sekwah.advancedportals.destinations;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+
+import com.mysql.jdbc.Util;
+import com.sekwah.advancedportals.AdvancedPortalsPlugin;
+import com.sekwah.advancedportals.ConfigAccessor;
+import com.sekwah.advancedportals.effects.WarpEffects;
+
+public class Destination {
+
+ private static AdvancedPortalsPlugin plugin;
+
+ public Destination(AdvancedPortalsPlugin plugin) {
+ Destination.plugin = plugin;
+ }
+
+ public static void create(Location location, String name){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+
+ config.getConfig().set(name.toLowerCase() + ".world", location.getWorld().getName());
+
+ config.getConfig().set(name.toLowerCase() + ".pos.X", location.getX());
+ config.getConfig().set(name.toLowerCase() + ".pos.Y", location.getY());
+ config.getConfig().set(name.toLowerCase() + ".pos.Z", location.getZ());
+
+ config.getConfig().set(name.toLowerCase() + ".pos.pitch", location.getPitch());
+ config.getConfig().set(name.toLowerCase() + ".pos.yaw", location.getYaw());
+
+ config.saveConfig();
+ }
+
+ public static void move(Location location, String name){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+
+ config.getConfig().set(name.toLowerCase() + ".world", location.getWorld().getName());
+
+ config.getConfig().set(name.toLowerCase() + ".pos.X", location.getX());
+ config.getConfig().set(name.toLowerCase() + ".pos.Y", location.getY());
+ config.getConfig().set(name.toLowerCase() + ".pos.Z", location.getZ());
+
+ config.getConfig().set(name.toLowerCase() + ".pos.pitch", location.getPitch());
+ config.getConfig().set(name.toLowerCase() + ".pos.yaw", location.getYaw());
+
+ config.saveConfig();
+ }
+
+ public static void rename(String oldName, String newName){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+
+ config.getConfig().set(newName.toLowerCase() + ".world", config.getConfig().getString(oldName + ".world"));
+
+ config.getConfig().set(newName.toLowerCase() + ".pos.X", config.getConfig().getDouble(oldName + ".pos.X"));
+ config.getConfig().set(newName.toLowerCase() + ".pos.Y", config.getConfig().getDouble(oldName + ".pos.Y"));
+ config.getConfig().set(newName.toLowerCase() + ".pos.Z", config.getConfig().getDouble(oldName + ".pos.Z"));
+
+ config.getConfig().set(newName.toLowerCase() + ".pos.pitch", config.getConfig().getDouble(oldName + ".pos.pitch"));
+ config.getConfig().set(newName.toLowerCase() + ".pos.yaw", config.getConfig().getDouble(oldName + ".pos.yaw"));
+
+ remove(oldName);
+
+ config.saveConfig();
+ }
+
+ public static void remove(String name){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+
+ config.getConfig().set(name.toLowerCase() + ".world", null);
+
+ config.getConfig().set(name.toLowerCase() + ".pos.X", null);
+ config.getConfig().set(name.toLowerCase() + ".pos.Y", null);
+ config.getConfig().set(name.toLowerCase() + ".pos.Z", null);
+
+ config.getConfig().set(name.toLowerCase() + ".pos.pitch", null);
+ config.getConfig().set(name.toLowerCase() + ".pos.yaw", null);
+
+ config.getConfig().set(name.toLowerCase() + ".pos", null);
+
+ config.getConfig().set(name.toLowerCase(), null);
+
+ config.saveConfig();
+ }
+
+ public static boolean warp(Player player, String name, boolean senderror){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+ if(config.getConfig().getString(name + ".world") != null){
+ Location loc = player.getLocation();
+ if(Bukkit.getWorld(config.getConfig().getString(name + ".world")) != null){
+ loc.setWorld(Bukkit.getWorld(config.getConfig().getString(name + ".world")));
+
+ loc.setX(config.getConfig().getDouble(name + ".pos.X"));
+ loc.setY(config.getConfig().getDouble(name + ".pos.Y"));
+ loc.setZ(config.getConfig().getDouble(name + ".pos.Z"));
+
+ loc.setPitch((float) config.getConfig().getDouble(name + ".pos.pitch"));
+ loc.setYaw((float) config.getConfig().getDouble(name + ".pos.yaw"));
+
+ WarpEffects.activateParticles(player);
+ WarpEffects.activateSound(player);
+ Chunk c = loc.getChunk();
+ Entity riding = player.getVehicle();
+ if (!c.isLoaded()) c.load();
+ if(player.getVehicle() != null){
+ riding.eject();
+ riding.teleport(loc);
+ player.teleport(loc);
+ riding.setPassenger(player);
+ }
+ else{
+ player.teleport(loc);
+ }
+ WarpEffects.activateParticles(player);
+ WarpEffects.activateSound(player);
+
+
+ return true;
+ }
+ else{
+ if(senderror){
+ player.sendMessage("§c[§7AdvancedPortals§c] The destination you are trying to warp to seems to be linked to a world that doesn't exist!");
+ plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' is linked to the world "
+ + config.getConfig().getString(name + ".world") + " which doesnt seem to exist any more!");
+ }
+ return false;
+ }
+ }
+ else{
+ if(senderror){
+ player.sendMessage("§c[§7AdvancedPortals§c] There has been a problem warping you to the selected destination!");
+ plugin.getLogger().log(Level.SEVERE, "The destination '" + name + "' has just had a warp "
+ + "attempt and either the data is corrupt or that destination doesn't exist!");
+ }
+ return false;
+ }
+
+ }
+
+ /**
+ * Same as other warp but changes sender to player for you.
+ *
+ * @param sender
+ * @param name
+ * @return
+ */
+ public static boolean warp(Player player, String name) {
+ return warp(player, name, true);
+
+ }
+
+ /**
+ * Same as other warp but changes sender to player for you.
+ *
+ * @param sender
+ * @param name
+ * @return
+ */
+ public static boolean warp(CommandSender sender, String name, boolean senderror) {
+ Player player = (Player)sender;
+ return warp(player, name, senderror);
+
+ }
+
+ /**
+ * Same as other warp but changes sender to player for you.
+ *
+ * @param sender
+ * @param name
+ * @return
+ */
+ public static boolean warp(CommandSender sender, String name) {
+ Player player = (Player)sender;
+ return warp(player, name, true);
+
+ }
+
+ public static List destiList(){
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Destinations.yml");
+
+ LinkedList destiList = new LinkedList();
+
+ Set destiSet = config.getConfig().getKeys(false);
+ if(destiSet.size() > 0){;
+ for(Object desti: destiSet.toArray()){
+ destiSet.add(desti.toString());
+ }
+ }
+
+ Collections.sort(destiList);
+ return destiList;
+ }
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/effects/WarpEffects.java b/src/com/sekwah/advancedportals/effects/WarpEffects.java
similarity index 95%
rename from Advanced Portals/src/com/sekwah/advancedportals/effects/WarpEffects.java
rename to src/com/sekwah/advancedportals/effects/WarpEffects.java
index 2dfdf896..ae90d29b 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/effects/WarpEffects.java
+++ b/src/com/sekwah/advancedportals/effects/WarpEffects.java
@@ -1,45 +1,45 @@
-package com.sekwah.advancedportals.effects;
-
-import org.bukkit.Effect;
-import org.bukkit.Instrument;
-import org.bukkit.Location;
-import org.bukkit.Note;
-import org.bukkit.Sound;
-import org.bukkit.World;
-import org.bukkit.Note.Tone;
-import org.bukkit.entity.Player;
-
-import com.sekwah.advancedportals.Assets;
-
-public class WarpEffects {
-
- public static void activateParticles(Player player) {
- Location loc = player.getLocation();
- World world = player.getWorld();
- switch (Assets.currentWarpParticles){
- case 1:
- for(int i = 0; i < 10; i++){
- world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
- }
- loc.add(0D, 1D, 0D);
- for(int i = 0; i < 10; i++){
- world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
- }
- default: break;
- }
-
- }
-
- public static void activateSound(Player player) {
- Location loc = player.getLocation();
- World world = player.getWorld();
- switch (Assets.currentWarpParticles){
- case 1:
- world.playSound(loc, Sound.ENDERMAN_TELEPORT, 1F, 1F);
- default: break;
- }
-
-
- }
-
-}
+package com.sekwah.advancedportals.effects;
+
+import org.bukkit.Effect;
+import org.bukkit.Instrument;
+import org.bukkit.Location;
+import org.bukkit.Note;
+import org.bukkit.Sound;
+import org.bukkit.World;
+import org.bukkit.Note.Tone;
+import org.bukkit.entity.Player;
+
+import com.sekwah.advancedportals.Assets;
+
+public class WarpEffects {
+
+ public static void activateParticles(Player player) {
+ Location loc = player.getLocation();
+ World world = player.getWorld();
+ switch (Assets.currentWarpParticles){
+ case 1:
+ for(int i = 0; i < 10; i++){
+ world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
+ }
+ loc.add(0D, 1D, 0D);
+ for(int i = 0; i < 10; i++){
+ world.playEffect(loc, Effect.ENDER_SIGNAL, 0);
+ }
+ default: break;
+ }
+
+ }
+
+ public static void activateSound(Player player) {
+ Location loc = player.getLocation();
+ World world = player.getWorld();
+ switch (Assets.currentWarpParticles){
+ case 1:
+ world.playSound(loc, Sound.ENDERMAN_TELEPORT, 1F, 1F);
+ default: break;
+ }
+
+
+ }
+
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/events/WarpEvent.java b/src/com/sekwah/advancedportals/events/WarpEvent.java
similarity index 95%
rename from Advanced Portals/src/com/sekwah/advancedportals/events/WarpEvent.java
rename to src/com/sekwah/advancedportals/events/WarpEvent.java
index b85ce612..06cd8489 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/events/WarpEvent.java
+++ b/src/com/sekwah/advancedportals/events/WarpEvent.java
@@ -1,75 +1,75 @@
-package com.sekwah.advancedportals.events;
-
-import org.bukkit.entity.Player;
-import org.bukkit.event.Event;
-import org.bukkit.event.HandlerList;
-import org.bukkit.event.Cancellable;
-
-import com.sekwah.advancedportals.portalcontrolls.Portal;
-
-public final class WarpEvent extends Event implements Cancellable {
-
- /**
- * Use listeners so you can add new triggers easier and also other plugins can listen for the event
- * and add their own triggers
- */
-
-
- private static final HandlerList handlers = new HandlerList();
-
- private boolean cancelled = false;
- private Player player;
- private String portalName;
-
- private boolean hasWarped = false;
-
- public WarpEvent(Player player, String portalName) {
- this.player = player;
- this.portalName = portalName;
- }
-
-
- /**
- * Returns if the event has been cancelled
- *
- * @return cancelled
- */
- public boolean isCancelled() {
- return cancelled;
- }
-
- public void setCancelled(boolean cancel) {
- cancelled = cancel;
- }
-
- /**
- * If the
- *
- * @param warped
- */
- public void setHasWarped(boolean warped){
- this.hasWarped = warped;
- }
-
- /**
- * This will return true if another plugin has warped the player(and set this to true)
- *
- * @return hasWarped
- */
- public boolean getHasWarped(){
- return hasWarped;
- }
-
- public Player getPlayer(){
- return player;
- }
-
-
- public HandlerList getHandlers() {
- return handlers;
- }
-
- public static HandlerList getHandlerList() {
- return handlers;
- }
+package com.sekwah.advancedportals.events;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Event;
+import org.bukkit.event.HandlerList;
+import org.bukkit.event.Cancellable;
+
+import com.sekwah.advancedportals.portalcontrolls.Portal;
+
+public final class WarpEvent extends Event implements Cancellable {
+
+ /**
+ * Use listeners so you can add new triggers easier and also other plugins can listen for the event
+ * and add their own triggers
+ */
+
+
+ private static final HandlerList handlers = new HandlerList();
+
+ private boolean cancelled = false;
+ private Player player;
+ private String portalName;
+
+ private boolean hasWarped = false;
+
+ public WarpEvent(Player player, String portalName) {
+ this.player = player;
+ this.portalName = portalName;
+ }
+
+
+ /**
+ * Returns if the event has been cancelled
+ *
+ * @return cancelled
+ */
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+
+ /**
+ * If the
+ *
+ * @param warped
+ */
+ public void setHasWarped(boolean warped){
+ this.hasWarped = warped;
+ }
+
+ /**
+ * This will return true if another plugin has warped the player(and set this to true)
+ *
+ * @return hasWarped
+ */
+ public boolean getHasWarped(){
+ return hasWarped;
+ }
+
+ public Player getPlayer(){
+ return player;
+ }
+
+
+ public HandlerList getHandlers() {
+ return handlers;
+ }
+
+ public static HandlerList getHandlerList() {
+ return handlers;
+ }
}
\ No newline at end of file
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/metrics/Metrics.java b/src/com/sekwah/advancedportals/metrics/Metrics.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/metrics/Metrics.java
rename to src/com/sekwah/advancedportals/metrics/Metrics.java
index 4034b871..51dc20ca 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/metrics/Metrics.java
+++ b/src/com/sekwah/advancedportals/metrics/Metrics.java
@@ -1,759 +1,759 @@
-/*
- * Copyright 2011-2013 Tyler Blair. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification, are
- * permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this list of
- * conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this list
- * of conditions and the following disclaimer in the documentation and/or other materials
- * provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
- * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * The views and conclusions contained in the software and documentation are those of the
- * authors and contributors and should not be interpreted as representing official policies,
- * either expressed or implied, of anybody else.
- */
-package com.sekwah.advancedportals.metrics;
-
-import org.bukkit.Bukkit;
-import org.bukkit.configuration.InvalidConfigurationException;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.plugin.Plugin;
-import org.bukkit.plugin.PluginDescriptionFile;
-import org.bukkit.scheduler.BukkitTask;
-
-import java.io.BufferedReader;
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.UnsupportedEncodingException;
-import java.net.Proxy;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.Set;
-import java.util.UUID;
-import java.util.logging.Level;
-import java.util.zip.GZIPOutputStream;
-
-public class Metrics {
-
- /**
- * The current revision number
- */
- private final static int REVISION = 7;
-
- /**
- * The base url of the metrics domain
- */
- private static final String BASE_URL = "http://report.mcstats.org";
-
- /**
- * The url used to report a server's status
- */
- private static final String REPORT_URL = "/plugin/%s";
-
- /**
- * Interval of time to ping (in minutes)
- */
- private static final int PING_INTERVAL = 15;
-
- /**
- * The plugin this metrics submits for
- */
- private final Plugin plugin;
-
- /**
- * All of the custom graphs to submit to metrics
- */
- private final Set graphs = Collections.synchronizedSet(new HashSet());
-
- /**
- * The plugin configuration file
- */
- private final YamlConfiguration configuration;
-
- /**
- * The plugin configuration file
- */
- private final File configurationFile;
-
- /**
- * Unique server id
- */
- private final String guid;
-
- /**
- * Debug mode
- */
- private final boolean debug;
-
- /**
- * Lock for synchronization
- */
- private final Object optOutLock = new Object();
-
- /**
- * The scheduled task
- */
- private volatile BukkitTask task = null;
-
- public Metrics(final Plugin plugin) throws IOException {
- if (plugin == null) {
- throw new IllegalArgumentException("Plugin cannot be null");
- }
-
- this.plugin = plugin;
-
- // load the config
- configurationFile = getConfigFile();
- configuration = YamlConfiguration.loadConfiguration(configurationFile);
-
- // add some defaults
- configuration.addDefault("opt-out", false);
- configuration.addDefault("guid", UUID.randomUUID().toString());
- configuration.addDefault("debug", false);
-
- // Do we need to create the file?
- if (configuration.get("guid", null) == null) {
- configuration.options().header("http://mcstats.org").copyDefaults(true);
- configuration.save(configurationFile);
- }
-
- // Load the guid then
- guid = configuration.getString("guid");
- debug = configuration.getBoolean("debug", false);
- }
-
- /**
- * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics
- * website. Plotters can be added to the graph object returned.
- *
- * @param name The name of the graph
- * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
- */
- public Graph createGraph(final String name) {
- if (name == null) {
- throw new IllegalArgumentException("Graph name cannot be null");
- }
-
- // Construct the graph object
- final Graph graph = new Graph(name);
-
- // Now we can add our graph
- graphs.add(graph);
-
- // and return back
- return graph;
- }
-
- /**
- * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
- *
- * @param graph The name of the graph
- */
- public void addGraph(final Graph graph) {
- if (graph == null) {
- throw new IllegalArgumentException("Graph cannot be null");
- }
-
- graphs.add(graph);
- }
-
- /**
- * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
- * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
- * ticks.
- *
- * @return True if statistics measuring is running, otherwise false.
- */
- public boolean start() {
- synchronized (optOutLock) {
- // Did we opt out?
- if (isOptOut()) {
- return false;
- }
-
- // Is metrics already running?
- if (task != null) {
- return true;
- }
-
- // Begin hitting the server with glorious data
- task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
-
- private boolean firstPost = true;
-
- public void run() {
- try {
- // This has to be synchronized or it can collide with the disable method.
- synchronized (optOutLock) {
- // Disable Task, if it is running and the server owner decided to opt-out
- if (isOptOut() && task != null) {
- task.cancel();
- task = null;
- // Tell all plotters to stop gathering information.
- for (Graph graph : graphs) {
- graph.onOptOut();
- }
- }
- }
-
- // We use the inverse of firstPost because if it is the first time we are posting,
- // it is not a interval ping, so it evaluates to FALSE
- // Each time thereafter it will evaluate to TRUE, i.e PING!
- postPlugin(!firstPost);
-
- // After the first post we set firstPost to false
- // Each post thereafter will be a ping
- firstPost = false;
- } catch (IOException e) {
- if (debug) {
- Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
- }
- }
- }
- }, 0, PING_INTERVAL * 1200);
-
- return true;
- }
- }
-
- /**
- * Has the server owner denied plugin metrics?
- *
- * @return true if metrics should be opted out of it
- */
- public boolean isOptOut() {
- synchronized (optOutLock) {
- try {
- // Reload the metrics file
- configuration.load(getConfigFile());
- } catch (IOException ex) {
- if (debug) {
- Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
- }
- return true;
- } catch (InvalidConfigurationException ex) {
- if (debug) {
- Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
- }
- return true;
- }
- return configuration.getBoolean("opt-out", false);
- }
- }
-
- /**
- * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
- *
- * @throws java.io.IOException
- */
- public void enable() throws IOException {
- // This has to be synchronized or it can collide with the check in the task.
- synchronized (optOutLock) {
- // Check if the server owner has already set opt-out, if not, set it.
- if (isOptOut()) {
- configuration.set("opt-out", false);
- configuration.save(configurationFile);
- }
-
- // Enable Task, if it is not running
- if (task == null) {
- start();
- }
- }
- }
-
- /**
- * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
- *
- * @throws java.io.IOException
- */
- public void disable() throws IOException {
- // This has to be synchronized or it can collide with the check in the task.
- synchronized (optOutLock) {
- // Check if the server owner has already set opt-out, if not, set it.
- if (!isOptOut()) {
- configuration.set("opt-out", true);
- configuration.save(configurationFile);
- }
-
- // Disable Task, if it is running
- if (task != null) {
- task.cancel();
- task = null;
- }
- }
- }
-
- /**
- * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
- *
- * @return the File object for the config file
- */
- public File getConfigFile() {
- // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
- // is to abuse the plugin object we already have
- // plugin.getDataFolder() => base/plugins/PluginA/
- // pluginsFolder => base/plugins/
- // The base is not necessarily relative to the startup directory.
- File pluginsFolder = plugin.getDataFolder().getParentFile();
-
- // return => base/plugins/PluginMetrics/config.yml
- return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
- }
-
- /**
- * Generic method that posts a plugin to the metrics website
- */
- private void postPlugin(final boolean isPing) throws IOException {
- // Server software specific section
- PluginDescriptionFile description = plugin.getDescription();
- String pluginName = description.getName();
- boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
- String pluginVersion = description.getVersion();
- String serverVersion = Bukkit.getVersion();
- int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
-
- // END server software specific section -- all code below does not use any code outside of this class / Java
-
- // Construct the post data
- StringBuilder json = new StringBuilder(1024);
- json.append('{');
-
- // The plugin's description file containg all of the plugin data such as name, version, author, etc
- appendJSONPair(json, "guid", guid);
- appendJSONPair(json, "plugin_version", pluginVersion);
- appendJSONPair(json, "server_version", serverVersion);
- appendJSONPair(json, "players_online", Integer.toString(playersOnline));
-
- // New data as of R6
- 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();
-
- // normalize os arch .. amd64 -> x86_64
- if (osarch.equals("amd64")) {
- osarch = "x86_64";
- }
-
- appendJSONPair(json, "osname", osname);
- appendJSONPair(json, "osarch", osarch);
- appendJSONPair(json, "osversion", osversion);
- appendJSONPair(json, "cores", Integer.toString(coreCount));
- appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
- appendJSONPair(json, "java_version", java_version);
-
- // If we're pinging, append it
- if (isPing) {
- appendJSONPair(json, "ping", "1");
- }
-
- if (graphs.size() > 0) {
- synchronized (graphs) {
- json.append(',');
- json.append('"');
- json.append("graphs");
- json.append('"');
- json.append(':');
- json.append('{');
-
- boolean firstGraph = true;
-
- final Iterator iter = graphs.iterator();
-
- while (iter.hasNext()) {
- Graph graph = iter.next();
-
- StringBuilder graphJson = new StringBuilder();
- graphJson.append('{');
-
- for (Plotter plotter : graph.getPlotters()) {
- appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
- }
-
- graphJson.append('}');
-
- if (!firstGraph) {
- json.append(',');
- }
-
- json.append(escapeJSON(graph.getName()));
- json.append(':');
- json.append(graphJson);
-
- firstGraph = false;
- }
-
- json.append('}');
- }
- }
-
- // close json
- json.append('}');
-
- // Create the url
- URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
-
- // Connect to the website
- URLConnection connection;
-
- // Mineshafter creates a socks proxy, so we can safely bypass it
- // It does not reroute POST requests so we need to go around it
- if (isMineshafterPresent()) {
- connection = url.openConnection(Proxy.NO_PROXY);
- } else {
- connection = url.openConnection();
- }
-
-
- byte[] uncompressed = json.toString().getBytes();
- byte[] compressed = gzip(json.toString());
-
- // Headers
- connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
- connection.addRequestProperty("Content-Type", "application/json");
- connection.addRequestProperty("Content-Encoding", "gzip");
- connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
- connection.addRequestProperty("Accept", "application/json");
- connection.addRequestProperty("Connection", "close");
-
- connection.setDoOutput(true);
-
- if (debug) {
- System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
- }
-
- // Write the data
- OutputStream os = connection.getOutputStream();
- os.write(compressed);
- os.flush();
-
- // Now read the response
- final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
- String response = reader.readLine();
-
- // close resources
- os.close();
- reader.close();
-
- if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
- if (response == null) {
- response = "null";
- } else if (response.startsWith("7")) {
- response = response.substring(response.startsWith("7,") ? 2 : 1);
- }
-
- throw new IOException(response);
- } else {
- // Is this the first update this hour?
- if (response.equals("1") || response.contains("This is your first update this hour")) {
- synchronized (graphs) {
- final Iterator iter = graphs.iterator();
-
- while (iter.hasNext()) {
- final Graph graph = iter.next();
-
- for (Plotter plotter : graph.getPlotters()) {
- plotter.reset();
- }
- }
- }
- }
- }
- }
-
- /**
- * GZip compress a string of bytes
- *
- * @param input
- * @return
- */
- public static byte[] gzip(String input) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- GZIPOutputStream gzos = null;
-
- try {
- gzos = new GZIPOutputStream(baos);
- gzos.write(input.getBytes("UTF-8"));
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (gzos != null) try {
- gzos.close();
- } catch (IOException ignore) {
- }
- }
-
- return baos.toByteArray();
- }
-
- /**
- * Check if mineshafter is present. If it is, we need to bypass it to send POST requests
- *
- * @return true if mineshafter is installed on the server
- */
- private boolean isMineshafterPresent() {
- try {
- Class.forName("mineshafter.MineServer");
- return true;
- } catch (Exception e) {
- return false;
- }
- }
-
- /**
- * Appends a json encoded key/value pair to the given string builder.
- *
- * @param json
- * @param key
- * @param value
- * @throws UnsupportedEncodingException
- */
- private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
- boolean isValueNumeric = false;
-
- try {
- if (value.equals("0") || !value.endsWith("0")) {
- Double.parseDouble(value);
- isValueNumeric = true;
- }
- } catch (NumberFormatException e) {
- isValueNumeric = false;
- }
-
- if (json.charAt(json.length() - 1) != '{') {
- json.append(',');
- }
-
- json.append(escapeJSON(key));
- json.append(':');
-
- if (isValueNumeric) {
- json.append(value);
- } else {
- json.append(escapeJSON(value));
- }
- }
-
- /**
- * Escape a string to create a valid JSON string
- *
- * @param text
- * @return
- */
- private static String escapeJSON(String text) {
- StringBuilder builder = new StringBuilder();
-
- builder.append('"');
- for (int index = 0; index < text.length(); index++) {
- char chr = text.charAt(index);
-
- switch (chr) {
- case '"':
- case '\\':
- builder.append('\\');
- builder.append(chr);
- break;
- case '\b':
- builder.append("\\b");
- break;
- case '\t':
- builder.append("\\t");
- break;
- case '\n':
- builder.append("\\n");
- break;
- case '\r':
- builder.append("\\r");
- break;
- default:
- if (chr < ' ') {
- String t = "000" + Integer.toHexString(chr);
- builder.append("\\u" + t.substring(t.length() - 4));
- } else {
- builder.append(chr);
- }
- break;
- }
- }
- builder.append('"');
-
- return builder.toString();
- }
-
- /**
- * Encode text as UTF-8
- *
- * @param text the text to encode
- * @return the encoded text, as UTF-8
- */
- private static String urlEncode(final String text) throws UnsupportedEncodingException {
- return URLEncoder.encode(text, "UTF-8");
- }
-
- /**
- * Represents a custom graph on the website
- */
- public static class Graph {
-
- /**
- * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is
- * rejected
- */
- private final String name;
-
- /**
- * The set of plotters that are contained within this graph
- */
- private final Set plotters = new LinkedHashSet();
-
- private Graph(final String name) {
- this.name = name;
- }
-
- /**
- * Gets the graph's name
- *
- * @return the Graph's name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Add a plotter to the graph, which will be used to plot entries
- *
- * @param plotter the plotter to add to the graph
- */
- public void addPlotter(final Plotter plotter) {
- plotters.add(plotter);
- }
-
- /**
- * Remove a plotter from the graph
- *
- * @param plotter the plotter to remove from the graph
- */
- public void removePlotter(final Plotter plotter) {
- plotters.remove(plotter);
- }
-
- /**
- * Gets an unmodifiable set of the plotter objects in the graph
- *
- * @return an unmodifiable {@link java.util.Set} of the plotter objects
- */
- public Set getPlotters() {
- return Collections.unmodifiableSet(plotters);
- }
-
- @Override
- public int hashCode() {
- return name.hashCode();
- }
-
- @Override
- public boolean equals(final Object object) {
- if (!(object instanceof Graph)) {
- return false;
- }
-
- final Graph graph = (Graph) object;
- return graph.name.equals(name);
- }
-
- /**
- * Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
- */
- protected void onOptOut() {
- }
- }
-
- /**
- * Interface used to collect custom data for a plugin
- */
- public static abstract class Plotter {
-
- /**
- * The plot's name
- */
- private final String name;
-
- /**
- * Construct a plotter with the default plot name
- */
- public Plotter() {
- this("Default");
- }
-
- /**
- * Construct a plotter with a specific plot name
- *
- * @param name the name of the plotter to use, which will show up on the website
- */
- public Plotter(final String name) {
- this.name = name;
- }
-
- /**
- * Get the current value for the plotted point. Since this function defers to an external function it may or may
- * not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
- * from any thread so care should be taken when accessing resources that need to be synchronized.
- *
- * @return the current value for the point to be plotted.
- */
- public abstract int getValue();
-
- /**
- * Get the column name for the plotted point
- *
- * @return the plotted point's column name
- */
- public String getColumnName() {
- return name;
- }
-
- /**
- * Called after the website graphs have been updated
- */
- public void reset() {
- }
-
- @Override
- public int hashCode() {
- return getColumnName().hashCode();
- }
-
- @Override
- public boolean equals(final Object object) {
- if (!(object instanceof Plotter)) {
- return false;
- }
-
- final Plotter plotter = (Plotter) object;
- return plotter.name.equals(name) && plotter.getValue() == getValue();
- }
- }
+/*
+ * Copyright 2011-2013 Tyler Blair. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and contributors and should not be interpreted as representing official policies,
+ * either expressed or implied, of anybody else.
+ */
+package com.sekwah.advancedportals.metrics;
+
+import org.bukkit.Bukkit;
+import org.bukkit.configuration.InvalidConfigurationException;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.plugin.Plugin;
+import org.bukkit.plugin.PluginDescriptionFile;
+import org.bukkit.scheduler.BukkitTask;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.Proxy;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.zip.GZIPOutputStream;
+
+public class Metrics {
+
+ /**
+ * The current revision number
+ */
+ private final static int REVISION = 7;
+
+ /**
+ * The base url of the metrics domain
+ */
+ private static final String BASE_URL = "http://report.mcstats.org";
+
+ /**
+ * The url used to report a server's status
+ */
+ private static final String REPORT_URL = "/plugin/%s";
+
+ /**
+ * Interval of time to ping (in minutes)
+ */
+ private static final int PING_INTERVAL = 15;
+
+ /**
+ * The plugin this metrics submits for
+ */
+ private final Plugin plugin;
+
+ /**
+ * All of the custom graphs to submit to metrics
+ */
+ private final Set graphs = Collections.synchronizedSet(new HashSet());
+
+ /**
+ * The plugin configuration file
+ */
+ private final YamlConfiguration configuration;
+
+ /**
+ * The plugin configuration file
+ */
+ private final File configurationFile;
+
+ /**
+ * Unique server id
+ */
+ private final String guid;
+
+ /**
+ * Debug mode
+ */
+ private final boolean debug;
+
+ /**
+ * Lock for synchronization
+ */
+ private final Object optOutLock = new Object();
+
+ /**
+ * The scheduled task
+ */
+ private volatile BukkitTask task = null;
+
+ public Metrics(final Plugin plugin) throws IOException {
+ if (plugin == null) {
+ throw new IllegalArgumentException("Plugin cannot be null");
+ }
+
+ this.plugin = plugin;
+
+ // load the config
+ configurationFile = getConfigFile();
+ configuration = YamlConfiguration.loadConfiguration(configurationFile);
+
+ // add some defaults
+ configuration.addDefault("opt-out", false);
+ configuration.addDefault("guid", UUID.randomUUID().toString());
+ configuration.addDefault("debug", false);
+
+ // Do we need to create the file?
+ if (configuration.get("guid", null) == null) {
+ configuration.options().header("http://mcstats.org").copyDefaults(true);
+ configuration.save(configurationFile);
+ }
+
+ // Load the guid then
+ guid = configuration.getString("guid");
+ debug = configuration.getBoolean("debug", false);
+ }
+
+ /**
+ * Construct and create a Graph that can be used to separate specific plotters to their own graphs on the metrics
+ * website. Plotters can be added to the graph object returned.
+ *
+ * @param name The name of the graph
+ * @return Graph object created. Will never return NULL under normal circumstances unless bad parameters are given
+ */
+ public Graph createGraph(final String name) {
+ if (name == null) {
+ throw new IllegalArgumentException("Graph name cannot be null");
+ }
+
+ // Construct the graph object
+ final Graph graph = new Graph(name);
+
+ // Now we can add our graph
+ graphs.add(graph);
+
+ // and return back
+ return graph;
+ }
+
+ /**
+ * Add a Graph object to BukkitMetrics that represents data for the plugin that should be sent to the backend
+ *
+ * @param graph The name of the graph
+ */
+ public void addGraph(final Graph graph) {
+ if (graph == null) {
+ throw new IllegalArgumentException("Graph cannot be null");
+ }
+
+ graphs.add(graph);
+ }
+
+ /**
+ * Start measuring statistics. This will immediately create an async repeating task as the plugin and send the
+ * initial data to the metrics backend, and then after that it will post in increments of PING_INTERVAL * 1200
+ * ticks.
+ *
+ * @return True if statistics measuring is running, otherwise false.
+ */
+ public boolean start() {
+ synchronized (optOutLock) {
+ // Did we opt out?
+ if (isOptOut()) {
+ return false;
+ }
+
+ // Is metrics already running?
+ if (task != null) {
+ return true;
+ }
+
+ // Begin hitting the server with glorious data
+ task = plugin.getServer().getScheduler().runTaskTimerAsynchronously(plugin, new Runnable() {
+
+ private boolean firstPost = true;
+
+ public void run() {
+ try {
+ // This has to be synchronized or it can collide with the disable method.
+ synchronized (optOutLock) {
+ // Disable Task, if it is running and the server owner decided to opt-out
+ if (isOptOut() && task != null) {
+ task.cancel();
+ task = null;
+ // Tell all plotters to stop gathering information.
+ for (Graph graph : graphs) {
+ graph.onOptOut();
+ }
+ }
+ }
+
+ // We use the inverse of firstPost because if it is the first time we are posting,
+ // it is not a interval ping, so it evaluates to FALSE
+ // Each time thereafter it will evaluate to TRUE, i.e PING!
+ postPlugin(!firstPost);
+
+ // After the first post we set firstPost to false
+ // Each post thereafter will be a ping
+ firstPost = false;
+ } catch (IOException e) {
+ if (debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + e.getMessage());
+ }
+ }
+ }
+ }, 0, PING_INTERVAL * 1200);
+
+ return true;
+ }
+ }
+
+ /**
+ * Has the server owner denied plugin metrics?
+ *
+ * @return true if metrics should be opted out of it
+ */
+ public boolean isOptOut() {
+ synchronized (optOutLock) {
+ try {
+ // Reload the metrics file
+ configuration.load(getConfigFile());
+ } catch (IOException ex) {
+ if (debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
+ }
+ return true;
+ } catch (InvalidConfigurationException ex) {
+ if (debug) {
+ Bukkit.getLogger().log(Level.INFO, "[Metrics] " + ex.getMessage());
+ }
+ return true;
+ }
+ return configuration.getBoolean("opt-out", false);
+ }
+ }
+
+ /**
+ * Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
+ *
+ * @throws java.io.IOException
+ */
+ public void enable() throws IOException {
+ // This has to be synchronized or it can collide with the check in the task.
+ synchronized (optOutLock) {
+ // Check if the server owner has already set opt-out, if not, set it.
+ if (isOptOut()) {
+ configuration.set("opt-out", false);
+ configuration.save(configurationFile);
+ }
+
+ // Enable Task, if it is not running
+ if (task == null) {
+ start();
+ }
+ }
+ }
+
+ /**
+ * Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
+ *
+ * @throws java.io.IOException
+ */
+ public void disable() throws IOException {
+ // This has to be synchronized or it can collide with the check in the task.
+ synchronized (optOutLock) {
+ // Check if the server owner has already set opt-out, if not, set it.
+ if (!isOptOut()) {
+ configuration.set("opt-out", true);
+ configuration.save(configurationFile);
+ }
+
+ // Disable Task, if it is running
+ if (task != null) {
+ task.cancel();
+ task = null;
+ }
+ }
+ }
+
+ /**
+ * Gets the File object of the config file that should be used to store data such as the GUID and opt-out status
+ *
+ * @return the File object for the config file
+ */
+ public File getConfigFile() {
+ // I believe the easiest way to get the base folder (e.g craftbukkit set via -P) for plugins to use
+ // is to abuse the plugin object we already have
+ // plugin.getDataFolder() => base/plugins/PluginA/
+ // pluginsFolder => base/plugins/
+ // The base is not necessarily relative to the startup directory.
+ File pluginsFolder = plugin.getDataFolder().getParentFile();
+
+ // return => base/plugins/PluginMetrics/config.yml
+ return new File(new File(pluginsFolder, "PluginMetrics"), "config.yml");
+ }
+
+ /**
+ * Generic method that posts a plugin to the metrics website
+ */
+ private void postPlugin(final boolean isPing) throws IOException {
+ // Server software specific section
+ PluginDescriptionFile description = plugin.getDescription();
+ String pluginName = description.getName();
+ boolean onlineMode = Bukkit.getServer().getOnlineMode(); // TRUE if online mode is enabled
+ String pluginVersion = description.getVersion();
+ String serverVersion = Bukkit.getVersion();
+ int playersOnline = Bukkit.getServer().getOnlinePlayers().length;
+
+ // END server software specific section -- all code below does not use any code outside of this class / Java
+
+ // Construct the post data
+ StringBuilder json = new StringBuilder(1024);
+ json.append('{');
+
+ // The plugin's description file containg all of the plugin data such as name, version, author, etc
+ appendJSONPair(json, "guid", guid);
+ appendJSONPair(json, "plugin_version", pluginVersion);
+ appendJSONPair(json, "server_version", serverVersion);
+ appendJSONPair(json, "players_online", Integer.toString(playersOnline));
+
+ // New data as of R6
+ 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();
+
+ // normalize os arch .. amd64 -> x86_64
+ if (osarch.equals("amd64")) {
+ osarch = "x86_64";
+ }
+
+ appendJSONPair(json, "osname", osname);
+ appendJSONPair(json, "osarch", osarch);
+ appendJSONPair(json, "osversion", osversion);
+ appendJSONPair(json, "cores", Integer.toString(coreCount));
+ appendJSONPair(json, "auth_mode", onlineMode ? "1" : "0");
+ appendJSONPair(json, "java_version", java_version);
+
+ // If we're pinging, append it
+ if (isPing) {
+ appendJSONPair(json, "ping", "1");
+ }
+
+ if (graphs.size() > 0) {
+ synchronized (graphs) {
+ json.append(',');
+ json.append('"');
+ json.append("graphs");
+ json.append('"');
+ json.append(':');
+ json.append('{');
+
+ boolean firstGraph = true;
+
+ final Iterator iter = graphs.iterator();
+
+ while (iter.hasNext()) {
+ Graph graph = iter.next();
+
+ StringBuilder graphJson = new StringBuilder();
+ graphJson.append('{');
+
+ for (Plotter plotter : graph.getPlotters()) {
+ appendJSONPair(graphJson, plotter.getColumnName(), Integer.toString(plotter.getValue()));
+ }
+
+ graphJson.append('}');
+
+ if (!firstGraph) {
+ json.append(',');
+ }
+
+ json.append(escapeJSON(graph.getName()));
+ json.append(':');
+ json.append(graphJson);
+
+ firstGraph = false;
+ }
+
+ json.append('}');
+ }
+ }
+
+ // close json
+ json.append('}');
+
+ // Create the url
+ URL url = new URL(BASE_URL + String.format(REPORT_URL, urlEncode(pluginName)));
+
+ // Connect to the website
+ URLConnection connection;
+
+ // Mineshafter creates a socks proxy, so we can safely bypass it
+ // It does not reroute POST requests so we need to go around it
+ if (isMineshafterPresent()) {
+ connection = url.openConnection(Proxy.NO_PROXY);
+ } else {
+ connection = url.openConnection();
+ }
+
+
+ byte[] uncompressed = json.toString().getBytes();
+ byte[] compressed = gzip(json.toString());
+
+ // Headers
+ connection.addRequestProperty("User-Agent", "MCStats/" + REVISION);
+ connection.addRequestProperty("Content-Type", "application/json");
+ connection.addRequestProperty("Content-Encoding", "gzip");
+ connection.addRequestProperty("Content-Length", Integer.toString(compressed.length));
+ connection.addRequestProperty("Accept", "application/json");
+ connection.addRequestProperty("Connection", "close");
+
+ connection.setDoOutput(true);
+
+ if (debug) {
+ System.out.println("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
+ }
+
+ // Write the data
+ OutputStream os = connection.getOutputStream();
+ os.write(compressed);
+ os.flush();
+
+ // Now read the response
+ final BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream()));
+ String response = reader.readLine();
+
+ // close resources
+ os.close();
+ reader.close();
+
+ if (response == null || response.startsWith("ERR") || response.startsWith("7")) {
+ if (response == null) {
+ response = "null";
+ } else if (response.startsWith("7")) {
+ response = response.substring(response.startsWith("7,") ? 2 : 1);
+ }
+
+ throw new IOException(response);
+ } else {
+ // Is this the first update this hour?
+ if (response.equals("1") || response.contains("This is your first update this hour")) {
+ synchronized (graphs) {
+ final Iterator iter = graphs.iterator();
+
+ while (iter.hasNext()) {
+ final Graph graph = iter.next();
+
+ for (Plotter plotter : graph.getPlotters()) {
+ plotter.reset();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * GZip compress a string of bytes
+ *
+ * @param input
+ * @return
+ */
+ public static byte[] gzip(String input) {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ GZIPOutputStream gzos = null;
+
+ try {
+ gzos = new GZIPOutputStream(baos);
+ gzos.write(input.getBytes("UTF-8"));
+ } catch (IOException e) {
+ e.printStackTrace();
+ } finally {
+ if (gzos != null) try {
+ gzos.close();
+ } catch (IOException ignore) {
+ }
+ }
+
+ return baos.toByteArray();
+ }
+
+ /**
+ * Check if mineshafter is present. If it is, we need to bypass it to send POST requests
+ *
+ * @return true if mineshafter is installed on the server
+ */
+ private boolean isMineshafterPresent() {
+ try {
+ Class.forName("mineshafter.MineServer");
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ /**
+ * Appends a json encoded key/value pair to the given string builder.
+ *
+ * @param json
+ * @param key
+ * @param value
+ * @throws UnsupportedEncodingException
+ */
+ private static void appendJSONPair(StringBuilder json, String key, String value) throws UnsupportedEncodingException {
+ boolean isValueNumeric = false;
+
+ try {
+ if (value.equals("0") || !value.endsWith("0")) {
+ Double.parseDouble(value);
+ isValueNumeric = true;
+ }
+ } catch (NumberFormatException e) {
+ isValueNumeric = false;
+ }
+
+ if (json.charAt(json.length() - 1) != '{') {
+ json.append(',');
+ }
+
+ json.append(escapeJSON(key));
+ json.append(':');
+
+ if (isValueNumeric) {
+ json.append(value);
+ } else {
+ json.append(escapeJSON(value));
+ }
+ }
+
+ /**
+ * Escape a string to create a valid JSON string
+ *
+ * @param text
+ * @return
+ */
+ private static String escapeJSON(String text) {
+ StringBuilder builder = new StringBuilder();
+
+ builder.append('"');
+ for (int index = 0; index < text.length(); index++) {
+ char chr = text.charAt(index);
+
+ switch (chr) {
+ case '"':
+ case '\\':
+ builder.append('\\');
+ builder.append(chr);
+ break;
+ case '\b':
+ builder.append("\\b");
+ break;
+ case '\t':
+ builder.append("\\t");
+ break;
+ case '\n':
+ builder.append("\\n");
+ break;
+ case '\r':
+ builder.append("\\r");
+ break;
+ default:
+ if (chr < ' ') {
+ String t = "000" + Integer.toHexString(chr);
+ builder.append("\\u" + t.substring(t.length() - 4));
+ } else {
+ builder.append(chr);
+ }
+ break;
+ }
+ }
+ builder.append('"');
+
+ return builder.toString();
+ }
+
+ /**
+ * Encode text as UTF-8
+ *
+ * @param text the text to encode
+ * @return the encoded text, as UTF-8
+ */
+ private static String urlEncode(final String text) throws UnsupportedEncodingException {
+ return URLEncoder.encode(text, "UTF-8");
+ }
+
+ /**
+ * Represents a custom graph on the website
+ */
+ public static class Graph {
+
+ /**
+ * The graph's name, alphanumeric and spaces only :) If it does not comply to the above when submitted, it is
+ * rejected
+ */
+ private final String name;
+
+ /**
+ * The set of plotters that are contained within this graph
+ */
+ private final Set plotters = new LinkedHashSet();
+
+ private Graph(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Gets the graph's name
+ *
+ * @return the Graph's name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Add a plotter to the graph, which will be used to plot entries
+ *
+ * @param plotter the plotter to add to the graph
+ */
+ public void addPlotter(final Plotter plotter) {
+ plotters.add(plotter);
+ }
+
+ /**
+ * Remove a plotter from the graph
+ *
+ * @param plotter the plotter to remove from the graph
+ */
+ public void removePlotter(final Plotter plotter) {
+ plotters.remove(plotter);
+ }
+
+ /**
+ * Gets an unmodifiable set of the plotter objects in the graph
+ *
+ * @return an unmodifiable {@link java.util.Set} of the plotter objects
+ */
+ public Set getPlotters() {
+ return Collections.unmodifiableSet(plotters);
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (!(object instanceof Graph)) {
+ return false;
+ }
+
+ final Graph graph = (Graph) object;
+ return graph.name.equals(name);
+ }
+
+ /**
+ * Called when the server owner decides to opt-out of BukkitMetrics while the server is running.
+ */
+ protected void onOptOut() {
+ }
+ }
+
+ /**
+ * Interface used to collect custom data for a plugin
+ */
+ public static abstract class Plotter {
+
+ /**
+ * The plot's name
+ */
+ private final String name;
+
+ /**
+ * Construct a plotter with the default plot name
+ */
+ public Plotter() {
+ this("Default");
+ }
+
+ /**
+ * Construct a plotter with a specific plot name
+ *
+ * @param name the name of the plotter to use, which will show up on the website
+ */
+ public Plotter(final String name) {
+ this.name = name;
+ }
+
+ /**
+ * Get the current value for the plotted point. Since this function defers to an external function it may or may
+ * not return immediately thus cannot be guaranteed to be thread friendly or safe. This function can be called
+ * from any thread so care should be taken when accessing resources that need to be synchronized.
+ *
+ * @return the current value for the point to be plotted.
+ */
+ public abstract int getValue();
+
+ /**
+ * Get the column name for the plotted point
+ *
+ * @return the plotted point's column name
+ */
+ public String getColumnName() {
+ return name;
+ }
+
+ /**
+ * Called after the website graphs have been updated
+ */
+ public void reset() {
+ }
+
+ @Override
+ public int hashCode() {
+ return getColumnName().hashCode();
+ }
+
+ @Override
+ public boolean equals(final Object object) {
+ if (!(object instanceof Plotter)) {
+ return false;
+ }
+
+ final Plotter plotter = (Plotter) object;
+ return plotter.name.equals(name) && plotter.getValue() == getValue();
+ }
+ }
}
\ No newline at end of file
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/AdvancedPortal.java b/src/com/sekwah/advancedportals/portalcontrolls/AdvancedPortal.java
similarity index 96%
rename from Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/AdvancedPortal.java
rename to src/com/sekwah/advancedportals/portalcontrolls/AdvancedPortal.java
index f88af654..90fd0053 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/AdvancedPortal.java
+++ b/src/com/sekwah/advancedportals/portalcontrolls/AdvancedPortal.java
@@ -1,21 +1,21 @@
-package com.sekwah.advancedportals.portalcontrolls;
-
-import org.bukkit.Location;
-import org.bukkit.Material;
-
-public class AdvancedPortal {
-
- public Material trigger = null;
-
- public String worldName = null;
-
- public Location pos1 = null;
-
- public Location pos2 = null;
-
- public String portalName = null;
-
- public String destiation = null; // Could possibly store the destination name to stop the server having to read the config file
-
- public String bungee = null; // Could possibly store the bungee server name to stop the server having to read the config file
-}
+package com.sekwah.advancedportals.portalcontrolls;
+
+import org.bukkit.Location;
+import org.bukkit.Material;
+
+public class AdvancedPortal {
+
+ public Material trigger = null;
+
+ public String worldName = null;
+
+ public Location pos1 = null;
+
+ public Location pos2 = null;
+
+ public String portalName = null;
+
+ public String destiation = null; // Could possibly store the destination name to stop the server having to read the config file
+
+ public String bungee = null; // Could possibly store the bungee server name to stop the server having to read the config file
+}
diff --git a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/Portal.java b/src/com/sekwah/advancedportals/portalcontrolls/Portal.java
similarity index 97%
rename from Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/Portal.java
rename to src/com/sekwah/advancedportals/portalcontrolls/Portal.java
index dcab9d92..20a76ce1 100644
--- a/Advanced Portals/src/com/sekwah/advancedportals/portalcontrolls/Portal.java
+++ b/src/com/sekwah/advancedportals/portalcontrolls/Portal.java
@@ -1,400 +1,400 @@
-package com.sekwah.advancedportals.portalcontrolls;
-
-import java.util.Set;
-import java.util.logging.Level;
-
-import org.bukkit.Bukkit;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-
-import com.google.common.io.ByteArrayDataOutput;
-import com.google.common.io.ByteStreams;
-import com.sekwah.advancedportals.AdvancedPortalsPlugin;
-import com.sekwah.advancedportals.ConfigAccessor;
-import com.sekwah.advancedportals.DataCollector.DataCollector;
-import com.sekwah.advancedportals.destinations.Destination;
-import com.sekwah.advancedportals.events.WarpEvent;
-
-public class Portal {
-
- private static AdvancedPortalsPlugin plugin;
-
- public static boolean portalsActive = true;
-
- public static AdvancedPortal[] Portals;
-
- private static boolean ShowBungeeMessage;
-
- public Portal(AdvancedPortalsPlugin plugin) {
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
- ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
-
- Portal.plugin = plugin;
- Portal.loadPortals();
- }
-
- /**
- * This can be used to move the get keys to different sections
- *
- * ConfigurationSection section = config.getSection("sectionname");
- *
- * section.getKeys(false);
- *
- */
-
- public static void loadPortals(){
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
- Set PortalSet = config.getConfig().getKeys(false);
- if(PortalSet.size() > 0){
- Portals = new AdvancedPortal[PortalSet.toArray().length];
-
- for(int i = 0; i <= PortalSet.toArray().length - 1; i++){
- Portals[i] = new AdvancedPortal();
- }
-
- int portalId = 0;
- for(Object portal: PortalSet.toArray()){
-
- Material blockType = Material.PORTAL;
- String BlockID = config.getConfig().getString(portal.toString() + ".triggerblock");
- try
- {
- Integer.parseInt(BlockID);
- System.out.println("Block names must be given not IDs");
- }
- catch(NumberFormatException e)
- {
- blockType = Material.getMaterial(BlockID);
- }
-
- if(blockType == null){
- blockType = Material.PORTAL;
- }
-
- Portals[portalId].trigger = blockType;
- System.out.println("Test: " + portal.toString());
- Portals[portalId].portalName = portal.toString();
- Portals[portalId].worldName = config.getConfig().getString(portal.toString() + ".world");
- World world = Bukkit.getWorld(config.getConfig().getString(portal.toString() + ".world"));
- Portals[portalId].pos1 = new Location(world, config.getConfig().getInt(portal.toString() + ".pos1.X"), config.getConfig().getInt(portal.toString() + ".pos1.Y"), config.getConfig().getInt(portal.toString() + ".pos1.Z"));
- Portals[portalId].pos2 = new Location(world, config.getConfig().getInt(portal.toString() + ".pos2.X"), config.getConfig().getInt(portal.toString() + ".pos2.Y"), config.getConfig().getInt(portal.toString() + ".pos2.Z"));
-
- portalId++;
- }
- portalsActive = true;
- }
- else{
- portalsActive = false;
- }
-
- }
-
- public static String create(Location pos1, Location pos2 , String name, String destination, Material triggerBlock) {
- return create(pos1, pos2, name, destination, triggerBlock, null);
- }
-
- public static String create(Location pos1, Location pos2 , String name, String destination, Material triggerBlock, String serverName) {
-
- if(!pos1.getWorld().equals(pos2.getWorld())){
- plugin.getLogger().log(Level.WARNING, "pos1 and pos2 must be in the same world!");
- return "§cPortal creation error, pos1 and pos2 must be in the same world!";
- }
-
- int LowX = 0;
- int LowY = 0;
- int LowZ = 0;
-
- int HighX = 0;
- int HighY = 0;
- int HighZ = 0;
-
- if(pos1.getX() > pos2.getX()){
- LowX = (int) pos2.getX();
- HighX = (int) pos1.getX();
- }
- else{
- LowX = (int) pos1.getX();
- HighX = (int) pos2.getX();
- }
- if(pos1.getY() > pos2.getY()){
- LowY = (int) pos2.getY();
- HighY = (int) pos1.getY();
- }
- else{
- LowY = (int) pos1.getY();
- HighY = (int) pos2.getY();
- }
- if(pos1.getZ() > pos2.getZ()){
- LowZ = (int) pos2.getZ();
- HighZ = (int) pos1.getZ();
- }
- else{
- LowZ = (int) pos1.getZ();
- HighZ = (int) pos2.getZ();
- }
-
- Location checkpos1 = new Location(pos1.getWorld(), HighX, HighY, HighZ);
- Location checkpos2 = new Location(pos2.getWorld(), LowX, LowY, LowZ);
-
- if(checkPortalOverlap(checkpos1, checkpos2)){
- plugin.getLogger().log(Level.WARNING, "Portals must not overlap!");
- return "§cPortal creation error, portals must not overlap!";
- }
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
-
- config.getConfig().set(name + ".world", pos1.getWorld().getName());
-
- config.getConfig().set(name + ".triggerblock", checkMaterial(triggerBlock));
-
- config.getConfig().set(name + ".destination", destination);
-
- config.getConfig().set(name + ".bungee", serverName);
-
- config.getConfig().set(name + ".pos1.X", HighX);
- config.getConfig().set(name + ".pos1.Y", HighY);
- config.getConfig().set(name + ".pos1.Z", HighZ);
-
- config.getConfig().set(name + ".pos2.X", LowX);
- config.getConfig().set(name + ".pos2.Y", LowY);
- config.getConfig().set(name + ".pos2.Z", LowZ);
-
- config.saveConfig();
-
- loadPortals();
-
- return "§aPortal creation successful!";
- }
-
- // make this actually work!
- private static boolean checkPortalOverlap(Location pos1, Location pos2) {
-
- if(portalsActive){
- int portalId = 0;
- for(@SuppressWarnings("unused") Object portal : Portal.Portals){
- if(Portals[portalId].worldName.equals(pos2.getWorld().getName())){ // checks that the cubes arnt overlapping by seeing if all 4 corners are not in side another
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
-
- if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
- }
- portalId++;
- }
- }
- return false;
- }
-
- private static boolean checkOverLapPortal(Location pos1, Location pos2, int posX, int posY, int posZ) {
- if(pos1.getX() >= posX && pos1.getY() >= posX && pos1.getZ() >= posZ){
- if((pos2.getX()) <= posX && pos2.getY() <= posY && pos2.getZ() <= posZ){
- return true;
-
- }
- }
- return false;
- }
-
- private static String checkMaterial(Material triggerBlock) {
- if(triggerBlock.equals(Material.WATER)){
- return "STATIONARY_WATER";
- }
- else if(triggerBlock.equals(Material.LAVA)){
- return "STATIONARY_LAVA";
- }
- return triggerBlock.toString();
- }
-
- public static String create(Location pos1, Location pos2, String name, String destination) {
- return create(pos1, pos2, name, destination,(String) null);
- }
-
- @SuppressWarnings("deprecation")
- public static String create(Location pos1, Location pos2, String name, String destination, String serverName) { // add stuff for destination names or coordinates
- ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
-
- Material triggerBlockType;
- String BlockID = config.getConfig().getString("DefaultPortalTriggerBlock");
- try
- {
- triggerBlockType = Material.getMaterial(Integer.parseInt(BlockID));
- }
- catch(Exception e)
- {
- triggerBlockType = Material.getMaterial(BlockID);
- }
-
- if(triggerBlockType == null){
- triggerBlockType = Material.PORTAL;
- }
-
- // TODO add a for loop which scans through the addArgs and adds them to the config so that the application can use them
-
- String result = create(pos1, pos2, name, destination, triggerBlockType, serverName);
-
- return result;
- }
-
- public static void redefine(Location pos1, Location pos2, String name){
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
-
- config.getConfig().set(name + ".pos1.X", pos1.getX());
- config.getConfig().set(name + ".pos1.Y", pos1.getY());
- config.getConfig().set(name + ".pos1.Z", pos1.getZ());
-
- config.getConfig().set(name + ".pos2.X", pos2.getX());
- config.getConfig().set(name + ".pos2.Y", pos2.getY());
- config.getConfig().set(name + ".pos2.Z", pos2.getZ());
-
- config.saveConfig();
-
- loadPortals();
-
- }
-
- public static void remove(String name){
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
-
- Object[] keys = config.getConfig().getKeys(true).toArray();
- for(int i = keys.length - 1; i >= 0; i--){
- String key = keys[i].toString();
- if(key.startsWith(name + ".")){
- config.getConfig().set(key, null);
- }
- }
- config.getConfig().set(name, null);
-
- /**Set keys = config.getConfig().getKeys(true);
- for(String key: keys){
- if(key.startsWith(name)){
- config.getConfig().set(key, null);
- }
- }*/
-
- /**config.getConfig().set(name + ".world", null);
- config.getConfig().set(name + ".triggerblock", null);
- config.getConfig().set(name + ".destination", null);
-
- config.getConfig().set(name + ".pos1.X", null);
- config.getConfig().set(name + ".pos1.Y", null);
- config.getConfig().set(name + ".pos1.Z", null);
-
- config.getConfig().set(name + ".pos2.X", null);
- config.getConfig().set(name + ".pos2.Y", null);
- config.getConfig().set(name + ".pos2.Z", null);
-
- config.getConfig().set(name + ".pos1", null);
- config.getConfig().set(name + ".pos2", null);
-
- config.getConfig().set(name, null);*/
-
- config.saveConfig();
-
- loadPortals();
- }
-
- public static boolean portalExists(String portalName){
-
- ConfigAccessor portalconfig = new ConfigAccessor(plugin, "Portals.yml");
- String posX = portalconfig.getConfig().getString(portalName + ".pos1.X");
-
- if(posX == null){
- return false;
- }
- else{
- return true;
- }
- }
-
- public static boolean activate(Player player, String portalName) {
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
-
- // add other variables or filter code here, or somehow have a way to register them
-
- if(config.getConfig().getString(portalName + ".bungee") != null){
- if(ShowBungeeMessage){
- player.sendMessage("§a[§eAdvancedPortals§a] Attempting to warp to §e" + config.getConfig().getString(portalName + ".bungee") + "§a.");
- }
- ByteArrayDataOutput out = ByteStreams.newDataOutput();
- out.writeUTF("Connect");
- out.writeUTF(config.getConfig().getString(portalName + ".bungee"));
- player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
- return false;
-
- }
- else{
- if(config.getConfig().getString(portalName + ".destination") != null){
- ConfigAccessor configDesti = new ConfigAccessor(plugin, "Destinations.yml");
- String destiName = config.getConfig().getString(portalName + ".destination");
- if(configDesti.getConfig().getString(destiName + ".world") != null){
- boolean warped = Destination.warp(player, destiName);
- return warped;
- }
- else{
- player.sendMessage("§c[§7AdvancedPortals§c] The destination you are currently attempting to warp to doesnt exist!");
- plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
- + "attempt and either the data is corrupt or that destination listed doesn't exist!");
- return false;
- }
-
- }
- else{
- player.sendMessage("§c[§7AdvancedPortals§c] The portal you are trying to use doesn't have a destination!");
- plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
- + "attempt and either the data is corrupt or portal doesn't exist!");
- return false;
- }
- }
-
- // add code for if the portal doesnt have a destination but a teleport location
-
-
- }
-
- public static void rename(String oldName, String newName){
-
- // set it so it gets all data from one and puts it into another place
-
- ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
-
- Set keys = config.getConfig().getKeys(true);
- for(String key: keys){
- if(key.startsWith(oldName + ".")){
- if(config.getConfig().getString(key) != null){
- try
- {
- int intData = Integer.parseInt(config.getConfig().getString(key));
- config.getConfig().set(key.replace(oldName + ".", newName + "."), intData);
- }
- catch(Exception e)
- {
- config.getConfig().set(key.replace(oldName + ".", newName + "."), config.getConfig().getString(key));
- }
-
- }
- }
- }
-
- config.saveConfig();
-
- remove(oldName);
-
- }
-
-
-
-}
+package com.sekwah.advancedportals.portalcontrolls;
+
+import java.util.Set;
+import java.util.logging.Level;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.Material;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+
+import com.google.common.io.ByteArrayDataOutput;
+import com.google.common.io.ByteStreams;
+import com.sekwah.advancedportals.AdvancedPortalsPlugin;
+import com.sekwah.advancedportals.ConfigAccessor;
+import com.sekwah.advancedportals.DataCollector.DataCollector;
+import com.sekwah.advancedportals.destinations.Destination;
+import com.sekwah.advancedportals.events.WarpEvent;
+
+public class Portal {
+
+ private static AdvancedPortalsPlugin plugin;
+
+ public static boolean portalsActive = true;
+
+ public static AdvancedPortal[] Portals;
+
+ private static boolean ShowBungeeMessage;
+
+ public Portal(AdvancedPortalsPlugin plugin) {
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+ ShowBungeeMessage = config.getConfig().getBoolean("ShowBungeeWarpMessage");
+
+ Portal.plugin = plugin;
+ Portal.loadPortals();
+ }
+
+ /**
+ * This can be used to move the get keys to different sections
+ *
+ * ConfigurationSection section = config.getSection("sectionname");
+ *
+ * section.getKeys(false);
+ *
+ */
+
+ public static void loadPortals(){
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+ Set PortalSet = config.getConfig().getKeys(false);
+ if(PortalSet.size() > 0){
+ Portals = new AdvancedPortal[PortalSet.toArray().length];
+
+ for(int i = 0; i <= PortalSet.toArray().length - 1; i++){
+ Portals[i] = new AdvancedPortal();
+ }
+
+ int portalId = 0;
+ for(Object portal: PortalSet.toArray()){
+
+ Material blockType = Material.PORTAL;
+ String BlockID = config.getConfig().getString(portal.toString() + ".triggerblock");
+ try
+ {
+ Integer.parseInt(BlockID);
+ System.out.println("Block names must be given not IDs");
+ }
+ catch(NumberFormatException e)
+ {
+ blockType = Material.getMaterial(BlockID);
+ }
+
+ if(blockType == null){
+ blockType = Material.PORTAL;
+ }
+
+ Portals[portalId].trigger = blockType;
+ System.out.println("Test: " + portal.toString());
+ Portals[portalId].portalName = portal.toString();
+ Portals[portalId].worldName = config.getConfig().getString(portal.toString() + ".world");
+ World world = Bukkit.getWorld(config.getConfig().getString(portal.toString() + ".world"));
+ Portals[portalId].pos1 = new Location(world, config.getConfig().getInt(portal.toString() + ".pos1.X"), config.getConfig().getInt(portal.toString() + ".pos1.Y"), config.getConfig().getInt(portal.toString() + ".pos1.Z"));
+ Portals[portalId].pos2 = new Location(world, config.getConfig().getInt(portal.toString() + ".pos2.X"), config.getConfig().getInt(portal.toString() + ".pos2.Y"), config.getConfig().getInt(portal.toString() + ".pos2.Z"));
+
+ portalId++;
+ }
+ portalsActive = true;
+ }
+ else{
+ portalsActive = false;
+ }
+
+ }
+
+ public static String create(Location pos1, Location pos2 , String name, String destination, Material triggerBlock) {
+ return create(pos1, pos2, name, destination, triggerBlock, null);
+ }
+
+ public static String create(Location pos1, Location pos2 , String name, String destination, Material triggerBlock, String serverName) {
+
+ if(!pos1.getWorld().equals(pos2.getWorld())){
+ plugin.getLogger().log(Level.WARNING, "pos1 and pos2 must be in the same world!");
+ return "§cPortal creation error, pos1 and pos2 must be in the same world!";
+ }
+
+ int LowX = 0;
+ int LowY = 0;
+ int LowZ = 0;
+
+ int HighX = 0;
+ int HighY = 0;
+ int HighZ = 0;
+
+ if(pos1.getX() > pos2.getX()){
+ LowX = (int) pos2.getX();
+ HighX = (int) pos1.getX();
+ }
+ else{
+ LowX = (int) pos1.getX();
+ HighX = (int) pos2.getX();
+ }
+ if(pos1.getY() > pos2.getY()){
+ LowY = (int) pos2.getY();
+ HighY = (int) pos1.getY();
+ }
+ else{
+ LowY = (int) pos1.getY();
+ HighY = (int) pos2.getY();
+ }
+ if(pos1.getZ() > pos2.getZ()){
+ LowZ = (int) pos2.getZ();
+ HighZ = (int) pos1.getZ();
+ }
+ else{
+ LowZ = (int) pos1.getZ();
+ HighZ = (int) pos2.getZ();
+ }
+
+ Location checkpos1 = new Location(pos1.getWorld(), HighX, HighY, HighZ);
+ Location checkpos2 = new Location(pos2.getWorld(), LowX, LowY, LowZ);
+
+ if(checkPortalOverlap(checkpos1, checkpos2)){
+ plugin.getLogger().log(Level.WARNING, "Portals must not overlap!");
+ return "§cPortal creation error, portals must not overlap!";
+ }
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+
+ config.getConfig().set(name + ".world", pos1.getWorld().getName());
+
+ config.getConfig().set(name + ".triggerblock", checkMaterial(triggerBlock));
+
+ config.getConfig().set(name + ".destination", destination);
+
+ config.getConfig().set(name + ".bungee", serverName);
+
+ config.getConfig().set(name + ".pos1.X", HighX);
+ config.getConfig().set(name + ".pos1.Y", HighY);
+ config.getConfig().set(name + ".pos1.Z", HighZ);
+
+ config.getConfig().set(name + ".pos2.X", LowX);
+ config.getConfig().set(name + ".pos2.Y", LowY);
+ config.getConfig().set(name + ".pos2.Z", LowZ);
+
+ config.saveConfig();
+
+ loadPortals();
+
+ return "§aPortal creation successful!";
+ }
+
+ // make this actually work!
+ private static boolean checkPortalOverlap(Location pos1, Location pos2) {
+
+ if(portalsActive){
+ int portalId = 0;
+ for(@SuppressWarnings("unused") Object portal : Portal.Portals){
+ if(Portals[portalId].worldName.equals(pos2.getWorld().getName())){ // checks that the cubes arnt overlapping by seeing if all 4 corners are not in side another
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos1.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos1.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos2.getBlockZ())){return true;}
+
+ if(checkOverLapPortal(pos1, pos2, Portals[portalId].pos2.getBlockX(), Portals[portalId].pos2.getBlockY(), Portals[portalId].pos1.getBlockZ())){return true;}
+ }
+ portalId++;
+ }
+ }
+ return false;
+ }
+
+ private static boolean checkOverLapPortal(Location pos1, Location pos2, int posX, int posY, int posZ) {
+ if(pos1.getX() >= posX && pos1.getY() >= posX && pos1.getZ() >= posZ){
+ if((pos2.getX()) <= posX && pos2.getY() <= posY && pos2.getZ() <= posZ){
+ return true;
+
+ }
+ }
+ return false;
+ }
+
+ private static String checkMaterial(Material triggerBlock) {
+ if(triggerBlock.equals(Material.WATER)){
+ return "STATIONARY_WATER";
+ }
+ else if(triggerBlock.equals(Material.LAVA)){
+ return "STATIONARY_LAVA";
+ }
+ return triggerBlock.toString();
+ }
+
+ public static String create(Location pos1, Location pos2, String name, String destination) {
+ return create(pos1, pos2, name, destination,(String) null);
+ }
+
+ @SuppressWarnings("deprecation")
+ public static String create(Location pos1, Location pos2, String name, String destination, String serverName) { // add stuff for destination names or coordinates
+ ConfigAccessor config = new ConfigAccessor(plugin, "Config.yml");
+
+ Material triggerBlockType;
+ String BlockID = config.getConfig().getString("DefaultPortalTriggerBlock");
+ try
+ {
+ triggerBlockType = Material.getMaterial(Integer.parseInt(BlockID));
+ }
+ catch(Exception e)
+ {
+ triggerBlockType = Material.getMaterial(BlockID);
+ }
+
+ if(triggerBlockType == null){
+ triggerBlockType = Material.PORTAL;
+ }
+
+ // TODO add a for loop which scans through the addArgs and adds them to the config so that the application can use them
+
+ String result = create(pos1, pos2, name, destination, triggerBlockType, serverName);
+
+ return result;
+ }
+
+ public static void redefine(Location pos1, Location pos2, String name){
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+
+ config.getConfig().set(name + ".pos1.X", pos1.getX());
+ config.getConfig().set(name + ".pos1.Y", pos1.getY());
+ config.getConfig().set(name + ".pos1.Z", pos1.getZ());
+
+ config.getConfig().set(name + ".pos2.X", pos2.getX());
+ config.getConfig().set(name + ".pos2.Y", pos2.getY());
+ config.getConfig().set(name + ".pos2.Z", pos2.getZ());
+
+ config.saveConfig();
+
+ loadPortals();
+
+ }
+
+ public static void remove(String name){
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+
+ Object[] keys = config.getConfig().getKeys(true).toArray();
+ for(int i = keys.length - 1; i >= 0; i--){
+ String key = keys[i].toString();
+ if(key.startsWith(name + ".")){
+ config.getConfig().set(key, null);
+ }
+ }
+ config.getConfig().set(name, null);
+
+ /**Set keys = config.getConfig().getKeys(true);
+ for(String key: keys){
+ if(key.startsWith(name)){
+ config.getConfig().set(key, null);
+ }
+ }*/
+
+ /**config.getConfig().set(name + ".world", null);
+ config.getConfig().set(name + ".triggerblock", null);
+ config.getConfig().set(name + ".destination", null);
+
+ config.getConfig().set(name + ".pos1.X", null);
+ config.getConfig().set(name + ".pos1.Y", null);
+ config.getConfig().set(name + ".pos1.Z", null);
+
+ config.getConfig().set(name + ".pos2.X", null);
+ config.getConfig().set(name + ".pos2.Y", null);
+ config.getConfig().set(name + ".pos2.Z", null);
+
+ config.getConfig().set(name + ".pos1", null);
+ config.getConfig().set(name + ".pos2", null);
+
+ config.getConfig().set(name, null);*/
+
+ config.saveConfig();
+
+ loadPortals();
+ }
+
+ public static boolean portalExists(String portalName){
+
+ ConfigAccessor portalconfig = new ConfigAccessor(plugin, "Portals.yml");
+ String posX = portalconfig.getConfig().getString(portalName + ".pos1.X");
+
+ if(posX == null){
+ return false;
+ }
+ else{
+ return true;
+ }
+ }
+
+ public static boolean activate(Player player, String portalName) {
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+
+ // add other variables or filter code here, or somehow have a way to register them
+
+ if(config.getConfig().getString(portalName + ".bungee") != null){
+ if(ShowBungeeMessage){
+ player.sendMessage("§a[§eAdvancedPortals§a] Attempting to warp to §e" + config.getConfig().getString(portalName + ".bungee") + "§a.");
+ }
+ ByteArrayDataOutput out = ByteStreams.newDataOutput();
+ out.writeUTF("Connect");
+ out.writeUTF(config.getConfig().getString(portalName + ".bungee"));
+ player.sendPluginMessage(plugin, "BungeeCord", out.toByteArray());
+ return false;
+
+ }
+ else{
+ if(config.getConfig().getString(portalName + ".destination") != null){
+ ConfigAccessor configDesti = new ConfigAccessor(plugin, "Destinations.yml");
+ String destiName = config.getConfig().getString(portalName + ".destination");
+ if(configDesti.getConfig().getString(destiName + ".world") != null){
+ boolean warped = Destination.warp(player, destiName);
+ return warped;
+ }
+ else{
+ player.sendMessage("§c[§7AdvancedPortals§c] The destination you are currently attempting to warp to doesnt exist!");
+ plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
+ + "attempt and either the data is corrupt or that destination listed doesn't exist!");
+ return false;
+ }
+
+ }
+ else{
+ player.sendMessage("§c[§7AdvancedPortals§c] The portal you are trying to use doesn't have a destination!");
+ plugin.getLogger().log(Level.SEVERE, "The portal '" + portalName + "' has just had a warp "
+ + "attempt and either the data is corrupt or portal doesn't exist!");
+ return false;
+ }
+ }
+
+ // add code for if the portal doesnt have a destination but a teleport location
+
+
+ }
+
+ public static void rename(String oldName, String newName){
+
+ // set it so it gets all data from one and puts it into another place
+
+ ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
+
+ Set keys = config.getConfig().getKeys(true);
+ for(String key: keys){
+ if(key.startsWith(oldName + ".")){
+ if(config.getConfig().getString(key) != null){
+ try
+ {
+ int intData = Integer.parseInt(config.getConfig().getString(key));
+ config.getConfig().set(key.replace(oldName + ".", newName + "."), intData);
+ }
+ catch(Exception e)
+ {
+ config.getConfig().set(key.replace(oldName + ".", newName + "."), config.getConfig().getString(key));
+ }
+
+ }
+ }
+ }
+
+ config.saveConfig();
+
+ remove(oldName);
+
+ }
+
+
+
+}
diff --git a/Advanced Portals/src/plugin.yml b/src/plugin.yml
similarity index 96%
rename from Advanced Portals/src/plugin.yml
rename to src/plugin.yml
index 5014db11..744d9a84 100644
--- a/Advanced Portals/src/plugin.yml
+++ b/src/plugin.yml
@@ -1,29 +1,29 @@
-main: com.sekwah.advancedportals.AdvancedPortalsPlugin
-name: AdvancedPortals
-version: 0.0.3
-author: SEKWAH41
-description: An advanced portals plugin for bukkit.
-commands:
- advancedportals:
- description: The main command for the advanced portals
- aliases: [portals, aportals, portal]
- usage: /
- destination:
- description: Can be used to access portal destinations.
- aliases: [desti]
- usage: /
- warp:
- description: Used to warp to destinations.
- usage: /
-permissions:
- advancedportals.*:
- description: Gives access to all portal commands
- children:
- advancedportals.createportal: true
- advancedportals.build: true
- advancedportals.createportal:
- description: Allows you to create portals
- default: op
- advancedportals.build:
- description: Allows you to build in the portal regions
- default: op
+main: com.sekwah.advancedportals.AdvancedPortalsPlugin
+name: AdvancedPortals
+version: 0.0.3
+author: SEKWAH41
+description: An advanced portals plugin for bukkit.
+commands:
+ advancedportals:
+ description: The main command for the advanced portals
+ aliases: [portals, aportals, portal]
+ usage: /
+ destination:
+ description: Can be used to access portal destinations.
+ aliases: [desti]
+ usage: /
+ warp:
+ description: Used to warp to destinations.
+ usage: /
+permissions:
+ advancedportals.*:
+ description: Gives access to all portal commands
+ children:
+ advancedportals.createportal: true
+ advancedportals.build: true
+ advancedportals.createportal:
+ description: Allows you to create portals
+ default: op
+ advancedportals.build:
+ description: Allows you to build in the portal regions
+ default: op