fixed game rules
This commit is contained in:
1 parent
cf3fd2f38f
commit
a1ab06a80d
2 files changed
+12
No files matched your search
@@ -31,6 +31,10 @@ public class IteratorUtil {
|
|||||||
rules.forEach((gameRule, value) -> IteratorUtil.worlds(world -> world.setGameRule(gameRule, value ^ inverse)));
|
rules.forEach((gameRule, value) -> IteratorUtil.worlds(world -> world.setGameRule(gameRule, value ^ inverse)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setIntGameRules(Map<GameRule<Integer>, Integer> rules) {
|
||||||
|
rules.forEach((gameRule, value) -> IteratorUtil.worlds(world -> world.setGameRule(gameRule, value)));
|
||||||
|
}
|
||||||
|
|
||||||
public static void times(int times, Runnable callback) {
|
public static void times(int times, Runnable callback) {
|
||||||
IntStream.range(0, times).forEach(value -> callback.run());
|
IntStream.range(0, times).forEach(value -> callback.run());
|
||||||
}
|
}
|
||||||
|
|||||||
+8
@@ -68,6 +68,12 @@ public class ProjectStart extends Appliance {
|
|||||||
entry(GameRules.FALL_DAMAGE, true),
|
entry(GameRules.FALL_DAMAGE, true),
|
||||||
entry(GameRules.FIRE_DAMAGE, true)
|
entry(GameRules.FIRE_DAMAGE, true)
|
||||||
);
|
);
|
||||||
|
private final Map<GameRule<Integer>, Integer> intGameRulesAfterStart = Map.of(
|
||||||
|
GameRules.FIRE_SPREAD_RADIUS_AROUND_PLAYER, -1
|
||||||
|
);
|
||||||
|
private final Map<GameRule<Integer>, Integer> intGameRulesBeforeStart = Map.of(
|
||||||
|
GameRules.FIRE_SPREAD_RADIUS_AROUND_PLAYER, 0
|
||||||
|
);
|
||||||
|
|
||||||
public ProjectStart() {
|
public ProjectStart() {
|
||||||
super("countdown");
|
super("countdown");
|
||||||
@@ -121,6 +127,7 @@ public class ProjectStart extends Appliance {
|
|||||||
|
|
||||||
IteratorUtil.worlds(World::getWorldBorder, worldBorder -> worldBorder.setSize(worldBorder.getMaxSize()));
|
IteratorUtil.worlds(World::getWorldBorder, worldBorder -> worldBorder.setSize(worldBorder.getMaxSize()));
|
||||||
IteratorUtil.worlds(world -> IteratorUtil.setGameRules(this.gameRulesAfterStart, false));
|
IteratorUtil.worlds(world -> IteratorUtil.setGameRules(this.gameRulesAfterStart, false));
|
||||||
|
IteratorUtil.worlds(world -> IteratorUtil.setIntGameRules(this.intGameRulesAfterStart));
|
||||||
Bukkit.getWorlds().getFirst().setFullTime(0);
|
Bukkit.getWorlds().getFirst().setFullTime(0);
|
||||||
|
|
||||||
this.netherFireLocations.forEach(location -> Objects.requireNonNull(this.startWorld).getBlockAt(location).setType(Material.FIRE));
|
this.netherFireLocations.forEach(location -> Objects.requireNonNull(this.startWorld).getBlockAt(location).setType(Material.FIRE));
|
||||||
@@ -168,6 +175,7 @@ public class ProjectStart extends Appliance {
|
|||||||
});
|
});
|
||||||
|
|
||||||
IteratorUtil.worlds(world -> world, world -> IteratorUtil.setGameRules(this.gameRulesAfterStart, true));
|
IteratorUtil.worlds(world -> world, world -> IteratorUtil.setGameRules(this.gameRulesAfterStart, true));
|
||||||
|
IteratorUtil.worlds(world -> world, world -> IteratorUtil.setIntGameRules(this.intGameRulesBeforeStart));
|
||||||
this.resetAdvancements();
|
this.resetAdvancements();
|
||||||
|
|
||||||
this.blockCycle.reset();
|
this.blockCycle.reset();
|
||||||
|
|||||||
Reference in new issue
Block a user