cluster create feedback

This commit is contained in:
boy0001 2015-01-31 19:22:53 +11:00
parent 27da7070b2
commit debc7f6ab3
3 changed files with 30 additions and 0 deletions

View File

@ -101,7 +101,9 @@ public class Cluster extends SubCommand {
return false;
}
if (args.length != 4) {
PlotId id = ClusterManager.estimatePlotId(plr.getLocation());
PlayerFunctions.sendMessage(plr, C.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>");
PlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id);
return false;
}
// check pos1 / pos2

View File

@ -60,6 +60,7 @@ public enum C {
CLUSTER_REGENERATED("&6Successfully started cluster regeneration"),
CLUSTER_TELEPORTING("&6Teleporting..."),
CLUSTER_INFO("&6Current cluster: &7%id%\n&6Name: &7%name%\n&6Owner: &7%owner%\n&6Size: &7%size%\n&6Rights: &7%rights%"),
CLUSTER_CURRENT_PLOTID("&6Current plot: &7%s"),
/*
* Border
*/

View File

@ -215,6 +215,33 @@ public class ClusterManager {
return null;
}
public static PlotId estimatePlotId(Location loc) {
PlotId a = new PlotId(0, 0);
PlotId b = new PlotId(1, 1);
int xw;
int zw;
String world = loc.getWorld().getName();
PlotWorld plotworld = PlotMain.getWorldSettings(world);
if (plotworld == null) {
xw = 39;
zw = 39;
}
else {
PlotManager manager = PlotMain.getPlotManager(world);
Location al = manager.getPlotBottomLocAbs(plotworld, a);
Location bl = manager.getPlotBottomLocAbs(plotworld, b);
xw = bl.getBlockX() - al.getBlockX();
zw = bl.getBlockZ() - al.getBlockZ();
}
int x = loc.getBlockX();
int z = loc.getBlockZ();
return new PlotId((x/xw) + 1,(z/zw) + 1);
}
public static void regenCluster(final PlotCluster cluster) {
if (regenerating.contains(cluster.world + ":" + cluster.getName())) {
return;