Advertisement
Guest User

UltimateSheepWars Contributor god & fly mode

a guest
Jul 19th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.36 KB | None | 0 0
  1.             if (itemStack.getItemMeta().getDisplayName().contains("Close")) {
  2.                 Sounds.playSound(player, player.getLocation(), Sounds.CHICKEN_EGG_POP, 1.0f, 1.0f);
  3.                 player.closeInventory();
  4.             }
  5.             else if (itemStack.getItemMeta().getDisplayName().contains("GOD MODE") && this.contributor.getLevel() > 3) {
  6.                 player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, Integer.MAX_VALUE, 10, false, false));
  7.                 player.sendMessage("God mode enabled.");
  8.                 player.closeInventory();
  9.             }
  10.             else if (itemStack.getItemMeta().getDisplayName().contains("FLY") && this.contributor.getLevel() > 3) {
  11.                 player.sendMessage("Fly mode enabled.");
  12.                 final Iterator<Player> iterator = Bukkit.getOnlinePlayers().iterator();
  13.                 while (iterator.hasNext()) {
  14.                     iterator.next().hidePlayer(player);
  15.                 }
  16.                 player.setAllowFlight(true);
  17.                 player.setFlying(true);
  18.                 player.setVelocity(new Vector(0.0, 3.0, 0.0));
  19.                 if (player.getLocation().getY() <= 0.0) {
  20.                     player.setVelocity(new Vector(0.0, 10.0, 0.0));
  21.                 }
  22.                 player.closeInventory();
  23.                 new BukkitRunnable(this, player) {
  24.                     final ContributorsInventory this$0;
  25.                     private final Player val$clicker;
  26.                    
  27.                     ContributorsInventory$1(final ContributorsInventory this$0, final Player val$clicker) {
  28.                         this.this$0 = this$0;
  29.                         this.val$clicker = val$clicker;
  30.                         super();
  31.                     }
  32.                    
  33.                     public void run() {
  34.                         if (this.val$clicker.getLocation().subtract(0.0, 1.0, 0.0).getBlock().getType() != Material.AIR) {
  35.                             final Iterator<Player> iterator = Bukkit.getOnlinePlayers().iterator();
  36.                             while (iterator.hasNext()) {
  37.                                 iterator.next().showPlayer(this.val$clicker);
  38.                             }
  39.                             this.cancel();
  40.                         }
  41.                     }
  42.                 }.runTaskTimer((Plugin)this.plugin, 30L, 0L);
  43.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement