3 Commits
v2 ... main

Author SHA1 Message Date
Jack
f99eceb46f make time/weather command checks more strict (closes #19) 2025-06-22 23:30:50 -04:00
Jack
df9b8f1fcd Merge pull request #18 from Karotte128/main
fix SunriseSunsetRequest to use right config values
2025-05-29 00:51:17 -04:00
Karotte128
6f5f69ee9e fix SunriseSunsetRequest to use right config variables 2025-02-22 22:09:51 +01:00
2 changed files with 5 additions and 5 deletions

View File

@@ -18,8 +18,8 @@ public class EventHandlers implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onCommandPreprocess(PlayerCommandPreprocessEvent event) { public void onCommandPreprocess(PlayerCommandPreprocessEvent event) {
if ((config.getBlockTimeSetCommand() && config.isTimeEnabled() && event.getMessage().contains("time set")) if ((config.getBlockTimeSetCommand() && config.isTimeEnabled() && event.getMessage().toLowerCase().contains("time set "))
|| (config.getBlockWeatherCommand() && config.isWeatherEnabled() && event.getMessage().contains("weather"))) { || (config.getBlockWeatherCommand() && config.isWeatherEnabled() && event.getMessage().toLowerCase().contains("weather "))) {
event.setCancelled(true); event.setCancelled(true);
event.getPlayer().sendMessage("Command disabled by RealTimeWeather"); event.getPlayer().sendMessage("Command disabled by RealTimeWeather");
} }
@@ -27,8 +27,8 @@ public class EventHandlers implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onConsoleCommand(ServerCommandEvent event) { public void onConsoleCommand(ServerCommandEvent event) {
if ((config.getBlockTimeSetCommand() && config.isTimeEnabled() && event.getCommand().contains("time set")) if ((config.getBlockTimeSetCommand() && config.isTimeEnabled() && event.getCommand().toLowerCase().contains("time set "))
|| (config.getBlockWeatherCommand() && config.isWeatherEnabled() && event.getCommand().contains("weather"))) { || (config.getBlockWeatherCommand() && config.isWeatherEnabled() && event.getCommand().toLowerCase().contains("weather "))) {
event.setCancelled(true); event.setCancelled(true);
event.getSender().sendMessage("Command disabled by RealTimeWeather"); event.getSender().sendMessage("Command disabled by RealTimeWeather");
} }

View File

@@ -87,7 +87,7 @@ public final class RealTimeWeather extends JavaPlugin {
if (config.getSunriseSunset().equals("real")) { if (config.getSunriseSunset().equals("real")) {
SunriseSunsetRequestObject sunriseSunset; SunriseSunsetRequestObject sunriseSunset;
try { try {
sunriseSunset = new SunriseSunsetRequestObject(config.getTimeZone(), config.getWeatherLatitude(), config.getWeatherLongitude()); sunriseSunset = new SunriseSunsetRequestObject(config.getTimeZone(), config.getSunriseSunsetLatitude(), config.getSunriseSunsetLongitude());
world.setTime(calculateWorldTime(cal, sunriseSunset.getSunriseTime(), sunriseSunset.getSunsetTime())); world.setTime(calculateWorldTime(cal, sunriseSunset.getSunriseTime(), sunriseSunset.getSunsetTime()));
} catch (Exception e) { } catch (Exception e) {
logger.severe(e.getMessage()); logger.severe(e.getMessage());