Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
/**
* Used to get block/location-related information.
*/
@Deprecated
@Contract
public interface BlockSafety {
/**
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/org/mvplugins/multiverse/core/api/MVConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,14 @@ public interface MVConfig {
*/
void setFirstSpawnOverride(boolean firstSpawnOverride);

void setSafeLocationHorizontalSearchRadius(int searchRadius);

int getSafeLocationHorizontalSearchRadius();

void setSafeLocationVerticalSearchRadius(int searchRadius);

int getSafeLocationVerticalSearchRadius();

/**
* Gets firstSpawnOverride.
* @return firstSpawnOverride.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,26 @@ public void setFirstSpawnOverride(boolean firstSpawnOverride) {
configHandle.set(configNodes.FIRST_SPAWN_OVERRIDE, firstSpawnOverride);
}

@Override
public void setSafeLocationHorizontalSearchRadius(int searchRadius) {
configHandle.set(configNodes.SAFE_LOCATION_HORIZONTAL_SEARCH_RADIUS, searchRadius);
}

@Override
public int getSafeLocationHorizontalSearchRadius() {
return configHandle.get(configNodes.SAFE_LOCATION_HORIZONTAL_SEARCH_RADIUS);
}

@Override
public void setSafeLocationVerticalSearchRadius(int searchRadius) {
configHandle.set(configNodes.SAFE_LOCATION_VERTICAL_SEARCH_RADIUS, searchRadius);
}

@Override
public int getSafeLocationVerticalSearchRadius() {
return configHandle.get(configNodes.SAFE_LOCATION_VERTICAL_SEARCH_RADIUS);
}

@Override
public boolean getFirstSpawnOverride() {
return configHandle.get(configNodes.FIRST_SPAWN_OVERRIDE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ private <N extends Node> N node(N node) {
.name("teleport-intercept")
.build());

final ConfigNode<Integer> SAFE_LOCATION_HORIZONTAL_SEARCH_RADIUS = node(ConfigNode.builder("teleport.safe-location-horizontal-search-radius", Integer.class)
.comment("")
.comment("Sets the horizontal (x and z-axis) search radius for finding a safe location to teleport to.")
.comment("Increasing this value will widen the search area at the cost of performance.")
.comment("To disable, set to 0.")
.defaultValue(3)
.name("safe-location-horizontal-search-radius")
.build());

final ConfigNode<Integer> SAFE_LOCATION_VERTICAL_SEARCH_RADIUS = node(ConfigNode.builder("teleport.safe-location-vertical-search-radius", Integer.class)
.comment("")
.comment("Sets the vertical (y-axis) search radius for finding a safe location to teleport to.")
.comment("Increasing this value will widen the search area at the cost of performance.")
.comment("To disable, set to 0.")
.defaultValue(3)
.name("safe-location-vertical-search-radius")
.build());

private final ConfigHeaderNode SPAWN_HEADER = node(ConfigHeaderNode.builder("spawn")
.comment("")
.comment("")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package org.mvplugins.multiverse.core.listeners;

import java.util.Map;
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

import com.dumptruckman.minecraft.util.Logging;
Expand All @@ -24,22 +23,20 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerChangedWorldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPortalEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.plugin.Plugin;
import org.jetbrains.annotations.NotNull;
import org.jvnet.hk2.annotations.Service;

import org.mvplugins.multiverse.core.MultiverseCore;
import org.mvplugins.multiverse.core.api.BlockSafety;
import org.mvplugins.multiverse.core.commandtools.MVCommandManager;
import org.mvplugins.multiverse.core.config.MVCoreConfig;
import org.mvplugins.multiverse.core.destination.DestinationInstance;
import org.mvplugins.multiverse.core.destination.DestinationsProvider;
import org.mvplugins.multiverse.core.economy.MVEconomist;
import org.mvplugins.multiverse.core.event.MVRespawnEvent;
import org.mvplugins.multiverse.core.teleportation.AdvancedBlockSafety;
import org.mvplugins.multiverse.core.teleportation.AsyncSafetyTeleporter;
import org.mvplugins.multiverse.core.teleportation.TeleportQueue;
import org.mvplugins.multiverse.core.utils.result.ResultChain;
Expand All @@ -58,7 +55,7 @@ public class MVPlayerListener implements CoreListener {
private final Plugin plugin;
private final MVCoreConfig config;
private final Provider<WorldManager> worldManagerProvider;
private final BlockSafety blockSafety;
private final AdvancedBlockSafety blockSafety;
private final AsyncSafetyTeleporter safetyTeleporter;
private final Server server;
private final TeleportQueue teleportQueue;
Expand All @@ -75,7 +72,7 @@ public class MVPlayerListener implements CoreListener {
MultiverseCore plugin,
MVCoreConfig config,
Provider<WorldManager> worldManagerProvider,
BlockSafety blockSafety,
AdvancedBlockSafety blockSafety,
AsyncSafetyTeleporter safetyTeleporter,
Server server,
TeleportQueue teleportQueue,
Expand Down Expand Up @@ -317,6 +314,7 @@ public void playerPortalCheck(PlayerPortalEvent event) {
return;
}
}

/**
* This method is called when a player actually portals via a vanilla style portal.
* @param event The Event that was fired.
Expand Down
Loading