Skip to content

Commit 754d4f2

Browse files
committed
backrooms: add random chance to spawn nextbot
1 parent 12123e4 commit 754d4f2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

src/main/java/city/thefloating/floatyplugin/backrooms/RandomSpooks.java

+32
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,38 @@ public void start() {
116116
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 30, 1, true, true, false));
117117
}
118118
}, 1, Ticks.in(Duration.ofSeconds(123)) - 17);
119+
120+
// spawn nextbot.
121+
scheduler.scheduleSyncRepeatingTask(this.plugin, () -> {
122+
for (final Player player : this.worldService.getWorld(Realm.BACKROOMS).getPlayers()) {
123+
if (RANDOM.nextFloat() > 0.05F) {
124+
continue;
125+
}
126+
127+
for (int dist = 24; dist < 33; dist++) {
128+
final var locPX = player.getLocation().add(new Vector(dist, 0, 0));
129+
if (locPX.getBlock().getType() == Material.AIR) {
130+
this.nate.createNextbot(Nextbot.Type.OBUNGA, locPX);
131+
return;
132+
}
133+
final var locNX = player.getLocation().add(new Vector(-dist, 0, 0));
134+
if (locNX.getBlock().getType() == Material.AIR) {
135+
this.nate.createNextbot(Nextbot.Type.OBUNGA, locNX);
136+
return;
137+
}
138+
final var locPZ = player.getLocation().add(new Vector(0, 0, dist));
139+
if (locPZ.getBlock().getType() == Material.AIR) {
140+
this.nate.createNextbot(Nextbot.Type.OBUNGA, locPZ);
141+
return;
142+
}
143+
final var locNZ = player.getLocation().add(new Vector(0, 0, -dist));
144+
if (locNZ.getBlock().getType() == Material.AIR) {
145+
this.nate.createNextbot(Nextbot.Type.OBUNGA, locNZ);
146+
return;
147+
}
148+
}
149+
}
150+
}, 1, Ticks.in(Duration.ofSeconds(497)) - 5);
119151
}
120152

121153
}

0 commit comments

Comments
 (0)