Fixed error message /transferclaim offline player.

This commit is contained in:
ryanhamshire 2015-04-23 21:11:19 -07:00
parent baf29ae38f
commit bdf720281e
2 changed files with 8 additions and 6 deletions

View File

@ -31,6 +31,7 @@ import java.util.logging.Logger;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import me.ryanhamshire.GriefPrevention.DataStore.NoTransferException;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
@ -1033,10 +1034,10 @@ public class GriefPrevention extends JavaPlugin
{ {
this.dataStore.changeClaimOwner(claim, newOwnerID); this.dataStore.changeClaimOwner(claim, newOwnerID);
} }
catch(Exception e) catch(NoTransferException e)
{ {
GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferTopLevel); GriefPrevention.sendMessage(player, TextMode.Instr, Messages.TransferTopLevel);
return true; return true;
} }
//confirm //confirm

View File

@ -292,15 +292,16 @@ public class PlayerData
int totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID); int totalBlocks = this.accruedClaimBlocks + this.getBonusClaimBlocks() + GriefPrevention.instance.dataStore.getGroupBonusBlocks(this.playerID);
if(totalBlocks < totalClaimsArea) if(totalBlocks < totalClaimsArea)
{ {
Player player = GriefPrevention.instance.getServer().getPlayer(this.playerID); OfflinePlayer player = GriefPrevention.instance.getServer().getOfflinePlayer(this.playerID);
GriefPrevention.AddLogEntry(player.getName() + "has more claimed land than blocks available. Adding blocks to fix.", CustomLogEntryTypes.Debug); GriefPrevention.AddLogEntry(player.getName() + "has more claimed land than blocks available. Adding blocks to fix.", CustomLogEntryTypes.Debug, true);
GriefPrevention.AddLogEntry("Total blocks: " + totalBlocks + " Total claimed area: " + totalClaimsArea, CustomLogEntryTypes.Debug); GriefPrevention.AddLogEntry("Total blocks: " + totalBlocks + " Total claimed area: " + totalClaimsArea, CustomLogEntryTypes.Debug, true);
for(Claim claim : this.claims) for(Claim claim : this.claims)
{ {
GriefPrevention.AddLogEntry( GriefPrevention.AddLogEntry(
GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()) + " // " GriefPrevention.getfriendlyLocationString(claim.getLesserBoundaryCorner()) + " // "
+ GriefPrevention.getfriendlyLocationString(claim.getGreaterBoundaryCorner()) + " = " + GriefPrevention.getfriendlyLocationString(claim.getGreaterBoundaryCorner()) + " = "
+ claim.getArea()); + claim.getArea()
, CustomLogEntryTypes.Debug, true);
} }
//try to fix it by adding to accrued blocks //try to fix it by adding to accrued blocks