Fixed console bug in admin command
This commit is contained in:
@@ -17,13 +17,11 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@CommandRegistry(value = "ultrals", permission = @Permission("ultrals.admin"), printStackTrace = true)
|
@CommandRegistry(value = "ultrals", permission = @Permission("ultrals.admin"), printStackTrace = true, playersOnly = false)
|
||||||
public class UltraLSCommand implements CustomCommand {
|
public class UltraLSCommand implements CustomCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchCommand(CommandSender sender, Args args) {
|
public void dispatchCommand(CommandSender sender, Args args) {
|
||||||
Player p = (Player) sender;
|
|
||||||
|
|
||||||
switch (args.get(0).toString()) {
|
switch (args.get(0).toString()) {
|
||||||
case "hearts" -> {
|
case "hearts" -> {
|
||||||
OfflinePlayer target = Bukkit.getOfflinePlayer(args.get(1).toString());
|
OfflinePlayer target = Bukkit.getOfflinePlayer(args.get(1).toString());
|
||||||
@@ -31,7 +29,7 @@ public class UltraLSCommand implements CustomCommand {
|
|||||||
switch (args.get(2).toString()) {
|
switch (args.get(2).toString()) {
|
||||||
case "add" -> {
|
case "add" -> {
|
||||||
if (!target.isConnected()) {
|
if (!target.isConnected()) {
|
||||||
p.sendMessage(Text.prefix("&cNull Error. &7Target is not online."));
|
sender.sendMessage(Text.prefix("&cNull Error. &7Target is not online."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int amount = args.get(3).toInt();
|
int amount = args.get(3).toInt();
|
||||||
@@ -39,7 +37,7 @@ public class UltraLSCommand implements CustomCommand {
|
|||||||
}
|
}
|
||||||
case "subtract" -> {
|
case "subtract" -> {
|
||||||
if (!target.isConnected()) {
|
if (!target.isConnected()) {
|
||||||
p.sendMessage(Text.prefix("&cNull Error. &7Target is not online."));
|
sender.sendMessage(Text.prefix("&cNull Error. &7Target is not online."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int amount = args.get(3).toInt();
|
int amount = args.get(3).toInt();
|
||||||
@@ -57,7 +55,7 @@ public class UltraLSCommand implements CustomCommand {
|
|||||||
case "bar" -> {
|
case "bar" -> {
|
||||||
int amount = args.get(4).toInt();
|
int amount = args.get(4).toInt();
|
||||||
if (!target.isConnected()) {
|
if (!target.isConnected()) {
|
||||||
p.sendMessage(Text.prefix("&cNull Error. &7Target is not online."));
|
sender.sendMessage(Text.prefix("&cNull Error. &7Target is not online."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AdminFunctions.setHearts(sender,target.getPlayer(),amount,args.get(5).toBool());
|
AdminFunctions.setHearts(sender,target.getPlayer(),amount,args.get(5).toBool());
|
||||||
@@ -71,7 +69,7 @@ public class UltraLSCommand implements CustomCommand {
|
|||||||
case "debug" -> {
|
case "debug" -> {
|
||||||
UltraLS.config.debugMode = !UltraLS.config.debugMode;
|
UltraLS.config.debugMode = !UltraLS.config.debugMode;
|
||||||
UltraLS.config.save();
|
UltraLS.config.save();
|
||||||
p.sendMessage(Text.prefix("Debug mode is now &a%s&7.".formatted(UltraLS.config.debugMode)));
|
sender.sendMessage(Text.prefix("Debug mode is now &a%s&7.".formatted(UltraLS.config.debugMode)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user