mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-14 22:56:12 +01:00
Move destination to new world manager api
This commit is contained in:
parent
791d8b653c
commit
08b87cba39
@ -1,14 +1,5 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.InvalidCommandArgument;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
@ -18,7 +9,6 @@ import co.aikar.commands.annotation.Optional;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
|
||||
@ -38,6 +28,11 @@ import org.bukkit.plugin.Plugin;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@CommandAlias("mv")
|
||||
public class CreateCommand extends MultiverseCommand {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import co.aikar.commands.annotation.CommandAlias;
|
||||
import co.aikar.commands.annotation.CommandCompletion;
|
||||
import co.aikar.commands.annotation.CommandPermission;
|
||||
@ -8,8 +7,6 @@ import co.aikar.commands.annotation.Description;
|
||||
import co.aikar.commands.annotation.Subcommand;
|
||||
import co.aikar.commands.annotation.Syntax;
|
||||
import com.dumptruckman.minecraft.util.Logging;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MVCommandManager;
|
||||
import com.onarandombox.MultiverseCore.commandtools.MultiverseCommand;
|
||||
|
@ -5,11 +5,12 @@ import java.util.Collections;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.api.Destination;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.Teleporter;
|
||||
import com.onarandombox.MultiverseCore.worldnew.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.worldnew.WorldManager;
|
||||
import jakarta.inject.Inject;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
@ -17,10 +18,10 @@ import org.jvnet.hk2.annotations.Service;
|
||||
@Service
|
||||
public class CannonDestination implements Destination<CannonDestinationInstance> {
|
||||
|
||||
private final MVWorldManager worldManager;
|
||||
private final WorldManager worldManager;
|
||||
|
||||
@Inject
|
||||
public CannonDestination(MVWorldManager worldManager) {
|
||||
public CannonDestination(WorldManager worldManager) {
|
||||
this.worldManager = worldManager;
|
||||
}
|
||||
|
||||
@ -53,7 +54,7 @@ public class CannonDestination implements Destination<CannonDestinationInstance>
|
||||
return null;
|
||||
}
|
||||
|
||||
MVWorld world = this.worldManager.getMVWorld(worldName);
|
||||
World world = this.worldManager.getMVWorld(worldName).map(MVWorld::getBukkitWorld).getOrNull().getOrNull();
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
@ -62,7 +63,7 @@ public class CannonDestination implements Destination<CannonDestinationInstance>
|
||||
double dSpeed;
|
||||
try {
|
||||
location = new Location(
|
||||
world.getCBWorld(),
|
||||
world,
|
||||
Double.parseDouble(coordinatesParams[0]),
|
||||
Double.parseDouble(coordinatesParams[1]),
|
||||
Double.parseDouble(coordinatesParams[2]),
|
||||
|
@ -5,11 +5,12 @@ import java.util.Collections;
|
||||
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.api.Destination;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.Teleporter;
|
||||
import com.onarandombox.MultiverseCore.worldnew.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.worldnew.WorldManager;
|
||||
import jakarta.inject.Inject;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jvnet.hk2.annotations.Service;
|
||||
@ -17,10 +18,10 @@ import org.jvnet.hk2.annotations.Service;
|
||||
@Service
|
||||
public class ExactDestination implements Destination<ExactDestinationInstance> {
|
||||
|
||||
private final MVWorldManager worldManager;
|
||||
private final WorldManager worldManager;
|
||||
|
||||
@Inject
|
||||
public ExactDestination(MVWorldManager worldManager) {
|
||||
public ExactDestination(WorldManager worldManager) {
|
||||
this.worldManager = worldManager;
|
||||
}
|
||||
|
||||
@ -49,7 +50,7 @@ public class ExactDestination implements Destination<ExactDestinationInstance> {
|
||||
return null;
|
||||
}
|
||||
|
||||
MVWorld world = this.worldManager.getMVWorld(worldName);
|
||||
World world = this.worldManager.getMVWorld(worldName).map(MVWorld::getBukkitWorld).getOrNull().getOrNull();
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
@ -57,7 +58,7 @@ public class ExactDestination implements Destination<ExactDestinationInstance> {
|
||||
Location location;
|
||||
try {
|
||||
location = new Location(
|
||||
world.getCBWorld(),
|
||||
world,
|
||||
Double.parseDouble(coordinatesParams[0]),
|
||||
Double.parseDouble(coordinatesParams[1]),
|
||||
Double.parseDouble(coordinatesParams[2])
|
||||
|
@ -6,9 +6,9 @@ import java.util.Collections;
|
||||
import co.aikar.commands.BukkitCommandIssuer;
|
||||
import com.onarandombox.MultiverseCore.api.Destination;
|
||||
import com.onarandombox.MultiverseCore.api.LocationManipulation;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.Teleporter;
|
||||
import com.onarandombox.MultiverseCore.worldnew.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.worldnew.WorldManager;
|
||||
import jakarta.inject.Inject;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -17,11 +17,11 @@ import org.jvnet.hk2.annotations.Service;
|
||||
@Service
|
||||
public class WorldDestination implements Destination<WorldDestinationInstance> {
|
||||
|
||||
private final MVWorldManager worldManager;
|
||||
private final WorldManager worldManager;
|
||||
private final LocationManipulation locationManipulation;
|
||||
|
||||
@Inject
|
||||
public WorldDestination(MVWorldManager worldManager, LocationManipulation locationManipulation) {
|
||||
public WorldDestination(WorldManager worldManager, LocationManipulation locationManipulation) {
|
||||
this.worldManager = worldManager;
|
||||
this.locationManipulation = locationManipulation;
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class WorldDestination implements Destination<WorldDestinationInstance> {
|
||||
}
|
||||
|
||||
String worldName = items[0];
|
||||
MVWorld world = this.worldManager.getMVWorld(worldName);
|
||||
MVWorld world = this.worldManager.getMVWorld(worldName).getOrNull();
|
||||
if (world == null) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
package com.onarandombox.MultiverseCore.destination.core;
|
||||
|
||||
import com.onarandombox.MultiverseCore.api.DestinationInstance;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.worldnew.MVWorld;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -59,8 +59,8 @@ public class WorldDestinationInstance implements DestinationInstance {
|
||||
@Override
|
||||
public @NotNull String serialise() {
|
||||
if (this.direction != null) {
|
||||
return this.world.getCBWorld().getName() + ":" + this.direction;
|
||||
return this.world.getName() + ":" + this.direction;
|
||||
}
|
||||
return this.world.getCBWorld().getName();
|
||||
return this.world.getName();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user