Initial commit
This commit is contained in:
+72
@@ -0,0 +1,72 @@
|
||||
package net.crankedpvp.deadmanschest.commands;
|
||||
|
||||
import me.mattstudios.mf.annotations.*;
|
||||
import me.mattstudios.mf.base.CommandBase;
|
||||
import net.crankedpvp.deadmanschest.DeadmansChestPlugin;
|
||||
import net.crankedpvp.crankedutils.utils.CC;
|
||||
import net.crankedpvp.crankedutils.utils.CustomItemUtils;
|
||||
import net.crankedpvp.crankedutils.utils.InventoryUtils;
|
||||
import net.crankedpvp.crankedutils.utils.SoundUtils;
|
||||
import net.crankedpvp.crankedutils.utils.items.ItemBuilder;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@Command("deadmanschest")
|
||||
@Alias({"dmc", "deadman", "deadmans", "deadchest"})
|
||||
public class DeadmansChestCommand extends CommandBase {
|
||||
|
||||
private final DeadmansChestPlugin plugin;
|
||||
public DeadmansChestCommand(DeadmansChestPlugin plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Default
|
||||
public void defaultCommand(final Player player) {
|
||||
this.plugin.getDeadmansChestInventory().getUI().open(player);
|
||||
}
|
||||
|
||||
@SubCommand("start")
|
||||
@Permission("cranked.admin")
|
||||
public void startCommand(final CommandSender commandSender) {
|
||||
this.plugin.getDeadmansChestManager().start();
|
||||
commandSender.sendMessage(CC.translate(DeadmansChestPlugin.PREFIX + "You have forcefully started a dead mans chest event"));
|
||||
}
|
||||
|
||||
@SubCommand("edit")
|
||||
@Alias("editor")
|
||||
@Permission("cranked.admin")
|
||||
public void editCommand(final Player player) {
|
||||
if(InventoryUtils.hasAvailableSlot(player)) {
|
||||
final ItemBuilder itemBuilder = new ItemBuilder(Material.CHEST, "&d&lDead Mans Chest Location Setter",
|
||||
"&7Place this chest down at the",
|
||||
"&7locations that you want the",
|
||||
"&7DMC events to spawn at");
|
||||
final ItemStack itemStack = CustomItemUtils.setCrankedCustomItem(itemBuilder.colorize().build(), "deadmansChestLocationSetter");
|
||||
player.getInventory().addItem(itemStack);
|
||||
player.sendMessage(CC.translate(DeadmansChestPlugin.PREFIX + "&7Received a dead mans chest location setter"));
|
||||
SoundUtils.tryPlaySuccessSound(player);
|
||||
}
|
||||
}
|
||||
|
||||
@SubCommand("stop")
|
||||
@Permission("cranked.admin")
|
||||
public void stopCommand(final CommandSender commandSender) {
|
||||
this.plugin.getDeadmansChestManager().stop();
|
||||
commandSender.sendMessage(CC.translate(DeadmansChestPlugin.PREFIX + "You have forcefully stopped the ongoing dead mans chest event"));
|
||||
}
|
||||
|
||||
@SubCommand("debug")
|
||||
@Permission("cranked.admin")
|
||||
public void debugCommand(final CommandSender commandSender) {
|
||||
if(this.plugin.getDeadmansChestManager().isActive()) {
|
||||
this.plugin.getDeadmansChestManager().stop();
|
||||
commandSender.sendMessage(CC.translate(DeadmansChestPlugin.PREFIX + "You have forcefully stopped the ongoing dead mans chest event"));
|
||||
}
|
||||
this.plugin.getDeadmansChestManager().debugAndRemoveDeadMansChests();
|
||||
commandSender.sendMessage(CC.translate(DeadmansChestPlugin.PREFIX + "You have debugged all dead mans chests"));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user