mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
Should fix #233
This commit is contained in:
parent
fffead4a16
commit
b6d86ec1e1
@ -60,14 +60,37 @@ public class SetOwner extends SubCommand {
|
|||||||
MainUtil.sendMessage(plr, C.NEED_USER);
|
MainUtil.sendMessage(plr, C.NEED_USER);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final String world = loc.getWorld();
|
|
||||||
final PlotId bot = MainUtil.getBottomPlot(plot).id;
|
final PlotId bot = MainUtil.getBottomPlot(plot).id;
|
||||||
final PlotId top = MainUtil.getTopPlot(plot).id;
|
final PlotId top = MainUtil.getTopPlot(plot).id;
|
||||||
final ArrayList<PlotId> plots = MainUtil.getPlotSelectionIds(bot, top);
|
final ArrayList<PlotId> plots = MainUtil.getPlotSelectionIds(bot, top);
|
||||||
|
|
||||||
|
PlotPlayer other = UUIDHandler.getPlayer(args[0]);
|
||||||
|
if (other == null) {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
|
MainUtil.sendMessage(plr, C.INVALID_PLAYER);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
|
int size = plots.size();
|
||||||
|
final int currentPlots = MainUtil.getPlayerPlotCount(loc.getWorld(), other) + size;
|
||||||
|
if (currentPlots > MainUtil.getAllowedPlots(other)) {
|
||||||
|
sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!plot.isOwner(plr.getUUID())) {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
final String world = loc.getWorld();
|
||||||
for (final PlotId id : plots) {
|
for (final PlotId id : plots) {
|
||||||
final Plot current = PlotSquared.getPlots(world).get(id);
|
final Plot current = PlotSquared.getPlots(world).get(id);
|
||||||
final UUID uuid = getUUID(args[0]);
|
final UUID uuid = getUUID(args[0]);
|
||||||
@ -81,6 +104,9 @@ public class SetOwner extends SubCommand {
|
|||||||
}
|
}
|
||||||
MainUtil.setSign(args[0], plot);
|
MainUtil.setSign(args[0], plot);
|
||||||
MainUtil.sendMessage(plr, C.SET_OWNER);
|
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||||
|
if (other != null) {
|
||||||
|
MainUtil.sendMessage(other, C.NOW_OWNER, plot.world + ";" + plot.id);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -213,6 +213,7 @@ public enum C {
|
|||||||
NO_PERMISSION("$2You are lacking the permission node: $1%s"),
|
NO_PERMISSION("$2You are lacking the permission node: $1%s"),
|
||||||
NO_PLOT_PERMS("$2You must be the plot owner to perform this action"),
|
NO_PLOT_PERMS("$2You must be the plot owner to perform this action"),
|
||||||
CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots."),
|
CANT_CLAIM_MORE_PLOTS("$2You can't claim more plots."),
|
||||||
|
CANT_TRANSFER_MORE_PLOTS("$2You can't send more plots to that user"),
|
||||||
CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once"),
|
CANT_CLAIM_MORE_PLOTS_NUM("$2You can't claim more than $1%s $2plots at once"),
|
||||||
YOU_BE_DENIED("$2You are not allowed to enter this plot"),
|
YOU_BE_DENIED("$2You are not allowed to enter this plot"),
|
||||||
NO_PERM_MERGE("$2You are not the owner of the plot: $1%plot%"),
|
NO_PERM_MERGE("$2You are not the owner of the plot: $1%plot%"),
|
||||||
@ -437,6 +438,7 @@ public enum C {
|
|||||||
* Set Owner
|
* Set Owner
|
||||||
*/
|
*/
|
||||||
SET_OWNER("$4You successfully set the plot owner"),
|
SET_OWNER("$4You successfully set the plot owner"),
|
||||||
|
NOW_OWNER("$4You are now owner of plot %s"),
|
||||||
/*
|
/*
|
||||||
* Signs
|
* Signs
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user