Fixed plot deletion

This commit is contained in:
Sauilitired 2014-10-21 07:35:15 +02:00
parent 66d596b993
commit 264baf10e3
4 changed files with 328 additions and 412 deletions

File diff suppressed because it is too large Load Diff

View File

@ -339,6 +339,9 @@ public enum C {
} }
} }
public static class Potato {
}
/** /**
* Get the default string * Get the default string
* *

View File

@ -9,9 +9,7 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import net.milkbowl.vault.economy.Economy; import net.milkbowl.vault.economy.Economy;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.block.Biome; import org.bukkit.block.Biome;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -19,7 +17,6 @@ import org.bukkit.block.BlockState;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.io.File; import java.io.File;
import java.util.ArrayList; import java.util.ArrayList;
@ -701,6 +698,7 @@ public class PlotHelper {
refreshPlotChunks(world, plot); refreshPlotChunks(world, plot);
// SetBlockFast.update(requester); // SetBlockFast.update(requester);
} }
return; return;
} }

View File

@ -53,6 +53,7 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.*; import java.util.*;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.concurrent.TimeUnit;
/** /**
* @awesome @author Citymonstret, Empire92 PlotMain class. * @awesome @author Citymonstret, Empire92 PlotMain class.
@ -456,8 +457,8 @@ public class PlotMain extends JavaPlugin {
if (lastPlayed == 0) { if (lastPlayed == 0) {
continue; continue;
} }
int days = (int) (lastPlayed / (1000 * 60 * 60 * 24)); long compared = System.currentTimeMillis() - lastPlayed;
if (days >= Settings.AUTO_CLEAR_DAYS) { if (TimeUnit.MILLISECONDS.toDays(compared) >= Settings.AUTO_CLEAR_DAYS) {
PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id); PlotDeleteEvent event = new PlotDeleteEvent(world, plot.id);
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
@ -1282,21 +1283,16 @@ public class PlotMain extends JavaPlugin {
@Override @Override
public String parseValue(String value) { public String parseValue(String value) {
switch (value) { switch (value) {
case "true": case "true":
return "true"; case "1":
case "yes": case "yes":
return "true"; return "true";
case "1": case "false":
return "true"; case "off":
case "false": case "0":
return "false"; return "false";
case "no": default:
return "false"; return null;
case "0":
return "false";
default:
return null;
} }
} }
@ -1313,26 +1309,20 @@ public class PlotMain extends JavaPlugin {
@Override @Override
public String parseValue(String value) { public String parseValue(String value) {
switch (value) { switch (value) {
case "creative": case "creative":
return "creative"; case "c":
case "survival": case "1":
return "survival"; return "creative";
case "adventure": case "survival":
return "adventure"; case "s":
case "c": case "0":
return "creative"; return "survival";
case "s": case "adventure":
return "survival"; case "a":
case "a": case "2":
return "adventure"; return "adventure";
case "1": default:
return "creative"; return null;
case "0":
return "survival";
case "2":
return "adventure";
default:
return null;
} }
} }
@ -1364,16 +1354,12 @@ public class PlotMain extends JavaPlugin {
public String parseValue(String value) { public String parseValue(String value) {
switch (value) { switch (value) {
case "rain": case "rain":
return "rain";
case "storm": case "storm":
return "rain";
case "on": case "on":
return "rain"; return "rain";
case "clear": case "clear":
return "clear";
case "sun":
return "clear";
case "off": case "off":
case "sun":
return "clear"; return "clear";
default: default:
return null; return null;