mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Add spout tests
This commit is contained in:
parent
f6299c60a0
commit
e36210b99a
12
pom.xml
12
pom.xml
@ -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>
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
@ -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.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user