From 871a601e374ce706d8bead021ef4a79de9d60cb8 Mon Sep 17 00:00:00 2001 From: "main()" Date: Sat, 3 Mar 2012 17:07:07 +0100 Subject: [PATCH] General cleanup. --- .../MultiverseCore/MultiverseCore.java | 10 ++++----- .../MultiverseCoreConfiguration.java | 22 +++++++++++++++++++ .../commands/ImportCommand.java | 2 +- .../MultiverseCore/commands/InfoCommand.java | 4 ++-- .../MultiverseCore/commands/PurgeCommand.java | 2 +- .../commands/TeleportCommand.java | 4 ---- .../MultiverseCore/commands/WhoCommand.java | 2 +- .../destination/DestinationFactory.java | 2 +- .../destination/WorldDestination.java | 2 +- .../event/MVConfigReloadEvent.java | 1 - .../listeners/MVEntityListener.java | 13 +++++------ .../listeners/MVPortalListener.java | 8 +++---- .../MultiverseCore/utils/FancyMessage.java | 2 ++ .../MultiverseCore/utils/MVMessaging.java | 8 +++---- .../MultiverseCore/utils/MVPermissions.java | 7 +++--- .../MultiverseCore/utils/PermissionTools.java | 2 +- .../utils/SimpleBlockSafety.java | 14 ++++++------ .../MultiverseCore/utils/WorldManager.java | 12 ---------- .../utils/webpaste/PastebinPasteService.java | 15 ------------- 19 files changed, 62 insertions(+), 70 deletions(-) diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java index 7436c0d9..2ad337c3 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCore.java @@ -70,7 +70,7 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { private AnchorManager anchorManager = new AnchorManager(this); // TODO please let's make this non-static - private static MultiverseCoreConfiguration config; + private MultiverseCoreConfiguration config; /** * This method is used to find out who is teleporting a player. @@ -489,13 +489,13 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { * @param msg The message to log. */ public static void staticLog(Level level, String msg) { - if (level == Level.FINE && config.getGlobalDebug() >= 1) { + if (level == Level.FINE && MultiverseCoreConfiguration.getInstance().getGlobalDebug() >= 1) { staticDebugLog(Level.INFO, msg); return; - } else if (level == Level.FINER && config.getGlobalDebug() >= 2) { + } else if (level == Level.FINER && MultiverseCoreConfiguration.getInstance().getGlobalDebug() >= 2) { staticDebugLog(Level.INFO, msg); return; - } else if (level == Level.FINEST && config.getGlobalDebug() >= 3) { + } else if (level == Level.FINEST && MultiverseCoreConfiguration.getInstance().getGlobalDebug() >= 3) { staticDebugLog(Level.INFO, msg); return; } else if (level != Level.FINE && level != Level.FINER && level != Level.FINEST) { @@ -864,6 +864,6 @@ public class MultiverseCore extends JavaPlugin implements MVPlugin, Core { */ @Deprecated public static MultiverseCoreConfiguration getStaticConfig() { - return config; + return MultiverseCoreConfiguration.getInstance(); } } diff --git a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java index 6446ba3d..25e95cfc 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java +++ b/src/main/java/com/onarandombox/MultiverseCore/MultiverseCoreConfiguration.java @@ -11,6 +11,26 @@ import me.main__.util.SerializationConfig.SerializationConfig; * Our configuration. */ public class MultiverseCoreConfiguration extends SerializationConfig implements MultiverseCoreConfig { + private static MultiverseCoreConfiguration instance; + + /** + * Sets the statically saved instance. + * @param instance The new instance. + */ + public static void setInstance(MultiverseCoreConfiguration instance) { + MultiverseCoreConfiguration.instance = instance; + } + + /** + * Gets the statically saved instance. + * @return The statically saved instance. + */ + public static MultiverseCoreConfiguration getInstance() { + if (instance == null) + throw new IllegalStateException("The instance wasn't set!"); + return instance; + } + @Property private boolean enforceaccess; @Property @@ -34,10 +54,12 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements public MultiverseCoreConfiguration() { super(); + MultiverseCoreConfiguration.setInstance(this); } public MultiverseCoreConfiguration(Map values) { super(values); + MultiverseCoreConfiguration.setInstance(this); } /** diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java index 187a93f6..e750cfde 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/ImportCommand.java @@ -52,7 +52,7 @@ public class ImportCommand extends MultiverseCommand { * @param worldFolder The File that may be a world. * @return True if it looks like a world, false if not. */ - private boolean checkIfIsWorld(File worldFolder) { + private static boolean checkIfIsWorld(File worldFolder) { if (worldFolder.isDirectory()) { File[] files = worldFolder.listFiles(new FilenameFilter() { @Override diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java index 7ff8e409..f9b5380d 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/InfoCommand.java @@ -190,7 +190,7 @@ public class InfoCommand extends MultiverseCommand { return worldInfo; } - private String toCommaSeperated(List list) { + private static String toCommaSeperated(List list) { if (list == null || list.size() == 0) { return ""; } @@ -216,7 +216,7 @@ public class InfoCommand extends MultiverseCommand { return positive ? ChatColor.GREEN : ChatColor.RED; } - private void showPage(int page, CommandSender sender, List> doc) { + private static void showPage(int page, CommandSender sender, List> doc) { page = page < 0 ? 0 : page; page = page > doc.size() - 1 ? doc.size() - 1 : page; boolean altColor = false; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java index 8112fd0f..8b7c4a26 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/PurgeCommand.java @@ -65,7 +65,7 @@ public class PurgeCommand extends MultiverseCommand { } if (!worldName.equalsIgnoreCase("all") && !this.worldManager.isMVWorld(worldName)) { - ((MultiverseCore) this.plugin).showNotMVWorldMessage(sender, worldName); + this.plugin.showNotMVWorldMessage(sender, worldName); sender.sendMessage("It cannot be purged."); return; } diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java index b20f7e73..7b0d9a92 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/TeleportCommand.java @@ -50,12 +50,8 @@ public class TeleportCommand extends MultiverseCommand { @Override public void runCommand(CommandSender sender, List args) { - // Check if the command was sent from a Player. CommandSender teleporter = sender; Player teleportee = null; - if (sender instanceof Player) { - teleporter = (Player) sender; - } String destinationName; diff --git a/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java b/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java index d633bb2c..93a960ba 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java +++ b/src/main/java/com/onarandombox/MultiverseCore/commands/WhoCommand.java @@ -90,7 +90,7 @@ public class WhoCommand extends MultiverseCommand { return; } - private String buildPlayerString(MultiverseWorld world) { + private static String buildPlayerString(MultiverseWorld world) { List players = world.getCBWorld().getPlayers(); if (players.size() == 0) { return "No players found."; diff --git a/src/main/java/com/onarandombox/MultiverseCore/destination/DestinationFactory.java b/src/main/java/com/onarandombox/MultiverseCore/destination/DestinationFactory.java index 4b5e5c48..2b80e153 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/destination/DestinationFactory.java +++ b/src/main/java/com/onarandombox/MultiverseCore/destination/DestinationFactory.java @@ -54,7 +54,7 @@ public class DestinationFactory { Class myClass = this.destList.get(idenChar); try { MVDestination mydest = myClass.newInstance(); - if (!mydest.isThisType((MultiverseCore) this.plugin, destination)) { + if (!mydest.isThisType(this.plugin, destination)) { return new InvalidDestination(); } mydest.setDestination(this.plugin, destination); diff --git a/src/main/java/com/onarandombox/MultiverseCore/destination/WorldDestination.java b/src/main/java/com/onarandombox/MultiverseCore/destination/WorldDestination.java index ef853256..6cbc0351 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/destination/WorldDestination.java +++ b/src/main/java/com/onarandombox/MultiverseCore/destination/WorldDestination.java @@ -70,7 +70,7 @@ public class WorldDestination implements MVDestination { return spawnLoc; } - private Location getAcurateSpawnLocation(Entity e, MultiverseWorld world) { + private static Location getAcurateSpawnLocation(Entity e, MultiverseWorld world) { if (world != null) { return world.getSpawnLocation(); } else { diff --git a/src/main/java/com/onarandombox/MultiverseCore/event/MVConfigReloadEvent.java b/src/main/java/com/onarandombox/MultiverseCore/event/MVConfigReloadEvent.java index a8acca07..bae3541b 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/event/MVConfigReloadEvent.java +++ b/src/main/java/com/onarandombox/MultiverseCore/event/MVConfigReloadEvent.java @@ -16,7 +16,6 @@ import java.util.List; * Called when the Multiverse-config should be reloaded. */ public class MVConfigReloadEvent extends Event { - private static final long serialVersionUID = 3647950355746345397L; private List configsLoaded; public MVConfigReloadEvent(List configsLoaded) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java index 25e17ed2..e4f060d9 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVEntityListener.java @@ -12,7 +12,7 @@ import com.onarandombox.MultiverseCore.api.MVWorldManager; import com.onarandombox.MultiverseCore.api.MultiverseWorld; import org.bukkit.World; import org.bukkit.entity.Animals; -import org.bukkit.entity.CreatureType; +import org.bukkit.entity.EntityType; import org.bukkit.entity.Ghast; import org.bukkit.entity.Monster; import org.bukkit.entity.Player; @@ -99,14 +99,13 @@ public class MVEntityListener implements Listener { if (!(this.worldManager.isMVWorld(world.getName()))) return; - CreatureType creature = event.getCreatureType(); - + EntityType type = event.getEntityType(); MultiverseWorld mvworld = this.worldManager.getMVWorld(world.getName()); /** * Handle people with non-standard animals: ie a patched craftbukkit. */ - if (creature == null) { + if (type == null) { this.plugin.log(Level.FINER, "Found a null typed creature."); return; } @@ -115,17 +114,17 @@ public class MVEntityListener implements Listener { * Animal Handling */ if (event.getEntity() instanceof Animals || event.getEntity() instanceof Squid) { - event.setCancelled(this.shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.canAnimalsSpawn(), creature.toString().toUpperCase())); + event.setCancelled(shouldWeKillThisCreature(mvworld.getAnimalList(), mvworld.canAnimalsSpawn(), type.getName().toUpperCase())); } /** * Monster Handling */ if (event.getEntity() instanceof Monster || event.getEntity() instanceof Ghast || event.getEntity() instanceof Slime) { - event.setCancelled(this.shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.canMonstersSpawn(), creature.toString().toUpperCase())); + event.setCancelled(shouldWeKillThisCreature(mvworld.getMonsterList(), mvworld.canMonstersSpawn(), type.getName().toUpperCase())); } } - private boolean shouldWeKillThisCreature(List creatureList, boolean allowCreatureSpawning, String creature) { + private static boolean shouldWeKillThisCreature(List creatureList, boolean allowCreatureSpawning, String creature) { if (creatureList.isEmpty() && allowCreatureSpawning) { // 1. There are no exceptions and animals are allowed. Save it. return false; diff --git a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalListener.java b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalListener.java index ae350c78..855e0728 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalListener.java +++ b/src/main/java/com/onarandombox/MultiverseCore/listeners/MVPortalListener.java @@ -41,7 +41,7 @@ public class MVPortalListener implements Listener { } MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getBlocks().get(0).getWorld()); // We have to do it like this due to a bug in 1.1-R3 - if (this.cancelPortalEvent(world, event.getPortalType())) { + if (cancelPortalEvent(world, event.getPortalType())) { event.setCancelled(true); } } @@ -59,7 +59,7 @@ public class MVPortalListener implements Listener { for (Block b : event.getBlocks()) { if (b.getType() == Material.PORTAL) { MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(b.getWorld()); - if (this.cancelPortalEvent(world, PortalType.NETHER)) { + if (cancelPortalEvent(world, PortalType.NETHER)) { event.setCancelled(true); return; } @@ -67,12 +67,12 @@ public class MVPortalListener implements Listener { } // If We're here, then the Portal was an Ender type: MultiverseWorld world = this.plugin.getMVWorldManager().getMVWorld(event.getBlocks().get(0).getWorld()); - if (this.cancelPortalEvent(world, PortalType.ENDER)) { + if (cancelPortalEvent(world, PortalType.ENDER)) { event.setCancelled(true); } } - private boolean cancelPortalEvent(MultiverseWorld world, PortalType type) { + private static boolean cancelPortalEvent(MultiverseWorld world, PortalType type) { if (world.getAllowedPortals() == AllowedPortalType.NONE) { return true; } else if (world.getAllowedPortals() != AllowedPortalType.ALL) { diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/FancyMessage.java b/src/main/java/com/onarandombox/MultiverseCore/utils/FancyMessage.java index 5239ef1f..e02c010e 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/FancyMessage.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/FancyMessage.java @@ -20,9 +20,11 @@ public class FancyMessage implements FancyText { /** * Allows easy creation of an alternating colored list. + * TODO: Documentation! Why does CheckStyle just ignore this? * * @param title * @param message + * @param scheme */ public FancyMessage(String title, String message, FancyColorScheme scheme) { this.title = title; diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/MVMessaging.java b/src/main/java/com/onarandombox/MultiverseCore/utils/MVMessaging.java index 45e73654..8363c12d 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/MVMessaging.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/MVMessaging.java @@ -51,17 +51,17 @@ public class MVMessaging implements MultiverseMessaging { public boolean sendMessages(CommandSender sender, String[] messages, boolean ignoreCooldown) { if (!(sender instanceof Player) || ignoreCooldown) { - this.sendMessages(sender, messages); + sendMessages(sender, messages); return true; } if (!this.sentList.containsKey(sender.getName())) { - this.sendMessages(sender, messages); + sendMessages(sender, messages); this.sentList.put(sender.getName(), System.currentTimeMillis()); return true; } else { long time = System.currentTimeMillis(); if (time >= this.sentList.get(sender.getName()) + this.cooldown) { - this.sendMessages(sender, messages); + sendMessages(sender, messages); this.sentList.put(sender.getName(), System.currentTimeMillis()); return true; } @@ -77,7 +77,7 @@ public class MVMessaging implements MultiverseMessaging { return this.sendMessages(sender, messages.toArray(new String[0]), ignoreCooldown); } - private void sendMessages(CommandSender sender, String[] messages) { + private static void sendMessages(CommandSender sender, String[] messages) { for (String s : messages) { sender.sendMessage(s); } diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java b/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java index e23d46e4..24d0043f 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/MVPermissions.java @@ -229,6 +229,7 @@ public class MVPermissions implements PermissionsInterface { * @param isOpRequired @Deprecated. This is not used for anything anymore. * @return True if they have that permission or any parent. */ + @Override public boolean hasPermission(CommandSender sender, String node, boolean isOpRequired) { if (!(sender instanceof Player)) { return true; @@ -268,6 +269,7 @@ public class MVPermissions implements PermissionsInterface { * @param node The permission node to check (possibly already a parent). * @return True if they have any parent perm, false if none. */ + // TODO remove this...? private boolean hasAnyParentPermission(CommandSender sender, String node) { String parentPerm = this.pullOneLevelOff(node); // Base case @@ -288,7 +290,7 @@ public class MVPermissions implements PermissionsInterface { * @param node The root node to check. * @return The parent of the node */ - private String pullOneLevelOff(String node) { + private static String pullOneLevelOff(String node) { if (node == null) { return null; } @@ -393,7 +395,7 @@ public class MVPermissions implements PermissionsInterface { /** * If the given permission was 'multiverse.core.tp.self', this would return 'multiverse.core.tp.*'. */ - private String getParentPerm(String[] seperated) { + private static String getParentPerm(String[] seperated) { if (seperated.length == 1) { return null; } @@ -403,5 +405,4 @@ public class MVPermissions implements PermissionsInterface { } return returnString + "*"; } - } diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java b/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java index bcb98377..1e404265 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/PermissionTools.java @@ -78,7 +78,7 @@ public class PermissionTools { * @param separatedPermissionString The array of a dot separated perm string. * @return The dot separated parent permission string. */ - private String getParentPerm(String[] separatedPermissionString) { + private static String getParentPerm(String[] separatedPermissionString) { if (separatedPermissionString.length == 1) { return null; } diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/SimpleBlockSafety.java b/src/main/java/com/onarandombox/MultiverseCore/utils/SimpleBlockSafety.java index e1ed80df..5b21aecf 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/SimpleBlockSafety.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/SimpleBlockSafety.java @@ -65,24 +65,24 @@ public class SimpleBlockSafety implements BlockSafety { upOne.setY(upOne.getY() + 1); downOne.setY(downOne.getY() - 1); - if (this.isSolidBlock(world.getBlockAt(actual).getType()) - || this.isSolidBlock(upOne.getBlock().getType())) { + if (isSolidBlock(world.getBlockAt(actual).getType()) + || isSolidBlock(upOne.getBlock().getType())) { MultiverseCore.staticLog(Level.FINER, "Error Here (Actual)? (" - + actual.getBlock().getType() + ")[" + this.isSolidBlock(actual.getBlock().getType()) + "]"); + + actual.getBlock().getType() + ")[" + isSolidBlock(actual.getBlock().getType()) + "]"); MultiverseCore.staticLog(Level.FINER, "Error Here (upOne)? (" - + upOne.getBlock().getType() + ")[" + this.isSolidBlock(upOne.getBlock().getType()) + "]"); + + upOne.getBlock().getType() + ")[" + isSolidBlock(upOne.getBlock().getType()) + "]"); return false; } if (downOne.getBlock().getType() == Material.LAVA || downOne.getBlock().getType() == Material.STATIONARY_LAVA) { MultiverseCore.staticLog(Level.FINER, "Error Here (downOne)? (" - + downOne.getBlock().getType() + ")[" + this.isSolidBlock(downOne.getBlock().getType()) + "]"); + + downOne.getBlock().getType() + ")[" + isSolidBlock(downOne.getBlock().getType()) + "]"); return false; } if (downOne.getBlock().getType() == Material.FIRE) { MultiverseCore.staticLog(Level.FINER, "There's fire below! (" - + actual.getBlock().getType() + ")[" + this.isSolidBlock(actual.getBlock().getType()) + "]"); + + actual.getBlock().getType() + ")[" + isSolidBlock(actual.getBlock().getType()) + "]"); return false; } @@ -129,7 +129,7 @@ public class SimpleBlockSafety implements BlockSafety { /* * If someone has a better way of this... Please either tell us, or submit a pull request! */ - private boolean isSolidBlock(Material type) { + private static boolean isSolidBlock(Material type) { switch (type) { case AIR: return false; diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java index 2262fd2f..388a694d 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/WorldManager.java @@ -155,18 +155,6 @@ public class WorldManager implements MVWorldManager { return true; } - /** - * Verifies that a given Plugin generator string exists. - * - * @param generator The name of the generator plugin. This should be something like CleanRoomGenerator. - * @return True if the plugin exists and is enabled, false if not. - */ - // TODO maybe remove this since it's unused? - private boolean pluginExists(String generator) { - Plugin myPlugin = this.plugin.getServer().getPluginManager().getPlugin(generator); - return myPlugin != null && myPlugin.isEnabled(); - } - /** * {@inheritDoc} */ diff --git a/src/main/java/com/onarandombox/MultiverseCore/utils/webpaste/PastebinPasteService.java b/src/main/java/com/onarandombox/MultiverseCore/utils/webpaste/PastebinPasteService.java index 2eb5221c..84e3acd5 100644 --- a/src/main/java/com/onarandombox/MultiverseCore/utils/webpaste/PastebinPasteService.java +++ b/src/main/java/com/onarandombox/MultiverseCore/utils/webpaste/PastebinPasteService.java @@ -8,7 +8,6 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.URLConnection; import java.net.URLEncoder; -import java.util.regex.Pattern; /** * Pastes to {@code pastebin.com}. @@ -75,18 +74,4 @@ public class PastebinPasteService implements PasteService { throw new PasteFailedException(e); } } - - // TODO maybe remove this? - private Pattern getURLMatchingPattern() { - if (this.isPrivate) { - return Pattern.compile(".*http://pastie.org/.*key=([0-9a-z]+).*"); - } else { - return Pattern.compile(".*http://pastie.org/([0-9]+).*"); - } - } - - // TODO maybe remove this? - private String formatURL(String pastieID) { - return "http://pastie.org/" + (this.isPrivate ? "private/" : "") + pastieID; - } }