From 99899e45ad1a9f6d39bbad0e5542a4ef823048c0 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Wed, 25 Feb 2015 21:36:19 +1100 Subject: [PATCH] Finished templates --- .../intellectualcrafters/plot/BukkitMain.java | 8 +- .../intellectualcrafters/plot/IPlotMain.java | 3 +- .../plot/PlotSquared.java | 2 +- .../plot/commands/DebugClaimTest.java | 2 +- .../plot/commands/Set.java | 2 - .../plot/commands/Template.java | 110 +++++++++++++++--- .../plot/commands/Trim.java | 2 +- .../plot/events/PlotDeleteEvent.java | 1 - .../plot/generator/BukkitHybridUtils.java | 2 +- .../plot/generator/HybridPlotManager.java | 11 +- .../plot/generator/HybridUtils.java | 2 +- .../plot/generator/SquarePlotManager.java | 2 +- .../plot/listeners/PlayerEvents.java | 5 - .../plot/object/PlotManager.java | 6 +- .../plot/util/BlockUpdateUtil.java | 1 - .../plot/util/ClusterManager.java | 2 +- .../plot/util/EventUtil.java | 1 - 17 files changed, 114 insertions(+), 48 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index e1b52f943..90a85b94b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -37,24 +37,24 @@ import com.intellectualcrafters.plot.listeners.PlotPlusListener; import com.intellectualcrafters.plot.listeners.WorldEditListener; import com.intellectualcrafters.plot.titles.AbstractTitle; import com.intellectualcrafters.plot.titles.DefaultTitle; -import com.intellectualcrafters.plot.util.ChunkManager; -import com.intellectualcrafters.plot.util.BlockUpdateUtil; import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.BlockUpdateUtil; +import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ConsoleColors; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitChunkManager; import com.intellectualcrafters.plot.util.bukkit.BukkitEventUtil; +import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager; import com.intellectualcrafters.plot.util.bukkit.BukkitSetupUtils; import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -import com.intellectualcrafters.plot.util.bukkit.BukkitChunkManager; import com.intellectualcrafters.plot.util.bukkit.Metrics; import com.intellectualcrafters.plot.util.bukkit.SendChunk; import com.intellectualcrafters.plot.util.bukkit.SetBlockFast; import com.intellectualcrafters.plot.util.bukkit.SetBlockFast_1_8; -import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager; import com.intellectualcrafters.plot.util.bukkit.SetBlockSlow; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java index 3e945f4ba..fdd5dc407 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/IPlotMain.java @@ -5,9 +5,8 @@ import java.io.File; import net.milkbowl.vault.economy.Economy; import com.intellectualcrafters.plot.generator.HybridUtils; -import com.intellectualcrafters.plot.object.PlotId; -import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.SetupUtils; import com.intellectualcrafters.plot.util.TaskManager; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index a552e75f0..37ea49f49 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -49,8 +49,8 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; -import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.ExpireManager; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java index 45e134a1c..76b92e195 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -35,8 +35,8 @@ import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.StringWrapper; -import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.EventUtil; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java index 7906a6a5d..a522adfe2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -20,9 +20,7 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import java.util.ArrayList; import java.util.Arrays; -import java.util.HashSet; import java.util.List; import org.apache.commons.lang.StringUtils; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java index 561e42aed..b9ba04316 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -24,13 +24,9 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Enumeration; import java.util.Set; -import java.util.zip.GZIPOutputStream; import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; +import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; import org.bukkit.configuration.ConfigurationSection; @@ -38,48 +34,130 @@ import org.bukkit.configuration.file.YamlConfiguration; import com.intellectualcrafters.plot.PlotSquared; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Configuration; +import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.object.FileBytes; import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.SetupObject; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.SetupUtils; +import com.intellectualcrafters.plot.util.TaskManager; public class Template extends SubCommand { public Template() { super("template", "plots.admin", "Create or use a world template", "template", "", CommandCategory.DEBUG, false); } - + @Override public boolean execute(final PlotPlayer plr, final String... args) { - if (args.length != 2) { - MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template "); + if (args.length != 2 && args.length != 3) { + MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template [template]"); return false; } final String world = args[1]; switch (args[0].toLowerCase()) { case "import": { - // TODO import template - MainUtil.sendMessage(plr, "TODO"); + if (args.length != 3) { + MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot template import