本文整理匯總了Java中org.bukkit.Server.getBukkitVersion方法的典型用法代碼示例。如果您正苦於以下問題:Java Server.getBukkitVersion方法的具體用法?Java Server.getBukkitVersion怎麽用?Java Server.getBukkitVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.Server
的用法示例。
在下文中一共展示了Server.getBukkitVersion方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: before
import org.bukkit.Server; //導入方法依賴的package包/類
@SuppressWarnings({"resource", "deprecation"})
@Before
public void before() throws Exception {
final File dataDir = new File("target/classes/");
final File jar = new File("target/", "skript.jar");
assumeTrue(jar.exists());
final Logger l = Logger.getLogger(getClass().getCanonicalName());
l.setParent(SkriptLogger.LOGGER);
l.setLevel(Level.WARNING);
final Server s = createMock(Server.class);
s.getLogger();
expectLastCall().andReturn(l).anyTimes();
s.isPrimaryThread();
expectLastCall().andReturn(true).anyTimes();
s.getName();
expectLastCall().andReturn("Whatever").anyTimes();
s.getVersion();
expectLastCall().andReturn("2.0").anyTimes();
s.getBukkitVersion();
expectLastCall().andReturn("2.0").anyTimes();
replay(s);
Bukkit.setServer(s);
final Skript skript = (Skript) ObjenesisHelper.newInstance(Skript.class); // bypass the class loader check
final Field instance = Skript.class.getDeclaredField("instance");
instance.setAccessible(true);
instance.set(null, skript);
final PluginDescriptionFile pdf = new PluginDescriptionFile(new FileInputStream(new File(dataDir, "plugin.yml")));
// final void init(PluginLoader loader, Server server, PluginDescriptionFile description, File dataFolder, File file, ClassLoader classLoader) {
final Method init = JavaPlugin.class.getDeclaredMethod("init", PluginLoader.class, Server.class, PluginDescriptionFile.class, File.class, File.class, ClassLoader.class);
init.setAccessible(true);
init.invoke(skript, new JavaPluginLoader(s), s, pdf, dataDir, jar, getClass().getClassLoader());
Skript.getAddonInstance().loadClasses("ch.njol.skript", "entity");
new JavaClasses();
new BukkitClasses();
new BukkitEventValues();
new SkriptClasses();
final Field r = Skript.class.getDeclaredField("acceptRegistrations");
r.setAccessible(true);
r.set(null, false);
Classes.onRegistrationsStop();
}