Skip to content

Commit

Permalink
Add "odd integer" and "even integer" to If command matches. Make <pla…
Browse files Browse the repository at this point in the history
…yer.item_in_hand.enchantments> work with fallbacks.
  • Loading branch information
davidcernat committed Mar 7, 2013
1 parent f1af64f commit 1e3b345
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 13 deletions.
8 changes: 4 additions & 4 deletions src/main/java/net/aufdemrand/denizen/Denizen.java
Expand Up @@ -172,10 +172,10 @@ public void onEnable() {
reloadConfig();

// Warn if configuration is outdated / too new
if (!getConfig().isSet("version") || !getConfig().getString("version", "0").equalsIgnoreCase(configVersion)) {
dB.echoError("Your configuration version does not match with the internal version.");
dB.echoError("Some things might not work, unless you generate a new one!");
dB.echoError("This is easily done by deleteing the current config.yml file in the Denizen folder.");
if (!getConfig().isSet("Version") || !getConfig().getString("Version", "0").equalsIgnoreCase(configVersion)) {
dB.echoError("Your Denizen config file is from a different version.");
dB.echoError("Some settings will not be available unless you generate a new config file.");
dB.echoError("This is easily done by deleting the current config.yml file in the Denizen folder.");
}

ScriptHelper.reloadScripts();
Expand Down
Expand Up @@ -175,6 +175,14 @@ else if (((String) com.comparedto).equalsIgnoreCase("double")) {
else if (((String) com.comparedto).equalsIgnoreCase("integer")) {
if (aH.matchesInteger(comparable)) com.outcome = true;
}
else if (((String) com.comparedto).equalsIgnoreCase("even integer")) {
if (aH.matchesInteger(comparable) && (aH.getIntegerFrom(comparable) % 2) == 0)
com.outcome = true;
}
else if (((String) com.comparedto).equalsIgnoreCase("odd integer")) {
if (aH.matchesInteger(comparable) && (aH.getIntegerFrom(comparable) % 2) == 1)
com.outcome = true;
}
else if (((String) com.comparedto).equalsIgnoreCase("duration")) {
if (aH.matchesDuration("duration:" + comparable)) com.outcome = true;
}
Expand Down
18 changes: 13 additions & 5 deletions src/main/java/net/aufdemrand/denizen/tags/core/PlayerTags.java
Expand Up @@ -186,11 +186,19 @@ else if (subType.equals("DATA"))
else if (subType.equals("MAX_STACK"))
event.setReplaced(String.valueOf(p.getItemInHand().getMaxStackSize()));
else if (subType.equals("ENCHANTMENTS"))
event.setReplaced(NBTItem.getEnchantments(p.getItemInHand()).asDScriptList());
else if (subType.equals("ENCHANTMENTS_WITH_LEVEL"))
event.setReplaced(NBTItem.getEnchantments(p.getItemInHand()).asDScriptListWithLevels());
else if (subType.equals("ENCHANTMENTS_WITH_LEVEL_ONLY"))
event.setReplaced(NBTItem.getEnchantments(p.getItemInHand()).asDScriptListLevelsOnly());
{
String enchantments = null;

if (specifier.equals("LEVELS"))
enchantments = NBTItem.getEnchantments(p.getItemInHand()).asDScriptListWithLevels();
else if (specifier.equals("LEVELS_ONLY"))
enchantments = NBTItem.getEnchantments(p.getItemInHand()).asDScriptListLevelsOnly();
else
enchantments = NBTItem.getEnchantments(p.getItemInHand()).asDScriptList();

if (enchantments != null && enchantments.length() > 0)
event.setReplaced(enchantments);
}
else if (subType.equals("LORE"))
event.setReplaced(NBTItem.getLore(p.getItemInHand()).asDScriptList());
else if (subType.equals("DISPLAY"))
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/config.yml
@@ -1,7 +1,7 @@
# The current configuration version. DO NOT CHANGE THIS VALUE!!!
# Denizen will check against the latest internal version and warn you if your
# configuration file is outdated!
version: 0.8.8
# The current configuration version. You should not change this
# value. Denizen will check against the latest internal version
# and warn you if your configuration file is outdated.
Version: 0.8.8

# Whether Denizen debug information should be shown in the server
# console or not.
Expand Down

0 comments on commit 1e3b345

Please sign in to comment.