This is the commit where i update commands

This commit is contained in:
TheTrouper
2024-04-08 19:20:18 -05:00
parent 5dae610708
commit 9cf45a7f12
24 changed files with 65 additions and 45 deletions

View File

@@ -10,7 +10,7 @@ if [ $? -eq 0 ]; then
# SFTP upload # SFTP upload
SFTP_HOST="home-server" SFTP_HOST="home-server"
SFTP_USER="trouper" SFTP_USER="trouper"
SFTP_REMOTE_DIR="/home/trouper/minecraft/data/plugins/" SFTP_REMOTE_DIR="/home/trouper/testing/data/plugins/"
# Create a temporary file with a unique name # Create a temporary file with a unique name
TEMP_FILE=$(mktemp) TEMP_FILE=$(mktemp)

Binary file not shown.

Binary file not shown.

View File

@@ -54,10 +54,10 @@ public final class UltraUtils extends JavaPlugin {
new UltraUtilsCommand().register(); new UltraUtilsCommand().register();
new GamemodeCommand().register(); new GamemodeCommand().register();
new GMACommand().register(); // new GMACommand().register();
new GMCCommand().register(); // new GMCCommand().register();
new GMSPCommand().register(); // new GMSPCommand().register();
new GMSCommand().register(); // new GMSCommand().register();
new AnvilCommand().register(); new AnvilCommand().register();
new CartographyCommand().register(); new CartographyCommand().register();
new CraftingCommand().register(); new CraftingCommand().register();

View File

@@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "enderchest",permission = @Permission("ultrautils.enderchest"),playersOnly = true) @CommandRegistry(value = "enderchest",permission = @Permission("ultrautils.enderchest"),playersOnly = true)
public class EnderChestCommand implements CustomCommand { public class EnderChestCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player user = (Player) sender; Player user = (Player) sender;
Player target = Bukkit.getPlayer(args.get(0).toString()); Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null) target = user; if (target == null) target = user;

View File

