mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-13 10:34:09 +01:00
cluster create feedback
This commit is contained in:
parent
27da7070b2
commit
debc7f6ab3
@ -101,7 +101,9 @@ public class Cluster extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (args.length != 4) {
|
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.COMMAND_SYNTAX, "/plot cluster create <name> <id-bot> <id-top>");
|
||||||
|
PlayerFunctions.sendMessage(plr, C.CLUSTER_CURRENT_PLOTID, "" + id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// check pos1 / pos2
|
// check pos1 / pos2
|
||||||
|
@ -60,6 +60,7 @@ public enum C {
|
|||||||
CLUSTER_REGENERATED("&6Successfully started cluster regeneration"),
|
CLUSTER_REGENERATED("&6Successfully started cluster regeneration"),
|
||||||
CLUSTER_TELEPORTING("&6Teleporting..."),
|
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_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
|
* Border
|
||||||
*/
|
*/
|
||||||
|
@ -215,6 +215,33 @@ public class ClusterManager {
|
|||||||
return null;
|
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) {
|
public static void regenCluster(final PlotCluster cluster) {
|
||||||
if (regenerating.contains(cluster.world + ":" + cluster.getName())) {
|
if (regenerating.contains(cluster.world + ":" + cluster.getName())) {
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user