All Downloads are FREE. Search and download functionalities are using the official Maven repository.

scripts.conditions.world.js Maven / Gradle / Ivy

There is a newer version: 1.6.7-beta-6
Show newest version
//@Condition()

Coerce = static("Coerce");

key = "world";

names = ["要求世界: (?.*)", "需要不是世界: (?.*)"];

function parameters(matcher, text) {
  const world = matcher.group("world");
  const isIn = !matcher.pattern().toString().contains("不");
  return mapOf({ world: world, status: isIn });
}

function condition(entity, map) {
  if (entity == null) return true;
  const world = map.get("world");
  const isIn = map.get("status");
  return (
    (isIn && entity.location.world.name.equalsIgnoreCase(world)) ||
    (!isIn && !entity.location.world.name.equalsIgnoreCase(world))
  );
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy