public void signSet(Sign sign, Map map) { if (this.args.length < 4) return; String key = this.args[2]; String value = Utils.multiArgs(this.args, 3); if (!sign.getDefaultOptions().containsKey(key) && !sign.getObjectType().equals(ObjectType.CUSTOM)) { message("Option <" + key + "> is not defined for object " + sign.getTypeName()); return; } // Option value reset if (value.equals("default") && sign.getOptions().containsKey(key)) { sign.getOptions().remove(key); message( "Option <" + key + "> has now it default value " + ChatColor.WHITE + sign.getDefaultOptions().get(key).getValue()); } else { sign.getOptions().put(key, value); message("Option <" + key + "> has now value " + ChatColor.WHITE + value); } try { map.writeSigns(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
public void signOutput(Sign sign, Map map) { if (this.args.length <= 4) return; int flux; if (this.args[3].equalsIgnoreCase("n")) { flux = map.getNewSignal(); } else if (!Utils.isInt(this.args[3])) return; else { flux = Integer.parseInt(this.args[3]); } boolean fluxValue; if (this.args[4].equalsIgnoreCase("true") || this.args[4].equalsIgnoreCase("t") || this.args[4].equalsIgnoreCase("on")) fluxValue = true; else if (this.args[4].equalsIgnoreCase("false") || this.args[4].equalsIgnoreCase("f") || this.args[4].equalsIgnoreCase("off")) fluxValue = false; else return; switch (this.args[2]) { case "add": case "a": case "+": this.signAddOutput(sign, map, flux, fluxValue); break; case "remove": case "r": case "-": this.signRemoveOutput(sign, map, flux, fluxValue); break; } }
public void go() { if (!(this.sender instanceof Player)) return; Player p = (Player) this.sender; Map map = this.editor.getMap(p.getWorld()); if (map == null) return; if (this.args.length == 1) return; if (!Utils.isInt(this.args[1])) return; int n = Integer.parseInt(this.args[1]); if (n < 1) return; Sign sign = map.getSign(n); if (sign == null) { message("Sign not found, check /editor find..."); return; } p.teleport(sign.getRealLocation(p.getWorld())); message("Teleported to sign #" + n); }
public void signInput(Sign sign, Map map) { if (this.args.length <= 3) return; int flux; if (this.args[3].equalsIgnoreCase("n")) { flux = map.getNewSignal(); } else if (!Utils.isInt(this.args[3])) return; else { flux = Integer.parseInt(this.args[3]); } switch (this.args[2]) { case "add": case "a": case "+": this.signAddInput(sign, map, flux); break; case "remove": case "r": case "-": this.signRemoveInput(sign, map, flux); break; } }