Allow for reward grouping.
This commit makes the MAUtils class responsible for parsing reward maps use the new ThingPickerManager to parse the reward lists. As a result, the new `all()` and `random()` pickers are available for use in the rewards section. This should allow for granting item sets and similar types of "bundles" as rewards in the arena, e.g. a diamond sword and permission to join a more difficult arena. Closes #386
This commit is contained in:
@@ -18,6 +18,7 @@ These changes will (most likely) be included in the next version.
|
|||||||
- Boss names now support color codes.
|
- Boss names now support color codes.
|
||||||
- New per-arena setting `arena-warp-offset` can be used to spread out players randomly by an offset from the arena warp. This should help prevent players taking suffocation damage.
|
- New per-arena setting `arena-warp-offset` can be used to spread out players randomly by an offset from the arena warp. This should help prevent players taking suffocation damage.
|
||||||
- New per-arena setting `announcer-type` determines where to display per-arena announcements such as wave spawns, auto start timers, boss abilities, and death messages. Options are `title` (default) or `chat`.
|
- New per-arena setting `announcer-type` determines where to display per-arena announcements such as wave spawns, auto start timers, boss abilities, and death messages. Options are `title` (default) or `chat`.
|
||||||
|
- It is now possible to group rewards. For example, `all(stick, bone)` results a stick and a bone, while `random(all(stick, bone), all(dirt, stone))` results in getting _either_ a stick and a bone _or_ a dirt block and a stone block.
|
||||||
- The Root Target ability now uses potion effects (slowness, slow falling, and negative jump boost) instead of repeated teleports. This should make for a smoother root experience.
|
- The Root Target ability now uses potion effects (slowness, slow falling, and negative jump boost) instead of repeated teleports. This should make for a smoother root experience.
|
||||||
- Using `spectate-on-death: true` no longer forces players out to their join location/exit warp before moving them to the spectator area. This should prevent "jumpy" behavior in multi-world setups.
|
- Using `spectate-on-death: true` no longer forces players out to their join location/exit warp before moving them to the spectator area. This should prevent "jumpy" behavior in multi-world setups.
|
||||||
- Players should now properly respawn at the spectator area rather than at world spawn on servers with plugins that override respawn locations.
|
- Players should now properly respawn at the spectator area rather than at world spawn on servers with plugins that override respawn locations.
|
||||||
|
|||||||
@@ -4,9 +4,6 @@ import com.garbagemule.MobArena.framework.Arena;
|
|||||||
import com.garbagemule.MobArena.framework.ArenaMaster;
|
import com.garbagemule.MobArena.framework.ArenaMaster;
|
||||||
import com.garbagemule.MobArena.region.ArenaRegion;
|
import com.garbagemule.MobArena.region.ArenaRegion;
|
||||||
import com.garbagemule.MobArena.things.InvalidThingInputString;
|
import com.garbagemule.MobArena.things.InvalidThingInputString;
|
||||||
import com.garbagemule.MobArena.things.RandomThingPicker;
|
|
||||||
import com.garbagemule.MobArena.things.SingleThingPicker;
|
|
||||||
import com.garbagemule.MobArena.things.Thing;
|
|
||||||
import com.garbagemule.MobArena.things.ThingPicker;
|
import com.garbagemule.MobArena.things.ThingPicker;
|
||||||
import com.garbagemule.MobArena.util.TextUtils;
|
import com.garbagemule.MobArena.util.TextUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -64,17 +61,13 @@ public class MAUtils
|
|||||||
String path = typePath + "." + wave;
|
String path = typePath + "." + wave;
|
||||||
String rewards = config.getString(path);
|
String rewards = config.getString(path);
|
||||||
|
|
||||||
List<ThingPicker> pickers = new ArrayList<>();
|
try {
|
||||||
for (String reward : rewards.split(",")) {
|
String wrapped = "random(" + rewards + ")";
|
||||||
try {
|
ThingPicker picker = plugin.getThingPickerManager().parse(wrapped);
|
||||||
Thing thing = plugin.getThingManager().parse(reward.trim());
|
result.put(wave, picker);
|
||||||
ThingPicker picker = new SingleThingPicker(thing);
|
} catch (InvalidThingInputString e) {
|
||||||
pickers.add(picker);
|
throw new ConfigError("Failed to parse reward for wave " + wave + " in the '" + type + "' branch of arena " + arena + ": " + e.getInput());
|
||||||
} catch (InvalidThingInputString e) {
|
|
||||||
throw new ConfigError("Failed to parse reward for wave " + wave + " in the '" + type + "' branch of arena " + arena + ": " + e.getInput());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result.put(wave, new RandomThingPicker(pickers, MobArena.random));
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user