Add support for a per-arena default class.

This commit is contained in:
Andreas Troelsen 2017-02-18 03:27:50 +01:00
parent d2fd8b4fc2
commit 692d7f52dc
2 changed files with 15 additions and 0 deletions

View File

@ -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;
}

View File

@ -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