diff --git a/checkstyle.xml b/checkstyle.xml
new file mode 100644
index 0000000..941c004
--- /dev/null
+++ b/checkstyle.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
diff --git a/pom.xml b/pom.xml
index 5833bdb..f326ab9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -41,9 +41,8 @@
check
-
- suppressions.xml
-
+ checkstyle.xml
+ suppressions.xml
true
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandBroadcastVanilla.java b/src/main/java/pw/kaboom/extras/commands/CommandBroadcastVanilla.java
index 04633bf..eb974ed 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandBroadcastVanilla.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandBroadcastVanilla.java
@@ -7,11 +7,13 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public final class CommandBroadcastVanilla implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " ");
} else {
- Command.broadcastCommandMessage(sender, ChatColor.translateAlternateColorCodes('&', String.join(" ", args)));
+ Command.broadcastCommandMessage(sender, ChatColor.translateAlternateColorCodes(
+ '&', String.join(" ", args)));
}
return true;
}
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java b/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java
index 9d001e6..e3d8ff4 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java
@@ -10,7 +10,8 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public final class CommandClearChat implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
final int maxMessages = 100;
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandConsole.java b/src/main/java/pw/kaboom/extras/commands/CommandConsole.java
index 2677163..915a934 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandConsole.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandConsole.java
@@ -8,13 +8,15 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public final class CommandConsole implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " ");
} else {
Bukkit.dispatchCommand(
Bukkit.getConsoleSender(),
- "minecraft:say " + ChatColor.translateAlternateColorCodes('&', String.join(" ", args))
+ "minecraft:say " + ChatColor.translateAlternateColorCodes(
+ '&', String.join(" ", args))
);
}
return true;
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java b/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java
index b43b81f..ca112a6 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java
@@ -10,7 +10,8 @@ import org.bukkit.entity.EntityType;
public final class CommandDestroyEntities implements CommandExecutor {
@Override
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
int entityCount = 0;
int worldCount = 0;
@@ -24,7 +25,8 @@ public final class CommandDestroyEntities implements CommandExecutor {
worldCount++;
}
- sender.sendMessage("Successfully destroyed " + entityCount + " entities in " + worldCount + " worlds");
+ sender.sendMessage("Successfully destroyed " + entityCount + " entities in "
+ + worldCount + " worlds");
return true;
}
}
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java b/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java
index 231847e..f52ca48 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java
@@ -14,7 +14,8 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public final class CommandEnchantAll implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage("Command has to be run by a player");
} else {
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java b/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java
index dec5a45..e772e2f 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java
@@ -22,7 +22,8 @@ public final class CommandJumpscare implements CommandExecutor {
}
}
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " ");
} else {
@@ -35,7 +36,8 @@ public final class CommandJumpscare implements CommandExecutor {
final Player target = Bukkit.getPlayer(args[0]);
if (target != null) {
createJumpscare(target);
- sender.sendMessage("Successfully created jumpscare for player \"" + target.getName() + "\"");
+ sender.sendMessage("Successfully created jumpscare for player \""
+ + target.getName() + "\"");
} else {
sender.sendMessage("Player \"" + args[0] + "\" not found");
}
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandKaboom.java b/src/main/java/pw/kaboom/extras/commands/CommandKaboom.java
index 6a926a9..3d4adfd 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandKaboom.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandKaboom.java
@@ -15,7 +15,8 @@ import org.bukkit.inventory.ItemStack;
public final class CommandKaboom implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
final Player player = (Player) sender;
boolean explode = ThreadLocalRandom.current().nextBoolean();
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandPing.java b/src/main/java/pw/kaboom/extras/commands/CommandPing.java
index 9be54cf..23699cd 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandPing.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandPing.java
@@ -9,7 +9,8 @@ import org.bukkit.entity.Player;
public final class CommandPing implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
Player target;
if (args.length == 0) {
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java b/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java
index f819185..ceb1017 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java
@@ -19,12 +19,14 @@ import org.bukkit.plugin.java.JavaPlugin;
import pw.kaboom.extras.Main;
public final class CommandPrefix implements CommandExecutor {
- 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 {
final Player player = (Player) sender;
- final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(), "prefixes.yml");
+ final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(),
+ "prefixes.yml");
final FileConfiguration prefixConfig = YamlConfiguration.loadConfiguration(configFile);
try {
@@ -37,10 +39,13 @@ public final class CommandPrefix implements CommandExecutor {
} else {
prefixConfig.set(player.getUniqueId().toString(), String.join(" ", args));
prefixConfig.save(configFile);
- player.sendMessage("You now have the tag: " + ChatColor.translateAlternateColorCodes('&', String.join(" ", args)));
+ player.sendMessage("You now have the tag: "
+ + ChatColor.translateAlternateColorCodes(
+ '&', String.join(" ", args)));
}
} catch (Exception exception) {
- player.sendMessage("Something went wrong while saving the prefix. Please check console.");
+ player.sendMessage("Something went wrong while saving the prefix. "
+ + "Please check console.");
exception.printStackTrace();
}
}
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java b/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java
index cc146b0..ee74b66 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java
@@ -17,7 +17,8 @@ public final class CommandPumpkin implements CommandExecutor {
player.getInventory().setHelmet(new ItemStack(Material.CARVED_PUMPKIN));
}
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " ");
} else {
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java b/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java
index d430f33..21d56ec 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java
@@ -13,14 +13,16 @@ import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
public final class CommandServerInfo implements CommandExecutor {
- private void sendInfoMessage(final CommandSender target, final String description, final String value) {
+ private void sendInfoMessage(final CommandSender target, final String description,
+ final String value) {
target.sendMessage(
ChatColor.GRAY + description + ": "
+ ChatColor.WHITE + value
);
}
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
try {
sendInfoMessage(sender, "Hostname",
InetAddress.getLocalHost().getHostName()
@@ -79,7 +81,8 @@ public final class CommandServerInfo implements CommandExecutor {
);
final long heapUsage = ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getUsed();
- final long nonHeapUsage = ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getUsed();
+ final long nonHeapUsage = ManagementFactory.getMemoryMXBean()
+ .getNonHeapMemoryUsage().getUsed();
final long memoryMax = (
ManagementFactory.getMemoryMXBean().getHeapMemoryUsage().getMax()
+ ManagementFactory.getMemoryMXBean().getNonHeapMemoryUsage().getMax()
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandSkin.java b/src/main/java/pw/kaboom/extras/commands/CommandSkin.java
index cd2f28c..955a19e 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandSkin.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandSkin.java
@@ -13,7 +13,8 @@ public final class CommandSkin implements CommandExecutor {
private long millis;
@Override
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage("Command has to be run by a player");
} else {
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java b/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java
index 08eb670..edb629b 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java
@@ -15,7 +15,8 @@ import org.bukkit.command.ConsoleCommandSender;
import org.bukkit.entity.Player;
public final class CommandSpawn implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage("Command has to be run by a player");
} else {
@@ -25,7 +26,8 @@ public final class CommandSpawn implements CommandExecutor {
final int maxWorldHeight = 256;
for (double y = spawnLocation.getY(); y <= maxWorldHeight; y++) {
- final Location yLocation = new Location(world, spawnLocation.getX(), y, spawnLocation.getZ());
+ final Location yLocation = new Location(world, spawnLocation.getX(), y,
+ spawnLocation.getZ());
final Block coordBlock = world.getBlockAt(yLocation);
if (!coordBlock.getType().isSolid()
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java b/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java
index e9eff35..13aac24 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java
@@ -14,7 +14,8 @@ import org.bukkit.util.BlockIterator;
import org.bukkit.util.Vector;
public final class CommandSpidey implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (sender instanceof ConsoleCommandSender) {
sender.sendMessage("Command has to be run by a player");
} else {
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java b/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java
index a812b0d..fdd86cd 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java
@@ -10,12 +10,14 @@ import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public final class CommandTellraw implements CommandExecutor {
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, final String label,
+ final String[] args) {
if (args.length == 0) {
sender.sendMessage(ChatColor.RED + "Usage: /" + label + " ");
} else {
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
- onlinePlayer.sendMessage(ChatColor.translateAlternateColorCodes('&', String.join(" ", args)));
+ onlinePlayer.sendMessage(ChatColor.translateAlternateColorCodes(
+ '&', String.join(" ", args)));
}
}
return true;
diff --git a/src/main/java/pw/kaboom/extras/commands/CommandUsername.java b/src/main/java/pw/kaboom/extras/commands/CommandUsername.java
index dab2e7e..2188e02 100644
--- a/src/main/java/pw/kaboom/extras/commands/CommandUsername.java
+++ b/src/main/java/pw/kaboom/extras/commands/CommandUsername.java
@@ -14,13 +14,15 @@ public final class CommandUsername implements CommandExecutor {
private long millis;
@Override
- public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
+ public boolean onCommand(final CommandSender sender, final Command command, 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 String nameColor = ChatColor.translateAlternateColorCodes('&', String.join(" ", args));
+ final String nameColor = ChatColor.translateAlternateColorCodes(
+ '&', String.join(" ", args));
final String name = nameColor.substring(0, Math.min(16, nameColor.length()));
final long millisDifference = System.currentTimeMillis() - millis;
diff --git a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java
index 8eb6c68..c34d414 100644
--- a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java
+++ b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java
@@ -29,7 +29,8 @@ public final class BlockPhysics implements Listener {
try {
if (!event.getBlock().getType().isSolid()) {
for (BlockFace face : getBlockFaces()) {
- if (event.getBlock().getRelative(face).getType() != event.getBlock().getType()) {
+ if (event.getBlock().getRelative(face).getType()
+ != event.getBlock().getType()) {
return;
}
if (!event.getBlock().getType().equals(Material.AIR)) {
@@ -84,9 +85,11 @@ public final class BlockPhysics implements Listener {
boolean waterFound = false;
for (BlockFace face : getBlockFaces()) {
- if (event.getBlock().getRelative(face).getType() == Material.LAVA && !lavaFound) {
+ if (event.getBlock().getRelative(face).getType() == Material.LAVA
+ && !lavaFound) {
lavaFound = true;
- } else if (event.getBlock().getRelative(face).getType() == Material.WATER && !waterFound) {
+ } else if (event.getBlock().getRelative(face).getType() == Material.WATER
+ && !waterFound) {
waterFound = true;
}
@@ -115,8 +118,10 @@ public final class BlockPhysics implements Listener {
case REPEATER:
case TRIPWIRE:
if (!event.getBlock().getRelative(BlockFace.DOWN).getType().isSolid()
- && !Material.AIR.equals(event.getBlock().getRelative(BlockFace.DOWN).getType())
- && !Material.CAVE_AIR.equals(event.getBlock().getRelative(BlockFace.DOWN).getType())) {
+ && !Material.AIR.equals(event.getBlock().getRelative(BlockFace.DOWN)
+ .getType())
+ && !Material.CAVE_AIR.equals(event.getBlock()
+ .getRelative(BlockFace.DOWN).getType())) {
event.setCancelled(true);
}
return;
diff --git a/src/main/java/pw/kaboom/extras/modules/entity/EntityExplosion.java b/src/main/java/pw/kaboom/extras/modules/entity/EntityExplosion.java
index fa73c1e..936bae0 100644
--- a/src/main/java/pw/kaboom/extras/modules/entity/EntityExplosion.java
+++ b/src/main/java/pw/kaboom/extras/modules/entity/EntityExplosion.java
@@ -1,5 +1,7 @@
package pw.kaboom.extras.modules.entity;
+import org.bukkit.World;
+
import org.bukkit.entity.Fireball;
import org.bukkit.event.EventHandler;
@@ -16,9 +18,10 @@ public final class EntityExplosion implements Listener {
event.setRadius(maxRadius);
}
+ final World world = event.getEntity().getWorld();
final int maxFireballCount = 30;
- if (event.getEntity().getWorld().getEntitiesByClass(Fireball.class).size() > maxFireballCount
+ if (world.getEntitiesByClass(Fireball.class).size() > maxFireballCount
&& event.getRadius() > 1) {
event.setRadius(1);
}
diff --git a/src/main/java/pw/kaboom/extras/modules/entity/EntitySpawn.java b/src/main/java/pw/kaboom/extras/modules/entity/EntitySpawn.java
index 5268a72..440f71d 100644
--- a/src/main/java/pw/kaboom/extras/modules/entity/EntitySpawn.java
+++ b/src/main/java/pw/kaboom/extras/modules/entity/EntitySpawn.java
@@ -68,7 +68,8 @@ public final class EntitySpawn implements Listener {
return false;
}
- private boolean isEntityLimitReached(final EntityType entityType, final Chunk chunk, final World world) {
+ private boolean isEntityLimitReached(final EntityType entityType, final Chunk chunk,
+ final World world) {
switch (entityType) {
case ENDER_DRAGON:
final int worldDragonCount = world.getEntitiesByClass(EnderDragon.class).size();
@@ -169,7 +170,8 @@ public final class EntitySpawn implements Listener {
@EventHandler
void onExplosionPrime(final ExplosionPrimeEvent event) {
if (EntityType.MINECART_TNT.equals(event.getEntityType())
- && event.getEntity().getWorld().getEntitiesByClass(ExplosiveMinecart.class).size() > 80) {
+ && event.getEntity().getWorld()
+ .getEntitiesByClass(ExplosiveMinecart.class).size() > 80) {
event.setCancelled(true);
}
}
@@ -255,7 +257,9 @@ public final class EntitySpawn implements Listener {
@EventHandler
void onSpawnerSpawn(final SpawnerSpawnEvent event) {
if (EntityType.FALLING_BLOCK.equals(event.getEntityType())) {
- if (((FallingBlock) event.getEntity()).getBlockData().getMaterial().equals(Material.SPAWNER)) {
+ final FallingBlock block = (FallingBlock) event.getEntity();
+
+ if (block.getBlockData().getMaterial().equals(Material.SPAWNER)) {
event.setCancelled(true);
event.getSpawner().setSpawnedType(EntityType.FALLING_BLOCK);
}
diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java
index 0f5a527..52f554e 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java
@@ -26,7 +26,8 @@ public final class PlayerChat implements Listener {
final UUID playerUuid = event.getPlayer().getUniqueId();
if (PlayerCommand.getCommandMillisList().get(playerUuid) != null) {
- final long millisDifference = System.currentTimeMillis() - PlayerCommand.getCommandMillisList().get(playerUuid);
+ final long lastCommandTime = PlayerCommand.getCommandMillisList().get(playerUuid);
+ final long millisDifference = System.currentTimeMillis() - lastCommandTime;
if (millisDifference < 50) {
event.setCancelled(true);
@@ -39,7 +40,8 @@ public final class PlayerChat implements Listener {
return;
}
- final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(), "prefixes.yml");
+ final File configFile = new File(JavaPlugin.getPlugin(Main.class).getDataFolder(),
+ "prefixes.yml");
final FileConfiguration prefixConfig = YamlConfiguration.loadConfiguration(configFile);
final String prefix;
final String name = player.getDisplayName().toString();
diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
index fdf01f0..a89e33c 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
@@ -18,7 +18,8 @@ public final class PlayerCommand implements Listener {
final UUID playerUuid = event.getPlayer().getUniqueId();
if (getCommandMillisList().get(playerUuid) != null) {
- final long millisDifference = System.currentTimeMillis() - getCommandMillisList().get(playerUuid);
+ final long lastCommandTime = getCommandMillisList().get(playerUuid);
+ final long millisDifference = System.currentTimeMillis() - lastCommandTime;
if (millisDifference < 75) {
event.setCancelled(true);
@@ -43,11 +44,6 @@ public final class PlayerCommand implements Listener {
event.setMessage(checkedCommand);
}
}
-
- /*final MessageInterceptingCommandRunner cmdRunner = new MessageInterceptingCommandRunner(Bukkit.getConsoleSender());
- Bukkit.dispatchCommand(cmdRunner, event.getMessage().substring(1));
-
- event.setCancelled(true);*/
}
public static HashMap getCommandMillisList() {
diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java
index c49a9f7..ae712ea 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java
@@ -38,8 +38,10 @@ public final class PlayerConnection implements Listener {
private static final int FADE_OUT = 5;
private static final boolean ENABLE_KICK = CONFIG.getBoolean("enableKick");
- private static final boolean ENABLE_JOIN_RESTRICTIONS = CONFIG.getBoolean("enableJoinRestrictions");
- private static final boolean ALLOW_JOIN_ON_FULL_SERVER = CONFIG.getBoolean("allowJoinOnFullServer");
+ private static final boolean ENABLE_JOIN_RESTRICTIONS = CONFIG.getBoolean(
+ "enableJoinRestrictions");
+ private static final boolean ALLOW_JOIN_ON_FULL_SERVER = CONFIG.getBoolean(
+ "allowJoinOnFullServer");
private static final boolean OP_ON_JOIN = CONFIG.getBoolean("opOnJoin");
private static final boolean RANDOMIZE_SPAWN = CONFIG.getBoolean("randomizeSpawn");
@@ -47,13 +49,15 @@ public final class PlayerConnection implements Listener {
void onAsyncPlayerPreLogin(final AsyncPlayerPreLoginEvent event) {
if (Bukkit.getPlayer(event.getName()) != null
&& Bukkit.getPlayer(event.getName()).isOnline()) {
- event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER, "A player with that username is already logged in");
+ event.disallow(AsyncPlayerPreLoginEvent.Result.KICK_OTHER,
+ "A player with that username is already logged in");
}
/*try {
final PlayerProfile profile = event.getPlayerProfile();
- UUID offlineUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getName()).getBytes(Charsets.UTF_8));
+ UUID offlineUUID = UUID.nameUUIDFromBytes(
+ ("OfflinePlayer:" + event.getName()).getBytes(Charsets.UTF_8));
profile.setId(offlineUUID);
@@ -113,7 +117,8 @@ public final class PlayerConnection implements Listener {
@EventHandler
void onPlayerSpawn(final PlayerSpawnLocationEvent event) {
- if (RANDOMIZE_SPAWN && event.getPlayer().getBedSpawnLocation() != event.getSpawnLocation()) {
+ if (RANDOMIZE_SPAWN
+ && event.getPlayer().getBedSpawnLocation() != event.getSpawnLocation()) {
final World world = event.getPlayer().getWorld();
final double x = ThreadLocalRandom.current().nextInt(-300000000, 30000000) + .5;
final double y = 100;
@@ -133,7 +138,8 @@ public final class PlayerConnection implements Listener {
@EventHandler
void onPreLookupProfile(final PreLookupProfileEvent event) {
// Disable Mojang API calls, we don't need them
- UUID offlineUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getName()).getBytes(Charsets.UTF_8));
+ UUID offlineUUID = UUID.nameUUIDFromBytes(
+ ("OfflinePlayer:" + event.getName()).getBytes(Charsets.UTF_8));
event.setUUID(offlineUUID);
event.setProfileProperties(new HashSet());
diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java
index 5673f39..f12dc85 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java
@@ -65,7 +65,8 @@ public final class PlayerDamage implements Listener {
}
if (event.getDroppedExp() > 0) {
- ExperienceOrb xp = player.getWorld().spawn(player.getLocation(), ExperienceOrb.class);
+ ExperienceOrb xp = player.getWorld().spawn(player.getLocation(),
+ ExperienceOrb.class);
xp.setExperience(event.getDroppedExp());
}
diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
index fc469b8..7752a8f 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
@@ -28,7 +28,8 @@ public final class PlayerInteract implements Listener {
/*final UUID playerUuid = event.getPlayer().getUniqueId();
if (interactMillisList.get(playerUuid) != null) {
- final long millisDifference = System.currentTimeMillis() - interactMillisList.get(playerUuid);
+ final long lastInteractionTime = interactMillisList.get(playerUuid);
+ final long millisDifference = System.currentTimeMillis() - lastInteractionTime;
if (millisDifference < 150) {
event.setCancelled(true);
diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java
index d2200fe..46f7ba8 100644
--- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java
+++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java
@@ -18,7 +18,8 @@ import org.bukkit.plugin.java.JavaPlugin;
import pw.kaboom.extras.Main;
public final class ServerCommand implements Listener {
- private static final Pattern AS_AT_PATTERN = Pattern.compile("\\b(as|at|facing entity) @[ae]\\b");
+ private static final Pattern AS_AT_PATTERN = Pattern.compile(
+ "\\b(as|at|facing entity) @[ae]\\b");
private static final Logger LOGGER = JavaPlugin.getPlugin(Main.class).getLogger();
public static boolean checkExecuteCommand(final String cmd) {
@@ -46,7 +47,8 @@ public final class ServerCommand implements Listener {
|| "w".equalsIgnoreCase(cmd)
);
}
- public static String checkCommand(final CommandSender sender, final String command, final boolean isConsoleCommand) {
+ public static String checkCommand(final CommandSender sender, final String command,
+ final boolean isConsoleCommand) {
final String[] arr = command.split(" ");
String commandName = arr[0].toLowerCase();
@@ -72,7 +74,6 @@ public final class ServerCommand implements Listener {
} catch (NumberFormatException e) {
// Ignore exception
}
-
}
}
@@ -98,8 +99,10 @@ public final class ServerCommand implements Listener {
if (checkExecuteCommand(arr[i + 1])) {
return "cancel";
} else {
- final String[] executeCommand = Arrays.copyOfRange(arr, i + 1, arr.length);
- String result = checkCommand(sender, String.join(" ", executeCommand), true);
+ final String[] executeCommand = Arrays.copyOfRange(
+ arr, i + 1, arr.length);
+ String result = checkCommand(sender,
+ String.join(" ", executeCommand), true);
if (result == null) {
break;
}
@@ -107,7 +110,8 @@ public final class ServerCommand implements Listener {
case "cancel":
return "cancel";
default:
- String pureExecute = String.join(" ", Arrays.copyOfRange(arr, 0, i + 1));
+ String pureExecute = String.join(
+ " ", Arrays.copyOfRange(arr, 0, i + 1));
return (pureExecute + " " + result);
}
}
@@ -211,7 +215,8 @@ public final class ServerCommand implements Listener {
}
if (command.contains("distance")) {
- return command.replace("distance=", "]").replace("\"distance\"=", "]").replace("'distance'=", "]");
+ return command.replace("distance=", "]").replace("\"distance\"=", "]")
+ .replace("'distance'=", "]");
}
return null;
@@ -222,7 +227,8 @@ public final class ServerCommand implements Listener {
final CommandSender sender = event.getSender();
if (sender instanceof BlockCommandSender) {
- final CommandBlock commandBlock = (CommandBlock) ((BlockCommandSender) sender).getBlock().getState();
+ final CommandBlock commandBlock = (CommandBlock) ((BlockCommandSender) sender)
+ .getBlock().getState();
commandBlock.setCommand("");
commandBlock.update();
diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerTabComplete.java b/src/main/java/pw/kaboom/extras/modules/server/ServerTabComplete.java
index aab68d9..4ecb541 100644
--- a/src/main/java/pw/kaboom/extras/modules/server/ServerTabComplete.java
+++ b/src/main/java/pw/kaboom/extras/modules/server/ServerTabComplete.java
@@ -19,7 +19,8 @@ public final class ServerTabComplete implements Listener {
void onAsyncTabComplete(final AsyncTabCompleteEvent event) {
final String[] arr = event.getBuffer().split(" ", 2);
- // Vanilla clients will not send tab complete requests on the first word, but modified or bot clients may
+ // Vanilla clients will not send tab complete requests on the first word,
+ // but modified or bot clients may
if (arr.length < 2) {
return;
}
diff --git a/suppressions.xml b/suppressions.xml
index e4ec2cf..23ef9a0 100644
--- a/suppressions.xml
+++ b/suppressions.xml
@@ -1,12 +1,10 @@
-
+ "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN"
+ "https://checkstyle.org/dtds/suppressions_1_2.dtd">
-