diff options
author | t00thpick1 <t00thpick1dirko@gmail.com> | 2014-01-16 01:48:38 -0500 |
---|---|---|
committer | Wesley Wolfe <weswolf@aol.com> | 2014-01-16 00:51:09 -0600 |
commit | b8143c63c20b6d578a77edc84a5049323e3bf567 (patch) | |
tree | 7c1eb20c11894969bb9fc83fb7927d8057f5a12a /src | |
parent | 622a2976d97775df8650d92be44cdb67ca4012ca (diff) | |
download | craftbukkit-b8143c63c20b6d578a77edc84a5049323e3bf567.tar craftbukkit-b8143c63c20b6d578a77edc84a5049323e3bf567.tar.gz craftbukkit-b8143c63c20b6d578a77edc84a5049323e3bf567.tar.lz craftbukkit-b8143c63c20b6d578a77edc84a5049323e3bf567.tar.xz craftbukkit-b8143c63c20b6d578a77edc84a5049323e3bf567.zip |
[Bleeding] Implement methods for /achievement command. Addresses BUKKIT-4932
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index 89c599ee..43adac13 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -1,5 +1,7 @@ package org.bukkit.craftbukkit.util; +import java.util.ArrayList; +import java.util.Iterator; import java.util.List; import net.minecraft.server.Block; @@ -7,9 +9,13 @@ import net.minecraft.server.Blocks; import net.minecraft.server.Item; import net.minecraft.server.MojangsonParser; import net.minecraft.server.NBTTagCompound; +import net.minecraft.server.StatisticList; +import org.bukkit.Achievement; import org.bukkit.Material; +import org.bukkit.Statistic; import org.bukkit.UnsafeValues; +import org.bukkit.craftbukkit.CraftStatistic; import org.bukkit.craftbukkit.inventory.CraftItemStack; import org.bukkit.inventory.ItemStack; import org.bukkit.util.StringUtil; @@ -100,4 +106,27 @@ public final class CraftMagicNumbers implements UnsafeValues { return stack; } + + @Override + public Statistic getStatisticFromInternalName(String name) { + return CraftStatistic.getBukkitStatisticByName(name); + } + + @Override + public Achievement getAchievementFromInternalName(String name) { + return CraftStatistic.getBukkitAchievementByName(name); + } + + @Override + public List<String> tabCompleteInternalStatisticOrAchievementName(String token, List<String> completions) { + List<String> matches = new ArrayList<String>(); + Iterator iterator = StatisticList.b.iterator(); + while (iterator.hasNext()) { + String statistic = ((net.minecraft.server.Statistic) iterator.next()).e; + if (statistic.startsWith(token)) { + matches.add(statistic); + } + } + return matches; + } } |