From 844f6f26df6ca5fff1b179128fe0b87afaa430eb Mon Sep 17 00:00:00 2001 From: kaboom <58372747+kaboombot@users.noreply.github.com> Date: Fri, 20 May 2022 04:44:37 +0300 Subject: [PATCH] Use spaces instead of tabs --- pom.xml | 96 +++++------ src/main/java/pw/kaboom/weapons/Main.java | 108 ++++++------- .../weapons/commands/CommandWeapons.java | 56 +++---- .../modules/player/PlayerReceiveWeapon.java | 22 +-- .../modules/player/PlayerUseWeapon.java | 62 +++---- .../modules/weapons/WeaponAnvilDropper.java | 40 ++--- .../weapons/modules/weapons/WeaponArcher.java | 98 +++++------ .../modules/weapons/WeaponArmageddon.java | 104 ++++++------ .../modules/weapons/WeaponBlobinator.java | 134 +++++++-------- .../modules/weapons/WeaponGrenade.java | 76 ++++----- .../weapons/modules/weapons/WeaponLaser.java | 128 +++++++-------- .../modules/weapons/WeaponLightningStick.java | 24 +-- .../modules/weapons/WeaponMachineGun.java | 152 +++++++++--------- .../weapons/modules/weapons/WeaponNuker.java | 66 ++++---- .../weapons/modules/weapons/WeaponSniper.java | 84 +++++----- suppressions.xml | 9 +- 16 files changed, 629 insertions(+), 630 deletions(-) diff --git a/pom.xml b/pom.xml index 1a292b5..b2883d1 100644 --- a/pom.xml +++ b/pom.xml @@ -1,55 +1,55 @@ - 4.0.0 - pw.kaboom - Weapons - master + 4.0.0 + pw.kaboom + Weapons + master - - 1.8 - 1.8 - true - UTF-8 - + + 1.8 + 1.8 + true + UTF-8 + - - - com.destroystokyo.paper - paper-api - 1.13.2-R0.1-SNAPSHOT - - + + + com.destroystokyo.paper + paper-api + 1.13.2-R0.1-SNAPSHOT + + - - - papermc - https://papermc.io/repo/repository/maven-public/ - - + + + papermc + https://papermc.io/repo/repository/maven-public/ + + - - ${project.artifactId} - - - org.apache.maven.plugins - maven-checkstyle-plugin - 3.1.2 - - - checkstyle - validate - - check - - - - suppressions.xml - - true - - - - - - + + ${project.artifactId} + + + org.apache.maven.plugins + maven-checkstyle-plugin + 3.1.2 + + + checkstyle + validate + + check + + + + suppressions.xml + + true + + + + + + diff --git a/src/main/java/pw/kaboom/weapons/Main.java b/src/main/java/pw/kaboom/weapons/Main.java index 32567a9..76d363c 100644 --- a/src/main/java/pw/kaboom/weapons/Main.java +++ b/src/main/java/pw/kaboom/weapons/Main.java @@ -19,65 +19,65 @@ import pw.kaboom.weapons.modules.weapons.WeaponGrenade; import pw.kaboom.weapons.modules.weapons.WeaponMachineGun; public final class Main extends JavaPlugin { - private static HashSet blockFaces = new HashSet(); - private static List colors = new ArrayList(); + private static HashSet blockFaces = new HashSet(); + private static List colors = new ArrayList(); - @Override - public void onLoad() { - /* Fill lists */ - Collections.addAll( - blockFaces, - BlockFace.NORTH, - BlockFace.SOUTH, - BlockFace.WEST, - BlockFace.EAST, - BlockFace.UP, - BlockFace.DOWN - ); + @Override + public void onLoad() { + /* Fill lists */ + Collections.addAll( + blockFaces, + BlockFace.NORTH, + BlockFace.SOUTH, + BlockFace.WEST, + BlockFace.EAST, + BlockFace.UP, + BlockFace.DOWN + ); - Collections.addAll( - colors, - Material.BLACK_WOOL, - Material.BLUE_WOOL, - Material.BROWN_WOOL, - Material.CYAN_WOOL, - Material.GRAY_WOOL, - Material.GREEN_WOOL, - Material.LIGHT_BLUE_WOOL, - Material.LIGHT_GRAY_WOOL, - Material.LIME_WOOL, - Material.MAGENTA_WOOL, - Material.ORANGE_WOOL, - Material.PINK_WOOL, - Material.PURPLE_WOOL, - Material.RED_WOOL, - Material.WHITE_WOOL, - Material.YELLOW_WOOL - ); - } + Collections.addAll( + colors, + Material.BLACK_WOOL, + Material.BLUE_WOOL, + Material.BROWN_WOOL, + Material.CYAN_WOOL, + Material.GRAY_WOOL, + Material.GREEN_WOOL, + Material.LIGHT_BLUE_WOOL, + Material.LIGHT_GRAY_WOOL, + Material.LIME_WOOL, + Material.MAGENTA_WOOL, + Material.ORANGE_WOOL, + Material.PINK_WOOL, + Material.PURPLE_WOOL, + Material.RED_WOOL, + Material.WHITE_WOOL, + Material.YELLOW_WOOL + ); + } - @Override - public void onEnable() { - /* Commands */ - this.getCommand("weapons").setExecutor(new CommandWeapons()); + @Override + public void onEnable() { + /* Commands */ + this.getCommand("weapons").setExecutor(new CommandWeapons()); - /* Player Events */ - this.getServer().getPluginManager().registerEvents(new PlayerReceiveWeapon(), this); - this.getServer().getPluginManager().registerEvents(new PlayerUseWeapon(), this); + /* Player Events */ + this.getServer().getPluginManager().registerEvents(new PlayerReceiveWeapon(), this); + this.getServer().getPluginManager().registerEvents(new PlayerUseWeapon(), this); - /* Weapon Events */ - this.getServer().getPluginManager().registerEvents(new WeaponArcher(), this); - this.getServer().getPluginManager().registerEvents(new WeaponArmageddon(), this); - this.getServer().getPluginManager().registerEvents(new WeaponBlobinator(), this); - this.getServer().getPluginManager().registerEvents(new WeaponGrenade(), this); - this.getServer().getPluginManager().registerEvents(new WeaponMachineGun(), this); - } + /* Weapon Events */ + this.getServer().getPluginManager().registerEvents(new WeaponArcher(), this); + this.getServer().getPluginManager().registerEvents(new WeaponArmageddon(), this); + this.getServer().getPluginManager().registerEvents(new WeaponBlobinator(), this); + this.getServer().getPluginManager().registerEvents(new WeaponGrenade(), this); + this.getServer().getPluginManager().registerEvents(new WeaponMachineGun(), this); + } - public static HashSet getBlockFaces() { - return blockFaces; - } + public static HashSet getBlockFaces() { + return blockFaces; + } - public static List getColors() { - return colors; - } + public static List getColors() { + return colors; + } } diff --git a/src/main/java/pw/kaboom/weapons/commands/CommandWeapons.java b/src/main/java/pw/kaboom/weapons/commands/CommandWeapons.java index 8040d96..6b95596 100644 --- a/src/main/java/pw/kaboom/weapons/commands/CommandWeapons.java +++ b/src/main/java/pw/kaboom/weapons/commands/CommandWeapons.java @@ -12,35 +12,35 @@ import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.ItemMeta; public final class CommandWeapons implements CommandExecutor { - private void addWeapon(final Inventory inventory, final Material material, final String name) { - final ItemStack item = new ItemStack(material, 1); - final ItemMeta itemMeta = item.getItemMeta(); + private void addWeapon(final Inventory inventory, final Material material, final String name) { + final ItemStack item = new ItemStack(material, 1); + final ItemMeta itemMeta = item.getItemMeta(); - itemMeta.setDisplayName(name); - item.setItemMeta(itemMeta); - inventory.addItem(item); - } + itemMeta.setDisplayName(name); + item.setItemMeta(itemMeta); + inventory.addItem(item); + } - @Override - public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) { - if (sender instanceof ConsoleCommandSender) { - sender.sendMessage("Command has to be run by a player"); - } else { - final Player player = (Player) sender; - final Inventory inventory = Bukkit.createInventory(null, 18, "Weapons"); + @Override + public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) { + if (sender instanceof ConsoleCommandSender) { + sender.sendMessage("Command has to be run by a player"); + } else { + final Player player = (Player) sender; + final Inventory inventory = Bukkit.createInventory(null, 18, "Weapons"); - addWeapon(inventory, Material.ANVIL, "§rAnvil Dropper"); - addWeapon(inventory, Material.SPECTRAL_ARROW, "§rArcher"); - addWeapon(inventory, Material.FIRE_CHARGE, "§rArmageddon"); - addWeapon(inventory, Material.MAGMA_CREAM, "§rBlobinator"); - addWeapon(inventory, Material.EGG, "§rGrenade"); - addWeapon(inventory, Material.BLAZE_POWDER, "§rLaser"); - addWeapon(inventory, Material.STICK, "§rLightning Stick"); - addWeapon(inventory, Material.GOLDEN_HORSE_ARMOR, "§rMachine Gun"); - addWeapon(inventory, Material.BLAZE_ROD, "§rNuker"); - addWeapon(inventory, Material.IRON_HORSE_ARMOR, "§rSniper"); - player.openInventory(inventory); - } - return true; - } + addWeapon(inventory, Material.ANVIL, "§rAnvil Dropper"); + addWeapon(inventory, Material.SPECTRAL_ARROW, "§rArcher"); + addWeapon(inventory, Material.FIRE_CHARGE, "§rArmageddon"); + addWeapon(inventory, Material.MAGMA_CREAM, "§rBlobinator"); + addWeapon(inventory, Material.EGG, "§rGrenade"); + addWeapon(inventory, Material.BLAZE_POWDER, "§rLaser"); + addWeapon(inventory, Material.STICK, "§rLightning Stick"); + addWeapon(inventory, Material.GOLDEN_HORSE_ARMOR, "§rMachine Gun"); + addWeapon(inventory, Material.BLAZE_ROD, "§rNuker"); + addWeapon(inventory, Material.IRON_HORSE_ARMOR, "§rSniper"); + player.openInventory(inventory); + } + return true; + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/player/PlayerReceiveWeapon.java b/src/main/java/pw/kaboom/weapons/modules/player/PlayerReceiveWeapon.java index f334e40..1817543 100644 --- a/src/main/java/pw/kaboom/weapons/modules/player/PlayerReceiveWeapon.java +++ b/src/main/java/pw/kaboom/weapons/modules/player/PlayerReceiveWeapon.java @@ -7,18 +7,18 @@ import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.inventory.ItemStack; public final class PlayerReceiveWeapon implements Listener { - @EventHandler - void onInventoryClick(final InventoryClickEvent event) { - if (event.isCancelled() || !"Weapons".equals(event.getView().getTitle())) { - return; - } + @EventHandler + void onInventoryClick(final InventoryClickEvent event) { + if (event.isCancelled() || !"Weapons".equals(event.getView().getTitle())) { + return; + } - final ItemStack item = event.getCurrentItem(); - final Player player = (Player) event.getWhoClicked(); + final ItemStack item = event.getCurrentItem(); + final Player player = (Player) event.getWhoClicked(); - player.getInventory().addItem(item); - player.closeInventory(); - player.sendMessage("You have received the " + item.getItemMeta().getDisplayName().toLowerCase() + "!"); - } + player.getInventory().addItem(item); + player.closeInventory(); + player.sendMessage("You have received the " + item.getItemMeta().getDisplayName().toLowerCase() + "!"); + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/player/PlayerUseWeapon.java b/src/main/java/pw/kaboom/weapons/modules/player/PlayerUseWeapon.java index d39a161..93248be 100644 --- a/src/main/java/pw/kaboom/weapons/modules/player/PlayerUseWeapon.java +++ b/src/main/java/pw/kaboom/weapons/modules/player/PlayerUseWeapon.java @@ -19,39 +19,39 @@ import pw.kaboom.weapons.modules.weapons.WeaponNuker; import pw.kaboom.weapons.modules.weapons.WeaponSniper; public final class PlayerUseWeapon implements Listener { - @EventHandler - void onPlayerInteract(final PlayerInteractEvent event) { - if ((event.useInteractedBlock() == Result.DENY && event.useItemInHand() == Result.DENY) - || !event.hasItem()) { - return; - } + @EventHandler + void onPlayerInteract(final PlayerInteractEvent event) { + if ((event.useInteractedBlock() == Result.DENY && event.useItemInHand() == Result.DENY) + || !event.hasItem()) { + return; + } - String name = ""; + String name = ""; - try { - name = event.getItem().getItemMeta().getDisplayName(); - } catch (Exception ignored) { - return; - } + try { + name = event.getItem().getItemMeta().getDisplayName(); + } catch (Exception ignored) { + return; + } - final Action action = event.getAction(); - final Material item = event.getMaterial(); + final Action action = event.getAction(); + final Material item = event.getMaterial(); - if (action == Action.LEFT_CLICK_AIR - || action == Action.LEFT_CLICK_BLOCK) { - WeaponAnvilDropper.leftClick(item, name, event); - WeaponArcher.leftClick(item, name, event); - WeaponArmageddon.leftClick(item, name, event); - WeaponBlobinator.leftClick(item, name, event); - WeaponLightningStick.leftClick(item, name, event); - WeaponNuker.leftClick(item, name, event); - WeaponSniper.leftClick(item, name, event); - } else if (action == Action.RIGHT_CLICK_AIR - || action == Action.RIGHT_CLICK_BLOCK) { - WeaponGrenade.rightClick(item, name, event); - WeaponLaser.rightClick(item, name, event); - WeaponMachineGun.rightClick(item, name, event); - WeaponSniper.rightClick(item, name, event); - } - } + if (action == Action.LEFT_CLICK_AIR + || action == Action.LEFT_CLICK_BLOCK) { + WeaponAnvilDropper.leftClick(item, name, event); + WeaponArcher.leftClick(item, name, event); + WeaponArmageddon.leftClick(item, name, event); + WeaponBlobinator.leftClick(item, name, event); + WeaponLightningStick.leftClick(item, name, event); + WeaponNuker.leftClick(item, name, event); + WeaponSniper.leftClick(item, name, event); + } else if (action == Action.RIGHT_CLICK_AIR + || action == Action.RIGHT_CLICK_BLOCK) { + WeaponGrenade.rightClick(item, name, event); + WeaponLaser.rightClick(item, name, event); + WeaponMachineGun.rightClick(item, name, event); + WeaponSniper.rightClick(item, name, event); + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponAnvilDropper.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponAnvilDropper.java index c22a1eb..9af2a93 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponAnvilDropper.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponAnvilDropper.java @@ -6,27 +6,27 @@ import org.bukkit.World; import org.bukkit.event.player.PlayerInteractEvent; public final class WeaponAnvilDropper { - private WeaponAnvilDropper() { - } + private WeaponAnvilDropper() { + } - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.ANVIL - && ("§rAnvil Dropper".equals(name) || "Anvil Dropper".equals(name))) { - final int min = -2; - final int max = 2; + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.ANVIL + && ("§rAnvil Dropper".equals(name) || "Anvil Dropper".equals(name))) { + final int min = -2; + final int max = 2; - for (int x = min; x <= max; x++) { - for (int z = min; z <= max; z++) { - final Location blockLocation = event.getPlayer().getLocation().subtract(x, 0, z); - final World world = event.getPlayer().getWorld(); + for (int x = min; x <= max; x++) { + for (int z = min; z <= max; z++) { + final Location blockLocation = event.getPlayer().getLocation().subtract(x, 0, z); + final World world = event.getPlayer().getWorld(); - world.spawnFallingBlock( - blockLocation, - Material.ANVIL.createBlockData() - ); - } - } - event.setCancelled(true); - } - } + world.spawnFallingBlock( + blockLocation, + Material.ANVIL.createBlockData() + ); + } + } + event.setCancelled(true); + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArcher.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArcher.java index cfcd5a9..c86c802 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArcher.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArcher.java @@ -17,62 +17,62 @@ import org.bukkit.util.Vector; import com.destroystokyo.paper.event.entity.ProjectileCollideEvent; public final class WeaponArcher implements Listener { - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.SPECTRAL_ARROW - && ("§rArcher".equals(name) || "Archer".equals(name))) { - final Player player = event.getPlayer(); - final World world = player.getWorld(); + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.SPECTRAL_ARROW + && ("§rArcher".equals(name) || "Archer".equals(name))) { + final Player player = event.getPlayer(); + final World world = player.getWorld(); - final int maxArrowCount = 20; + final int maxArrowCount = 20; - for (int i = 0; i <= maxArrowCount; i++) { - final double randomX = (Math.random() * ((15 + 15) + 1)) - 15; - final double randomY = (Math.random() * ((15 + 15) + 1)) - 15; - final double randomZ = (Math.random() * ((15 + 15) + 1)) - 15; + for (int i = 0; i <= maxArrowCount; i++) { + final double randomX = (Math.random() * ((15 + 15) + 1)) - 15; + final double randomY = (Math.random() * ((15 + 15) + 1)) - 15; + final double randomZ = (Math.random() * ((15 + 15) + 1)) - 15; - final Vector randomDirection = new Vector( - randomX, - randomY, - randomZ).normalize().multiply(8); + final Vector randomDirection = new Vector( + randomX, + randomY, + randomZ).normalize().multiply(8); - final SpectralArrow arrow = (SpectralArrow) world.spawnEntity( - player.getLocation(), - EntityType.SPECTRAL_ARROW - ); - arrow.setCustomName("WeaponArcherArrow"); - arrow.setShooter(player); - arrow.setVelocity(randomDirection); - } + final SpectralArrow arrow = (SpectralArrow) world.spawnEntity( + player.getLocation(), + EntityType.SPECTRAL_ARROW + ); + arrow.setCustomName("WeaponArcherArrow"); + arrow.setShooter(player); + arrow.setVelocity(randomDirection); + } - final Location eyeLocation = player.getEyeLocation(); - final float volume = 1.0F; - final float pitch = 1.5F; + final Location eyeLocation = player.getEyeLocation(); + final float volume = 1.0F; + final float pitch = 1.5F; - world.playSound( - eyeLocation, - Sound.BLOCK_ANVIL_DESTROY, - volume, - pitch - ); - event.setCancelled(true); - } - } + world.playSound( + eyeLocation, + Sound.BLOCK_ANVIL_DESTROY, + volume, + pitch + ); + event.setCancelled(true); + } + } - /* Make shooter invulnerable to weapon projectiles */ - @EventHandler - private void onProjectileCollide(final ProjectileCollideEvent event) { - if (event.getEntityType() == EntityType.SPECTRAL_ARROW) { - final Projectile projectile = event.getEntity(); + /* Make shooter invulnerable to weapon projectiles */ + @EventHandler + private void onProjectileCollide(final ProjectileCollideEvent event) { + if (event.getEntityType() == EntityType.SPECTRAL_ARROW) { + final Projectile projectile = event.getEntity(); - if ("WeaponArcherArrow".equals(projectile.getCustomName())) { - final Entity collidedWith = event.getCollidedWith(); + if ("WeaponArcherArrow".equals(projectile.getCustomName())) { + final Entity collidedWith = event.getCollidedWith(); - if (collidedWith.getType() == EntityType.PLAYER - && projectile.getShooter() instanceof Player - && ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) { - event.setCancelled(true); - } - } - } - } + if (collidedWith.getType() == EntityType.PLAYER + && projectile.getShooter() instanceof Player + && ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) { + event.setCancelled(true); + } + } + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArmageddon.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArmageddon.java index 36e51d4..de61d56 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArmageddon.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponArmageddon.java @@ -17,67 +17,67 @@ import org.bukkit.util.Vector; import com.destroystokyo.paper.event.entity.ProjectileCollideEvent; public final class WeaponArmageddon implements Listener { - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.FIRE_CHARGE - && ("§rArmageddon".equals(name) || "Armageddon".equals(name))) { - final Player player = event.getPlayer(); - final World world = player.getWorld(); + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.FIRE_CHARGE + && ("§rArmageddon".equals(name) || "Armageddon".equals(name))) { + final Player player = event.getPlayer(); + final World world = player.getWorld(); - final int min = -12; - final int max = 12; - final int iteratorSpacing = 4; + final int min = -12; + final int max = 12; + final int iteratorSpacing = 4; - for (int i = min; i <= max; i += iteratorSpacing) { - final Location eyeLocation = player.getEyeLocation(); + for (int i = min; i <= max; i += iteratorSpacing) { + final Location eyeLocation = player.getEyeLocation(); - final double x = i * Math.cos(Math.toRadians(eyeLocation.getYaw())); - final double z = i * Math.sin(Math.toRadians(eyeLocation.getYaw())); + final double x = i * Math.cos(Math.toRadians(eyeLocation.getYaw())); + final double z = i * Math.sin(Math.toRadians(eyeLocation.getYaw())); - final Vector velocity = eyeLocation.getDirection().multiply(12); - final int yield = 5; + final Vector velocity = eyeLocation.getDirection().multiply(12); + final int yield = 5; - final Fireball fireball = (Fireball) world.spawnEntity( - eyeLocation.add(x, 0, z), - EntityType.FIREBALL - ); + final Fireball fireball = (Fireball) world.spawnEntity( + eyeLocation.add(x, 0, z), + EntityType.FIREBALL + ); - fireball.setBounce(false); - fireball.setCustomName("WeaponArmegaddonCharge"); - fireball.setDirection(velocity); - fireball.setShooter(player); - fireball.setYield(yield); - } + fireball.setBounce(false); + fireball.setCustomName("WeaponArmegaddonCharge"); + fireball.setDirection(velocity); + fireball.setShooter(player); + fireball.setYield(yield); + } - final Location eyeLocation = player.getEyeLocation(); - final float volume = 0.9F; - final float pitch = 1.5F; + final Location eyeLocation = player.getEyeLocation(); + final float volume = 0.9F; + final float pitch = 1.5F; - world.playSound( - eyeLocation, - Sound.ENTITY_GHAST_SHOOT, - volume, - pitch - ); - event.setCancelled(true); - } - } + world.playSound( + eyeLocation, + Sound.ENTITY_GHAST_SHOOT, + volume, + pitch + ); + event.setCancelled(true); + } + } - /* Make shooter invulnerable to weapon projectiles, and prevent charges from colliding with each other */ - @EventHandler - private void onProjectileCollide(final ProjectileCollideEvent event) { - if (event.getEntityType() == EntityType.FIREBALL) { - final Projectile projectile = event.getEntity(); + /* Make shooter invulnerable to weapon projectiles, and prevent charges from colliding with each other */ + @EventHandler + private void onProjectileCollide(final ProjectileCollideEvent event) { + if (event.getEntityType() == EntityType.FIREBALL) { + final Projectile projectile = event.getEntity(); - if ("WeaponArmegaddonCharge".equals(projectile.getCustomName())) { - final Entity collidedWith = event.getCollidedWith(); + if ("WeaponArmegaddonCharge".equals(projectile.getCustomName())) { + final Entity collidedWith = event.getCollidedWith(); - if ((collidedWith.getType() == EntityType.PLAYER - && projectile.getShooter() instanceof Player - && ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) - || collidedWith.getType() == EntityType.FIREBALL) { - event.setCancelled(true); - } - } - } - } + if ((collidedWith.getType() == EntityType.PLAYER + && projectile.getShooter() instanceof Player + && ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) + || collidedWith.getType() == EntityType.FIREBALL) { + event.setCancelled(true); + } + } + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponBlobinator.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponBlobinator.java index 706855d..6a16a62 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponBlobinator.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponBlobinator.java @@ -23,82 +23,82 @@ import com.destroystokyo.paper.event.entity.ProjectileCollideEvent; import pw.kaboom.weapons.Main; public final class WeaponBlobinator implements Listener { - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.MAGMA_CREAM - && ("§rBlobinator".equals(name) || "Blobinator".equals(name))) { - final Player player = event.getPlayer(); - final Location eyeLocation = player.getEyeLocation(); - final Vector velocity = eyeLocation.getDirection().multiply(8); + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.MAGMA_CREAM + && ("§rBlobinator".equals(name) || "Blobinator".equals(name))) { + final Player player = event.getPlayer(); + final Location eyeLocation = player.getEyeLocation(); + final Vector velocity = eyeLocation.getDirection().multiply(8); - final Snowball snowball = player.launchProjectile(Snowball.class); - snowball.setCustomName("WeaponBlobinatorBall"); - snowball.setShooter(player); - snowball.setVelocity(velocity); + final Snowball snowball = player.launchProjectile(Snowball.class); + snowball.setCustomName("WeaponBlobinatorBall"); + snowball.setShooter(player); + snowball.setVelocity(velocity); - final World world = player.getWorld(); - final float volume = 1.0F; - final float pitch = 0.8F; + final World world = player.getWorld(); + final float volume = 1.0F; + final float pitch = 0.8F; - world.playSound( - eyeLocation, - Sound.ITEM_BOTTLE_EMPTY, - volume, - pitch - ); - event.setCancelled(true); - } - } + world.playSound( + eyeLocation, + Sound.ITEM_BOTTLE_EMPTY, + volume, + pitch + ); + event.setCancelled(true); + } + } - private void createBlobSplash(final World world, final int x, final int y, final int z, final int radius, final Block hitBlock, final Material color) { - final Location blockLocation = hitBlock.getLocation().add(x, y, z); + private void createBlobSplash(final World world, final int x, final int y, final int z, final int radius, final Block hitBlock, final Material color) { + final Location blockLocation = hitBlock.getLocation().add(x, y, z); - if (blockLocation.distance(hitBlock.getLocation()) <= radius) { - final Block block = world.getBlockAt(blockLocation); + if (blockLocation.distance(hitBlock.getLocation()) <= radius) { + final Block block = world.getBlockAt(blockLocation); - if (block.getType() != Material.AIR - && block.getType() != Material.CAVE_AIR) { - for (BlockFace face : Main.getBlockFaces()) { - if (block.getRelative(face).getType() == Material.AIR - || block.getRelative(face).getType() == Material.CAVE_AIR) { - block.setType(color); - } - } - } - } - } + if (block.getType() != Material.AIR + && block.getType() != Material.CAVE_AIR) { + for (BlockFace face : Main.getBlockFaces()) { + if (block.getRelative(face).getType() == Material.AIR + || block.getRelative(face).getType() == Material.CAVE_AIR) { + block.setType(color); + } + } + } + } + } - @EventHandler - private void onProjectileCollide(final ProjectileCollideEvent event) { - if (event.getEntityType() == EntityType.SNOWBALL) { - final Projectile projectile = event.getEntity(); + @EventHandler + private void onProjectileCollide(final ProjectileCollideEvent event) { + if (event.getEntityType() == EntityType.SNOWBALL) { + final Projectile projectile = event.getEntity(); - if ("WeaponBlobinatorBall".equals(projectile.getCustomName())) { - event.setCancelled(true); - } - } - } + if ("WeaponBlobinatorBall".equals(projectile.getCustomName())) { + event.setCancelled(true); + } + } + } - @EventHandler - private void onProjectileHit(final ProjectileHitEvent event) { - if (event.getEntityType() == EntityType.SNOWBALL) { - final Block hitBlock = event.getHitBlock(); - final Projectile projectile = event.getEntity(); + @EventHandler + private void onProjectileHit(final ProjectileHitEvent event) { + if (event.getEntityType() == EntityType.SNOWBALL) { + final Block hitBlock = event.getHitBlock(); + final Projectile projectile = event.getEntity(); - if (hitBlock != null - && "WeaponBlobinatorBall".equals(projectile.getCustomName())) { - final int radius = 4; - final World world = projectile.getWorld(); - final Random random = new Random(); - final Material color = Main.getColors().get(random.nextInt(Main.getColors().size())); + if (hitBlock != null + && "WeaponBlobinatorBall".equals(projectile.getCustomName())) { + final int radius = 4; + final World world = projectile.getWorld(); + final Random random = new Random(); + final Material color = Main.getColors().get(random.nextInt(Main.getColors().size())); - for (int x = -radius; x < radius; x++) { - for (int y = -radius; y < radius; y++) { - for (int z = -radius; z < radius; z++) { - createBlobSplash(world, x, y, z, radius, hitBlock, color); - } - } - } - } - } - } + for (int x = -radius; x < radius; x++) { + for (int y = -radius; y < radius; y++) { + for (int z = -radius; z < radius; z++) { + createBlobSplash(world, x, y, z, radius, hitBlock, color); + } + } + } + } + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponGrenade.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponGrenade.java index a413ab0..8c1978d 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponGrenade.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponGrenade.java @@ -15,50 +15,50 @@ import org.bukkit.event.player.PlayerEggThrowEvent; import org.bukkit.event.player.PlayerInteractEvent; public final class WeaponGrenade implements Listener { - public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.EGG - && ("§rGrenade".equals(name) || "Grenade".equals(name))) { - event.setCancelled(true); + public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.EGG + && ("§rGrenade".equals(name) || "Grenade".equals(name))) { + event.setCancelled(true); - final Player player = event.getPlayer(); - final Location eyeLocation = player.getEyeLocation(); + final Player player = event.getPlayer(); + final Location eyeLocation = player.getEyeLocation(); - final Egg egg = player.launchProjectile(Egg.class); - egg.setCustomName("WeaponGrenade"); - egg.setShooter(player); + final Egg egg = player.launchProjectile(Egg.class); + egg.setCustomName("WeaponGrenade"); + egg.setShooter(player); - final World world = player.getWorld(); - final float volume = 1.0F; - final float pitch = 1.0F; + final World world = player.getWorld(); + final float volume = 1.0F; + final float pitch = 1.0F; - world.playSound( - eyeLocation, - Sound.ENTITY_EGG_THROW, - volume, - pitch - ); - } - } + world.playSound( + eyeLocation, + Sound.ENTITY_EGG_THROW, + volume, + pitch + ); + } + } - @EventHandler - private void onPlayerEggThrow(final PlayerEggThrowEvent event) { - if ("WeaponGrenade".equals(event.getEgg().getCustomName())) { - event.setHatching(false); - } - } + @EventHandler + private void onPlayerEggThrow(final PlayerEggThrowEvent event) { + if ("WeaponGrenade".equals(event.getEgg().getCustomName())) { + event.setHatching(false); + } + } - @EventHandler - private void onProjectileHit(final ProjectileHitEvent event) { - if (event.getEntityType() == EntityType.EGG) { - final Projectile projectile = event.getEntity(); + @EventHandler + private void onProjectileHit(final ProjectileHitEvent event) { + if (event.getEntityType() == EntityType.EGG) { + final Projectile projectile = event.getEntity(); - if ("WeaponGrenade".equals(projectile.getCustomName())) { - final Location location = projectile.getLocation(); - final World world = location.getWorld(); - final float power = 6; + if ("WeaponGrenade".equals(projectile.getCustomName())) { + final Location location = projectile.getLocation(); + final World world = location.getWorld(); + final float power = 6; - world.createExplosion(location, power); - } - } - } + world.createExplosion(location, power); + } + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLaser.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLaser.java index a291936..c0483da 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLaser.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLaser.java @@ -14,80 +14,80 @@ import org.bukkit.util.BlockIterator; import org.bukkit.util.Vector; public final class WeaponLaser { - private WeaponLaser() { - } + private WeaponLaser() { + } - public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.BLAZE_POWDER - && ("§rLaser".equals(name) || "Laser".equals(name))) { - final Player player = event.getPlayer(); - final Location eyeLocation = player.getEyeLocation(); - final Vector direction = eyeLocation.getDirection(); - final int distance = 100; - final Location particleLocation = player.getEyeLocation(); - final World world = player.getWorld(); + public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.BLAZE_POWDER + && ("§rLaser".equals(name) || "Laser".equals(name))) { + final Player player = event.getPlayer(); + final Location eyeLocation = player.getEyeLocation(); + final Vector direction = eyeLocation.getDirection(); + final int distance = 100; + final Location particleLocation = player.getEyeLocation(); + final World world = player.getWorld(); - for (int i = 0; i <= distance; i++) { - particleLocation.add(direction); + for (int i = 0; i <= distance; i++) { + particleLocation.add(direction); - final int count = 1; - final double offsetX = 0; - final double offsetY = 0; - final double offsetZ = 0; + final int count = 1; + final double offsetX = 0; + final double offsetY = 0; + final double offsetZ = 0; - final Random random = new Random(); - final int size = 1; - final Particle.DustOptions dustOptions = new Particle.DustOptions( - random.nextBoolean() ? Color.TEAL : Color.RED, - size - ); + final Random random = new Random(); + final int size = 1; + final Particle.DustOptions dustOptions = new Particle.DustOptions( + random.nextBoolean() ? Color.TEAL : Color.RED, + size + ); - world.spawnParticle( - Particle.REDSTONE, - particleLocation, - count, - offsetX, - offsetY, - offsetZ, - dustOptions - ); - } + world.spawnParticle( + Particle.REDSTONE, + particleLocation, + count, + offsetX, + offsetY, + offsetZ, + dustOptions + ); + } - final Vector start = eyeLocation.toVector(); - final int yOffset = 0; + final Vector start = eyeLocation.toVector(); + final int yOffset = 0; - final BlockIterator blockIterator = new BlockIterator( - world, - start, - direction, - yOffset, - distance - ); + final BlockIterator blockIterator = new BlockIterator( + world, + start, + direction, + yOffset, + distance + ); - while (blockIterator.hasNext()) { - blockIterator.next().breakNaturally(); - } + while (blockIterator.hasNext()) { + blockIterator.next().breakNaturally(); + } - final float volume = 0.8F; - final float pitch = 63.0F; + final float volume = 0.8F; + final float pitch = 63.0F; - world.playSound( - eyeLocation, - Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR, - volume, - pitch - ); + world.playSound( + eyeLocation, + Sound.ENTITY_FIREWORK_ROCKET_BLAST_FAR, + volume, + pitch + ); - final float volume2 = 1.0F; - final float pitch2 = 20.0F; + final float volume2 = 1.0F; + final float pitch2 = 20.0F; - world.playSound( - eyeLocation, - Sound.ENTITY_FIREWORK_ROCKET_BLAST, - volume2, - pitch2 - ); - event.setCancelled(true); - } - } + world.playSound( + eyeLocation, + Sound.ENTITY_FIREWORK_ROCKET_BLAST, + volume2, + pitch2 + ); + event.setCancelled(true); + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLightningStick.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLightningStick.java index ceef8c3..280c377 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLightningStick.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponLightningStick.java @@ -8,18 +8,18 @@ import org.bukkit.World; import org.bukkit.event.player.PlayerInteractEvent; public final class WeaponLightningStick { - private WeaponLightningStick() { - } + private WeaponLightningStick() { + } - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.STICK - && ("§rLightning Stick".equals(name) || "Lightning Stick".equals(name))) { - final int maxDistance = 100; - final Location lookLocation = event.getPlayer().getTargetBlock((Set) null, maxDistance).getLocation(); - final World world = event.getPlayer().getWorld(); + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.STICK + && ("§rLightning Stick".equals(name) || "Lightning Stick".equals(name))) { + final int maxDistance = 100; + final Location lookLocation = event.getPlayer().getTargetBlock((Set) null, maxDistance).getLocation(); + final World world = event.getPlayer().getWorld(); - world.strikeLightning(lookLocation); - event.setCancelled(true); - } - } + world.strikeLightning(lookLocation); + event.setCancelled(true); + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponMachineGun.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponMachineGun.java index e2fd7a7..c5bc94c 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponMachineGun.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponMachineGun.java @@ -28,98 +28,98 @@ import com.destroystokyo.paper.event.entity.ProjectileCollideEvent; import pw.kaboom.weapons.Main; public final class WeaponMachineGun implements Listener { - private static HashSet machineGunActive = new HashSet(); + private static HashSet machineGunActive = new HashSet(); - public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.GOLDEN_HORSE_ARMOR - && ("§rMachine Gun".equals(name) || "Machine Gun".equals(name))) { - final UUID playerUUID = event.getPlayer().getUniqueId(); + public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.GOLDEN_HORSE_ARMOR + && ("§rMachine Gun".equals(name) || "Machine Gun".equals(name))) { + final UUID playerUUID = event.getPlayer().getUniqueId(); - if (!machineGunActive.contains(playerUUID)) { - machineGunActive.add(playerUUID); - final int maxBulletCount = 20; + if (!machineGunActive.contains(playerUUID)) { + machineGunActive.add(playerUUID); + final int maxBulletCount = 20; - new BukkitRunnable() { - private int i; + new BukkitRunnable() { + private int i; - @Override - public void run() { - final Player player = event.getPlayer(); - final Location eyeLocation = player.getEyeLocation(); - final World world = player.getWorld(); - final Vector velocity = eyeLocation.getDirection().multiply(12); + @Override + public void run() { + final Player player = event.getPlayer(); + final Location eyeLocation = player.getEyeLocation(); + final World world = player.getWorld(); + final Vector velocity = eyeLocation.getDirection().multiply(12); - final Arrow arrow = player.launchProjectile(Arrow.class); + final Arrow arrow = player.launchProjectile(Arrow.class); - arrow.setCustomName("WeaponMachineGunBullet"); - arrow.setShooter(player); - arrow.setVelocity(velocity); + arrow.setCustomName("WeaponMachineGunBullet"); + arrow.setShooter(player); + arrow.setVelocity(velocity); - final float volume = 1.0F; - final float pitch = 63.0F; + final float volume = 1.0F; + final float pitch = 63.0F; - world.playSound( - eyeLocation, - Sound.ENTITY_GENERIC_EXPLODE, - volume, - pitch - ); + world.playSound( + eyeLocation, + Sound.ENTITY_GENERIC_EXPLODE, + volume, + pitch + ); - i++; + i++; - if (i >= maxBulletCount) { - this.cancel(); - } - } - }.runTaskTimer(JavaPlugin.getPlugin(Main.class), 0, 1); + if (i >= maxBulletCount) { + this.cancel(); + } + } + }.runTaskTimer(JavaPlugin.getPlugin(Main.class), 0, 1); - machineGunActive.remove(playerUUID); - } - event.setCancelled(true); - } - } + machineGunActive.remove(playerUUID); + } + event.setCancelled(true); + } + } - /* Make shooter invulnerable to weapon projectiles */ - @EventHandler - private void onProjectileCollide(final ProjectileCollideEvent event) { - if (event.getEntityType() == EntityType.ARROW) { - final Projectile projectile = event.getEntity(); + /* Make shooter invulnerable to weapon projectiles */ + @EventHandler + private void onProjectileCollide(final ProjectileCollideEvent event) { + if (event.getEntityType() == EntityType.ARROW) { + final Projectile projectile = event.getEntity(); - if ("WeaponMachineGunBullet".equals(projectile.getCustomName())) { - final Entity collidedWith = event.getCollidedWith(); + if ("WeaponMachineGunBullet".equals(projectile.getCustomName())) { + final Entity collidedWith = event.getCollidedWith(); - if (collidedWith.getType() == EntityType.PLAYER - && projectile.getShooter() instanceof Player - && ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) { - event.setCancelled(true); - } else if (collidedWith instanceof LivingEntity) { - final int duration = 90000; - final int amplifier = 3; - final boolean ambient = true; - final boolean particles = false; + if (collidedWith.getType() == EntityType.PLAYER + && projectile.getShooter() instanceof Player + && ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) { + event.setCancelled(true); + } else if (collidedWith instanceof LivingEntity) { + final int duration = 90000; + final int amplifier = 3; + final boolean ambient = true; + final boolean particles = false; - final PotionEffect harm = new PotionEffect( - PotionEffectType.HARM, - duration, - amplifier, - ambient, - particles - ); + final PotionEffect harm = new PotionEffect( + PotionEffectType.HARM, + duration, + amplifier, + ambient, + particles + ); - ((LivingEntity) collidedWith).addPotionEffect(harm, true); - } - } - } - } + ((LivingEntity) collidedWith).addPotionEffect(harm, true); + } + } + } + } - @EventHandler - private void onProjectileHit(final ProjectileHitEvent event) { - if (event.getEntityType() == EntityType.ARROW) { - final Projectile projectile = event.getEntity(); + @EventHandler + private void onProjectileHit(final ProjectileHitEvent event) { + if (event.getEntityType() == EntityType.ARROW) { + final Projectile projectile = event.getEntity(); - if ("WeaponMachineGunBullet".equals(projectile.getCustomName())) { - projectile.remove(); - } - } - } + if ("WeaponMachineGunBullet".equals(projectile.getCustomName())) { + projectile.remove(); + } + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponNuker.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponNuker.java index cc77349..8f4940d 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponNuker.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponNuker.java @@ -10,43 +10,43 @@ import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; public final class WeaponNuker { - private WeaponNuker() { - } + private WeaponNuker() { + } - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.BLAZE_ROD - && ("§rNuker".equals(name) || "Nuker".equals(name))) { - final Player player = event.getPlayer(); - final Location eyeLocation = player.getEyeLocation(); - final Vector velocity = eyeLocation.getDirection().multiply(10); - final int yield = 8; + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.BLAZE_ROD + && ("§rNuker".equals(name) || "Nuker".equals(name))) { + final Player player = event.getPlayer(); + final Location eyeLocation = player.getEyeLocation(); + final Vector velocity = eyeLocation.getDirection().multiply(10); + final int yield = 8; - final Fireball fireball = player.launchProjectile(Fireball.class); - fireball.setShooter(player); - fireball.setVelocity(velocity); - fireball.setYield(yield); + final Fireball fireball = player.launchProjectile(Fireball.class); + fireball.setShooter(player); + fireball.setVelocity(velocity); + fireball.setYield(yield); - final World world = player.getWorld(); - final float volume = 0.9F; - final float pitch = 1.5F; + final World world = player.getWorld(); + final float volume = 0.9F; + final float pitch = 1.5F; - world.playSound( - eyeLocation, - Sound.ENTITY_GHAST_SHOOT, - volume, - pitch - ); + world.playSound( + eyeLocation, + Sound.ENTITY_GHAST_SHOOT, + volume, + pitch + ); - final float volume2 = 0.8F; - final float pitch2 = 2.0F; + final float volume2 = 0.8F; + final float pitch2 = 2.0F; - world.playSound( - eyeLocation, - Sound.ENTITY_BAT_TAKEOFF, - volume2, - pitch2 - ); - event.setCancelled(true); - } - } + world.playSound( + eyeLocation, + Sound.ENTITY_BAT_TAKEOFF, + volume2, + pitch2 + ); + event.setCancelled(true); + } + } } diff --git a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponSniper.java b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponSniper.java index 2106714..3c3f756 100644 --- a/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponSniper.java +++ b/src/main/java/pw/kaboom/weapons/modules/weapons/WeaponSniper.java @@ -12,53 +12,53 @@ import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; public final class WeaponSniper { - private WeaponSniper() { - } + private WeaponSniper() { + } - public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.IRON_HORSE_ARMOR - && ("§rSniper".equals(name) || "Sniper".equals(name))) { - final Player player = event.getPlayer(); - final Location eyeLocation = player.getEyeLocation(); - final Vector velocity = eyeLocation.getDirection().multiply(12); + public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.IRON_HORSE_ARMOR + && ("§rSniper".equals(name) || "Sniper".equals(name))) { + final Player player = event.getPlayer(); + final Location eyeLocation = player.getEyeLocation(); + final Vector velocity = eyeLocation.getDirection().multiply(12); - final Snowball snowball = player.launchProjectile(Snowball.class); - snowball.setShooter(player); - snowball.setVelocity(velocity); + final Snowball snowball = player.launchProjectile(Snowball.class); + snowball.setShooter(player); + snowball.setVelocity(velocity); - final World world = player.getWorld(); - final float volume = 1.0F; - final float pitch = 63.0F; + final World world = player.getWorld(); + final float volume = 1.0F; + final float pitch = 63.0F; - world.playSound( - eyeLocation, - Sound.BLOCK_PISTON_CONTRACT, - volume, - pitch - ); - event.setCancelled(true); - } - } + world.playSound( + eyeLocation, + Sound.BLOCK_PISTON_CONTRACT, + volume, + pitch + ); + event.setCancelled(true); + } + } - public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { - if (item == Material.IRON_HORSE_ARMOR - && ("§rSniper".equals(name) || "Sniper".equals(name))) { - final Player player = event.getPlayer(); + public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) { + if (item == Material.IRON_HORSE_ARMOR + && ("§rSniper".equals(name) || "Sniper".equals(name))) { + final Player player = event.getPlayer(); - if (player.hasPotionEffect(PotionEffectType.SLOW)) { - player.removePotionEffect(PotionEffectType.SLOW); - } else { - final int duration = 90000; - final int amplifier = 7; + if (player.hasPotionEffect(PotionEffectType.SLOW)) { + player.removePotionEffect(PotionEffectType.SLOW); + } else { + final int duration = 90000; + final int amplifier = 7; - final PotionEffect effect = new PotionEffect( - PotionEffectType.SLOW, - duration, - amplifier - ); - player.addPotionEffect(effect); - } - event.setCancelled(true); - } - } + final PotionEffect effect = new PotionEffect( + PotionEffectType.SLOW, + duration, + amplifier + ); + player.addPotionEffect(effect); + } + event.setCancelled(true); + } + } } diff --git a/suppressions.xml b/suppressions.xml index 790ec65..78fba39 100644 --- a/suppressions.xml +++ b/suppressions.xml @@ -1,11 +1,10 @@ + "-//Puppy Crawl//DTD Suppressions 1.0//EN" + "http://www.puppycrawl.com/dtds/suppressions_1_0.dtd"> - - - + +