Skip to content

Commit

Permalink
Update WorldCommand.java
Browse files Browse the repository at this point in the history
  • Loading branch information
hardsiamang655 authored Jul 8, 2024
1 parent 44fb4ad commit e09aadb
Showing 1 changed file with 9 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,32 +28,31 @@ public WorldCommand(EssentialsAPI api) {
//KailynDev2024®
}

public int execute(CommandSender sender, String commandLabel, Map.Entry<String, ParamList> result, CommandLogger log) {
var args = result.getKey();
public boolean execute(CommandSender sender, String label, String[] args) {
if (!this.testPermission(sender)) {
return 0;
return false;
}
if (!this.testIngame(sender)) {
return 0;
return false;
}
if (args.length() != 1) {
if (args.length != 1) {
this.sendUsage(sender);
return 0;
return false;
}
if (api.hasCooldown(sender)) {
return 1;
return true;
}
if (api.getServer().getLevelByName(args[0])==null) {
sender.sendMessage(TextFormat.RED + Language.translate("commands.world.notfound", args[0]));
return 1;
return true;
} else if (!api.getServer().isLevelLoaded(args[0])) {
sender.sendMessage(Language.translate("commands.world.loading"));
if (!api.getServer().loadLevel(args[0])) {
sender.sendMessage(TextFormat.RED + Language.translate("commands.world.unloadable"));
return 0;
return false;
}
}
api.onTP((Player) sender, api.getServer().getLevelByName(args[0]).getSpawnLocation(), Language.translate("commands.generic.teleporting"));
return 1;
return true;
}
}

0 comments on commit e09aadb

Please sign in to comment.