Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added the "RAINY" requirement, changed "STORMY" requirement to also r…
…ecognize the thunder. Changed the "REMOVE" command to use the default server world instead of "world", also added an entity null check
- Loading branch information
1 parent
d3005c1
commit ba44c80
Showing
4 changed files
with
41 additions
and
8 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
22 changes: 22 additions & 0 deletions
22
src/main/java/net/aufdemrand/denizen/scripts/requirements/core/RainyRequirement.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,22 @@ | ||
package net.aufdemrand.denizen.scripts.requirements.core; | ||
|
||
import net.aufdemrand.denizen.exceptions.RequirementCheckException; | ||
import net.aufdemrand.denizen.scripts.requirements.AbstractRequirement; | ||
import net.aufdemrand.denizen.scripts.requirements.RequirementsContext; | ||
import org.bukkit.World; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Returns whether or not it's raining in the world where the player is. | ||
*/ | ||
public class RainyRequirement extends AbstractRequirement { | ||
|
||
@Override | ||
public boolean check(RequirementsContext context, List<String> args) throws RequirementCheckException { | ||
World world = context.getPlayer().getPlayerEntity().getWorld(); | ||
|
||
return world.hasStorm() && !world.isThundering(); | ||
} | ||
|
||
} |
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
ba44c80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops seems like I messed up my IDE settings "a bit" - sorry :(
ba44c80
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First off, the null check in Remove is unnecessary, because this line:
Already handles that.
Secondly, you completely reversed the logic in Remove, thus breaking the command. You changed this:
Into:
Instead of what was correct:
Better luck next time. :P