diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java index 89c599eebf..43adac1363 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 tabCompleteInternalStatisticOrAchievementName(String token, List completions) { + List matches = new ArrayList(); + 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; + } }