Advertisement
Guest User

Untitled

a guest
Jul 28th, 2016
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.31 KB | None | 0 0
  1. @EventHandler
  2. /* */ public void onEven(PlayerInteractEvent e)
  3. /* */ throws IOException
  4. /* */ {
  5. /* 34 */ Player p = e.getPlayer();
  6. /* 35 */ String Playername = p.getName();
  7. /* 36 */ File file = new File("plugins//Gun-Game//SpielerMapList//" + Playername);
  8. /* 37 */ new YamlConfiguration();FileConfiguration cfg = YamlConfiguration.loadConfiguration(file);
  9. /* */
  10. /* 39 */ if (e.getAction() == Action.RIGHT_CLICK_BLOCK)
  11. /* */ {
  12. /* 41 */ Block b = e.getClickedBlock();
  13. /* 42 */ BlockState bs = b.getState();
  14. /* 43 */ if ((bs instanceof Sign)) {
  15. /* 44 */ Sign s = (Sign)bs;
  16. /* */
  17. /* 46 */ if ((s.getLine(0).equalsIgnoreCase("§c> §1SkyPvP §c<")) && (s.getLine(3).equalsIgnoreCase("§a§oOffen"))) {
  18. /* 47 */ if (!Main.insign.contains(p.getName()))
  19. /* */ {
  20. /* 49 */ String name = s.getLine(1);
  21. /* */
  22. /* 51 */ File file1 = new File("plugins//Gun-Game//MapAnzahlList//" + name);
  23. /* 52 */ new YamlConfiguration();FileConfiguration cfg1 = YamlConfiguration.loadConfiguration(file1);
  24. /* 53 */ int anzahl = cfg1.getInt("Map." + name);
  25. /* */
  26. /* 55 */ File file2 = new File("plugins//Gun-Game//MapMaxPlayer//" + name);
  27. /* 56 */ new YamlConfiguration();FileConfiguration cfg2 = YamlConfiguration.loadConfiguration(file2);
  28. /* 57 */ int maxplayer = cfg2.getInt("MaxPlayer." + name);
  29. /* 58 */ if (anzahl != maxplayer)
  30. /* */ {
  31. /* 60 */ cfg.set("Sign.name", name);
  32. /* */
  33. /* 62 */ cfg.save(file);
  34. /* 63 */ cfg1.set("Map." + name, Integer.valueOf(anzahl + 1));
  35. /* 64 */ cfg1.save(file1);
  36. /* 65 */ Main.insign.add(p.getName());
  37. /* */
  38. /* 67 */ String world = this.plugin.getConfig().getString("Map." + name + ".world");
  39. /* 68 */ double x = this.plugin.getConfig().getDouble("Map." + name + ".x");
  40. /* 69 */ double y = this.plugin.getConfig().getDouble("Map." + name + ".y");
  41. /* 70 */ double z = this.plugin.getConfig().getDouble("Map." + name + ".z");
  42. /* 71 */ double yaw = this.plugin.getConfig().getDouble("Map." + name + ".yaw");
  43. /* 72 */ double pitch = this.plugin.getConfig().getDouble("Map." + name + ".pitch");
  44. /* 73 */ Location loc = new Location(Bukkit.getWorld(world), x, y, z);
  45. /* 74 */ loc.setYaw((float)yaw);
  46. /* 75 */ loc.setPitch((float)pitch);
  47. /* */
  48. /* 77 */ p.teleport(loc);
  49. /* 78 */ anzahl++;
  50. /* */
  51. /* 80 */ this.plugin.saveConfig();
  52. /* 81 */ p.sendMessage(Main.prefix + "§1SkyPvP §cMap: §f§l" + name);
  53. /* 82 */ p.sendMessage(Main.prefix + "§f" + anzahl + " §5Spieler sind(ist) in dieser Map!");
  54. /* */
  55. /* 84 */ s.setLine(2, "§5" + anzahl + " §fInGame");
  56. /* 85 */ s.update();
  57. /* 86 */ if (maxplayer == anzahl) {
  58. /* 87 */ s.setLine(3, "§4§lVoll");
  59. /* 88 */ s.update();
  60. /* 89 */ } else if (maxplayer != anzahl) {
  61. /* 90 */ s.setLine(3, "§a§oOffen");
  62. /* 91 */ s.update();
  63. /* */ }
  64. /* */ }
  65. /* */ else {
  66. /* 95 */ p.sendMessage(Main.prefix + "§cEs sind bereits §6§l" + anzahl + " §cvon §6§l" + maxplayer + " in dieser Map! Du kannst nicht beitreten!");
  67. /* */ }
  68. /* */ }
  69. /* */ else {
  70. /* 99 */ String name = s.getLine(1);
  71. /* 100 */ p.sendMessage(Main.prefix + "§cFehler: Du bist bereits in einer Map");
  72. /* */ }
  73. /* 102 */ } else if ((s.getLine(0).equalsIgnoreCase("§c> §1SkyPvP §c<")) && (s.getLine(3).equalsIgnoreCase("§c§oGeschlossen"))) {
  74. /* 103 */ String name = s.getLine(1);
  75. /* 104 */ p.sendMessage(Main.prefix + "§cDie Map §6§l" + name + " §cist geschlossen!");
  76. /* */ }
  77. /* */ }
  78. /* */ }
  79. /* */ }
  80. /* */ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement