v0.4
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="WINDOWS-1252" standalone="no"?>
|
||||
<jardesc>
|
||||
<jar path="C:/Users/Tom/Desktop/MC Servers/plugins/Metropolis-0.4.jar"/>
|
||||
<jar path="C:/Users/Tom/Desktop/MC Servers/City/plugins/Metropolis.jar"/>
|
||||
<options buildIfNeeded="true" compress="true" descriptionLocation="/Metropolis/Plugin.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
|
||||
<storedRefactorings deprecationInfo="true" structuralOnly="false"/>
|
||||
<selectedProjects/>
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.majinnaibu.bukkit.plugins.metropolis;
|
||||
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@@ -44,6 +46,15 @@ public class Cuboid implements Comparable<Cuboid> {
|
||||
this.maxZ = max.getBlockZ();
|
||||
}
|
||||
|
||||
public Cuboid() {
|
||||
this.minX = 0;
|
||||
this.minY = 0;
|
||||
this.minZ = 0;
|
||||
this.maxX = 0;
|
||||
this.maxY = 0;
|
||||
this.maxZ = 0;
|
||||
}
|
||||
|
||||
public BlockVector getMin(){
|
||||
return new BlockVector(minX, minY, minZ);
|
||||
}
|
||||
@@ -74,18 +85,33 @@ public class Cuboid implements Comparable<Cuboid> {
|
||||
}
|
||||
}
|
||||
|
||||
public static int compareBlockVectors(BlockVector min, BlockVector otherMin){
|
||||
if(min.getBlockX() < otherMin.getBlockX()){
|
||||
return -1;
|
||||
}else if(min.getBlockX() > otherMin.getBlockX()){
|
||||
public static int compareBlockVectors(BlockVector v1, BlockVector v2){
|
||||
Logger log = Logger.getLogger("Minecraft");
|
||||
|
||||
if(v1 == null){
|
||||
if(v2 == null){
|
||||
log.info("in Cuboid.compareBlockVectors v1 and v2 are null");
|
||||
return 0;
|
||||
}else{
|
||||
log.info("in Cubiod.compareBlockVectors v1 is null");
|
||||
return -1;
|
||||
}
|
||||
}else if(v2 == null){
|
||||
log.info("in Cubiod.compareBlockVectors v2 is null");
|
||||
return 1;
|
||||
}else if(min.getBlockZ() < otherMin.getBlockZ()){
|
||||
}
|
||||
log.info(String.format("v1.x: %d, v1.y: %d, v1.z: %d, v2.x: %d, v2.y: %d, v2.z: %d", v1.getBlockX(), v1.getBlockY(), v1.getBlockZ(), v2.getBlockX(), v2.getBlockY(), v2.getBlockZ()));
|
||||
if(v1.getBlockX() < v2.getBlockX()){
|
||||
return -1;
|
||||
}else if(min.getBlockZ() > otherMin.getBlockZ()){
|
||||
}else if(v1.getBlockX() > v2.getBlockX()){
|
||||
return 1;
|
||||
}else if(min.getBlockY() < otherMin.getBlockY()){
|
||||
}else if(v1.getBlockZ() < v2.getBlockZ()){
|
||||
return -1;
|
||||
}else if(min.getBlockY() > otherMin.getBlockY()){
|
||||
}else if(v1.getBlockZ() > v2.getBlockZ()){
|
||||
return 1;
|
||||
}else if(v1.getBlockY() < v2.getBlockY()){
|
||||
return -1;
|
||||
}else if(v1.getBlockY() > v2.getBlockY()){
|
||||
return 1;
|
||||
}else{
|
||||
return 0;
|
||||
@@ -103,4 +129,21 @@ public class Cuboid implements Comparable<Cuboid> {
|
||||
public Cuboid inset(int x, int y, int z){
|
||||
return new Cuboid(this.minX + x, this.minY, this.minZ + z, this.maxX - x, this.maxY, this.maxZ - z);
|
||||
}
|
||||
|
||||
public int getVolume() {
|
||||
return (this.maxX - this.minX) * (this.maxY - this.minY) * (this.maxZ - this.minZ);
|
||||
}
|
||||
public int getMinX(){return minX;}
|
||||
public void setMinX(int minX){this.minX = minX;}
|
||||
public int getMinY(){return minY;}
|
||||
public void setMinY(int minY){this.minY = minY;}
|
||||
public int getMinZ(){return minZ;}
|
||||
public void setMinZ(int minZ){this.minZ = minZ;}
|
||||
public int getMaxX(){return maxX;}
|
||||
public void setMaxX(int maxX){this.maxX = maxX;}
|
||||
public int getMaxY(){return maxY;}
|
||||
public void setMaxY(int maxY){this.maxY = maxY;}
|
||||
public int getMaxZ(){return maxZ;}
|
||||
public void setMaxZ(int maxZ){this.maxZ = maxZ;}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,16 +14,19 @@ public class LoginListener implements Listener {
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@EventHandler(priority=EventPriority.MONITOR)
|
||||
public void onPlayerLogin(PlayerLoginEvent event){
|
||||
MetropolisPlugin.log.info("Metropolis: player login");
|
||||
Player player = event.getPlayer();
|
||||
if(player == null){
|
||||
return;
|
||||
}
|
||||
|
||||
_plugin.getPlayerHome(player);
|
||||
PlayerHome home = _plugin.getPlayerHome(player);
|
||||
if(home == null || home.getCuboid() == null || home.getCuboid().getVolume() == 0){
|
||||
MetropolisPlugin.log.info(String.format("Metropolis: Unable to get or create home for player %s", player.getName()));
|
||||
}
|
||||
|
||||
Cuboid cuboid = home.getCuboid();
|
||||
player.sendMessage(String.format("Metropolis: Welcome %s your home is between (%d, %d, %d) and (%d, %d, %d)", player.getName(), cuboid.getMinX(), cuboid.getMinY(), cuboid.getMinZ(), cuboid.getMaxX(), cuboid.getMaxY(), cuboid.getMaxZ()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.majinnaibu.bukkit.plugins.metropolis;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.configuration.Configuration;
|
||||
@@ -15,8 +18,8 @@ import org.bukkit.plugin.PluginDescriptionFile;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.majinnaibu.bukkit.plugins.metropolis.commands.MetropolisHomeGenerateCommand;
|
||||
import com.majinnaibu.bukkit.plugins.metropolis.commands.MetropolisHomeListCommand;
|
||||
import com.sk89q.worldedit.BlockVector;
|
||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||
import com.sk89q.worldguard.domains.DefaultDomain;
|
||||
import com.sk89q.worldguard.protection.managers.RegionManager;
|
||||
@@ -28,7 +31,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
public PluginDescriptionFile pdf = null;
|
||||
public WorldGuardPlugin worldGuard = null;
|
||||
public WorldEditPlugin worldEdit = null;
|
||||
//public WorldEditPlugin worldEdit = null;
|
||||
public World world = null;
|
||||
public RegionManager regionManager = null;
|
||||
|
||||
@@ -36,7 +39,7 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
private LoginListener _loginListener = null;
|
||||
|
||||
int size = 0;
|
||||
int size = 1;
|
||||
|
||||
int plotSizeX = 24;
|
||||
int plotSizeZ = 24;
|
||||
@@ -66,9 +69,9 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
roadLevel = config.getInt("road.level");
|
||||
roadMaterial = config.getInt("road.material");
|
||||
worldName =config.getString("worldname");
|
||||
|
||||
saveConfig();
|
||||
|
||||
log.info(String.format("Metropolis: world name is %s", worldName));
|
||||
|
||||
Plugin plugin = getServer().getPluginManager().getPlugin("WorldGuard");
|
||||
if(plugin == null || !(plugin instanceof WorldGuardPlugin)){
|
||||
@@ -77,20 +80,21 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
worldGuard = (WorldGuardPlugin) plugin;
|
||||
|
||||
/*
|
||||
plugin = getServer().getPluginManager().getPlugin("WorldEdit");
|
||||
if(plugin == null || !(plugin instanceof WorldEditPlugin)){
|
||||
throw new RuntimeException("WorldEdit must be loaded first");
|
||||
}
|
||||
worldEdit = (WorldEditPlugin) plugin;
|
||||
*/
|
||||
|
||||
world = getServer().getWorld(worldName);
|
||||
// for(World world: getServer().getWorlds()){
|
||||
// log.info(String.format("name: %s", world.getName()));
|
||||
// }
|
||||
|
||||
regionManager = worldGuard.getRegionManager(world);
|
||||
|
||||
_occupiedHomes = new ArrayList<PlayerHome>();
|
||||
|
||||
fillOccupiedHomes();
|
||||
|
||||
|
||||
ProtectedRegion cityRegion = regionManager.getRegion("City");
|
||||
if(cityRegion == null){
|
||||
cityRegion = new ProtectedCuboidRegion("City", getPlotMin(0, 0), this.getPlotMax(0, 0));
|
||||
@@ -101,34 +105,19 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
//setupDatabase();
|
||||
|
||||
_occupiedHomes = new ArrayList<PlayerHome>();
|
||||
fillOccupiedHomes();
|
||||
|
||||
if(_loginListener == null){
|
||||
_loginListener = new LoginListener(this);
|
||||
}
|
||||
|
||||
Map<String, ProtectedRegion> regions = regionManager.getRegions();
|
||||
|
||||
for(ProtectedRegion region: regions.values()){
|
||||
if(region.getId().startsWith("h_")){
|
||||
setHomeOccupied(region.getId().substring(2), region.getMinimumPoint(), region.getMaximumPoint());
|
||||
}
|
||||
}
|
||||
|
||||
log.info(String.format("%s enabled", pdf.getFullName()));
|
||||
|
||||
|
||||
getCommand("metropolis-home-generate").setExecutor(new MetropolisHomeGenerateCommand(this));
|
||||
|
||||
|
||||
/*
|
||||
Set<String>strings = config.getKeys(true);
|
||||
log.info(String.valueOf(strings.size()));
|
||||
for(String str : strings){
|
||||
log.info(str);
|
||||
}
|
||||
*/
|
||||
|
||||
getCommand("metropolis-home-list").setExecutor(new MetropolisHomeListCommand(this));
|
||||
}
|
||||
/*
|
||||
|
||||
private void setupDatabase() {
|
||||
try{
|
||||
getDatabase().find(PlayerHome.class).findRowCount();
|
||||
@@ -137,17 +126,36 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
installDDL();
|
||||
}
|
||||
}
|
||||
/**/
|
||||
|
||||
private void fillOccupiedHomes() {
|
||||
_occupiedHomes = new ArrayList<PlayerHome>();
|
||||
for(ProtectedRegion region : regionManager.getRegions().values()){
|
||||
if(region instanceof ProtectedCuboidRegion && region.getId().startsWith("h_")){
|
||||
ProtectedCuboidRegion cuboidRegion = (ProtectedCuboidRegion) region;
|
||||
_occupiedHomes.add(new PlayerHome(cuboidRegion));
|
||||
PlayerHome home = new PlayerHome(cuboidRegion);
|
||||
_occupiedHomes.add(home);
|
||||
/*
|
||||
if(getDatabase().find(PlayerHome.class).where().eq("regionName", home.getRegionName()).findRowCount() == 0){
|
||||
getDatabase().insert(home);
|
||||
}
|
||||
/**/
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for(PlayerHome home : getDatabase().find(PlayerHome.class).findList()){
|
||||
_occupiedHomes.add(home);
|
||||
}
|
||||
/**/
|
||||
|
||||
Map<String, ProtectedRegion> map = regionManager.getRegions();
|
||||
for(String regionId : map.keySet()){
|
||||
//log.info(String.format("key: %s, id: %s", regionId, map.get(regionId).getId()));
|
||||
}
|
||||
|
||||
|
||||
log.info(String.format("Metropolis: %d occupied homes", _occupiedHomes.size()));
|
||||
|
||||
Collections.sort(_occupiedHomes);
|
||||
}
|
||||
|
||||
@@ -156,25 +164,26 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
|
||||
String regionName = "h_" + player.getName();
|
||||
ProtectedRegion homeRegion = regionManager.getRegion(regionName);
|
||||
|
||||
|
||||
log.info(homeRegion == null? "null" : homeRegion.toString());
|
||||
if(homeRegion == null){
|
||||
log.info(String.format("Creating home for player %s", player.getName()));
|
||||
home = generateHome(player.getName());
|
||||
}
|
||||
|
||||
return home;
|
||||
}
|
||||
|
||||
/*
|
||||
@Override
|
||||
public List<Class<?>> getDatabaseClasses(){
|
||||
List<Class<?>> list = new ArrayList<Class<?>>();
|
||||
|
||||
list.add(PlayerHome.class);
|
||||
list.add(Cuboid.class);
|
||||
|
||||
return list;
|
||||
}
|
||||
/**/
|
||||
|
||||
private void createRoads(Cuboid plotCuboid) {
|
||||
if(roadWidth>0){
|
||||
@@ -234,28 +243,84 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
}
|
||||
|
||||
private Cuboid findNextUnownedHomeRegion() {
|
||||
if(size <= 2){size=3;}
|
||||
int homeIndex = 0;
|
||||
int rowMin = -size/2;
|
||||
int rowMax = size/2;
|
||||
int colMin = -size/2;
|
||||
int colMax = size/2;
|
||||
|
||||
log.info(String.format("size: %d, rowMin: %d, rowMax: %d, colMin: %d, colMax: %d", size, rowMin, rowMax, colMin, colMax));
|
||||
|
||||
int row = rowMin;
|
||||
int col = colMin;
|
||||
|
||||
if(_occupiedHomes.size() == 0){return new Cuboid(getPlotMin(row, col), getPlotMax(row, col));}
|
||||
|
||||
PlayerHome home = _occupiedHomes.get(homeIndex);
|
||||
|
||||
for(col=colMin; col <= colMax; col++){
|
||||
for(row=rowMin; row<= rowMax; row++){
|
||||
if(row != 0 || col != 0){
|
||||
log.info(String.format("row: %d, col: %d", row, col));
|
||||
if(home == null){
|
||||
return new Cuboid(getPlotMin(row, col), getPlotMax(row, col));
|
||||
}
|
||||
else if(Cuboid.isBlockLessThan(getPlotMin(row, col), home.getPlotMin(roadWidth))){
|
||||
return new Cuboid(getPlotMin(row, col), getPlotMax(row, col));
|
||||
}else{
|
||||
homeIndex++;
|
||||
if(homeIndex < _occupiedHomes.size()){
|
||||
home = _occupiedHomes.get(homeIndex);
|
||||
}else{
|
||||
home = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
expandCityRegion();
|
||||
return new Cuboid(getPlotMin(-size/2, -size/2), getPlotMax(-size/2, -size/2));
|
||||
|
||||
/*
|
||||
log.info(String.valueOf(size));
|
||||
int homeIndex = 0;
|
||||
if(_occupiedHomes.size() == 0){
|
||||
log.info("_occupiedHomes.size is 0");
|
||||
if(size < 1){
|
||||
size=1;
|
||||
}
|
||||
|
||||
expandCityRegion();
|
||||
|
||||
log.info(String.format("row: %d, col: %d", -1, -1));
|
||||
return new Cuboid(getPlotMin(-1, -1), getPlotMax(-1, -1));
|
||||
|
||||
}
|
||||
|
||||
PlayerHome home = _occupiedHomes.get(homeIndex);
|
||||
|
||||
for(int row = -size/2; row<=size/2; row++){
|
||||
for(int col = -size/2; col <= size/2; col++){
|
||||
int row=0;
|
||||
int col=0;
|
||||
log.info(String.format("row-min: %d, row-max: %d, col-min: %d, col-max: %d", -size/2, size/2, -size/2, size/2));
|
||||
for(row = -size/2; row<=size/2; row++){
|
||||
for(col = -size/2; col <= size/2; col++){
|
||||
log.info(String.format(
|
||||
"checking row: %d, col: %d, homeIndex: %d, home is %s",
|
||||
row,
|
||||
col,
|
||||
homeIndex,
|
||||
home==null?"null":"not null"));
|
||||
if(home == null){
|
||||
log.info("home is null");
|
||||
expandCityRegion();
|
||||
log.info(String.format("row: %d, col: %d", row, col));
|
||||
return new Cuboid(getPlotMin(row, col), getPlotMax(row, col));
|
||||
}else if(Cuboid.isBlockLessThan(getPlotMin(row, col), home.getCuboid().getMin())){
|
||||
log.info("Cuboid.isBlockLessThan(getPlotMin(row, col), home.getCuboid().getMin())");
|
||||
log.info(String.format("row: %d, col: %d", row, col));
|
||||
return new Cuboid(getPlotMin(row, col), getPlotMax(row, col));
|
||||
}else{
|
||||
log.info("else");
|
||||
homeIndex++;
|
||||
if(homeIndex < _occupiedHomes.size()){
|
||||
home = _occupiedHomes.get(homeIndex);
|
||||
@@ -266,19 +331,30 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
size++;
|
||||
return new Cuboid(getPlotMin(-size/2, -size/2), getPlotMax(-size/2, -size/2));
|
||||
size+=2;
|
||||
|
||||
log.info(String.format("row: %d, col: %d", row, col));
|
||||
return new Cuboid(getPlotMin(row, col), getPlotMax(row, col));
|
||||
//log.info(String.format("row: %d, col: %d", -size/2, -size/2));
|
||||
//return new Cuboid(getPlotMin(-size/2, -size/2), getPlotMax(-size/2, -size/2));
|
||||
/**/
|
||||
}
|
||||
|
||||
private void expandCityRegion() {
|
||||
size+=2;
|
||||
ProtectedRegion cityRegion = regionManager.getRegion("City");
|
||||
if(cityRegion instanceof ProtectedCuboidRegion){
|
||||
ProtectedCuboidRegion region = (ProtectedCuboidRegion)cityRegion;
|
||||
BlockVector min = region.getMinimumPoint();
|
||||
BlockVector max = region.getMaximumPoint();
|
||||
|
||||
min = new BlockVector(min.getBlockX() - plotSizeX, min.getBlockY(), min.getBlockZ() - plotSizeZ);
|
||||
max = new BlockVector(max.getBlockX() + plotSizeX, max.getBlockY(), max.getBlockZ() + plotSizeZ);
|
||||
BlockVector min;
|
||||
BlockVector max;
|
||||
|
||||
//min = region.getMinimumPoint();
|
||||
//max = region.getMaximumPoint();
|
||||
//min = new BlockVector(min.getBlockX() - plotSizeX, min.getBlockY(), min.getBlockZ() - plotSizeZ);
|
||||
//max = new BlockVector(max.getBlockX() + plotSizeX, max.getBlockY(), max.getBlockZ() + plotSizeZ);
|
||||
min = getPlotMin(-size/2, -size/2);
|
||||
max = getPlotMax(size/2, size/2);
|
||||
|
||||
region.setMinimumPoint(min);
|
||||
region.setMaximumPoint(max);
|
||||
@@ -312,23 +388,38 @@ public class MetropolisPlugin extends JavaPlugin {
|
||||
return null;
|
||||
}
|
||||
|
||||
public PlayerHome generateHome(String string) {
|
||||
public PlayerHome generateHome(String playerName) {
|
||||
log.info(String.format("Generating home for %s", playerName));
|
||||
Cuboid plotCuboid = null;
|
||||
Cuboid homeCuboid = null;
|
||||
ProtectedRegion homeRegion = null;
|
||||
String regionName = "h_" + string;
|
||||
String regionName = "h_" + playerName;
|
||||
|
||||
plotCuboid = findNextUnownedHomeRegion();
|
||||
homeCuboid = plotCuboid.inset(roadWidth/2, roadWidth/2);
|
||||
homeRegion = new ProtectedCuboidRegion(regionName, homeCuboid.getMin(), homeCuboid.getMax());
|
||||
DefaultDomain d = homeRegion.getOwners();
|
||||
d.addPlayer(string);
|
||||
d.addPlayer(playerName);
|
||||
homeRegion.setPriority(1);
|
||||
regionManager.addRegion(homeRegion);
|
||||
try {
|
||||
regionManager.save();
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
setHomeOccupied(playerName, homeRegion.getMinimumPoint(), homeRegion.getMaximumPoint());
|
||||
|
||||
createRoads(plotCuboid);
|
||||
|
||||
log.info(String.format("Done generating home for %s", playerName));
|
||||
|
||||
return new PlayerHome(homeRegion);
|
||||
}
|
||||
|
||||
public List<PlayerHome> getCityBlocks() {
|
||||
return Collections.unmodifiableList(_occupiedHomes);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,13 +22,19 @@ public class PlayerHome implements Comparable<PlayerHome>{
|
||||
@NotNull
|
||||
private Cuboid cuboid;
|
||||
|
||||
@NotNull
|
||||
private String regionName;
|
||||
|
||||
public PlayerHome(String owner, BlockVector min, BlockVector max) {
|
||||
cuboid = new Cuboid(min, max);
|
||||
playerName = owner;
|
||||
this.cuboid = new Cuboid(min, max);
|
||||
this.playerName = owner;
|
||||
this.regionName = "h_" + owner;
|
||||
}
|
||||
|
||||
public PlayerHome() {
|
||||
// TODO Auto-generated constructor stub
|
||||
this.cuboid = new Cuboid();
|
||||
this.playerName = "";
|
||||
this.regionName = "";
|
||||
}
|
||||
|
||||
public PlayerHome(ProtectedRegion homeRegion){
|
||||
@@ -62,6 +68,9 @@ public class PlayerHome implements Comparable<PlayerHome>{
|
||||
public Cuboid getCuboid(){return this.cuboid;}
|
||||
public void setCuboid(Cuboid cuboid){this.cuboid = cuboid;}
|
||||
|
||||
public String getRegionName(){return this.regionName;}
|
||||
public void setRegionName(String regionName){this.regionName = regionName;}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object other) {
|
||||
if(!(other instanceof PlayerHome)){
|
||||
@@ -85,4 +94,17 @@ public class PlayerHome implements Comparable<PlayerHome>{
|
||||
public int compareTo(PlayerHome another) {
|
||||
return cuboid.compareTo(another.cuboid);
|
||||
}
|
||||
|
||||
public BlockVector getPlotMin(int roadWidth) {
|
||||
return new BlockVector(this.cuboid.minX - roadWidth/2, this.cuboid.minY, this.cuboid.minZ - roadWidth/2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
sb.append(String.format("{PlayerHome "));
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class MetropolisHomeGenerateCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
if(player != null){
|
||||
if(player.hasPermission("metropolis.generate")){
|
||||
if(!player.hasPermission("metropolis.generate")){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.majinnaibu.bukkit.plugins.metropolis.commands;
|
||||
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandExecutor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.majinnaibu.bukkit.plugins.metropolis.MetropolisPlugin;
|
||||
import com.majinnaibu.bukkit.plugins.metropolis.PlayerHome;
|
||||
|
||||
public class MetropolisHomeListCommand implements CommandExecutor {
|
||||
private MetropolisPlugin _plugin;
|
||||
|
||||
public MetropolisHomeListCommand(MetropolisPlugin plugin){
|
||||
_plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
for(PlayerHome cityBlock : _plugin.getCityBlocks()){
|
||||
sender.sendMessage(String.format("%s", cityBlock.toString()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,14 @@
|
||||
name: Metropolis
|
||||
main: com.majinnaibu.bukkit.plugins.metropolis.MetropolisPlugin
|
||||
depend: [WorldEdit, WorldGuard]
|
||||
version: 0.3
|
||||
version: 0.4
|
||||
database: false
|
||||
commands:
|
||||
metropolis-home-generate:
|
||||
description: This command generates a home for a user as if they'd just logged in.
|
||||
permission: metropolis.generate
|
||||
usage: /metropolis-home-generate <playername>
|
||||
metropolis-home-list:
|
||||
description: This lists the regions managed by Metropolis
|
||||
permission: metropolis.list
|
||||
usage: /metropolis-home-list
|
||||
Reference in New Issue
Block a user