private static boolean changeType( CommandSender sender, Arena arena, BattleArenaController ac, String value) { ArenaType t = ArenaType.fromString(value); if (t == null) { sendMessage( sender, "&ctype &6" + value + "&c not found. valid types=&6" + ArenaType.getValidList()); return false; } ac.removeArena(arena); arena.getParameters().setType(t); ac.addArena(arena); sendMessage(sender, "&2Altered arena type to &6" + value); return true; }
@Override protected void setUp() { plugin = new TestPlugin(); ArenaType.register("arena", Arena.class, plugin); BukkitInterface.setServer(new TestBukkitServer()); plugin.onEnable(); /// Set test server MCServer.setInstance(new TestMCBukkitServer()); /// load classes BAClassesSerializer classesSerializer = new BAClassesSerializer(); classesSerializer.setConfig(new File("test_files/classes.yml")); classesSerializer.loadAll(); /// Controller bac = new BattleArenaController(null); /// Messages MessageSerializer ms = new MessageSerializer("default", null); ms.setConfig(new File("default_files/messages.yml")); MessageSerializer.setDefaultConfig(ms); AnnouncementOptions an = new AnnouncementOptions(); AnnouncementOptions.setDefaultOptions(an); /// Arenas ArenaSerializer as = new ArenaSerializer(plugin, new File("test_files/arenas.yml")); ArenaSerializer.setBAC(bac); as.loadArenas(plugin); }
public void testCreateArena() { MatchParams mp = loadParams("Arena"); assertNotNull(mp); Arena arena = ArenaType.createArena("testArena", mp); assertNotNull(arena); ParamController.addMatchParams(mp); bac.addArena(arena); }
@Override protected void setUp() { Defaults.TESTSERVER = true; plugin = new TestPlugin(); ArenaType.register("arena", Arena.class, plugin); BukkitInterface.setServer(new TestBukkitServer()); plugin.onEnable(); }