From 19c1a356f7de46100ff9be1b0c7f8fcebab0f9a3 Mon Sep 17 00:00:00 2001 From: filoghost Date: Sun, 21 Dec 2014 15:15:06 +0100 Subject: [PATCH] Remove some google libs imports --- .../commands/main/subs/AlignCommand.java | 4 ++-- .../commands/main/subs/ReadimageCommand.java | 5 ++--- .../holographicdisplays/disk/Configuration.java | 12 ++++++------ .../holographicdisplays/util/ItemUtils.java | 3 +-- .../filoghost/holographicdisplays/util/Utils.java | 7 +++++-- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/AlignCommand.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/AlignCommand.java index 683a6130..1844ccf3 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/AlignCommand.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/AlignCommand.java @@ -24,7 +24,7 @@ public class AlignCommand extends HologramSubCommand { @Override public String getPossibleArguments() { - return " "; + return " "; } @Override @@ -58,7 +58,7 @@ public class AlignCommand extends HologramSubCommand { } hologram.teleport(loc.getWorld(), loc.getX(), loc.getY(), loc.getZ()); - hologram.despawnEntities(); + hologram.despawnEntities(); hologram.refreshAll(); HologramDatabase.saveHologram(hologram); diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java index b719aba3..10711668 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/commands/main/subs/ReadimageCommand.java @@ -9,8 +9,6 @@ import java.net.URL; import java.util.Arrays; import java.util.List; -import net.minecraft.util.com.google.common.collect.Lists; - import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; @@ -27,6 +25,7 @@ import com.gmail.filoghost.holographicdisplays.image.ImageMessage; import com.gmail.filoghost.holographicdisplays.object.NamedHologram; import com.gmail.filoghost.holographicdisplays.object.NamedHologramManager; import com.gmail.filoghost.holographicdisplays.util.FileUtils; +import com.gmail.filoghost.holographicdisplays.util.Utils; public class ReadimageCommand extends HologramSubCommand { @@ -52,7 +51,7 @@ public class ReadimageCommand extends HologramSubCommand { boolean append = false; - List newArgs = Lists.newArrayList(); + List newArgs = Utils.newList(); for (int i = 0; i < args.length; i++) { if (args[i].equalsIgnoreCase("-a") || args[i].equalsIgnoreCase("-append")) { diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/disk/Configuration.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/disk/Configuration.java index fbcd216e..07ba27f9 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/disk/Configuration.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/disk/Configuration.java @@ -12,7 +12,7 @@ import org.bukkit.configuration.InvalidConfigurationException; import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.plugin.Plugin; -import com.google.common.base.Joiner; +import com.gmail.filoghost.holographicdisplays.util.Utils; /** * Just a bunch of static varibles to hold the settings. @@ -89,13 +89,13 @@ public class Configuration { if (needsSave) { - config.options().header(Joiner.on('\n').join( + config.options().header(Utils.join(new String[] { ".", ". Read the tutorial at: http://dev.bukkit.org/bukkit-plugins/holographic-displays/", ".", ". Plugin created by filoghost.", - "." - )); + "."}, + "\n")); config.options().copyHeader(true); try { config.save(configFile); @@ -108,7 +108,7 @@ public class Configuration { spaceBetweenLines = config.getDouble(ConfigNode.SPACE_BETWEEN_LINES.getPath()); updateNotification = config.getBoolean(ConfigNode.UPDATE_NOTIFICATION.getPath()); - imageSymbol = StringConverter.toReadableFormat(config.getString(ConfigNode.IMAGES_SYMBOL.getPath())); + imageSymbol = StringConverter.toReadableFormat(config.getString(ConfigNode.IMAGES_SYMBOL.getPath())); transparencySymbol = StringConverter.toReadableFormat(config.getString(ConfigNode.TRANSPARENCY_SPACE.getPath())); bungeeRefreshSeconds = config.getInt(ConfigNode.BUNGEE_REFRESH_SECONDS.getPath()); useRedisBungee = config.getBoolean(ConfigNode.BUNGEE_USE_REDIS_BUNGEE.getPath()); @@ -145,5 +145,5 @@ public class Configuration { plugin.getLogger().warning("The maximum interval for pinging BungeeCord's servers is 60 seconds. It has been automatically set."); bungeeRefreshSeconds = 60; } - } + } } diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/ItemUtils.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/ItemUtils.java index 785951d2..d16c1d3b 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/ItemUtils.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/ItemUtils.java @@ -7,7 +7,6 @@ import java.util.regex.Pattern; import org.bukkit.ChatColor; import org.bukkit.Material; -import com.google.common.collect.Maps; public class ItemUtils { @@ -21,7 +20,7 @@ public class ItemUtils { static { // Default material names are ugly. - Map tempMap = Maps.newHashMap(); + Map tempMap = Utils.newMap(); tempMap.put("iron bar", Material.IRON_FENCE); tempMap.put("iron bars", Material.IRON_FENCE); diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/Utils.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/Utils.java index cead05f9..9daee09e 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/Utils.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/util/Utils.java @@ -75,8 +75,8 @@ public class Utils extends Object { public static String join(String[] elements, String separator, int startIndex, int endIndex) { - Validator.isTrue(startIndex > 0 && startIndex < elements.length, "startIndex out of bounds"); - Validator.isTrue(endIndex > 0 && endIndex <= elements.length, "endIndex out of bounds"); + Validator.isTrue(startIndex >= 0 && startIndex < elements.length, "startIndex out of bounds"); + Validator.isTrue(endIndex >= 0 && endIndex <= elements.length, "endIndex out of bounds"); Validator.isTrue(startIndex <= endIndex, "startIndex lower than endIndex"); StringBuilder result = new StringBuilder(); @@ -95,6 +95,9 @@ public class Utils extends Object { return result.toString(); } + public static String join(String[] elements, String separator) { + return join(elements, separator, 0, elements.length); + } public static String join(List elements, String separator, int startIndex, int size) { return join(elements.toArray(new String[elements.size()]), separator, startIndex, size);