@@ -25,7 +25,7 @@ import java.util.List;
public class UltraUtilsCommand implements CustomCommand { public class UltraUtilsCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label,Args args) {
Player p = (Player) sender; Player p = (Player) sender;
switch (args.get(0).toString()) { switch (args.get(0).toString()) {

View File

@@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender;
public class BroadcastCommand implements CustomCommand { public class BroadcastCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender commandSender, Command command, Args args) { public void dispatchCommand(CommandSender commandSender, Command command, String label, Args args) {
Bukkit.getServer().broadcast(Component.text(Text.color(UltraUtils.config.broadcastPrefix + args.getAll().toString()))); Bukkit.getServer().broadcast(Component.text(Text.color(UltraUtils.config.broadcastPrefix + args.getAll().toString())));
} }

View File

@@ -26,7 +26,7 @@ import java.util.List;
@CommandRegistry(value = "macrotool",permission = @Permission("ultrautils.macrotool"),playersOnly = true,printStackTrace = true) @CommandRegistry(value = "macrotool",permission = @Permission("ultrautils.macrotool"),playersOnly = true,printStackTrace = true)
public class MacroToolCommand implements CustomCommand { public class MacroToolCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command cmd, Args args) { public void dispatchCommand(CommandSender sender, Command cmd, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
String command = args.getAll(1).toString(); String command = args.getAll(1).toString();
ItemStack item = p.getInventory().getItemInMainHand(); ItemStack item = p.getInventory().getItemInMainHand();

View File

@@ -21,7 +21,7 @@ import java.util.List;
public class WorldCommand implements CustomCommand { public class WorldCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
String worldName = args.get(0).toString(); String worldName = args.get(0).toString();
World world = Bukkit.getWorld(worldName); World world = Bukkit.getWorld(worldName);
if (world == null) { if (world == null) {

View File

@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
public class GMACommand implements CustomCommand { public class GMACommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender commandSender, Command command, Args args) { public void dispatchCommand(CommandSender commandSender, Command command, String label, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString()); Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender; if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) { if (target == null) {

View File

@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
public class GMCCommand implements CustomCommand { public class GMCCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender commandSender, Command command, Args args) { public void dispatchCommand(CommandSender commandSender, Command command, String label, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString()); Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender; if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) { if (target == null) {

View File

@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
public class GMSCommand implements CustomCommand { public class GMSCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender commandSender, Command command, Args args) { public void dispatchCommand(CommandSender commandSender, Command command, String label, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString()); Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender; if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) { if (target == null) {

View File

@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
public class GMSPCommand implements CustomCommand { public class GMSPCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender commandSender, Command command, Args args) { public void dispatchCommand(CommandSender commandSender, Command command, String label, Args args) {
Player target = Bukkit.getPlayer(args.get(0).toString()); Player target = Bukkit.getPlayer(args.get(0).toString());
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender; if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
if (target == null) { if (target == null) {

View File

@@ -18,18 +18,49 @@ import javax.annotation.Nullable;
public class GamemodeCommand implements CustomCommand { public class GamemodeCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player target = Bukkit.getPlayer(args.get(1).toString()); Player target = Bukkit.getPlayer(args.get(1).toString());
if (target == null && (sender instanceof Player)) target = (Player) sender; if (target == null && (sender instanceof Player)) target = (Player) sender;
if (target == null) { if (target == null) {
sender.sendMessage(Text.prefix("Only players may execute that command")); sender.sendMessage(Text.prefix("Only players may execute that command"));
return; return;
} }
target.sendMessage("Target: %s, Sender: %s, Command: %s, Label: %s, Args: %s".formatted(target,sender,command,label,args));
switch (label) {
case "gma" -> {
setGameMode(sender,target,GameMode.ADVENTURE, "ultrautils.gamemode.adventure");
return;
}
case "gmc" -> {
setGameMode(sender,target,GameMode.CREATIVE,"ultrautils.gamemode.creative");
return;
}
case "gms" -> {
setGameMode(sender,target,GameMode.SURVIVAL,"ultrautils.gamemode.survival");
return;
}
case "gmsp" -> {
setGameMode(sender,target,GameMode.SPECTATOR,"ultrautils.gamemode.spectator");
return;
}
}
switch (args.get(0).toString()) { switch (args.get(0).toString()) {
case "a","adventure","adv","gma" -> setGameMode(sender,target,GameMode.ADVENTURE, "ultrautils.gamemode.adventure"); case "a","adventure","adv","gma" -> {
case "c","creative","cre","gmc" -> setGameMode(sender,target,GameMode.CREATIVE,"ultrautils.gamemode.creative"); setGameMode(sender,target,GameMode.ADVENTURE, "ultrautils.gamemode.adventure");
case "s","survival","sur","gms" -> setGameMode(sender,target,GameMode.SURVIVAL,"ultrautils.gamemode.survival"); return;
case "sp","spectator","spec","gmsp" -> setGameMode(sender,target,GameMode.SPECTATOR,"ultrautils.gamemode.spectator"); }
case "c","creative","cre","gmc" -> {
setGameMode(sender,target,GameMode.CREATIVE,"ultrautils.gamemode.creative");
return;
}
case "s","survival","sur","gms" -> {
setGameMode(sender,target,GameMode.SURVIVAL,"ultrautils.gamemode.survival");
return;
}
case "sp","spectator","spec","gmsp" -> {
setGameMode(sender,target,GameMode.SPECTATOR,"ultrautils.gamemode.spectator");
return;
}
} }
} }

View File

@@ -18,7 +18,7 @@ import java.util.List;
@CommandRegistry(value = "fly", permission = @Permission("ultrautils.flight"),printStackTrace = true) @CommandRegistry(value = "fly", permission = @Permission("ultrautils.flight"),printStackTrace = true)
public class FlyCommand implements CustomCommand { public class FlyCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player user = (Player) sender; Player user = (Player) sender;
Player target = Bukkit.getPlayer(args.get(1).toString()); Player target = Bukkit.getPlayer(args.get(1).toString());
if (target == null && (sender instanceof Player)) target = (Player) sender; if (target == null && (sender instanceof Player)) target = (Player) sender;

View File

@@ -18,7 +18,7 @@ import java.util.List;
@CommandRegistry(value = "speed", permission = @Permission("ultrautils.speed"),printStackTrace = true) @CommandRegistry(value = "speed", permission = @Permission("ultrautils.speed"),printStackTrace = true)
public class SpeedCommand implements CustomCommand { public class SpeedCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
String type = args.get(1).toString(); String type = args.get(1).toString();
float speed = args.get(0).toFloat(); float speed = args.get(0).toFloat();
Player user = (Player) sender; Player user = (Player) sender;

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "anvil", permission = @Permission("ultrautils.anvil"),playersOnly = true) @CommandRegistry(value = "anvil", permission = @Permission("ultrautils.anvil"),playersOnly = true)
public class AnvilCommand implements CustomCommand { public class AnvilCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openAnvil(p.getLocation(),true); p.openAnvil(p.getLocation(),true);
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "cartography", permission = @Permission("ultrautils.cartography"),playersOnly = true) @CommandRegistry(value = "cartography", permission = @Permission("ultrautils.cartography"),playersOnly = true)
public class CartographyCommand implements CustomCommand { public class CartographyCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openCartographyTable(p.getLocation(),true); p.openCartographyTable(p.getLocation(),true);
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "craft", permission = @Permission("ultrautils.craft"),playersOnly = true) @CommandRegistry(value = "craft", permission = @Permission("ultrautils.craft"),playersOnly = true)
public class CraftingCommand implements CustomCommand { public class CraftingCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openWorkbench(p.getLocation(),true); p.openWorkbench(p.getLocation(),true);
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "grindstone", permission = @Permission("ultrautils.grind"),playersOnly = true) @CommandRegistry(value = "grindstone", permission = @Permission("ultrautils.grind"),playersOnly = true)
public class GrindstoneCommand implements CustomCommand { public class GrindstoneCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openGrindstone(p.getLocation(),true); p.openGrindstone(p.getLocation(),true);
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true) @CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true)
public class LoomCommand implements CustomCommand { public class LoomCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openLoom(p.getLocation(),true); p.openLoom(p.getLocation(),true);
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true) @CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true)
public class SmithingCommand implements CustomCommand { public class SmithingCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openSmithingTable(p.getLocation(),true); p.openSmithingTable(p.getLocation(),true);
} }

View File

@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
@CommandRegistry(value = "stonecutter", permission = @Permission("ultrautils.stonecut"),playersOnly = true) @CommandRegistry(value = "stonecutter", permission = @Permission("ultrautils.stonecut"),playersOnly = true)
public class StonecutterCommand implements CustomCommand { public class StonecutterCommand implements CustomCommand {
@Override @Override
public void dispatchCommand(CommandSender sender, Command command, Args args) { public void dispatchCommand(CommandSender sender, Command command, String label, Args args) {
Player p = (Player) sender; Player p = (Player) sender;
p.openStonecutter(p.getLocation(),true); p.openStonecutter(p.getLocation(),true);
} }

View File

@@ -80,27 +80,16 @@ commands:
usage: /ultrautils usage: /ultrautils
permission: ultrautils.admin permission: ultrautils.admin
aliases: aliases:
- uu - uur
gma:
description: Change gamemode to adventure
permission: ultrautils.gamemode.adventure
usage: /gma [<player>]
gmc:
description: Change gamemode to creative
permission: ultrautils.gamemode.creative
usage: /gmc [<player>]
gms:
description: Change gamemode to survival
permission: ultrautils.gamemode.survival
usage: /gms [<player>]
gmsp:
description: Change gamemode to spectator
permission: ultrautils.gamemode.spectator
usage: /gmsp [<player>]
gamemode: gamemode:
description: Root gamemode changing command. Required for all the other gamemode commands. description: Root gamemode changing command. Required for all the other gamemode commands.
permission: ultrautils.gamemode permission: ultrautils.gamemode
usage: /gamemode <gamemode> [<player>] usage: /gamemode <gamemode> [<player>]
aliases:
- gmc
- gms
- gmsp
- gma
anvil: anvil:
permission: ultrautils.anvil permission: ultrautils.anvil
description: a portable anvil description: a portable anvil