fix: make entities respect the allow_nether setting and add an allow_end setting (#1374)

* fix: make try_use_portal respect allow_nether

* feat: add allow_end (#881)

* else if

* else if
This commit is contained in:
Steve
2026-01-27 21:41:58 +02:00
committed by GitHub
parent dc4ade7365
commit 31c60c1854
2 changed files with 22 additions and 0 deletions

View File

@@ -83,6 +83,8 @@ pub struct BasicConfiguration {
pub op_permission_level: PermissionLvl,
/// Whether the Nether dimension is enabled.
pub allow_nether: bool,
/// Whether the End dimension is enabled.
pub allow_end: bool,
/// Whether the server is in hardcore mode.
pub hardcore: bool,
/// Whether online mode is enabled. Requires valid Minecraft accounts.
@@ -127,6 +129,7 @@ impl Default for BasicConfiguration {
default_difficulty: Difficulty::Normal,
op_permission_level: PermissionLvl::Four,
allow_nether: true,
allow_end: true,
hardcore: false,
online_mode: true,
encryption: true,

View File

@@ -1475,6 +1475,25 @@ impl Entity {
.store(self.default_portal_cooldown(), Ordering::Relaxed);
return;
}
if (portal_world.dimension == Dimension::THE_NETHER
&& !portal_world
.server
.upgrade()
.unwrap()
.basic_config
.allow_nether)
|| (portal_world.dimension == Dimension::THE_END
&& !portal_world
.server
.upgrade()
.unwrap()
.basic_config
.allow_end)
{
return;
}
let mut manager = self.portal_manager.lock().await;
let world = self.world.load();
if manager.is_none() {