mirror of
https://github.com/Xiao-MoMi/Custom-Fishing.git
synced 2025-12-23 00:49:24 +00:00
internal improvements
This commit is contained in:
@@ -33,7 +33,7 @@ public interface Action<T> {
|
|||||||
*/
|
*/
|
||||||
void trigger(Context<T> context);
|
void trigger(Context<T> context);
|
||||||
|
|
||||||
static Action<?> empty() {
|
static <T> Action<T> empty() {
|
||||||
return EmptyAction.INSTANCE;
|
return EmptyAction.instance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,11 +24,13 @@ import org.bukkit.entity.Player;
|
|||||||
* An implementation of the Action interface that represents an empty action with no behavior.
|
* An implementation of the Action interface that represents an empty action with no behavior.
|
||||||
* This class serves as a default action to prevent NPE.
|
* This class serves as a default action to prevent NPE.
|
||||||
*/
|
*/
|
||||||
public class EmptyAction implements Action<Player> {
|
public class EmptyAction<T> implements Action<T> {
|
||||||
|
|
||||||
public static final EmptyAction INSTANCE = new EmptyAction();
|
public static <T> EmptyAction<T> instance() {
|
||||||
|
return new EmptyAction<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void trigger(Context<Player> context) {
|
public void trigger(Context<T> context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,12 +23,14 @@ import org.bukkit.entity.Player;
|
|||||||
/**
|
/**
|
||||||
* Represents an empty requirement that always returns true when checking conditions.
|
* Represents an empty requirement that always returns true when checking conditions.
|
||||||
*/
|
*/
|
||||||
public class EmptyRequirement implements Requirement<Player> {
|
public class EmptyRequirement<T> implements Requirement<T> {
|
||||||
|
|
||||||
public static final EmptyRequirement INSTANCE = new EmptyRequirement();
|
public static <T> EmptyRequirement<T> instance() {
|
||||||
|
return new EmptyRequirement<>();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isSatisfied(Context<Player> context) {
|
public boolean isSatisfied(Context<T> context) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public interface Requirement<T> {
|
|||||||
*/
|
*/
|
||||||
boolean isSatisfied(Context<T> context);
|
boolean isSatisfied(Context<T> context);
|
||||||
|
|
||||||
static Requirement<?> empty() {
|
static <T> Requirement<T> empty() {
|
||||||
return EmptyRequirement.INSTANCE;
|
return EmptyRequirement.instance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -57,7 +57,7 @@ public class WorldGuardRegion {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
BukkitCustomFishingPlugin.getInstance().getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at region requirement which is expected be `Section` or `StringList`");
|
BukkitCustomFishingPlugin.getInstance().getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at region requirement which is expected be `Section` or `StringList`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return EmptyRequirement.instance();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int finalMode = mode;
|
int finalMode = mode;
|
||||||
|
|||||||
@@ -110,11 +110,11 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Action<Player> parseAction(Section section) {
|
public Action<Player> parseAction(Section section) {
|
||||||
if (section == null) return EmptyAction.INSTANCE;
|
if (section == null) return Action.empty();
|
||||||
ActionFactory<Player> factory = getActionFactory(section.getString("type"));
|
ActionFactory<Player> factory = getActionFactory(section.getString("type"));
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
plugin.getPluginLogger().warn("Action type: " + section.getString("type") + " doesn't exist.");
|
plugin.getPluginLogger().warn("Action type: " + section.getString("type") + " doesn't exist.");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
return factory.process(section.get("value"), section.getDouble("chance", 1d));
|
return factory.process(section.get("value"), section.getDouble("chance", 1d));
|
||||||
}
|
}
|
||||||
@@ -140,7 +140,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
ActionFactory<Player> factory = getActionFactory(type);
|
ActionFactory<Player> factory = getActionFactory(type);
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
plugin.getPluginLogger().warn("Action type: " + type + " doesn't exist.");
|
plugin.getPluginLogger().warn("Action type: " + type + " doesn't exist.");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
return factory.process(args, 1);
|
return factory.process(args, 1);
|
||||||
}
|
}
|
||||||
@@ -225,7 +225,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at message-nearby action which should be Section");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at message-nearby action which should be Section");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -288,7 +288,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at command-nearby action which should be Section");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at command-nearby action which should be Section");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -340,7 +340,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at actionbar-nearby action which should be Section");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at actionbar-nearby action which should be Section");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -412,7 +412,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at item-amount action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at item-amount action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerAction("durability", (args, chance) -> {
|
registerAction("durability", (args, chance) -> {
|
||||||
@@ -445,7 +445,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at durability action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at durability action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerAction("give-item", (args, chance) -> {
|
registerAction("give-item", (args, chance) -> {
|
||||||
@@ -475,7 +475,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at give-item action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at give-item action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -586,7 +586,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at conditional action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at conditional action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerAction("priority", (args, chance) -> {
|
registerAction("priority", (args, chance) -> {
|
||||||
@@ -618,7 +618,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at priority action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at priority action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -656,7 +656,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at potion-effect action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at potion-effect action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -677,7 +677,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at sound action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at sound action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -697,7 +697,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at plugin-exp action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at plugin-exp action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -722,7 +722,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at title action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at title action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerAction("random-title", (args, chance) -> {
|
registerAction("random-title", (args, chance) -> {
|
||||||
@@ -748,7 +748,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at random-title action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at random-title action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerAction("title-nearby", (args, chance) -> {
|
registerAction("title-nearby", (args, chance) -> {
|
||||||
@@ -776,7 +776,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at title-nearby action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at title-nearby action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -829,7 +829,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at fake-item action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at fake-item action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
@@ -876,7 +876,7 @@ public class BukkitActionManager implements ActionManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at hologram action which is expected to be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at hologram action which is expected to be `Section`");
|
||||||
return EmptyAction.INSTANCE;
|
return Action.empty();
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -126,12 +126,12 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
String type = section.getString("type");
|
String type = section.getString("type");
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
plugin.getPluginLogger().warn("No requirement type found at " + section.getRouteAsString());
|
plugin.getPluginLogger().warn("No requirement type found at " + section.getRouteAsString());
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
var factory = getRequirementFactory(type);
|
var factory = getRequirementFactory(type);
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
plugin.getPluginLogger().warn("Requirement type: " + type + " not exists");
|
plugin.getPluginLogger().warn("Requirement type: " + type + " not exists");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
return factory.process(section.get("value"), actionList, runActions);
|
return factory.process(section.get("value"), actionList, runActions);
|
||||||
}
|
}
|
||||||
@@ -142,7 +142,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
RequirementFactory<Player> factory = getRequirementFactory(type);
|
RequirementFactory<Player> factory = getRequirementFactory(type);
|
||||||
if (factory == null) {
|
if (factory == null) {
|
||||||
plugin.getPluginLogger().warn("Requirement type: " + type + " doesn't exist.");
|
plugin.getPluginLogger().warn("Requirement type: " + type + " doesn't exist.");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
return factory.process(value);
|
return factory.process(value);
|
||||||
}
|
}
|
||||||
@@ -220,7 +220,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at competition requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at competition requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -254,7 +254,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at item-in-hand requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at item-in-hand requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -278,7 +278,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at plugin-level requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at plugin-level requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -334,7 +334,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at || requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at || requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -355,7 +355,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at && requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at && requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -635,7 +635,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
for (String e : ListUtils.toList(args)) {
|
for (String e : ListUtils.toList(args)) {
|
||||||
plugin.getPluginLogger().warn(" - " + e);
|
plugin.getPluginLogger().warn(" - " + e);
|
||||||
}
|
}
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -827,7 +827,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at cooldown requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at cooldown requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -898,7 +898,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at < requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at < requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("<=", (args, actions, runActions) -> {
|
registerRequirement("<=", (args, actions, runActions) -> {
|
||||||
@@ -912,7 +912,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at <= requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at <= requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!=", (args, actions, runActions) -> {
|
registerRequirement("!=", (args, actions, runActions) -> {
|
||||||
@@ -926,7 +926,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at != requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at != requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("==", (args, actions, runActions) -> {
|
registerRequirement("==", (args, actions, runActions) -> {
|
||||||
@@ -940,7 +940,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at == requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at == requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement(">=", (args, actions, runActions) -> {
|
registerRequirement(">=", (args, actions, runActions) -> {
|
||||||
@@ -954,7 +954,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at >= requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at >= requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement(">", (args, actions, runActions) -> {
|
registerRequirement(">", (args, actions, runActions) -> {
|
||||||
@@ -968,7 +968,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at > requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at > requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("regex", (args, actions, runActions) -> {
|
registerRequirement("regex", (args, actions, runActions) -> {
|
||||||
@@ -982,7 +982,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at regex requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at regex requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("startsWith", (args, actions, runActions) -> {
|
registerRequirement("startsWith", (args, actions, runActions) -> {
|
||||||
@@ -996,7 +996,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at startsWith requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at startsWith requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!startsWith", (args, actions, runActions) -> {
|
registerRequirement("!startsWith", (args, actions, runActions) -> {
|
||||||
@@ -1010,7 +1010,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !startsWith requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !startsWith requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("endsWith", (args, actions, runActions) -> {
|
registerRequirement("endsWith", (args, actions, runActions) -> {
|
||||||
@@ -1024,7 +1024,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at endsWith requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at endsWith requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!endsWith", (args, actions, runActions) -> {
|
registerRequirement("!endsWith", (args, actions, runActions) -> {
|
||||||
@@ -1038,7 +1038,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !endsWith requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !endsWith requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("contains", (args, actions, runActions) -> {
|
registerRequirement("contains", (args, actions, runActions) -> {
|
||||||
@@ -1052,7 +1052,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at contains requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at contains requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!contains", (args, actions, runActions) -> {
|
registerRequirement("!contains", (args, actions, runActions) -> {
|
||||||
@@ -1066,7 +1066,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !contains requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !contains requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("in-list", (args, actions, runActions) -> {
|
registerRequirement("in-list", (args, actions, runActions) -> {
|
||||||
@@ -1080,7 +1080,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at in-list requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at in-list requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!in-list", (args, actions, runActions) -> {
|
registerRequirement("!in-list", (args, actions, runActions) -> {
|
||||||
@@ -1094,7 +1094,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !in-list requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !in-list requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("equals", (args, actions, runActions) -> {
|
registerRequirement("equals", (args, actions, runActions) -> {
|
||||||
@@ -1109,7 +1109,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at equals requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at equals requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerRequirement("!equals", (args, actions, runActions) -> {
|
registerRequirement("!equals", (args, actions, runActions) -> {
|
||||||
@@ -1123,7 +1123,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !equals requirement which is expected be `Section`");
|
plugin.getPluginLogger().warn("Invalid value type: " + args.getClass().getSimpleName() + " found at !equals requirement which is expected be `Section`");
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1135,7 +1135,7 @@ public class BukkitRequirementManager implements RequirementManager<Player> {
|
|||||||
PotionEffectType type = PotionEffectType.getByName(split[0]);
|
PotionEffectType type = PotionEffectType.getByName(split[0]);
|
||||||
if (type == null) {
|
if (type == null) {
|
||||||
plugin.getPluginLogger().warn("Potion effect doesn't exist: " + split[0]);
|
plugin.getPluginLogger().warn("Potion effect doesn't exist: " + split[0]);
|
||||||
return EmptyRequirement.INSTANCE;
|
return Requirement.empty();
|
||||||
}
|
}
|
||||||
int required = Integer.parseInt(split[1]);
|
int required = Integer.parseInt(split[1]);
|
||||||
String operator = potions.substring(split[0].length(), potions.length() - split[1].length());
|
String operator = potions.substring(split[0].length(), potions.length() - split[1].length());
|
||||||
|
|||||||
Reference in New Issue
Block a user