From 85e1106b42acd24afce32d0701b9f955e6614765 Mon Sep 17 00:00:00 2001 From: graywolf336 Date: Tue, 19 Aug 2014 14:34:02 -0500 Subject: [PATCH] Fix some spacing issues introduced by the last commit. --- src/main/java/com/graywolf336/jail/Util.java | 28 +-- .../jail/listeners/CellSignListener.java | 202 +++++++++--------- .../jail/steps/CellCreationSteps.java | 14 +- 3 files changed, 122 insertions(+), 122 deletions(-) diff --git a/src/main/java/com/graywolf336/jail/Util.java b/src/main/java/com/graywolf336/jail/Util.java index 46028ad..12fd8c6 100644 --- a/src/main/java/com/graywolf336/jail/Util.java +++ b/src/main/java/com/graywolf336/jail/Util.java @@ -96,22 +96,22 @@ public class Util { public static String getColorfulMessage(String message) { return message.replaceAll("(?i)&([0-9abcdefklmnor])", "\u00A7$1"); } - + /** Returns a message with all the possible variables replaced. */ public static String replaceAllVariables(Prisoner p, String msg) { - msg = msg.replaceAll("%player%", p.getLastKnownName()); - msg = msg.replaceAll("%uuid%", p.getUUID().toString()); - msg = msg.replaceAll("%reason%", p.getReason()); - msg = msg.replaceAll("%jailer", p.getJailer()); - msg = msg.replaceAll("%afktime%", TimeUnit.MILLISECONDS.toMinutes(p.getAFKTime()) + "m"); - - if(p.getRemainingTime() >= 0) { - msg = msg.replaceAll("%timeinminutes%", String.valueOf(p.getRemainingTimeInMinutes())); - }else { - msg = msg.replaceAll("%timeinminutes%", Lang.JAILEDFOREVERSIGN.get()); - } - - return getColorfulMessage(msg); + msg = msg.replaceAll("%player%", p.getLastKnownName()); + msg = msg.replaceAll("%uuid%", p.getUUID().toString()); + msg = msg.replaceAll("%reason%", p.getReason()); + msg = msg.replaceAll("%jailer", p.getJailer()); + msg = msg.replaceAll("%afktime%", TimeUnit.MILLISECONDS.toMinutes(p.getAFKTime()) + " mins"); + + if(p.getRemainingTime() >= 0) { + msg = msg.replaceAll("%timeinminutes%", String.valueOf(p.getRemainingTimeInMinutes())); + }else { + msg = msg.replaceAll("%timeinminutes%", Lang.JAILEDFOREVERSIGN.get()); + } + + return getColorfulMessage(msg); } /** Returns the wand used throughout the different creation steps. */ diff --git a/src/main/java/com/graywolf336/jail/listeners/CellSignListener.java b/src/main/java/com/graywolf336/jail/listeners/CellSignListener.java index b164ced..8fea66c 100644 --- a/src/main/java/com/graywolf336/jail/listeners/CellSignListener.java +++ b/src/main/java/com/graywolf336/jail/listeners/CellSignListener.java @@ -17,106 +17,106 @@ import com.graywolf336.jail.events.PrisonerTimeChangeEvent; import com.graywolf336.jail.events.PrisonerTransferredEvent; public class CellSignListener implements Listener { - private String lineOne, lineTwo, lineThree, lineFour; - - public CellSignListener(JailMain plugin) { - List lines = plugin.getConfig().getStringList(Settings.CELLSIGNLINES.getPath()); - lineOne = lines.get(0); - lineTwo = lines.get(1); - lineThree = lines.get(2); - lineFour = lines.get(3); - } - - @EventHandler + private String lineOne, lineTwo, lineThree, lineFour; + + public CellSignListener(JailMain plugin) { + List lines = plugin.getConfig().getStringList(Settings.CELLSIGNLINES.getPath()); + lineOne = lines.get(0); + lineTwo = lines.get(1); + lineThree = lines.get(2); + lineFour = lines.get(3); + } + + @EventHandler public void changeTheCellSigns(PrisonerTimeChangeEvent event) { - if(event.hasCell() && event.getCell().hasSigns()) { - HashSet signs = event.getCell().getSigns(); - String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne); - String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo); - String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree); - String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour); - - for(SimpleLocation s : signs) { - if(s.getLocation().getBlock().getState() instanceof Sign) { - Sign sign = (Sign) s.getLocation().getBlock().getState(); - sign.setLine(0, s1); - sign.setLine(1, s2); - sign.setLine(2, s3); - sign.setLine(3, s4); - sign.update(); - }else { - //Remove the sign from the cell since it isn't - //a valid sign - event.getCell().getSigns().remove(s); - } - } - } - } - - @EventHandler - public void clearTheCellSigns(PrisonerReleasedEvent event) { - if(event.hasCell() && event.getCell().hasSigns()) { - HashSet signs = event.getCell().getSigns(); - - for(SimpleLocation s : signs) { - if(s.getLocation().getBlock().getState() instanceof Sign) { - Sign sign = (Sign) s.getLocation().getBlock().getState(); - sign.setLine(0, ""); - sign.setLine(1, Lang.CELLEMPTYSIGN.get()); - sign.setLine(2, ""); - sign.setLine(3, ""); - sign.update(); - }else { - //Remove the sign from the cell since it isn't - //a valid sign - event.getCell().getSigns().remove(s); - } - } - } - } - - @EventHandler - public void handleSignsOnTransfer(PrisonerTransferredEvent event) { - if(event.hasOriginalCell() && event.getOriginalCell().hasSigns()) { - HashSet signs = event.getOriginalCell().getSigns(); - - for(SimpleLocation s : signs) { - if(s.getLocation().getBlock().getState() instanceof Sign) { - Sign sign = (Sign) s.getLocation().getBlock().getState(); - sign.setLine(0, ""); - sign.setLine(1, Lang.CELLEMPTYSIGN.get()); - sign.setLine(2, ""); - sign.setLine(3, ""); - sign.update(); - }else { - //Remove the sign from the cell since it isn't - //a valid sign - event.getOriginalCell().getSigns().remove(s); - } - } - } - - if(event.hasTargetCell() && event.getTargetCell().hasSigns()) { - HashSet signs = event.getTargetCell().getSigns(); - String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne); - String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo); - String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree); - String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour); - - for(SimpleLocation s : signs) { - if(s.getLocation().getBlock().getState() instanceof Sign) { - Sign sign = (Sign) s.getLocation().getBlock().getState(); - sign.setLine(0, s1); - sign.setLine(1, s2); - sign.setLine(2, s3); - sign.setLine(3, s4); - sign.update(); - }else { - //Remove the sign from the cell since it isn't - //a valid sign - event.getTargetCell().getSigns().remove(s); - } - } - } - } + if (event.hasCell() && event.getCell().hasSigns()) { + HashSet signs = event.getCell().getSigns(); + String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne); + String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo); + String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree); + String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour); + + for (SimpleLocation s : signs) { + if (s.getLocation().getBlock().getState() instanceof Sign) { + Sign sign = (Sign) s.getLocation().getBlock().getState(); + sign.setLine(0, s1); + sign.setLine(1, s2); + sign.setLine(2, s3); + sign.setLine(3, s4); + sign.update(); + } else { + // Remove the sign from the cell since it isn't + // a valid sign + event.getCell().getSigns().remove(s); + } + } + } + } + + @EventHandler + public void clearTheCellSigns(PrisonerReleasedEvent event) { + if (event.hasCell() && event.getCell().hasSigns()) { + HashSet signs = event.getCell().getSigns(); + + for (SimpleLocation s : signs) { + if (s.getLocation().getBlock().getState() instanceof Sign) { + Sign sign = (Sign) s.getLocation().getBlock().getState(); + sign.setLine(0, ""); + sign.setLine(1, Lang.CELLEMPTYSIGN.get()); + sign.setLine(2, ""); + sign.setLine(3, ""); + sign.update(); + } else { + // Remove the sign from the cell since it isn't + // a valid sign + event.getCell().getSigns().remove(s); + } + } + } + } + + @EventHandler + public void handleSignsOnTransfer(PrisonerTransferredEvent event) { + if (event.hasOriginalCell() && event.getOriginalCell().hasSigns()) { + HashSet signs = event.getOriginalCell().getSigns(); + + for (SimpleLocation s : signs) { + if (s.getLocation().getBlock().getState() instanceof Sign) { + Sign sign = (Sign) s.getLocation().getBlock().getState(); + sign.setLine(0, ""); + sign.setLine(1, Lang.CELLEMPTYSIGN.get()); + sign.setLine(2, ""); + sign.setLine(3, ""); + sign.update(); + } else { + // Remove the sign from the cell since it isn't + // a valid sign + event.getOriginalCell().getSigns().remove(s); + } + } + } + + if (event.hasTargetCell() && event.getTargetCell().hasSigns()) { + HashSet signs = event.getTargetCell().getSigns(); + String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne); + String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo); + String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree); + String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour); + + for (SimpleLocation s : signs) { + if (s.getLocation().getBlock().getState() instanceof Sign) { + Sign sign = (Sign) s.getLocation().getBlock().getState(); + sign.setLine(0, s1); + sign.setLine(1, s2); + sign.setLine(2, s3); + sign.setLine(3, s4); + sign.update(); + } else { + // Remove the sign from the cell since it isn't + // a valid sign + event.getTargetCell().getSigns().remove(s); + } + } + } + } } diff --git a/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java b/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java index 6f60d6f..45b23f1 100644 --- a/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java +++ b/src/main/java/com/graywolf336/jail/steps/CellCreationSteps.java @@ -95,15 +95,15 @@ public class CellCreationSteps { private void secondStep(CreationPlayer cp, Player player, Block block) { if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN) { cp.addSign(new SimpleLocation(block.getLocation())); - + //Set the sign's first text Sign sign = (Sign) block.getState(); - sign.setLine(0, ""); - sign.setLine(1, Lang.CELLEMPTYSIGN.get()); - sign.setLine(2, ""); - sign.setLine(3, ""); - sign.update(); - + sign.setLine(0, ""); + sign.setLine(1, Lang.CELLEMPTYSIGN.get()); + sign.setLine(2, ""); + sign.setLine(3, ""); + sign.update(); + player.sendMessage(ChatColor.GREEN + "Sign added, if you want to select another go ahead otherwise right click on any non-sign block."); }else { player.sendMessage(ChatColor.AQUA + "---------- Jail Cell Creation (chest) ----------");