mirror of
https://github.com/garbagemule/MobArena.git
synced 2024-11-27 04:55:25 +01:00
Add support for a per-arena default class.
This commit is contained in:
parent
d2fd8b4fc2
commit
692d7f52dc
@ -71,6 +71,7 @@ public class ArenaImpl implements Arena
|
||||
private Set<Player> randoms;
|
||||
|
||||
// Classes stuff
|
||||
private ArenaClass defaultClass;
|
||||
private Map<String,ArenaClass> classes;
|
||||
private Map<Player,PermissionAttachment> attachments;
|
||||
|
||||
@ -140,6 +141,11 @@ public class ArenaImpl implements Arena
|
||||
this.attachments = new HashMap<Player,PermissionAttachment>();
|
||||
this.limitManager = new ClassLimitManager(this, classes, makeSection(section, "class-limits"));
|
||||
|
||||
String defaultClassName = settings.getString("default-class", null);
|
||||
if (defaultClassName != null) {
|
||||
this.defaultClass = classes.get(defaultClassName);
|
||||
}
|
||||
|
||||
// Blocks and pets
|
||||
this.repairQueue = new PriorityBlockingQueue<Repairable>(100, new RepairableComparator());
|
||||
this.blocks = new HashSet<Block>();
|
||||
@ -616,6 +622,14 @@ public class ArenaImpl implements Arena
|
||||
Messenger.tell(p, Msg.ARENA_AUTO_START, "" + autoStartTimer.getRemaining() / 20l);
|
||||
}
|
||||
|
||||
if (defaultClass != null) {
|
||||
// Assign default class if applicable
|
||||
if (!ClassChests.assignClassFromStoredClassChest(this, p, defaultClass)) {
|
||||
assignClass(p, defaultClass.getLowercaseName());
|
||||
Messenger.tell(p, Msg.LOBBY_CLASS_PICKED, defaultClass.getConfigName());
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,7 @@ world: ''
|
||||
enabled: true
|
||||
protect: true
|
||||
entry-fee: ''
|
||||
default-class: ''
|
||||
clear-wave-before-next: false
|
||||
clear-boss-before-next: false
|
||||
clear-wave-before-boss: false
|
||||
|
Loading…
Reference in New Issue
Block a user