From 92d9e4ad64bb74fd4aa772416b2e15a52b653bcf Mon Sep 17 00:00:00 2001 From: mathiascode Date: Sat, 18 Apr 2020 17:13:03 +0300 Subject: [PATCH] Remove outdated command --- src/main/java/pw/kaboom/extras/Main.java | 2 -- .../extras/commands/CommandUnloadChunks.java | 26 ------------------- .../extras/modules/block/BlockPhysics.java | 7 +++++ .../extras/modules/player/PlayerDamage.java | 16 +----------- src/main/resources/plugin.yml | 4 --- 5 files changed, 8 insertions(+), 47 deletions(-) delete mode 100644 src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java diff --git a/src/main/java/pw/kaboom/extras/Main.java b/src/main/java/pw/kaboom/extras/Main.java index c702421..06f408b 100644 --- a/src/main/java/pw/kaboom/extras/Main.java +++ b/src/main/java/pw/kaboom/extras/Main.java @@ -25,7 +25,6 @@ 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; @@ -77,7 +76,6 @@ public final class Main extends JavaPlugin { this.getCommand("spawn").setExecutor(new CommandSpawn()); this.getCommand("spidey").setExecutor(new CommandSpidey()); this.getCommand("tellraw").setExecutor(new CommandTellraw()); - this.getCommand("unloadchunks").setExecutor(new CommandUnloadChunks()); this.getCommand("username").setExecutor(new CommandUsername()); ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(this, ListenerPriority.NORMAL, PacketType.Play.Client.WINDOW_CLICK) { diff --git a/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java b/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java deleted file mode 100644 index 044395b..0000000 --- a/src/main/java/pw/kaboom/extras/commands/CommandUnloadChunks.java +++ /dev/null @@ -1,26 +0,0 @@ -package pw.kaboom.extras.commands; - -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.World; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -public final class CommandUnloadChunks implements CommandExecutor { - public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) { - int chunkCount = 0; - - for (World world : Bukkit.getServer().getWorlds()) { - for (Chunk chunk : world.getLoadedChunks()) { - if (chunk.unload()) { - chunkCount++; - } - } - } - - sender.sendMessage("Unloaded " + chunkCount + " unused chunks"); - return true; - } -} 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 8a9ef85..f73defc 100644 --- a/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java +++ b/src/main/java/pw/kaboom/extras/modules/block/BlockPhysics.java @@ -105,12 +105,19 @@ public final class BlockPhysics implements Listener { case REDSTONE_TORCH: case REDSTONE_WIRE: 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())) { event.setCancelled(true); } return; + case COMMAND_BLOCK: + case CHAIN_COMMAND_BLOCK: + case REPEATING_COMMAND_BLOCK: + if (Material.STRUCTURE_BLOCK.equals(event.getSourceBlock().getType())) { + event.setCancelled(true); + } default: break; } 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 32a8f9c..4944513 100644 --- a/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java +++ b/src/main/java/pw/kaboom/extras/modules/player/PlayerDamage.java @@ -1,10 +1,7 @@ package pw.kaboom.extras.modules.player; import org.bukkit.Bukkit; -import org.bukkit.Location; import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; import org.bukkit.entity.EntityType; import org.bukkit.entity.ExperienceOrb; import org.bukkit.entity.HumanEntity; @@ -78,18 +75,7 @@ public final class PlayerDamage implements Listener { player.teleportAsync(player.getBedSpawnLocation()); } else { final World world = Bukkit.getWorld("world"); - final Location spawnLocation = world.getSpawnLocation(); - - for (double y = spawnLocation.getY(); y <= 256; y++) { - final Location yLocation = new Location(world, spawnLocation.getX(), y, spawnLocation.getZ()); - final Block coordBlock = world.getBlockAt(yLocation); - - if (!coordBlock.getType().isSolid() - && !coordBlock.getRelative(BlockFace.UP).getType().isSolid()) { - player.teleportAsync(yLocation); - break; - } - } + player.teleportAsync(world.getSpawnLocation()); } } catch (Exception exception) { player.setMaxHealth(Double.POSITIVE_INFINITY); diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index cb07132..76e115b 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -55,10 +55,6 @@ commands: spidey: description: Annoying little spider... permission: extras.spidey - unloadchunks: - aliases: uc - description: Unloads all unused chunks - permission: extras.unloadchunks username: description: Changes your username on the server permission: extras.username