mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-02-02 21:41:23 +01:00
parent
51b725ea58
commit
f44f3fb7d6
@ -23,6 +23,8 @@ public interface ConfigRepository {
|
||||
|
||||
int getProtectionRadius();
|
||||
|
||||
boolean blockSpectatorMode();
|
||||
|
||||
boolean getStopWaterFlow();
|
||||
|
||||
boolean getPortalProtection();
|
||||
|
@ -134,6 +134,11 @@ public class ConfigRepositoryImpl implements ConfigRepository {
|
||||
return this.config.disablePhysicsEvents;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean blockSpectatorMode() {
|
||||
return this.config.blockSpectatorMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandPortalConfig getCommandPortals() {
|
||||
return this.config.commandPortals;
|
||||
|
@ -24,6 +24,8 @@ public class Config {
|
||||
|
||||
public boolean disablePhysicsEvents = true;
|
||||
|
||||
public boolean blockSpectatorMode = true;
|
||||
|
||||
public int maxPortalVisualisationSize = 1000;
|
||||
|
||||
public int maxSelectionVisualisationSize = 9000;
|
||||
|
@ -2,6 +2,7 @@ package com.sekwah.advancedportals.core.services;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
import com.sekwah.advancedportals.core.connector.containers.GameMode;
|
||||
import com.sekwah.advancedportals.core.connector.containers.PlayerContainer;
|
||||
import com.sekwah.advancedportals.core.portal.AdvancedPortal;
|
||||
import com.sekwah.advancedportals.core.registry.TagRegistry;
|
||||
@ -102,6 +103,10 @@ public class PortalServices {
|
||||
|
||||
public PortalActivationResult checkPortalActivation(
|
||||
PlayerContainer player, PlayerLocation toLoc, TriggerType triggerType) {
|
||||
if(configRepository.blockSpectatorMode() && player.getGameMode() == GameMode.SPECTATOR) {
|
||||
return PortalActivationResult.NOT_IN_PORTAL;
|
||||
}
|
||||
|
||||
var blockLoc = toLoc.toBlockPos();
|
||||
var blockEntityTopLoc = blockLoc.addY(player.getHeight());
|
||||
var world = player.getWorld();
|
||||
|
Loading…
Reference in New Issue
Block a user