Fix some spacing issues introduced by the last commit.
This commit is contained in:
parent
81da8ddb59
commit
85e1106b42
@ -99,19 +99,19 @@ public class Util {
|
||||
|
||||
/** 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");
|
||||
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());
|
||||
}
|
||||
if(p.getRemainingTime() >= 0) {
|
||||
msg = msg.replaceAll("%timeinminutes%", String.valueOf(p.getRemainingTimeInMinutes()));
|
||||
}else {
|
||||
msg = msg.replaceAll("%timeinminutes%", Lang.JAILEDFOREVERSIGN.get());
|
||||
}
|
||||
|
||||
return getColorfulMessage(msg);
|
||||
return getColorfulMessage(msg);
|
||||
}
|
||||
|
||||
/** Returns the wand used throughout the different creation steps. */
|
||||
|
@ -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;
|
||||
private String lineOne, lineTwo, lineThree, lineFour;
|
||||
|
||||
public CellSignListener(JailMain plugin) {
|
||||
List<String> lines = plugin.getConfig().getStringList(Settings.CELLSIGNLINES.getPath());
|
||||
lineOne = lines.get(0);
|
||||
lineTwo = lines.get(1);
|
||||
lineThree = lines.get(2);
|
||||
lineFour = lines.get(3);
|
||||
}
|
||||
public CellSignListener(JailMain plugin) {
|
||||
List<String> lines = plugin.getConfig().getStringList(Settings.CELLSIGNLINES.getPath());
|
||||
lineOne = lines.get(0);
|
||||
lineTwo = lines.get(1);
|
||||
lineThree = lines.get(2);
|
||||
lineFour = lines.get(3);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@EventHandler
|
||||
public void changeTheCellSigns(PrisonerTimeChangeEvent event) {
|
||||
if(event.hasCell() && event.getCell().hasSigns()) {
|
||||
HashSet<SimpleLocation> 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);
|
||||
if (event.hasCell() && event.getCell().hasSigns()) {
|
||||
HashSet<SimpleLocation> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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<SimpleLocation> signs = event.getCell().getSigns();
|
||||
@EventHandler
|
||||
public void clearTheCellSigns(PrisonerReleasedEvent event) {
|
||||
if (event.hasCell() && event.getCell().hasSigns()) {
|
||||
HashSet<SimpleLocation> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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<SimpleLocation> signs = event.getOriginalCell().getSigns();
|
||||
@EventHandler
|
||||
public void handleSignsOnTransfer(PrisonerTransferredEvent event) {
|
||||
if (event.hasOriginalCell() && event.getOriginalCell().hasSigns()) {
|
||||
HashSet<SimpleLocation> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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<SimpleLocation> 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);
|
||||
if (event.hasTargetCell() && event.getTargetCell().hasSigns()) {
|
||||
HashSet<SimpleLocation> 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -98,11 +98,11 @@ public class CellCreationSteps {
|
||||
|
||||
//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 {
|
||||
|
Loading…
Reference in New Issue
Block a user