make time/weather command checks more strict (closes #19)

This commit is contained in:
Jack
2025-06-22 23:30:50 -04:00
parent df9b8f1fcd
commit f99eceb46f

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");
} }