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. */
|
/** Returns a message with all the possible variables replaced. */
|
||||||
public static String replaceAllVariables(Prisoner p, String msg) {
|
public static String replaceAllVariables(Prisoner p, String msg) {
|
||||||
msg = msg.replaceAll("%player%", p.getLastKnownName());
|
msg = msg.replaceAll("%player%", p.getLastKnownName());
|
||||||
msg = msg.replaceAll("%uuid%", p.getUUID().toString());
|
msg = msg.replaceAll("%uuid%", p.getUUID().toString());
|
||||||
msg = msg.replaceAll("%reason%", p.getReason());
|
msg = msg.replaceAll("%reason%", p.getReason());
|
||||||
msg = msg.replaceAll("%jailer", p.getJailer());
|
msg = msg.replaceAll("%jailer", p.getJailer());
|
||||||
msg = msg.replaceAll("%afktime%", TimeUnit.MILLISECONDS.toMinutes(p.getAFKTime()) + "m");
|
msg = msg.replaceAll("%afktime%", TimeUnit.MILLISECONDS.toMinutes(p.getAFKTime()) + " mins");
|
||||||
|
|
||||||
if(p.getRemainingTime() >= 0) {
|
if(p.getRemainingTime() >= 0) {
|
||||||
msg = msg.replaceAll("%timeinminutes%", String.valueOf(p.getRemainingTimeInMinutes()));
|
msg = msg.replaceAll("%timeinminutes%", String.valueOf(p.getRemainingTimeInMinutes()));
|
||||||
}else {
|
}else {
|
||||||
msg = msg.replaceAll("%timeinminutes%", Lang.JAILEDFOREVERSIGN.get());
|
msg = msg.replaceAll("%timeinminutes%", Lang.JAILEDFOREVERSIGN.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
return getColorfulMessage(msg);
|
return getColorfulMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the wand used throughout the different creation steps. */
|
/** 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;
|
import com.graywolf336.jail.events.PrisonerTransferredEvent;
|
||||||
|
|
||||||
public class CellSignListener implements Listener {
|
public class CellSignListener implements Listener {
|
||||||
private String lineOne, lineTwo, lineThree, lineFour;
|
private String lineOne, lineTwo, lineThree, lineFour;
|
||||||
|
|
||||||
public CellSignListener(JailMain plugin) {
|
public CellSignListener(JailMain plugin) {
|
||||||
List<String> lines = plugin.getConfig().getStringList(Settings.CELLSIGNLINES.getPath());
|
List<String> lines = plugin.getConfig().getStringList(Settings.CELLSIGNLINES.getPath());
|
||||||
lineOne = lines.get(0);
|
lineOne = lines.get(0);
|
||||||
lineTwo = lines.get(1);
|
lineTwo = lines.get(1);
|
||||||
lineThree = lines.get(2);
|
lineThree = lines.get(2);
|
||||||
lineFour = lines.get(3);
|
lineFour = lines.get(3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void changeTheCellSigns(PrisonerTimeChangeEvent event) {
|
public void changeTheCellSigns(PrisonerTimeChangeEvent event) {
|
||||||
if(event.hasCell() && event.getCell().hasSigns()) {
|
if (event.hasCell() && event.getCell().hasSigns()) {
|
||||||
HashSet<SimpleLocation> signs = event.getCell().getSigns();
|
HashSet<SimpleLocation> signs = event.getCell().getSigns();
|
||||||
String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne);
|
String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne);
|
||||||
String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo);
|
String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo);
|
||||||
String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree);
|
String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree);
|
||||||
String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour);
|
String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour);
|
||||||
|
|
||||||
for(SimpleLocation s : signs) {
|
for (SimpleLocation s : signs) {
|
||||||
if(s.getLocation().getBlock().getState() instanceof Sign) {
|
if (s.getLocation().getBlock().getState() instanceof Sign) {
|
||||||
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
||||||
sign.setLine(0, s1);
|
sign.setLine(0, s1);
|
||||||
sign.setLine(1, s2);
|
sign.setLine(1, s2);
|
||||||
sign.setLine(2, s3);
|
sign.setLine(2, s3);
|
||||||
sign.setLine(3, s4);
|
sign.setLine(3, s4);
|
||||||
sign.update();
|
sign.update();
|
||||||
}else {
|
} else {
|
||||||
//Remove the sign from the cell since it isn't
|
// Remove the sign from the cell since it isn't
|
||||||
//a valid sign
|
// a valid sign
|
||||||
event.getCell().getSigns().remove(s);
|
event.getCell().getSigns().remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void clearTheCellSigns(PrisonerReleasedEvent event) {
|
public void clearTheCellSigns(PrisonerReleasedEvent event) {
|
||||||
if(event.hasCell() && event.getCell().hasSigns()) {
|
if (event.hasCell() && event.getCell().hasSigns()) {
|
||||||
HashSet<SimpleLocation> signs = event.getCell().getSigns();
|
HashSet<SimpleLocation> signs = event.getCell().getSigns();
|
||||||
|
|
||||||
for(SimpleLocation s : signs) {
|
for (SimpleLocation s : signs) {
|
||||||
if(s.getLocation().getBlock().getState() instanceof Sign) {
|
if (s.getLocation().getBlock().getState() instanceof Sign) {
|
||||||
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
||||||
sign.setLine(0, "");
|
sign.setLine(0, "");
|
||||||
sign.setLine(1, Lang.CELLEMPTYSIGN.get());
|
sign.setLine(1, Lang.CELLEMPTYSIGN.get());
|
||||||
sign.setLine(2, "");
|
sign.setLine(2, "");
|
||||||
sign.setLine(3, "");
|
sign.setLine(3, "");
|
||||||
sign.update();
|
sign.update();
|
||||||
}else {
|
} else {
|
||||||
//Remove the sign from the cell since it isn't
|
// Remove the sign from the cell since it isn't
|
||||||
//a valid sign
|
// a valid sign
|
||||||
event.getCell().getSigns().remove(s);
|
event.getCell().getSigns().remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void handleSignsOnTransfer(PrisonerTransferredEvent event) {
|
public void handleSignsOnTransfer(PrisonerTransferredEvent event) {
|
||||||
if(event.hasOriginalCell() && event.getOriginalCell().hasSigns()) {
|
if (event.hasOriginalCell() && event.getOriginalCell().hasSigns()) {
|
||||||
HashSet<SimpleLocation> signs = event.getOriginalCell().getSigns();
|
HashSet<SimpleLocation> signs = event.getOriginalCell().getSigns();
|
||||||
|
|
||||||
for(SimpleLocation s : signs) {
|
for (SimpleLocation s : signs) {
|
||||||
if(s.getLocation().getBlock().getState() instanceof Sign) {
|
if (s.getLocation().getBlock().getState() instanceof Sign) {
|
||||||
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
||||||
sign.setLine(0, "");
|
sign.setLine(0, "");
|
||||||
sign.setLine(1, Lang.CELLEMPTYSIGN.get());
|
sign.setLine(1, Lang.CELLEMPTYSIGN.get());
|
||||||
sign.setLine(2, "");
|
sign.setLine(2, "");
|
||||||
sign.setLine(3, "");
|
sign.setLine(3, "");
|
||||||
sign.update();
|
sign.update();
|
||||||
}else {
|
} else {
|
||||||
//Remove the sign from the cell since it isn't
|
// Remove the sign from the cell since it isn't
|
||||||
//a valid sign
|
// a valid sign
|
||||||
event.getOriginalCell().getSigns().remove(s);
|
event.getOriginalCell().getSigns().remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.hasTargetCell() && event.getTargetCell().hasSigns()) {
|
if (event.hasTargetCell() && event.getTargetCell().hasSigns()) {
|
||||||
HashSet<SimpleLocation> signs = event.getTargetCell().getSigns();
|
HashSet<SimpleLocation> signs = event.getTargetCell().getSigns();
|
||||||
String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne);
|
String s1 = Util.replaceAllVariables(event.getPrisoner(), lineOne);
|
||||||
String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo);
|
String s2 = Util.replaceAllVariables(event.getPrisoner(), lineTwo);
|
||||||
String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree);
|
String s3 = Util.replaceAllVariables(event.getPrisoner(), lineThree);
|
||||||
String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour);
|
String s4 = Util.replaceAllVariables(event.getPrisoner(), lineFour);
|
||||||
|
|
||||||
for(SimpleLocation s : signs) {
|
for (SimpleLocation s : signs) {
|
||||||
if(s.getLocation().getBlock().getState() instanceof Sign) {
|
if (s.getLocation().getBlock().getState() instanceof Sign) {
|
||||||
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
Sign sign = (Sign) s.getLocation().getBlock().getState();
|
||||||
sign.setLine(0, s1);
|
sign.setLine(0, s1);
|
||||||
sign.setLine(1, s2);
|
sign.setLine(1, s2);
|
||||||
sign.setLine(2, s3);
|
sign.setLine(2, s3);
|
||||||
sign.setLine(3, s4);
|
sign.setLine(3, s4);
|
||||||
sign.update();
|
sign.update();
|
||||||
}else {
|
} else {
|
||||||
//Remove the sign from the cell since it isn't
|
// Remove the sign from the cell since it isn't
|
||||||
//a valid sign
|
// a valid sign
|
||||||
event.getTargetCell().getSigns().remove(s);
|
event.getTargetCell().getSigns().remove(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -98,11 +98,11 @@ public class CellCreationSteps {
|
|||||||
|
|
||||||
//Set the sign's first text
|
//Set the sign's first text
|
||||||
Sign sign = (Sign) block.getState();
|
Sign sign = (Sign) block.getState();
|
||||||
sign.setLine(0, "");
|
sign.setLine(0, "");
|
||||||
sign.setLine(1, Lang.CELLEMPTYSIGN.get());
|
sign.setLine(1, Lang.CELLEMPTYSIGN.get());
|
||||||
sign.setLine(2, "");
|
sign.setLine(2, "");
|
||||||
sign.setLine(3, "");
|
sign.setLine(3, "");
|
||||||
sign.update();
|
sign.update();
|
||||||
|
|
||||||
player.sendMessage(ChatColor.GREEN + "Sign added, if you want to select another go ahead otherwise right click on any non-sign block.");
|
player.sendMessage(ChatColor.GREEN + "Sign added, if you want to select another go ahead otherwise right click on any non-sign block.");
|
||||||
}else {
|
}else {
|
||||||
|
Loading…
Reference in New Issue
Block a user