diff --git a/.idea/artifacts/plotsquared__.xml b/.idea/artifacts/plotsquared__.xml
deleted file mode 100644
index 2134bc9a0..000000000
--- a/.idea/artifacts/plotsquared__.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
- $PROJECT_DIR$/out/plotsquared
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/libraries/WorldGuard.xml b/.idea/libraries/WorldGuard.xml
new file mode 100644
index 000000000..7f65e5da9
--- /dev/null
+++ b/.idea/libraries/WorldGuard.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1cf831c20..188308548 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -5,15 +5,21 @@
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
@@ -37,138 +43,43 @@
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
-
-
-
+
+
+
+
+
+
+
-
-
+
+
-
-
+
+
@@ -192,7 +103,6 @@
-
@@ -202,23 +112,27 @@
-
-
-
+
+
+
+
+
+
+
-
-
+
+
@@ -251,7 +165,6 @@
-
@@ -259,6 +172,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -324,138 +351,9 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
@@ -467,10 +365,10 @@
-
+
-
+
@@ -512,10 +410,79 @@
- $PROJECT_DIR$/.gitignore
+ $PROJECT_DIR$/.classpath
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/AbstractFlag.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/C.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/ConsoleColors.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Flag.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/FlagManager.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/LSetCube.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Lag.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Logger.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Metrics.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PWE.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlayerFunctions.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Plot.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotHomePosition.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotId.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotSettings.java
$PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/PlotWorld.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/RUtils.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/ReflectionUtils.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/SchematicHandler.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/SetBlockFast.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Settings.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/Title.java
$PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
$PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/XPopulator.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/api/PlotAPI.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Auto.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Camera.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Claim.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Clear.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Command.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/CommandPermission.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Debug.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Denied.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Help.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Helpers.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Home.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Info.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Inventory.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/MainCommand.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Reload.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Set.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/SetOwner.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/SubCommand.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/TP.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/Visit.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/list.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/commands/plugin.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/Database.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/MySQL.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/PlotMeConverter.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/database/SQLite.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlayerClaimPlotEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlayerEnterPlotEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlayerLeavePlotEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlayerPlotDeniedEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlayerPlotHelperEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlayerTeleportToPlotEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlotDeleteEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlotFlagAddEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/events/PlotFlagRemoveEvent.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/listeners/PlayerEvents.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldEditListener.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/uuid/NameFetcher.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualcrafters/plot/uuid/UUIDFetcher.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualsites/web/IndexHandler.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualsites/web/PlotWeb.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualsites/web/ResourceHandler.java
+ $PROJECT_DIR$/PlotSquared/src/com/intellectualsites/web/Test.java
@@ -523,8 +490,6 @@
- $PROJECT_DIR$/.classpath
- $PROJECT_DIR$/.project
@@ -759,7 +724,8 @@
-
+
+
1411382351159
@@ -825,15 +791,19 @@
1411491737240
1411491737240
-
+
+ 1411497477072
+ 1411497477072
+
+
-
+
-
-
+
+
@@ -846,13 +816,13 @@
-
-
+
+
-
+
@@ -891,7 +861,8 @@
-
+
+
@@ -903,35 +874,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -990,14 +932,14 @@
+
+
+
-
-
-
@@ -1013,28 +955,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1099,7 +1019,6 @@
-
@@ -1109,8 +1028,6 @@
-
-
@@ -1119,13 +1036,6 @@
-
-
-
-
-
-
-
@@ -1133,20 +1043,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1162,7 +1058,6 @@
-
@@ -1170,9 +1065,7 @@
-
-
-
+
@@ -1180,32 +1073,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -1213,7 +1080,6 @@
-
@@ -1221,12 +1087,6 @@
-
-
-
-
-
-
@@ -1234,11 +1094,6 @@
-
-
-
-
-
@@ -1262,15 +1117,6 @@
-
-
-
-
-
-
-
-
-
@@ -1282,34 +1128,26 @@
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
+
+
@@ -1324,61 +1162,154 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -1389,7 +1320,7 @@
- plotsquared__
+ PlotSquared
- lib
+ WorldGuard
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/C.java b/PlotSquared/src/com/intellectualcrafters/plot/C.java
index 1d776ad07..b69e883af 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/C.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/C.java
@@ -185,7 +185,11 @@ public enum C {
*/
C(String d) {
this.d = d;
- this.s = PlotMain.translations.getString(this.toString());
+ if(PlotMain.translations == null) {
+ this.s = d;
+ } else {
+ this.s = PlotMain.translations.getString(this.toString());
+ }
if (this.s == null) {
this.s = "";
}
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
index bc44f0515..cfb9013d9 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java
@@ -9,126 +9,7 @@
package com.intellectualcrafters.plot;
-import static org.bukkit.Material.ACACIA_STAIRS;
-import static org.bukkit.Material.BEACON;
-import static org.bukkit.Material.BEDROCK;
-import static org.bukkit.Material.BIRCH_WOOD_STAIRS;
-import static org.bukkit.Material.BOOKSHELF;
-import static org.bukkit.Material.BREWING_STAND;
-import static org.bukkit.Material.BRICK;
-import static org.bukkit.Material.BRICK_STAIRS;
-import static org.bukkit.Material.BURNING_FURNACE;
-import static org.bukkit.Material.CAKE_BLOCK;
-import static org.bukkit.Material.CAULDRON;
-import static org.bukkit.Material.CLAY;
-import static org.bukkit.Material.CLAY_BRICK;
-import static org.bukkit.Material.COAL_BLOCK;
-import static org.bukkit.Material.COAL_ORE;
-import static org.bukkit.Material.COBBLESTONE;
-import static org.bukkit.Material.COBBLESTONE_STAIRS;
-import static org.bukkit.Material.COBBLE_WALL;
-import static org.bukkit.Material.COMMAND;
-import static org.bukkit.Material.DARK_OAK_STAIRS;
-import static org.bukkit.Material.DAYLIGHT_DETECTOR;
-import static org.bukkit.Material.DIAMOND_BLOCK;
-import static org.bukkit.Material.DIAMOND_ORE;
-import static org.bukkit.Material.DIRT;
-import static org.bukkit.Material.DISPENSER;
-import static org.bukkit.Material.DROPPER;
-import static org.bukkit.Material.EMERALD_BLOCK;
-import static org.bukkit.Material.EMERALD_ORE;
-import static org.bukkit.Material.ENCHANTMENT_TABLE;
-import static org.bukkit.Material.ENDER_PORTAL_FRAME;
-import static org.bukkit.Material.ENDER_STONE;
-import static org.bukkit.Material.FURNACE;
-import static org.bukkit.Material.GLASS;
-import static org.bukkit.Material.GLOWSTONE;
-import static org.bukkit.Material.GOLD_BLOCK;
-import static org.bukkit.Material.GOLD_ORE;
-import static org.bukkit.Material.GRASS;
-import static org.bukkit.Material.GRAVEL;
-import static org.bukkit.Material.HARD_CLAY;
-import static org.bukkit.Material.HAY_BLOCK;
-import static org.bukkit.Material.HUGE_MUSHROOM_1;
-import static org.bukkit.Material.HUGE_MUSHROOM_2;
-import static org.bukkit.Material.IRON_BLOCK;
-import static org.bukkit.Material.IRON_ORE;
-import static org.bukkit.Material.JACK_O_LANTERN;
-import static org.bukkit.Material.JUKEBOX;
-import static org.bukkit.Material.JUNGLE_WOOD_STAIRS;
-import static org.bukkit.Material.LAPIS_BLOCK;
-import static org.bukkit.Material.LAPIS_ORE;
-import static org.bukkit.Material.LEAVES;
-import static org.bukkit.Material.LEAVES_2;
-import static org.bukkit.Material.LOG;
-import static org.bukkit.Material.LOG_2;
-import static org.bukkit.Material.MELON_BLOCK;
-import static org.bukkit.Material.MOB_SPAWNER;
-import static org.bukkit.Material.MOSSY_COBBLESTONE;
-import static org.bukkit.Material.MYCEL;
-import static org.bukkit.Material.NETHERRACK;
-import static org.bukkit.Material.NETHER_BRICK;
-import static org.bukkit.Material.NETHER_BRICK_STAIRS;
-import static org.bukkit.Material.NOTE_BLOCK;
-import static org.bukkit.Material.OBSIDIAN;
-import static org.bukkit.Material.PACKED_ICE;
-import static org.bukkit.Material.PUMPKIN;
-import static org.bukkit.Material.QUARTZ_BLOCK;
-import static org.bukkit.Material.QUARTZ_ORE;
-import static org.bukkit.Material.QUARTZ_STAIRS;
-import static org.bukkit.Material.REDSTONE_BLOCK;
-import static org.bukkit.Material.SAND;
-import static org.bukkit.Material.SANDSTONE;
-import static org.bukkit.Material.SANDSTONE_STAIRS;
-import static org.bukkit.Material.SMOOTH_BRICK;
-import static org.bukkit.Material.SMOOTH_STAIRS;
-import static org.bukkit.Material.SNOW_BLOCK;
-import static org.bukkit.Material.SOUL_SAND;
-import static org.bukkit.Material.SPONGE;
-import static org.bukkit.Material.SPRUCE_WOOD_STAIRS;
-import static org.bukkit.Material.STONE;
-import static org.bukkit.Material.WOOD;
-import static org.bukkit.Material.WOOD_STAIRS;
-import static org.bukkit.Material.WOOL;
-import static org.bukkit.Material.WORKBENCH;
-import static org.bukkit.Material.getMaterial;
-
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DatabaseMetaData;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-import java.util.UUID;
-
-import me.confuser.barapi.BarAPI;
-
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.Chunk;
-import org.bukkit.Location;
-import org.bukkit.Material;
-import org.bukkit.World;
-import org.bukkit.configuration.file.YamlConfiguration;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.LivingEntity;
-import org.bukkit.entity.Player;
-import org.bukkit.entity.Tameable;
-import org.bukkit.generator.ChunkGenerator;
-import org.bukkit.plugin.java.JavaPlugin;
-
import ca.mera.CameraAPI;
-
import com.intellectualcrafters.plot.Logger.LogLevel;
import com.intellectualcrafters.plot.Settings.Web;
import com.intellectualcrafters.plot.commands.Camera;
@@ -141,7 +22,27 @@ import com.intellectualcrafters.plot.events.PlayerTeleportToPlotEvent;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import com.intellectualcrafters.plot.listeners.PlayerEvents;
import com.intellectualcrafters.plot.listeners.WorldEditListener;
+import com.intellectualcrafters.plot.listeners.WorldGuardListener;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
+import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
+import me.confuser.barapi.BarAPI;
+import org.bukkit.*;
+import org.bukkit.configuration.file.YamlConfiguration;
+import org.bukkit.entity.*;
+import org.bukkit.generator.ChunkGenerator;
+import org.bukkit.plugin.java.JavaPlugin;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static org.bukkit.Material.*;
/**
* @awesome @author Citymonstret, Empire92 PlotMain class.
@@ -191,6 +92,9 @@ public class PlotMain extends JavaPlugin {
*/
public static CameraAPI cameraAPI;
+ public static WorldGuardPlugin worldGuard;
+
+
/**
* !!WorldGeneration!!
*/
@@ -410,7 +314,10 @@ public class PlotMain extends JavaPlugin {
if (plot.owner == null) {
continue;
}
- if (PlayerFunctions.hasExpired(plot)) {
+ long lastPlayed = getLastPlayed(plot.owner);
+ if(lastPlayed == 0) continue;
+ int days = (int) (lastPlayed / (1000*60*60*24));
+ if (days >= Settings.AUTO_CLEAR_DAYS) {
PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id);
Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
@@ -561,6 +468,7 @@ public class PlotMain extends JavaPlugin {
e.printStackTrace();
}
}
+
getCommand("plots").setExecutor(new MainCommand());
getCommand("plots").setAliases(new ArrayList() {
{
@@ -569,6 +477,7 @@ public class PlotMain extends JavaPlugin {
add("plot");
}
});
+
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
if (getServer().getPluginManager().getPlugin("CameraAPI") != null) {
@@ -584,13 +493,19 @@ public class PlotMain extends JavaPlugin {
worldEdit = (WorldEditPlugin) getServer().getPluginManager().getPlugin("WorldEdit");
getServer().getPluginManager().registerEvents(new WorldEditListener(), this);
}
- checkExpired(PlotMain.getMain(), true);
- checkForExpiredPlots();
+ if (getServer().getPluginManager().getPlugin("WorldGuard") != null) {
+ worldGuard = (WorldGuardPlugin) getServer().getPluginManager().getPlugin("WorldGuard");
+ getServer().getPluginManager().registerEvents(new WorldGuardListener(this), this);
+ }
+ if(Settings.AUTO_CLEAR) {
+ checkExpired(PlotMain.getMain(), true);
+ checkForExpiredPlots();
+ }
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Lag(), 100L, 1L);
if (Web.ENABLED) {
- sendConsoleSenderMessage(C.PREFIX.s() + "This is not yet implemented...");
+ sendConsoleSenderMessage(C.PREFIX.s() + "Web Is not implemented yet. Please bear with us.");
}
}
@@ -702,6 +617,14 @@ public class PlotMain extends JavaPlugin {
translations = YamlConfiguration.loadConfiguration(translationsFile);
}
+ public static long getLastPlayed(UUID uuid) {
+ if(uuid == null) return 0;
+ OfflinePlayer player;
+ if((player = Bukkit.getOfflinePlayer(uuid)) == null || !player.hasPlayedBefore()) {
+ return 0;
+ }
+ return player.getLastPlayed();
+ }
/**
* Load configuration files
*/
@@ -768,6 +691,24 @@ public class PlotMain extends JavaPlugin {
// Web
// Web.ENABLED = config.getBoolean("web.enabled");
// Web.PORT = config.getInt("web.port");
+
+ Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
+ Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days");
+ }
+ if(Settings.DEBUG) {
+ Map settings = new HashMap<>();
+ settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);
+ settings.put("Use Metrics", "" + Settings.METRICS);
+ settings.put("Mob Pathfinding", "" + Settings.MOB_PATHFINDING);
+ settings.put("Web Enabled", "" + Web.ENABLED);
+ settings.put("Web Port", "" + Web.PORT);
+ settings.put("DB Mysql Enabled", "" + Settings.DB.USE_MYSQL);
+ settings.put("DB SQLite Enabled", "" + Settings.DB.USE_SQLITE);
+ settings.put("Auto Clear Enabled", "" + Settings.AUTO_CLEAR);
+ settings.put("Auto Clear Days", "" + Settings.AUTO_CLEAR_DAYS);
+ for(Entry setting : settings.entrySet()) {
+ sendConsoleSenderMessage(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
+ }
}
}
@@ -888,11 +829,19 @@ public class PlotMain extends JavaPlugin {
options.put("web.enabled", Web.ENABLED);
options.put("web.port", Web.PORT);
options.put("metrics", true);
+ options.put("debug", true);
+ options.put("clear.auto.enabled", false);
+ options.put("clear.auto.days", 365);
+
for (Entry node : options.entrySet()) {
if (!config.contains(node.getKey())) {
config.set(node.getKey(), node.getValue());
}
}
+ Settings.DEBUG = config.getBoolean("debug");
+ if(Settings.DEBUG) {
+ sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
+ }
Web.ENABLED = config.getBoolean("web.enabled");
Web.PORT = config.getInt("web.port");
Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs");
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/Settings.java b/PlotSquared/src/com/intellectualcrafters/plot/Settings.java
index 058500b85..e5901f3a8 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/Settings.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/Settings.java
@@ -46,6 +46,11 @@ public class Settings {
*/
public static String URL = "http://dev.bukkit.org/bukkit-plugins/plotsquared/";
+ public static boolean DEBUG = true;
+
+ public static boolean AUTO_CLEAR = false;
+ public static int AUTO_CLEAR_DAYS = 365;
+
public static class Update {
/**
* Update plugin?
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
index e65ceec5d..c0c1f7613 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/WorldGenerator.java
@@ -1,30 +1,5 @@
package com.intellectualcrafters.plot;
-import static com.intellectualcrafters.plot.PlotWorld.DEFAULT_FLAGS_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.MAIN_BLOCK_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.PLOT_BIOME_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.PLOT_HEIGHT_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.PLOT_WIDTH_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.ROAD_BLOCK_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.ROAD_HEIGHT_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.ROAD_STRIPES_ENABLED_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.ROAD_WIDTH_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_FILE_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.SCHEMATIC_ON_CLAIM_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.TOP_BLOCK_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.WALL_BLOCK_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.WALL_FILLING_DEFAULT;
-import static com.intellectualcrafters.plot.PlotWorld.WALL_HEIGHT_DEFAULT;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Random;
-
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
@@ -33,6 +8,12 @@ import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
+import java.io.IOException;
+import java.util.*;
+import java.util.Map.Entry;
+
+import static com.intellectualcrafters.plot.PlotWorld.*;
+
/**
* TODO finish recoding this class
*
@@ -40,6 +21,7 @@ import org.bukkit.generator.ChunkGenerator;
* @author Citymonstret
*
*/
+@SuppressWarnings("deprecation")
public class WorldGenerator extends ChunkGenerator {
private long state;
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Visit.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Visit.java
index d9c4f5648..3553ef447 100644
--- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Visit.java
+++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Visit.java
@@ -9,17 +9,16 @@
package com.intellectualcrafters.plot.commands;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-
import com.intellectualcrafters.plot.C;
import com.intellectualcrafters.plot.PlayerFunctions;
import com.intellectualcrafters.plot.Plot;
import com.intellectualcrafters.plot.PlotMain;
+import org.bukkit.Bukkit;
+import org.bukkit.entity.Player;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
public class Visit extends SubCommand {
public Visit() {
@@ -27,7 +26,7 @@ public class Visit extends SubCommand {
}
public List getPlots(UUID uuid) {
- List plots = new ArrayList();
+ List plots = new ArrayList<>();
for (Plot p : PlotMain.getPlots()) {
if (p.owner.equals(uuid)) {
plots.add(p);
@@ -36,6 +35,7 @@ public class Visit extends SubCommand {
return plots;
}
+ @SuppressWarnings("deprecation")
@Override
public boolean execute(Player plr, String... args) {
if (args.length < 1) {
diff --git a/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
new file mode 100644
index 000000000..13cb45f61
--- /dev/null
+++ b/PlotSquared/src/com/intellectualcrafters/plot/listeners/WorldGuardListener.java
@@ -0,0 +1,62 @@
+package com.intellectualcrafters.plot.listeners;
+
+import com.intellectualcrafters.plot.Plot;
+import com.intellectualcrafters.plot.PlotHelper;
+import com.intellectualcrafters.plot.PlotId;
+import com.intellectualcrafters.plot.PlotMain;
+import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
+import com.intellectualcrafters.plot.events.PlotDeleteEvent;
+import com.sk89q.worldedit.BlockVector;
+import com.sk89q.worldguard.domains.DefaultDomain;
+import com.sk89q.worldguard.protection.managers.RegionManager;
+import com.sk89q.worldguard.protection.regions.ProtectedCuboidRegion;
+import com.sk89q.worldguard.protection.regions.ProtectedRegion;
+import org.bukkit.Bukkit;
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+
+/**
+ * Created by Citymonstret on 2014-09-24.
+ */
+public class WorldGuardListener implements Listener {
+
+ private PlotMain plugin;
+
+ public WorldGuardListener(PlotMain plugin) {
+ plugin.getServer().getPluginManager().registerEvents(this, plugin);
+ }
+
+ @EventHandler
+ public void onPlotClaim(PlayerClaimPlotEvent event) {
+ Player player = event.getPlayer();
+ Plot plot = event.getPlot();
+ RegionManager manager = PlotMain.worldGuard.getRegionManager(plot.getWorld());
+
+ Location location1 = PlotHelper.getPlotBottomLoc(plot.getWorld(), plot.getId());
+ Location location2 = PlotHelper.getPlotTopLoc(plot.getWorld(), plot.getId());
+
+ BlockVector vector1 = new BlockVector(location1.getBlockX(), 1, location1.getBlockZ());
+ BlockVector vector2 = new BlockVector(location2.getBlockX(), plot.getWorld().getMaxHeight(), location2.getBlockZ());
+
+ ProtectedRegion region = new ProtectedCuboidRegion(plot.getId().x + ";" + plot.getId().y, vector1, vector2);
+
+ DefaultDomain owner = new DefaultDomain();
+ owner.addPlayer(PlotMain.worldGuard.wrapPlayer(player));
+
+ region.setOwners(owner);
+
+ manager.addRegion(region);
+ }
+
+ @EventHandler
+ public void onPlotDelete(PlotDeleteEvent event) {
+ PlotId plot = event.getPlotId();
+ World world = Bukkit.getWorld(event.getWorld());
+
+ RegionManager manager = PlotMain.worldGuard.getRegionManager(world);
+ manager.removeRegion(plot.x + ";" + plot.y);
+ }
+}
diff --git a/plotsquared.xml b/plotsquared.xml
index 4ac7b5c20..31cb60999 100644
--- a/plotsquared.xml
+++ b/plotsquared.xml
@@ -123,7 +123,97 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+