scripts.conditions.weather.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Pouvoir Show documentation
Show all versions of Pouvoir Show documentation
Bukkit Script Engine Plugin.
//@Condition()
Coerce = static("Coerce");
Player = find("org.bukkit.entity.Player");
key = "weather";
names = ["需要天气: (?.*)", "需要不是天气: (?.*)"];
function parameters(matcher, text) {
var weather = matcher.group("weather");
if (weather.contains("晴")) {
weather = "CLEAR";
} else {
weather = "DOWNFALL";
}
const isIn = !matcher.pattern().toString().contains("不");
return mapOf({ weather: weather, status: isIn });
}
function condition(entity, map) {
if (entity == null || !(entity instanceof Player)) return true;
const weather = map.get("weather");
const isIn = map.get("status");
return (
(isIn && entity.getPlayerWeather().name().equalsIgnoreCase(weather)) ||
(!isIn && !entity.getPlayerWeather().name().equalsIgnoreCase(weather))
);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy