develop-bloodmoon #10
@@ -78,7 +78,7 @@ public class Bloodmoon extends Appliance {
|
||||
);
|
||||
private final boolean hordesEnabled = true;
|
||||
private final int hordeSpawnRateTicks = 800;
|
||||
private final int hordeSpawnRateVariationTicks = 100;
|
||||
private final int hordeSpawnRateVariationTicks = 800;
|
||||
private final int hordeMinPopulation = 3;
|
||||
private final int hordeMaxPopulation = 10;
|
||||
private final int hordeSpawnDistance = 10;
|
||||
@@ -87,6 +87,7 @@ public class Bloodmoon extends Appliance {
|
||||
EntityType.SKELETON,
|
||||
EntityType.SPIDER
|
||||
);
|
||||
private final Map<Player, @Nullable BukkitTask> hordeSpawnTasks = new HashMap<>();
|
||||
private @Nullable BukkitTask hordeSpawnTask = null;
|
||||
public final int bloodmoonLength = 12000;
|
||||
|
Pupsi marked this conversation as resolved
Outdated
|
||||
public final int ticksPerDay = 24000;
|
||||
@@ -133,12 +134,17 @@ public class Bloodmoon extends Appliance {
|
||||
}
|
||||
|
||||
private int getRandomHordeSpawnDelay() {
|
||||
return this.hordeSpawnRateTicks + ThreadLocalRandom.current().nextInt(-this.hordeSpawnRateVariationTicks, this.hordeSpawnRateVariationTicks);
|
||||
return this.hordeSpawnRateTicks + ThreadLocalRandom.current().nextInt(this.hordeSpawnRateVariationTicks);
|
||||
}
|
||||
|
||||
private void startHordeSpawning(int delay) {
|
||||
if(this.hordeSpawnTask != null) this.hordeSpawnTask.cancel();
|
||||
this.hordeSpawnTask = Bukkit.getScheduler().runTaskLater(
|
||||
Bukkit.getOnlinePlayers().forEach(player -> this.startHordeSpawning(delay, player));
|
||||
}
|
||||
|
||||
private void startHordeSpawning(int delay, Player player) {
|
||||
@Nullable BukkitTask task = this.hordeSpawnTasks.get(player);
|
||||
if(task != null) task.cancel();
|
||||
task = Bukkit.getScheduler().runTaskLater(
|
||||
Main.instance(),
|
||||
() -> {
|
||||
if(!this.bloodmoonIsActive()) return;
|
||||
@@ -147,6 +153,7 @@ public class Bloodmoon extends Appliance {
|
||||
},
|
||||
delay
|
||||
);
|
||||
this.hordeSpawnTasks.put(player, task);
|
||||
}
|
||||
|
||||
|
Pupsi marked this conversation as resolved
MineTec
commented
hier die Variable aus dem map.get zu überschreiben sieht komisch aus hier die Variable aus dem map.get zu überschreiben sieht komisch aus
Mach doch eine neue Variable, du setzt unten ja sowiso manuell .put
|
||||
public void addPlayerToBossBar(Player player) {
|
||||
|
||||
@@ -29,7 +29,7 @@ public class BloodmoonSetting extends BoolSetting implements CategorizedSetting
|
||||
|
||||
@Override
|
||||
protected String description() {
|
||||
return "Kämpfe während dem Blutmond mit stärkeren Monstern mit besseren Drops. Kann nicht während dem Blutmond geändert werden!";
|
||||
return "Kämpfe während dem Blutmond gegen stärkere Monster mit besseren Drops. Kann nicht während dem Blutmond geändert werden!";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user
WeakHashMap implementierung verwenden