mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-02-03 06:01:30 +01:00
Add second chance to teleports
This commit is contained in:
parent
a43e033a84
commit
addd95443a
@ -1 +1 @@
|
|||||||
Subproject commit 19ed820418bf91e1851ec3533dd50e372bd711c3
|
Subproject commit 330ec8864a11b196e71a0540c7dd5f94064ba20a
|
@ -349,7 +349,7 @@ public class MVWorld {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean setVariable(String name, double value) {
|
private boolean setVariable(String name, double value) {
|
||||||
if (name.equalsIgnoreCase("scaling")) {
|
if (name.equalsIgnoreCase("scaling") || name.equalsIgnoreCase("scale")) {
|
||||||
this.setScaling(value);
|
this.setScaling(value);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.World.Environment;
|
import org.bukkit.World.Environment;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -64,7 +65,7 @@ import com.onarandombox.utils.UpdateChecker;
|
|||||||
import com.onarandombox.utils.WorldDestination;
|
import com.onarandombox.utils.WorldDestination;
|
||||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
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.
|
// Useless stuff to keep us going.
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
private static final Logger log = Logger.getLogger("Minecraft");
|
||||||
@ -155,7 +156,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
|
|||||||
|
|
||||||
this.loadWorlds(true);
|
this.loadWorlds(true);
|
||||||
} else {
|
} 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.
|
* @return True if success, false if failure.
|
||||||
*/
|
*/
|
||||||
public boolean removeWorldFromList(String name) {
|
public boolean removeWorldFromList(String name) {
|
||||||
|
|
||||||
if (this.worlds.containsKey(name)) {
|
if (this.worlds.containsKey(name)) {
|
||||||
this.worlds.remove(name);
|
this.worlds.remove(name);
|
||||||
this.log(Level.INFO, "World " + name + " was unloaded from memory.");
|
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.
|
* @return True if success, false if failure.
|
||||||
*/
|
*/
|
||||||
public boolean removeWorldFromConfig(String name) {
|
public boolean removeWorldFromConfig(String name) {
|
||||||
if(this.configWorlds.getProperty("worlds." + name) != null) {
|
if (this.configWorlds.getProperty("worlds." + name) != null) {
|
||||||
removeWorldFromList(name);
|
removeWorldFromList(name);
|
||||||
this.log(Level.INFO, "World " + name + " was removed from config.yml");
|
this.log(Level.INFO, "World " + name + " was removed from config.yml");
|
||||||
this.configWorlds.removeProperty("worlds." + name);
|
this.configWorlds.removeProperty("worlds." + name);
|
||||||
@ -465,7 +466,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
|
|||||||
World w = this.getServer().getWorld(name);
|
World w = this.getServer().getWorld(name);
|
||||||
World safeWorld = this.getServer().getWorlds().get(0);
|
World safeWorld = this.getServer().getWorlds().get(0);
|
||||||
List<Player> ps = w.getPlayers();
|
List<Player> ps = w.getPlayers();
|
||||||
for(Player p : ps) {
|
for (Player p : ps) {
|
||||||
p.teleport(safeWorld.getSpawnLocation());
|
p.teleport(safeWorld.getSpawnLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -719,4 +720,14 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin{
|
|||||||
public DestinationFactory getDestinationFactory() {
|
public DestinationFactory getDestinationFactory() {
|
||||||
return this.destFactory;
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ public class ModifyAddCommand extends MultiverseCommand {
|
|||||||
public ModifyAddCommand(MultiverseCore plugin) {
|
public ModifyAddCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.setName("Modify a World (Add a value)");
|
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.setArgRange(2, 3);
|
||||||
this.addKey("mvm add");
|
this.addKey("mvm add");
|
||||||
this.addKey("mvmadd");
|
this.addKey("mvmadd");
|
||||||
|
@ -21,7 +21,7 @@ enum Action {
|
|||||||
|
|
||||||
// Color == Aliascolor
|
// Color == Aliascolor
|
||||||
enum SetProperties {
|
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 {
|
public class ModifyCommand extends MultiverseCommand {
|
||||||
|
@ -15,7 +15,7 @@ public class ModifyRemoveCommand extends MultiverseCommand {
|
|||||||
public ModifyRemoveCommand(MultiverseCore plugin) {
|
public ModifyRemoveCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.setName("Modify a World (Remove a value)");
|
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.setArgRange(2, 3);
|
||||||
this.addKey("mvm remove");
|
this.addKey("mvm remove");
|
||||||
this.addKey("mvmremove");
|
this.addKey("mvmremove");
|
||||||
|
@ -13,7 +13,7 @@ public class RemoveCommand extends MultiverseCommand {
|
|||||||
public RemoveCommand(MultiverseCore plugin) {
|
public RemoveCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.setName("Remove World");
|
this.setName("Remove World");
|
||||||
this.setCommandUsage("/mv remove " + ChatColor.GREEN + " {WORLD}");
|
this.setCommandUsage("/mv remove" + ChatColor.GREEN + " {WORLD}");
|
||||||
this.setArgRange(1, 1);
|
this.setArgRange(1, 1);
|
||||||
this.addKey("mvremove");
|
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);
|
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);
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.onarandombox.MultiverseCore.commands;
|
package com.onarandombox.MultiverseCore.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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!");
|
teleporter.sendMessage("Sorry Boss, I tried everything, but just couldn't teleport ya there!");
|
||||||
return;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ public class WhoCommand extends MultiverseCommand {
|
|||||||
public WhoCommand(MultiverseCore plugin) {
|
public WhoCommand(MultiverseCore plugin) {
|
||||||
super(plugin);
|
super(plugin);
|
||||||
this.setName("Who?");
|
this.setName("Who?");
|
||||||
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
|
this.setCommandUsage("/mv who" + ChatColor.GOLD + " [WORLD]");
|
||||||
this.setArgRange(0, 1);
|
this.setArgRange(0, 1);
|
||||||
this.addKey("mv who");
|
this.addKey("mv who");
|
||||||
this.addKey("mvw");
|
this.addKey("mvw");
|
||||||
|
Loading…
Reference in New Issue
Block a user