Add /announcelocation command

master
Elnu 3 years ago
parent b3f1894360
commit 2c580bd86a

@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import java.time.LocalDateTime;
@ -45,6 +46,18 @@ public class DeathCoordinates extends JavaPlugin {
sender.sendMessage(ChatColor.YELLOW + "No death coordinates to announce.");
}
return true;
} else if (cmd.getName().equalsIgnoreCase("announcelocation")) {
var player = (Player) sender;
var location = player.getLocation();
Bukkit.getServer().broadcastMessage(ChatColor.GREEN + String.format(
"%s is announcing that they are at (%d, %d, %d) in %s.",
sender.getName(),
location.getBlockX(),
location.getBlockY(),
location.getBlockZ(),
location.getWorld().getEnvironment()
));
return true;
}
return false;
}

@ -5,4 +5,7 @@ author: ElnuDraws
commands:
announcedeath:
description: Announce last death coordinates.
usage: /announcedeath
announcelocation:
description: Announce location.
usage: /announcedeath