13
0
geforkt von Mirrors/Paper

[Bleeding] Add missing methods to Bukkit class, fix non-static methods, and add a junit test to ensure both these problems will be caught in future.

By: Celtic Minstrel <celtic.minstrel.ca@some.place>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2012-02-25 12:39:10 -05:00
Ursprung 716821eebc
Commit e1b9154af1
2 geänderte Dateien mit 55 neuen und 4 gelöschten Zeilen

Datei anzeigen

@ -194,19 +194,19 @@ public final class Bukkit {
return server.addRecipe(recipe);
}
public List<Recipe> getRecipesFor(ItemStack result) {
public static List<Recipe> getRecipesFor(ItemStack result) {
return server.getRecipesFor(result);
}
public Iterator<Recipe> recipeIterator() {
public static Iterator<Recipe> recipeIterator() {
return server.recipeIterator();
}
public void clearRecipes() {
public static void clearRecipes() {
server.clearRecipes();
}
public void resetRecipes() {
public static void resetRecipes() {
server.resetRecipes();
}
@ -289,4 +289,36 @@ public final class Bukkit {
public static Messenger getMessenger() {
return server.getMessenger();
}
public static boolean getAllowEnd() {
return server.getAllowEnd();
}
public static File getUpdateFolderFile() {
return server.getUpdateFolderFile();
}
public static int getTicksPerAnimalSpawns() {
return server.getTicksPerAnimalSpawns();
}
public static int getTicksPerMonsterSpawns() {
return server.getTicksPerMonsterSpawns();
}
public static boolean useExactLoginLocation() {
return server.useExactLoginLocation();
}
public static GameMode getDefaultGameMode() {
return server.getDefaultGameMode();
}
public static void setDefaultGameMode(GameMode mode) {
server.setDefaultGameMode(mode);
}
public static OfflinePlayer[] getOfflinePlayers() {
return server.getOfflinePlayers();
}
}

Datei anzeigen

@ -0,0 +1,19 @@
package org.bukkit;
import static org.junit.Assert.*;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import org.junit.Test;
public class BukkitMirrorTest {
@Test
public final void test() throws NoSuchMethodException {
Method[] serverMethods = Server.class.getDeclaredMethods();
for(Method method : serverMethods) {
Method mirrorMethod = Bukkit.class.getDeclaredMethod(method.getName(), method.getParameterTypes());
assertTrue("Bukkit." + method.getName() + " must be static!", Modifier.isStatic(mirrorMethod.getModifiers()));
}
}
}