Skip to content

Commit

Permalink
Merge pull request #160 from IvanMishin1/portal-pull
Browse files Browse the repository at this point in the history
  • Loading branch information
Seggan authored Jul 9, 2024
2 parents 2c6e88d + 9d2b4e3 commit c598c22
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ Inspiration taken from ClayTech and the mod GalactiCraft.

## Download

Download here (just click the badge!):
Download here (just click the badge!):

[![Build Status](https://thebusybiscuit.github.io/builds/Slimefun-Addon-Community/Galactifun/master/badge.svg)](https://thebusybiscuit.github.io/builds/Slimefun-Addon-Community/Galactifun/master)

## Discord

Feel free to join us on the Slimefun Addon Community Discord:

https://discord.gg/SqD3gg5SAU
https://discord.gg/SqD3gg5SAU
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@
import org.bukkit.event.player.PlayerGameModeChangeEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.world.PortalCreateEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.metadata.MetadataValue;

Expand Down Expand Up @@ -181,6 +183,20 @@ public Collection<AlienWorld> alienWorlds() {
return Collections.unmodifiableCollection(this.alienWorlds.values());
}

@EventHandler(priority = EventPriority.HIGHEST)
public void onPortalCreate(PortalCreateEvent e) {
if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && getAlienWorld(e.getWorld()) != null) {
e.setCancelled(true);
}
}

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void portal(PlayerPortalEvent e){
if (!Galactifun.instance().getConfig().getBoolean("worlds.allow-nether-portals") && getAlienWorld(e.getFrom().getWorld()) != null){
e.setCancelled(true);
}
}

@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onPlanetChange(@Nonnull PlayerChangedWorldEvent e) {
AlienWorld object = getAlienWorld(e.getFrom());
Expand Down
3 changes: 3 additions & 0 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ worlds:
# This should be the name main world where people work on stuff and make bases.
earth-name: world

# If set to true, players can use Nether portals in Galactifun planet worlds.
allow-nether-portals: false

aliens:

# How often aliens tick in Minecraft ticks - there are 20 ticks in 1 second
Expand Down

0 comments on commit c598c22

Please sign in to comment.