mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
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:
@@ -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,
|
||||
|
||||
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user