-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changed ConditionList to support AND and OR.
Added ORCondition
- Loading branch information
Showing
9 changed files
with
72 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
src/main/java/me/xemor/skillslibrary2/conditions/ORCondition.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package me.xemor.skillslibrary2.conditions; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.configuration.ConfigurationSection; | ||
import org.bukkit.entity.Entity; | ||
import org.bukkit.inventory.ItemStack; | ||
|
||
public class ORCondition extends Condition implements EntityCondition, TargetCondition, LocationCondition, ItemStackCondition { | ||
|
||
private final ConditionList conditions; | ||
|
||
public ORCondition(int condition, ConfigurationSection configurationSection) { | ||
super(condition, configurationSection); | ||
conditions = new ConditionList(configurationSection.getConfigurationSection("conditions")); | ||
} | ||
|
||
@Override | ||
public boolean isTrue(Entity entity) { | ||
return conditions.ORConditions(entity, true); | ||
} | ||
|
||
@Override | ||
public boolean isTrue(Entity entity, ItemStack itemStack) { | ||
return conditions.ORConditions(entity, true, itemStack); | ||
} | ||
|
||
@Override | ||
public boolean isTrue(Entity entity, Location location) { | ||
return conditions.ORConditions(entity, true, location); | ||
} | ||
|
||
@Override | ||
public boolean isTrue(Entity entity, Entity target) { | ||
return conditions.ORConditions(entity, true, target); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters