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) { } catch (ProviderException e) {
logger.severe("Couldn't initialize provider!"); logger.severe("Couldn't initialize provider!");
logger.severe("Possible causes:"); 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"); logger.severe("2. The provider or your internet is down");
e.printStackTrace(); e.printStackTrace();

View file

@ -36,8 +36,15 @@ public class GeoCommand implements CommandExecutor {
sender.sendMessage("Add arguments to use this command in console"); sender.sendMessage("Add arguments to use this command in console");
} }
} else if (args.length >= 2) { } else if (args.length >= 2) {
double latitude = Double.parseDouble(args[0]); double latitude, longitude;
double longitude = Double.parseDouble(args[1]);
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); Coordinates coordinates = new Coordinates(latitude, longitude);
Location location = GlobalConstants.getMapper().coordinatesToLocation(player.getWorld(), coordinates); Location location = GlobalConstants.getMapper().coordinatesToLocation(player.getWorld(), coordinates);
@ -51,7 +58,7 @@ public class GeoCommand implements CommandExecutor {
player.spigot().sendMessage(component); player.spigot().sendMessage(component);
if (args.length == 3) { 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 targetLoc =
location.getWorld().getHighestBlockAt(location).getLocation().add(0, 1, 0); location.getWorld().getHighestBlockAt(location).getLocation().add(0, 1, 0);
player.teleport(targetLoc); player.teleport(targetLoc);

View file

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