diff --git a/resources/config.yml b/resources/config.yml new file mode 100644 index 0000000..ff7c678 --- /dev/null +++ b/resources/config.yml @@ -0,0 +1,118 @@ +# MobArena v0.0.0 - Config-file +# Read the Wiki for details on how to set up this file: http://goo.gl/F5TTc +# Note: You -must- use spaces instead of tabs! +global-settings: + enabled: true + allowed-commands: /list, /pl + update-notification: true +classes: + Knight: + items: diamond_sword, potion:8197:3 + armor: 306,307,308,309 + Tank: + items: iron_sword, potion:8229:2 + armor: 310,311,312,313 + Archer: + items: wood_sword, bow, arrow:256, potion:8197:3, bone + armor: 298,299,300,301 + Chemist: + items: stone_sword, potion:16428:30, potion:16388:8, potion:16389:20, potion:8197:3, potion:8226:1 + armor: 314,315,316,317 + Oddjob: + items: stone_sword, flint_and_steel, netherrack:2, tnt:4, potion:8197:3 + armor: 298,299,300,301 +arenas: + default: + settings: + world: world + enabled: true + protect: true + entry-fee: '' + clear-wave-before-next: false + clear-boss-before-next: false + clear-wave-before-boss: false + lightning: true + auto-equip-armor: true + soft-restore: false + soft-restore-drops: false + require-empty-inv-join: false + require-empty-inv-spec: false + hellhounds: false + pvp-enabled: false + monster-infight: false + allow-teleporting: false + spectate-on-death: true + auto-respawn: true + share-items-in-arena: true + min-players: 0 + max-players: 0 + max-join-distance: 0 + first-wave-delay: 5 + wave-interval: 15 + final-wave: 0 + monster-limit: 100 + monster-exp: false + keep-exp: true + food-regen: false + lock-food-level: true + spout-class-select: false + player-time-in-arena: world + auto-ignite-tnt: false + auto-start-timer: 0 + auto-ready: false + use-class-chests: false + display-waves-as-level: false + display-timer-as-level: false + use-scoreboards: true + isolated-chat: false + global-first-join-announce: false + global-end-announce: false + waves: + recurrent: + def1: + type: default + priority: 1 + frequency: 1 + monsters: + zombies: 10 + skeletons: 10 + spiders: 10 + creepers: 10 + wolves: 10 + spec1: + type: special + priority: 2 + frequency: 4 + monsters: + powered-creepers: 10 + zombie-pigmen: 10 + angry-wolves: 10 + blazes: 10 + single: + swarm1: + type: swarm + wave: 6 + monster: slime + amount: low + boss1: + type: boss + wave: 10 + monster: cave_spider + health: high + abilities: arrows, root-target, throw-nearby + rewards: + waves: + every: + '3': feather, bone, stick + '5': dirt:4, gravel:4, stone:4 + '10': iron_ingot:10, gold_ingot:8 + after: + '7': minecart, storage_minecart, powered_minecart + '13': iron_sword, iron_pickaxe, iron_spade + '16': diamond_sword + class-limits: + Archer: -1 + Oddjob: -1 + Chemist: -1 + Tank: -1 + Knight: -1 \ No newline at end of file diff --git a/resources/res/config.yml b/resources/res/config.yml index f8ac1a9..d10997b 100644 --- a/resources/res/config.yml +++ b/resources/res/config.yml @@ -1,4 +1,3 @@ -# Layout global-settings: {} classes: {} arenas: {} \ No newline at end of file diff --git a/src/com/garbagemule/MobArena/ArenaMasterImpl.java b/src/com/garbagemule/MobArena/ArenaMasterImpl.java index 5195d77..dcadb27 100644 --- a/src/com/garbagemule/MobArena/ArenaMasterImpl.java +++ b/src/com/garbagemule/MobArena/ArenaMasterImpl.java @@ -85,6 +85,7 @@ public class ArenaMasterImpl implements ArenaMaster public Arena getSelectedArena() { if (selectedArena == null && !arenas.isEmpty()) { + System.out.println("SELECTED ARENA IS NULL! ARENAS: " + arenas.size()); selectedArena = arenas.get(0); } return selectedArena; @@ -244,6 +245,8 @@ public class ArenaMasterImpl implements ArenaMaster loadClasses(); loadArenas(); config.save(); + // Apparently necessary... + reloadConfig(); } /** diff --git a/src/com/garbagemule/MobArena/MobArena.java b/src/com/garbagemule/MobArena/MobArena.java index d3d77f2..da70408 100644 --- a/src/com/garbagemule/MobArena/MobArena.java +++ b/src/com/garbagemule/MobArena/MobArena.java @@ -64,8 +64,7 @@ public class MobArena extends JavaPlugin public static Random random = new Random(); public void onEnable() { - // Create default files and initialize config-file - FileUtils.extractResource(this.getDataFolder(), "config.yml", getClass()); + // Initialize config-file loadConfigFile(); // Load boss abilities @@ -118,16 +117,8 @@ public class MobArena extends JavaPlugin } private void loadConfigFile() { - File dir = this.getDataFolder(); - if (!dir.exists()) dir.mkdir(); - - File file = new File(this.getDataFolder(), "config.yml"); - config = new Config(file); - if (!config.load()) { - this.getServer().getPluginManager().disablePlugin(this); - throw new IllegalStateException("The config-file could not be loaded! Read further up to find the actual bug!"); - } - + saveDefaultConfig(); + config = new Config(new File(getDataFolder(), "config.yml")); updateSettings(config); config.setHeader(getHeader()); config.save();