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;
@ -139,6 +140,11 @@ public class ArenaImpl implements Arena
this.classes = plugin.getArenaMaster().getClasses();
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());
@ -615,6 +621,14 @@ public class ArenaImpl implements Arena
} else if (autoStartTimer.isRunning()) {
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