mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-12-24 01:48:02 +01:00
Cleaning up the Commands
This commit is contained in:
parent
fc7db31b0d
commit
96fa18eab3
@ -5,9 +5,8 @@ import java.util.List;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ConfirmCommand extends Command {
|
||||
public class ConfirmCommand extends MultiverseCommand {
|
||||
|
||||
public ConfirmCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -24,7 +23,7 @@ public class ConfirmCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
((MultiverseCore) this.plugin).getCommandHandler().confirmQueuedCommand(sender);
|
||||
this.plugin.getCommandHandler().confirmQueuedCommand(sender);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -9,9 +9,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.LocationManipulation;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class CoordCommand extends Command {
|
||||
public class CoordCommand extends MultiverseCommand {
|
||||
|
||||
private LocationManipulation locMan = new LocationManipulation();
|
||||
|
||||
@ -33,7 +32,7 @@ public class CoordCommand extends Command {
|
||||
if (sender instanceof Player) {
|
||||
Player p = (Player) sender;
|
||||
p.sendMessage(ChatColor.RED + "World: " + ChatColor.WHITE + p.getWorld().getName());
|
||||
p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName()).getScaling());
|
||||
p.sendMessage(ChatColor.RED + "World Scale: " + ChatColor.WHITE + this.plugin.getMVWorld(p.getWorld().getName()).getScaling());
|
||||
p.sendMessage(ChatColor.RED + "Coordinates: " + ChatColor.WHITE + this.locMan.strCoords(p.getLocation()));
|
||||
p.sendMessage(ChatColor.RED + "Direction: " + ChatColor.WHITE + this.locMan.getDirection(p.getLocation()));
|
||||
p.sendMessage(ChatColor.RED + "Block: " + ChatColor.WHITE + Material.getMaterial(p.getWorld().getBlockTypeIdAt(p.getLocation())));
|
||||
|
@ -8,10 +8,9 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
import com.pneumaticraft.commandhandler.CommandHandler;
|
||||
|
||||
public class CreateCommand extends Command {
|
||||
public class CreateCommand extends MultiverseCommand {
|
||||
|
||||
public CreateCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -38,20 +37,20 @@ public class CreateCommand extends Command {
|
||||
String seed = CommandHandler.getFlag("-s", args);
|
||||
String generator = CommandHandler.getFlag("-g", args);
|
||||
|
||||
if (new File(worldName).exists() || ((MultiverseCore) this.plugin).isMVWorld(worldName)) {
|
||||
if (new File(worldName).exists() || this.plugin.isMVWorld(worldName)) {
|
||||
sender.sendMessage(ChatColor.RED + "A Folder/World already exists with this name!");
|
||||
sender.sendMessage(ChatColor.RED + "If you are confident it is a world you can import with /mvimport");
|
||||
return;
|
||||
}
|
||||
|
||||
Environment environment = ((MultiverseCore) this.plugin).getEnvFromString(env);
|
||||
Environment environment = this.plugin.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
return;
|
||||
}
|
||||
sender.sendMessage(ChatColor.AQUA + "Starting world creation...");
|
||||
if (((MultiverseCore) this.plugin).addWorld(worldName, environment, seed, generator)) {
|
||||
if (this.plugin.addWorld(worldName, environment, seed, generator)) {
|
||||
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "FAILED.");
|
||||
|
@ -6,9 +6,8 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class DeleteCommand extends Command {
|
||||
public class DeleteCommand extends MultiverseCommand {
|
||||
|
||||
public DeleteCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -25,7 +24,7 @@ public class DeleteCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
Class<?> paramTypes[] = {String.class};
|
||||
((MultiverseCore) this.plugin).getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!");
|
||||
Class<?> paramTypes[] = { String.class };
|
||||
this.plugin.getCommandHandler().queueCommand(sender, "mvdelete", "deleteWorld", args, paramTypes, "World Deleted!", "World was not deleted!");
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,9 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class EnvironmentCommand extends Command {
|
||||
|
||||
public class EnvironmentCommand extends MultiverseCommand {
|
||||
|
||||
public EnvironmentCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
@ -7,15 +7,14 @@ import java.util.List;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class HelpCommand extends Command {
|
||||
public class HelpCommand extends MultiverseCommand {
|
||||
private static final int CMDS_PER_PAGE = 7;
|
||||
|
||||
public HelpCommand(JavaPlugin plugin) {
|
||||
public HelpCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.commandName = "Get Help with Multiverse";
|
||||
this.commandDesc = "Displays a nice help menu.";
|
||||
@ -42,7 +41,7 @@ public class HelpCommand extends Command {
|
||||
}
|
||||
}
|
||||
|
||||
List<Command> availableCommands = new ArrayList<Command>(((MultiverseCore) this.plugin).getCommandHandler().getCommands(sender));
|
||||
List<Command> availableCommands = new ArrayList<Command>(this.plugin.getCommandHandler().getCommands(sender));
|
||||
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage(ChatColor.AQUA + " Add a '" + ChatColor.DARK_PURPLE + "?" + ChatColor.AQUA + "' after a command to see more about it.");
|
||||
|
@ -8,9 +8,8 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ImportCommand extends Command {
|
||||
public class ImportCommand extends MultiverseCommand {
|
||||
|
||||
public ImportCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -29,7 +28,7 @@ public class ImportCommand extends Command {
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
String worldName = args.get(0);
|
||||
if (((MultiverseCore) this.plugin).isMVWorld(worldName) && new File(worldName).exists()) {
|
||||
if (this.plugin.isMVWorld(worldName) && new File(worldName).exists()) {
|
||||
sender.sendMessage(ChatColor.RED + "Multiverse already knows about this world!");
|
||||
return;
|
||||
}
|
||||
@ -40,7 +39,7 @@ public class ImportCommand extends Command {
|
||||
}
|
||||
|
||||
String env = args.get(1);
|
||||
Environment environment = ((MultiverseCore) this.plugin).getEnvFromString(env);
|
||||
Environment environment = this.plugin.getEnvFromString(env);
|
||||
if (environment == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That is not a valid environment.");
|
||||
EnvironmentCommand.showEnvironments(sender);
|
||||
@ -49,7 +48,7 @@ public class ImportCommand extends Command {
|
||||
|
||||
if (new File(worldName).exists() && env != null) {
|
||||
sender.sendMessage(ChatColor.AQUA + "Starting world import...");
|
||||
((MultiverseCore) this.plugin).addWorld(worldName, environment, null, generator);
|
||||
this.plugin.addWorld(worldName, environment, null, generator);
|
||||
sender.sendMessage(ChatColor.GREEN + "Complete!");
|
||||
return;
|
||||
} else if (env == null) {
|
||||
|
@ -9,9 +9,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class InfoCommand extends Command {
|
||||
public class InfoCommand extends MultiverseCommand {
|
||||
|
||||
public InfoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -39,8 +38,8 @@ public class InfoCommand extends Command {
|
||||
} else {
|
||||
worldName = args.get(0);
|
||||
}
|
||||
if (((MultiverseCore) this.plugin).isMVWorld(worldName)) {
|
||||
for (String s : buildEntireCommand(((MultiverseCore) this.plugin).getMVWorld(worldName))) {
|
||||
if (this.plugin.isMVWorld(worldName)) {
|
||||
for (String s : buildEntireCommand(this.plugin.getMVWorld(worldName))) {
|
||||
sender.sendMessage(s);
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ListCommand extends Command {
|
||||
public class ListCommand extends MultiverseCommand {
|
||||
|
||||
public ListCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -35,9 +34,9 @@ public class ListCommand extends Command {
|
||||
}
|
||||
|
||||
String output = ChatColor.LIGHT_PURPLE + "Worlds which you can view:\n";
|
||||
for (MVWorld world : ((MultiverseCore) this.plugin).getMVWorlds()) {
|
||||
for (MVWorld world : this.plugin.getMVWorlds()) {
|
||||
|
||||
if (p != null && (!((MultiverseCore) this.plugin).ph.canEnterWorld(p, world))) {
|
||||
if (p != null && (!this.plugin.ph.canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
// This will contain all the properties that support the ADD/REMOVE
|
||||
// Anything not in here will only support the SET action
|
||||
|
||||
public class ModifyAddCommand extends Command {
|
||||
public class ModifyAddCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyAddCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -51,9 +50,9 @@ public class ModifyAddCommand extends Command {
|
||||
String property = args.get(1);
|
||||
|
||||
if (args.size() == 2) {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(2));
|
||||
world = this.plugin.getMVWorld(args.get(2));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
|
@ -8,9 +8,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ModifyClearCommand extends Command {
|
||||
public class ModifyClearCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyClearCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -46,9 +45,9 @@ public class ModifyClearCommand extends Command {
|
||||
String property = args.get(0);
|
||||
|
||||
if (args.size() == 1) {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(1));
|
||||
world = this.plugin.getMVWorld(args.get(1));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
|
@ -6,7 +6,6 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
enum AddProperties {
|
||||
blockblacklist, playerwhitelist, playerblacklist, worldblacklist, animals, monsters
|
||||
@ -21,7 +20,7 @@ enum SetProperties {
|
||||
alias, animals, monsters, pvp, scaling, aliascolor, color, respawn
|
||||
}
|
||||
|
||||
public class ModifyCommand extends Command {
|
||||
public class ModifyCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -53,7 +52,6 @@ public class ModifyCommand extends Command {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -8,9 +8,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ModifyRemoveCommand extends Command {
|
||||
public class ModifyRemoveCommand extends MultiverseCommand {
|
||||
|
||||
public ModifyRemoveCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -48,9 +47,9 @@ public class ModifyRemoveCommand extends Command {
|
||||
String property = args.get(1);
|
||||
|
||||
if (args.size() == 2) {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(2));
|
||||
world = this.plugin.getMVWorld(args.get(2));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
|
@ -8,9 +8,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ModifySetCommand extends Command {
|
||||
public class ModifySetCommand extends MultiverseCommand {
|
||||
|
||||
public ModifySetCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -48,9 +47,9 @@ public class ModifySetCommand extends Command {
|
||||
String property = args.get(0);
|
||||
|
||||
if (args.size() == 2) {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(p.getWorld().getName());
|
||||
world = this.plugin.getMVWorld(p.getWorld().getName());
|
||||
} else {
|
||||
world = ((MultiverseCore) this.plugin).getMVWorld(args.get(2));
|
||||
world = this.plugin.getMVWorld(args.get(2));
|
||||
}
|
||||
|
||||
if (world == null) {
|
||||
|
@ -0,0 +1,23 @@
|
||||
package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class MultiverseCommand extends Command {
|
||||
|
||||
protected MultiverseCore plugin;
|
||||
public MultiverseCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -11,9 +11,8 @@ import org.bukkit.entity.Player;
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.PurgeWorlds;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class PurgeCommand extends Command {
|
||||
public class PurgeCommand extends MultiverseCommand {
|
||||
|
||||
public PurgeCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -49,7 +48,7 @@ public class PurgeCommand extends Command {
|
||||
deathName = args.get(1);
|
||||
}
|
||||
|
||||
if (!worldName.equalsIgnoreCase("all") && !((MultiverseCore) this.plugin).isMVWorld(worldName)) {
|
||||
if (!worldName.equalsIgnoreCase("all") && !this.plugin.isMVWorld(worldName)) {
|
||||
((MultiverseCore)this.plugin).showNotMVWorldMessage(sender, worldName);
|
||||
sender.sendMessage("It cannot be purged.");
|
||||
return;
|
||||
@ -58,12 +57,12 @@ public class PurgeCommand extends Command {
|
||||
List<MVWorld> worldsToRemoveEntitiesFrom = new ArrayList<MVWorld>();
|
||||
// Handle all case any user who names a world "all" should know better...
|
||||
if (worldName.equalsIgnoreCase("all")) {
|
||||
worldsToRemoveEntitiesFrom.addAll(((MultiverseCore) this.plugin).getMVWorlds());
|
||||
worldsToRemoveEntitiesFrom.addAll(this.plugin.getMVWorlds());
|
||||
} else {
|
||||
worldsToRemoveEntitiesFrom.add(((MultiverseCore) this.plugin).getMVWorld(worldName));
|
||||
worldsToRemoveEntitiesFrom.add(this.plugin.getMVWorld(worldName));
|
||||
}
|
||||
|
||||
PurgeWorlds purger = ((MultiverseCore) this.plugin).getWorldPurger();
|
||||
PurgeWorlds purger = this.plugin.getWorldPurger();
|
||||
ArrayList<String> thingsToKill = new ArrayList<String>();
|
||||
if (deathName.equalsIgnoreCase("all") || deathName.equalsIgnoreCase("animals") || deathName.equalsIgnoreCase("monsters")) {
|
||||
thingsToKill.add(deathName.toUpperCase());
|
||||
|
@ -6,9 +6,8 @@ import java.util.logging.Level;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class ReloadCommand extends Command {
|
||||
public class ReloadCommand extends MultiverseCommand {
|
||||
|
||||
public ReloadCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -26,10 +25,10 @@ public class ReloadCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
((MultiverseCore) this.plugin).log(Level.INFO, "Reloading Multiverse-Core config.yml and worlds.yml");
|
||||
((MultiverseCore) this.plugin).loadConfigs();
|
||||
((MultiverseCore) this.plugin).loadWorlds(true);
|
||||
((MultiverseCore) this.plugin).log(Level.INFO, "Reload Complete!");
|
||||
this.plugin.log(Level.INFO, "Reloading Multiverse-Core config.yml and worlds.yml");
|
||||
this.plugin.loadConfigs();
|
||||
this.plugin.loadWorlds(true);
|
||||
this.plugin.log(Level.INFO, "Reload Complete!");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -6,9 +6,8 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class RemoveCommand extends Command {
|
||||
public class RemoveCommand extends MultiverseCommand {
|
||||
|
||||
public RemoveCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -25,7 +24,7 @@ public class RemoveCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (((MultiverseCore) this.plugin).removeWorld(args.get(0))) {
|
||||
if (this.plugin.removeWorld(args.get(0))) {
|
||||
sender.sendMessage("World removed from config!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to remove world from config!");
|
||||
|
@ -8,9 +8,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class SetSpawnCommand extends Command {
|
||||
public class SetSpawnCommand extends MultiverseCommand {
|
||||
|
||||
public SetSpawnCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
|
@ -2,17 +2,13 @@ package com.onarandombox.MultiverseCore.commands;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVPlayerSession;
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class SleepCommand extends Command {
|
||||
public class SleepCommand extends MultiverseCommand {
|
||||
|
||||
public SleepCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -36,7 +32,7 @@ public class SleepCommand extends Command {
|
||||
if (p == null) {
|
||||
return;
|
||||
}
|
||||
MVPlayerSession session = ((MultiverseCore) this.plugin).getPlayerSession(p);
|
||||
MVPlayerSession session = this.plugin.getPlayerSession(p);
|
||||
if (session.getBedRespawnLocation() != null) {
|
||||
p.teleport(session.getBedRespawnLocation());
|
||||
} else {
|
||||
|
@ -7,9 +7,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class SpawnCommand extends Command {
|
||||
public class SpawnCommand extends MultiverseCommand {
|
||||
|
||||
public SpawnCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -33,7 +32,7 @@ public class SpawnCommand extends Command {
|
||||
}
|
||||
// If a persons name was passed in, you must be A. the console, or B have permissions
|
||||
if (args.size() == 1) {
|
||||
if (player != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(player, "multiverse.world.spawn.other", true)) {
|
||||
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.world.spawn.other", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport another player to spawn. (multiverse.world.spawn.other)");
|
||||
return;
|
||||
}
|
||||
@ -50,7 +49,7 @@ public class SpawnCommand extends Command {
|
||||
sender.sendMessage(args.get(0) + " is not logged on right now!");
|
||||
}
|
||||
} else {
|
||||
if (player != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(player, "multiverse.world.spawn.self", true)) {
|
||||
if (player != null && !this.plugin.getPermissions().hasPermission(player, "multiverse.world.spawn.self", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport yourself to spawn. (multiverse.world.spawn.self)");
|
||||
return;
|
||||
}
|
||||
|
@ -12,9 +12,8 @@ import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.utils.Destination;
|
||||
import com.onarandombox.utils.DestinationType;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class TeleportCommand extends Command {
|
||||
public class TeleportCommand extends MultiverseCommand {
|
||||
private MVTeleport playerTeleporter;
|
||||
|
||||
public TeleportCommand(MultiverseCore plugin) {
|
||||
@ -43,7 +42,7 @@ public class TeleportCommand extends Command {
|
||||
String worldName;
|
||||
|
||||
if (args.size() == 2) {
|
||||
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, "multiverse.world.tp.other", true)) {
|
||||
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.world.tp.other", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport another player. (multiverse.world.tp.other)");
|
||||
return;
|
||||
}
|
||||
@ -56,7 +55,7 @@ public class TeleportCommand extends Command {
|
||||
|
||||
} else {
|
||||
worldName = args.get(0);
|
||||
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().hasPermission(sender, "multiverse.world.tp.self", true)) {
|
||||
if (teleporter != null && !this.plugin.getPermissions().hasPermission(sender, "multiverse.world.tp.self", true)) {
|
||||
sender.sendMessage("You don't have permission to teleport yourself between worlds. (multiverse.world.tp.self)");
|
||||
return;
|
||||
}
|
||||
@ -70,20 +69,20 @@ public class TeleportCommand extends Command {
|
||||
}
|
||||
|
||||
Destination d = Destination.parseDestination(worldName, (MultiverseCore) this.plugin);
|
||||
if (!(d.getType() == DestinationType.World) || !((MultiverseCore) this.plugin).isMVWorld(d.getName())) {
|
||||
if (!(d.getType() == DestinationType.World) || !this.plugin.isMVWorld(d.getName())) {
|
||||
sender.sendMessage("Multiverse does not know about this world: " + worldName);
|
||||
return;
|
||||
}
|
||||
MVWorld world = ((MultiverseCore) this.plugin).getMVWorld(d.getName());
|
||||
MVWorld world = this.plugin.getMVWorld(d.getName());
|
||||
|
||||
if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().canEnterWorld(teleporter, world)) {
|
||||
if (teleporter != null && !this.plugin.getPermissions().canEnterWorld(teleporter, world)) {
|
||||
if (teleportee.equals(teleporter)) {
|
||||
teleporter.sendMessage("Doesn't look like you're allowed to go " + ChatColor.RED + "there...");
|
||||
} else {
|
||||
teleporter.sendMessage("Doesn't look like you're allowed to send " + ChatColor.GOLD + teleportee.getName() + ChatColor.WHITE + " to " + ChatColor.RED + "there...");
|
||||
}
|
||||
return;
|
||||
} else if (teleporter != null && !((MultiverseCore) this.plugin).getPermissions().canTravelFromWorld(teleporter, world)) {
|
||||
} else if (teleporter != null && !this.plugin.getPermissions().canTravelFromWorld(teleporter, world)) {
|
||||
if (teleportee.equals(teleporter)) {
|
||||
teleporter.sendMessage("DOH! Doesn't look like you can get to " + ChatColor.RED + d.getName() + " from " + ChatColor.GREEN + teleporter.getWorld().getName());
|
||||
} else {
|
||||
|
@ -6,9 +6,8 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class UnloadCommand extends Command {
|
||||
public class UnloadCommand extends MultiverseCommand {
|
||||
|
||||
public UnloadCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -25,7 +24,7 @@ public class UnloadCommand extends Command {
|
||||
|
||||
@Override
|
||||
public void runCommand(CommandSender sender, List<String> args) {
|
||||
if (((MultiverseCore) this.plugin).unloadWorld(args.get(0))) {
|
||||
if (this.plugin.unloadWorld(args.get(0))) {
|
||||
sender.sendMessage("World Unloaded!");
|
||||
} else {
|
||||
sender.sendMessage("Error trying to unload world!");
|
||||
|
@ -4,16 +4,13 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.onarandombox.MultiverseCore.MVWorld;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.pneumaticraft.commandhandler.Command;
|
||||
|
||||
public class WhoCommand extends Command {
|
||||
public class WhoCommand extends MultiverseCommand {
|
||||
|
||||
public WhoCommand(MultiverseCore plugin) {
|
||||
super(plugin);
|
||||
@ -38,22 +35,22 @@ public class WhoCommand extends Command {
|
||||
List<MVWorld> worlds = new ArrayList<MVWorld>();
|
||||
|
||||
if (args.size() > 0) {
|
||||
if (((MultiverseCore) this.plugin).isMVWorld(args.get(0))) {
|
||||
worlds.add(((MultiverseCore) this.plugin).getMVWorld(args.get(0)));
|
||||
if (this.plugin.isMVWorld(args.get(0))) {
|
||||
worlds.add(this.plugin.getMVWorld(args.get(0)));
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.RED + "World does not exist");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
worlds = new ArrayList<MVWorld>(((MultiverseCore) this.plugin).getMVWorlds());
|
||||
worlds = new ArrayList<MVWorld>(this.plugin.getMVWorlds());
|
||||
}
|
||||
|
||||
for (MVWorld world : worlds) {
|
||||
if (!(((MultiverseCore) this.plugin).isMVWorld(world.getName()))) {
|
||||
if (!(this.plugin.isMVWorld(world.getName()))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (p != null && (!((MultiverseCore) this.plugin).getPermissions().canEnterWorld(p, world))) {
|
||||
if (p != null && (!this.plugin.getPermissions().canEnterWorld(p, world))) {
|
||||
continue;
|
||||
}
|
||||
List<Player> players = world.getCBWorld().getPlayers();
|
||||
|
Loading…
Reference in New Issue
Block a user