QUOTE: Kindness is always fashionable.

feat: Added survival nether and end worlds - poppy - A feature-rich Minecraft plugin which enhances gaming experience

poppy

A feature-rich Minecraft plugin which enhances gaming experience
git clone git://192.168.2.2/poppy
Log | Files | Refs | README

commit ea71cee8914dc89b2de9703b93b0e3341f9766fa
parent e0c3e9d239743a3501a69576fda726e890468db9
Author: typable <contact@typable.dev>
Date:   Mon,  6 Nov 2023 19:16:09 +0100

feat: Added survival nether and end worlds

Diffstat:
Msrc/poppy/Main.java | 33++++++++++++++++++++++++++++++++-
1 file changed, 32 insertions(+), 1 deletion(-)

diff --git a/src/poppy/Main.java b/src/poppy/Main.java @@ -9,10 +9,15 @@ import org.bukkit.NamespacedKey; import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.WorldType; +import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.Listener; +import org.bukkit.event.player.PlayerPortalEvent; +import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.inventory.FurnaceRecipe; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.meta.SkullMeta; @@ -35,7 +40,7 @@ import poppy.modules.SpawnerModule; import poppy.modules.PlayerMountModule; -public class Main extends JavaPlugin +public class Main extends JavaPlugin implements Listener { private Plugin plugin; private Config config; @@ -111,6 +116,16 @@ public class Main extends JavaPlugin .type(WorldType.NORMAL) .generateStructures(true) .createWorld(); + + new WorldCreator("survival_nether") + .environment(Environment.NETHER) + .generateStructures(true) + .createWorld(); + + new WorldCreator("survival_the_end") + .environment(Environment.THE_END) + .generateStructures(true) + .createWorld(); } @Override @@ -168,6 +183,22 @@ public class Main extends JavaPlugin return true; } + @EventHandler + public void onPlayerPortal(final PlayerPortalEvent event) + { + final Player player = event.getPlayer(); + + if (event.getCause() == TeleportCause.NETHER_PORTAL) + { + return; + } + + if (event.getCause() == TeleportCause.END_PORTAL) + { + return; + } + } + private boolean setItemAsHead(final Player player, final String[] args) { final ItemStack item = player.getInventory().getItemInMainHand();