Skip to content

Commit

Permalink
Add <server.list_enchantments>
Browse files Browse the repository at this point in the history
  • Loading branch information
Fortifier42 committed Aug 7, 2017
1 parent 4b5dcbe commit 310c119
Showing 1 changed file with 15 additions and 0 deletions.
Expand Up @@ -35,6 +35,7 @@
import net.citizensnpcs.api.CitizensAPI;
import net.citizensnpcs.api.npc.NPC;
import org.bukkit.*;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
Expand Down Expand Up @@ -209,6 +210,20 @@ public void serverTag(ReplaceableTagEvent event) {
event.setReplaced(allMats.getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <server.list_enchantments>
// @returns dList
// @description
// Returns a list of all enchantments known to the server (only their Bukkit enum names).
// -->
if (attribute.startsWith("list_enchantments")) {
dList enchants = new dList();
for (Enchantment e : Enchantment.values()) {
enchants.add(e.getName());
}
event.setReplaced(enchants.getAttribute(attribute.fulfill(1)));
}

// <--[tag]
// @attribute <server.list_flags[(regex:)<search>]>
// @returns dList
Expand Down

0 comments on commit 310c119

Please sign in to comment.