Fix package paths

This commit is contained in:
mathiascode 2019-12-17 14:37:59 +02:00
parent f8eeaed1fc
commit d3d5140fe4
31 changed files with 102 additions and 172 deletions

6
.gitignore vendored
View file

@ -1,2 +1,4 @@
.gradle/
target/
.settings/
target/
.classpath
.project

View file

@ -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<UUID> skinInProgress = new HashSet<>();
public static HashSet<UUID> skinInProgress = new HashSet<>();
static HashSet<String> consoleCommandBlacklist = new HashSet<>();
static HashSet<BlockFace> faces = new HashSet<>();
public static HashSet<String> consoleCommandBlacklist = new HashSet<>();
public static HashSet<BlockFace> faces = new HashSet<>();
public void onLoad() {
/* Fill lists */

View file

@ -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) {

View file

@ -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 + " <message ..>");

View file

@ -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;

View file

@ -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");

View file

@ -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++) {

View file

@ -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");

View file

@ -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));
}

View file

@ -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 + ": " +

View file

@ -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");

View file

@ -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");

View file

@ -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");

View file

@ -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 + " <message ..>");

View file

@ -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;

View file

@ -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");

View file

@ -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;

View file

@ -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) {

View file

@ -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];

View file

@ -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) {

View file

@ -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;

View file

@ -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;
}
}

View file

@ -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()));

View file

@ -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();

View file

@ -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<UUID, Long> commandMillisList = new HashMap<>();
@EventHandler

View file

@ -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());

View file

@ -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) {

View file

@ -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<UUID, Long> interactMillisList = new HashMap<>();
@EventHandler
void onPlayerInteract(PlayerInteractEvent event) {
final Player player = event.getPlayer();
final UUID playerUuid = event.getPlayer().getUniqueId();
if (interactMillisList.get(playerUuid) != null) {

View file

@ -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()));

View file

@ -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;

View file

@ -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) {