private static boolean checkToggleState(Sign sign) { String line3 = SignUtil.getTextRaw(sign, 2).toLowerCase(); String line4 = SignUtil.getTextRaw(sign, 3).toLowerCase(); return MARKER_PATTERN.matcher(line3).matches() || !("--".equals(line4) || MARKER_PATTERN.matcher(line4).matches()); }
public boolean isMechanicSign(Sign sign) { for(String text : getValidSigns()) if(SignUtil.getTextRaw(sign, 1).equals(text)) return true; return false; }
public static Location<World> parseBlockLocation(Sign sign, int lPos, LocationCheckType relative) { return parseBlockLocation(sign, SignUtil.getTextRaw(sign, lPos), relative); }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); if (SignUtil.getTextRaw(lines.get(2)).length() == 0) { throw new InvalidICException("A band must be supplied on the 3rd line!"); } wirelessData = new WirelessTransmitter.Factory.WirelessData(); wirelessData.shortband = SignUtil.getTextRaw(lines.get(2)); if (SignUtil.getTextRaw(lines.get(3)).length() == 0) { wirelessData.wideband = player.getUniqueId().toString(); } else { wirelessData.wideband = SignUtil.getTextRaw(lines.get(3)); } }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); if (SignUtil.getTextRaw(lines.get(2)).length() == 0) { throw new InvalidICException("A band must be supplied on the 3rd line!"); } wirelessData = new Factory.WirelessData(); wirelessData.shortband = SignUtil.getTextRaw(lines.get(2)); if (SignUtil.getTextRaw(lines.get(3)).length() == 0) { wirelessData.wideband = player.getUniqueId().toString(); } else { wirelessData.wideband = SignUtil.getTextRaw(lines.get(3)); } }
public static String getTextRaw(SignData sign, int line) { return getTextRaw(getText(sign, line)); }
public String getLine(int line) { return SignUtil.getTextRaw(getSign(), line); }
public static String getTextRaw(Sign sign, int line) { return getTextRaw(sign.get(SignData.class).get(), line); }
public static Vector3d parseRadius(Sign sign, int lPos) { return parseRadius(SignUtil.getTextRaw(sign, lPos)); }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); String showName = SignUtil.getTextRaw(lines.get(2)); if (showName.trim().isEmpty() || (!new File(fireworksFolder, showName.trim() + ".txt").exists() && !new File(fireworksFolder, showName.trim() + ".fwk").exists())) { throw new InvalidICException("Unknown firework show on line 3!"); } }
/** * Check if the given text matches the sign. * * @param text The given text * @return If it matches */ public boolean matches(String text) { return hasSign() && SignUtil.getTextRaw(sign.getTileEntity() .map(sign -> (Sign) sign).get(), 1).equalsIgnoreCase('[' + text + ']'); }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); try { limit = Math.max(5, Math.min(1000, Integer.parseInt(SignUtil.getTextRaw(lines.get(2))))); } catch (Exception e) { limit = 20; } lines.set(2, Text.of(limit)); }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); if (SignUtil.getTextRaw(lines.get(2)).trim().isEmpty()) { throw new InvalidICException("Must enter filename on 3rd line."); } }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); if (SignUtil.getTextRaw(lines.get(2)).trim().isEmpty()) { throw new InvalidICException("Must enter filename on 3rd line."); } }
@Override public void create(Player player, List<Text> lines) throws InvalidICException { super.create(player, lines); if (SignUtil.getTextRaw(lines.get(2)).length() != 3) { throw new InvalidICException("The combination must be 3 characters long."); } }
@Override public boolean verifyLines(Location<World> location, List<Text> lines, @Nullable Player player) { if (SignUtil.getTextRaw(lines.get(2)).equalsIgnoreCase("locked")) { ITEMS_PROMPT.getData(player, itemStacks -> { KeyLockData keyLockData = new KeyLockData(itemStacks.get(0)); location.offer(keyLockData); }); } return super.verifyLines(location, lines, player); }
private int getMultiplier(Sign sign) { int multiplier; try { multiplier = Integer.parseInt(SignUtil.getTextRaw(sign, 3)); } catch (Exception e) { multiplier = requireFuel.getValue() ? 0 : 1; setMultiplier(sign, multiplier); } if (multiplier <= 0 && !requireFuel.getValue()) return 1; return Math.max(0, multiplier); }
@Override public boolean isValid(Location<World> location) { return SignUtil.isSign(location) && ICManager.getICType(SignUtil.getTextRaw((Sign) location.getTileEntity().get(), 1)) != null; }
@Override public boolean triggerMechanic(Location<World> block, Sign sign, Humanoid human, Boolean forceState) { if ("[Gate]".equals(SignUtil.getTextRaw(sign, 1))) { Set<GateColumn> columns = new HashSet<>(); BlockState state = findColumns(block, columns, null); if (!columns.isEmpty()) { toggleColumns(state, sign, human, columns, forceState); } else { if (human instanceof CommandSource) ((CommandSource) human).sendMessage(Text.builder("Can't find a gate!").build()); } } else return false; return true; }
@Override public BlockBag getBlockBag(Location<World> location) { BlockBag mainBlockBag = super.getBlockBag(location); if (SignUtil.isSign(location)) { Direction back = "[Door Up]".equals(SignUtil.getTextRaw((Sign) location.getTileEntity().get(), 1)) ? Direction.UP : Direction.DOWN; Location<World> next = BlockUtil.getNextMatchingSign(location, back, maximumLength.getValue() + 2, this::isMechanicSign); if (next != null) { BlockBag nextBlockBag = super.getBlockBag(next); if (nextBlockBag != null) { return new MultiBlockBag(mainBlockBag, nextBlockBag); } } } return mainBlockBag; }