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()) {
@ -1283,20 +1284,15 @@ public class PlotMain extends JavaPlugin {
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":
return "true";
case "false": case "false":
return "false"; case "off":
case "no":
return "false";
case "0": case "0":
return "false"; return "false";
default: default:
return null; return null;
} }
} }
@ -1314,21 +1310,15 @@ public class PlotMain extends JavaPlugin {
public String parseValue(String value) { public String parseValue(String value) {
switch (value) { switch (value) {
case "creative": case "creative":
return "creative";
case "survival":
return "survival";
case "adventure":
return "adventure";
case "c": case "c":
return "creative";
case "s":
return "survival";
case "a":
return "adventure";
case "1": case "1":
return "creative"; return "creative";
case "survival":
case "s":
case "0": case "0":
return "survival"; return "survival";
case "adventure":
case "a":
case "2": case "2":
return "adventure"; return "adventure";
default: default:
@ -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;