Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.swagcraft.parkour;
- import java.sql.Connection;
- import java.sql.DriverManager;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.sql.Statement;
- import java.util.ArrayList;
- import java.util.Collections;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Map.Entry;
- import java.util.Random;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Color;
- import org.bukkit.FireworkEffect;
- import org.bukkit.GameMode;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.World;
- import org.bukkit.FireworkEffect.Type;
- import org.bukkit.block.Block;
- import org.bukkit.block.Chest;
- import org.bukkit.block.Sign;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandSender;
- import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
- import org.bukkit.entity.ArmorStand;
- import org.bukkit.entity.Entity;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Firework;
- import org.bukkit.entity.Guardian;
- import org.bukkit.entity.Item;
- import org.bukkit.entity.LivingEntity;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Snowball;
- import org.bukkit.entity.Snowman;
- import org.bukkit.entity.TNTPrimed;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.ShapedRecipe;
- import org.bukkit.inventory.meta.FireworkMeta;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.plugin.java.JavaPlugin;
- import org.bukkit.util.Vector;
- import me.themuhammed2188.pac.api.HackType;
- import me.themuhammed2188.pac.api.PACAPI;
- import net.minecraft.server.v1_8_R3.PacketPlayOutExplosion;
- import net.minecraft.server.v1_8_R3.PlayerConnection;
- import net.minecraft.server.v1_8_R3.Vec3D;
- public class Chess extends JavaPlugin {
- public static PACAPI api;
- public static HashMap<Block, Integer> taskID = new HashMap<Block, Integer>();
- public static HashMap<Block, Integer> ChestA = new HashMap<Block, Integer>();
- public static HashMap<ArmorStand, Integer> taskIDParty = new HashMap<ArmorStand, Integer>();
- public static HashMap<ArmorStand, Integer> ArmorstandA = new HashMap<ArmorStand, Integer>();
- public static HashMap<Player, Location> FrozenPlayers = new HashMap<Player, Location>();
- public static HashMap<Guardian, Integer> TaskGuardian = new HashMap<Guardian, Integer>();
- public static HashMap<Guardian, Double> GuardianTimes = new HashMap<Guardian, Double>();
- public static HashMap<Player, Integer> FidgetTimes = new HashMap<Player, Integer>();
- public static HashMap<ArmorStand, Double> Armorstandangle = new HashMap<ArmorStand, Double>();
- public static HashMap<Location, Player> PlakdetP = new HashMap<Location, Player>();
- public static Integer votingtaskID;
- public static Integer votingtaskAmount;
- public static Inventory myInventory = Bukkit.createInventory(null, 9, "Chroma 2 Case");
- public static Inventory myInventory2 = Bukkit.createInventory(null, 9, "Chroma 2 Case");
- public static HashMap<Snowball, Player> PlakBullets = new HashMap<Snowball, Player>();
- public static List<Player> Jesters = new ArrayList<Player>();
- public static List<Player> PlayerGettingbanned = new ArrayList<Player>();
- public static Connection connection;
- private String host;
- private String database;
- private String username;
- private String password;
- private int port;
- private Statement statement;
- public static BuildBattleGame bbgame;
- @Override
- public void onEnable() {
- bbgame = new BuildBattleGame(this);
- api = new PACAPI(this);
- everySecond();
- host = "mc.swagerman.com";
- port = 3306;
- database = "brood_cas";
- username = "brood_cas";
- password = "NeeDavidNietMijnWachtwoordStelen";
- ItemStack bottle = new ItemStack(Material.NETHER_STAR, 1);
- ItemStack bottle2 = new ItemStack(Material.NETHER_STAR, 1);
- ItemStack bottle3 = new ItemStack(Material.DIAMOND_SWORD, 1);
- ItemMeta it2 = bottle2.getItemMeta();
- ItemMeta it3 = bottle3.getItemMeta();
- it2.setDisplayName(ChatColor.RED + "Opening case....");
- it3.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "M9 Bayonet | Case hardened (Blue gem)");
- bottle2.setItemMeta(it2);
- bottle3.setItemMeta(it3);
- myInventory.setItem(4, bottle2);
- myInventory2.setItem(4, bottle3);
- ItemMeta it = bottle.getItemMeta();
- it.setDisplayName(ChatColor.RED + "FIDGET SPINNER");
- bottle.setItemMeta(it);
- bottle.getItemMeta().setDisplayName(ChatColor.RED + "FIDGET SPINNER");
- ShapedRecipe expBottle = new ShapedRecipe(bottle);
- expBottle.shape("*%*"
- ,"%B%",
- "*%*");
- expBottle.setIngredient('*', Material.REDSTONE);
- expBottle.setIngredient('B', Material.NETHER_STAR);
- expBottle.setIngredient('%', Material.BLAZE_ROD);
- getServer().addRecipe(expBottle);
- ItemStack gun = new ItemStack(Material.BLAZE_ROD, 1);
- ItemMeta gunmeta = gun.getItemMeta();
- gunmeta.setDisplayName(ChatColor.RED + "" + ChatColor.BOLD + "Plakdetonator");
- gun.setItemMeta(gunmeta);
- ShapedRecipe Gunrecip = new ShapedRecipe(gun);
- Gunrecip.shape("###"
- ,"#*B",
- "###");
- Gunrecip.setIngredient('*', Material.BLAZE_ROD);
- Gunrecip.setIngredient('B', Material.TNT);
- Gunrecip.setIngredient('#', Material.OBSIDIAN);
- getServer().addRecipe(Gunrecip);
- ItemStack tntparty = new ItemStack(Material.TNT, 1);
- ItemMeta tntpartymeta = gun.getItemMeta();
- tntpartymeta.setDisplayName(ChatColor.GREEN + "" + ChatColor.BOLD + "Allahu akbar");
- tntparty.setItemMeta(tntpartymeta);
- ShapedRecipe tntpartyrecip = new ShapedRecipe(tntparty);
- tntpartyrecip.shape("###"
- ,"###",
- "###");
- tntpartyrecip.setIngredient('#', Material.TNT);
- getServer().addRecipe(tntpartyrecip);
- new FidgetListener(this);
- startSpam();
- try {
- openConnection();
- } catch (ClassNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- try {
- statement = connection.createStatement();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- everyMinute5();
- }
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- if (cmd.getName().equalsIgnoreCase("explode") && sender instanceof Player) {
- HashMap<Location, Player> Plakdetc = new HashMap<Location, Player>(PlakdetP);
- for(Entry<Location, Player> entry : Plakdetc.entrySet()) {
- Player p = entry.getValue();
- Player senderr = (Player) sender;
- Location loc = entry.getKey();
- if(p == senderr) {
- loc.getWorld().createExplosion(loc, 4.0F);
- PlakdetP.remove(loc);
- }
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("jester") && sender instanceof Player) {
- Player p = (Player) sender;
- if(!Jesters.contains(p)) {
- Jesters.add(p);
- p.sendMessage(ChatColor.GREEN + "You are now a Jester");
- }
- return true;
- }
- if (cmd.getName().equalsIgnoreCase("gwenban") && sender instanceof Player) {
- if(args.length == 1 || args.length == 2) {
- Player p = this.getServer().getPlayer(args[0]);
- if(args.length == 2) {
- if(args[1].equals("UNAPPEALABLE69") && p != null) {
- GwenBanP(p, "Unappealable ban", true, true);
- return true;
- }
- }
- if(p != null) {
- GwenBanP(p, "Je zuigt", false, false);
- }
- return true;
- }
- } else if (cmd.getName().equalsIgnoreCase("dab") && sender instanceof Player) {
- Player p = (Player) sender;
- if(args.length == 0) {
- Block block = p.getLocation().subtract(0, 1, 0).getBlock();
- block.setType(Material.LAVA);
- p.setGameMode(GameMode.SURVIVAL);
- Bukkit.broadcastMessage(p.getName() + " dabbed.");
- } else {
- Player OtherP = Bukkit.getPlayer(args[0]);
- Block block = OtherP.getLocation().subtract(0, 1, 0).getBlock();
- block.setType(Material.LAVA);
- OtherP.setGameMode(GameMode.SURVIVAL);
- Bukkit.broadcastMessage(OtherP.getName() + "got dabbed by " + p.getName());
- }
- return true;
- } else if (cmd.getName().equalsIgnoreCase("iwanttodie") && sender instanceof Player) {
- Player p = (Player) sender;
- p.setGameMode(GameMode.SURVIVAL);
- Random random = new Random();
- Integer rando = random.nextInt(13) + 1;
- if (p.getItemInHand().getType().equals(Material.NETHER_STAR) && p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.RED + "FIDGET SPINNER")) {
- Bukkit.broadcastMessage(p.getName() + " tried to kill himself while holding a fidget spinner");
- GwenBanP(p, "Fidget spinner", false, false);
- } else if(rando <= 1) {
- Block block = p.getLocation().getBlock();
- block.setType(Material.LAVA);
- } else if(rando == 2) {
- Location loc = p.getLocation().add(0, 80, 0);
- p.teleport(loc);
- } else if(rando == 3) {
- for(int i=1; i<21; i++){
- p.getWorld().spawnEntity(p.getLocation(), EntityType.ZOMBIE);
- }
- } else if(rando == 4) {
- p.setHealth(1.0);
- Block block = p.getLocation().add(0, 15, 0).getBlock();
- block.setType(Material.ANVIL);
- } else if(rando == 5) {
- Location loc2 = p.getLocation();
- loc2.setY(-1);
- p.teleport(loc2);
- } else if(rando == 6) {
- p.setHealth(0);
- Bukkit.broadcastMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "Sanka you dead?");
- } else if(rando == 7) {
- p.setFireTicks(100000);
- } else if(rando == 8) {
- for(int i=1; i<21; i++){
- p.getWorld().spawnEntity(p.getLocation(), EntityType.CREEPER);
- }
- } else if(rando == 9) {
- for(int i=1; i<6; i++){
- p.getWorld().spawnEntity(p.getLocation(), EntityType.LIGHTNING);
- }
- } else if(rando == 10) {
- Location loc = p.getLocation();
- loc.setY(5);
- p.teleport(loc);
- loc.subtract(0, 1, 0).getBlock().setType(Material.BEDROCK);
- loc.add(0, 2, 0).getBlock().setType(Material.BEDROCK);
- loc.add(1, 0, 0).getBlock().setType(Material.BEDROCK);
- loc.add(1, 1, 0).getBlock().setType(Material.BEDROCK);
- loc.add(0, 1, 1).getBlock().setType(Material.BEDROCK);
- loc.add(0, 0, 1).getBlock().setType(Material.BEDROCK);
- loc.subtract(1, 1, 0).getBlock().setType(Material.BEDROCK);
- loc.subtract(1, 0, 0).getBlock().setType(Material.BEDROCK);
- loc.subtract(0, 1, 1).getBlock().setType(Material.BEDROCK);
- loc.subtract(0, 0, 1).getBlock().setType(Material.BEDROCK);
- loc.getBlock().setType(Material.WATER);
- loc.add(0, 1, 0).getBlock().setType(Material.WATER);
- } else if(rando == 11) {
- p.openInventory(myInventory);
- NextInv(p);
- } else if(rando == 12) {
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- Bukkit.broadcastMessage(ChatColor.GREEN + "" + p.getName() + " was shot by vigilante");
- } else if(rando == 13) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "BIEM");
- Location loc1 = p.getLocation().add(+0.0, +5.0, +20.0);
- Location loc2 = p.getLocation().add(+0.0, +5.0, -20.0);
- Location loc3 = p.getLocation().add(+20.0, +5.0, +0.0);
- Location loc4 = p.getLocation().add(-20.0, +5.0, +0.0);
- StartAllahuAkbar(loc1);
- StartAllahuAkbar(loc2);
- StartAllahuAkbar(loc3);
- StartAllahuAkbar(loc4);
- }
- Bukkit.broadcastMessage(p.getName() + " wants to die");
- return true;
- } else if (cmd.getName().equalsIgnoreCase("eyerape") && sender instanceof Player) {
- Player p = (Player) sender;
- if(args.length == 1) {
- Player targetP = Bukkit.getPlayer(args[0]);
- if(targetP == null) {
- p.sendMessage(ChatColor.RED + "speler niet gevonden!");
- } else {
- targetP.setResourcePack("https://www.dropbox.com/s/jb746vu666jyqpa/EyeRape.zip?dl=1");
- }
- } else {
- p.sendMessage(ChatColor.RED + "Incorrect");
- }
- return true;
- } else if (cmd.getName().equalsIgnoreCase("crash") && sender instanceof Player) {
- Player p = (Player) sender;
- if(args.length == 1) {
- Player target = Bukkit.getPlayer(args[0]);
- if(target == null) {
- p.sendMessage(ChatColor.RED + "Boiii player not found");
- } else {
- Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + target.getName() + " is helaas gecrashed");
- PlayerConnection connection = ((CraftPlayer) target).getHandle().playerConnection;
- 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)));
- }
- } else {
- p.sendMessage(ChatColor.RED + "pls use /crash <player>");
- }
- return true;
- } else if (cmd.getName().equalsIgnoreCase("startbuildbattle") && sender instanceof Player) {
- Player p = (Player) sender;
- if(args.length >= 2) {
- if(bbgame.isStarted) {
- p.sendMessage(ChatColor.RED + "Game already started!");
- } else {
- Integer time = Integer.valueOf(args[0]);
- StringBuilder sb = new StringBuilder();
- for(int i = 1; i < args.length; i++) {
- if (i > 0) sb.append(" ");
- sb.append(args[i]);
- }
- bbgame.startGame(sb.toString(), time);
- }
- } else {
- p.sendMessage(ChatColor.RED + "pls use /startbuildbattle <time> <theme>");
- }
- return true;
- } else if (cmd.getName().equalsIgnoreCase("anticheatban")) {
- if(args.length >= 2) {
- Player p = Bukkit.getPlayer(args[0]);
- StringBuilder sb = new StringBuilder();
- for(int i = 1; i < args.length; i++) {
- if (i > 0) sb.append(" ");
- sb.append(args[i]);
- }
- if(p!=null) {
- GwenBanP(p, sb.toString(), true, false);
- }
- }
- return true;
- } else if (cmd.getName().equalsIgnoreCase("ungwenban")) {
- if(args.length == 1) {
- PreparedStatement st;
- try {
- st = connection.prepareStatement("DELETE FROM BannedPlayers WHERE Playername ='" + args[0]+ "'");
- st.executeUpdate();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- return false;
- }
- public void gwenbanwave(Player p) {
- String prepsql;
- prepsql = "INSERT INTO BanWave (Player) VALUES ('" + p.getName() + "')";
- PreparedStatement prepstate;
- try {
- prepstate = Chess.connection.prepareStatement(prepsql, 1);
- prepstate.execute();
- } catch (SQLException exc) {
- exc.printStackTrace();
- }
- }
- public void everyMinute5() {
- Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- Bukkit.broadcastMessage(ChatColor.BLUE + "GWEN> " + ChatColor.GRAY + "Starting ban wave!");
- for(Player p : Bukkit.getOnlinePlayers()) {
- PreparedStatement ps;
- try {
- ps = Chess.connection.prepareStatement("SELECT * FROM BanWave WHERE Player ='" + p.getName() + "'");
- ResultSet result = ps.executeQuery();
- if(result.next()) {
- GwenBanP(p, "BanWave [AC]", true, false);
- PreparedStatement st = connection.prepareStatement("DELETE FROM BanWave WHERE Player ='" + p.getName() + "'");
- st.executeUpdate();
- }
- } catch (SQLException e1) {
- // TODO Auto-generated catch block
- e1.printStackTrace();
- }
- }
- }
- }, 4000, 4000);
- }
- public void everySecond() {
- Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- bbgame.timePast();
- for(Player p : Bukkit.getOnlinePlayers()) {
- int FAST_BOW = 0;
- int MOVEMENT = 0;
- int MORE_PACKETS = 0;
- int INVENTORY = 0;
- int IMPOSSIBLE_INTERACT = 0;
- int SPEED = 0;
- int IMPOSSIBLE_PACKET = 0;
- try {
- PreparedStatement ps = Chess.connection.prepareStatement("SELECT * FROM Violations WHERE Player ='" + p.getName() + "'");
- ResultSet result = ps.executeQuery();
- while (result.next()) {
- String hacktyperaw = result.getString("HackType");
- HackType hacktype = HackType.valueOf(hacktyperaw);
- int ViolationAmount = result.getInt("ViolationType");
- if(hacktype == HackType.FAST_BOW) {
- FAST_BOW = FAST_BOW + ViolationAmount;
- } else if(hacktype == HackType.MOVEMENT) {
- MOVEMENT = MOVEMENT + ViolationAmount;
- } else if(hacktype == HackType.MORE_PACKETS) {
- MORE_PACKETS = MORE_PACKETS + ViolationAmount;
- } else if(hacktype == HackType.INVENTORY) {
- INVENTORY = INVENTORY + ViolationAmount;
- } else if(hacktype == HackType.IMPOSSIBLE_PACKETS) {
- IMPOSSIBLE_PACKET = IMPOSSIBLE_PACKET + ViolationAmount;
- } else if(hacktype == HackType.SPEED) {
- SPEED = SPEED + ViolationAmount;
- } else if(hacktype == HackType.IMPOSSIBLE_INTERACT) {
- IMPOSSIBLE_INTERACT = IMPOSSIBLE_INTERACT + ViolationAmount;
- }
- //FAST_BOW: 3, 6, 9 max: 8
- //MOVEMENT: 7, 14, 25 max viopoints: 9
- //MORE_PACKETS: 2, 3, 5 max viopoints: 7
- //I NVENTORY 10, 20, 25 max viopoints: 8
- //IMPOSSIBLE_INTERACT 4, 10, 15 max: 7
- //SPEED: 10, 20, 30 max viopoints: 9
- //IMPOSSIBLE_PACKET: 4, 8, 12 max: 7
- //Player, ViolationType, HackType
- }
- } catch (SQLException excc) {
- // TODO Auto-generated catch block
- excc.printStackTrace();
- }
- if(FAST_BOW > 9) {
- gwenbanwave(p);
- clearViolations(p);
- } else if(MOVEMENT > 9) {
- gwenbanwave(p);
- clearViolations(p);
- } else if(MORE_PACKETS > 7) {
- gwenbanwave(p);
- clearViolations(p);
- } else if(INVENTORY > 8) {
- gwenbanwave(p);
- clearViolations(p);
- } else if(IMPOSSIBLE_PACKET > 7) {
- gwenbanwave(p);
- clearViolations(p);
- } else if(SPEED > 9) {
- gwenbanwave(p);
- clearViolations(p);
- } else if(IMPOSSIBLE_INTERACT > 7) {
- gwenbanwave(p);
- clearViolations(p);
- }
- }
- }
- }, 20, 20);
- }
- public void clearViolations(Player p) {
- try {
- PreparedStatement st = connection.prepareStatement("DELETE FROM Violations WHERE Player ='" + p.getName() + "'");
- st.executeUpdate();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- public void startSpam() {
- Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- public void run() {
- for (World w : Bukkit.getWorlds()) {
- for (Entity e : w.getEntities()) {
- if(e instanceof Snowman) {
- if(((Snowman) e).getTarget() != null) {
- ((Snowman) e).launchProjectile(Snowball.class);
- }
- }
- }
- }
- for (Player p: Bukkit.getServer().getOnlinePlayers()) {
- try {
- PreparedStatement ps = connection.prepareStatement("SELECT * FROM BannedPlayers WHERE Playername ='" + p.getName() + "'");
- ResultSet result = ps.executeQuery();
- if (result.next()) {
- if(!PlayerGettingbanned.contains(p))
- GwenBanP(p, result.getString("reason"), false, false);
- PlayerGettingbanned.add(p);
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- Random random = new Random();
- Integer rando = random.nextInt(20000) + 1;
- if(rando == 103) {
- GwenBanP(p, "Random ban", false, false);
- }
- if (p.getItemInHand().getType().equals(Material.NETHER_STAR)) {
- if(p.getItemInHand().getItemMeta().hasDisplayName() == true) {
- if(p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.RED + "FIDGET SPINNER")) {
- if(!FidgetTimes.containsKey(p)) {
- FidgetTimes.put(p, 0);
- }
- if(FidgetTimes.get(p) > 200) {
- Block block = p.getLocation().add(+0.0, -1.0, +0.0).getBlock();
- block.setType(Material.AIR);
- Location loc = p.getLocation();
- loc.setYaw(loc.getYaw() + 10);
- loc.setY(loc.getY() - 1.0);
- p.teleport(loc);
- }
- FidgetTimes.put(p, FidgetTimes.get(p) + 1);
- Location loc = p.getLocation();
- loc.setYaw(loc.getYaw() + 10);
- p.teleport(loc);
- } else if(FidgetTimes.containsKey(p)) FidgetTimes.remove(p);
- } else if(FidgetTimes.containsKey(p)) FidgetTimes.remove(p);
- } else if(FidgetTimes.containsKey(p)) FidgetTimes.remove(p);
- }
- }
- }, 0, 1);
- }
- public void startStpam(Guardian g, Player p, Location loc, ArmorStand arm) {
- TaskGuardian.put(g, Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- public void run() {
- if(g.isDead() == false || arm.isDead() == false) {
- Location armloc = getLocationAroundCircle(p.getLocation(), 4.0, Armorstandangle.get(arm));
- g.leaveVehicle();
- arm.teleport(armloc.add(+0.0, +5.0, +0.0));
- arm.setPassenger(g);
- LivingEntity en = p;
- g.setTarget(en);
- Armorstandangle.put(arm, Armorstandangle.get(arm) + GuardianTimes.get(g));
- p.setHealth(20.0);
- if(GuardianTimes.get(g) < 0.02) {
- GuardianTimes.put(g, GuardianTimes.get(g) + 0.0004);
- } else if(GuardianTimes.get(g) >= 0.002 && GuardianTimes.get(g) < 0.9 ){
- GuardianTimes.put(g, GuardianTimes.get(g) + 0.002);
- } else {
- GuardianTimes.put(g, GuardianTimes.get(g) + 0.04);
- }
- } else {
- Integer id = TaskGuardian.get(g);
- TaskGuardian.remove(g);
- Armorstandangle.remove(arm);
- GuardianTimes.remove(g);
- Bukkit.getScheduler().cancelTask(id);
- }
- }
- }, 12, 1));
- }
- public Runnable NextInv(Player p) { // You'll most likely want to include a final player parameter
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- p.openInventory(myInventory2);
- Bukkit.broadcastMessage(ChatColor.GOLD + "" + ChatColor.BOLD + "KNIIIFFFFEEEE");
- SpawnFirework(p);
- SpawnFirework(p);
- SpawnFirework(p);
- SpawnFirework(p);
- SpawnFirework(p);
- SpawnFirework(p);
- SpawnFirework(p);
- SpawnFirework(p);
- killByI(p);
- }
- }, 100);
- return null;
- }
- 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
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- FrozenPlayers.remove(p);
- g.remove();
- g2.remove();
- g3.remove();
- g4.remove();
- am.remove();
- am2.remove();
- am3.remove();
- am4.remove();
- p.getLocation().getWorld().createExplosion(p.getLocation(), 4.0F);
- p.getLocation().getWorld().createExplosion(p.getLocation().add(+0.0, +3.0, +0.0), 4.0F);
- GwenBan(p, reason, true, realban, unappealable);
- }
- }, 200);
- return null;
- }
- public Runnable killByI(Player p) { // You'll most likely want to include a final player parameter
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- Location loc = p.getLocation();
- Random random = new Random();
- Integer rando = random.nextInt(10) + 1;
- if(rando == 1) {
- Bukkit.broadcastMessage(ChatColor.GREEN + "" + ChatColor.BOLD + "Case opening gaat goed?!?!?!");
- ItemStack bottle = new ItemStack(Material.DIAMOND_SWORD, 1);
- ItemMeta it = bottle.getItemMeta();
- it.setDisplayName(ChatColor.BLUE + "" + ChatColor.BOLD + "M9 Bayonet | Case hardened (Blue gem)");
- bottle.setItemMeta(it);
- p.closeInventory();
- p.getInventory().addItem(bottle);
- } else {
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- loc.getWorld().createExplosion(loc, 4.0F);
- p.setHealth(0);
- Bukkit.broadcastMessage(ChatColor.RED + "" + ChatColor.BOLD + "Pirenk");
- }
- }
- }, 50);
- return null;
- }
- public void SpawnFirework(Player p) {
- Firework fireWork = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK);
- FireworkMeta fwMeta = fireWork.getFireworkMeta();
- 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());
- fireWork.setFireworkMeta(fwMeta);
- }
- public Runnable waitt(Block chest, Location loc) {
- ChestA.put(chest, 0);
- taskID.put(chest,
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- Integer amounts = ChestA.get(chest);
- amounts = amounts + 1;
- ChestA.put(chest, amounts);
- if(amounts >= 60) {
- Integer taskid2 = taskID.get(chest);
- taskID.remove(chest);
- Bukkit.getScheduler().cancelTask(taskid2);
- ChestA.remove(chest);
- }
- Firework fireWork = (Firework) chest.getWorld().spawnEntity(loc, EntityType.FIREWORK);
- FireworkMeta fwMeta = fireWork.getFireworkMeta();
- 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());
- fireWork.setFireworkMeta(fwMeta);
- }
- }, 0L, 2L));
- return null;
- }
- public void GwenBan(Player p, String reason, Boolean ShowBanMessage, Boolean realban, Boolean unappealable) {
- if(ShowBanMessage) {
- Bukkit.broadcastMessage(ChatColor.BLUE + "GWEN> " + ChatColor.GRAY + "" + p.getName() + " has been banned. I am always watching");
- }
- 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");
- if(realban) {
- String prepsql;
- if(unappealable) {
- prepsql = "INSERT INTO BannedPlayers (Playername, reason, Unappealable) VALUES ('" + p.getName() + "', '" + reason + "', '1')";
- } else {
- prepsql = "INSERT INTO BannedPlayers (Playername, reason) VALUES ('" + p.getName() + "', '" + reason + "')";
- }
- PreparedStatement prepstate;
- try {
- prepstate = connection.prepareStatement(prepsql, 1);
- prepstate.execute();
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- }
- public Location getLocationAroundCircle(Location center, double radius, double angleInRadian) {
- double x = center.getX() + radius * Math.cos(angleInRadian);
- double z = center.getZ() + radius * Math.sin(angleInRadian);
- double y = center.getY();
- Location loc = new Location(center.getWorld(), x, y, z);
- Vector difference = center.toVector().clone().subtract(loc.toVector());
- loc.setDirection(difference);
- return loc;
- }
- public Runnable test(Guardian g, ArmorStand arm) { // You'll most likely want to include a final player parameter
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- g.leaveVehicle();
- g.teleport(g.getLocation().add(+0.0, +50.0, +0.0));
- arm.teleport(g.getLocation().add(+0.0, +50.0, +0.0));
- }
- }, 10);
- return null;
- }
- public void GwenBanP(Player p, String reason, Boolean realban, Boolean unapp) {
- Guardian g = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
- Guardian g2 = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
- Guardian g3 = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
- Guardian g4 = (Guardian) p.getWorld().spawnEntity(p.getLocation().add(+0.0, +50.0, +0.0), EntityType.GUARDIAN);
- ArmorStand arm = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
- arm.setVisible(false);
- arm.setGravity(false);
- arm.setPassenger(g);
- Armorstandangle.put(arm, Math.toRadians(90.0));
- ArmorStand arm2 = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
- arm2.setVisible(false);
- arm2.setGravity(false);
- arm2.setPassenger(g2);
- Armorstandangle.put(arm2, Math.toRadians(180.0));
- ArmorStand arm3 = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
- arm3.setVisible(false);
- arm3.setGravity(false);
- arm3.setPassenger(g3);
- Armorstandangle.put(arm3, Math.toRadians(270.0));
- ArmorStand arm4 = (ArmorStand) p.getLocation().getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
- arm4.setVisible(false);
- arm4.setGravity(false);
- arm4.setPassenger(g4);
- Armorstandangle.put(arm4, 0.0);
- startStpam(g, p, p.getLocation(), arm);
- startStpam(g2, p, p.getLocation(), arm2);
- startStpam(g3, p, p.getLocation(), arm3);
- startStpam(g4, p, p.getLocation(), arm4);
- FrozenPlayers.put(p, p.getLocation());
- test(g, arm);
- test(g2, arm2);
- test(g3, arm3);
- test(g4, arm4);
- GuardianTimes.put(g, 0.01);
- GuardianTimes.put(g2, 0.01);
- GuardianTimes.put(g3, 0.01);
- GuardianTimes.put(g4, 0.01);
- KillAndKick(p, g, g2, g3, g4, arm, arm2, arm3, arm4, reason, realban, unapp);
- }
- public Runnable JesterKill(Player p) { // You'll most likely want to include a final player parameter
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- p.setHealth(0.0);
- Bukkit.broadcastMessage(ChatColor.RED + "" + p.getName() + " died from guilt over lynching the Jester");
- }
- }, 1200);
- return null;
- }
- public void GwenBan2(Player p, String reason, Boolean realban, Boolean unapp) {
- GwenBanP(p, reason, realban, unapp);
- }
- public Runnable tntParty(ArmorStand arm) {
- ArmorstandA.put(arm, 0);
- taskIDParty.put(arm,
- Bukkit.getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
- @Override
- public void run() {
- Integer amounts = ArmorstandA.get(arm);
- amounts = amounts + 1;
- ArmorstandA.put(arm, amounts);
- Location loc = arm.getLocation();
- loc.setYaw(loc.getYaw() + 5);
- if(amounts < 200) {
- loc.setPitch(loc.getPitch() - 1);
- } else {
- loc.setPitch(loc.getPitch() + 1);
- }
- arm.teleport(loc);
- Entity tnt = arm.getWorld().spawn(arm.getLocation().add(0, 1, 0), TNTPrimed.class);
- //Sets it to detonate after 40 ticks (2 seconds)
- ((TNTPrimed)tnt).setFuseTicks(80);
- tnt.setVelocity(arm.getLocation().getDirection().multiply(2.0));
- if(amounts >= 400) {
- Integer taskid2 = taskIDParty.get(arm);
- taskIDParty.remove(arm);
- Bukkit.getScheduler().cancelTask(taskid2);
- ArmorstandA.remove(arm);
- arm.remove();
- }
- }
- }, 0L, 1L));
- return null;
- }
- public Runnable voting(Player p) { // You'll most likely want to include a final player parameter
- Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() {
- @Override
- public void run() {
- bbgame.nextVote(p);
- }
- }, 300);
- return null;
- }
- public void StartAllahuAkbar(Location loc) {
- ItemStack items = new ItemStack(Material.TNT);
- Location startloc = loc;
- startloc.setYaw(0);
- startloc.setPitch(40);
- ArmorStand arm = (ArmorStand) loc.getWorld().spawnEntity(loc.add(+0.0, -1.0, +0.0), EntityType.ARMOR_STAND);
- arm.setVisible(false);
- arm.setGravity(false);
- tntParty(arm);
- arm.setHelmet(items);
- }
- public void openConnection() throws SQLException, ClassNotFoundException {
- if ((connection != null) && (!connection.isClosed())) {
- return;
- }
- synchronized (this) {
- if ((connection != null) && (!connection.isClosed())) {
- return;
- }
- Class.forName("com.mysql.jdbc.Driver");
- connection = DriverManager.getConnection("jdbc:mysql://" + host + ":" + port + "/" + database, username, password);
- }
- }
- }
- Class 2:
- package me.swagcraft.parkour;
- import java.sql.PreparedStatement;
- import java.sql.ResultSet;
- import java.sql.SQLException;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.List;
- import java.util.Random;
- import org.bukkit.Bukkit;
- import org.bukkit.Effect;
- import org.bukkit.Location;
- import org.bukkit.Material;
- import org.bukkit.Sound;
- import org.bukkit.block.Chest;
- import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
- import org.bukkit.entity.ArmorStand;
- import org.bukkit.entity.Creeper;
- import org.bukkit.entity.EntityType;
- import org.bukkit.entity.Item;
- import org.bukkit.entity.Player;
- import org.bukkit.entity.Projectile;
- import org.bukkit.entity.Snowball;
- import org.bukkit.event.EventHandler;
- import org.bukkit.event.EventPriority;
- import org.bukkit.event.Listener;
- import org.bukkit.event.block.Action;
- import org.bukkit.event.entity.EntityExplodeEvent;
- import org.bukkit.event.entity.PlayerDeathEvent;
- import org.bukkit.event.entity.ProjectileHitEvent;
- import org.bukkit.event.inventory.InventoryClickEvent;
- import org.bukkit.event.player.AsyncPlayerChatEvent;
- import org.bukkit.event.player.PlayerChatEvent;
- import org.bukkit.event.player.PlayerCommandPreprocessEvent;
- import org.bukkit.event.player.PlayerInteractEvent;
- import org.bukkit.event.player.PlayerJoinEvent;
- import org.bukkit.event.player.PlayerLoginEvent;
- import org.bukkit.event.player.PlayerMoveEvent;
- import org.bukkit.event.player.PlayerPickupItemEvent;
- import org.bukkit.event.player.PlayerQuitEvent;
- import org.bukkit.event.player.PlayerResourcePackStatusEvent;
- import org.bukkit.inventory.Inventory;
- import org.bukkit.inventory.ItemStack;
- import org.bukkit.inventory.meta.ItemMeta;
- import org.bukkit.util.Vector;
- import me.swagcraft.parkour.Chess;
- import me.themuhammed2188.pac.api.HackType;
- import me.themuhammed2188.pac.api.PlayerViolationEvent;
- import net.md_5.bungee.api.ChatColor;
- import net.minecraft.server.v1_8_R3.BlockPosition;
- import net.minecraft.server.v1_8_R3.TileEntityChest;
- import net.minecraft.server.v1_8_R3.World;
- public class FidgetListener implements Listener {
- public List<Item> lists = new ArrayList<Item>();
- private Chess chessin;
- public static HashMap<Player, Integer> playerDenies = new HashMap<Player, Integer>();
- public FidgetListener(Chess instance) {
- instance.getServer().getPluginManager().registerEvents(this, instance);
- chessin = instance;
- }
- //@EventHandler
- //public void onPlayerViolationCommand(PlayerViolationCommandEvent e) {
- // e.setCancelled(true);
- // String hacktype = e.getHackType() + "";
- // chessin.GwenBanP(e.getPlayer(), hacktype, true, false);
- //}
- @EventHandler
- public void onResourcepackStatusEvent(PlayerResourcePackStatusEvent event){
- if(event.getStatus() == PlayerResourcePackStatusEvent.Status.DECLINED)
- Bukkit.broadcastMessage(ChatColor.RED + event.getPlayer().getName() + " denied the resourcepack");
- }
- // if(playerDenies.containsKey(event.getPlayer())) {
- // Integer denies = playerDenies.get(event.getPlayer());
- // denies++;
- // if(denies >= 3) {
- // chessin.GwenBan2(event.getPlayer(), "Denied eyerape 3 times", true, true);
- // playerDenies.put(event.getPlayer(), 0);
- // } else {
- // playerDenies.put(event.getPlayer() ,denies);
- // chessin.GwenBan2(event.getPlayer(), "fk u", true, false);
- // }
- //} else {
- // chessin.GwenBan2(event.getPlayer(), "fk u", true, false);
- // playerDenies.put(event.getPlayer(), 1);
- //}
- @EventHandler
- public void onleave(AsyncPlayerChatEvent e) {
- if(Chess.bbgame.voting) {
- if(isInteger(e.getMessage())) {
- if(Integer.valueOf(e.getMessage()) >= 0 && Integer.valueOf(e.getMessage()) <= 10 ) {
- Boolean allowed = Chess.bbgame.playerVote(e.getPlayer(), Integer.valueOf(e.getMessage()));
- e.setCancelled(true);
- if(allowed) {
- e.getPlayer().sendMessage(ChatColor.GREEN + "You voted: " + e.getMessage() + "/10");
- } else {
- e.getPlayer().sendMessage(ChatColor.RED + "Don't vote on yourself!");
- }
- } else {
- e.setCancelled(true);
- e.getPlayer().sendMessage(ChatColor.RED + "Dat is geen getal tussen 0 en 10....");
- }
- }
- }
- }
- @EventHandler
- public void onleave(PlayerQuitEvent e) {
- Player p = e.getPlayer();
- if(Chess.PlayerGettingbanned.contains(p)) {
- Chess.PlayerGettingbanned.remove(p);
- }
- }
- @EventHandler
- public void onKill(PlayerDeathEvent e)
- {
- if(e.getEntity().getKiller() != null) {
- Player killer = e.getEntity().getKiller();
- if(Chess.Jesters.contains(e.getEntity())) {
- Chess.Jesters.remove(e.getEntity());
- Bukkit.broadcastMessage(ChatColor.RED + "The Jester will get his revenge from the grave!");
- chessin.JesterKill(e.getEntity().getKiller());
- }
- }
- }
- public static boolean isInteger(String s) {
- try {
- Integer.parseInt(s);
- } catch(NumberFormatException e) {
- return false;
- } catch(NullPointerException e) {
- return false;
- }
- // only got here if we didn't return false
- return true;
- }
- @EventHandler
- public void onPlayerJoint(PlayerMoveEvent move) {
- if(Chess.bbgame.isStarted) {
- for (Player key : Chess.bbgame.spawnLoc.keySet()) {
- if(key.getLocation().getBlockX() - Chess.bbgame.spawnLoc.get(key).getBlockX() < 16 && key.getLocation().getBlockX() - Chess.bbgame.spawnLoc.get(key).getBlockX() > -16) {
- if(key.getLocation().getBlockZ() - Chess.bbgame.spawnLoc.get(key).getBlockZ() < 16 && key.getLocation().getBlockZ() - Chess.bbgame.spawnLoc.get(key).getBlockZ() > -16) {
- } else {
- key.teleport(Chess.bbgame.spawnLoc.get(key));
- key.sendMessage(ChatColor.RED + "Do not leave your plot!");
- }
- } else {
- key.teleport(Chess.bbgame.spawnLoc.get(key));
- key.sendMessage(ChatColor.RED + "Do not leave your plot!");
- }
- }
- }
- }
- public void suspect(Player p, HackType hacktype, Integer viotype) {
- for(Player p2 : Bukkit.getOnlinePlayers()) {
- //if(p2.isOp()) {
- String value = hacktype.toString();
- value = value.replace('_', ' ');
- StringBuilder sb = new StringBuilder(value);
- int charact = 0;
- for (int index = 0; index < sb.length(); index++) {
- charact++;
- char c = sb.charAt(index);
- if(charact != 1) {
- sb.setCharAt(index, Character.toLowerCase(c));
- }
- }
- if(viotype == 1) {
- 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());
- } else if(viotype == 2) {
- 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());
- } else if(viotype == 3) {
- 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());
- }
- //}
- }
- }
- @EventHandler
- public void onViolation(PlayerViolationEvent e)
- {
- Player player = e.getPlayer();
- HackType hackType = e.getHackType();
- int VL = e.getVL();
- Boolean logVio = false;
- int vioType = 0;
- if(hackType == HackType.FAST_BOW) {
- if(VL == 3) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 6) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 9) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 2);
- }
- } else if(hackType == HackType.MOVEMENT) {
- if(VL == 7) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 14) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 25) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 3);
- }
- } else if(hackType == HackType.MORE_PACKETS) {
- if(VL == 2) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 3) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 5) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 3);
- }
- } else if(hackType == HackType.INVENTORY) {
- if(VL == 10) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 20) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 25) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 3);
- }
- } else if(hackType == HackType.IMPOSSIBLE_INTERACT) {
- if(VL == 4) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 10) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 15) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 3);
- }
- } else if(hackType == HackType.SPEED) {
- if(VL == 10) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 20) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 30) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 3);
- }
- } else if(hackType == HackType.IMPOSSIBLE_PACKETS) {
- if(VL == 4) {
- vioType = 1;
- logVio = true;
- suspect(player, hackType, 1);
- } else if(VL == 8) {
- vioType = 2;
- logVio = true;
- suspect(player, hackType, 2);
- } else if(VL == 12) {
- vioType = 3;
- logVio = true;
- suspect(player, hackType, 3);
- }
- } else if(hackType == HackType.KILL_AURA) {
- if(VL == 1) {
- suspect(player, hackType, 3);
- } else if(VL == 2) {
- chessin.gwenbanwave(player);
- }
- }
- //FAST_BOW: 3, 6, 9 max: 8
- //MOVEMENT: 7, 14, 25 max viopoints: 9
- //MORE_PACKETS: 2, 3, 5 max viopoints: 7
- //I NVENTORY 10, 20, 25 max viopoints: 8
- //IMPOSSIBLE_INTERACT 4, 10, 15 max: 7
- //SPEED: 10, 20, 30 max viopoints: 9
- //IMPOSSIBLE_PACKET: 4, 8, 12 max: 7
- //Killaura: 1
- if(logVio) {
- String prepsql;
- prepsql = "INSERT INTO Violations (Player, ViolationType, HackType) VALUES ('" + player.getName() + "', '" + vioType + "', '" + hackType.toString() + "')";
- PreparedStatement prepstate;
- try {
- prepstate = Chess.connection.prepareStatement(prepsql, 1);
- prepstate.execute();
- } catch (SQLException exc) {
- // TODO Auto-generated catch block
- exc.printStackTrace();
- }
- }
- if(false) {
- try {
- PreparedStatement ps = Chess.connection.prepareStatement("SELECT * FROM Violations WHERE Player ='" + player.getName() + "'");
- ResultSet result = ps.executeQuery();
- if (result.next()) {
- String VHackType = result.getString("HackType");
- int VTime = result.getInt("Time");
- }
- } catch (SQLException excc) {
- // TODO Auto-generated catch block
- excc.printStackTrace();
- }
- }
- }
- @EventHandler
- public void onPlayerJoint(PlayerJoinEvent move) {
- Player p = move.getPlayer();
- try {
- PreparedStatement ps = Chess.connection.prepareStatement("SELECT * FROM BannedPlayers WHERE Playername ='" + p.getName() + "'");
- ResultSet result = ps.executeQuery();
- if (result.next()) {
- 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");
- }
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- @EventHandler
- public void onInventoryClick(PlayerMoveEvent move) {
- if(Chess.FrozenPlayers.containsKey(move.getPlayer())) {
- Location from=move.getFrom();
- Location to=move.getTo();
- double x=Math.floor(from.getX());
- double z=Math.floor(from.getZ());
- if(Math.floor(to.getX())!=x||Math.floor(to.getZ())!=z)
- {
- x+=.5;
- z+=.5;
- move.getPlayer().teleport(new Location(from.getWorld(),x,from.getY(),z,from.getYaw(),from.getPitch()));
- }
- }
- }
- @EventHandler
- public void onInventoryClic(PlayerPickupItemEvent event) {
- Item item = event.getItem();
- if(lists.contains(item)){
- event.setCancelled(true);
- }
- }
- @EventHandler(priority = EventPriority.HIGHEST)
- public void onPreCommand(PlayerCommandPreprocessEvent e){
- String[] args = e.getMessage().split(" ");
- if(args[0].equalsIgnoreCase("/fly")){
- chessin.GwenBanP(e.getPlayer(), "Fly hacks", false, false);
- }
- }
- @EventHandler
- public void onInventoryClick(InventoryClickEvent event) {
- Inventory inventory = event.getInventory(); // The inventory that was clicked in
- if (inventory.getName().equals(Chess.myInventory.getName()) || inventory.getName().equals(Chess.myInventory2.getName())) { // The inventory is our custom Inventory
- // The item that the player clicked it dirt
- event.setCancelled(true);
- }// Make it so the dirt is back in its original spot
- }
- @EventHandler
- public void onPlayerInteract(PlayerInteractEvent event) {
- if(event.getAction() == Action.RIGHT_CLICK_AIR) {
- if(event.getItem() != null && event.getItem().getItemMeta().getDisplayName() != null) {
- if(event.getItem().getType() == Material.BLAZE_ROD && event.getItem().getItemMeta().getDisplayName().equals(ChatColor.RED + "" + ChatColor.BOLD + "Plakdetonator")) {
- Snowball s = event.getPlayer().launchProjectile(Snowball.class);
- s.getWorld().playEffect(event.getPlayer().getLocation(), Effect.SMOKE, 10);
- Chess.PlakBullets.put(s, event.getPlayer());
- }
- }
- }
- if(event.getAction() == Action.RIGHT_CLICK_AIR) {
- if(event.getItem() != null && event.getItem().getItemMeta().getDisplayName() != null) {
- if(event.getItem().getType() == Material.TNT && event.getItem().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "" + ChatColor.BOLD + "Allahu akbar")) {
- chessin.StartAllahuAkbar(event.getPlayer().getLocation());
- }
- }
- }
- if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
- if(event.getClickedBlock().getType() == Material.CHEST && !Chess.ChestA.containsKey(event.getClickedBlock())) {
- Player p = event.getPlayer();
- event.setCancelled(true);
- Location loc = p.getLocation();
- Chest chest = (Chest) event.getClickedBlock().getState();
- playChestAction(chest, true);
- ItemStack item = new ItemStack(Material.NETHER_STAR, 1);
- Item items = event.getClickedBlock().getWorld().dropItem(event.getClickedBlock().getLocation().add(+0.5, +1, +0.5), item);
- ArmorStand arm = (ArmorStand) event.getClickedBlock().getWorld().spawnEntity(event.getClickedBlock().getLocation().add(+0.5, -0.7, +0.5), EntityType.ARMOR_STAND);
- arm.setVisible(false);
- arm.setCustomName(ChatColor.DARK_RED + "" + ChatColor.BOLD + "TITAN");
- arm.setCustomNameVisible(true);
- arm.setGravity(false);
- Location loc2 = event.getClickedBlock().getLocation().add(+0.5, +1, +0.5);
- chessin.waitt(event.getClickedBlock(), loc2);
- items.setVelocity(new Vector(0, 0, 0));
- lists.add(items);
- event.getClickedBlock().getLocation().getWorld().playSound(event.getClickedBlock().getLocation(), Sound.PORTAL_TRAVEL, 15, 1);
- Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title @a title {text:\"TITAN\",color:\"dark_red\",bold:true}");
- 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\"}]}");
- Bukkit.getServer().dispatchCommand(Bukkit.getConsoleSender(), "title @a times 20 100 20");
- Bukkit.broadcastMessage(ChatColor.BLUE + "Treasure> " + ChatColor.YELLOW + "" + p.getName() + " " + ChatColor.GRAY + "found" + ChatColor.RED + " Mythical Titan Rank");
- Bukkit.broadcastMessage(ChatColor.RED + "" + p.getName() + "" + ChatColor.WHITE + " found Titan in a "+ ChatColor.RED + "Mythical Chest");
- }
- }
- }
- @EventHandler
- public void onProjectileHit(ProjectileHitEvent e) {
- Projectile p = e.getEntity();
- if(!(p instanceof Snowball)) {
- return;
- }
- Snowball s = (Snowball) p;
- if(!Chess.PlakBullets.containsKey(s)) {
- return;
- }
- Player owner = Chess.PlakBullets.get(s);
- Chess.PlakBullets.remove(s);
- Chess.PlakdetP.put(p.getLocation(), owner);
- }
- public static void playChestAction(Chest chest, boolean open) {
- Location location = chest.getLocation();
- World world = ((CraftWorld) location.getWorld()).getHandle();
- BlockPosition position = new BlockPosition(location.getX(), location.getY(), location.getZ());
- TileEntityChest tileChest = (TileEntityChest) world.getTileEntity(position);
- world.playBlockAction(position, tileChest.w(), 1, open ? 1 : 0);
- }
- }
- Class 3:
- package me.swagcraft.parkour;
- import java.util.ArrayList;
- import java.util.HashMap;
- import java.util.LinkedHashMap;
- import java.util.List;
- import org.bukkit.Bukkit;
- import org.bukkit.Location;
- import org.bukkit.entity.Player;
- import net.md_5.bungee.api.ChatColor;
- public class BuildBattleGame {
- public Chess instance;
- public Boolean isStarted = false;;
- public Integer timeLeft;
- public HashMap<Player, Integer> points = new HashMap<Player, Integer>();
- public String theme;
- public Player lookingAt;
- public Boolean voting = false;
- public HashMap<Player, Location> spawnLoc = new HashMap<Player, Location>();
- public HashMap<Player, Integer> currentvote = new HashMap<Player, Integer>();
- public Integer voteInt;
- public List<Player> players = new ArrayList<Player>();
- public Boolean done = false;
- public BuildBattleGame(Chess instance) {
- this.instance = instance;
- }
- public Boolean startGame(String theme, Integer time) {
- if(isStarted || voting) {
- return true;
- } else {
- done = false;
- for(Player p : Bukkit.getOnlinePlayers()) {
- points.put(p, 0);
- spawnLoc.put(p, p.getLocation());
- players.add(p);
- p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.WHITE + "" + ChatColor.BOLD + " BUILD BATTLE");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "Build something relevant to the theme: " + ChatColor.AQUA + "" + ChatColor.BOLD + theme);
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " When the timer runs out you'll be able to vote");
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " how good other people's plots are!");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
- }
- this.theme = theme;
- this.timeLeft = time;
- this.isStarted = true;
- return false;
- }
- }
- public void stopGame() {
- if(isStarted == false && voting == true) {
- Player winner = getWinner();
- for(Player p : players) {
- p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.WHITE + "" + ChatColor.BOLD + " BUILD BATTLE");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.WHITE + "" + " Winner");
- p.sendMessage(ChatColor.GOLD + "" + " " + points.get(winner));
- p.sendMessage(ChatColor.GRAY + "" + " " + winner.getName());
- p.sendMessage(" ");
- p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
- Bukkit.broadcastMessage(ChatColor.RED + "" + timeLeft + "" + ChatColor.YELLOW + " seconds left!");
- }
- isStarted = false;
- voting = false;
- timeLeft = null;
- points.clear();
- theme = null;
- lookingAt = null;
- spawnLoc.clear();
- players.clear();
- }
- }
- public void startVoting() {
- if(isStarted) {
- voting = true;
- isStarted = false;
- voteInt = 0;
- instance.voting(players.get(voteInt));
- for(Player p : players) {
- p.teleport(spawnLoc.get(players.get(voteInt)));
- p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.WHITE + "" + ChatColor.BOLD + " Voting");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " Vote for your competitors \"Plots\" ");
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " the theme was: " + ChatColor.AQUA + "" + ChatColor.BOLD + theme);
- p.sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + " Talk in the chat to vote!");
- p.sendMessage(" ");
- p.sendMessage(ChatColor.GREEN + "" + ChatColor.STRIKETHROUGH + "-----------------------------------------------------");
- }
- Bukkit.broadcastMessage(ChatColor.YELLOW + "Builder: " + "" + ChatColor.GRAY + players.get(voteInt).getName());
- //send message
- }
- }
- public void timePast() {
- if(isStarted) {
- timeLeft--;
- if(timeLeft <= 10 || timeLeft == 15 || timeLeft == 20 || timeLeft == 30 || timeLeft == 60 || timeLeft == 120 || timeLeft == 300 || timeLeft == 500 || timeLeft == 1000 || timeLeft == 2000) {
- Bukkit.broadcastMessage(ChatColor.RED + "" + timeLeft + "" + ChatColor.YELLOW + " seconds left!");
- }
- if(timeLeft < 0) {
- startVoting();
- }
- }
- }
- public Boolean playerVote(Player p, Integer amount) {
- if(players.get(voteInt) == p) {
- return false;
- } else {
- currentvote.put(p, amount);
- return true;
- }
- }
- public void nextVote(Player p) {
- for (Player key : spawnLoc.keySet()) {
- if(currentvote.containsKey(key)) {
- if(points.containsKey(p)) {
- Integer currentp = points.get(p);
- currentp = currentp + currentvote.get(key);
- points.put(p, currentp);
- } else {
- points.put(p, currentvote.get(key));
- }
- } else if (key != players.get(voteInt)){
- if(points.containsKey(p)) {
- Integer currentp = points.get(p);
- currentp = currentp + 5;
- points.put(p, currentp);
- } else {
- points.put(p, 5);
- }
- }
- }
- currentvote.clear();
- voteInt++;
- if(voteInt >= players.size()) {
- stopGame();
- } else {
- p = players.get(voteInt);
- for(Player p2 : players) {
- p2.teleport(spawnLoc.get(p));
- }
- instance.voting(p);
- Bukkit.broadcastMessage(ChatColor.YELLOW + "Builder: " + "" + ChatColor.GRAY + players.get(voteInt).getName());
- }
- }
- public Player getWinner() {
- Player winner = null;
- for (Player key : points.keySet()) {
- if(winner == null) {
- winner = key;
- } else {
- if(points.get(winner) < points.get(key)) {
- winner = key;
- }
- }
- }
- return winner;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement