Advertisement
AMCServer

Sign check on Load

Dec 26th, 2013
35
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.08 KB | None | 0 0
  1. String[] arg = rset.getString("memotext").split(",");
  2. if(arg.length >= 4) {
  3. try {
  4. int i = 1;
  5. for(String ar: arg) { PvPRewards.debug("Argument " + String.valueOf(i) + " ist gleich " + ar); i++; }
  6. for(World wor: Bukkit.getWorlds()) { PvPRewards.debug("Verfuegbarer WeltName : " + wor.getName()); }
  7.  
  8. World world = Bukkit.getWorld(arg[0]);
  9. if(world != null) {
  10. double x = Double.parseDouble(arg[1]);
  11. double y = Double.parseDouble(arg[2]);
  12. double z = Double.parseDouble(arg[3]);
  13. Location loc = new Location(world, (int)x, (int)y, (int)z );
  14. if(loc != null) {
  15. Block block = world.getBlockAt(loc);
  16. if(block != null) {
  17. if(block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN) {
  18. Sign sign = (Sign)block.getState();
  19. if(sign != null) {
  20. if(sign.getLine(0).equalsIgnoreCase("[" + ChatColor.DARK_GREEN + "Frei" + ChatColor.RESET + "]")) {
  21. plugin.addSignLocation(block);
  22. } else {
  23. PvPRewards.debug("Schild gefunden , doch text in Zeile 1 passt nicht. Aktueller Text : " + sign.getLine(0));
  24. }
  25. }
  26. }
  27. }
  28. }
  29. }
  30. } catch(Exception e) {
  31. throw new IllegalStateException("Fehler beim Laden einer Sign Location \"" + rset.getString("memotext") + "\"!", e);
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement