Add second chance to teleports

This commit is contained in:
Eric Stokes 2011-07-30 09:17:23 -06:00
parent a43e033a84
commit addd95443a
9 changed files with 31 additions and 14 deletions

@ -1 +1 @@
Subproject commit 19ed820418bf91e1851ec3533dd50e372bd711c3
Subproject commit 330ec8864a11b196e71a0540c7dd5f94064ba20a

View File

@ -349,7 +349,7 @@ public class MVWorld {
}
private boolean setVariable(String name, double value) {
if (name.equalsIgnoreCase("scaling")) {
if (name.equalsIgnoreCase("scaling") || name.equalsIgnoreCase("scale")) {
this.setScaling(value);
return true;
}

View File

@ -10,6 +10,7 @@ import java.util.logging.Level;
import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.command.Command;
@ -64,7 +65,7 @@ import com.onarandombox.utils.UpdateChecker;
import com.onarandombox.utils.WorldDestination;
import com.pneumaticraft.commandhandler.CommandHandler;
public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
// Useless stuff to keep us going.
private static final Logger log = Logger.getLogger("Minecraft");
@ -155,7 +156,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
this.loadWorlds(true);
} else {
this.log(Level.SEVERE , "Your configs were not loaded. Very little will function in Multiverse.");
this.log(Level.SEVERE, "Your configs were not loaded. Very little will function in Multiverse.");
}
}
@ -410,7 +411,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
* @return True if success, false if failure.
*/
public boolean removeWorldFromList(String name) {
if (this.worlds.containsKey(name)) {
this.worlds.remove(name);
this.log(Level.INFO, "World " + name + " was unloaded from memory.");
@ -427,7 +428,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
* @return True if success, false if failure.
*/
public boolean removeWorldFromConfig(String name) {
if(this.configWorlds.getProperty("worlds." + name) != null) {
if (this.configWorlds.getProperty("worlds." + name) != null) {
removeWorldFromList(name);
this.log(Level.INFO, "World " + name + " was removed from config.yml");
this.configWorlds.removeProperty("worlds." + name);
@ -465,7 +466,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
World w = this.getServer().getWorld(name);
World safeWorld = this.getServer().getWorlds().get(0);
List<Player> ps = w.getPlayers();
for(Player p : ps) {
for (Player p : ps) {
p.teleport(safeWorld.getSpawnLocation());
}
}
@ -719,4 +720,14 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
public DestinationFactory getDestinationFactory() {
return this.destFactory;
}
/**
* This is a convenience method to allow the QueuedCommand system to call it. You should NEVER call this directly.
*
* @param p Player
* @param l The potentially unsafe location.
*/
public void teleportPlayer(Player p, Location l) {
p.teleport(l);
}
}

View File

@ -18,7 +18,7 @@ public class ModifyAddCommand extends MultiverseCommand {
public ModifyAddCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Add a value)");
this.setCommandUsage("/mv modify " + ChatColor.GREEN + "ADD {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
this.setCommandUsage("/mv modify " + ChatColor.GREEN + "add {VALUE} {PROPERTY}" + ChatColor.GOLD + " [WORLD] ");
this.setArgRange(2, 3);
this.addKey("mvm add");
this.addKey("mvmadd");

View File

@ -21,7 +21,7 @@ enum Action {
// Color == Aliascolor
enum SetProperties {
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn, currency, curr, price, scale
}
public class ModifyCommand extends MultiverseCommand {

View File

@ -15,7 +15,7 @@ public class ModifyRemoveCommand extends MultiverseCommand {
public ModifyRemoveCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Modify a World (Remove a value)");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + "REMOVE {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setCommandUsage("/mv modify" + ChatColor.GREEN + " remove {PROPERTY} {VALUE}" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(2, 3);
this.addKey("mvm remove");
this.addKey("mvmremove");

View File

@ -13,7 +13,7 @@ public class RemoveCommand extends MultiverseCommand {
public RemoveCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Remove World");
this.setCommandUsage("/mv remove " + ChatColor.GREEN + " {WORLD}");
this.setCommandUsage("/mv remove" + ChatColor.GREEN + " {WORLD}");
this.setArgRange(1, 1);
this.addKey("mvremove");
this.setPermission("multiverse.core.remove", "Unloads a world from Multiverse and removes it from worlds.yml, this does NOT remove the world folder.", PermissionDefault.OP);

View File

@ -1,5 +1,6 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -106,8 +107,13 @@ public class TeleportCommand extends MultiverseCommand {
teleporter.sendMessage("Sorry Boss, I tried everything, but just couldn't teleport ya there!");
return;
}
if(this.playerTeleporter.safelyTeleport(teleportee, l)) {
if(!this.playerTeleporter.safelyTeleport(teleportee, l)) {
Class<?> paramTypes[] = { Player.class, Location.class };
List<Object> items = new ArrayList<Object>();
items.add(teleportee);
items.add(l);
String message = "Multiverse" + ChatColor.WHITE + " did not teleport you to " + ChatColor.DARK_AQUA + d.getName() + ChatColor.WHITE + " because it was unsafe.";
this.plugin.getCommandHandler().queueCommand(sender, "mvteleport", "teleportPlayer", items, paramTypes, "", "", ChatColor.GREEN + message, "Would you like to try anyway?", 15);
}
}
}

View File

@ -16,7 +16,7 @@ public class WhoCommand extends MultiverseCommand {
public WhoCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Who?");
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
this.setArgRange(0, 1);
this.addKey("mv who");
this.addKey("mvw");