Advertisement
Guest User

Gwen

a guest
Oct 6th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 61.62 KB | None | 0 0
  1. package me.swagcraft.parkour;
  2.  
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.PreparedStatement;
  6. import java.sql.ResultSet;
  7. import java.sql.SQLException;
  8. import java.sql.Statement;
  9. import java.util.ArrayList;
  10. import java.util.Collections;
  11. import java.util.HashMap;
  12. import java.util.List;
  13. import java.util.Map.Entry;
  14. import java.util.Random;
  15.  
  16. import org.bukkit.Bukkit;
  17. import org.bukkit.ChatColor;
  18. import org.bukkit.Color;
  19. import org.bukkit.FireworkEffect;
  20. import org.bukkit.GameMode;
  21. import org.bukkit.Location;
  22. import org.bukkit.Material;
  23. import org.bukkit.World;
  24. import org.bukkit.FireworkEffect.Type;
  25. import org.bukkit.block.Block;
  26. import org.bukkit.block.Chest;
  27. import org.bukkit.block.Sign;
  28. import org.bukkit.command.Command;
  29. import org.bukkit.command.CommandSender;
  30. import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
  31. import org.bukkit.entity.ArmorStand;
  32. import org.bukkit.entity.Entity;
  33. import org.bukkit.entity.EntityType;
  34. import org.bukkit.entity.Firework;
  35. import org.bukkit.entity.Guardian;
  36. import org.bukkit.entity.Item;
  37. import org.bukkit.entity.LivingEntity;
  38. import org.bukkit.entity.Player;
  39. import org.bukkit.entity.Snowball;
  40. import org.bukkit.entity.Snowman;
  41. import org.bukkit.entity.TNTPrimed;
  42. import org.bukkit.inventory.Inventory;
  43. import org.bukkit.inventory.ItemStack;
  44. import org.bukkit.inventory.ShapedRecipe;
  45. import org.bukkit.inventory.meta.FireworkMeta;
  46. import org.bukkit.inventory.meta.ItemMeta;
  47. import org.bukkit.plugin.java.JavaPlugin;
  48. import org.bukkit.util.Vector;
  49.  
  50. import me.themuhammed2188.pac.api.HackType;
  51. import me.themuhammed2188.pac.api.PACAPI;
  52. import net.minecraft.server.v1_8_R3.PacketPlayOutExplosion;
  53. import net.minecraft.server.v1_8_R3.PlayerConnection;
  54. import net.minecraft.server.v1_8_R3.Vec3D;
  55.  
  56.  
  57.  
  58. public class Chess extends JavaPlugin {
  59.  
  60. public static PACAPI api;
  61. public static HashMap<Block, Integer> taskID = new HashMap<Block, Integer>();
  62. public static HashMap<Block, Integer> ChestA = new HashMap<Block, Integer>();
  63. public static HashMap<ArmorStand, Integer> taskIDParty = new HashMap<ArmorStand, Integer>();
  64. public static HashMap<ArmorStand, Integer> ArmorstandA = new HashMap<ArmorStand, Integer>();
  65. public static HashMap<Player, Location> FrozenPlayers = new HashMap<Player, Location>();
  66. public static HashMap<Guardian, Integer> TaskGuardian = new HashMap<Guardian, Integer>();
  67. public static HashMap<Guardian, Double> GuardianTimes = new HashMap<Guardian, Double>();
  68. public static HashMap<Player, Integer> FidgetTimes = new HashMap<Player, Integer>();
  69. public static HashMap<ArmorStand, Double> Armorstandangle = new HashMap<ArmorStand, Double>();
  70. public static HashMap<Location, Player> PlakdetP = new HashMap<Location, Player>();
  71.  
  72. public static Integer votingtaskID;
  73. public static Integer votingtaskAmount;
  74.  
  75. public static Inventory myInventory = Bukkit.createInventory(null, 9, "Chroma 2 Case");
  76. public static Inventory myInventory2 = Bukkit.createInventory(null, 9, "Chroma 2 Case");
  77.  
  78. public static HashMap<Snowball, Player> PlakBullets = new HashMap<Snowball, Player>();
  79. public static List<Player> Jesters = new ArrayList<Player>();
  80. public static List<Player> PlayerGettingbanned = new ArrayList<Player>();
  81. public static Connection connection;
  82. private String host;
  83. private String database;
  84. private String username;
  85. private String password;
  86. private int port;
  87. private Statement statement;
  88.  
  89. public static BuildBattleGame bbgame;
  90.  
  91.  
  92. @Override
  93. public void onEnable() {
  94. bbgame = new BuildBattleGame(this);
  95.  
  96. api = new PACAPI(this);
  97.  
  98. everySecond();
  99. host = "mc.swagerman.com";
  100. port = 3306;
  101. database = "brood_cas";
  102. username = "brood_cas";
  103. password = "NeeDavidNietMijnWachtwoordStelen";
  104.  
  105. ItemStack bottle = new ItemStack(Material.NETHER_STAR, 1);
  106. ItemStack bottle2 = new ItemStack(Material.NETHER_STAR, 1);
  107. ItemStack bottle3 = new ItemStack(Material.DIAMOND_SWORD, 1);
  108. ItemMeta it2 = bottle2.getItemMeta();
  109. ItemMeta it3 = bottle3.getItemMeta();
  110. it2.setDisplayName(ChatColor.RED + "Opening case....");
  111. it3.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "M9 Bayonet | Case hardened (Blue gem)");
  112. bottle2.setItemMeta(it2);
  113. bottle3.setItemMeta(it3);
  114.  
  115. myInventory.setItem(4, bottle2);
  116. myInventory2.setItem(4, bottle3);
  117.  
  118.  
  119. ItemMeta it = bottle.getItemMeta();
  120. it.setDisplayName(ChatColor.RED + "FIDGET SPINNER");
  121. bottle.setItemMeta(it);
  122.  
  123. bottle.getItemMeta().setDisplayName(ChatColor.RED + "FIDGET SPINNER");
  124. ShapedRecipe expBottle = new ShapedRecipe(bottle);
  125.  
  126. expBottle.shape("*%*"
  127. ,"%B%",
  128. "*%*");
  129.  
  130. expBottle.setIngredient('*', Material.REDSTONE);
  131. expBottle.setIngredient('B', Material.NETHER_STAR);
  132. expBottle.setIngredient('%', Material.BLAZE_ROD);
  133.  
  134.  
  135. getServer().addRecipe(expBottle);
  136.  
  137. ItemStack gun = new ItemStack(Material.BLAZE_ROD, 1);
  138.  
  139. ItemMeta gunmeta = gun.getItemMeta();
  140. gunmeta.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Plakdetonator");
  141. gun.setItemMeta(gunmeta);
  142.  
  143.  
  144. ShapedRecipe Gunrecip = new ShapedRecipe(gun);
  145.  
  146. Gunrecip.shape("###"
  147. ,"#*B",
  148. "###");
  149.  
  150. Gunrecip.setIngredient('*', Material.BLAZE_ROD);
  151. Gunrecip.setIngredient('B', Material.TNT);
  152. Gunrecip.setIngredient('#', Material.OBSIDIAN);
  153.  
  154.  
  155.  
  156. getServer().addRecipe(Gunrecip);
  157.  
  158. ItemStack tntparty = new ItemStack(Material.TNT, 1);
  159.  
  160. ItemMeta tntpartymeta = gun.getItemMeta();
  161. tntpartymeta.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + "Allahu akbar");
  162. tntparty.setItemMeta(tntpartymeta);
  163.  
  164.  
  165. ShapedRecipe tntpartyrecip = new ShapedRecipe(tntparty);
  166.  
  167. tntpartyrecip.shape("###"
  168. ,"###",
  169. "###");
  170.  
  171. tntpartyrecip.setIngredient('#', Material.TNT);
  172.  
  173.  
  174.  
  175. getServer().addRecipe(tntpartyrecip);
  176.  
  177. new FidgetListener(this);
  178.  
  179. startSpam();
  180.  
  181. try {
  182. openConnection();
  183. } catch (ClassNotFoundException e) {
  184. // TODO Auto-generated catch block
  185. e.printStackTrace();
  186. } catch (SQLException e) {
  187. // TODO Auto-generated catch block
  188. e.printStackTrace();
  189. }
  190. try {
  191. statement = connection.createStatement();
  192. } catch (SQLException e) {
  193. // TODO Auto-generated catch block
  194. e.printStackTrace();
  195. }
  196. everyMinute5();
  197.  
  198.  
  199.  
  200.  
  201.  
  202. }
  203.  
  204. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  205.  
  206. if (cmd.getName().equalsIgnoreCase("explode") && sender instanceof Player) {
  207.  
  208. HashMap<Location, Player> Plakdetc = new HashMap<Location, Player>(PlakdetP);
  209.  
  210. for(Entry<Location, Player> entry : Plakdetc.entrySet()) {
  211. Player p = entry.getValue();
  212. Player senderr = (Player) sender;
  213. Location loc = entry.getKey();
  214. if(p == senderr) {
  215. loc.getWorld().createExplosion(loc, 4.0F);
  216. PlakdetP.remove(loc);
  217. }
  218.  
  219.  
  220. }
  221.  
  222. return true;
  223. }
  224. if (cmd.getName().equalsIgnoreCase("jester") && sender instanceof Player) {
  225. Player p = (Player) sender;
  226. if(!Jesters.contains(p)) {
  227. Jesters.add(p);
  228. p.sendMessage(ChatColor.GREEN + "You are now a Jester");
  229. }
  230. return true;
  231. }
  232. if (cmd.getName().equalsIgnoreCase("gwenban") && sender instanceof Player) {
  233. if(args.length == 1 || args.length == 2) {
  234. Player p = this.getServer().getPlayer(args[0]);
  235. if(args.length == 2) {
  236.  
  237. if(args[1].equals("UNAPPEALABLE69") && p != null) {
  238.  
  239. GwenBanP(p, "Unappealable ban", true, true);
  240.  
  241. return true;
  242. }
  243.  
  244. }
  245. if(p != null) {
  246.  
  247. GwenBanP(p, "Je zuigt", false, false);
  248.  
  249. }
  250. return true;
  251. }
  252.  
  253. } else if (cmd.getName().equalsIgnoreCase("dab") && sender instanceof Player) {
  254. Player p = (Player) sender;
  255.  
  256.  
  257.  
  258.  
  259. if(args.length == 0) {
  260.  
  261. Block block = p.getLocation().subtract(0, 1, 0).getBlock();
  262.  
  263. block.setType(Material.LAVA);
  264. p.setGameMode(GameMode.SURVIVAL);
  265. Bukkit.broadcastMessage(p.getName() + " dabbed.");
  266. } else {
  267. Player OtherP = Bukkit.getPlayer(args[0]);
  268. Block block = OtherP.getLocation().subtract(0, 1, 0).getBlock();
  269.  
  270. block.setType(Material.LAVA);
  271. OtherP.setGameMode(GameMode.SURVIVAL);
  272. Bukkit.broadcastMessage(OtherP.getName() + "got dabbed by " + p.getName());
  273. }
  274. return true;
  275. } else if (cmd.getName().equalsIgnoreCase("iwanttodie") && sender instanceof Player) {
  276. Player p = (Player) sender;
  277. p.setGameMode(GameMode.SURVIVAL);
  278. Random random = new Random();
  279. Integer rando = random.nextInt(13) + 1;
  280. if (p.getItemInHand().getType().equals(Material.NETHER_STAR) && p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.RED + "FIDGET SPINNER")) {
  281.  
  282.  
  283.  
  284. Bukkit.broadcastMessage(p.getName() + " tried to kill himself while holding a fidget spinner");
  285. GwenBanP(p, "Fidget spinner", false, false);
  286. } else if(rando <= 1) {
  287.  
  288. Block block = p.getLocation().getBlock();
  289. block.setType(Material.LAVA);
  290. } else if(rando == 2) {
  291. Location loc = p.getLocation().add(0, 80, 0);
  292. p.teleport(loc);
  293. } else if(rando == 3) {
  294. for(int i=1; i<21; i++){
  295. p.getWorld().spawnEntity(p.getLocation(), EntityType.ZOMBIE);
  296. }
  297.  
  298. } else if(rando == 4) {
  299. p.setHealth(1.0);
  300. Block block = p.getLocation().add(0, 15, 0).getBlock();
  301. block.setType(Material.ANVIL);
  302. } else if(rando == 5) {
  303. Location loc2 = p.getLocation();
  304. loc2.setY(-1);
  305.  
  306. p.teleport(loc2);
  307. } else if(rando == 6) {
  308. p.setHealth(0);
  309. Bukkit.broadcastMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "Sanka you dead?");
  310. } else if(rando == 7) {
  311. p.setFireTicks(100000);
  312. } else if(rando == 8) {
  313. for(int i=1; i<21; i++){
  314. p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER);
  315. }
  316. } else if(rando == 9) {
  317. for(int i=1; i<6; i++){
  318. p.getWorld().spawnEntity(p.getLocation(), EntityType.LIGHTNING);
  319. }
  320. } else if(rando == 10) {
  321. Location loc = p.getLocation();
  322. loc.setY(5);
  323. p.teleport(loc);
  324. loc.subtract(0, 1, 0).getBlock().setType(Material.BEDROCK);
  325. loc.add(0, 2, 0).getBlock().setType(Material.BEDROCK);
  326. loc.add(1, 0, 0).getBlock().setType(Material.BEDROCK);
  327. loc.add(1, 1, 0).getBlock().setType(Material.BEDROCK);
  328. loc.add(0, 1, 1).getBlock().setType(Material.BEDROCK);
  329. loc.add(0, 0, 1).getBlock().setType(Material.BEDROCK);
  330. loc.subtract(1, 1, 0).getBlock().setType(Material.BEDROCK);
  331. loc.subtract(1, 0, 0).getBlock().setType(Material.BEDROCK);
  332. loc.subtract(0, 1, 1).getBlock().setType(Material.BEDROCK);
  333. loc.subtract(0, 0, 1).getBlock().setType(Material.BEDROCK);
  334. loc.getBlock().setType(Material.WATER);
  335. loc.add(0, 1, 0).getBlock().setType(Material.WATER);
  336. } else if(rando == 11) {
  337. p.openInventory(myInventory);
  338. NextInv(p);
  339. } else if(rando == 12) {
  340. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  341. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  342. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  343. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  344. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  345. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  346. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  347. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  348. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  349. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  350. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  351. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  352. Bukkit.broadcastMessage(ChatColor.GREEN + "" + p.getName() + " was shot by vigilante");
  353. } else if(rando == 13) {
  354. Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "BIEM");
  355. Location loc1 = p.getLocation().add(+0.0, +5.0, +20.0);
  356. Location loc2 = p.getLocation().add(+0.0, +5.0, -20.0);
  357. Location loc3 = p.getLocation().add(+20.0, +5.0, +0.0);
  358. Location loc4 = p.getLocation().add(-20.0, +5.0, +0.0);
  359. StartAllahuAkbar(loc1);
  360. StartAllahuAkbar(loc2);
  361. StartAllahuAkbar(loc3);
  362. StartAllahuAkbar(loc4);
  363.  
  364. }
  365.  
  366. Bukkit.broadcastMessage(p.getName() + " wants to die");
  367.  
  368. return true;
  369. } else if (cmd.getName().equalsIgnoreCase("eyerape") && sender instanceof Player) {
  370. Player p = (Player) sender;
  371. if(args.length == 1) {
  372. Player targetP = Bukkit.getPlayer(args[0]);
  373. if(targetP == null) {
  374. p.sendMessage(ChatColor.RED + "speler niet gevonden!");
  375. } else {
  376. targetP.setResourcePack("https://www.dropbox.com/s/jb746vu666jyqpa/EyeRape.zip?dl=1");
  377. }
  378. } else {
  379. p.sendMessage(ChatColor.RED + "Incorrect");
  380. }
  381.  
  382.  
  383. return true;
  384. } else if (cmd.getName().equalsIgnoreCase("crash") && sender instanceof Player) {
  385. Player p = (Player) sender;
  386. if(args.length == 1) {
  387. Player target = Bukkit.getPlayer(args[0]);
  388. if(target == null) {
  389. p.sendMessage(ChatColor.RED + "Boiii player not found");
  390. } else {
  391. Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + target.getName() + " is helaas gecrashed");
  392. PlayerConnection connection = ((CraftPlayer) target).getHandle().playerConnection;
  393. connection.sendPacket(new PacketPlayOutExplosion(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE, Float.MAX_VALUE, Collections.EMPTY_LIST, new Vec3D(Double.MAX_VALUE, Double.MAX_VALUE, Double.MAX_VALUE)));
  394.  
  395. }
  396. } else {
  397. p.sendMessage(ChatColor.RED + "pls use /crash <player>");
  398. }
  399. return true;
  400. } else if (cmd.getName().equalsIgnoreCase("startbuildbattle") && sender instanceof Player) {
  401. Player p = (Player) sender;
  402. if(args.length >= 2) {
  403. if(bbgame.isStarted) {
  404. p.sendMessage(ChatColor.RED + "Game already started!");
  405. } else {
  406. Integer time = Integer.valueOf(args[0]);
  407.  
  408. StringBuilder sb = new StringBuilder();
  409. for(int i = 1; i < args.length; i++) {
  410. if (i > 0) sb.append(" ");
  411. sb.append(args[i]);
  412. }
  413.  
  414. bbgame.startGame(sb.toString(), time);
  415. }
  416. } else {
  417. p.sendMessage(ChatColor.RED + "pls use /startbuildbattle <time> <theme>");
  418. }
  419. return true;
  420. } else if (cmd.getName().equalsIgnoreCase("anticheatban")) {
  421. if(args.length >= 2) {
  422. Player p = Bukkit.getPlayer(args[0]);
  423. StringBuilder sb = new StringBuilder();
  424. for(int i = 1; i < args.length; i++) {
  425. if (i > 0) sb.append(" ");
  426. sb.append(args[i]);
  427. }
  428. if(p!=null) {
  429. GwenBanP(p, sb.toString(), true, false);
  430. }
  431. }
  432. return true;
  433. } else if (cmd.getName().equalsIgnoreCase("ungwenban")) {
  434. if(args.length == 1) {
  435. PreparedStatement st;
  436. try {
  437. st = connection.prepareStatement("DELETE FROM BannedPlayers WHERE Playername ='" + args[0]+ "'");
  438. st.executeUpdate();
  439. } catch (SQLException e) {
  440. // TODO Auto-generated catch block
  441. e.printStackTrace();
  442. }
  443.  
  444. }
  445. }
  446. return false;
  447.  
  448. }
  449.  
  450. public void gwenbanwave(Player p) {
  451. String prepsql;
  452. prepsql = "INSERT INTO BanWave (Player) VALUES ('" + p.getName() + "')";
  453. PreparedStatement prepstate;
  454. try {
  455. prepstate = Chess.connection.prepareStatement(prepsql, 1);
  456. prepstate.execute();
  457. } catch (SQLException exc) {
  458.  
  459. exc.printStackTrace();
  460. }
  461. }
  462.  
  463. public void everyMinute5() {
  464. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  465. @Override
  466. public void run() {
  467.  
  468. Bukkit.broadcastMessage(ChatColor.BLUE + "GWEN> " + ChatColor.GRAY + "Starting ban wave!");
  469.  
  470. for(Player p : Bukkit.getOnlinePlayers()) {
  471.  
  472. PreparedStatement ps;
  473. try {
  474. ps = Chess.connection.prepareStatement("SELECT * FROM BanWave WHERE Player ='" + p.getName() + "'");
  475. ResultSet result = ps.executeQuery();
  476. if(result.next()) {
  477. GwenBanP(p, "BanWave [AC]", true, false);
  478. PreparedStatement st = connection.prepareStatement("DELETE FROM BanWave WHERE Player ='" + p.getName() + "'");
  479. st.executeUpdate();
  480. }
  481. } catch (SQLException e1) {
  482. // TODO Auto-generated catch block
  483. e1.printStackTrace();
  484. }
  485.  
  486.  
  487.  
  488. }
  489. }
  490.  
  491. }, 4000, 4000);
  492. }
  493. public void everySecond() {
  494. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  495.  
  496. @Override
  497. public void run() {
  498. bbgame.timePast();
  499. for(Player p : Bukkit.getOnlinePlayers()) {
  500. int FAST_BOW = 0;
  501. int MOVEMENT = 0;
  502. int MORE_PACKETS = 0;
  503. int INVENTORY = 0;
  504. int IMPOSSIBLE_INTERACT = 0;
  505. int SPEED = 0;
  506. int IMPOSSIBLE_PACKET = 0;
  507. try {
  508. PreparedStatement ps = Chess.connection.prepareStatement("SELECT * FROM Violations WHERE Player ='" + p.getName() + "'");
  509. ResultSet result = ps.executeQuery();
  510.  
  511. while (result.next()) {
  512.  
  513.  
  514.  
  515.  
  516. String hacktyperaw = result.getString("HackType");
  517. HackType hacktype = HackType.valueOf(hacktyperaw);
  518.  
  519.  
  520. int ViolationAmount = result.getInt("ViolationType");
  521. if(hacktype == HackType.FAST_BOW) {
  522. FAST_BOW = FAST_BOW + ViolationAmount;
  523. } else if(hacktype == HackType.MOVEMENT) {
  524. MOVEMENT = MOVEMENT + ViolationAmount;
  525. } else if(hacktype == HackType.MORE_PACKETS) {
  526. MORE_PACKETS = MORE_PACKETS + ViolationAmount;
  527. } else if(hacktype == HackType.INVENTORY) {
  528. INVENTORY = INVENTORY + ViolationAmount;
  529. } else if(hacktype == HackType.IMPOSSIBLE_PACKETS) {
  530. IMPOSSIBLE_PACKET = IMPOSSIBLE_PACKET + ViolationAmount;
  531. } else if(hacktype == HackType.SPEED) {
  532. SPEED = SPEED + ViolationAmount;
  533. } else if(hacktype == HackType.IMPOSSIBLE_INTERACT) {
  534. IMPOSSIBLE_INTERACT = IMPOSSIBLE_INTERACT + ViolationAmount;
  535. }
  536.  
  537.  
  538. //FAST_BOW: 3, 6, 9 max: 8
  539. //MOVEMENT: 7, 14, 25 max viopoints: 9
  540. //MORE_PACKETS: 2, 3, 5 max viopoints: 7
  541. //I NVENTORY 10, 20, 25 max viopoints: 8
  542. //IMPOSSIBLE_INTERACT 4, 10, 15 max: 7
  543. //SPEED: 10, 20, 30 max viopoints: 9
  544. //IMPOSSIBLE_PACKET: 4, 8, 12 max: 7
  545.  
  546. //Player, ViolationType, HackType
  547.  
  548. }
  549. } catch (SQLException excc) {
  550. // TODO Auto-generated catch block
  551. excc.printStackTrace();
  552. }
  553.  
  554. if(FAST_BOW > 9) {
  555. gwenbanwave(p);
  556. clearViolations(p);
  557. } else if(MOVEMENT > 9) {
  558. gwenbanwave(p);
  559. clearViolations(p);
  560. } else if(MORE_PACKETS > 7) {
  561. gwenbanwave(p);
  562. clearViolations(p);
  563. } else if(INVENTORY > 8) {
  564. gwenbanwave(p);
  565. clearViolations(p);
  566. } else if(IMPOSSIBLE_PACKET > 7) {
  567. gwenbanwave(p);
  568. clearViolations(p);
  569. } else if(SPEED > 9) {
  570. gwenbanwave(p);
  571. clearViolations(p);
  572. } else if(IMPOSSIBLE_INTERACT > 7) {
  573. gwenbanwave(p);
  574. clearViolations(p);
  575. }
  576. }
  577. }
  578.  
  579. }, 20, 20);
  580. }
  581.  
  582.  
  583. public void clearViolations(Player p) {
  584. try {
  585. PreparedStatement st = connection.prepareStatement("DELETE FROM Violations WHERE Player ='" + p.getName() + "'");
  586. st.executeUpdate();
  587. } catch (SQLException e) {
  588. // TODO Auto-generated catch block
  589. e.printStackTrace();
  590. }
  591. }
  592.  
  593.  
  594.  
  595.  
  596. public void startSpam() {
  597. Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  598. public void run() {
  599. for (World w : Bukkit.getWorlds()) {
  600. for (Entity e : w.getEntities()) {
  601. if(e instanceof Snowman) {
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608. if(((Snowman) e).getTarget() != null) {
  609. ((Snowman) e).launchProjectile(Snowball.class);
  610. }
  611.  
  612. }
  613. }
  614. }
  615.  
  616. for (Player p: Bukkit.getServer().getOnlinePlayers()) {
  617.  
  618. try {
  619. PreparedStatement ps = connection.prepareStatement("SELECT * FROM BannedPlayers WHERE Playername ='" + p.getName() + "'");
  620. ResultSet result = ps.executeQuery();
  621. if (result.next()) {
  622. if(!PlayerGettingbanned.contains(p))
  623. GwenBanP(p, result.getString("reason"), false, false);
  624. PlayerGettingbanned.add(p);
  625. }
  626. } catch (SQLException e) {
  627. // TODO Auto-generated catch block
  628. e.printStackTrace();
  629. }
  630.  
  631. Random random = new Random();
  632. Integer rando = random.nextInt(20000) + 1;
  633. if(rando == 103) {
  634. GwenBanP(p, "Random ban", false, false);
  635. }
  636.  
  637.  
  638. if (p.getItemInHand().getType().equals(Material.NETHER_STAR)) {
  639. if(p.getItemInHand().getItemMeta().hasDisplayName() == true) {
  640. if(p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.RED + "FIDGET SPINNER")) {
  641. if(!FidgetTimes.containsKey(p)) {
  642. FidgetTimes.put(p, 0);
  643. }
  644.  
  645. if(FidgetTimes.get(p) > 200) {
  646. Block block = p.getLocation().add(+0.0, -1.0, +0.0).getBlock();
  647. block.setType(Material.AIR);
  648. Location loc = p.getLocation();
  649. loc.setYaw(loc.getYaw() + 10);
  650. loc.setY(loc.getY() - 1.0);
  651. p.teleport(loc);
  652. }
  653. FidgetTimes.put(p, FidgetTimes.get(p) + 1);
  654. Location loc = p.getLocation();
  655. loc.setYaw(loc.getYaw() + 10);
  656. p.teleport(loc);
  657.  
  658.  
  659. } else if(FidgetTimes.containsKey(p)) FidgetTimes.remove(p);
  660. } else if(FidgetTimes.containsKey(p)) FidgetTimes.remove(p);
  661. } else if(FidgetTimes.containsKey(p)) FidgetTimes.remove(p);
  662. }
  663. }
  664. }, 0, 1);
  665. }
  666.  
  667. public void startStpam(Guardian g, Player p, Location loc, ArmorStand arm) {
  668.  
  669. TaskGuardian.put(g, Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  670. public void run() {
  671. if(g.isDead() == false || arm.isDead() == false) {
  672.  
  673. Location armloc = getLocationAroundCircle(p.getLocation(), 4.0, Armorstandangle.get(arm));
  674.  
  675. g.leaveVehicle();
  676. arm.teleport(armloc.add(+0.0, +5.0, +0.0));
  677. arm.setPassenger(g);
  678. LivingEntity en = p;
  679. g.setTarget(en);
  680. Armorstandangle.put(arm, Armorstandangle.get(arm) + GuardianTimes.get(g));
  681. p.setHealth(20.0);
  682. if(GuardianTimes.get(g) < 0.02) {
  683. GuardianTimes.put(g, GuardianTimes.get(g) + 0.0004);
  684. } else if(GuardianTimes.get(g) >= 0.002 && GuardianTimes.get(g) < 0.9 ){
  685. GuardianTimes.put(g, GuardianTimes.get(g) + 0.002);
  686. } else {
  687. GuardianTimes.put(g, GuardianTimes.get(g) + 0.04);
  688. }
  689. } else {
  690. Integer id = TaskGuardian.get(g);
  691. TaskGuardian.remove(g);
  692. Armorstandangle.remove(arm);
  693. GuardianTimes.remove(g);
  694. Bukkit.getScheduler().cancelTask(id);
  695.  
  696.  
  697. }
  698. }
  699. }, 12, 1));
  700. }
  701.  
  702. public Runnable NextInv(Player p) { // You'll most likely want to include a final player parameter
  703. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  704. @Override
  705. public void run() {
  706. p.openInventory(myInventory2);
  707. Bukkit.broadcastMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "KNIIIFFFFEEEE");
  708. SpawnFirework(p);
  709. SpawnFirework(p);
  710. SpawnFirework(p);
  711. SpawnFirework(p);
  712. SpawnFirework(p);
  713. SpawnFirework(p);
  714. SpawnFirework(p);
  715. SpawnFirework(p);
  716. killByI(p);
  717. }
  718. }, 100);
  719. return null;
  720. }
  721.  
  722. public Runnable KillAndKick(Player p, Guardian g, Guardian g2, Guardian g3, Guardian g4, ArmorStand am, ArmorStand am2, ArmorStand am3, ArmorStand am4, String reason, Boolean realban, Boolean unappealable) { // You'll most likely want to include a final player parameter
  723. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  724. @Override
  725. public void run() {
  726. FrozenPlayers.remove(p);
  727. g.remove();
  728. g2.remove();
  729. g3.remove();
  730. g4.remove();
  731. am.remove();
  732. am2.remove();
  733. am3.remove();
  734. am4.remove();
  735. p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
  736. p.getLocation().getWorld().createExplosion(p.getLocation().add(+0.0, +3.0, +0.0), 4.0F);
  737.  
  738. GwenBan(p, reason, true, realban, unappealable);
  739.  
  740. }
  741. }, 200);
  742. return null;
  743. }
  744.  
  745. public Runnable killByI(Player p) { // You'll most likely want to include a final player parameter
  746. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  747. @Override
  748. public void run() {
  749. Location loc = p.getLocation();
  750. Random random = new Random();
  751. Integer rando = random.nextInt(10) + 1;
  752.  
  753. if(rando == 1) {
  754. Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Case opening gaat goed?!?!?!");
  755. ItemStack bottle = new ItemStack(Material.DIAMOND_SWORD, 1);
  756.  
  757. ItemMeta it = bottle.getItemMeta();
  758.  
  759. it.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "M9 Bayonet | Case hardened (Blue gem)");
  760.  
  761. bottle.setItemMeta(it);
  762. p.closeInventory();
  763. p.getInventory().addItem(bottle);
  764.  
  765. } else {
  766.  
  767.  
  768.  
  769. loc.getWorld().createExplosion(loc, 4.0F);
  770. loc.getWorld().createExplosion(loc, 4.0F);
  771. loc.getWorld().createExplosion(loc, 4.0F);
  772. loc.getWorld().createExplosion(loc, 4.0F);
  773. loc.getWorld().createExplosion(loc, 4.0F);
  774. loc.getWorld().createExplosion(loc, 4.0F);
  775. loc.getWorld().createExplosion(loc, 4.0F);
  776. loc.getWorld().createExplosion(loc, 4.0F);
  777. loc.getWorld().createExplosion(loc, 4.0F);
  778. loc.getWorld().createExplosion(loc, 4.0F);
  779. p.setHealth(0);
  780. Bukkit.broadcastMessage(ChatColor.RED + "" + ChatColor.BOLD + "Pirenk");
  781. }
  782. }
  783. }, 50);
  784. return null;
  785. }
  786.  
  787. public void SpawnFirework(Player p) {
  788. Firework fireWork = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK);
  789. FireworkMeta fwMeta = fireWork.getFireworkMeta();
  790.  
  791. fwMeta.addEffect(FireworkEffect.builder().flicker(false).trail(true).with(Type.BALL).with(Type.BALL_LARGE).with(Type.STAR).withColor(Color.ORANGE).withColor(Color.YELLOW).withFade(Color.PURPLE).withFade(Color.RED).build());
  792.  
  793. fireWork.setFireworkMeta(fwMeta);
  794. }
  795.  
  796.  
  797. public Runnable waitt(Block chest, Location loc) {
  798. ChestA.put(chest, 0);
  799. taskID.put(chest,
  800.  
  801. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  802.  
  803. @Override
  804. public void run() {
  805.  
  806. Integer amounts = ChestA.get(chest);
  807. amounts = amounts + 1;
  808. ChestA.put(chest, amounts);
  809. if(amounts >= 60) {
  810. Integer taskid2 = taskID.get(chest);
  811. taskID.remove(chest);
  812. Bukkit.getScheduler().cancelTask(taskid2);
  813.  
  814.  
  815. ChestA.remove(chest);
  816. }
  817.  
  818. Firework fireWork = (Firework) chest.getWorld().spawnEntity(loc, EntityType.FIREWORK);
  819. FireworkMeta fwMeta = fireWork.getFireworkMeta();
  820.  
  821. fwMeta.addEffect(FireworkEffect.builder().flicker(false).trail(true).with(Type.BALL).with(Type.BALL_LARGE).with(Type.STAR).withColor(Color.RED).withColor(Color.RED).withFade(Color.RED).withFade(Color.RED).build());
  822.  
  823. fireWork.setFireworkMeta(fwMeta);
  824.  
  825. }
  826.  
  827.  
  828.  
  829. }, 0L, 2L));
  830.  
  831. return null;
  832. }
  833.  
  834. public void GwenBan(Player p, String reason, Boolean ShowBanMessage, Boolean realban, Boolean unappealable) {
  835. if(ShowBanMessage) {
  836. Bukkit.broadcastMessage(ChatColor.BLUE + "GWEN> " + ChatColor.GRAY + "" + p.getName() + " has been banned. I am always watching");
  837. }
  838. p.kickPlayer(ChatColor.RED + "Kicked from Noobcraft-1: " + ChatColor.BOLD + "You are banned for Permanent" + "\n" + ChatColor.WHITE + "" + ChatColor.RESET + "[GWEN] Hacking - "+ reason + " [Klootserver]" + "\n" + ChatColor.DARK_GREEN + "Unfairly banned? Appeal at " + ChatColor.GREEN + "mc.swagerman.com");
  839. if(realban) {
  840. String prepsql;
  841. if(unappealable) {
  842. prepsql = "INSERT INTO BannedPlayers (Playername, reason, Unappealable) VALUES ('" + p.getName() + "', '" + reason + "', '1')";
  843. } else {
  844. prepsql = "INSERT INTO BannedPlayers (Playername, reason) VALUES ('" + p.getName() + "', '" + reason + "')";
  845. }
  846. PreparedStatement prepstate;
  847. try {
  848. prepstate = connection.prepareStatement(prepsql, 1);
  849. prepstate.execute();
  850. } catch (SQLException e) {
  851. // TODO Auto-generated catch block
  852. e.printStackTrace();
  853. }
  854.  
  855. }
  856. }
  857.  
  858. public Location getLocationAroundCircle(Location center, double radius, double angleInRadian) {
  859. double x = center.getX() + radius * Math.cos(angleInRadian);
  860. double z = center.getZ() + radius * Math.sin(angleInRadian);
  861. double y = center.getY();
  862.  
  863. Location loc = new Location(center.getWorld(), x, y, z);
  864. Vector difference = center.toVector().clone().subtract(loc.toVector());
  865. loc.setDirection(difference);
  866.  
  867. return loc;
  868. }
  869.  
  870. public Runnable test(Guardian g, ArmorStand arm) { // You'll most likely want to include a final player parameter
  871. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  872. @Override
  873. public void run() {
  874. g.leaveVehicle();
  875. g.teleport(g.getLocation().add(+0.0, +50.0, +0.0));
  876. arm.teleport(g.getLocation().add(+0.0, +50.0, +0.0));
  877. }
  878. }, 10);
  879. return null;
  880. }
  881.  
  882. public void GwenBanP(Player p, String reason, Boolean realban, Boolean unapp) {
  883. Guardian g = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
  884. Guardian g2 = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
  885. Guardian g3 = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
  886. Guardian g4 = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
  887. ArmorStand arm = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
  888. arm.setVisible(false);
  889. arm.setGravity(false);
  890. arm.setPassenger(g);
  891. Armorstandangle.put(arm, Math.toRadians(90.0));
  892. ArmorStand arm2 = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
  893. arm2.setVisible(false);
  894. arm2.setGravity(false);
  895. arm2.setPassenger(g2);
  896. Armorstandangle.put(arm2, Math.toRadians(180.0));
  897. ArmorStand arm3 = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
  898. arm3.setVisible(false);
  899. arm3.setGravity(false);
  900. arm3.setPassenger(g3);
  901. Armorstandangle.put(arm3, Math.toRadians(270.0));
  902. ArmorStand arm4 = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
  903. arm4.setVisible(false);
  904. arm4.setGravity(false);
  905. arm4.setPassenger(g4);
  906. Armorstandangle.put(arm4, 0.0);
  907. startStpam(g, p, p.getLocation(), arm);
  908. startStpam(g2, p, p.getLocation(), arm2);
  909. startStpam(g3, p, p.getLocation(), arm3);
  910. startStpam(g4, p, p.getLocation(), arm4);
  911. FrozenPlayers.put(p, p.getLocation());
  912. test(g, arm);
  913. test(g2, arm2);
  914. test(g3, arm3);
  915. test(g4, arm4);
  916. GuardianTimes.put(g, 0.01);
  917. GuardianTimes.put(g2, 0.01);
  918. GuardianTimes.put(g3, 0.01);
  919. GuardianTimes.put(g4, 0.01);
  920. KillAndKick(p, g, g2, g3, g4, arm, arm2, arm3, arm4, reason, realban, unapp);
  921. }
  922.  
  923. public Runnable JesterKill(Player p) { // You'll most likely want to include a final player parameter
  924. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  925. @Override
  926. public void run() {
  927. p.setHealth(0.0);
  928. Bukkit.broadcastMessage(ChatColor.RED + "" + p.getName() + " died from guilt over lynching the Jester");
  929. }
  930. }, 1200);
  931. return null;
  932. }
  933.  
  934. public void GwenBan2(Player p, String reason, Boolean realban, Boolean unapp) {
  935. GwenBanP(p, reason, realban, unapp);
  936. }
  937.  
  938. public Runnable tntParty(ArmorStand arm) {
  939. ArmorstandA.put(arm, 0);
  940. taskIDParty.put(arm,
  941.  
  942. Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
  943.  
  944. @Override
  945. public void run() {
  946.  
  947. Integer amounts = ArmorstandA.get(arm);
  948. amounts = amounts + 1;
  949. ArmorstandA.put(arm, amounts);
  950. Location loc = arm.getLocation();
  951. loc.setYaw(loc.getYaw() + 5);
  952. if(amounts < 200) {
  953. loc.setPitch(loc.getPitch() - 1);
  954. } else {
  955. loc.setPitch(loc.getPitch() + 1);
  956. }
  957. arm.teleport(loc);
  958. Entity tnt = arm.getWorld().spawn(arm.getLocation().add(0, 1, 0), TNTPrimed.class);
  959.  
  960. //Sets it to detonate after 40 ticks (2 seconds)
  961. ((TNTPrimed)tnt).setFuseTicks(80);
  962.  
  963.  
  964. tnt.setVelocity(arm.getLocation().getDirection().multiply(2.0));
  965. if(amounts >= 400) {
  966. Integer taskid2 = taskIDParty.get(arm);
  967. taskIDParty.remove(arm);
  968. Bukkit.getScheduler().cancelTask(taskid2);
  969.  
  970.  
  971. ArmorstandA.remove(arm);
  972. arm.remove();
  973. }
  974.  
  975.  
  976.  
  977. }
  978.  
  979.  
  980.  
  981. }, 0L, 1L));
  982.  
  983. return null;
  984. }
  985.  
  986. public Runnable voting(Player p) { // You'll most likely want to include a final player parameter
  987. Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
  988. @Override
  989. public void run() {
  990. bbgame.nextVote(p);
  991. }
  992. }, 300);
  993. return null;
  994. }
  995.  
  996. public void StartAllahuAkbar(Location loc) {
  997. ItemStack items = new ItemStack(Material.TNT);
  998.  
  999. Location startloc = loc;
  1000. startloc.setYaw(0);
  1001. startloc.setPitch(40);
  1002. ArmorStand arm = (ArmorStand) loc.getWorld().spawnEntity(loc.add(+0.0, -1.0, +0.0), EntityType.ARMOR_STAND);
  1003. arm.setVisible(false);
  1004. arm.setGravity(false);
  1005. tntParty(arm);
  1006. arm.setHelmet(items);
  1007. }
  1008.  
  1009. public void openConnection() throws SQLException, ClassNotFoundException {
  1010. if ((connection != null) && (!connection.isClosed())) {
  1011. return;
  1012. }
  1013.  
  1014. synchronized (this) {
  1015. if ((connection != null) && (!connection.isClosed())) {
  1016. return;
  1017. }
  1018. Class.forName("com.mysql.jdbc.Driver");
  1019. connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
  1020. }
  1021. }
  1022.  
  1023. }
  1024.  
  1025.  
  1026.  
  1027.  
  1028. Class 2:
  1029.  
  1030.  
  1031. package me.swagcraft.parkour;
  1032.  
  1033. import java.sql.PreparedStatement;
  1034. import java.sql.ResultSet;
  1035. import java.sql.SQLException;
  1036. import java.util.ArrayList;
  1037. import java.util.HashMap;
  1038. import java.util.List;
  1039. import java.util.Random;
  1040.  
  1041. import org.bukkit.Bukkit;
  1042. import org.bukkit.Effect;
  1043. import org.bukkit.Location;
  1044. import org.bukkit.Material;
  1045. import org.bukkit.Sound;
  1046. import org.bukkit.block.Chest;
  1047. import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
  1048. import org.bukkit.entity.ArmorStand;
  1049. import org.bukkit.entity.Creeper;
  1050. import org.bukkit.entity.EntityType;
  1051. import org.bukkit.entity.Item;
  1052. import org.bukkit.entity.Player;
  1053. import org.bukkit.entity.Projectile;
  1054. import org.bukkit.entity.Snowball;
  1055. import org.bukkit.event.EventHandler;
  1056. import org.bukkit.event.EventPriority;
  1057. import org.bukkit.event.Listener;
  1058. import org.bukkit.event.block.Action;
  1059. import org.bukkit.event.entity.EntityExplodeEvent;
  1060. import org.bukkit.event.entity.PlayerDeathEvent;
  1061. import org.bukkit.event.entity.ProjectileHitEvent;
  1062. import org.bukkit.event.inventory.InventoryClickEvent;
  1063. import org.bukkit.event.player.AsyncPlayerChatEvent;
  1064. import org.bukkit.event.player.PlayerChatEvent;
  1065. import org.bukkit.event.player.PlayerCommandPreprocessEvent;
  1066. import org.bukkit.event.player.PlayerInteractEvent;
  1067. import org.bukkit.event.player.PlayerJoinEvent;
  1068. import org.bukkit.event.player.PlayerLoginEvent;
  1069. import org.bukkit.event.player.PlayerMoveEvent;
  1070. import org.bukkit.event.player.PlayerPickupItemEvent;
  1071. import org.bukkit.event.player.PlayerQuitEvent;
  1072. import org.bukkit.event.player.PlayerResourcePackStatusEvent;
  1073. import org.bukkit.inventory.Inventory;
  1074. import org.bukkit.inventory.ItemStack;
  1075. import org.bukkit.inventory.meta.ItemMeta;
  1076. import org.bukkit.util.Vector;
  1077.  
  1078.  
  1079. import me.swagcraft.parkour.Chess;
  1080. import me.themuhammed2188.pac.api.HackType;
  1081. import me.themuhammed2188.pac.api.PlayerViolationEvent;
  1082. import net.md_5.bungee.api.ChatColor;
  1083. import net.minecraft.server.v1_8_R3.BlockPosition;
  1084. import net.minecraft.server.v1_8_R3.TileEntityChest;
  1085. import net.minecraft.server.v1_8_R3.World;
  1086.  
  1087.  
  1088.  
  1089. public class FidgetListener implements Listener {
  1090.  
  1091. public List<Item> lists = new ArrayList<Item>();
  1092. private Chess chessin;
  1093. public static HashMap<Player, Integer> playerDenies = new HashMap<Player, Integer>();
  1094.  
  1095. public FidgetListener(Chess instance) {
  1096. instance.getServer().getPluginManager().registerEvents(this, instance);
  1097. chessin = instance;
  1098. }
  1099.  
  1100. //@EventHandler
  1101. //public void onPlayerViolationCommand(PlayerViolationCommandEvent e) {
  1102. // e.setCancelled(true);
  1103. // String hacktype = e.getHackType() + "";
  1104. // chessin.GwenBanP(e.getPlayer(), hacktype, true, false);
  1105. //}
  1106.  
  1107. @EventHandler
  1108. public void onResourcepackStatusEvent(PlayerResourcePackStatusEvent event){
  1109. if(event.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED)
  1110. Bukkit.broadcastMessage(ChatColor.RED + event.getPlayer().getName() + " denied the resourcepack");
  1111. }
  1112.  
  1113.  
  1114.  
  1115. // if(playerDenies.containsKey(event.getPlayer())) {
  1116. // Integer denies = playerDenies.get(event.getPlayer());
  1117. // denies++;
  1118. // if(denies >= 3) {
  1119. // chessin.GwenBan2(event.getPlayer(), "Denied eyerape 3 times", true, true);
  1120. // playerDenies.put(event.getPlayer(), 0);
  1121. // } else {
  1122. // playerDenies.put(event.getPlayer() ,denies);
  1123. // chessin.GwenBan2(event.getPlayer(), "fk u", true, false);
  1124. // }
  1125. //} else {
  1126. // chessin.GwenBan2(event.getPlayer(), "fk u", true, false);
  1127. // playerDenies.put(event.getPlayer(), 1);
  1128. //}
  1129.  
  1130.  
  1131. @EventHandler
  1132. public void onleave(AsyncPlayerChatEvent e) {
  1133. if(Chess.bbgame.voting) {
  1134. if(isInteger(e.getMessage())) {
  1135. if(Integer.valueOf(e.getMessage()) >= 0 && Integer.valueOf(e.getMessage()) <= 10 ) {
  1136. Boolean allowed = Chess.bbgame.playerVote(e.getPlayer(), Integer.valueOf(e.getMessage()));
  1137. e.setCancelled(true);
  1138. if(allowed) {
  1139. e.getPlayer().sendMessage(ChatColor.GREEN + "You voted: " + e.getMessage() + "/10");
  1140. } else {
  1141. e.getPlayer().sendMessage(ChatColor.RED + "Don't vote on yourself!");
  1142. }
  1143. } else {
  1144. e.setCancelled(true);
  1145. e.getPlayer().sendMessage(ChatColor.RED + "Dat is geen getal tussen 0 en 10....");
  1146. }
  1147. }
  1148. }
  1149. }
  1150.  
  1151. @EventHandler
  1152. public void onleave(PlayerQuitEvent e) {
  1153. Player p = e.getPlayer();
  1154. if(Chess.PlayerGettingbanned.contains(p)) {
  1155. Chess.PlayerGettingbanned.remove(p);
  1156. }
  1157. }
  1158.  
  1159. @EventHandler
  1160. public void onKill(PlayerDeathEvent e)
  1161. {
  1162. if(e.getEntity().getKiller() != null) {
  1163. Player killer = e.getEntity().getKiller();
  1164. if(Chess.Jesters.contains(e.getEntity())) {
  1165. Chess.Jesters.remove(e.getEntity());
  1166. Bukkit.broadcastMessage(ChatColor.RED + "The Jester will get his revenge from the grave!");
  1167. chessin.JesterKill(e.getEntity().getKiller());
  1168. }
  1169.  
  1170. }
  1171. }
  1172. public static boolean isInteger(String s) {
  1173. try {
  1174. Integer.parseInt(s);
  1175. } catch(NumberFormatException e) {
  1176. return false;
  1177. } catch(NullPointerException e) {
  1178. return false;
  1179. }
  1180. // only got here if we didn't return false
  1181. return true;
  1182. }
  1183.  
  1184.  
  1185. @EventHandler
  1186. public void onPlayerJoint(PlayerMoveEvent move) {
  1187. if(Chess.bbgame.isStarted) {
  1188. for (Player key : Chess.bbgame.spawnLoc.keySet()) {
  1189. if(key.getLocation().getBlockX() - Chess.bbgame.spawnLoc.get(key).getBlockX() < 16 && key.getLocation().getBlockX() - Chess.bbgame.spawnLoc.get(key).getBlockX() > -16) {
  1190. if(key.getLocation().getBlockZ() - Chess.bbgame.spawnLoc.get(key).getBlockZ() < 16 && key.getLocation().getBlockZ() - Chess.bbgame.spawnLoc.get(key).getBlockZ() > -16) {
  1191.  
  1192. } else {
  1193. key.teleport(Chess.bbgame.spawnLoc.get(key));
  1194. key.sendMessage(ChatColor.RED + "Do not leave your plot!");
  1195. }
  1196. } else {
  1197. key.teleport(Chess.bbgame.spawnLoc.get(key));
  1198. key.sendMessage(ChatColor.RED + "Do not leave your plot!");
  1199. }
  1200. }
  1201. }
  1202.  
  1203. }
  1204.  
  1205.  
  1206. public void suspect(Player p, HackType hacktype, Integer viotype) {
  1207. for(Player p2 : Bukkit.getOnlinePlayers()) {
  1208. //if(p2.isOp()) {
  1209.  
  1210. String value = hacktype.toString();
  1211. value = value.replace('_', ' ');
  1212. StringBuilder sb = new StringBuilder(value);
  1213. int charact = 0;
  1214. for (int index = 0; index < sb.length(); index++) {
  1215. charact++;
  1216. char c = sb.charAt(index);
  1217. if(charact != 1) {
  1218. sb.setCharAt(index, Character.toLowerCase(c));
  1219. }
  1220.  
  1221. }
  1222.  
  1223. if(viotype == 1) {
  1224. p2.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + "" + ChatColor.MAGIC +"a" + " " + ChatColor.RESET + "" + ChatColor.RED + ChatColor.BOLD +"GWEN> " + ChatColor.RESET + "" + ChatColor.GOLD + p.getName() + ChatColor.YELLOW + " suspected of " + ChatColor.GREEN + "" + sb.toString());
  1225. } else if(viotype == 2) {
  1226. p2.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + "" + ChatColor.MAGIC +"a" + " " + ChatColor.RESET + "" + ChatColor.RED + ChatColor.BOLD +"GWEN> " + ChatColor.RESET + "" + ChatColor.GOLD + p.getName() + ChatColor.YELLOW + " suspected of " + ChatColor.GOLD + "" + sb.toString());
  1227. } else if(viotype == 3) {
  1228. p2.sendMessage(ChatColor.AQUA + "" + ChatColor.BOLD + "" + ChatColor.MAGIC +"a" + " " + ChatColor.RESET + "" + ChatColor.RED + ChatColor.BOLD +"GWEN> " + ChatColor.RESET + "" + ChatColor.GOLD + p.getName() + ChatColor.YELLOW + " suspected of " + ChatColor.RED + "" + sb.toString());
  1229. }
  1230. //}
  1231. }
  1232. }
  1233.  
  1234.  
  1235. @EventHandler
  1236. public void onViolation(PlayerViolationEvent e)
  1237. {
  1238. Player player = e.getPlayer();
  1239. HackType hackType = e.getHackType();
  1240. int VL = e.getVL();
  1241. Boolean logVio = false;
  1242. int vioType = 0;
  1243.  
  1244. if(hackType == HackType.FAST_BOW) {
  1245. if(VL == 3) {
  1246. vioType = 1;
  1247. logVio = true;
  1248. suspect(player, hackType, 1);
  1249. } else if(VL == 6) {
  1250. vioType = 2;
  1251. logVio = true;
  1252. suspect(player, hackType, 2);
  1253. } else if(VL == 9) {
  1254. vioType = 3;
  1255. logVio = true;
  1256. suspect(player, hackType, 2);
  1257. }
  1258. } else if(hackType == HackType.MOVEMENT) {
  1259. if(VL == 7) {
  1260. vioType = 1;
  1261. logVio = true;
  1262. suspect(player, hackType, 1);
  1263. } else if(VL == 14) {
  1264. vioType = 2;
  1265. logVio = true;
  1266. suspect(player, hackType, 2);
  1267. } else if(VL == 25) {
  1268. vioType = 3;
  1269. logVio = true;
  1270. suspect(player, hackType, 3);
  1271. }
  1272. } else if(hackType == HackType.MORE_PACKETS) {
  1273. if(VL == 2) {
  1274. vioType = 1;
  1275. logVio = true;
  1276. suspect(player, hackType, 1);
  1277. } else if(VL == 3) {
  1278. vioType = 2;
  1279. logVio = true;
  1280. suspect(player, hackType, 2);
  1281. } else if(VL == 5) {
  1282. vioType = 3;
  1283. logVio = true;
  1284. suspect(player, hackType, 3);
  1285. }
  1286. } else if(hackType == HackType.INVENTORY) {
  1287. if(VL == 10) {
  1288. vioType = 1;
  1289. logVio = true;
  1290. suspect(player, hackType, 1);
  1291. } else if(VL == 20) {
  1292. vioType = 2;
  1293. logVio = true;
  1294. suspect(player, hackType, 2);
  1295. } else if(VL == 25) {
  1296. vioType = 3;
  1297. logVio = true;
  1298. suspect(player, hackType, 3);
  1299. }
  1300. } else if(hackType == HackType.IMPOSSIBLE_INTERACT) {
  1301. if(VL == 4) {
  1302. vioType = 1;
  1303. logVio = true;
  1304. suspect(player, hackType, 1);
  1305. } else if(VL == 10) {
  1306. vioType = 2;
  1307. logVio = true;
  1308. suspect(player, hackType, 2);
  1309. } else if(VL == 15) {
  1310. vioType = 3;
  1311. logVio = true;
  1312. suspect(player, hackType, 3);
  1313. }
  1314. } else if(hackType == HackType.SPEED) {
  1315. if(VL == 10) {
  1316. vioType = 1;
  1317. logVio = true;
  1318. suspect(player, hackType, 1);
  1319. } else if(VL == 20) {
  1320. vioType = 2;
  1321. logVio = true;
  1322. suspect(player, hackType, 2);
  1323. } else if(VL == 30) {
  1324. vioType = 3;
  1325. logVio = true;
  1326. suspect(player, hackType, 3);
  1327. }
  1328. } else if(hackType == HackType.IMPOSSIBLE_PACKETS) {
  1329. if(VL == 4) {
  1330. vioType = 1;
  1331. logVio = true;
  1332. suspect(player, hackType, 1);
  1333. } else if(VL == 8) {
  1334. vioType = 2;
  1335. logVio = true;
  1336. suspect(player, hackType, 2);
  1337. } else if(VL == 12) {
  1338. vioType = 3;
  1339. logVio = true;
  1340. suspect(player, hackType, 3);
  1341. }
  1342. } else if(hackType == HackType.KILL_AURA) {
  1343. if(VL == 1) {
  1344. suspect(player, hackType, 3);
  1345. } else if(VL == 2) {
  1346. chessin.gwenbanwave(player);
  1347. }
  1348. }
  1349.  
  1350. //FAST_BOW: 3, 6, 9 max: 8
  1351. //MOVEMENT: 7, 14, 25 max viopoints: 9
  1352. //MORE_PACKETS: 2, 3, 5 max viopoints: 7
  1353. //I NVENTORY 10, 20, 25 max viopoints: 8
  1354. //IMPOSSIBLE_INTERACT 4, 10, 15 max: 7
  1355. //SPEED: 10, 20, 30 max viopoints: 9
  1356. //IMPOSSIBLE_PACKET: 4, 8, 12 max: 7
  1357. //Killaura: 1
  1358.  
  1359. if(logVio) {
  1360.  
  1361. String prepsql;
  1362. prepsql = "INSERT INTO Violations (Player, ViolationType, HackType) VALUES ('" + player.getName() + "', '" + vioType + "', '" + hackType.toString() + "')";
  1363. PreparedStatement prepstate;
  1364. try {
  1365. prepstate = Chess.connection.prepareStatement(prepsql, 1);
  1366. prepstate.execute();
  1367. } catch (SQLException exc) {
  1368. // TODO Auto-generated catch block
  1369. exc.printStackTrace();
  1370. }
  1371.  
  1372.  
  1373. }
  1374. if(false) {
  1375. try {
  1376. PreparedStatement ps = Chess.connection.prepareStatement("SELECT * FROM Violations WHERE Player ='" + player.getName() + "'");
  1377. ResultSet result = ps.executeQuery();
  1378.  
  1379. if (result.next()) {
  1380.  
  1381. String VHackType = result.getString("HackType");
  1382. int VTime = result.getInt("Time");
  1383. }
  1384. } catch (SQLException excc) {
  1385. // TODO Auto-generated catch block
  1386. excc.printStackTrace();
  1387. }
  1388. }
  1389.  
  1390.  
  1391.  
  1392.  
  1393. }
  1394.  
  1395.  
  1396. @EventHandler
  1397. public void onPlayerJoint(PlayerJoinEvent move) {
  1398. Player p = move.getPlayer();
  1399.  
  1400. try {
  1401. PreparedStatement ps = Chess.connection.prepareStatement("SELECT * FROM BannedPlayers WHERE Playername ='" + p.getName() + "'");
  1402. ResultSet result = ps.executeQuery();
  1403. if (result.next()) {
  1404. p.kickPlayer(ChatColor.RED + "Kicked from Noobcraft-1: " + ChatColor.BOLD + "You are banned for Permanent" + "\n" + ChatColor.WHITE + "" + ChatColor.RESET + "[GWEN] Hacking - "+ result.getString("reason") + " [Klootserver]" + "\n" + ChatColor.DARK_GREEN + "Unfairly banned? Appeal at " + ChatColor.GREEN + "mc.swagerman.com");
  1405. }
  1406.  
  1407. } catch (SQLException e) {
  1408. // TODO Auto-generated catch block
  1409. e.printStackTrace();
  1410. }
  1411. }
  1412.  
  1413. @EventHandler
  1414. public void onInventoryClick(PlayerMoveEvent move) {
  1415.  
  1416. if(Chess.FrozenPlayers.containsKey(move.getPlayer())) {
  1417. Location from=move.getFrom();
  1418. Location to=move.getTo();
  1419. double x=Math.floor(from.getX());
  1420. double z=Math.floor(from.getZ());
  1421. if(Math.floor(to.getX())!=x||Math.floor(to.getZ())!=z)
  1422. {
  1423. x+=.5;
  1424. z+=.5;
  1425. move.getPlayer().teleport(new Location(from.getWorld(),x,from.getY(),z,from.getYaw(),from.getPitch()));
  1426. }
  1427. }
  1428. }
  1429.  
  1430. @EventHandler
  1431. public void onInventoryClic(PlayerPickupItemEvent event) {
  1432. Item item = event.getItem();
  1433. if(lists.contains(item)){
  1434. event.setCancelled(true);
  1435. }
  1436. }
  1437.  
  1438. @EventHandler(priority = EventPriority.HIGHEST)
  1439. public void onPreCommand(PlayerCommandPreprocessEvent e){
  1440. String[] args = e.getMessage().split(" ");
  1441. if(args[0].equalsIgnoreCase("/fly")){
  1442.  
  1443. chessin.GwenBanP(e.getPlayer(), "Fly hacks", false, false);
  1444. }
  1445. }
  1446.  
  1447.  
  1448. @EventHandler
  1449. public void onInventoryClick(InventoryClickEvent event) {
  1450. Inventory inventory = event.getInventory(); // The inventory that was clicked in
  1451. if (inventory.getName().equals(Chess.myInventory.getName()) || inventory.getName().equals(Chess.myInventory2.getName())) { // The inventory is our custom Inventory
  1452. // The item that the player clicked it dirt
  1453. event.setCancelled(true);
  1454. }// Make it so the dirt is back in its original spot
  1455. }
  1456.  
  1457. @EventHandler
  1458. public void onPlayerInteract(PlayerInteractEvent event) {
  1459.  
  1460. if(event.getAction() == Action.RIGHT_CLICK_AIR) {
  1461. if(event.getItem() != null && event.getItem().getItemMeta().getDisplayName() != null) {
  1462. if(event.getItem().getType() == Material.BLAZE_ROD && event.getItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Plakdetonator")) {
  1463. Snowball s = event.getPlayer().launchProjectile(Snowball.class);
  1464. s.getWorld().playEffect(event.getPlayer().getLocation(), Effect.SMOKE, 10);
  1465. Chess.PlakBullets.put(s, event.getPlayer());
  1466. }
  1467. }
  1468. }
  1469.  
  1470. if(event.getAction() == Action.RIGHT_CLICK_AIR) {
  1471. if(event.getItem() != null && event.getItem().getItemMeta().getDisplayName() != null) {
  1472. if(event.getItem().getType() == Material.TNT && event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "" + ChatColor.BOLD + "Allahu akbar")) {
  1473. chessin.StartAllahuAkbar(event.getPlayer().getLocation());
  1474.  
  1475. }
  1476. }
  1477. }
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483. if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
  1484. if(event.getClickedBlock().getType() == Material.CHEST && !Chess.ChestA.containsKey(event.getClickedBlock())) {
  1485.  
  1486. Player p = event.getPlayer();
  1487. event.setCancelled(true);
  1488. Location loc = p.getLocation();
  1489. Chest chest = (Chest) event.getClickedBlock().getState();
  1490. playChestAction(chest, true);
  1491. ItemStack item = new ItemStack(Material.NETHER_STAR, 1);
  1492.  
  1493. Item items = event.getClickedBlock().getWorld().dropItem(event.getClickedBlock().getLocation().add(+0.5, +1, +0.5), item);
  1494. ArmorStand arm = (ArmorStand) event.getClickedBlock().getWorld().spawnEntity(event.getClickedBlock().getLocation().add(+0.5, -0.7, +0.5), EntityType.ARMOR_STAND);
  1495. arm.setVisible(false);
  1496. arm.setCustomName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "TITAN");
  1497. arm.setCustomNameVisible(true);
  1498. arm.setGravity(false);
  1499. Location loc2 = event.getClickedBlock().getLocation().add(+0.5, +1, +0.5);
  1500. chessin.waitt(event.getClickedBlock(), loc2);
  1501.  
  1502. items.setVelocity(new Vector(0, 0, 0));
  1503. lists.add(items);
  1504. event.getClickedBlock().getLocation().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.PORTAL_TRAVEL, 15, 1);
  1505. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title @a title {text:\"TITAN\",color:\"dark_red\",bold:true}");
  1506. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title @a subtitle {text:\""+ p.getName() + "\",color:\"red\",extra:[{text:\" found Titan in a \",color:\"white\"},{text:\"Mythical Chest\",color:\"red\"}]}");
  1507. Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title @a times 20 100 20");
  1508. Bukkit.broadcastMessage(ChatColor.BLUE + "Treasure> " + ChatColor.YELLOW + "" + p.getName() + " " + ChatColor.GRAY + "found" + ChatColor.RED + " Mythical Titan Rank");
  1509. Bukkit.broadcastMessage(ChatColor.RED + "" + p.getName() + "" + ChatColor.WHITE + " found Titan in a "+ ChatColor.RED + "Mythical Chest");
  1510.  
  1511.  
  1512. }
  1513. }
  1514. }
  1515.  
  1516. @EventHandler
  1517. public void onProjectileHit(ProjectileHitEvent e) {
  1518. Projectile p = e.getEntity();
  1519. if(!(p instanceof Snowball)) {
  1520. return;
  1521. }
  1522.  
  1523. Snowball s = (Snowball) p;
  1524. if(!Chess.PlakBullets.containsKey(s)) {
  1525. return;
  1526. }
  1527. Player owner = Chess.PlakBullets.get(s);
  1528. Chess.PlakBullets.remove(s);
  1529. Chess.PlakdetP.put(p.getLocation(), owner);
  1530.  
  1531. }
  1532.  
  1533. public static void playChestAction(Chest chest, boolean open) {
  1534. Location location = chest.getLocation();
  1535. World world = ((CraftWorld) location.getWorld()).getHandle();
  1536. BlockPosition position = new BlockPosition(location.getX(), location.getY(), location.getZ());
  1537. TileEntityChest tileChest = (TileEntityChest) world.getTileEntity(position);
  1538. world.playBlockAction(position, tileChest.w(), 1, open ? 1 : 0);
  1539. }
  1540.  
  1541.  
  1542.  
  1543. }
  1544.  
  1545.  
  1546.  
  1547.  
  1548.  
  1549.  
  1550. Class 3:
  1551.  
  1552.  
  1553. package me.swagcraft.parkour;
  1554.  
  1555. import java.util.ArrayList;
  1556. import java.util.HashMap;
  1557. import java.util.LinkedHashMap;
  1558. import java.util.List;
  1559.  
  1560. import org.bukkit.Bukkit;
  1561. import org.bukkit.Location;
  1562. import org.bukkit.entity.Player;
  1563.  
  1564. import net.md_5.bungee.api.ChatColor;
  1565.  
  1566. public class BuildBattleGame {
  1567.  
  1568. public Chess instance;
  1569. public Boolean isStarted = false;;
  1570. public Integer timeLeft;
  1571. public HashMap<Player, Integer> points = new HashMap<Player, Integer>();
  1572. public String theme;
  1573. public Player lookingAt;
  1574. public Boolean voting = false;
  1575. public HashMap<Player, Location> spawnLoc = new HashMap<Player, Location>();
  1576. public HashMap<Player, Integer> currentvote = new HashMap<Player, Integer>();
  1577. public Integer voteInt;
  1578. public List<Player> players = new ArrayList<Player>();
  1579. public Boolean done = false;
  1580. public BuildBattleGame(Chess instance) {
  1581. this.instance = instance;
  1582.  
  1583. }
  1584.  
  1585. public Boolean startGame(String theme, Integer time) {
  1586. if(isStarted || voting) {
  1587. return true;
  1588. } else {
  1589. done = false;
  1590. for(Player p : Bukkit.getOnlinePlayers()) {
  1591. points.put(p, 0);
  1592. spawnLoc.put(p, p.getLocation());
  1593. players.add(p);
  1594. p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
  1595. p.sendMessage(" ");
  1596. p.sendMessage(ChatColor.WHITE + "" + ChatColor.BOLD + " BUILD BATTLE");
  1597. p.sendMessage(" ");
  1598. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "Build something relevant to the theme: " + ChatColor.AQUA + "" + ChatColor.BOLD + theme);
  1599. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " When the timer runs out you'll be able to vote");
  1600. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " how good other people's plots are!");
  1601. p.sendMessage(" ");
  1602. p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
  1603.  
  1604. }
  1605. this.theme = theme;
  1606. this.timeLeft = time;
  1607. this.isStarted = true;
  1608. return false;
  1609. }
  1610. }
  1611.  
  1612. public void stopGame() {
  1613.  
  1614. if(isStarted == false && voting == true) {
  1615. Player winner = getWinner();
  1616. for(Player p : players) {
  1617. p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
  1618. p.sendMessage(" ");
  1619. p.sendMessage(ChatColor.WHITE + "" + ChatColor.BOLD + " BUILD BATTLE");
  1620. p.sendMessage(" ");
  1621. p.sendMessage(ChatColor.WHITE + "" + " Winner");
  1622. p.sendMessage(ChatColor.GOLD + "" + " " + points.get(winner));
  1623. p.sendMessage(ChatColor.GRAY + "" + " " + winner.getName());
  1624. p.sendMessage(" ");
  1625. p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
  1626. Bukkit.broadcastMessage(ChatColor.RED + "" + timeLeft + "" + ChatColor.YELLOW + " seconds left!");
  1627.  
  1628. }
  1629. isStarted = false;
  1630. voting = false;
  1631. timeLeft = null;
  1632. points.clear();
  1633. theme = null;
  1634. lookingAt = null;
  1635. spawnLoc.clear();
  1636. players.clear();
  1637.  
  1638. }
  1639.  
  1640. }
  1641. public void startVoting() {
  1642. if(isStarted) {
  1643. voting = true;
  1644. isStarted = false;
  1645. voteInt = 0;
  1646. instance.voting(players.get(voteInt));
  1647. for(Player p : players) {
  1648. p.teleport(spawnLoc.get(players.get(voteInt)));
  1649. p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
  1650. p.sendMessage(" ");
  1651. p.sendMessage(ChatColor.WHITE + "" + ChatColor.BOLD + " Voting");
  1652. p.sendMessage(" ");
  1653. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " Vote for your competitors \"Plots\" ");
  1654. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " the theme was: " + ChatColor.AQUA + "" + ChatColor.BOLD + theme);
  1655. p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " Talk in the chat to vote!");
  1656. p.sendMessage(" ");
  1657. p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
  1658. }
  1659.  
  1660. Bukkit.broadcastMessage(ChatColor.YELLOW + "Builder: " + "" + ChatColor.GRAY + players.get(voteInt).getName());
  1661. //send message
  1662. }
  1663. }
  1664. public void timePast() {
  1665. if(isStarted) {
  1666. timeLeft--;
  1667. if(timeLeft <= 10 || timeLeft == 15 || timeLeft == 20 || timeLeft == 30 || timeLeft == 60 || timeLeft == 120 || timeLeft == 300 || timeLeft == 500 || timeLeft == 1000 || timeLeft == 2000) {
  1668. Bukkit.broadcastMessage(ChatColor.RED + "" + timeLeft + "" + ChatColor.YELLOW + " seconds left!");
  1669. }
  1670.  
  1671. if(timeLeft < 0) {
  1672. startVoting();
  1673.  
  1674. }
  1675. }
  1676. }
  1677.  
  1678. public Boolean playerVote(Player p, Integer amount) {
  1679.  
  1680. if(players.get(voteInt) == p) {
  1681.  
  1682. return false;
  1683. } else {
  1684. currentvote.put(p, amount);
  1685. return true;
  1686. }
  1687.  
  1688.  
  1689.  
  1690. }
  1691.  
  1692. public void nextVote(Player p) {
  1693. for (Player key : spawnLoc.keySet()) {
  1694. if(currentvote.containsKey(key)) {
  1695. if(points.containsKey(p)) {
  1696. Integer currentp = points.get(p);
  1697. currentp = currentp + currentvote.get(key);
  1698. points.put(p, currentp);
  1699. } else {
  1700. points.put(p, currentvote.get(key));
  1701. }
  1702. } else if (key != players.get(voteInt)){
  1703. if(points.containsKey(p)) {
  1704. Integer currentp = points.get(p);
  1705. currentp = currentp + 5;
  1706. points.put(p, currentp);
  1707. } else {
  1708. points.put(p, 5);
  1709. }
  1710. }
  1711. }
  1712.  
  1713. currentvote.clear();
  1714.  
  1715. voteInt++;
  1716.  
  1717. if(voteInt >= players.size()) {
  1718. stopGame();
  1719. } else {
  1720. p = players.get(voteInt);
  1721. for(Player p2 : players) {
  1722. p2.teleport(spawnLoc.get(p));
  1723.  
  1724.  
  1725. }
  1726. instance.voting(p);
  1727. Bukkit.broadcastMessage(ChatColor.YELLOW + "Builder: " + "" + ChatColor.GRAY + players.get(voteInt).getName());
  1728. }
  1729.  
  1730. }
  1731.  
  1732. public Player getWinner() {
  1733. Player winner = null;
  1734. for (Player key : points.keySet()) {
  1735. if(winner == null) {
  1736. winner = key;
  1737. } else {
  1738. if(points.get(winner) < points.get(key)) {
  1739. winner = key;
  1740. }
  1741. }
  1742.  
  1743. }
  1744. return winner;
  1745. }
  1746.  
  1747. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement