Added debug command to generate n test plots
This commit is contained in:
@@ -10,12 +10,15 @@ import org.bukkit.Material;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.Configuration;
|
import org.bukkit.configuration.Configuration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginDescriptionFile;
|
import org.bukkit.plugin.PluginDescriptionFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisDebugGenerateTestHomesCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisFlagResetCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisFlagResetCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeGenerateCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeGenerateCommand;
|
||||||
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeListCommand;
|
import com.majinnaibu.bukkitplugins.metropolis.commands.MetropolisHomeListCommand;
|
||||||
@@ -131,6 +134,9 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
getCommand("metropolis-home-list").setExecutor(new MetropolisHomeListCommand(this));
|
getCommand("metropolis-home-list").setExecutor(new MetropolisHomeListCommand(this));
|
||||||
getCommand("metropolis-flag-reset").setExecutor(new MetropolisFlagResetCommand(this));
|
getCommand("metropolis-flag-reset").setExecutor(new MetropolisFlagResetCommand(this));
|
||||||
getCommand("metropolis-plot-reserve").setExecutor(new MetropolisPlotReserveCommand(this));
|
getCommand("metropolis-plot-reserve").setExecutor(new MetropolisPlotReserveCommand(this));
|
||||||
|
if(DEBUG){
|
||||||
|
getCommand("gentesthomes").setExecutor(new MetropolisDebugGenerateTestHomesCommand(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fillOccupiedPlots(){
|
private void fillOccupiedPlots(){
|
||||||
@@ -151,6 +157,11 @@ public class MetropolisPlugin extends JavaPlugin {
|
|||||||
size=calculateCitySize();
|
size=calculateCitySize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||||
|
return super.onCommand(sender, command, label, args);
|
||||||
|
}
|
||||||
|
|
||||||
public PlayerHome getPlayerHome(Player player) {
|
public PlayerHome getPlayerHome(Player player) {
|
||||||
PlayerHome home = null;
|
PlayerHome home = null;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.majinnaibu.bukkitplugins.metropolis.commands;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
import com.majinnaibu.bukkitplugins.metropolis.MetropolisPlugin;
|
||||||
|
|
||||||
|
public class MetropolisDebugGenerateTestHomesCommand implements CommandExecutor {
|
||||||
|
|
||||||
|
private MetropolisPlugin _plugin;
|
||||||
|
|
||||||
|
public MetropolisDebugGenerateTestHomesCommand(MetropolisPlugin plugin) {
|
||||||
|
_plugin = plugin;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
try{
|
||||||
|
int numHomes = Integer.parseInt(args[0]);
|
||||||
|
for(int i=1; i<= numHomes; i++){
|
||||||
|
_plugin.generateHome(String.format("test%d", i));
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}catch(NumberFormatException ex){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -19,25 +19,40 @@ public class MetropolisPlotReserveCommand implements CommandExecutor {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||||
|
int minX = 0;
|
||||||
|
int minY = 0;
|
||||||
|
int minZ = 0;
|
||||||
|
int maxX = 0;
|
||||||
|
int maxY = 0;
|
||||||
|
int maxZ = 0;
|
||||||
Cuboid cuboid = new Cuboid();
|
Cuboid cuboid = new Cuboid();
|
||||||
|
|
||||||
if(sender instanceof Player && args.length == 1){
|
if(sender instanceof Player && args.length == 1){
|
||||||
Selection selection = _plugin.worldEdit.getSelection((Player) sender);
|
Selection selection = _plugin.worldEdit.getSelection((Player) sender);
|
||||||
cuboid = new Cuboid(selection);
|
cuboid = new Cuboid(selection);
|
||||||
}else if(args.length == 6){
|
}else if(args.length == 6){
|
||||||
int minX = Integer.parseInt(args[1]);
|
try{
|
||||||
int minY = Integer.parseInt(args[2]);
|
minX = Integer.parseInt(args[1]);
|
||||||
int minZ = Integer.parseInt(args[3]);
|
minY = Integer.parseInt(args[2]);
|
||||||
int maxX = Integer.parseInt(args[4]);
|
minZ = Integer.parseInt(args[3]);
|
||||||
int maxY = Integer.parseInt(args[5]);
|
maxX = Integer.parseInt(args[4]);
|
||||||
int maxZ = Integer.parseInt(args[6]);
|
maxY = Integer.parseInt(args[5]);
|
||||||
|
maxZ = Integer.parseInt(args[6]);
|
||||||
|
}catch(NumberFormatException ex){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
cuboid = new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
|
cuboid = new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}else if(args.length == 4){
|
}else if(args.length == 4){
|
||||||
int minX = Integer.parseInt(args[1]);
|
try{
|
||||||
int minY = 0;
|
minX = Integer.parseInt(args[1]);
|
||||||
int minZ = Integer.parseInt(args[2]);
|
minY = 0;
|
||||||
int maxX = Integer.parseInt(args[3]);
|
minZ = Integer.parseInt(args[2]);
|
||||||
int maxY = _plugin.getWorld().getMaxHeight();
|
maxX = Integer.parseInt(args[3]);
|
||||||
int maxZ = Integer.parseInt(args[4]);
|
maxY = _plugin.getWorld().getMaxHeight();
|
||||||
|
maxZ = Integer.parseInt(args[4]);
|
||||||
|
}catch(NumberFormatException ex){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
cuboid = new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
|
cuboid = new Cuboid(minX, minY, minZ, maxX, maxY, maxZ);
|
||||||
}else{
|
}else{
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ road:
|
|||||||
clearSpaceAbove: 66
|
clearSpaceAbove: 66
|
||||||
level: 62
|
level: 62
|
||||||
material: 4
|
material: 4
|
||||||
|
spawn:
|
||||||
|
generate: true
|
||||||
|
setAsWorldSpawn: true
|
||||||
|
material: 2
|
||||||
worldname: world
|
worldname: world
|
||||||
|
|||||||
@@ -21,3 +21,7 @@ commands:
|
|||||||
description: This command reserves a plot so it won't be assigned as a home.
|
description: This command reserves a plot so it won't be assigned as a home.
|
||||||
permission: metropolis.plot.reserve
|
permission: metropolis.plot.reserve
|
||||||
usage: /metropolis-plot-reserve <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
|
usage: /metropolis-plot-reserve <minX> <minY> <minZ> <maxX> <maxY> <maxZ>
|
||||||
|
gentesthomes:
|
||||||
|
description:
|
||||||
|
permission: metropolis.debug
|
||||||
|
usage: /gentesthomes
|
||||||
Reference in New Issue
Block a user