mirror of
https://github.com/kaboomserver/weapons.git
synced 2025-02-05 06:02:57 +00:00
Set maximum line length to 100 characters
This commit is contained in:
parent
844f6f26df
commit
56c520fb90
15 changed files with 57 additions and 30 deletions
10
checkstyle.xml
Normal file
10
checkstyle.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE module PUBLIC
|
||||
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
|
||||
"https://checkstyle.org/dtds/configuration_1_3.dtd">
|
||||
|
||||
<module name="Checker">
|
||||
<module name="LineLength">
|
||||
<property name="max" value="100"/>
|
||||
</module>
|
||||
</module>
|
5
pom.xml
5
pom.xml
|
@ -41,9 +41,8 @@
|
|||
<goal>check</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<suppressionsLocation>
|
||||
suppressions.xml
|
||||
</suppressionsLocation>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
<suppressionsLocation>suppressions.xml</suppressionsLocation>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
|
|
@ -22,7 +22,8 @@ public final class CommandWeapons implements CommandExecutor {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final CommandSender sender, final Command cmd, final String label, final String[] args) {
|
||||
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 {
|
||||
|
|
|
@ -14,11 +14,12 @@ public final class PlayerReceiveWeapon implements Listener {
|
|||
}
|
||||
|
||||
final ItemStack item = event.getCurrentItem();
|
||||
final String weaponName = item.getItemMeta().getDisplayName().toLowerCase();
|
||||
final Player player = (Player) event.getWhoClicked();
|
||||
|
||||
player.getInventory().addItem(item);
|
||||
player.closeInventory();
|
||||
player.sendMessage("You have received the " + item.getItemMeta().getDisplayName().toLowerCase() + "!");
|
||||
player.sendMessage("You have received the " + weaponName + "!");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ public final class WeaponAnvilDropper {
|
|||
private WeaponAnvilDropper() {
|
||||
}
|
||||
|
||||
public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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;
|
||||
|
@ -17,7 +18,8 @@ public final class WeaponAnvilDropper {
|
|||
|
||||
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 Location blockLocation = event.getPlayer().getLocation()
|
||||
.subtract(x, 0, z);
|
||||
final World world = event.getPlayer().getWorld();
|
||||
|
||||
world.spawnFallingBlock(
|
||||
|
|
|
@ -17,7 +17,8 @@ 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) {
|
||||
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();
|
||||
|
@ -69,7 +70,8 @@ public final class WeaponArcher implements Listener {
|
|||
|
||||
if (collidedWith.getType() == EntityType.PLAYER
|
||||
&& projectile.getShooter() instanceof Player
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) {
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(
|
||||
collidedWith.getUniqueId())) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,8 @@ 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) {
|
||||
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();
|
||||
|
@ -62,7 +63,8 @@ public final class WeaponArmageddon implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
/* Make shooter invulnerable to weapon projectiles, and prevent charges from colliding with each other */
|
||||
/* 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) {
|
||||
|
@ -73,7 +75,8 @@ public final class WeaponArmageddon implements Listener {
|
|||
|
||||
if ((collidedWith.getType() == EntityType.PLAYER
|
||||
&& projectile.getShooter() instanceof Player
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId()))
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(
|
||||
collidedWith.getUniqueId()))
|
||||
|| collidedWith.getType() == EntityType.FIREBALL) {
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package pw.kaboom.weapons.modules.weapons;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.concurrent.ThreadLocalRandom;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
@ -23,7 +23,8 @@ 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) {
|
||||
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();
|
||||
|
@ -49,7 +50,8 @@ public final class WeaponBlobinator implements Listener {
|
|||
}
|
||||
}
|
||||
|
||||
private void createBlobSplash(final World world, final int x, final int y, final int z, final int radius, final Block hitBlock, final Material color) {
|
||||
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) {
|
||||
|
@ -88,8 +90,8 @@ public final class WeaponBlobinator implements Listener {
|
|||
&& "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()));
|
||||
final Material color = Main.getColors().get(
|
||||
ThreadLocalRandom.current().nextInt(Main.getColors().size()));
|
||||
|
||||
for (int x = -radius; x < radius; x++) {
|
||||
for (int y = -radius; y < radius; y++) {
|
||||
|
|
|
@ -15,7 +15,8 @@ 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) {
|
||||
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);
|
||||
|
|
|
@ -17,7 +17,8 @@ public final class WeaponLaser {
|
|||
private WeaponLaser() {
|
||||
}
|
||||
|
||||
public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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();
|
||||
|
|
|
@ -11,11 +11,13 @@ public final class WeaponLightningStick {
|
|||
private WeaponLightningStick() {
|
||||
}
|
||||
|
||||
public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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<Material>) null, maxDistance).getLocation();
|
||||
final Location lookLocation = event.getPlayer().getTargetBlock(
|
||||
(Set<Material>) null, maxDistance).getLocation();
|
||||
final World world = event.getPlayer().getWorld();
|
||||
|
||||
world.strikeLightning(lookLocation);
|
||||
|
|
|
@ -30,7 +30,8 @@ import pw.kaboom.weapons.Main;
|
|||
public final class WeaponMachineGun implements Listener {
|
||||
private static HashSet<UUID> machineGunActive = new HashSet<UUID>();
|
||||
|
||||
public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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();
|
||||
|
@ -90,7 +91,8 @@ public final class WeaponMachineGun implements Listener {
|
|||
|
||||
if (collidedWith.getType() == EntityType.PLAYER
|
||||
&& projectile.getShooter() instanceof Player
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(collidedWith.getUniqueId())) {
|
||||
&& ((Player) projectile.getShooter()).getUniqueId().equals(
|
||||
collidedWith.getUniqueId())) {
|
||||
event.setCancelled(true);
|
||||
} else if (collidedWith instanceof LivingEntity) {
|
||||
final int duration = 90000;
|
||||
|
|
|
@ -13,7 +13,8 @@ public final class WeaponNuker {
|
|||
private WeaponNuker() {
|
||||
}
|
||||
|
||||
public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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();
|
||||
|
|
|
@ -15,7 +15,8 @@ public final class WeaponSniper {
|
|||
private WeaponSniper() {
|
||||
}
|
||||
|
||||
public static void leftClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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();
|
||||
|
@ -40,7 +41,8 @@ public final class WeaponSniper {
|
|||
}
|
||||
}
|
||||
|
||||
public static void rightClick(final Material item, final String name, final PlayerInteractEvent event) {
|
||||
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();
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC
|
||||
"-//Puppy Crawl//DTD Suppressions 1.0//EN"
|
||||
"http://www.puppycrawl.com/dtds/suppressions_1_0.dtd">
|
||||
"-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
|
||||
"https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
|
||||
<suppressions>
|
||||
<suppress checks="Javadoc" files="."/>
|
||||
<suppress checks="LineLength" files="."/>
|
||||
</suppressions>
|
||||
|
|
Loading…
Reference in a new issue