mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-14 19:42:09 +01:00
Remove the give-all-items flag for Upgrade waves.
The flag is almost always set to true, and when it isn't, it's either because people don't know that they have to set it, or because they only give one upgrade per class and thus don't feel the effect of it.
This commit is contained in:
parent
b58964dce9
commit
1371a90871
@ -243,14 +243,7 @@ public class WaveParser
|
||||
arena.getPlugin().getLogger().warning(WaveError.UPGRADE_MAP_MISSING.format(name, arena.configName()));
|
||||
return null;
|
||||
}
|
||||
|
||||
UpgradeWave result = new UpgradeWave(upgrades);
|
||||
|
||||
// Determine if all items should be given
|
||||
boolean giveAll = config.getBoolean("give-all-items", false);
|
||||
result.setGiveAll(giveAll);
|
||||
|
||||
return result;
|
||||
return new UpgradeWave(upgrades);
|
||||
}
|
||||
|
||||
private static Wave parseBossWave(Arena arena, String name, ConfigurationSection config) {
|
||||
|
@ -12,12 +12,10 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class UpgradeWave extends AbstractWave
|
||||
{
|
||||
private Map<String,List<Thing>> upgrades;
|
||||
private boolean giveAll;
|
||||
|
||||
public UpgradeWave(Map<String,List<Thing>> upgrades) {
|
||||
this.upgrades = upgrades;
|
||||
@ -33,25 +31,15 @@ public class UpgradeWave extends AbstractWave
|
||||
List<Thing> list = upgrades.get(className);
|
||||
if (list == null) return;
|
||||
|
||||
if (giveAll) {
|
||||
list.forEach(thing -> thing.giveTo(p));
|
||||
} else {
|
||||
int index = new Random().nextInt(list.size());
|
||||
list.get(index).giveTo(p);
|
||||
}
|
||||
list.forEach(thing -> thing.giveTo(p));
|
||||
}
|
||||
|
||||
public void setGiveAll(boolean giveAll) {
|
||||
this.giveAll = giveAll;
|
||||
}
|
||||
|
||||
public Wave copy() {
|
||||
Map<String,List<Thing>> upgrades = new HashMap<>();
|
||||
for (Map.Entry<String,List<Thing>> entry : this.upgrades.entrySet()) {
|
||||
upgrades.put(entry.getKey(), new ArrayList<>(entry.getValue()));
|
||||
}
|
||||
UpgradeWave result = new UpgradeWave(upgrades);
|
||||
result.giveAll = this.giveAll;
|
||||
|
||||
// From AbstractWave
|
||||
result.setAmountMultiplier(getAmountMultiplier());
|
||||
|
Loading…
Reference in New Issue
Block a user