This commit is contained in:
Minecon724 2024-06-09 16:58:21 +02:00
parent f7d8dc427f
commit 044549d535
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8
3 changed files with 22 additions and 23 deletions

View file

@ -109,7 +109,7 @@ public class RealWeatherPlugin extends JavaPlugin {
} catch (ProviderException e) {
logger.severe("Couldn't initialize provider!");
logger.severe("Possible causes:");
logger.severe("1. Your API key is invalid");
logger.severe("1. Your API key is invalid, or was added too recently");
logger.severe("2. The provider or your internet is down");
e.printStackTrace();

View file

@ -36,8 +36,15 @@ public class GeoCommand implements CommandExecutor {
sender.sendMessage("Add arguments to use this command in console");
}
} else if (args.length >= 2) {
double latitude = Double.parseDouble(args[0]);
double longitude = Double.parseDouble(args[1]);
double latitude, longitude;
try {
latitude = Double.parseDouble(args[0]);
longitude = Double.parseDouble(args[1]);
} catch (NumberFormatException e) {
sender.sendMessage("Arguments should be latitude and longitude");
return true;
}
Coordinates coordinates = new Coordinates(latitude, longitude);
Location location = GlobalConstants.getMapper().coordinatesToLocation(player.getWorld(), coordinates);
@ -51,7 +58,7 @@ public class GeoCommand implements CommandExecutor {
player.spigot().sendMessage(component);
if (args.length == 3) {
if (args[2].equalsIgnoreCase("tp") && player != null && player.hasPermission("realweather.geo.tp")) {
if (args[2].equalsIgnoreCase("tp") && player != null && player.hasPermission("realweather.command.geo.tp")) {
Location targetLoc =
location.getWorld().getHighestBlockAt(location).getLocation().add(0, 1, 0);
player.teleport(targetLoc);

View file

@ -9,41 +9,33 @@ load: STARTUP
main: eu.m724.realweather.RealWeatherPlugin
commands:
realweather:
description: AIO RealWeather command
aliases: rw
permission: realweather.command
rwadmin:
description: RealWeather admin command
permission: realweather.admin
permission-message: You do not have permission to use this command.
# usage is processed in code
geo:
description: Convert lat,lon to x,y,z and vice versa
permission: realweather.geo
permission: realweather.command.geo
permission-message: You do not have permission to use this command.
# usage is processed in code
localtime:
description: Get real time in current location
permission: realweather.localtime
permission: realweather.command.localtime
permission-message: You do not have permission to use this command.
permissions:
# Commands
realweather.command:
description: Allows /realweather (individual nodes are still necessary for subcommands)
realweather.command.status:
description: /realweather status
realweather.command.*:
description: All /realweather commands
children:
realweather.command: true
realweather.command.status: true
realweather.admin:
description: Allows admin management with /rwadmin
realweather.geo:
realweather.command.geo:
description: Allows /geo
default: true
realweather.geo.tp:
realweather.comamnd.geo.tp:
description: Allows teleportation using /geo
realweather.localtime:
realweather.command.localtime:
description: Allows /localtime
default: true