forked from kaboomserver/extras
Something, something
This commit is contained in:
parent
5b5a6943fb
commit
673bef2212
6 changed files with 60 additions and 18 deletions
|
@ -5,20 +5,7 @@ import java.util.Collections;
|
|||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
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.commands.*;
|
||||
import pw.kaboom.extras.modules.block.BlockCheck;
|
||||
import pw.kaboom.extras.modules.block.BlockPhysics;
|
||||
import pw.kaboom.extras.modules.entity.EntityExplosion;
|
||||
|
@ -426,6 +413,7 @@ public final class Main extends JavaPlugin {
|
|||
this.getCommand("destroyentities").setExecutor(new CommandDestroyEntities());
|
||||
this.getCommand("enchantall").setExecutor(new CommandEnchantAll());
|
||||
this.getCommand("jumpscare").setExecutor(new CommandJumpscare());
|
||||
this.getCommand("kaboom").setExecutor(new CommandKaboom());
|
||||
this.getCommand("prefix").setExecutor(new CommandPrefix());
|
||||
this.getCommand("pumpkin").setExecutor(new CommandPumpkin());
|
||||
this.getCommand("serverinfo").setExecutor(new CommandServerInfo());
|
||||
|
|
52
src/main/java/pw/kaboom/extras/commands/CommandKaboom.java
Normal file
52
src/main/java/pw/kaboom/extras/commands/CommandKaboom.java
Normal file
|
@ -0,0 +1,52 @@
|
|||
package pw.kaboom.extras.commands;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public final class CommandKaboom implements CommandExecutor {
|
||||
private double getRandom(final int min, final int max) {
|
||||
return new Random().nextInt(max - min + 1) + min;
|
||||
}
|
||||
|
||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||
final Player player = (Player) sender;
|
||||
int random = new Random().nextBoolean() ? 0 : 1;
|
||||
|
||||
if (random == 0) {
|
||||
final Location location = player.getLocation();
|
||||
final World world = player.getWorld();
|
||||
final int explosionCount = 20;
|
||||
final int power = 8;
|
||||
|
||||
world.createExplosion(location, power, true, true);
|
||||
|
||||
for (int i = 0; i < explosionCount; i++) {
|
||||
final double posX = location.getX() + getRandom(-15, 15);
|
||||
final double posY = location.getY() + getRandom(-6, 6);
|
||||
final double posZ = location.getZ() + getRandom(-15, 15);
|
||||
|
||||
final Location explodeLocation = new Location(world, posX, posY, posZ);
|
||||
final int power2 = 4;
|
||||
|
||||
world.createExplosion(explodeLocation, power2, true, true);
|
||||
explodeLocation.getBlock().setType(Material.LAVA);
|
||||
}
|
||||
|
||||
player.sendMessage("Forgive me :c");
|
||||
} else {
|
||||
player.getInventory().setItemInMainHand(new ItemStack(Material.CAKE));
|
||||
player.sendMessage("Have a nice day :)");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -32,7 +32,7 @@ public final class CommandPumpkin implements CommandExecutor {
|
|||
placePumpkin(target);
|
||||
sender.sendMessage("Player \"" + target.getName() + "\" is now a pumpkin");
|
||||
} else {
|
||||
sender.sendMessage("Player \"" + target.getName() + "\" not found");
|
||||
sender.sendMessage("Player \"" + args[0] + "\" not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.bukkit.command.CommandSender;
|
|||
import org.bukkit.command.ConsoleCommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import pw.kaboom.extras.Main;
|
||||
import pw.kaboom.extras.helpers.SkinDownloader;
|
||||
|
||||
public final class CommandSkin implements CommandExecutor {
|
||||
|
@ -20,7 +19,7 @@ public final class CommandSkin implements CommandExecutor {
|
|||
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <username>");
|
||||
} else if (!Main.skinInProgress.contains(player.getUniqueId())) {
|
||||
} else if (!SkinDownloader.skinInProgress.contains(player.getUniqueId())) {
|
||||
final String name = args[0];
|
||||
final boolean shouldChangeUsername = false;
|
||||
final boolean shouldSendMessage = true;
|
||||
|
|
|
@ -20,7 +20,7 @@ public final class CommandUsername implements CommandExecutor {
|
|||
|
||||
if (args.length == 0) {
|
||||
player.sendMessage(ChatColor.RED + "Usage: /" + label + " <username>");
|
||||
} else if (!Main.skinInProgress.contains(player.getUniqueId())) {
|
||||
} else if (!SkinDownloader.skinInProgress.contains(player.getUniqueId())) {
|
||||
final String nameColor = ChatColor.translateAlternateColorCodes('&', String.join(" ", args));
|
||||
final String name = nameColor.substring(0, Math.min(16, nameColor.length()));
|
||||
final boolean shouldChangeUsername = true;
|
||||
|
|
|
@ -27,6 +27,9 @@ commands:
|
|||
aliases: scare
|
||||
description: Scares a player
|
||||
permission: extras.jumpscare
|
||||
kaboom:
|
||||
description: I wonder...
|
||||
permission: extras.kaboom
|
||||
prefix:
|
||||
aliases: [rank, tag]
|
||||
description: Changes your tag
|
||||
|
|
Loading…
Reference in a new issue