diff --git a/.gitignore b/.gitignore
index 28972e5..3f88fb7 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,6 @@
.settings/
+bin/
target/
+.checkstyle
.classpath
-.project
\ No newline at end of file
+.project
diff --git a/build.sh b/build.sh
deleted file mode 100755
index f66edf3..0000000
--- a/build.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/sh
-mvn package
diff --git a/checkstyle.xml b/checkstyle.xml
deleted file mode 100644
index e350ceb..0000000
--- a/checkstyle.xml
+++ /dev/null
@@ -1,521 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pom.xml b/pom.xml
index dcd9861..7000a28 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,11 +3,13 @@
pw.kaboom
Extras
master
-
- 1.8
- 1.8
-
+
+ 1.7
+ 1.7
+ true
+ UTF-8
+
@@ -31,21 +33,21 @@
org.apache.maven.plugins
maven-checkstyle-plugin
3.1.0
-
- ${basedir}/checkstyle.xml
- true
- false
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.0
-
-
- -Xlint:all
-
-
+
+
+ checkstyle
+ validate
+
+ check
+
+
+
+ suppressions.xml
+
+ false
+
+
+
diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java
index 844b211..0bc7a04 100644
--- a/src/main/java/pw/kaboom/extras/Main.java
+++ b/src/main/java/pw/kaboom/extras/Main.java
@@ -7,22 +7,43 @@ import java.util.UUID;
import org.bukkit.block.BlockFace;
import org.bukkit.plugin.java.JavaPlugin;
-import pw.kaboom.extras.commands.*;
-import pw.kaboom.extras.modules.block.*;
-import pw.kaboom.extras.modules.entity.*;
-import pw.kaboom.extras.modules.player.*;
-import pw.kaboom.extras.modules.server.*;
+import pw.kaboom.extras.commands.CommandClearChat;
+import pw.kaboom.extras.commands.CommandConsole;
+import pw.kaboom.extras.commands.CommandDestroyEntities;
+import pw.kaboom.extras.commands.CommandEnchantAll;
+import pw.kaboom.extras.commands.CommandJumpscare;
+import pw.kaboom.extras.commands.CommandPrefix;
+import pw.kaboom.extras.commands.CommandPumpkin;
+import pw.kaboom.extras.commands.CommandServerInfo;
+import pw.kaboom.extras.commands.CommandSkin;
+import pw.kaboom.extras.commands.CommandSpawn;
+import pw.kaboom.extras.commands.CommandSpidey;
+import pw.kaboom.extras.commands.CommandTellraw;
+import pw.kaboom.extras.commands.CommandUnloadChunks;
+import pw.kaboom.extras.commands.CommandUsername;
+import pw.kaboom.extras.modules.block.BlockCheck;
+import pw.kaboom.extras.modules.block.BlockPhysics;
+import pw.kaboom.extras.modules.entity.EntityExplosion;
+import pw.kaboom.extras.modules.entity.EntityKnockback;
+import pw.kaboom.extras.modules.entity.EntitySpawn;
+import pw.kaboom.extras.modules.entity.EntityTeleport;
+import pw.kaboom.extras.modules.player.PlayerChat;
+import pw.kaboom.extras.modules.player.PlayerCommand;
+import pw.kaboom.extras.modules.player.PlayerConnection;
+import pw.kaboom.extras.modules.player.PlayerDamage;
+import pw.kaboom.extras.modules.player.PlayerInteract;
+import pw.kaboom.extras.modules.player.PlayerTeleport;
+import pw.kaboom.extras.modules.server.ServerCommand;
+import pw.kaboom.extras.modules.server.ServerPing;
public class Main extends JavaPlugin {
- public static HashSet skinInProgress = new HashSet<>();
-
- public static HashSet consoleCommandBlacklist = new HashSet<>();
- public static HashSet faces = new HashSet<>();
+ public static HashSet skinInProgress = new HashSet();
+ @Override
public void onLoad() {
/* Fill lists */
Collections.addAll(
- consoleCommandBlacklist,
+ ServerCommand.consoleCommandBlacklist,
"bukkit:about",
"bukkit:ver",
"bukkit:version",
@@ -388,7 +409,7 @@ public class Main extends JavaPlugin {
);
Collections.addAll(
- faces,
+ BlockPhysics.blockFaces,
BlockFace.NORTH,
BlockFace.SOUTH,
BlockFace.WEST,
@@ -401,6 +422,7 @@ public class Main extends JavaPlugin {
saveConfig();
}
+ @Override
public void onEnable() {
/* Commands */
this.getCommand("clearchat").setExecutor(new CommandClearChat());
diff --git a/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java b/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java
index 9e72ccd..ab016b6 100644
--- a/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java
+++ b/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java
@@ -2,17 +2,15 @@ package pw.kaboom.extras.helpers;
import java.io.InputStreamReader;
import java.net.URL;
+
import javax.net.ssl.HttpsURLConnection;
import org.bukkit.entity.Player;
-
import org.bukkit.plugin.java.JavaPlugin;
-
import org.bukkit.scheduler.BukkitRunnable;
import com.destroystokyo.paper.profile.PlayerProfile;
import com.destroystokyo.paper.profile.ProfileProperty;
-
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
@@ -26,9 +24,10 @@ public class SkinDownloader {
Main.skinInProgress.add(player.getUniqueId());
new BukkitRunnable() {
+ @Override
public void run() {
final PlayerProfile profile = player.getPlayerProfile();
-
+
if (shouldChangeName && shouldSendMessage) {
profile.setName(name);
player.sendMessage("Changing your username. Please wait...");
@@ -46,11 +45,12 @@ public class SkinDownloader {
}
new BukkitRunnable() {
+ @Override
public void run() {
try {
if (player.isOnline()) {
player.setPlayerProfile(profile);
-
+
if (shouldChangeName && shouldSendMessage) {
player.sendMessage("Successfully set your username to \"" + name + "\"");
}
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 59ccc5f..66070d3 100644
--- a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java
+++ b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java
@@ -1,32 +1,28 @@
package pw.kaboom.extras.modules.block;
+import java.util.HashSet;
+
import org.bukkit.Bukkit;
import org.bukkit.Material;
-
import org.bukkit.block.BlockFace;
import org.bukkit.entity.EntityType;
-
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-
import org.bukkit.event.block.BlockFormEvent;
import org.bukkit.event.block.BlockFromToEvent;
import org.bukkit.event.block.BlockRedstoneEvent;
-
import org.bukkit.event.entity.EntityChangeBlockEvent;
-import org.bukkit.plugin.java.JavaPlugin;
-
import com.destroystokyo.paper.event.block.BlockDestroyEvent;
-import pw.kaboom.extras.Main;
-
public class BlockPhysics implements Listener {
+ public static HashSet blockFaces = new HashSet();
+
@EventHandler
void onBlockForm(BlockFormEvent event) {
if (event.getBlock().getType() == Material.LAVA ||
event.getBlock().getType() == Material.WATER) {
- for (BlockFace face : Main.faces) {
+ for (BlockFace face : blockFaces) {
if (event.getBlock().getRelative(face).getType() != Material.LAVA &&
event.getBlock().getRelative(face).getType() != Material.WATER) {
return;
@@ -43,24 +39,24 @@ public class BlockPhysics implements Listener {
boolean lavaFound = false;
boolean waterFound = false;
- for (BlockFace face : Main.faces) {
+ for (BlockFace face : blockFaces) {
if (event.getBlock().getRelative(face).getType() == Material.LAVA) {
lavaFound = true;
} else if (event.getBlock().getRelative(face).getType() == Material.WATER) {
waterFound = true;
}
-
+
if (lavaFound && waterFound) {
event.setCancelled(true);
}
}
}
}
-
+
@EventHandler
void onBlockDestroy(BlockDestroyEvent event) {
if (!event.getBlock().getType().isSolid()) {
- for (BlockFace face : Main.faces) {
+ for (BlockFace face : blockFaces) {
if (event.getBlock().getRelative(face).getType() != event.getBlock().getType()) {
return;
}
@@ -78,9 +74,9 @@ public class BlockPhysics implements Listener {
event.setNewCurrent(0);
}
}
-
+
int fallingBlockCount;
-
+
@EventHandler
void onEntityChangeBlock(EntityChangeBlockEvent event) {
if (event.getEntityType() == EntityType.FALLING_BLOCK &&
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 e587906..b048456 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java
@@ -4,35 +4,33 @@ import java.util.HashMap;
import java.util.UUID;
import org.bukkit.command.CommandSender;
-
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import pw.kaboom.extras.modules.server.ServerCommand;
public class PlayerCommand implements Listener {
- static HashMap commandMillisList = new HashMap<>();
+ static HashMap commandMillisList = new HashMap();
@EventHandler
void onPlayerCommandPreprocess(PlayerCommandPreprocessEvent event) {
final UUID playerUuid = event.getPlayer().getUniqueId();
-
+
if (commandMillisList.get(playerUuid) != null) {
final long millisDifference = System.currentTimeMillis() - commandMillisList.get(playerUuid);
-
+
if (millisDifference < 75) {
event.setCancelled(true);
}
}
-
+
commandMillisList.put(playerUuid, System.currentTimeMillis());
-
+
if (event.isCancelled()) {
return;
}
-
+
final CommandSender sender = event.getPlayer();
final String command = event.getMessage();
final boolean isConsoleCommand = false;
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 e96b307..06ad988 100644
--- a/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
+++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java
@@ -5,24 +5,23 @@ import java.util.UUID;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-
import org.bukkit.event.player.PlayerInteractEvent;
public class PlayerInteract implements Listener {
- static HashMap interactMillisList = new HashMap<>();
+ static HashMap interactMillisList = new HashMap();
@EventHandler
void onPlayerInteract(PlayerInteractEvent event) {
final UUID playerUuid = event.getPlayer().getUniqueId();
-
+
if (interactMillisList.get(playerUuid) != null) {
final long millisDifference = System.currentTimeMillis() - interactMillisList.get(playerUuid);
-
+
if (millisDifference < 150) {
event.setCancelled(true);
}
}
-
+
interactMillisList.put(playerUuid, System.currentTimeMillis());
}
}
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 fa23274..48179bd 100644
--- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java
+++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java
@@ -1,34 +1,33 @@
package pw.kaboom.extras.modules.server;
-import org.bukkit.ChatColor;
+import java.util.HashSet;
+import org.bukkit.ChatColor;
import org.bukkit.command.BlockCommandSender;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
-
import org.bukkit.event.server.ServerCommandEvent;
-import pw.kaboom.extras.Main;
-
public class ServerCommand implements Listener {
+ public static HashSet consoleCommandBlacklist = new HashSet();
+
public static String checkCommand(CommandSender sender, String command, boolean isConsoleCommand) {
final String[] arr = command.split(" ");
String commandName = arr[0].toLowerCase();
-
+
if (isConsoleCommand) {
commandName = "/" + arr[0].toLowerCase();
}
-
+
try {
switch (commandName) {
case "/minecraft:execute":
case "/execute":
if (arr.length >= 2) {
int asAtCount = 0;
-
+
for (int i = 1; i < arr.length; i++) {
if ("run".equalsIgnoreCase(arr[i])) {
if (i+1 < arr.length) {
@@ -57,13 +56,13 @@ public class ServerCommand implements Listener {
}
break;
}
-
+
if ("as".equalsIgnoreCase(arr[i]) ||
"at".equalsIgnoreCase(arr[i])) {
asAtCount++;
}
}
-
+
if (asAtCount >= 2) {
Command.broadcastCommandMessage(sender, "Forbidden execute pattern detected");
return "cancel";
@@ -155,7 +154,7 @@ public class ServerCommand implements Listener {
final String[] arr = event.getCommand().split(" ");
if (sender instanceof BlockCommandSender) {
- if (Main.consoleCommandBlacklist.contains(arr[0].toLowerCase())) {
+ if (consoleCommandBlacklist.contains(arr[0].toLowerCase())) {
event.setCancelled(true);
}
}
@@ -163,7 +162,7 @@ public class ServerCommand implements Listener {
final String command = event.getCommand();
final boolean isConsoleCommand = true;
final String checkedCommand = checkCommand(sender, command, isConsoleCommand);
-
+
if (checkedCommand != null) {
if (checkedCommand.equals("cancel")) {
event.setCancelled(true);
diff --git a/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java b/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java
index 74f8e09..c31534d 100644
--- a/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java
+++ b/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java
@@ -13,6 +13,6 @@ public class ServerPing implements Listener {
} else {
event.setProtocolVersion(event.getClient().getProtocolVersion());
}
- event.setVersion("1.15");
+ event.setVersion("1.15.1");
}
}
diff --git a/suppressions.xml b/suppressions.xml
new file mode 100644
index 0000000..3b75716
--- /dev/null
+++ b/suppressions.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file