mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 10:36:06 +01:00
Multi-World travel now possible, not perfected at all
This commit is contained in:
parent
599bbcd16c
commit
5c144f31c2
@ -32,7 +32,7 @@ public class ListCommand extends BaseCommand {
|
||||
}
|
||||
}
|
||||
|
||||
String output = ChatColor.GREEN + "Worlds which you can view - \n";
|
||||
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
||||
for (int i = 0; i < plugin.getServer().getWorlds().size(); i++) {
|
||||
|
||||
World world = plugin.getServer().getWorlds().get(i);
|
||||
@ -54,7 +54,7 @@ public class ListCommand extends BaseCommand {
|
||||
color = ChatColor.GREEN;
|
||||
}
|
||||
|
||||
output += color + world.getName() + " - " + world.getEnvironment().toString() + " \n";
|
||||
output += ChatColor.GOLD + world.getName() + ChatColor.WHITE + " - " + color + world.getEnvironment().toString() + " \n";
|
||||
|
||||
}
|
||||
String[] response = output.split("\n");
|
||||
|
@ -1,24 +1,31 @@
|
||||
package com.onarandombox.MultiverseCore.command.commands;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVTeleport;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.command.BaseCommand;
|
||||
import com.onarandombox.utils.Destination;
|
||||
import com.onarandombox.utils.DestinationType;
|
||||
|
||||
public class TeleportCommand extends BaseCommand {
|
||||
private final Logger log = Logger.getLogger("Minecraft");
|
||||
private MVTeleport playerTeleporter;
|
||||
|
||||
public TeleportCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
name = "Teleport";
|
||||
description = "Teleports you to a different world.";
|
||||
usage = "/mvcoord" + ChatColor.RED + "{WORLD}";
|
||||
usage = "/mvtp" + ChatColor.GREEN + " {WORLD}";
|
||||
minArgs = 1;
|
||||
maxArgs = 1;
|
||||
identifiers.add("mvtp");
|
||||
playerTeleporter = new MVTeleport(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -31,12 +38,13 @@ public class TeleportCommand extends BaseCommand {
|
||||
p.sendMessage("You do not have access to this command.");
|
||||
return;
|
||||
}
|
||||
Destination d = Destination.parseDestination(args[1]);
|
||||
Destination d = Destination.parseDestination(args[0]);
|
||||
// TODO: I'd like to find a way to do these next bits inside Destination, so we're always valid --FF
|
||||
// TODO: Support portals, but I didn't see the portals list --FF
|
||||
if (this.plugin.worlds.containsKey(d.getName().toLowerCase())) {
|
||||
if(d.getType() == DestinationType.World) {
|
||||
|
||||
if (d.getType() == DestinationType.World) {
|
||||
Location l = playerTeleporter.getSafeDestination(plugin.getServer().getWorld(d.getName()).getSpawnLocation());
|
||||
p.teleport(l);
|
||||
}
|
||||
} else {
|
||||
p.sendMessage("That was not a valid world (portals aren't yet supported)");
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.onarandombox.utils;
|
||||
|
||||
public class Destination {
|
||||
|
||||
private String name;
|
||||
private DestinationType type;
|
||||
|
||||
@ -34,7 +33,7 @@ public class Destination {
|
||||
|
||||
// If we only found one param, assume world
|
||||
// TODO: Check for a valid world
|
||||
if (items.length == 0) {
|
||||
if (items.length == 1) {
|
||||
return new Destination(items[0], DestinationType.World);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user