3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-23 23:00:08 +01:00

[Bleeding] Implement methods for /achievement command. Addresses BUKKIT-4932

Dieser Commit ist enthalten in:
t00thpick1 2014-01-16 01:48:38 -05:00 committet von Wesley Wolfe
Ursprung 622a2976d9
Commit b8143c63c2

Datei anzeigen

@ -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;
}
}