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
*/
PLOT_NOT_CLAIMED("&cCannot claim plot"),
PLOT_IS_CLAIMED("&cThis plot is already claimed"),
CLAIMED("&6You successfully claimed the plot"),
/*

View File

@ -7,7 +7,7 @@ public class Flag {
private String key;
private 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");
if (key.length()>16)
throw new IllegalArgumentException("Key must be <= 16 characters");

View File

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

View File

@ -11,6 +11,7 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.*;
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@ -40,8 +41,13 @@ public class Claim extends SubCommand{
PlayerFunctions.sendMessage(plr, C.PLOT_IS_CLAIMED);
return false;
}
claimPlot(plr, plot, false);
return true;
boolean result = claimPlot(plr, plot, false);
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);
handler.paste(player.getLocation(), schematic, plot);
}
plot.settings.setFlags(PlotMain.getWorldSettings(player.getWorld()).DEFAULT_FLAGS);
}
return event.isCancelled();
}