more bug fixes

This commit is contained in:
boy0001 2014-09-23 15:28:26 +10:00
parent c3e271b22b
commit 0efb9d62ca
4 changed files with 13 additions and 5 deletions

View File

@ -156,6 +156,7 @@ public enum C {
/* /*
Claiming Claiming
*/ */
PLOT_NOT_CLAIMED("&cCannot claim plot"),
PLOT_IS_CLAIMED("&cThis plot is already claimed"), PLOT_IS_CLAIMED("&cThis plot is already claimed"),
CLAIMED("&6You successfully claimed the plot"), CLAIMED("&6You successfully claimed the plot"),
/* /*

View File

@ -7,7 +7,7 @@ public class Flag {
private String key; private String key;
private String value; private String value;
public Flag(String key, String value) { public Flag(String key, String value) {
if (!StringUtils.isAlphanumeric(key) || !StringUtils.isAlphanumeric(ChatColor.stripColor(value))) if (!StringUtils.isAlphanumeric(key) || !StringUtils.isAlphanumeric(ChatColor.stripColor(value).replace(" ", "")))
throw new IllegalArgumentException("Flag must be alphanumerical"); throw new IllegalArgumentException("Flag must be alphanumerical");
if (key.length()>16) if (key.length()>16)
throw new IllegalArgumentException("Key must be <= 16 characters"); throw new IllegalArgumentException("Key must be <= 16 characters");

View File

@ -67,8 +67,8 @@ public class Auto extends SubCommand {
id = new PlotId(x,z); id = new PlotId(x,z);
if(PlotHelper.getPlot(world, id).owner == null) { if(PlotHelper.getPlot(world, id).owner == null) {
Plot plot = PlotHelper.getPlot(world, id); Plot plot = PlotHelper.getPlot(world, id);
Claim.claimPlot(plr, plot, true); boolean result = Claim.claimPlot(plr, plot, true);
br = true; br = result;
} }
if(z < q && (z - x) < q) { if(z < q && (z - x) < q) {
z++; z++;

View File

@ -11,6 +11,7 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.*; import com.intellectualcrafters.plot.*;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent; import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -40,8 +41,13 @@ public class Claim extends SubCommand{
PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED); PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED);
return false; return false;
} }
claimPlot(plr, plot, false); boolean result = claimPlot(plr, plot, false);
return true; if (!result) {
PlayerFunctions.sendMessage(plr, C.PLOT_NOT_CLAIMED);
return false;
}
return true;
} }
@ -61,6 +67,7 @@ public class Claim extends SubCommand{
SchematicHandler.Schematic schematic = handler.getSchematic(world.SCHEMATIC_FILE); SchematicHandler.Schematic schematic = handler.getSchematic(world.SCHEMATIC_FILE);
handler.paste(player.getLocation(), schematic, plot); handler.paste(player.getLocation(), schematic, plot);
} }
plot.settings.setFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS);
} }
return event.isCancelled(); return event.isCancelled();
} }