From d3d5140fe48b40e247d2761267acc48d303e7a93 Mon Sep 17 00:00:00 2001 From: mathiascode Date: Tue, 17 Dec 2019 14:37:59 +0200 Subject: [PATCH] Fix package paths --- .gitignore | 6 ++-- src/main/java/pw/kaboom/extras/Main.java | 12 ++++--- .../extras/commands/CommandClearChat.java | 4 +-- .../extras/commands/CommandConsole.java | 6 ++-- .../commands/CommandDestroyEntities.java | 5 ++- .../extras/commands/CommandEnchantAll.java | 4 +-- .../extras/commands/CommandJumpscare.java | 4 +-- .../kaboom/extras/commands/CommandPrefix.java | 6 ++-- .../extras/commands/CommandPumpkin.java | 4 +-- .../extras/commands/CommandServerInfo.java | 6 ++-- .../kaboom/extras/commands/CommandSkin.java | 7 ++-- .../kaboom/extras/commands/CommandSpawn.java | 4 +-- .../kaboom/extras/commands/CommandSpidey.java | 5 ++- .../extras/commands/CommandTellraw.java | 4 +-- .../extras/commands/CommandUnloadChunks.java | 6 ++-- .../extras/commands/CommandUsername.java | 7 ++-- .../kaboom/extras/helpers/SkinDownloader.java | 6 ++-- .../extras/modules/block/BlockCheck.java | 27 ++------------- .../extras/modules/block/BlockPhysics.java | 24 ++++--------- .../modules/entity/EntityExplosion.java | 4 +-- .../modules/entity/EntityKnockback.java | 4 +-- .../extras/modules/entity/EntitySpawn.java | 34 +++---------------- .../extras/modules/entity/EntityTeleport.java | 4 +-- .../extras/modules/player/PlayerChat.java | 6 ++-- .../extras/modules/player/PlayerCommand.java | 12 ++----- .../modules/player/PlayerConnection.java | 21 ++++-------- .../extras/modules/player/PlayerDamage.java | 7 ++-- .../extras/modules/player/PlayerInteract.java | 7 ++-- .../extras/modules/player/PlayerTeleport.java | 6 ++-- .../extras/modules/server/ServerCommand.java | 18 +++++----- .../extras/modules/server/ServerPing.java | 4 +-- 31 files changed, 102 insertions(+), 172 deletions(-) diff --git a/.gitignore b/.gitignore index d7eca3b..28972e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ -.gradle/ -target/ \ No newline at end of file +.settings/ +target/ +.classpath +.project \ No newline at end of file diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java index 0c884cc..844b211 100644 --- a/src/main/java/pw/kaboom/extras/Main.java +++ b/src/main/java/pw/kaboom/extras/Main.java @@ -7,13 +7,17 @@ import java.util.UUID; import org.bukkit.block.BlockFace; import org.bukkit.plugin.java.JavaPlugin; -import com.destroystokyo.paper.profile.PlayerProfile; +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.*; public class Main extends JavaPlugin { - static HashSet skinInProgress = new HashSet<>(); + public static HashSet skinInProgress = new HashSet<>(); - static HashSet consoleCommandBlacklist = new HashSet<>(); - static HashSet faces = new HashSet<>(); + public static HashSet consoleCommandBlacklist = new HashSet<>(); + public static HashSet faces = new HashSet<>(); public void onLoad() { /* Fill lists */ diff --git a/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java b/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java index ecfe331..ca24e79 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandClearChat.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -class CommandClearChat implements CommandExecutor { +public class CommandClearChat implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { for (Player onlinePlayer : Bukkit.getOnlinePlayers()) { for (int i = 0; i < 100; ++i) { diff --git a/src/main/java/pw/kaboom/extras/commands/CommandConsole.java b/src/main/java/pw/kaboom/extras/commands/CommandConsole.java index b3b4b72..400a446 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandConsole.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandConsole.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -7,9 +7,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -class CommandConsole implements CommandExecutor { +public class CommandConsole implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Usage: /" + label + " "); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java b/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java index a8a2bf4..360b249 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandDestroyEntities.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.World; @@ -9,9 +9,8 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -class CommandDestroyEntities implements CommandExecutor { +public class CommandDestroyEntities implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { int entityCount = 0; int worldCount = 0; diff --git a/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java b/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java index 658b78b..512f4fe 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandEnchantAll.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Material; @@ -13,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -class CommandEnchantAll implements CommandExecutor { +public class CommandEnchantAll implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender instanceof ConsoleCommandSender) { sender.sendMessage("Command has to be run by a player"); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java b/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java index a783958..397efbd 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandJumpscare.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -class CommandJumpscare implements CommandExecutor { +public class CommandJumpscare implements CommandExecutor { private void createJumpscare(Player player) { player.spawnParticle(Particle.MOB_APPEARANCE, player.getLocation(), 4); for (int i = 0; i < 10; i++) { diff --git a/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java b/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java index da898c8..3827b13 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandPrefix.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import java.io.File; @@ -16,7 +16,9 @@ import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; -class CommandPrefix implements CommandExecutor { +import pw.kaboom.extras.Main; + +public class CommandPrefix implements CommandExecutor { public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { if (sender instanceof ConsoleCommandSender) { sender.sendMessage("Command has to be run by a player"); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java b/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java index fa44216..a92246e 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandPumpkin.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -12,7 +12,7 @@ import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; -class CommandPumpkin implements CommandExecutor { +public class CommandPumpkin implements CommandExecutor { private void placePumpkin(Player player) { player.getInventory().setHelmet(new ItemStack(Material.CARVED_PUMPKIN)); } diff --git a/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java b/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java index 22353f3..2f7f8ca 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandServerInfo.java @@ -1,11 +1,9 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import java.io.BufferedReader; import java.io.InputStreamReader; import java.lang.management.ManagementFactory; -import java.lang.management.MemoryPoolMXBean; - import java.net.InetAddress; import org.bukkit.ChatColor; @@ -14,7 +12,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -class CommandServerInfo implements CommandExecutor { +public class CommandServerInfo implements CommandExecutor { private void sendInfoMessage(CommandSender target, String description, String value) { target.sendMessage( ChatColor.GRAY + description + ": " + diff --git a/src/main/java/pw/kaboom/extras/commands/CommandSkin.java b/src/main/java/pw/kaboom/extras/commands/CommandSkin.java index 6bcfa05..718a5f0 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandSkin.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandSkin.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.ChatColor; @@ -9,7 +9,10 @@ import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -class CommandSkin implements CommandExecutor { +import pw.kaboom.extras.Main; +import pw.kaboom.extras.helpers.SkinDownloader; + +public class CommandSkin implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, final String[] args) { if (sender instanceof ConsoleCommandSender) { sender.sendMessage("Command has to be run by a player"); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java b/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java index 144e848..7edeeac 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandSpawn.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -14,7 +14,7 @@ import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -class CommandSpawn implements CommandExecutor { +public class CommandSpawn implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender instanceof ConsoleCommandSender) { sender.sendMessage("Command has to be run by a player"); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java b/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java index 8a9b4ca..93a5ac2 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandSpidey.java @@ -1,6 +1,5 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; -import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -14,7 +13,7 @@ import org.bukkit.entity.Player; import org.bukkit.util.BlockIterator; import org.bukkit.util.Vector; -class CommandSpidey implements CommandExecutor { +public class CommandSpidey implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (sender instanceof ConsoleCommandSender) { sender.sendMessage("Command has to be run by a player"); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java b/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java index 112426b..47c8bcd 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandTellraw.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.ChatColor; @@ -9,7 +9,7 @@ import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; -class CommandTellraw implements CommandExecutor { +public class CommandTellraw implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { if (args.length == 0) { sender.sendMessage(ChatColor.RED + "Usage: /" + label + " "); diff --git a/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java b/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java index 0c175ac..4cc9742 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.Bukkit; import org.bukkit.Chunk; @@ -8,9 +8,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; -import org.bukkit.entity.Player; - -class CommandUnloadChunks implements CommandExecutor { +public class CommandUnloadChunks implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { int chunkCount = 0; diff --git a/src/main/java/pw/kaboom/extras/commands/CommandUsername.java b/src/main/java/pw/kaboom/extras/commands/CommandUsername.java index 22a0e0a..b430cf2 100644 --- a/src/main/java/pw/kaboom/extras/commands/CommandUsername.java +++ b/src/main/java/pw/kaboom/extras/commands/CommandUsername.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.commands; import org.bukkit.ChatColor; @@ -9,7 +9,10 @@ import org.bukkit.command.ConsoleCommandSender; import org.bukkit.entity.Player; -class CommandUsername implements CommandExecutor { +import pw.kaboom.extras.Main; +import pw.kaboom.extras.helpers.SkinDownloader; + +public class CommandUsername implements CommandExecutor { public boolean onCommand(CommandSender sender, Command command, String label, final String[] args) { if (sender instanceof ConsoleCommandSender) { sender.sendMessage("Command has to be run by a player"); diff --git a/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java b/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java index af0e196..9e72ccd 100644 --- a/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java +++ b/src/main/java/pw/kaboom/extras/helpers/SkinDownloader.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.helpers; import java.io.InputStreamReader; import java.net.URL; @@ -16,7 +16,9 @@ import com.destroystokyo.paper.profile.ProfileProperty; import com.google.gson.JsonObject; import com.google.gson.JsonParser; -class SkinDownloader { +import pw.kaboom.extras.Main; + +public class SkinDownloader { private String texture; private String signature; diff --git a/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java b/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java index 4250ec8..afdcc89 100644 --- a/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java +++ b/src/main/java/pw/kaboom/extras/modules/block/BlockCheck.java @@ -1,7 +1,4 @@ -package pw.kaboom.extras; - -import org.bukkit.block.BlockState; -import org.bukkit.block.CommandBlock; +package pw.kaboom.extras.modules.block; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -9,9 +6,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockPlaceEvent; import org.bukkit.event.block.SignChangeEvent; -import org.bukkit.event.world.ChunkLoadEvent; - -class BlockCheck implements Listener { +public class BlockCheck implements Listener { @EventHandler void onBlockPlace(BlockPlaceEvent event) { if (event.getItemInHand().toString().length() > 3019) { @@ -24,24 +19,6 @@ class BlockCheck implements Listener { event.setCancelled(true); } } - - @EventHandler - void onChunkLoad(ChunkLoadEvent event) { - if (!event.isNewChunk()) { - try { - for (BlockState block : event.getChunk().getTileEntities()) { - if (block instanceof CommandBlock) { - block.update(); - } - } - } catch (Exception exception) { - event.getChunk().getWorld().regenerateChunk( - event.getChunk().getX(), - event.getChunk().getZ() - ); - } - } - } @EventHandler void onSignChange(SignChangeEvent event) { 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 dc939da..59ccc5f 100644 --- a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java +++ b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java @@ -1,13 +1,9 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.block; import org.bukkit.Bukkit; import org.bukkit.Material; -import org.bukkit.block.Block; import org.bukkit.block.BlockFace; -import org.bukkit.block.BlockState; -import org.bukkit.block.CommandBlock; - import org.bukkit.entity.EntityType; import org.bukkit.event.EventHandler; @@ -15,7 +11,6 @@ import org.bukkit.event.Listener; import org.bukkit.event.block.BlockFormEvent; import org.bukkit.event.block.BlockFromToEvent; -import org.bukkit.event.block.BlockPhysicsEvent; import org.bukkit.event.block.BlockRedstoneEvent; import org.bukkit.event.entity.EntityChangeBlockEvent; @@ -24,12 +19,14 @@ import org.bukkit.plugin.java.JavaPlugin; import com.destroystokyo.paper.event.block.BlockDestroyEvent; -class BlockPhysics implements Listener { +import pw.kaboom.extras.Main; + +public class BlockPhysics implements Listener { @EventHandler void onBlockForm(BlockFormEvent event) { if (event.getBlock().getType() == Material.LAVA || event.getBlock().getType() == Material.WATER) { - for (BlockFace face : JavaPlugin.getPlugin(Main.class).faces) { + for (BlockFace face : Main.faces) { if (event.getBlock().getRelative(face).getType() != Material.LAVA && event.getBlock().getRelative(face).getType() != Material.WATER) { return; @@ -46,7 +43,7 @@ class BlockPhysics implements Listener { boolean lavaFound = false; boolean waterFound = false; - for (BlockFace face : JavaPlugin.getPlugin(Main.class).faces) { + for (BlockFace face : Main.faces) { if (event.getBlock().getRelative(face).getType() == Material.LAVA) { lavaFound = true; } else if (event.getBlock().getRelative(face).getType() == Material.WATER) { @@ -63,7 +60,7 @@ class BlockPhysics implements Listener { @EventHandler void onBlockDestroy(BlockDestroyEvent event) { if (!event.getBlock().getType().isSolid()) { - for (BlockFace face : JavaPlugin.getPlugin(Main.class).faces) { + for (BlockFace face : Main.faces) { if (event.getBlock().getRelative(face).getType() != event.getBlock().getType()) { return; } @@ -73,13 +70,6 @@ class BlockPhysics implements Listener { } } - /*@EventHandler - void onBlockPhysics(BlockPhysicsEvent event) { - if (event.getSourceBlock().getState() instanceof CommandBlock) { - event.getSourceBlock().getState().update(); - } - }*/ - @EventHandler void onBlockRedstone(BlockRedstoneEvent event) { final double tps = Bukkit.getServer().getTPS()[0]; 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 2787f14..2da5483 100644 --- a/src/main/java/pw/kaboom/extras/modules/entity/EntityExplosion.java +++ b/src/main/java/pw/kaboom/extras/modules/entity/EntityExplosion.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.entity; import org.bukkit.entity.Fireball; @@ -7,7 +7,7 @@ import org.bukkit.event.Listener; import org.bukkit.event.entity.ExplosionPrimeEvent; -class EntityExplosion implements Listener { +public class EntityExplosion implements Listener { @EventHandler void onExplosionPrime(ExplosionPrimeEvent event) { if (event.getRadius() > 20) { diff --git a/src/main/java/pw/kaboom/extras/modules/entity/EntityKnockback.java b/src/main/java/pw/kaboom/extras/modules/entity/EntityKnockback.java index 3169343..2881512 100644 --- a/src/main/java/pw/kaboom/extras/modules/entity/EntityKnockback.java +++ b/src/main/java/pw/kaboom/extras/modules/entity/EntityKnockback.java @@ -1,11 +1,11 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.entity; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import com.destroystokyo.paper.event.entity.EntityKnockbackByEntityEvent; -class EntityKnockback implements Listener { +public class EntityKnockback implements Listener { @EventHandler void onEntityKnockbackByEntity(EntityKnockbackByEntityEvent event) { final int knockbackLimit = 60; 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 e2288a1..0fb1939 100644 --- a/src/main/java/pw/kaboom/extras/modules/entity/EntitySpawn.java +++ b/src/main/java/pw/kaboom/extras/modules/entity/EntitySpawn.java @@ -1,9 +1,6 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.entity; -import org.bukkit.Bukkit; import org.bukkit.Chunk; -import org.bukkit.DyeColor; -import org.bukkit.FireworkEffect; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -11,10 +8,7 @@ import org.bukkit.World; import org.bukkit.attribute.Attribute; import org.bukkit.attribute.AttributeInstance; -import org.bukkit.block.BlockState; import org.bukkit.block.CreatureSpawner; -import org.bukkit.block.ShulkerBox; - import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; @@ -23,31 +17,17 @@ import org.bukkit.entity.EnderDragon; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.FallingBlock; -import org.bukkit.entity.Firework; import org.bukkit.entity.LivingEntity; -import org.bukkit.entity.MagmaCube; import org.bukkit.entity.Slime; import org.bukkit.entity.TNTPrimed; import org.bukkit.entity.Vehicle; -import org.bukkit.event.block.BlockDispenseEvent; - import org.bukkit.event.entity.AreaEffectCloudApplyEvent; -import org.bukkit.event.entity.EntityAirChangeEvent; import org.bukkit.event.entity.EntitySpawnEvent; -import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.SpawnerSpawnEvent; import org.bukkit.event.vehicle.VehicleCreateEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BannerMeta; -import org.bukkit.inventory.meta.BlockStateMeta; -import org.bukkit.inventory.meta.ItemMeta; -import org.bukkit.inventory.meta.LeatherArmorMeta; -import org.bukkit.inventory.meta.PotionMeta; - import com.destroystokyo.paper.event.block.TNTPrimeEvent; import com.destroystokyo.paper.event.block.TNTPrimeEvent.PrimeReason; @@ -55,16 +35,8 @@ import com.destroystokyo.paper.event.entity.EntityAddToWorldEvent; import com.destroystokyo.paper.event.entity.PreCreatureSpawnEvent; import com.destroystokyo.paper.event.entity.PreSpawnerSpawnEvent; -import org.bukkit.block.banner.Pattern; - -import org.bukkit.plugin.java.JavaPlugin; - -import org.bukkit.scheduler.BukkitRunnable; - -class EntitySpawn implements Listener { +public class EntitySpawn implements Listener { private void applyEntityChanges(Entity entity) { - final World world = entity.getWorld(); - if (entity instanceof LivingEntity) { final LivingEntity mob = (LivingEntity) entity; @@ -82,6 +54,8 @@ class EntitySpawn implements Listener { final Slime slime = (Slime) entity; limitSlimeSize(slime); + default: + break; } } diff --git a/src/main/java/pw/kaboom/extras/modules/entity/EntityTeleport.java b/src/main/java/pw/kaboom/extras/modules/entity/EntityTeleport.java index 9804b8a..0bfc7bd 100644 --- a/src/main/java/pw/kaboom/extras/modules/entity/EntityTeleport.java +++ b/src/main/java/pw/kaboom/extras/modules/entity/EntityTeleport.java @@ -1,11 +1,11 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.entity; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityTeleportEvent; -class EntityTeleport implements Listener { +public class EntityTeleport implements Listener { @EventHandler void onEntityTeleport(EntityTeleportEvent event) { event.setTo(EntitySpawn.limitLocation(event.getTo())); 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 3793972..451ccdb 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerChat.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.player; import java.io.File; import java.util.UUID; @@ -17,7 +17,9 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.plugin.java.JavaPlugin; -class PlayerChat implements Listener { +import pw.kaboom.extras.Main; + +public class PlayerChat implements Listener { @EventHandler void onAsyncPlayerChat(AsyncPlayerChatEvent event) { final Player player = event.getPlayer(); 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 e351663..e587906 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerCommand.java @@ -1,12 +1,8 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.player; import java.util.HashMap; import java.util.UUID; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; - -import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.event.EventHandler; @@ -14,11 +10,9 @@ import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerCommandPreprocessEvent; -import org.bukkit.scheduler.BukkitRunnable; +import pw.kaboom.extras.modules.server.ServerCommand; -import org.bukkit.plugin.java.JavaPlugin; - -class PlayerCommand implements Listener { +public class PlayerCommand implements Listener { static HashMap commandMillisList = new HashMap<>(); @EventHandler 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 5f78490..31a69f1 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerConnection.java @@ -1,23 +1,14 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.player; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.block.BlockState; -import org.bukkit.block.banner.Pattern; - import org.bukkit.entity.Player; -import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.inventory.InventoryCloseEvent; - import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; @@ -25,13 +16,12 @@ import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerQuitEvent; -import org.bukkit.inventory.Inventory; -import org.bukkit.inventory.ItemStack; -import org.bukkit.inventory.meta.BannerMeta; - import org.bukkit.plugin.java.JavaPlugin; -class PlayerConnection implements Listener { +import pw.kaboom.extras.Main; +import pw.kaboom.extras.helpers.SkinDownloader; + +public class PlayerConnection implements Listener { @EventHandler void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) { if (event.getName().length() > 16) { @@ -107,6 +97,7 @@ class PlayerConnection implements Listener { skinDownloader.applySkin(player, player.getName(), shouldChangeUsername, shouldSendMessage); } + @SuppressWarnings("deprecation") @EventHandler void onPlayerQuit(PlayerQuitEvent event) { PlayerCommand.commandMillisList.remove(event.getPlayer().getUniqueId()); 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 b03dd07..f01e509 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.player; import org.bukkit.Bukkit; import org.bukkit.Location; @@ -21,12 +21,9 @@ import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.PlayerDeathEvent; -import org.bukkit.event.entity.EntityTeleportEvent; -import org.bukkit.event.player.PlayerTeleportEvent; - import org.bukkit.inventory.ItemStack; -class PlayerDamage implements Listener { +public class PlayerDamage implements Listener { @EventHandler void onEntityDamage(EntityDamageEvent event) { if (event.getEntityType() == EntityType.PLAYER) { 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 7d37e96..e96b307 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerInteract.java @@ -1,21 +1,18 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.player; import java.util.HashMap; import java.util.UUID; -import org.bukkit.entity.Player; - import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerInteractEvent; -class PlayerInteract implements Listener { +public class PlayerInteract implements Listener { static HashMap interactMillisList = new HashMap<>(); @EventHandler void onPlayerInteract(PlayerInteractEvent event) { - final Player player = event.getPlayer(); final UUID playerUuid = event.getPlayer().getUniqueId(); if (interactMillisList.get(playerUuid) != null) { diff --git a/src/main/java/pw/kaboom/extras/modules/player/PlayerTeleport.java b/src/main/java/pw/kaboom/extras/modules/player/PlayerTeleport.java index 84be1fe..6b18f3f 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerTeleport.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerTeleport.java @@ -1,11 +1,13 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import org.bukkit.event.player.PlayerTeleportEvent; -class PlayerTeleport implements Listener { +import pw.kaboom.extras.modules.entity.EntitySpawn; + +public class PlayerTeleport implements Listener { @EventHandler void onPlayerTeleport(PlayerTeleportEvent event) { event.setTo(EntitySpawn.limitLocation(event.getTo())); 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 49d1c3c..fa23274 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerCommand.java @@ -1,4 +1,4 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.server; import org.bukkit.ChatColor; @@ -6,16 +6,14 @@ import org.bukkit.command.BlockCommandSender; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; -import org.bukkit.block.Block; -import org.bukkit.block.CommandBlock; - import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; -import org.bukkit.event.server.RemoteServerCommandEvent; import org.bukkit.event.server.ServerCommandEvent; -class ServerCommand implements Listener { +import pw.kaboom.extras.Main; + +public class ServerCommand implements Listener { public static String checkCommand(CommandSender sender, String command, boolean isConsoleCommand) { final String[] arr = command.split(" "); String commandName = arr[0].toLowerCase(); @@ -51,8 +49,8 @@ class ServerCommand implements Listener { return command.replaceFirst("(?i)" + "spawnRadius " + arr[i+3], "spawnRadius 100"); } } else if ("give".equalsIgnoreCase(arr[i+1])) { - if (Double.parseDouble(arr[arr.length-1]) > 1024) { - arr[arr.length-1] = "1024"; + if (Double.parseDouble(arr[arr.length-1]) > 64) { + arr[arr.length-1] = "64"; return String.join(" ", arr); } } @@ -86,8 +84,8 @@ class ServerCommand implements Listener { break; case "/minecraft:give": case "/give": - if (Double.parseDouble(arr[arr.length-1]) > 1024) { - arr[arr.length-1] = "1024"; + if (Double.parseDouble(arr[arr.length-1]) > 64) { + arr[arr.length-1] = "64"; return String.join(" ", arr); } break; 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 9949f24..74f8e09 100644 --- a/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java +++ b/src/main/java/pw/kaboom/extras/modules/server/ServerPing.java @@ -1,11 +1,11 @@ -package pw.kaboom.extras; +package pw.kaboom.extras.modules.server; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; import com.destroystokyo.paper.event.server.PaperServerListPingEvent; -class ServerPing implements Listener { +public class ServerPing implements Listener { @EventHandler void onServerListPing(PaperServerListPingEvent event) { if (event.getClient().getProtocolVersion() == -1) {