Skip to content

Commit dd60eb4

Browse files
committed
Add Pale Garden biome tweaks
1 parent 4e09037 commit dd60eb4

2 files changed

Lines changed: 106 additions & 0 deletions

File tree

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
package parallelmc.parallelutils.modules.biometweaks;
2+
3+
import org.bukkit.Bukkit;
4+
import org.bukkit.plugin.Plugin;
5+
import org.bukkit.plugin.PluginManager;
6+
import org.jetbrains.annotations.NotNull;
7+
import parallelmc.parallelutils.Constants;
8+
import parallelmc.parallelutils.ParallelClassLoader;
9+
import parallelmc.parallelutils.ParallelModule;
10+
import parallelmc.parallelutils.ParallelUtils;
11+
import parallelmc.parallelutils.modules.biometweaks.biomes.PaleGarden;
12+
13+
import java.util.List;
14+
import java.util.logging.Level;
15+
16+
public class BiomeTweaks extends ParallelModule {
17+
18+
public BiomeTweaks(ParallelClassLoader classLoader, List<String> dependents) {
19+
super(classLoader, dependents);
20+
}
21+
22+
@Override
23+
public void onLoad() {
24+
25+
}
26+
27+
@Override
28+
public void onEnable() {
29+
PluginManager manager = Bukkit.getPluginManager();
30+
Plugin plugin = manager.getPlugin(Constants.PLUGIN_NAME);
31+
32+
if (plugin == null) {
33+
ParallelUtils.log(Level.SEVERE, "Unable to enable BiomeTweaks. Plugin " + Constants.PLUGIN_NAME + " does not exist!");
34+
return;
35+
}
36+
37+
ParallelUtils puPlugin = (ParallelUtils) plugin;
38+
39+
if (!puPlugin.registerModule(this)) {
40+
ParallelUtils.log(Level.SEVERE, "Unable to register module BiomeTweaks! Module may already be registered. Quitting...");
41+
return;
42+
}
43+
44+
// Initialize individual biomes
45+
PaleGarden paleGarden = new PaleGarden();
46+
}
47+
48+
@Override
49+
public void onDisable() {
50+
51+
}
52+
53+
@Override
54+
public void onUnload() {
55+
56+
}
57+
58+
@Override
59+
public @NotNull String getName() {
60+
return "BiomeTweaks";
61+
}
62+
63+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
package parallelmc.parallelutils.modules.biometweaks.biomes;
2+
3+
import org.bukkit.*;
4+
import org.bukkit.block.Biome;
5+
import org.bukkit.entity.Player;
6+
import org.bukkit.plugin.Plugin;
7+
import parallelmc.parallelutils.util.BukkitTools;
8+
import parallelmc.parallelutils.util.RandomTools;
9+
10+
11+
public class PaleGarden {
12+
13+
public PaleGarden() {
14+
Plugin plugin = BukkitTools.getPlugin();
15+
if (plugin == null) return;
16+
17+
plugin.getServer().getScheduler().runTaskTimer(plugin, this::gardenEffects, 0L, 20L);
18+
}
19+
20+
public void gardenEffects() {
21+
for (Player player : Bukkit.getOnlinePlayers()) {
22+
Location location = player.getLocation();
23+
// Check that player is in pale garden and at y=60 at minimum
24+
if (location.getBlock().getBiome() == Biome.PALE_GARDEN && location.getY() >= 60) {
25+
// Sound effects
26+
player.playSound(location, Sound.BLOCK_CONDUIT_AMBIENT, SoundCategory.PLAYERS, 1, 1);
27+
// 1/20 chance of ambient cave sound
28+
if (RandomTools.betweenTwoNumbers(1, 20) == 1) {
29+
player.playSound(location, Sound.AMBIENT_CAVE, SoundCategory.AMBIENT, 1, 1);
30+
}
31+
// 1/100 chance of thunder sound
32+
if (RandomTools.betweenTwoNumbers(1, 100) == 1) {
33+
player.playSound(location, Sound.ENTITY_LIGHTNING_BOLT_THUNDER, SoundCategory.WEATHER, 1, 1);
34+
}
35+
36+
// Particle effects
37+
player.spawnParticle(Particle.FALLING_WATER, location.getX(), location.getY() + 20, location.getZ(),
38+
200, 10, 10, 10, 4);
39+
}
40+
}
41+
}
42+
43+
}

0 commit comments

Comments
 (0)