Add spout tests

This commit is contained in:
Eric Stokes 2011-08-13 14:58:43 -06:00
parent f6299c60a0
commit e36210b99a
5 changed files with 86 additions and 2 deletions

12
pom.xml
View File

@ -16,6 +16,10 @@
<id>OnARandomBox</id>
<url>http://repo.onarandombox.com/artifactory/repo</url>
</repository>
<repository>
<id>GetSpout</id>
<url>http://repo.getspout.org/</url>
</repository>
</repositories>
<build>
@ -99,7 +103,13 @@
<scope>compile</scope>
</dependency>
<!-- Bukkit Dependency -->
<!-- Start of Spout -->
<dependency>
<groupId>org.getspout</groupId>
<artifactId>spoutapi</artifactId>
<version>dev-SNAPSHOT</version>
</dependency>
<!-- End of Spout -->
<!-- Start of Economy Dependencies -->
<dependency>
<groupId>cosine.boseconomy</groupId>

View File

@ -29,6 +29,7 @@ import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.config.Configuration;
import org.getspout.spoutapi.SpoutManager;
import com.fernferret.allpay.AllPay;
import com.fernferret.allpay.GenericBank;
@ -52,6 +53,7 @@ import com.onarandombox.MultiverseCore.commands.RemoveCommand;
import com.onarandombox.MultiverseCore.commands.SetSpawnCommand;
import com.onarandombox.MultiverseCore.commands.SleepCommand;
import com.onarandombox.MultiverseCore.commands.SpawnCommand;
import com.onarandombox.MultiverseCore.commands.SpoutCommand;
import com.onarandombox.MultiverseCore.commands.TeleportCommand;
import com.onarandombox.MultiverseCore.commands.UnloadCommand;
import com.onarandombox.MultiverseCore.commands.VersionCommand;
@ -115,6 +117,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
protected MVConfigMigrator migrator = new MVCoreConfigMigrator(this);
protected int pluginCount;
private DestinationFactory destFactory;
private SpoutManager spoutManager;
@Override
public void onLoad() {
@ -266,6 +269,7 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
// Misc Commands
this.commandHandler.registerCommand(new EnvironmentCommand(this));
this.commandHandler.registerCommand(new SleepCommand(this));
this.commandHandler.registerCommand(new SpoutCommand(this));
}
@ -814,4 +818,12 @@ public class MultiverseCore extends JavaPlugin implements LoggablePlugin {
this.log(Level.SEVERE, e.getMessage());
}
}
public void setSpout(SpoutManager spoutManager) {
this.spoutManager = spoutManager;
}
public SpoutManager getSpout() {
return this.spoutManager;
}
}

View File

@ -42,7 +42,6 @@ public class CoordCommand extends MultiverseCommand {
}
MVWorld mvworld = this.plugin.getMVWorld(world.getName());
// TODO: Convert to fancy stuff
p.sendMessage(ChatColor.AQUA + "--- Location Information ---");
p.sendMessage(ChatColor.AQUA + "World: " + ChatColor.WHITE + world.getName());

View File

@ -0,0 +1,58 @@
package com.onarandombox.MultiverseCore.commands;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.permissions.PermissionDefault;
import org.getspout.spoutapi.SpoutManager;
import org.getspout.spoutapi.gui.GenericButton;
import org.getspout.spoutapi.gui.GenericPopup;
import org.getspout.spoutapi.gui.InGameHUD;
import org.getspout.spoutapi.gui.InGameScreen;
import org.getspout.spoutapi.gui.ItemWidget;
import org.getspout.spoutapi.gui.PopupScreen;
import org.getspout.spoutapi.player.SpoutPlayer;
import com.onarandombox.MultiverseCore.MultiverseCore;
public class SpoutCommand extends MultiverseCommand {
public SpoutCommand(MultiverseCore plugin) {
super(plugin);
this.setName("Edit World with Spout");
this.setCommandUsage("/mv spout");
this.setArgRange(0, 0);
this.addKey("mv spout");
this.setPermission("multiverse.core.spout", "Edit a world with spout.", PermissionDefault.OP);
this.addCommandExample("/mv spout");
}
@Override
public void runCommand(CommandSender sender, List<String> args) {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.RED + "This command must be run as a player!");
return;
}
if (plugin.getSpout() == null) {
sender.sendMessage(ChatColor.RED + "You need spout installed on this server to use it with Multiverse!");
return;
}
SpoutPlayer p = (SpoutPlayer) sender;
if (!p.isSpoutCraftEnabled()) {
sender.sendMessage(ChatColor.RED + p.getName() + "You need to be using the Spoutcraft client to run this command!");
return;
}
PopupScreen pop = new GenericPopup();
GenericButton button = new GenericButton("Fish");
button.setX(50);
button.setY(50);
button.setWidth(100);
button.setHeight(40);
pop.attachWidget(this.plugin, button);
sender.sendMessage(ChatColor.GREEN + "YAY!");
p.getMainScreen().attachPopupScreen(pop);
}
}

View File

@ -6,6 +6,7 @@ import java.util.logging.Level;
import org.bukkit.event.server.PluginDisableEvent;
import org.bukkit.event.server.PluginEnableEvent;
import org.bukkit.event.server.ServerListener;
import org.getspout.spoutapi.SpoutManager;
import com.fernferret.allpay.AllPay;
import com.nijikokun.bukkit.Permissions.Permissions;
@ -41,6 +42,10 @@ public class MVPluginListener extends ServerListener {
this.plugin.log(Level.WARNING, "I just disabled the old version of Multiverse for you. You should remove the JAR now, your configs have been migrated.");
}
}
if (event.getPlugin().getDescription().getName().equals("Spout")) {
this.plugin.setSpout(SpoutManager.getInstance());
this.plugin.log(Level.INFO, "Spout integration enabled.");
}
}
/**