Fixed setowner

This commit is contained in:
boy0001 2015-01-30 10:57:29 +11:00
parent 4475290443
commit 3bd7f6a3a9
2 changed files with 9 additions and 9 deletions

View File

@ -8,7 +8,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<artifactId>PlotSquared</artifactId> <artifactId>PlotSquared</artifactId>
<version>2.6.0</version> <version>2.6.1</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -39,7 +39,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
public class SetOwner extends SubCommand { public class SetOwner extends SubCommand {
public SetOwner() { public SetOwner() {
super("setowner", "plots.admin.command.setowner", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS, true); super("setowner", "plots.set.owner", "Set the plot owner", "setowner {player}", "so", CommandCategory.ACTIONS, true);
} }
/* /*
@ -57,19 +57,21 @@ public class SetOwner extends SubCommand {
Plot plot = PlayerFunctions.getCurrentPlot(plr); Plot plot = PlayerFunctions.getCurrentPlot(plr);
if (plot == null || plot.owner == null) { if (plot == null || plot.owner == null) {
PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT); PlayerFunctions.sendMessage(plr, C.NOT_IN_PLOT);
return true; return false;
} }
if (args.length < 1) { if (args.length < 1) {
PlayerFunctions.sendMessage(plr, C.NEED_USER); PlayerFunctions.sendMessage(plr, C.NEED_USER);
return true; return false;
} }
if (!plot.owner.equals(UUIDHandler.getUUID(plr))) {
PlayerFunctions.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
return false;
}
final World world = plr.getWorld(); final World world = plr.getWorld();
final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id; final PlotId bot = PlayerFunctions.getBottomPlot(world, plot).id;
final PlotId top = PlayerFunctions.getTopPlot(world, plot).id; final PlotId top = PlayerFunctions.getTopPlot(world, plot).id;
final ArrayList<PlotId> plots = PlayerFunctions.getPlotSelectionIds(bot, top); final ArrayList<PlotId> plots = PlayerFunctions.getPlotSelectionIds(bot, top);
for (final PlotId id : plots) { for (final PlotId id : plots) {
final Plot current = PlotMain.getPlots(world).get(id); final Plot current = PlotMain.getPlots(world).get(id);
@ -89,9 +91,7 @@ public class SetOwner extends SubCommand {
} }
} }
PlotHelper.setSign(world, args[0], plot); PlotHelper.setSign(world, args[0], plot);
PlayerFunctions.sendMessage(plr, C.SET_OWNER); PlayerFunctions.sendMessage(plr, C.SET_OWNER);
return true; return true;
} }
} }