本文整理汇总了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();
}