From e0941c6225495d25b51dc7ae26a1dea056f435d8 Mon Sep 17 00:00:00 2001 From: boy0001 Date: Mon, 6 Jul 2015 01:44:10 +1000 Subject: [PATCH] Invalid configuration recovery --- .../configuration/ConfigurationSection.java | 2 +- .../configuration/MemorySection.java | 4 +- .../configuration/file/FileConfiguration.java | 9 +- .../file/FileConfigurationOptions.java | 3 +- .../configuration/file/YamlConfiguration.java | 37 ++- .../configuration/file/YamlConstructor.java | 2 +- .../configuration/file/YamlRepresenter.java | 6 +- .../intellectualcrafters/plot/BukkitMain.java | 149 ++++++++-- .../com/intellectualcrafters/plot/PS.java | 101 +++++-- .../plot/api/PlotAPI.java | 32 +- .../plot/commands/Add.java | 4 +- .../plot/commands/Auto.java | 7 +- .../plot/commands/Buy.java | 7 +- .../plot/commands/Claim.java | 6 +- .../plot/commands/Clear.java | 4 +- .../plot/commands/Cluster.java | 18 +- .../plot/commands/Condense.java | 12 +- .../plot/commands/Database.java | 10 +- .../plot/commands/DebugClaimTest.java | 15 +- .../plot/commands/DebugExec.java | 28 +- .../plot/commands/DebugFixFlags.java | 8 +- .../plot/commands/DebugSaveTest.java | 4 +- .../plot/commands/DebugUUID.java | 19 +- .../plot/commands/Delete.java | 6 +- .../plot/commands/Deny.java | 4 +- .../plot/commands/Home.java | 4 +- .../plot/commands/Info.java | 3 - .../plot/commands/MainCommand.java | 2 - .../plot/commands/Merge.java | 23 +- .../plot/commands/Move.java | 6 +- .../plot/commands/Purge.java | 10 +- .../plot/commands/Rate.java | 25 +- .../plot/commands/RegenAllRoads.java | 4 +- .../plot/commands/Reload.java | 2 +- .../plot/commands/Remove.java | 2 - .../plot/commands/SchematicCmd.java | 14 +- .../plot/commands/Set.java | 27 +- .../plot/commands/SetOwner.java | 6 +- .../plot/commands/TP.java | 3 +- .../plot/commands/Template.java | 26 +- .../plot/commands/Trim.java | 20 +- .../plot/commands/Trust.java | 4 +- .../plot/commands/Unclaim.java | 1 - .../plot/commands/Undeny.java | 2 - .../plot/commands/Untrust.java | 2 - .../plot/commands/Visit.java | 8 +- .../plot/commands/list.java | 17 +- .../plot/commands/plugin.java | 10 +- .../intellectualcrafters/plot/config/C.java | 163 ++++++----- .../plot/config/Configuration.java | 2 +- .../plot/database/SQLManager.java | 33 ++- .../plot/database/SQLite.java | 10 +- .../database/plotme/APlotMeConnector.java | 1 - .../plotme/ClassicPlotMeConnector.java | 24 +- .../database/plotme/LikePlotMeConverter.java | 27 +- .../plot/events/ClusterFlagRemoveEvent.java | 1 - .../plot/flag/FlagManager.java | 15 +- .../plot/flag/FlagValue.java | 1 - .../plot/generator/AugmentedPopulator.java | 29 +- .../plot/generator/BukkitHybridUtils.java | 29 +- .../plot/generator/ClassicPlotWorld.java | 2 +- .../plot/generator/HybridPlotManager.java | 22 +- .../plot/generator/HybridPlotWorld.java | 3 +- .../plot/generator/HybridPop.java | 19 +- .../plot/generator/HybridUtils.java | 16 +- .../plot/generator/SquarePlotWorld.java | 1 - .../plot/listeners/ChunkListener.java | 7 +- .../plot/listeners/PlayerEvents.java | 101 +++++-- .../plot/listeners/PlayerEvents_1_8.java | 23 +- .../plot/listeners/PlayerEvents_1_8_3.java | 15 +- .../plot/listeners/PlotListener.java | 21 +- .../plot/listeners/PlotPlusListener.java | 1 - .../plot/listeners/TNTListener.java | 15 +- .../plot/listeners/WorldEvents.java | 7 +- .../plot/listeners/worldedit/WEListener.java | 21 +- .../plot/listeners/worldedit/WEManager.java | 6 +- .../listeners/worldedit/WESubscriber.java | 4 +- .../plot/object/Plot.java | 2 - .../plot/object/PlotGenerator.java | 17 +- .../plot/object/PlotSettings.java | 1 - .../plot/object/PlotWorld.java | 15 +- .../plot/util/BlockManager.java | 1 - .../plot/util/ClusterManager.java | 32 +- .../plot/util/EventUtil.java | 12 +- .../plot/util/ExpireManager.java | 26 +- .../plot/util/MainUtil.java | 27 +- .../plot/util/SchematicHandler.java | 32 +- .../plot/util/SetBlockQueue.java | 8 +- .../plot/util/StringMan.java | 23 ++ .../plot/util/TaskManager.java | 7 +- .../plot/util/WorldEditSchematic.java | 7 +- .../plot/util/bukkit/BukkitInventoryUtil.java | 2 +- .../util/bukkit/BukkitPlayerFunctions.java | 13 +- .../plot/util/bukkit/BukkitSetupUtils.java | 17 +- .../plot/util/bukkit/BukkitUtil.java | 1 - .../plot/util/bukkit/Metrics.java | 4 +- .../plot/util/bukkit/SendChunk.java | 19 +- .../plot/util/bukkit/SetBlockFast.java | 1 - .../plot/util/bukkit/SetGenCB.java | 15 +- .../plot/util/bukkit/UUIDHandler.java | 25 +- .../plot/util/bukkit/chat/FancyMessage.java | 4 +- .../plot/util/bukkit/chat/JsonString.java | 3 +- .../plot/util/bukkit/chat/MessagePart.java | 4 +- .../util/bukkit/chat/TextualComponent.java | 5 +- .../translation/Translation.java | 19 -- .../translation/TranslationAsset.java | 30 -- .../translation/TranslationFile.java | 35 --- .../translation/TranslationLanguage.java | 39 --- .../translation/TranslationManager.java | 190 ------------ .../translation/TranslationObject.java | 46 --- .../translation/YamlTranslationFile.java | 277 ------------------ .../translation/bukkit/BukkitTranslation.java | 56 ---- .../translation/bukkit/TranslationPlugin.java | 43 --- 113 files changed, 1073 insertions(+), 1322 deletions(-) create mode 100644 PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringMan.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/Translation.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/TranslationAsset.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/TranslationFile.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/TranslationLanguage.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/TranslationManager.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java delete mode 100644 PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/TranslationPlugin.java diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java index 8ca1b4d12..9e368b566 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/ConfigurationSection.java @@ -1,8 +1,8 @@ package com.intellectualcrafters.configuration; +import java.util.List; import java.util.Map; import java.util.Set; -import java.util.List; /** * Represents a section of a {@link Configuration} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/MemorySection.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/MemorySection.java index b0cd19dab..ef7f33af5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/MemorySection.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/MemorySection.java @@ -1,6 +1,8 @@ package com.intellectualcrafters.configuration; -import static org.bukkit.util.NumberConversions.*; +import static org.bukkit.util.NumberConversions.toDouble; +import static org.bukkit.util.NumberConversions.toInt; +import static org.bukkit.util.NumberConversions.toLong; import java.util.ArrayList; import java.util.LinkedHashMap; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java index 3c39c26fa..caa269918 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java @@ -1,7 +1,5 @@ package com.intellectualcrafters.configuration.file; -import com.intellectualcrafters.configuration.InvalidConfigurationException; - import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; @@ -16,11 +14,12 @@ import java.io.Writer; import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; -import com.intellectualcrafters.configuration.Configuration; -import com.intellectualcrafters.configuration.MemoryConfiguration; - import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder; +import com.intellectualcrafters.configuration.Configuration; +import com.intellectualcrafters.configuration.InvalidConfigurationException; +import com.intellectualcrafters.configuration.MemoryConfiguration; + /** * This is a base class for all File based implementations of {@link * Configuration} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java index fcee3061a..72936c667 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/FileConfigurationOptions.java @@ -1,6 +1,7 @@ package com.intellectualcrafters.configuration.file; -import com.intellectualcrafters.configuration.*; +import com.intellectualcrafters.configuration.MemoryConfiguration; +import com.intellectualcrafters.configuration.MemoryConfigurationOptions; /** * Various settings for controlling the input and output of a {@link diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java index 2379c6915..4f395b580 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java @@ -1,22 +1,23 @@ package com.intellectualcrafters.configuration.file; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.io.Reader; +import java.nio.file.Files; +import java.nio.file.StandardCopyOption; import java.util.Map; -import com.intellectualcrafters.configuration.Configuration; -import com.intellectualcrafters.configuration.ConfigurationSection; -import com.intellectualcrafters.configuration.InvalidConfigurationException; -import com.intellectualcrafters.plot.PS; - import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.representer.Representer; +import com.intellectualcrafters.configuration.Configuration; +import com.intellectualcrafters.configuration.ConfigurationSection; +import com.intellectualcrafters.configuration.InvalidConfigurationException; +import com.intellectualcrafters.plot.PS; + /** * An implementation of {@link Configuration} which saves all files in Yaml. * Note that this implementation is not synchronized. @@ -177,13 +178,23 @@ public class YamlConfiguration extends FileConfiguration { try { config.load(file); - } catch (FileNotFoundException ex) { - } catch (IOException ex) { - PS.log("Cannot load " + file); - ex.printStackTrace(); - } catch (InvalidConfigurationException ex) { - PS.log("Cannot load " + file); - ex.printStackTrace(); + } catch (Exception ex) { + try { + String path = file.getAbsolutePath() + "_broken"; + File dest = new File(file.getAbsolutePath() + "_broken"); + int i = 0; + while (dest.exists()) { + dest = new File(file.getAbsolutePath() + "_broken_" + i++); + } + Files.copy( file.toPath(), dest.toPath() , StandardCopyOption.REPLACE_EXISTING); + PS.log("&dCould not read: &7" + file); + PS.log("&drenamed to: &7" + dest.getName()); + PS.log("&c============ Full stacktrace ============"); + ex.printStackTrace(); + PS.log("&c========================================="); + } catch (IOException e) { + e.printStackTrace(); + } } return config; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java index 024456a4c..5a8b41732 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java @@ -3,9 +3,9 @@ package com.intellectualcrafters.configuration.file; import java.util.LinkedHashMap; import java.util.Map; -import org.yaml.snakeyaml.nodes.Node; import org.yaml.snakeyaml.constructor.SafeConstructor; import org.yaml.snakeyaml.error.YAMLException; +import org.yaml.snakeyaml.nodes.Node; import org.yaml.snakeyaml.nodes.Tag; import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java index de52340c5..d4ef6da29 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java @@ -3,13 +3,13 @@ package com.intellectualcrafters.configuration.file; import java.util.LinkedHashMap; import java.util.Map; +import org.yaml.snakeyaml.nodes.Node; +import org.yaml.snakeyaml.representer.Representer; + import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; -import org.yaml.snakeyaml.nodes.Node; -import org.yaml.snakeyaml.representer.Representer; - public class YamlRepresenter extends Representer { public YamlRepresenter() { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java index 9dcbee212..8429a9e7c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/BukkitMain.java @@ -1,28 +1,10 @@ package com.intellectualcrafters.plot; -import com.intellectualcrafters.plot.commands.*; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.plotme.ClassicPlotMeConnector; -import com.intellectualcrafters.plot.database.plotme.LikePlotMeConverter; -import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.generator.BukkitHybridUtils; -import com.intellectualcrafters.plot.generator.HybridGen; -import com.intellectualcrafters.plot.generator.HybridUtils; -import com.intellectualcrafters.plot.listeners.*; -import com.intellectualcrafters.plot.listeners.worldedit.WEListener; -import com.intellectualcrafters.plot.listeners.worldedit.WESubscriber; -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.titles.AbstractTitle; -import com.intellectualcrafters.plot.titles.DefaultTitle; -import com.intellectualcrafters.plot.util.*; -import com.intellectualcrafters.plot.util.bukkit.*; -import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; -import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper; -import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; -import com.intellectualcrafters.plot.uuid.UUIDWrapper; -import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; +import java.io.File; +import java.util.Arrays; +import java.util.List; +import java.util.UUID; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -35,10 +17,123 @@ import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; -import java.io.File; -import java.util.Arrays; -import java.util.List; -import java.util.UUID; +import com.intellectualcrafters.plot.commands.Add; +import com.intellectualcrafters.plot.commands.Auto; +import com.intellectualcrafters.plot.commands.BukkitCommand; +import com.intellectualcrafters.plot.commands.Chat; +import com.intellectualcrafters.plot.commands.Claim; +import com.intellectualcrafters.plot.commands.Clear; +import com.intellectualcrafters.plot.commands.Cluster; +import com.intellectualcrafters.plot.commands.Comment; +import com.intellectualcrafters.plot.commands.Condense; +import com.intellectualcrafters.plot.commands.Confirm; +import com.intellectualcrafters.plot.commands.Copy; +import com.intellectualcrafters.plot.commands.CreateRoadSchematic; +import com.intellectualcrafters.plot.commands.Database; +import com.intellectualcrafters.plot.commands.Debug; +import com.intellectualcrafters.plot.commands.DebugClaimTest; +import com.intellectualcrafters.plot.commands.DebugClear; +import com.intellectualcrafters.plot.commands.DebugExec; +import com.intellectualcrafters.plot.commands.DebugFill; +import com.intellectualcrafters.plot.commands.DebugFixFlags; +import com.intellectualcrafters.plot.commands.DebugLoadTest; +import com.intellectualcrafters.plot.commands.DebugRoadRegen; +import com.intellectualcrafters.plot.commands.DebugSaveTest; +import com.intellectualcrafters.plot.commands.DebugUUID; +import com.intellectualcrafters.plot.commands.Delete; +import com.intellectualcrafters.plot.commands.Deny; +import com.intellectualcrafters.plot.commands.FlagCmd; +import com.intellectualcrafters.plot.commands.Help; +import com.intellectualcrafters.plot.commands.Home; +import com.intellectualcrafters.plot.commands.Inbox; +import com.intellectualcrafters.plot.commands.Info; +import com.intellectualcrafters.plot.commands.Inventory; +import com.intellectualcrafters.plot.commands.Kick; +import com.intellectualcrafters.plot.commands.MainCommand; +import com.intellectualcrafters.plot.commands.Merge; +import com.intellectualcrafters.plot.commands.Move; +import com.intellectualcrafters.plot.commands.MusicSubcommand; +import com.intellectualcrafters.plot.commands.Purge; +import com.intellectualcrafters.plot.commands.Rate; +import com.intellectualcrafters.plot.commands.RegenAllRoads; +import com.intellectualcrafters.plot.commands.Reload; +import com.intellectualcrafters.plot.commands.Remove; +import com.intellectualcrafters.plot.commands.SchematicCmd; +import com.intellectualcrafters.plot.commands.Set; +import com.intellectualcrafters.plot.commands.SetOwner; +import com.intellectualcrafters.plot.commands.Setup; +import com.intellectualcrafters.plot.commands.Swap; +import com.intellectualcrafters.plot.commands.TP; +import com.intellectualcrafters.plot.commands.Target; +import com.intellectualcrafters.plot.commands.Template; +import com.intellectualcrafters.plot.commands.Toggle; +import com.intellectualcrafters.plot.commands.Trim; +import com.intellectualcrafters.plot.commands.Trust; +import com.intellectualcrafters.plot.commands.Unclaim; +import com.intellectualcrafters.plot.commands.Undeny; +import com.intellectualcrafters.plot.commands.Unlink; +import com.intellectualcrafters.plot.commands.Untrust; +import com.intellectualcrafters.plot.commands.Visit; +import com.intellectualcrafters.plot.commands.WE_Anywhere; +import com.intellectualcrafters.plot.commands.list; +import com.intellectualcrafters.plot.commands.plugin; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.plotme.ClassicPlotMeConnector; +import com.intellectualcrafters.plot.database.plotme.LikePlotMeConverter; +import com.intellectualcrafters.plot.flag.FlagManager; +import com.intellectualcrafters.plot.generator.BukkitHybridUtils; +import com.intellectualcrafters.plot.generator.HybridGen; +import com.intellectualcrafters.plot.generator.HybridUtils; +import com.intellectualcrafters.plot.listeners.APlotListener; +import com.intellectualcrafters.plot.listeners.ChunkListener; +import com.intellectualcrafters.plot.listeners.ForceFieldListener; +import com.intellectualcrafters.plot.listeners.InventoryListener; +import com.intellectualcrafters.plot.listeners.PlayerEvents; +import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8; +import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8_3; +import com.intellectualcrafters.plot.listeners.PlotListener; +import com.intellectualcrafters.plot.listeners.PlotPlusListener; +import com.intellectualcrafters.plot.listeners.TNTListener; +import com.intellectualcrafters.plot.listeners.WorldEvents; +import com.intellectualcrafters.plot.listeners.worldedit.WEListener; +import com.intellectualcrafters.plot.listeners.worldedit.WESubscriber; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.titles.AbstractTitle; +import com.intellectualcrafters.plot.titles.DefaultTitle; +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.EconHandler; +import com.intellectualcrafters.plot.util.EventUtil; +import com.intellectualcrafters.plot.util.InventoryUtil; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.PlayerManager; +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.BukkitEconHandler; +import com.intellectualcrafters.plot.util.bukkit.BukkitEventUtil; +import com.intellectualcrafters.plot.util.bukkit.BukkitInventoryUtil; +import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerManager; +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.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.SetBlockSlow; +import com.intellectualcrafters.plot.util.bukkit.SetGenCB; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; +import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; +import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper; +import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; +import com.intellectualcrafters.plot.uuid.UUIDWrapper; +import com.sk89q.worldedit.WorldEdit; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java index bf0bb1e0a..9dae6edd9 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1,23 +1,5 @@ package com.intellectualcrafters.plot; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Configuration; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.*; -import com.intellectualcrafters.plot.flag.AbstractFlag; -import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.flag.FlagValue; -import com.intellectualcrafters.plot.generator.*; -import com.intellectualcrafters.plot.listeners.APlotListener; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.object.comment.CommentManager; -import com.intellectualcrafters.plot.util.*; -import com.intellectualcrafters.plot.util.Logger.LogLevel; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import com.sk89q.worldedit.bukkit.WorldEditPlugin; - -import com.intellectualcrafters.configuration.file.YamlConfiguration; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -25,11 +7,69 @@ import java.io.IOException; import java.sql.Connection; import java.sql.DatabaseMetaData; import java.sql.SQLException; -import java.util.*; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashMap; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; +import com.intellectualcrafters.configuration.file.YamlConfiguration; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Configuration; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.database.Database; +import com.intellectualcrafters.plot.database.MySQL; +import com.intellectualcrafters.plot.database.SQLManager; +import com.intellectualcrafters.plot.database.SQLite; +import com.intellectualcrafters.plot.flag.AbstractFlag; +import com.intellectualcrafters.plot.flag.FlagManager; +import com.intellectualcrafters.plot.flag.FlagValue; +import com.intellectualcrafters.plot.generator.AugmentedPopulator; +import com.intellectualcrafters.plot.generator.ClassicPlotWorld; +import com.intellectualcrafters.plot.generator.HybridGen; +import com.intellectualcrafters.plot.generator.HybridPlotWorld; +import com.intellectualcrafters.plot.generator.HybridUtils; +import com.intellectualcrafters.plot.generator.SquarePlotManager; +import com.intellectualcrafters.plot.generator.SquarePlotWorld; +import com.intellectualcrafters.plot.listeners.APlotListener; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotGenerator; +import com.intellectualcrafters.plot.object.PlotHandler; +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.object.comment.CommentManager; +import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.ChunkManager; +import com.intellectualcrafters.plot.util.ClusterManager; +import com.intellectualcrafters.plot.util.EconHandler; +import com.intellectualcrafters.plot.util.EventUtil; +import com.intellectualcrafters.plot.util.ExpireManager; +import com.intellectualcrafters.plot.util.InventoryUtil; +import com.intellectualcrafters.plot.util.Logger; +import com.intellectualcrafters.plot.util.Logger.LogLevel; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.PlayerManager; +import com.intellectualcrafters.plot.util.SetupUtils; +import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; +import com.sk89q.worldedit.bukkit.WorldEditPlugin; + /** * An implementation of the core, * with a static getter for easy access @@ -49,6 +89,8 @@ public class PS { // public: public WorldEditPlugin worldEdit = null; public File configFile; + public File translationFile; + public YamlConfiguration style; public YamlConfiguration config; public YamlConfiguration storage; public IPlotMain IMP = null; @@ -56,7 +98,6 @@ public class PS { // private: private File styleFile; - private YamlConfiguration style; private File storageFile; private File FILE = null; // This file private String VERSION = null; @@ -80,8 +121,6 @@ public class PS { } VERSION = IMP.getVersion(); EconHandler.manager = IMP.getEconomyHandler(); - C.setupTranslations(); - C.saveTranslations(); if (getJavaVersion() < 1.7) { log(C.PREFIX.s() + "&cYour java version is outdated. Please update to at least 1.7."); // Didn't know of any other link :D @@ -97,6 +136,8 @@ public class PS { log(C.ENABLED.s()); } setupConfigs(); + this.translationFile = new File(IMP.getDirectory() + File.separator + "translations" + File.separator + "PlotSquared.use_THIS.yml"); + C.load(translationFile); setupDefaultFlags(); setupDatabase(); CommentManager.registerDefaultInboxes(); @@ -1270,10 +1311,6 @@ public class PS { * Show startup debug information */ public void showDebug() { - C.COLOR_1 = "&" + (style.getString("color.1")); - C.COLOR_2 = "&" + (style.getString("color.2")); - C.COLOR_3 = "&" + (style.getString("color.3")); - C.COLOR_4 = "&" + (style.getString("color.4")); if (Settings.DEBUG) { final Map settings = new HashMap<>(); settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS); @@ -1298,12 +1335,12 @@ public class PS { private void setupStyle() { style.set("version", VERSION); final Map o = new HashMap<>(); - o.put("color.1", C.COLOR_1.substring(1)); - o.put("color.2", C.COLOR_2.substring(1)); - o.put("color.3", C.COLOR_3.substring(1)); - o.put("color.4", C.COLOR_4.substring(1)); - for (final Entry node : o.entrySet()) { - if (!style.contains(node.getKey())) { + o.put("color.1", "6"); + o.put("color.2", "7"); + o.put("color.3", "8"); + o.put("color.4", "3"); + if (!style.contains("color")) { + for (final Entry node : o.entrySet()) { style.set(node.getKey(), node.getValue()); } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index 57164503c..58c4d1fa6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -21,27 +21,37 @@ package com.intellectualcrafters.plot.api; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + +import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.commands.MainCommand; import com.intellectualcrafters.plot.commands.SubCommand; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.*; +import com.intellectualcrafters.plot.object.Plot; +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.BlockManager; +import com.intellectualcrafters.plot.util.ChunkManager; +import com.intellectualcrafters.plot.util.ClusterManager; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.uuid.UUIDWrapper; -import org.bukkit.Location; -import org.bukkit.World; -import com.intellectualcrafters.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Set; /** * PlotSquared API diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java index 16f72d916..1c0a6a45a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Add.java @@ -20,6 +20,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -31,8 +33,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.UUID; - public class Add extends SubCommand { public Add() { super(Command.ADD, "Allow a user to build while you are online", "add ", CommandCategory.ACTIONS, true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index f2d09b387..0c98eebb4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -23,7 +23,12 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java index b7e3dec3c..35fffb747 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Buy.java @@ -26,7 +26,12 @@ import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotHandler; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java index 3d9fe02ae..1fae73967 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Claim.java @@ -27,7 +27,11 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; -import com.intellectualcrafters.plot.util.*; +import com.intellectualcrafters.plot.util.EconHandler; +import com.intellectualcrafters.plot.util.EventUtil; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java index 581c5be17..93d34131e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Clear.java @@ -20,6 +20,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.Set; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -33,8 +35,6 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.Set; - public class Clear extends SubCommand { public Clear() { super(Command.CLEAR, "Clear a plot", "clear", CommandCategory.ACTIONS, false); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java index 11401ccc2..ed1aef502 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java @@ -20,21 +20,29 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.generator.AugmentedPopulator; import com.intellectualcrafters.plot.generator.HybridGen; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.BlockLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotClusterId; +import com.intellectualcrafters.plot.object.PlotGenerator; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.UUID; - public class Cluster extends SubCommand { public Cluster() { super(Command.CLUSTER, "Manage a plot cluster", "cluster", CommandCategory.ACTIONS, true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java index 0302012fe..453bec5ae 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Condense.java @@ -20,6 +20,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; @@ -27,10 +35,6 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; -import org.apache.commons.lang.StringUtils; - -import java.util.*; -import java.util.Set; public class Condense extends SubCommand { public static boolean TASK = false; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java index bbaf44cd4..b093bc068 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Database.java @@ -1,5 +1,10 @@ package com.intellectualcrafters.plot.commands; +import java.sql.Connection; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.MySQL; @@ -11,11 +16,6 @@ import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.sql.Connection; -import java.sql.SQLException; -import java.util.ArrayList; -import java.util.UUID; - /** * Created 2014-11-15 for PlotSquared * 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 00be7f0c8..de467d6d2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java @@ -20,20 +20,27 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.UUID; + import com.google.common.collect.BiMap; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +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.object.StringWrapper; 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; -import java.util.ArrayList; -import java.util.UUID; - /** * @author Citymonstret */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java index 194cb6474..3e8c1d047 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java @@ -20,26 +20,36 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.io.File; +import java.io.FileNotFoundException; +import java.io.PrintWriter; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Date; +import java.util.List; +import java.util.UUID; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.Bukkit; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.generator.BukkitHybridUtils; import com.intellectualcrafters.plot.generator.HybridUtils; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.OfflinePlotPlayer; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotAnalysis; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ExpireManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.apache.commons.lang.StringUtils; -import org.bukkit.Bukkit; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintWriter; -import java.sql.Timestamp; -import java.util.*; public class DebugExec extends SubCommand { public DebugExec() { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java index cfb3fd5a6..016046b4d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java @@ -20,6 +20,10 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -30,10 +34,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - public class DebugFixFlags extends SubCommand { public DebugFixFlags() { super(Command.DEBUGFIXFLAGS, "Attempt to fix all flags for a world", "debugclear", CommandCategory.DEBUG, false); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java index 3b98a2204..b49bbd730 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java @@ -20,14 +20,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; -import java.util.ArrayList; - /** * @author Citymonstret */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java index 203d7519d..7d95dc9ef 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java @@ -20,6 +20,16 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.io.File; +import java.io.FilenameFilter; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.UUID; + +import org.bukkit.Bukkit; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -37,15 +47,6 @@ import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper; import com.intellectualcrafters.plot.uuid.LowerOfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.UUIDWrapper; -import org.bukkit.Bukkit; - -import java.io.File; -import java.io.FilenameFilter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map.Entry; -import java.util.UUID; public class DebugUUID extends SubCommand { public DebugUUID() { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java index 44d5fd086..1d731a78c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Delete.java @@ -28,7 +28,11 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotWorld; -import com.intellectualcrafters.plot.util.*; +import com.intellectualcrafters.plot.util.CmdConfirm; +import com.intellectualcrafters.plot.util.EconHandler; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; public class Delete extends SubCommand { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java index bd71ff3c0..d50bf4f63 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Deny.java @@ -20,6 +20,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -31,8 +33,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.UUID; - public class Deny extends SubCommand { public Deny() { super(Command.DENY, "Deny a user from a plot", "deny ", CommandCategory.ACTIONS, true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java index 9448cd1a4..5389e475a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Home.java @@ -20,14 +20,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; -import java.util.ArrayList; - /** * @author Citymonstret */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java index 651f32351..3563bc180 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Info.java @@ -21,14 +21,12 @@ package com.intellectualcrafters.plot.commands; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collection; import java.util.UUID; import java.util.regex.Matcher; import org.apache.commons.lang.StringUtils; -import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; @@ -38,7 +36,6 @@ import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.TaskManager; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index cbdb50821..f761f7f93 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -24,11 +24,9 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringComparison; /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java index d7b6a1946..ea89f5ca3 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Merge.java @@ -20,17 +20,26 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.*; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.apache.commons.lang.StringUtils; - import java.util.ArrayList; import java.util.HashSet; import java.util.UUID; +import org.apache.commons.lang.StringUtils; + +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.util.CmdConfirm; +import com.intellectualcrafters.plot.util.EconHandler; +import com.intellectualcrafters.plot.util.EventUtil; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; + /** * @author Citymonstret */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java index 2fbebfe9d..9b2d70b00 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Move.java @@ -22,7 +22,11 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java index 4cb85542b..928b05ac7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Purge.java @@ -20,6 +20,11 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -29,11 +34,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; - @SuppressWarnings({ "javadoc" }) public class Purge extends SubCommand { public Purge() { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java index cc838be80..c8a95206e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Rate.java @@ -20,22 +20,27 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.TaskManager; -import org.apache.commons.lang.StringUtils; -import org.apache.commons.lang.mutable.MutableInt; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; import java.util.Map.Entry; import java.util.UUID; +import org.apache.commons.lang.StringUtils; +import org.apache.commons.lang.mutable.MutableInt; + +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotInventory; +import com.intellectualcrafters.plot.object.PlotItemStack; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.TaskManager; + public class Rate extends SubCommand { /* * String cmd, String permission, String description, String usage, String diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java index 14f8850ec..ec98558e0 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java @@ -20,6 +20,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.List; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.generator.HybridPlotManager; @@ -29,8 +31,6 @@ import com.intellectualcrafters.plot.object.PlotManager; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.ChunkManager; -import java.util.List; - public class RegenAllRoads extends SubCommand { public RegenAllRoads() { super(Command.REGENALLROADS, "Regenerate all roads in the map using the set road schematic", "rgar", CommandCategory.DEBUG, false); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java index a299d1b85..a425d2ce1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Reload.java @@ -38,7 +38,7 @@ public class Reload extends SubCommand { // loaded during startup unfortunately. PS.get().config.load(PS.get().configFile); PS.get().setupConfig(); - C.setupTranslations(); + C.load(PS.get().translationFile); for (final String pw : PS.get().getPlotWorlds()) { final PlotWorld plotworld = PS.get().getPlotWorld(pw); plotworld.loadDefaultConfiguration(PS.get().config.getConfigurationSection("worlds." + pw)); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java index 4c33ca3ed..bbf8809fc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Remove.java @@ -22,11 +22,9 @@ package com.intellectualcrafters.plot.commands; import java.util.ArrayList; import java.util.HashSet; -import java.util.Iterator; import java.util.UUID; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java index 1ce79d6ca..0a01443bf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java @@ -20,22 +20,26 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.*; +import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection; import com.intellectualcrafters.plot.util.SchematicHandler.Dimension; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; +import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; - public class SchematicCmd extends SubCommand { private int counter = 0; private boolean running = false; 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 77c06b5d0..5f48d8765 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Set.java @@ -20,22 +20,33 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import org.apache.commons.lang.StringUtils; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Configuration; -import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.listeners.APlotListener; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.*; +import com.intellectualcrafters.plot.object.BlockLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotBlock; +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.BlockManager; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.SetBlockQueue; +import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.apache.commons.lang.StringUtils; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; /** * @author Citymonstret diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java index 4267d71ae..ecf9a97f7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java @@ -20,6 +20,9 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -32,9 +35,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.ArrayList; -import java.util.UUID; - public class SetOwner extends SubCommand { public SetOwner() { super("setowner", "plots.set.owner", "Set the plot owner", "setowner ", "so", CommandCategory.ACTIONS, true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java index 4c012e433..67fde8b9b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/TP.java @@ -20,6 +20,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import org.apache.commons.lang.StringUtils; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Location; @@ -29,7 +31,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.apache.commons.lang.StringUtils; /** * @author Citymonstret 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 1641118e2..bc5941506 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Template.java @@ -20,17 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.ConfigurationNode; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.BlockManager; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.SetupUtils; -import com.intellectualcrafters.plot.util.TaskManager; -import com.intellectualcrafters.configuration.ConfigurationSection; -import com.intellectualcrafters.configuration.file.YamlConfiguration; - import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -40,6 +29,21 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import java.util.zip.ZipOutputStream; +import com.intellectualcrafters.configuration.ConfigurationSection; +import com.intellectualcrafters.configuration.file.YamlConfiguration; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +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); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java index b4f0588fc..ec0127a15 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trim.java @@ -20,14 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.BlockManager; -import com.intellectualcrafters.plot.util.ChunkManager; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.TaskManager; - import java.io.File; import java.nio.file.Files; import java.nio.file.Path; @@ -36,6 +28,18 @@ import java.nio.file.attribute.BasicFileAttributes; import java.util.ArrayList; import java.util.HashSet; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.BlockManager; +import com.intellectualcrafters.plot.util.ChunkManager; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.TaskManager; + public class Trim extends SubCommand { public static boolean TASK = false; public static ArrayList expired = null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java index 2a6ba88b1..ad49322cd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Trust.java @@ -20,6 +20,8 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; @@ -31,8 +33,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.UUID; - public class Trust extends SubCommand { public Trust() { super(Command.TRUST, "Allow a player to build in a plot", "trust ", CommandCategory.ACTIONS, true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java index b924478dd..6b2d1c8d5 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Unclaim.java @@ -22,7 +22,6 @@ package com.intellectualcrafters.plot.commands; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java index 33678044b..687ce7e53 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java @@ -21,11 +21,9 @@ package com.intellectualcrafters.plot.commands; import java.util.ArrayList; -import java.util.Iterator; import java.util.UUID; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java index ad552683d..ffbf7d084 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java @@ -21,11 +21,9 @@ package com.intellectualcrafters.plot.commands; import java.util.ArrayList; -import java.util.Iterator; import java.util.UUID; import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 65c3c5430..a6970d73b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -20,6 +20,10 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; @@ -28,10 +32,6 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import java.util.ArrayList; -import java.util.List; -import java.util.UUID; - public class Visit extends SubCommand { public Visit() { super("visit", "plots.visit", "Visit someones plot", "visit {player} [#]", "v", CommandCategory.TELEPORT, true); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java index 0584cdb1c..b713c7e71 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/list.java @@ -20,6 +20,17 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.List; +import java.util.Map.Entry; +import java.util.Set; +import java.util.UUID; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.ChatColor; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -34,12 +45,6 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import com.intellectualcrafters.plot.util.bukkit.chat.FancyMessage; -import org.apache.commons.lang.StringUtils; -import org.bukkit.ChatColor; - -import java.util.*; -import java.util.Map.Entry; -import java.util.Set; /** * @author Citymonstret diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java index e17cdabfd..d99d1c512 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/commands/plugin.java @@ -20,17 +20,17 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.commands; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.TaskManager; - import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.URL; import java.net.URLConnection; import java.util.ArrayList; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.TaskManager; + public class plugin extends SubCommand { public static String downloads, version; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java index 83aa7bbe3..85e74df3d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -20,15 +20,18 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.config; +import java.io.File; +import java.util.EnumSet; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Set; + import org.bukkit.ChatColor; -import com.boydti.buildoff.config.BBC; -import com.intellectualsites.translation.TranslationFile; -import com.intellectualsites.translation.TranslationLanguage; -import com.intellectualsites.translation.TranslationManager; -import com.intellectualsites.translation.TranslationObject; -import com.intellectualsites.translation.YamlTranslationFile; -import com.intellectualsites.translation.bukkit.BukkitTranslation; +import com.intellectualcrafters.configuration.ConfigurationSection; +import com.intellectualcrafters.configuration.file.YamlConfiguration; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.util.StringMan; /** * Captions class. @@ -41,7 +44,7 @@ public enum C { * Confirm */ FAILED_CONFIRM("$2You have no pending actions to confirm!", "Confirm"), - REQUIRES_CONFIRM("$2Are you sure you wish to execute: $1%s$2?\n$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"), + REQUIRES_CONFIRM("$2Are you sure you wish to execute: $1%s$2?\\n$2This cannot be undone! If you are sure: $1/plot confirm", "Confirm"), /* * Move */ @@ -57,7 +60,7 @@ public enum C { */ CLUSTER_AVAILABLE_ARGS("$1The following sub commands are available: $4list$2, $4create$2, $4delete$2, $4resize$2, $4invite$2, $4kick$2, $4leave$2, $4members$2, $4info$2, $4tp$2, $4sethome", "Cluster"), CLUSTER_LIST_HEADING("$2There are $1%s$2 clusters in this world", "Cluster"), - CLUSTER_LIST_ELEMENT("$2 - $1%s\n", "Cluster"), + CLUSTER_LIST_ELEMENT("$2 - $1%s\\n", "Cluster"), CLUSTER_INTERSECTION("$2The proposed area overlaps with $1%s$2 existing cluster/s", "Cluster"), CLUSTER_ADDED("$4Successfully created the cluster.", "Cluster"), CLUSTER_DELETED("$4Successfully deleted the cluster.", "Cluster"), @@ -74,7 +77,7 @@ public enum C { CLUSTER_REMOVED_HELPER("$4Successfully removed a helper from the cluster", "Cluster"), CLUSTER_REGENERATED("$4Successfully started cluster regeneration", "Cluster"), CLUSTER_TELEPORTING("$4Teleporting...", "Cluster"), - CLUSTER_INFO("$1Current cluster: $2%id%\n$1Name: $2%name%\n$1Owner: $2%owner%\n$1Size: $2%size%\n$1Rights: $2%rights%", "Cluster"), + CLUSTER_INFO("$1Current cluster: $2%id%\\n$1Name: $2%name%\\n$1Owner: $2%owner%\\n$1Size: $2%size%\\n$1Rights: $2%rights%", "Cluster"), CLUSTER_CURRENT_PLOTID("$1Current plot: $2%s", "Cluster"), /* * Border @@ -115,7 +118,7 @@ public enum C { NOT_VALID_INBOX_INDEX("$2No comment at index %s", "Comment"), INBOX_ITEM("$2 - $4%s", "Comment"), COMMENT_SYNTAX("$2Use /plots comment [X;Z] <%s> ", "Comment"), - INVALID_INBOX("$2That is not a valid inbox.\n$1Accepted values: %s", "Comment"), + INVALID_INBOX("$2That is not a valid inbox.\\n$1Accepted values: %s", "Comment"), NO_PERM_INBOX("$2You do not have permission for that inbox", "Comment"), NO_PERM_INBOX_MODIFY("$2You do not have permission to modify that inbox", "Comment"), NO_PLOT_INBOX("$2You must stand in or supply a plot argument", "Comment"), @@ -178,8 +181,8 @@ public enum C { SETUP_VALID_ARG("$2Value $1%s $2set to %s", "Setup"), SETUP_FINISHED("$3If you are using MULTIVERSE or MULTIWORLD the world should have just been created. Otherwise you will need to add the world manually through the bukkit.yml", "Setup"), SETUP_WORLD_TAKEN("$2%s is already a registered plotworld", "Setup"), - SETUP_MISSING_WORLD("$2You need to specify a world name ($1/plot setup &l$1 $2)\n$1Additional commands:\n$2 - $1/plot setup \n$2 - $1/plot setup back\n$2 - $1/plot setup cancel", "Setup"), - SETUP_MISSING_GENERATOR("$2You need to specify a generator ($1/plot setup &l&r$2)\n$1Additional commands:\n$2 - $1/plot setup \n$2 - $1/plot setup back\n$2 - $1/plot setup cancel", "Setup"), + SETUP_MISSING_WORLD("$2You need to specify a world name ($1/plot setup &l$1 $2)\\n$1Additional commands:\\n$2 - $1/plot setup \\n$2 - $1/plot setup back\\n$2 - $1/plot setup cancel", "Setup"), + SETUP_MISSING_GENERATOR("$2You need to specify a generator ($1/plot setup &l&r$2)\\n$1Additional commands:\\n$2 - $1/plot setup \\n$2 - $1/plot setup back\\n$2 - $1/plot setup cancel", "Setup"), SETUP_INVALID_GENERATOR("$2Invalid generator. Possible options: %s", "Setup"), /* * Schematic Stuff @@ -351,7 +354,7 @@ public enum C { PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"), PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"), PLOT_INFO_HEADER("$3====== $1INFO $3======", false, "Info"), - PLOT_INFO("$1ID: $2%id%$1\n" + "$1Alias: $2%alias%$1\n" + "$1Owner: $2%owner%$1\n" + "$1Biome: $2%biome%$1\n" + "$1Can Build: $2%build%$1\n" + "$1Rating: $2%rating%\n" + "$1Trusted: $2%trusted%$1\n" + "$1Members: $2%members%$1\n" + "$1Denied: $2%denied%$1\n" + "$1Flags: $2%flags%", "Info"), + PLOT_INFO("$1ID: $2%id%$1\\n" + "$1Alias: $2%alias%$1\\n" + "$1Owner: $2%owner%$1\\n" + "$1Biome: $2%biome%$1\\n" + "$1Can Build: $2%build%$1\\n" + "$1Rating: $2%rating%\\n" + "$1Trusted: $2%trusted%$1\\n" + "$1Members: $2%members%$1\\n" + "$1Denied: $2%denied%$1\\n" + "$1Flags: $2%flags%", "Info"), PLOT_INFO_TRUSTED("$1Trusted:$2 %trusted%", "Info"), PLOT_INFO_MEMBERS("$1Members:$2 %members%", "Info"), PLOT_INFO_DENIED("$1Denied:$2 %denied%", "Info"), @@ -469,7 +472,7 @@ public enum C { HELP_CATEGORY("$1Category: $2%category%$2,$1 Page: $2%current%$3/$2%max%$2,$1 Displaying: $2%dis%$3/$2%total%", "Help"), HELP_INFO("$3====== $1Choose a Category $3======", false, "Help"), HELP_INFO_ITEM("$1/plots help %category% $3- $2%category_desc%", "Help"), - HELP_ITEM("$1%usage% [%alias%]\n $3- $2%desc%\n", "Help"), + HELP_ITEM("$1%usage% [%alias%]\\n $3- $2%desc%\\n", "Help"), /* * Direction */ @@ -479,32 +482,13 @@ public enum C { */ CUSTOM_STRING("-", "-"); /** - * Special Language - * - * @see com.intellectualsites.translation.TranslationLanguage + * Translated */ - protected final static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use"); - public static String COLOR_1 = "&6", COLOR_2 = "&7", COLOR_3 = "&8", COLOR_4 = "&3"; - /** - * The TranslationManager - * - * @see com.intellectualsites.translation.TranslationManager - */ - private static TranslationManager manager; - /** - * The default file - * - * @see com.intellectualsites.translation.TranslationFile - */ - private static TranslationFile defaultFile; + private String s; /** * Default */ private String d; - /** - * Translated - */ - private String s; /** * What locale category should this translation fall under */ @@ -560,41 +544,84 @@ public enum C { } return m; } - - public static void setupTranslations() { - manager = new TranslationManager(); - defaultFile = new YamlTranslationFile(BukkitTranslation.getParent(), lang, "PlotSquared", manager, true).read(); - // register everything in this class - for (final C c : values()) { - manager.addTranslationObject(new TranslationObject(c.toString(), c.d, "", "")); - } - } - - public static void saveTranslations() { + + public static void load(File file) { try { - manager.saveAll(defaultFile).saveFile(defaultFile); - } catch (final Exception e) { + if (!file.exists()) { + file.getParentFile().mkdirs(); + file.createNewFile(); + } + YamlConfiguration yml = YamlConfiguration.loadConfiguration(file); + Set keys = yml.getKeys(true); + EnumSet all = EnumSet.allOf(C.class); + HashSet allNames = new HashSet<>(); + HashSet allCats = new HashSet<>(); + HashSet toRemove = new HashSet<>(); + for (C c: all) { + allNames.add(c.name()); + allCats.add(c.cat.toLowerCase()); + } + HashSet captions = new HashSet<>(); + boolean changed = false; + for (String key : keys) { + if (!yml.isString(key)) { + if (!allCats.contains(key)) { + toRemove.add(key); + } + continue; + } + String[] split = key.split("\\."); + String node = split[split.length - 1].toUpperCase(); + C caption = allNames.contains(node) ? valueOf(node) : null; + if (caption != null) { + String value = yml.getString(key); + if (!split[0].equalsIgnoreCase(caption.cat)) { + changed = true; + yml.set(key, null); + yml.set(caption.cat + "." + caption.name().toLowerCase(), value); + } + captions.add(caption); + caption.s = value; + } + else { + toRemove.add(key); + } + } + for (String remove : toRemove) { + changed = true; + yml.set(remove, null); + } + ConfigurationSection config = PS.get().style.getConfigurationSection("color"); + Set styles = config.getKeys(false); + HashMap replacements = new HashMap<>(); + for (String style : styles) { + replacements.put("$" + style, "\u00a7" + config.getString(style)); + } + for (int i = 0; i < 10; i++) { + replacements.put("&" + i, "\u00a7" + i); + } + for (char letter : "abcdefklmnor".toCharArray()) { + replacements.put("&" + letter, "\u00a7" + letter); + } + replacements.put("\\\\n", "\n"); + for (C caption : all) { + if (!captions.contains(caption)) { + changed = true; + yml.set(caption.cat + "." + caption.name().toLowerCase(), caption.d); + } + caption.s = StringMan.replaceFromMap(caption.s, replacements); + } + if (changed) { + yml.save(file); + } + } + catch (Exception e) { e.printStackTrace(); } } - - /** - * Get the default string - * - * @return default - */ - public String d() { - return this.d; - } - - /** - * Get translated if exists - * - * @return translated if exists else default - */ + public String s() { - final String s = manager.getTranslated(toString(), lang).getTranslated().replaceAll("&-", "\n").replaceAll("\\n", "\n"); - return s.replace("$1", COLOR_1.toString()).replace("$2", COLOR_2.toString()).replace("$3", COLOR_3.toString()).replace("$4", COLOR_4.toString()); + return this.s; } public boolean usePrefix() { @@ -613,8 +640,4 @@ public enum C { public String getCat() { return cat; } - - public void setCat(String cat) { - this.cat = cat; - } } diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java index 0f8a95abb..13e04a0ed 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Configuration.java @@ -21,7 +21,6 @@ package com.intellectualcrafters.plot.config; import java.util.ArrayList; -import java.util.List; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.util.BlockManager; @@ -34,6 +33,7 @@ import com.intellectualcrafters.plot.util.StringComparison; */ @SuppressWarnings("unused") public class Configuration { + public static final SettingValue STRING = new SettingValue("STRING") { @Override public boolean validateValue(final String string) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index e20e59ccc..07ef19a11 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -20,19 +20,40 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.database; +import java.sql.Connection; +import java.sql.DatabaseMetaData; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Timestamp; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Set; +import java.util.UUID; + +import org.apache.commons.lang.StringUtils; +import org.bukkit.block.Biome; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.BlockLoc; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotClusterId; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotSettings; +import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.comment.PlotComment; import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.TaskManager; -import org.apache.commons.lang.StringUtils; -import org.bukkit.block.Biome; - -import java.sql.*; -import java.util.*; /** * @author Citymonstret diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java index 48d56d531..d521efa00 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLite.java @@ -20,11 +20,15 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.database; -import com.intellectualcrafters.plot.PS; - import java.io.File; import java.io.IOException; -import java.sql.*; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; + +import com.intellectualcrafters.plot.PS; /** * Connects to and uses a SQLite database diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/APlotMeConnector.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/APlotMeConnector.java index 4a14e80b1..ca6a9df9a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/APlotMeConnector.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/APlotMeConnector.java @@ -5,7 +5,6 @@ import java.sql.SQLException; import java.util.HashMap; import com.intellectualcrafters.configuration.file.FileConfiguration; - import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java index 66992ce4b..f6390e410 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/ClassicPlotMeConnector.java @@ -1,5 +1,19 @@ package com.intellectualcrafters.plot.database.plotme; +import java.io.File; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.World; + +import com.intellectualcrafters.configuration.file.FileConfiguration; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.SQLite; @@ -9,16 +23,6 @@ import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.bukkit.Bukkit; -import org.bukkit.World; -import com.intellectualcrafters.configuration.file.FileConfiguration; - -import java.io.File; -import java.sql.*; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.UUID; public class ClassicPlotMeConnector extends APlotMeConnector { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java index 38f3351c2..870bbaacb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/plotme/LikePlotMeConverter.java @@ -20,19 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.database.plotme; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.generator.HybridGen; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotId; -import com.intellectualcrafters.plot.util.TaskManager; -import org.bukkit.Bukkit; -import org.bukkit.World; -import org.bukkit.WorldCreator; -import com.intellectualcrafters.configuration.file.FileConfiguration; -import com.intellectualcrafters.configuration.file.YamlConfiguration; - import java.io.File; import java.io.IOException; import java.nio.charset.Charset; @@ -47,6 +34,20 @@ import java.util.HashMap; import java.util.Map.Entry; import java.util.Set; +import org.bukkit.Bukkit; +import org.bukkit.World; +import org.bukkit.WorldCreator; + +import com.intellectualcrafters.configuration.file.FileConfiguration; +import com.intellectualcrafters.configuration.file.YamlConfiguration; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.generator.HybridGen; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.util.TaskManager; + /** * Created 2014-08-17 for PlotSquared * diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/ClusterFlagRemoveEvent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/ClusterFlagRemoveEvent.java index a8ac60977..85f1878f6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/ClusterFlagRemoveEvent.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/events/ClusterFlagRemoveEvent.java @@ -25,7 +25,6 @@ import org.bukkit.event.Event; import org.bukkit.event.HandlerList; import com.intellectualcrafters.plot.flag.Flag; -import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotCluster; /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java index d24b80558..d94d80c02 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java @@ -20,14 +20,23 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.flag; +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotSettings; +import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.util.EventUtil; -import java.util.*; - /** * Flag Manager Utility * diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java index a851fdfd3..1854834fb 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java @@ -1,7 +1,6 @@ package com.intellectualcrafters.plot.flag; import java.util.ArrayList; -import java.util.Arrays; import java.util.HashSet; import java.util.List; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java index cb9f62d74..67a29bdcf 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/AugmentedPopulator.java @@ -1,21 +1,30 @@ package com.intellectualcrafters.plot.generator; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.ChunkManager; -import com.intellectualcrafters.plot.util.TaskManager; -import com.intellectualcrafters.plot.util.bukkit.BukkitChunkManager; -import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map.Entry; +import java.util.Random; + import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.block.Biome; import org.bukkit.generator.BlockPopulator; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; -import java.util.Random; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.object.BlockWrapper; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotGenerator; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotLoc; +import com.intellectualcrafters.plot.object.PlotManager; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.RegionWrapper; +import com.intellectualcrafters.plot.util.ChunkManager; +import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitChunkManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitSetBlockManager; public class AugmentedPopulator extends BlockPopulator { public static short[][] x_loc; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java index 2247f1207..080be29ad 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/BukkitHybridUtils.java @@ -1,13 +1,11 @@ package com.intellectualcrafters.plot.generator; -import com.intellectualcrafters.plot.BukkitMain; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.ChunkManager; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.TaskManager; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Random; + import org.apache.commons.lang.mutable.MutableInt; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -21,7 +19,20 @@ import org.bukkit.material.Directional; import org.bukkit.material.MaterialData; import org.bukkit.plugin.Plugin; -import java.util.*; +import com.intellectualcrafters.plot.BukkitMain; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotAnalysis; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.RunnableVal; +import com.intellectualcrafters.plot.util.ChunkManager; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public class BukkitHybridUtils extends HybridUtils { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotWorld.java index bbbf76c69..72fa18284 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotWorld.java @@ -1,8 +1,8 @@ package com.intellectualcrafters.plot.generator; import org.apache.commons.lang.StringUtils; -import com.intellectualcrafters.configuration.ConfigurationSection; +import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.ConfigurationNode; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java index adc60ba13..844e23d2a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java @@ -20,14 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.generator; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.commands.Template; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.SetBlockQueue; -import com.intellectualcrafters.plot.util.TaskManager; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; - import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -35,6 +27,20 @@ import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.commands.Template; +import com.intellectualcrafters.plot.object.FileBytes; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotLoc; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.SetBlockQueue; +import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; + public class HybridPlotManager extends ClassicPlotManager { @Override diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java index 1c4726a7c..b5ae6be3d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java @@ -22,11 +22,10 @@ package com.intellectualcrafters.plot.generator; import java.util.HashMap; import java.util.HashSet; -import java.util.Map.Entry; import org.apache.commons.lang.StringUtils; -import com.intellectualcrafters.configuration.ConfigurationSection; +import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Configuration; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java index 1f2a79628..e43c193f1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java @@ -1,15 +1,20 @@ package com.intellectualcrafters.plot.generator; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.object.schematic.PlotItem; -import com.intellectualcrafters.plot.util.BlockManager; -import org.bukkit.World; -import org.bukkit.block.Biome; - import java.util.HashMap; import java.util.HashSet; +import org.bukkit.World; +import org.bukkit.block.Biome; + +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.object.PlotLoc; +import com.intellectualcrafters.plot.object.PlotPopulator; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.PseudoRandom; +import com.intellectualcrafters.plot.object.RegionWrapper; +import com.intellectualcrafters.plot.object.schematic.PlotItem; +import com.intellectualcrafters.plot.util.BlockManager; + /** * @author Citymonstret */ diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java index dbc24f149..b2f1ba61b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java @@ -1,16 +1,24 @@ package com.intellectualcrafters.plot.generator; +import java.io.File; +import java.util.HashMap; + import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotAnalysis; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotLoc; +import com.intellectualcrafters.plot.object.PlotManager; +import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.SchematicHandler; -import java.io.File; -import java.util.HashMap; - public abstract class HybridUtils { public static HybridUtils manager; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java index e4f157dc9..bb4fe2cf6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java @@ -1,7 +1,6 @@ package com.intellectualcrafters.plot.generator; import com.intellectualcrafters.configuration.ConfigurationSection; - import com.intellectualcrafters.plot.PS; public abstract class SquarePlotWorld extends GridPlotWorld { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ChunkListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ChunkListener.java index 9ec466bfe..66d1d28f7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ChunkListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/ChunkListener.java @@ -1,8 +1,5 @@ package com.intellectualcrafters.plot.listeners; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.util.TaskManager; import org.bukkit.Bukkit; import org.bukkit.Chunk; import org.bukkit.Material; @@ -20,6 +17,10 @@ import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkUnloadEvent; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.util.TaskManager; + public class ChunkListener implements Listener { private Chunk lastChunk = null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java index ec0f7e021..cf476c71e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents.java @@ -1,35 +1,77 @@ package com.intellectualcrafters.plot.listeners; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.flag.Flag; -import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.listeners.worldedit.WEManager; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.object.Location; -import com.intellectualcrafters.plot.util.*; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Set; +import java.util.UUID; + import org.apache.commons.lang.StringUtils; -import org.bukkit.*; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Chunk; +import org.bukkit.Material; +import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.BlockState; import org.bukkit.command.PluginCommand; -import org.bukkit.entity.*; +import org.bukkit.entity.Animals; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Creature; +import org.bukkit.entity.Entity; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.HumanEntity; +import org.bukkit.entity.ItemFrame; +import org.bukkit.entity.Monster; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Tameable; +import org.bukkit.entity.ThrownPotion; +import org.bukkit.entity.Vehicle; import org.bukkit.entity.minecart.RideableMinecart; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; -import org.bukkit.event.block.*; -import org.bukkit.event.entity.*; +import org.bukkit.event.block.Action; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.block.BlockFadeEvent; +import org.bukkit.event.block.BlockFormEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockGrowEvent; +import org.bukkit.event.block.BlockIgniteEvent; +import org.bukkit.event.block.BlockPhysicsEvent; +import org.bukkit.event.block.BlockPistonExtendEvent; +import org.bukkit.event.block.BlockPistonRetractEvent; +import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.block.BlockRedstoneEvent; +import org.bukkit.event.block.BlockSpreadEvent; +import org.bukkit.event.block.EntityBlockFormEvent; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntityChangeBlockEvent; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityExplodeEvent; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.hanging.HangingBreakByEntityEvent; import org.bukkit.event.hanging.HangingPlaceEvent; import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryCloseEvent; -import org.bukkit.event.player.*; +import org.bukkit.event.player.AsyncPlayerChatEvent; +import org.bukkit.event.player.PlayerBucketEmptyEvent; +import org.bukkit.event.player.PlayerBucketFillEvent; +import org.bukkit.event.player.PlayerChangedWorldEvent; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerEggThrowEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; import org.bukkit.event.vehicle.VehicleDestroyEvent; import org.bukkit.event.world.ChunkLoadEvent; @@ -41,7 +83,30 @@ import org.bukkit.projectiles.BlockProjectileSource; import org.bukkit.projectiles.ProjectileSource; import org.bukkit.util.Vector; -import java.util.*; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.flag.Flag; +import com.intellectualcrafters.plot.flag.FlagManager; +import com.intellectualcrafters.plot.listeners.worldedit.WEManager; +import com.intellectualcrafters.plot.object.BukkitPlayer; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.object.PlotHandler; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotInventory; +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.EventUtil; +import com.intellectualcrafters.plot.util.ExpireManager; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.TaskManager; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; /** * Player Events involving plots diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java index d702c1eee..c0cfe0066 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8.java @@ -1,13 +1,9 @@ package com.intellectualcrafters.plot.listeners; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.object.Location; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.object.PlotPlayer; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.Permissions; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; +import java.util.HashSet; +import java.util.List; +import java.util.UUID; + import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.entity.ArmorStand; @@ -24,9 +20,14 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.meta.ItemMeta; -import java.util.HashSet; -import java.util.List; -import java.util.UUID; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.Permissions; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public class PlayerEvents_1_8 extends PlotListener implements Listener { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8_3.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8_3.java index 275683da3..4561c6974 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8_3.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlayerEvents_1_8_3.java @@ -1,18 +1,19 @@ package com.intellectualcrafters.plot.listeners; +import java.util.Iterator; + +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.BlockExplodeEvent; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -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.BlockExplodeEvent; - -import java.util.Iterator; public class PlayerEvents_1_8_3 implements Listener { @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java index 51f459e74..b1f868104 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotListener.java @@ -20,6 +20,17 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.listeners; +import java.util.Arrays; +import java.util.UUID; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Effect; +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.WeatherType; +import org.bukkit.entity.Player; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -28,22 +39,12 @@ import com.intellectualcrafters.plot.events.PlayerLeavePlotEvent; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.BukkitPlayer; -import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.comment.CommentManager; import com.intellectualcrafters.plot.titles.AbstractTitle; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.TaskManager; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.bukkit.*; -import org.bukkit.entity.Player; - -import java.util.Arrays; -import java.util.UUID; - /** * @author Citymonstret * @author Empire92 diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java index 1ff7ab1b7..c20da95f6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/PlotPlusListener.java @@ -28,7 +28,6 @@ import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import org.bukkit.Effect; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.EntityType; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/TNTListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/TNTListener.java index f44825c09..20628bbab 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/TNTListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/TNTListener.java @@ -1,11 +1,7 @@ package com.intellectualcrafters.plot.listeners; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.flag.FlagManager; -import com.intellectualcrafters.plot.object.Location; -import com.intellectualcrafters.plot.object.Plot; -import com.intellectualcrafters.plot.util.MainUtil; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; +import java.util.List; + import org.bukkit.World; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; @@ -16,7 +12,12 @@ import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.util.Vector; -import java.util.List; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.flag.FlagManager; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.util.MainUtil; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; public class TNTListener implements Listener { private double lastRadius; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java index 4d9d49f23..43c9c694d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/WorldEvents.java @@ -1,8 +1,5 @@ package com.intellectualcrafters.plot.listeners; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.object.PlotGenerator; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; import org.bukkit.World; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -11,6 +8,10 @@ import org.bukkit.event.world.WorldInitEvent; import org.bukkit.event.world.WorldLoadEvent; import org.bukkit.generator.ChunkGenerator; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.object.PlotGenerator; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; + public class WorldEvents implements Listener { public static String lastWorld = null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java index bb30c109e..d88226c61 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEListener.java @@ -1,5 +1,16 @@ package com.intellectualcrafters.plot.listeners.worldedit; +import java.util.Arrays; +import java.util.HashSet; +import java.util.List; + +import org.bukkit.entity.Player; +import org.bukkit.event.Cancellable; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -11,16 +22,6 @@ import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.bukkit.selections.Selection; -import org.bukkit.entity.Player; -import org.bukkit.event.Cancellable; -import org.bukkit.event.EventHandler; -import org.bukkit.event.EventPriority; -import org.bukkit.event.Listener; -import org.bukkit.event.player.PlayerCommandPreprocessEvent; - -import java.util.Arrays; -import java.util.HashSet; -import java.util.List; public class WEListener implements Listener { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEManager.java index 1700c4e3b..2c4527157 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WEManager.java @@ -1,5 +1,8 @@ package com.intellectualcrafters.plot.listeners.worldedit; +import java.util.HashSet; +import java.util.UUID; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; @@ -8,9 +11,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.RegionWrapper; import com.intellectualcrafters.plot.util.MainUtil; -import java.util.HashSet; -import java.util.UUID; - public class WEManager { public static HashSet bypass = new HashSet<>(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java index 640b3d33a..e1819905e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/listeners/worldedit/WESubscriber.java @@ -1,5 +1,7 @@ package com.intellectualcrafters.plot.listeners.worldedit; +import java.util.HashSet; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; @@ -13,8 +15,6 @@ import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.util.eventbus.EventHandler.Priority; import com.sk89q.worldedit.util.eventbus.Subscribe; -import java.util.HashSet; - public class WESubscriber { @Subscribe(priority=Priority.VERY_EARLY) public void onEditSession(EditSessionEvent event) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java index dd520d0ba..f9d3836a6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -22,9 +22,7 @@ package com.intellectualcrafters.plot.object; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.HashSet; -import java.util.Set; import java.util.UUID; import com.intellectualcrafters.plot.PS; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java index fe51d1d6b..4f04fa52f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotGenerator.java @@ -20,20 +20,21 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.object; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.listeners.WorldEvents; -import com.intellectualcrafters.plot.util.ChunkManager; -import org.bukkit.World; -import org.bukkit.block.Biome; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.generator.ChunkGenerator; - import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; import java.util.Random; +import org.bukkit.World; +import org.bukkit.block.Biome; +import org.bukkit.generator.BlockPopulator; +import org.bukkit.generator.ChunkGenerator; + +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.listeners.WorldEvents; +import com.intellectualcrafters.plot.util.ChunkManager; + public abstract class PlotGenerator extends ChunkGenerator { public static short[][][] CACHE_I = null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java index 35bb3e3a8..98c172efe 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java @@ -23,7 +23,6 @@ package com.intellectualcrafters.plot.object; import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import java.util.Set; import java.util.UUID; import com.intellectualcrafters.plot.flag.Flag; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java index eee59475e..c542fc78b 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java @@ -20,6 +20,14 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.object; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Set; + +import org.apache.commons.lang.StringUtils; + +import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.ConfigurationNode; @@ -27,13 +35,6 @@ import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.util.EconHandler; -import org.apache.commons.lang.StringUtils; -import com.intellectualcrafters.configuration.ConfigurationSection; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Set; /** * @author Jesse Boyd diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java index 0d4918580..369f1a5ef 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java @@ -3,7 +3,6 @@ package com.intellectualcrafters.plot.util; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.schematic.PlotItem; -import com.intellectualcrafters.plot.util.StringComparison.ComparisonResult; public abstract class BlockManager { public static BlockManager manager; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java index 75a52771a..a38f9894c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java @@ -1,21 +1,31 @@ package com.intellectualcrafters.plot.util; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.generator.AugmentedPopulator; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.World; -import org.bukkit.generator.BlockPopulator; - import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; import java.util.Random; +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.World; +import org.bukkit.generator.BlockPopulator; + +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.generator.AugmentedPopulator; +import com.intellectualcrafters.plot.object.BlockLoc; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotClusterId; +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.bukkit.BukkitUtil; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; + public class ClusterManager { public static HashMap> clusters; public static PlotCluster last; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java index 0fef6f4bb..3b863e4f6 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java @@ -1,12 +1,16 @@ package com.intellectualcrafters.plot.util; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.flag.Flag; -import com.intellectualcrafters.plot.object.*; - import java.util.ArrayList; import java.util.UUID; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.flag.Flag; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotPlayer; + public abstract class EventUtil { public static EventUtil manager = null; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index 0e1adec49..175934846 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -1,21 +1,31 @@ package com.intellectualcrafters.plot.util; +import java.io.File; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; +import java.util.concurrent.ConcurrentHashMap; + +import org.bukkit.Bukkit; +import org.bukkit.OfflinePlayer; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.generator.ClassicPlotManager; import com.intellectualcrafters.plot.generator.HybridUtils; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.OfflinePlotPlayer; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotHandler; +import com.intellectualcrafters.plot.object.PlotManager; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.bukkit.Bukkit; -import org.bukkit.OfflinePlayer; - -import java.io.File; -import java.util.*; -import java.util.concurrent.ConcurrentHashMap; public class ExpireManager { public static ConcurrentHashMap> expiredPlots = new ConcurrentHashMap<>(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 8fe23d0d4..c47c37dec 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -20,20 +20,31 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.util; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.C; -import com.intellectualcrafters.plot.config.Settings; -import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.object.*; -import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; -import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; - import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Map.Entry; import java.util.UUID; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.C; +import com.intellectualcrafters.plot.config.Settings; +import com.intellectualcrafters.plot.database.DBFunc; +import com.intellectualcrafters.plot.object.BlockLoc; +import com.intellectualcrafters.plot.object.ChunkLoc; +import com.intellectualcrafters.plot.object.Location; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotBlock; +import com.intellectualcrafters.plot.object.PlotCluster; +import com.intellectualcrafters.plot.object.PlotId; +import com.intellectualcrafters.plot.object.PlotManager; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.PlotSettings; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.PseudoRandom; +import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; +import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; + /** * plot functions * diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index 8e2202a7c..eaf8a75d1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -1,6 +1,30 @@ package com.intellectualcrafters.plot.util; -import com.intellectualcrafters.jnbt.*; +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.ArrayList; +import java.util.Collection; +import java.util.HashSet; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.zip.GZIPInputStream; +import java.util.zip.GZIPOutputStream; + +import org.bukkit.Bukkit; + +import com.intellectualcrafters.jnbt.ByteArrayTag; +import com.intellectualcrafters.jnbt.CompoundTag; +import com.intellectualcrafters.jnbt.IntTag; +import com.intellectualcrafters.jnbt.ListTag; +import com.intellectualcrafters.jnbt.NBTInputStream; +import com.intellectualcrafters.jnbt.NBTOutputStream; +import com.intellectualcrafters.jnbt.ShortTag; +import com.intellectualcrafters.jnbt.Tag; import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.object.Location; @@ -10,12 +34,6 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem; import com.intellectualcrafters.plot.object.schematic.StateWrapper; import com.intellectualcrafters.plot.util.bukkit.BukkitUtil; import com.intellectualcrafters.plot.util.bukkit.UUIDHandler; -import org.bukkit.Bukkit; - -import java.io.*; -import java.util.*; -import java.util.zip.GZIPInputStream; -import java.util.zip.GZIPOutputStream; public abstract class SchematicHandler { public static SchematicHandler manager = new BukkitSchematicHandler(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java index b32c33b2c..c1d92eaee 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java @@ -1,14 +1,14 @@ package com.intellectualcrafters.plot.util; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map.Entry; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.generator.AugmentedPopulator; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.PlotBlock; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map.Entry; - public class SetBlockQueue { private volatile static HashMap blocks; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringMan.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringMan.java new file mode 100644 index 000000000..0fb8e3eea --- /dev/null +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/StringMan.java @@ -0,0 +1,23 @@ +package com.intellectualcrafters.plot.util; + +import java.util.Map; +import java.util.Map.Entry; + +public class StringMan { + public static String replaceFromMap(String string, Map replacements) { + StringBuilder sb = new StringBuilder(string); + for (Entry entry : replacements.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + + int start = sb.indexOf(key, 0); + while (start > -1) { + int end = start + key.length(); + int nextSearchStart = start + value.length(); + sb.replace(start, end, value); + start = sb.indexOf(key, nextSearchStart); + } + } + return sb.toString(); + } +} diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java index 5da807073..f4274bc95 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java @@ -1,11 +1,12 @@ package com.intellectualcrafters.plot.util; -import com.intellectualcrafters.plot.PS; -import org.apache.commons.lang.mutable.MutableInt; - import java.util.HashMap; import java.util.HashSet; +import org.apache.commons.lang.mutable.MutableInt; + +import com.intellectualcrafters.plot.PS; + public abstract class TaskManager { public static HashSet TELEPORT_QUEUE = new HashSet<>(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/WorldEditSchematic.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/WorldEditSchematic.java index 407923596..52d030952 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/WorldEditSchematic.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/WorldEditSchematic.java @@ -1,5 +1,9 @@ package com.intellectualcrafters.plot.util; +import java.io.File; + +import org.bukkit.Bukkit; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.PlotId; @@ -7,9 +11,6 @@ import com.sk89q.worldedit.CuboidClipboard; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.bukkit.BukkitWorld; -import org.bukkit.Bukkit; - -import java.io.File; public class WorldEditSchematic { public void saveSchematic(String file, final String world, final PlotId id) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitInventoryUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitInventoryUtil.java index 313e7a6c4..9d9a16f8e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitInventoryUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitInventoryUtil.java @@ -12,9 +12,9 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.PlayerInventory; import org.bukkit.inventory.meta.ItemMeta; +import com.intellectualcrafters.plot.object.BukkitPlayer; import com.intellectualcrafters.plot.object.PlotInventory; import com.intellectualcrafters.plot.object.PlotItemStack; -import com.intellectualcrafters.plot.object.BukkitPlayer; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.InventoryUtil; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java index c9bd8f08a..f284d7117 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitPlayerFunctions.java @@ -20,17 +20,18 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// package com.intellectualcrafters.plot.util.bukkit; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.Set; +import java.util.UUID; + +import org.bukkit.entity.Player; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.util.MainUtil; -import org.bukkit.entity.Player; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Set; -import java.util.UUID; /** * Functions involving players, plots and locations. diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java index 659b93e4e..af5ff6405 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitSetupUtils.java @@ -1,11 +1,8 @@ package com.intellectualcrafters.plot.util.bukkit; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.config.ConfigurationNode; -import com.intellectualcrafters.plot.object.PlotGenerator; -import com.intellectualcrafters.plot.object.PlotWorld; -import com.intellectualcrafters.plot.object.SetupObject; -import com.intellectualcrafters.plot.util.SetupUtils; +import java.io.IOException; +import java.util.Map.Entry; + import org.bukkit.Bukkit; import org.bukkit.World; import org.bukkit.World.Environment; @@ -13,8 +10,12 @@ import org.bukkit.WorldCreator; import org.bukkit.generator.ChunkGenerator; import org.bukkit.plugin.Plugin; -import java.io.IOException; -import java.util.Map.Entry; +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.config.ConfigurationNode; +import com.intellectualcrafters.plot.object.PlotGenerator; +import com.intellectualcrafters.plot.object.PlotWorld; +import com.intellectualcrafters.plot.object.SetupObject; +import com.intellectualcrafters.plot.util.SetupUtils; public class BukkitSetupUtils extends SetupUtils { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java index ffc66847e..8499ef658 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/BukkitUtil.java @@ -34,7 +34,6 @@ import com.intellectualcrafters.plot.object.schematic.PlotItem; import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.StringComparison; -import com.intellectualcrafters.plot.util.StringComparison.ComparisonResult; public class BukkitUtil extends BlockManager { private static HashMap worlds = new HashMap<>(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/Metrics.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/Metrics.java index b12e6be97..4384bb113 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/Metrics.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/Metrics.java @@ -42,13 +42,13 @@ import java.util.logging.Level; import java.util.zip.GZIPOutputStream; import org.bukkit.Bukkit; -import com.intellectualcrafters.configuration.InvalidConfigurationException; -import com.intellectualcrafters.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.scheduler.BukkitTask; +import com.intellectualcrafters.configuration.InvalidConfigurationException; +import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.plot.PS; public class Metrics { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SendChunk.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SendChunk.java index 608adc14a..e5d8c64ce 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SendChunk.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SendChunk.java @@ -1,20 +1,21 @@ package com.intellectualcrafters.plot.util.bukkit; +import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +import org.bukkit.Bukkit; +import org.bukkit.Chunk; +import org.bukkit.World; + import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass; import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor; import com.intellectualcrafters.plot.util.ReflectionUtils.RefField; import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod; -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.World; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; /** * An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java index f9a7fd52e..9dfceaee1 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetBlockFast.java @@ -26,7 +26,6 @@ import java.util.Collection; import java.util.HashMap; import org.bukkit.Chunk; -import org.bukkit.block.Block; import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.util.MainUtil; diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetGenCB.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetGenCB.java index aef83ef03..926df2117 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetGenCB.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/SetGenCB.java @@ -1,17 +1,18 @@ package com.intellectualcrafters.plot.util.bukkit; -import com.intellectualcrafters.plot.PS; -import com.intellectualcrafters.plot.generator.AugmentedPopulator; -import com.intellectualcrafters.plot.util.SetupUtils; -import org.bukkit.World; -import org.bukkit.generator.BlockPopulator; -import org.bukkit.generator.ChunkGenerator; - import java.lang.reflect.Constructor; import java.lang.reflect.Field; import java.util.ArrayList; import java.util.Iterator; +import org.bukkit.World; +import org.bukkit.generator.BlockPopulator; +import org.bukkit.generator.ChunkGenerator; + +import com.intellectualcrafters.plot.PS; +import com.intellectualcrafters.plot.generator.AugmentedPopulator; +import com.intellectualcrafters.plot.util.SetupUtils; + public class SetGenCB { public static void setGenerator(World world) throws Exception { SetupUtils.manager.updateGenerators(); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java index 272e096c5..537caf451 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/UUIDHandler.java @@ -1,5 +1,15 @@ package com.intellectualcrafters.plot.util.bukkit; +import java.io.File; +import java.io.FileInputStream; +import java.io.FilenameFilter; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map.Entry; +import java.util.UUID; + +import org.bukkit.Bukkit; + import com.google.common.collect.BiMap; import com.google.common.collect.HashBiMap; import com.google.common.io.Files; @@ -8,7 +18,11 @@ import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; -import com.intellectualcrafters.plot.object.*; +import com.intellectualcrafters.plot.object.BukkitOfflinePlayer; +import com.intellectualcrafters.plot.object.OfflinePlotPlayer; +import com.intellectualcrafters.plot.object.Plot; +import com.intellectualcrafters.plot.object.PlotPlayer; +import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.util.ExpireManager; import com.intellectualcrafters.plot.util.NbtFactory; import com.intellectualcrafters.plot.util.NbtFactory.NbtCompound; @@ -16,15 +30,6 @@ import com.intellectualcrafters.plot.util.NbtFactory.StreamOptions; import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper; import com.intellectualcrafters.plot.uuid.UUIDWrapper; -import org.bukkit.Bukkit; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FilenameFilter; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map.Entry; -import java.util.UUID; public class UUIDHandler { /** diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/FancyMessage.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/FancyMessage.java index b10e0ce4e..418eed32c 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/FancyMessage.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/FancyMessage.java @@ -24,8 +24,6 @@ import org.bukkit.Material; import org.bukkit.Statistic; import org.bukkit.Statistic.Type; import org.bukkit.command.CommandSender; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; @@ -35,6 +33,8 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import com.google.gson.stream.JsonWriter; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; /** * Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft JSON message formatter. diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/JsonString.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/JsonString.java index 5a6d6c26c..31986dd0e 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/JsonString.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/JsonString.java @@ -4,9 +4,8 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; - import com.google.gson.stream.JsonWriter; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; /** * Represents a JSON string value. diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/MessagePart.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/MessagePart.java index bb3f94c31..b87987248 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/MessagePart.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/MessagePart.java @@ -8,12 +8,12 @@ import java.util.logging.Level; import org.bukkit.Bukkit; import org.bukkit.ChatColor; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; import com.google.common.collect.BiMap; import com.google.common.collect.ImmutableBiMap; import com.google.gson.stream.JsonWriter; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; /** * Internal class: Represents a component of a JSON-serializable {@link FancyMessage}. diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/TextualComponent.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/TextualComponent.java index a57cab317..76ac5bd2d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/TextualComponent.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/bukkit/chat/TextualComponent.java @@ -4,12 +4,11 @@ import java.io.IOException; import java.util.HashMap; import java.util.Map; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; -import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; - import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.gson.stream.JsonWriter; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; +import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; /** * Represents a textual component of a message part. diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/Translation.java b/PlotSquared/src/main/java/com/intellectualsites/translation/Translation.java deleted file mode 100644 index 6476cd624..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/Translation.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.intellectualsites.translation; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Translation annotation - * - * @author Citymonstret - */ -@Retention(RetentionPolicy.RUNTIME) -@Target(ElementType.FIELD) -public @interface Translation { - String description() default ""; - - String creationDescription() default ""; -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationAsset.java b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationAsset.java deleted file mode 100644 index 62ef22d96..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationAsset.java +++ /dev/null @@ -1,30 +0,0 @@ -package com.intellectualsites.translation; - -/** - * Asset - * - * @author Citymonstret - */ -public class TranslationAsset { - private final TranslationObject trans; - private final String translated; - private final TranslationLanguage lang; - - public TranslationAsset(final TranslationObject trans, final String translated, final TranslationLanguage lang) { - this.trans = trans; - this.translated = translated; - this.lang = lang; - } - - public TranslationObject getObject() { - return this.trans; - } - - public String getTranslated() { - return this.translated.replace("\n", "&-"); - } - - public TranslationLanguage getLang() { - return this.lang; - } -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationFile.java b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationFile.java deleted file mode 100644 index 5ee23690a..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationFile.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.intellectualsites.translation; - -/** - * Abstract TranslationFile - * - * @author Citymonstret - */ -public abstract class TranslationFile { - /** - * A method used to get the language of the file - * - * @return language - */ - public abstract TranslationLanguage getLanguage(); - - /** - * Save the file - */ - public abstract void saveFile(); - - /** - * Read from the file - * - * @return instance - */ - public abstract TranslationFile read(); - - /** - * Add a value - * - * @param key name - * @param value value - */ - public abstract void add(String key, String value); -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationLanguage.java b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationLanguage.java deleted file mode 100644 index f02033f7e..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationLanguage.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.intellectualsites.translation; - -public class TranslationLanguage { - public static final TranslationLanguage englishAmerican = (new TranslationLanguage("American English", "us", "en")); - public static final TranslationLanguage englishBritish = (new TranslationLanguage("British English", "gb", "en")); - public static final TranslationLanguage swedishSwedish = (new TranslationLanguage("Swedish", "sv", "se")); - public static final TranslationLanguage russianRussian = (new TranslationLanguage("Russian", "ru", "ru")); - private final String countryCode; - private final String languageCode; - private final String friendlyName; - - public TranslationLanguage(final String friendlyName, final String countryCode, final String languageCode) { - this.friendlyName = friendlyName; - this.countryCode = countryCode; - this.languageCode = languageCode; - } - - public static TranslationLanguage[] values() { - return new TranslationLanguage[] { englishAmerican, englishBritish, swedishSwedish }; - } - - public String getName() { - return this.friendlyName; - } - - public String getCountryCode() { - return this.countryCode; - } - - public String getLanguageCode() { - return this.languageCode; - } - - @Override - public String toString() { - /* en_US */ - return this.languageCode.toLowerCase() + "_" + this.countryCode.toUpperCase(); - } -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationManager.java b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationManager.java deleted file mode 100644 index 16e9ca51f..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationManager.java +++ /dev/null @@ -1,190 +0,0 @@ -package com.intellectualsites.translation; - -import java.io.PrintStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.LinkedHashMap; -import java.util.LinkedList; -import java.util.List; - -/** - * Translation Manager Main class - * - * @author Citymonstret - */ -public class TranslationManager { - /** - * Objects - */ - private final LinkedList translationObjects; - /** - * The translations - */ - private final LinkedHashMap translatedObjects; - - /** - * Constructor - */ - public TranslationManager() { - this(new TranslationObject[] {}); - } - - /** - * Constructor - * - * @param translationObjects pre-init - */ - public TranslationManager(final TranslationObject[] translationObjects) { - this.translationObjects = new LinkedList(Arrays.asList(translationObjects)); - this.translatedObjects = new LinkedHashMap(); - } - - public static List transformEnum(final Object[] os) { - final List eList = new ArrayList(); - for (final Object o : os) { - eList.add(new TranslationObject(o.toString(), o.toString().toLowerCase().replace("_", " "), "", "")); - } - return eList; - } - - public static void scan(final Class c, final TranslationManager manager) throws IllegalAccessException { - final Field[] fields = c.getDeclaredFields(); - Annotation annotation; - for (final Field field : fields) { - if ((field.getType() != String.class) || ((annotation = field.getAnnotation(Translation.class)) == null)) { - continue; - } - final Translation t = (Translation) annotation; - final String key = field.getName(); - // Make sure we can get the value - field.setAccessible(true); - final String defaultValue = (String) field.get(c); - manager.addTranslationObject(new TranslationObject(key, defaultValue, t.description(), t.creationDescription())); - } - } - - /** - * Don't use this! - * - * @return this - */ - public TranslationManager instance() { - return this; - } - - /** - * Get the translation objects - * - * @return objects - */ - public List translations() { - return this.translationObjects; - } - - /** - * Add an object - * - * @param t object - * - * @return instance - */ - public TranslationManager addTranslationObject(final TranslationObject t) { - this.translationObjects.add(t); - return instance(); - } - - /** - * Remove an object - * - * @param t object - * - * @return instance - */ - public TranslationManager removeTranslationObject(final TranslationObject t) { - this.translationObjects.remove(t); - return instance(); - } - - public String getDescription(final String key) { - for (final TranslationObject o : translations()) { - if (o.getKey().equals(key) && !o.getDescription().equals("")) { - return "# " + o.getDescription(); - } - } - return ""; - } - - public TranslationManager addTranslation(final TranslationObject t, final TranslationAsset a) { - return addTranslation(t.getKey(), a); - } - - public TranslationManager addTranslation(final String key, final TranslationAsset a) { - String eKey = key + "." + a.getLang().toString(); - eKey = eKey.toLowerCase(); - if (this.translatedObjects.containsKey(eKey)) { - this.translatedObjects.remove(eKey); - } - this.translatedObjects.put(eKey, a); - return instance(); - } - - public TranslationAsset getTranslated(final String key, final String language) { - String eKey = key + "." + language; - eKey = eKey.toLowerCase(); - if (!this.translatedObjects.containsKey(eKey)) { - return new TranslationAsset(getDefault(key), getDefault(key).getKey(), TranslationLanguage.englishAmerican); - } - return this.translatedObjects.get(key); - } - - public TranslationAsset getTranslated(final String key, final TranslationLanguage language) { - String eKey = key + "." + language.toString(); - eKey = eKey.toLowerCase(); - if (!this.translatedObjects.containsKey(eKey)) { - return new TranslationAsset(getDefault(key), getDefault(key).getDefaultValue(), TranslationLanguage.englishAmerican); - } - return this.translatedObjects.get(eKey); - } - - public TranslationAsset getTranslated(final TranslationObject t, final TranslationLanguage l) { - return getTranslated(t.getKey(), l); - } - - public String getTranslation(final String key, final TranslationLanguage l) { - return getTranslated(key, l).getTranslated(); - } - - public TranslationObject getDefault(final String key) { - for (final TranslationObject o : translations()) { - if (o.getKey().equals(key.toLowerCase())) { - return o; - } - } - return null; - } - - public TranslationManager saveAll(final TranslationFile file) { - for (final TranslationObject object : translations()) { - final TranslationAsset o = getTranslated(object.getKey(), file.getLanguage()); - file.add(object.getKey(), o.getTranslated()); - } - return instance(); - } - - public TranslationManager debug(final PrintStream out) { - for (final TranslationObject object : translations()) { - out.println(object.getKey() + ":"); - for (final TranslationLanguage language : TranslationLanguage.values()) { - out.println(language.toString() + ": " + getTranslated(object.getKey(), language).getTranslated()); - } - } - return instance(); - } - - public TranslationManager saveFile(final TranslationFile file) { - file.saveFile(); - return instance(); - } -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java b/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java deleted file mode 100644 index 814d4aa6b..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/TranslationObject.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.intellectualsites.translation; - -public class TranslationObject { - // can include a suffix | not null - private final String key; - // The default ("no-translation" value) | not null - private final String defaultValue; - // ... "Join message" ... | can be null - private final String description; - // Like a plugin name for example | can be null - private final String creationDescription; - - public TranslationObject(final String key, final String defaultValue, String description, String creationDescription) { - if (description == null) { - description = ""; - } - if (creationDescription == null) { - creationDescription = ""; - } - for (final char c : key.toCharArray()) { - if (!Character.isDigit(c) && !Character.isAlphabetic(c) && (c != '_') && (c != '&') && (c != '\u00A7') && (c != ':')) { - throw new RuntimeException(String.format("Translation: '%s' is invalid (Character: '%s') - Only alphanumeric + (\\, _, &, ยง, :) charcters are allowed", key, c + "")); - } - } - this.key = key.toLowerCase(); - this.defaultValue = defaultValue.replace("\n", "&-"); - this.description = description; - this.creationDescription = creationDescription; - } - - public String getKey() { - return this.key; - } - - public String getDefaultValue() { - return this.defaultValue; - } - - public String getDescription() { - return this.description; - } - - public String getCreationDescription() { - return this.creationDescription; - } -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java b/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java deleted file mode 100644 index 245c0dd9f..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/YamlTranslationFile.java +++ /dev/null @@ -1,277 +0,0 @@ -package com.intellectualsites.translation; - -import java.io.File; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import com.intellectualcrafters.configuration.file.YamlConfiguration; -import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.Yaml; - -import com.intellectualcrafters.plot.config.C; - -/** - * The YAML implementation of TranslationFile Relies heavily on SnakeYAML - * - * @author Citymonstret - */ -public class YamlTranslationFile extends TranslationFile { - final private TranslationLanguage language; - final private String name; - final private TranslationManager manager; - private final File file; - private HashMap map; - private String[] header; - private boolean fancyHead = false; - private boolean isC = false; - private YamlTranslationFile instance; - /** - * YAML Object - */ - private Yaml yaml; - - /** - * Constructor - * - * @param path save path - * @param language translation language - * @param name project name - */ - public YamlTranslationFile(final File path, final TranslationLanguage language, final String name, final TranslationManager manager, final boolean isC) { - this.language = language; - this.name = name; - this.manager = manager; - this.isC = isC; - if (!path.exists()) { - if (!path.mkdirs()) { - throw new RuntimeException("Could not create: " + path.getAbsolutePath()); - } - } - this.file = new File(path + File.separator + name + "." + language.toString() + ".yml"); - if (!this.file.exists()) { - try { - if (!this.file.createNewFile()) { - throw new RuntimeException("Could not create: " + this.file.getName()); - } - } catch (final Exception e) { - e.printStackTrace(); - } - } - this.instance = this; - this.instance = this; - } - - /** - * Reload - */ - public void reload() { - this.map = new HashMap(); - this.read(); - } - - /** - * Set the header - * - * @param header Comment header - * - * @return instance - */ - public YamlTranslationFile header(final String... header) { - this.header = header; - this.fancyHead = false; - return this.instance; - } - - /** - * Set a fancy header - * - * @param header Comment header - * - * @return instance - */ - public YamlTranslationFile fancyHeader(final String... header) { - final String line = "################################################################################################"; - final int lineLength = line.length(); - final List strings = new ArrayList(); - strings.add(line + "\n"); - for (String s : header) { - s = "# " + s; - while (s.length() < (lineLength - 1)) { - s = s + " "; - } - s = s + "#\n"; - strings.add(s); - } - strings.add(line + "\n"); - this.header = strings.toArray(new String[strings.size()]); - this.fancyHead = true; - return this.instance; - } - - /** - * Add a translation - * - * @param key translation name - * @param value translation value - */ - @Override - public void add(final String key, final String value) { - if (this.map.containsKey(key)) { - return; - } - this.map.put(key, value); - } - - /** - * Get the translation language - * - * @return language - */ - @Override - public TranslationLanguage getLanguage() { - return this.language; - } - - /** - * Save the file - */ - @Override - public void saveFile() { - if (this.isC()) { - YamlConfiguration conf = YamlConfiguration.loadConfiguration(this.file); - for (String key : this.map.keySet()) { - try { - C c = C.valueOf(key.toUpperCase()); - conf.set("locale." + c.getCat() + "." + key, this.map.get(key)); - } - catch (IllegalArgumentException e) {} - conf.set(key, null); - } - try { - conf.save(this.file); - } catch (IOException e) { - e.printStackTrace(); - } - } else { - try { - if (!this.file.exists()) { - this.file.getParentFile().mkdirs(); - this.file.createNewFile(); - } - final FileWriter writer = new FileWriter(this.file); - // String s = getYaml().dump(map); - if ((this.header != null) && !this.fancyHead) { - for (final String head : this.header) { - writer.write("# " + head + "\n"); - } - } else if ((this.header != null) && this.fancyHead) { - for (final String head : this.header) { - writer.write(head); - } - } - final int length = this.map.size(); - int current = 0; - for (final Map.Entry entry : this.map.entrySet()) { - final String var = entry.getKey(); - final String val = entry.getValue(); - final String des = this.manager.getDescription(var); - if (des.equals("")) { - writer.write(var + ": \"" + val + "\"" + (current < (length - 1) ? "\n" : "")); - } else { - writer.write(des + "\n" + var + ": \"" + val + "\"" + (current < (length - 1) ? "\n" : "")); - } - ++current; - } - writer.close(); - } catch (final Exception e) { - e.printStackTrace(); - } - } - - } - - /** - * Get the YAML object - * - * @return yaml object with correct settings - */ - public Yaml getYaml() { - if (this.yaml == null) { - final DumperOptions options = new DumperOptions(); - options.setAllowUnicode(true); - options.setPrettyFlow(true); - options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - options.setDefaultScalarStyle(DumperOptions.ScalarStyle.DOUBLE_QUOTED); - this.yaml = new Yaml(options); - this.yaml.setName(this.name + "." + this.language.toString()); - } - return this.yaml; - } - - /** - * Read the file - * - * @return instance - */ - @Override - public YamlTranslationFile read() { - if (this.isC()) { - YamlConfiguration conf = YamlConfiguration.loadConfiguration(this.file); - if (conf.get("locale") == null) { - try { - this.map = (HashMap) this.getYaml().load(new FileReader(this.file)); - } catch (final Exception e) { - e.printStackTrace(); - } - if (this.map == null) { - this.map = new HashMap(); - } - for (final Map.Entry objects : this.map.entrySet()) { - final String key = objects.getKey(); - final String val = objects.getValue(); - this.manager.addTranslation(key, new TranslationAsset(null, val, this.language)); - } - this.saveFile(); - } else { - if (this.map == null) { - this.map = new HashMap(); - } - for (String label : conf.getConfigurationSection("locale").getKeys(false)) { - for (String key : conf.getConfigurationSection("locale." + label).getKeys(false)) { - String val = conf.getString("locale." + label + "." + key); - this.map.put(key, val); - this.manager.addTranslation(key, new TranslationAsset(null, val, this.language)); - } - } - } - } else { - try { - this.map = (HashMap) this.getYaml().load(new FileReader(this.file)); - } catch (final Exception e) { - e.printStackTrace(); - } - if (this.map == null) { - this.map = new HashMap(); - } - for (final Map.Entry objects : this.map.entrySet()) { - final String key = objects.getKey(); - final String val = objects.getValue(); - this.manager.addTranslation(key, new TranslationAsset(null, val, this.language)); - } - } - return this.instance; - } - - public boolean isC() { - return this.isC; - } - - public void setIsC(boolean isC) { - this.isC = isC; - } -} \ No newline at end of file diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java b/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java deleted file mode 100644 index c24db3e10..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/BukkitTranslation.java +++ /dev/null @@ -1,56 +0,0 @@ -package com.intellectualsites.translation.bukkit; - -import com.intellectualcrafters.plot.PS; -import com.intellectualsites.translation.TranslationAsset; -import com.intellectualsites.translation.TranslationLanguage; -import com.intellectualsites.translation.TranslationManager; -import com.intellectualsites.translation.TranslationObject; -import org.bukkit.Material; - -import java.io.File; - -/** - * @author Citymonstret - */ -public class BukkitTranslation { - /** - * Get the converted string - * - * @param asset asset - * - * @return converted asset - */ - public static String convert(final TranslationAsset asset) { - // In some cases newline can screw stuff up, so I added a new character - // thing - // &- = new line - return asset.getTranslated().replace("&-", "\n").replace('&', '\u00A7'); - } - - /** - * Get the universal parent based on the plugin data folder - * - * @return parent folder - */ - public static File getParent() { - return new File(PS.get().IMP.getDirectory() + File.separator + "translations"); - } - - /** - * Add material names to the translation list Will default to a somewhat friendly name - */ - public static void addMaterials(final TranslationManager manager) { - for (final Material material : Material.values()) { - manager.addTranslationObject(new TranslationObject(material.name(), material.name().replace("_", " ").toLowerCase(), "Material." + material.toString(), "")); - } - } - - /** - * The default translation language - * - * @return default translation language - */ - public TranslationLanguage getDefaultLanguage() { - return TranslationLanguage.englishAmerican; - } -} diff --git a/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/TranslationPlugin.java b/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/TranslationPlugin.java deleted file mode 100644 index a84518be9..000000000 --- a/PlotSquared/src/main/java/com/intellectualsites/translation/bukkit/TranslationPlugin.java +++ /dev/null @@ -1,43 +0,0 @@ -package com.intellectualsites.translation.bukkit; - -import java.util.logging.Level; - -import org.bukkit.plugin.java.JavaPlugin; - -import com.intellectualsites.translation.Translation; -import com.intellectualsites.translation.TranslationFile; -import com.intellectualsites.translation.TranslationLanguage; -import com.intellectualsites.translation.TranslationManager; -import com.intellectualsites.translation.YamlTranslationFile; - -public class TranslationPlugin extends JavaPlugin { - @Translation(description = "Printed when the translator is fully loaded") - private static final String TRANSLATOR_LOADED = "The translator has been loaded"; - @Translation(description = "Printed when the translator has been disabled") - private static final String TRANSLATOR_DISABLED = "The translator has been disabled"; - private static TranslationManager manager; - private TranslationFile english; - - @Override - public void onEnable() { - // Create a new manager - manager = new TranslationManager(); - // Scan this file for all @Translations - try { - TranslationManager.scan(TranslationPlugin.class, manager); - } catch (final Exception e) { - e.printStackTrace(); - } - // Now let's create some default files :D - this.english = new YamlTranslationFile(BukkitTranslation.getParent(), TranslationLanguage.englishAmerican, getName(), manager, true).read().header("Example file", "@author Citymonstret"); - // That created the file, read it, and made a default header - getLogger().log(Level.INFO, BukkitTranslation.convert(manager.getTranslated("translator_loaded", TranslationLanguage.englishAmerican))); - } - - @Override - public void onDisable() { - // Add all translations and save the file - manager.saveAll(this.english).saveFile(this.english); - getLogger().log(Level.INFO, BukkitTranslation.convert(manager.getTranslated("translator_disabled", TranslationLanguage.englishAmerican))); - } -}