From 6f4f43240209bd4278ae46a344255b094b210589 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Sat, 25 Oct 2014 15:02:38 +0200 Subject: [PATCH] Added schematic save path setting --- .idea/workspace.xml | 75 ++++++++++--------- .../intellectualcrafters/plot/PlotMain.java | 3 + .../intellectualcrafters/plot/Settings.java | 1 + .../plot/commands/Schematic.java | 23 ++---- 4 files changed, 47 insertions(+), 55 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 829e0513f..13b759796 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -10,12 +10,8 @@ - - - - - + @@ -83,8 +79,18 @@ - - + + + + + + + + + + + + @@ -93,18 +99,8 @@ - - - - - - - - - - - - + + @@ -165,7 +161,6 @@ @@ -543,7 +539,7 @@ - + 1411382351159 @@ -785,11 +781,15 @@ 1414241164578 1414241164578 - - @@ -827,7 +827,7 @@ - + @@ -887,7 +887,6 @@ - @@ -912,7 +911,8 @@ - @@ -924,13 +924,6 @@ - - - - - - - @@ -1281,16 +1274,24 @@ - - + + + + + + + + + + - - + + diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java index 47d7999e3..b9984e133 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotMain.java @@ -926,6 +926,7 @@ public class PlotMain extends JavaPlugin { Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled"); Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days"); Settings.DELETE_PLOTS_ON_BAN = config.getBoolean("clear.on.ban"); + Settings.SCHEMATIC_SAVE_PATH = config.getString("schematic.save_path"); } if (Settings.DEBUG) { Map settings = new HashMap<>(); @@ -937,6 +938,7 @@ public class PlotMain extends JavaPlugin { 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); + settings.put("Schematics Save Path", "" + Settings.SCHEMATIC_SAVE_PATH); for (Entry setting : settings.entrySet()) { sendConsoleSenderMessage(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue())); @@ -1086,6 +1088,7 @@ public class PlotMain extends JavaPlugin { Settings.AUTO_CLEAR_DAYS = config.getInt("clear.auto.days"); Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled"); Settings.MAX_PLOTS = config.getInt("max_plots"); + Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); } public static void createConfiguration(PlotWorld plotworld) { diff --git a/PlotSquared/src/com/intellectualcrafters/plot/Settings.java b/PlotSquared/src/com/intellectualcrafters/plot/Settings.java index 6e62b1f11..8892a1e5e 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/Settings.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/Settings.java @@ -15,6 +15,7 @@ package com.intellectualcrafters.plot; * @author Empire92 */ public class Settings { + public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics"; public static int MAX_PLOTS = 20; /** * WorldGuard region on claimed plots diff --git a/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java b/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java index 981dbb663..c64b84d67 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/commands/Schematic.java @@ -1,26 +1,13 @@ package com.intellectualcrafters.plot.commands; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; - +import com.intellectualcrafters.jnbt.CompoundTag; +import com.intellectualcrafters.plot.*; import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; -import com.intellectualcrafters.jnbt.CompoundTag; -import com.intellectualcrafters.plot.C; -import com.intellectualcrafters.plot.PlayerFunctions; -import com.intellectualcrafters.plot.Plot; -import com.intellectualcrafters.plot.PlotHelper; -import com.intellectualcrafters.plot.PlotId; -import com.intellectualcrafters.plot.PlotMain; -import com.intellectualcrafters.plot.SchematicHandler; -import com.intellectualcrafters.plot.Settings; -import com.intellectualcrafters.plot.UUIDHandler; -import com.intellectualcrafters.plot.database.DBFunc; -import com.sun.org.apache.xerces.internal.impl.xs.identity.ValueStore; +import java.util.HashMap; public class Schematic extends SubCommand { @@ -161,7 +148,7 @@ public class Schematic extends SubCommand { public void run() { counter++; PlayerFunctions.sendMessage(plr, "&6ID: "+plot.id); - boolean result = SchematicHandler.save(sch, Settings.Web.PATH+"/"+plot.id.x+","+plot.id.y+","+worldname+","+owner+".schematic"); + boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH+"/"+plot.id.x+","+plot.id.y+","+worldname+","+owner+".schematic"); if (!result) { PlayerFunctions.sendMessage(plr, "&7 - Failed to save &c"+plot.id); @@ -253,7 +240,7 @@ public class Schematic extends SubCommand { public void run() { counter++; PlayerFunctions.sendMessage(plr, "&6ID: "+plot.id); - boolean result = SchematicHandler.save(sch, Settings.Web.PATH+"/"+plot.id.x+","+plot.id.y+","+world+","+owner+".schematic"); + boolean result = SchematicHandler.save(sch, Settings.SCHEMATIC_SAVE_PATH+"/"+plot.id.x+","+plot.id.y+","+world+","+owner+".schematic"); if (!result) { PlayerFunctions.sendMessage(plr, "&7 - Failed to save &c"+plot.id);