private void getDestination(int id, Player p) { // get the destination sign Sign s = getDestinationSign(id); if (s != null) { String line1 = s.getLine(1); String line2 = s.getLine(2); String line3 = s.getLine(3); if (line1.isEmpty() || line2.isEmpty() || line3.isEmpty()) { TARDISMessage.send(p, "JUNK_LINES"); return; } World w = plugin.getServer().getWorld(line1); int x = TARDISNumberParsers.parseInt(line2); int z = TARDISNumberParsers.parseInt(line3); // load the chunk Chunk chunk = w.getChunkAt(x, z); while (!chunk.isLoaded()) { w.loadChunk(chunk); } int y = w.getHighestBlockYAt(x, z); Location d = new Location(w, x, y, z); // TODO check destination if (plugin.getPluginRespect().getRespect(d, new Parameters(p, FLAG.getNoMessageFlags()))) { while (!chunk.isLoaded()) { chunk.load(); } d.setY(getActualHighestY(d)); plugin.getGeneralKeeper().setJunkDestination(d); } } }
private void setSignCoords(int id, int line) { // get the destination sign Sign s = getDestinationSign(id); // get repeater data Block r = getControlBlock(id, 2); // get comparator data Block c = getControlBlock(id, 3); if (s != null && r != null && c != null) { String txt = s.getLine(line); if (txt.isEmpty()) { txt = "0"; } int multiplier = repeaterMap.get(r.getData()); int positiveNegative = (c.getData() == 3) ? 1 : -1; // get current coord int current = TARDISNumberParsers.parseInt(txt); // increment / decrement sign coord value int amount = current + (multiplier * positiveNegative); s.setLine(line, "" + amount); s.update(); } }