This is the commit where i update commands
This commit is contained in:
2
build.sh
2
build.sh
@@ -10,7 +10,7 @@ if [ $? -eq 0 ]; then
|
||||
# SFTP upload
|
||||
SFTP_HOST="home-server"
|
||||
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
|
||||
TEMP_FILE=$(mktemp)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -54,10 +54,10 @@ public final class UltraUtils extends JavaPlugin {
|
||||
|
||||
new UltraUtilsCommand().register();
|
||||
new GamemodeCommand().register();
|
||||
new GMACommand().register();
|
||||
new GMCCommand().register();
|
||||
new GMSPCommand().register();
|
||||
new GMSCommand().register();
|
||||
// new GMACommand().register();
|
||||
// new GMCCommand().register();
|
||||
// new GMSPCommand().register();
|
||||
// new GMSCommand().register();
|
||||
new AnvilCommand().register();
|
||||
new CartographyCommand().register();
|
||||
new CraftingCommand().register();
|
||||
|
||||
@@ -14,7 +14,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "enderchest",permission = @Permission("ultrautils.enderchest"),playersOnly = true)
|
||||
public class EnderChestCommand implements CustomCommand {
|
||||
@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 target = Bukkit.getPlayer(args.get(0).toString());
|
||||
if (target == null) target = user;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.List;
|
||||
public class UltraUtilsCommand implements CustomCommand {
|
||||
|
||||
@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;
|
||||
|
||||
switch (args.get(0).toString()) {
|
||||
|
||||
@@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender;
|
||||
public class BroadcastCommand implements CustomCommand {
|
||||
|
||||
@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())));
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.List;
|
||||
@CommandRegistry(value = "macrotool",permission = @Permission("ultrautils.macrotool"),playersOnly = true,printStackTrace = true)
|
||||
public class MacroToolCommand implements CustomCommand {
|
||||
@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;
|
||||
String command = args.getAll(1).toString();
|
||||
ItemStack item = p.getInventory().getItemInMainHand();
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.util.List;
|
||||
public class WorldCommand implements CustomCommand {
|
||||
|
||||
@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();
|
||||
World world = Bukkit.getWorld(worldName);
|
||||
if (world == null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
||||
public class GMACommand implements CustomCommand {
|
||||
|
||||
@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());
|
||||
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
|
||||
if (target == null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
||||
public class GMCCommand implements CustomCommand {
|
||||
|
||||
@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());
|
||||
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
|
||||
if (target == null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
||||
public class GMSCommand implements CustomCommand {
|
||||
|
||||
@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());
|
||||
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
|
||||
if (target == null) {
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
||||
public class GMSPCommand implements CustomCommand {
|
||||
|
||||
@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());
|
||||
if (target == null && (commandSender instanceof Player)) target = (Player) commandSender;
|
||||
if (target == null) {
|
||||
|
||||
@@ -18,18 +18,49 @@ import javax.annotation.Nullable;
|
||||
public class GamemodeCommand implements CustomCommand {
|
||||
|
||||
@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());
|
||||
if (target == null && (sender instanceof Player)) target = (Player) sender;
|
||||
if (target == null) {
|
||||
sender.sendMessage(Text.prefix("Only players may execute that command"));
|
||||
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()) {
|
||||
case "a","adventure","adv","gma" -> setGameMode(sender,target,GameMode.ADVENTURE, "ultrautils.gamemode.adventure");
|
||||
case "c","creative","cre","gmc" -> setGameMode(sender,target,GameMode.CREATIVE,"ultrautils.gamemode.creative");
|
||||
case "s","survival","sur","gms" -> setGameMode(sender,target,GameMode.SURVIVAL,"ultrautils.gamemode.survival");
|
||||
case "sp","spectator","spec","gmsp" -> setGameMode(sender,target,GameMode.SPECTATOR,"ultrautils.gamemode.spectator");
|
||||
case "a","adventure","adv","gma" -> {
|
||||
setGameMode(sender,target,GameMode.ADVENTURE, "ultrautils.gamemode.adventure");
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
@CommandRegistry(value = "fly", permission = @Permission("ultrautils.flight"),printStackTrace = true)
|
||||
public class FlyCommand implements CustomCommand {
|
||||
@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 target = Bukkit.getPlayer(args.get(1).toString());
|
||||
if (target == null && (sender instanceof Player)) target = (Player) sender;
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
@CommandRegistry(value = "speed", permission = @Permission("ultrautils.speed"),printStackTrace = true)
|
||||
public class SpeedCommand implements CustomCommand {
|
||||
@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();
|
||||
float speed = args.get(0).toFloat();
|
||||
Player user = (Player) sender;
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "anvil", permission = @Permission("ultrautils.anvil"),playersOnly = true)
|
||||
public class AnvilCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openAnvil(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "cartography", permission = @Permission("ultrautils.cartography"),playersOnly = true)
|
||||
public class CartographyCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openCartographyTable(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "craft", permission = @Permission("ultrautils.craft"),playersOnly = true)
|
||||
public class CraftingCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openWorkbench(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "grindstone", permission = @Permission("ultrautils.grind"),playersOnly = true)
|
||||
public class GrindstoneCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openGrindstone(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true)
|
||||
public class LoomCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openLoom(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "smith", permission = @Permission("ultrautils.smith"),playersOnly = true)
|
||||
public class SmithingCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openSmithingTable(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandRegistry(value = "stonecutter", permission = @Permission("ultrautils.stonecut"),playersOnly = true)
|
||||
public class StonecutterCommand implements CustomCommand {
|
||||
@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;
|
||||
p.openStonecutter(p.getLocation(),true);
|
||||
}
|
||||
|
||||
@@ -80,27 +80,16 @@ commands:
|
||||
usage: /ultrautils
|
||||
permission: ultrautils.admin
|
||||
aliases:
|
||||
- uu
|
||||
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>]
|
||||
- uur
|
||||
gamemode:
|
||||
description: Root gamemode changing command. Required for all the other gamemode commands.
|
||||
permission: ultrautils.gamemode
|
||||
usage: /gamemode <gamemode> [<player>]
|
||||
aliases:
|
||||
- gmc
|
||||
- gms
|
||||
- gmsp
|
||||
- gma
|
||||
anvil:
|
||||
permission: ultrautils.anvil
|
||||
description: a portable anvil
|
||||
|
||||
Reference in New Issue
Block a user