mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
A whole load of fixes
This commit is contained in:
parent
c25eccf4a0
commit
75a5a76fe9
@ -40,6 +40,7 @@ public class ListTagBuilder {
|
|||||||
*
|
*
|
||||||
* @return a new builder
|
* @return a new builder
|
||||||
*/
|
*/
|
||||||
|
@SafeVarargs
|
||||||
public static <T extends Tag> ListTagBuilder createWith(final T... entries) {
|
public static <T extends Tag> ListTagBuilder createWith(final T... entries) {
|
||||||
checkNotNull(entries);
|
checkNotNull(entries);
|
||||||
|
|
||||||
|
@ -179,8 +179,8 @@ public final class NBTOutputStream implements Closeable {
|
|||||||
|
|
||||||
this.os.writeByte(NBTUtils.getTypeCode(clazz));
|
this.os.writeByte(NBTUtils.getTypeCode(clazz));
|
||||||
this.os.writeInt(size);
|
this.os.writeInt(size);
|
||||||
for (int i = 0; i < size; ++i) {
|
for (Tag tag1 : tags) {
|
||||||
writeTagPayload(tags.get(i));
|
writeTagPayload(tag1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,6 @@ public final class NBTUtils {
|
|||||||
* @param key the key to look for
|
* @param key the key to look for
|
||||||
* @param expected the expected NBT class type
|
* @param expected the expected NBT class type
|
||||||
* @return child tag
|
* @return child tag
|
||||||
* @throws InvalidFormatException
|
|
||||||
*/
|
*/
|
||||||
public static <T extends Tag> T getChildTag(final Map<String, Tag> items, final String key, final Class<T> expected) throws IllegalArgumentException {
|
public static <T extends Tag> T getChildTag(final Map<String, Tag> items, final String key, final Class<T> expected) throws IllegalArgumentException {
|
||||||
if (!items.containsKey(key)) {
|
if (!items.containsKey(key)) {
|
||||||
|
@ -247,7 +247,7 @@ public class CDL {
|
|||||||
if ((names == null) || (names.length() == 0)) {
|
if ((names == null) || (names.length() == 0)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
final StringBuffer sb = new StringBuffer();
|
final StringBuilder sb = new StringBuilder();
|
||||||
for (int i = 0; i < ja.length(); i += 1) {
|
for (int i = 0; i < ja.length(); i += 1) {
|
||||||
final JSONObject jo = ja.optJSONObject(i);
|
final JSONObject jo = ja.optJSONObject(i);
|
||||||
if (jo != null) {
|
if (jo != null) {
|
||||||
|
@ -27,7 +27,6 @@ import java.io.Writer;
|
|||||||
import java.lang.reflect.Array;
|
import java.lang.reflect.Array;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -145,9 +144,8 @@ public class JSONArray {
|
|||||||
public JSONArray(final Collection<Object> collection) {
|
public JSONArray(final Collection<Object> collection) {
|
||||||
this.myArrayList = new ArrayList<Object>();
|
this.myArrayList = new ArrayList<Object>();
|
||||||
if (collection != null) {
|
if (collection != null) {
|
||||||
final Iterator<Object> iter = collection.iterator();
|
for (Object aCollection : collection) {
|
||||||
while (iter.hasNext()) {
|
this.myArrayList.add(JSONObject.wrap(aCollection));
|
||||||
this.myArrayList.add(JSONObject.wrap(iter.next()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,7 +546,7 @@ public class JSONArray {
|
|||||||
* @throws JSONException if the value is not finite.
|
* @throws JSONException if the value is not finite.
|
||||||
*/
|
*/
|
||||||
public JSONArray put(final double value) throws JSONException {
|
public JSONArray put(final double value) throws JSONException {
|
||||||
final Double d = new Double(value);
|
final Double d = value;
|
||||||
JSONObject.testValidity(d);
|
JSONObject.testValidity(d);
|
||||||
this.put(d);
|
this.put(d);
|
||||||
return this;
|
return this;
|
||||||
|
@ -164,9 +164,7 @@ public class JSONObject {
|
|||||||
public JSONObject(final Map<String, Object> map) {
|
public JSONObject(final Map<String, Object> map) {
|
||||||
this.map = new HashMap<String, Object>();
|
this.map = new HashMap<String, Object>();
|
||||||
if (map != null) {
|
if (map != null) {
|
||||||
final Iterator<Entry<String, Object>> i = map.entrySet().iterator();
|
for (Entry<String, Object> entry : map.entrySet()) {
|
||||||
while (i.hasNext()) {
|
|
||||||
final Entry<String, Object> entry = i.next();
|
|
||||||
final Object value = entry.getValue();
|
final Object value = entry.getValue();
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
this.map.put(entry.getKey(), wrap(value));
|
this.map.put(entry.getKey(), wrap(value));
|
||||||
@ -1319,9 +1317,7 @@ public class JSONObject {
|
|||||||
if (!set.equals(((JSONObject) other).keySet())) {
|
if (!set.equals(((JSONObject) other).keySet())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final Iterator<String> iterator = set.iterator();
|
for (String name : set) {
|
||||||
while (iterator.hasNext()) {
|
|
||||||
final String name = iterator.next();
|
|
||||||
final Object valueThis = this.get(name);
|
final Object valueThis = this.get(name);
|
||||||
final Object valueOther = ((JSONObject) other).get(name);
|
final Object valueOther = ((JSONObject) other).get(name);
|
||||||
if (valueThis instanceof JSONObject) {
|
if (valueThis instanceof JSONObject) {
|
||||||
@ -1485,8 +1481,12 @@ public class JSONObject {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected final Object clone() {
|
protected final Object clone() {
|
||||||
|
try {
|
||||||
|
return super.clone();
|
||||||
|
} catch (Exception e) {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A Null object is equal to the null value and to itself.
|
* A Null object is equal to the null value and to itself.
|
||||||
|
@ -38,6 +38,10 @@ import java.io.Writer;
|
|||||||
*/
|
*/
|
||||||
public class JSONWriter {
|
public class JSONWriter {
|
||||||
private static final int maxdepth = 200;
|
private static final int maxdepth = 200;
|
||||||
|
/**
|
||||||
|
* The writer that will receive the output.
|
||||||
|
*/
|
||||||
|
protected final Writer writer;
|
||||||
/**
|
/**
|
||||||
* The object/array stack.
|
* The object/array stack.
|
||||||
*/
|
*/
|
||||||
@ -51,10 +55,6 @@ public class JSONWriter {
|
|||||||
* 'o' (object).
|
* 'o' (object).
|
||||||
*/
|
*/
|
||||||
protected char mode;
|
protected char mode;
|
||||||
/**
|
|
||||||
* The writer that will receive the output.
|
|
||||||
*/
|
|
||||||
protected Writer writer;
|
|
||||||
/**
|
/**
|
||||||
* The comma flag determines if a comma should be output before the next
|
* The comma flag determines if a comma should be output before the next
|
||||||
* value.
|
* value.
|
||||||
|
@ -42,10 +42,8 @@ import com.intellectualcrafters.plot.uuid.PlotUUIDSaver;
|
|||||||
import com.intellectualcrafters.plot.uuid.UUIDSaver;
|
import com.intellectualcrafters.plot.uuid.UUIDSaver;
|
||||||
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
|
||||||
import me.confuser.barapi.BarAPI;
|
import me.confuser.barapi.BarAPI;
|
||||||
import net.milkbowl.vault.economy.Economy;
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
@ -80,6 +78,43 @@ public class PlotMain extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
public static final String ADMIN_PERMISSION =
|
public static final String ADMIN_PERMISSION =
|
||||||
"plots.admin";
|
"plots.admin";
|
||||||
|
/**
|
||||||
|
* Storage version
|
||||||
|
*/
|
||||||
|
public final static int storage_ver =
|
||||||
|
1;
|
||||||
|
/**
|
||||||
|
* Boolean Flags (material)
|
||||||
|
*/
|
||||||
|
public final static HashMap<Material, String> booleanFlags =
|
||||||
|
new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the material flags
|
||||||
|
*/
|
||||||
|
static {
|
||||||
|
booleanFlags.put(Material.WOODEN_DOOR, "wooden_door");
|
||||||
|
booleanFlags.put(Material.IRON_DOOR, "iron_door");
|
||||||
|
booleanFlags.put(Material.STONE_BUTTON, "stone_button");
|
||||||
|
booleanFlags.put(Material.WOOD_BUTTON, "wooden_button");
|
||||||
|
booleanFlags.put(Material.LEVER, "lever");
|
||||||
|
booleanFlags.put(Material.WOOD_PLATE, "wooden_plate");
|
||||||
|
booleanFlags.put(Material.STONE_PLATE, "stone_plate");
|
||||||
|
booleanFlags.put(Material.CHEST, "chest");
|
||||||
|
booleanFlags.put(Material.TRAPPED_CHEST, "trapped_chest");
|
||||||
|
booleanFlags.put(Material.TRAP_DOOR, "trap_door");
|
||||||
|
booleanFlags.put(Material.DISPENSER, "dispenser");
|
||||||
|
booleanFlags.put(Material.DROPPER, "dropper");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* All loaded plot worlds
|
||||||
|
*/
|
||||||
|
private final static HashMap<String, PlotWorld> worlds = new HashMap<>();
|
||||||
|
/**
|
||||||
|
* All world managers
|
||||||
|
*/
|
||||||
|
private final static HashMap<String, PlotManager> managers = new HashMap<>();
|
||||||
/**
|
/**
|
||||||
* settings.properties
|
* settings.properties
|
||||||
*/
|
*/
|
||||||
@ -96,11 +131,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* Contains storage options
|
* Contains storage options
|
||||||
*/
|
*/
|
||||||
public static YamlConfiguration storage;
|
public static YamlConfiguration storage;
|
||||||
/**
|
|
||||||
* Storage version
|
|
||||||
*/
|
|
||||||
public static int storage_ver =
|
|
||||||
1;
|
|
||||||
/**
|
/**
|
||||||
* MySQL Connection
|
* MySQL Connection
|
||||||
*/
|
*/
|
||||||
@ -135,30 +165,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
*/
|
*/
|
||||||
public static boolean useEconomy =
|
public static boolean useEconomy =
|
||||||
false;
|
false;
|
||||||
/**
|
|
||||||
* Boolean Flags (material)
|
|
||||||
*/
|
|
||||||
public static HashMap<Material, String> booleanFlags =
|
|
||||||
new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize the material flags
|
|
||||||
*/
|
|
||||||
static {
|
|
||||||
booleanFlags.put(Material.WOODEN_DOOR, "wooden_door");
|
|
||||||
booleanFlags.put(Material.IRON_DOOR, "iron_door");
|
|
||||||
booleanFlags.put(Material.STONE_BUTTON, "stone_button");
|
|
||||||
booleanFlags.put(Material.WOOD_BUTTON, "wooden_button");
|
|
||||||
booleanFlags.put(Material.LEVER, "lever");
|
|
||||||
booleanFlags.put(Material.WOOD_PLATE, "wooden_plate");
|
|
||||||
booleanFlags.put(Material.STONE_PLATE, "stone_plate");
|
|
||||||
booleanFlags.put(Material.CHEST, "chest");
|
|
||||||
booleanFlags.put(Material.TRAPPED_CHEST, "trapped_chest");
|
|
||||||
booleanFlags.put(Material.TRAP_DOOR, "trap_door");
|
|
||||||
booleanFlags.put(Material.DISPENSER, "dispenser");
|
|
||||||
booleanFlags.put(Material.DROPPER, "dropper");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The UUID Saver
|
* The UUID Saver
|
||||||
*/
|
*/
|
||||||
@ -172,14 +178,6 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* DO NOT USE EXCEPT FOR DATABASE PURPOSES
|
* DO NOT USE EXCEPT FOR DATABASE PURPOSES
|
||||||
*/
|
*/
|
||||||
private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots;
|
private static LinkedHashMap<String, HashMap<PlotId, Plot>> plots;
|
||||||
/**
|
|
||||||
* All loaded plot worlds
|
|
||||||
*/
|
|
||||||
private static HashMap<String, PlotWorld> worlds = new HashMap<>();
|
|
||||||
/**
|
|
||||||
* All world managers
|
|
||||||
*/
|
|
||||||
private static HashMap<String, PlotManager> managers = new HashMap<>();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for expired plots
|
* Check for expired plots
|
||||||
@ -202,12 +200,9 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* Check a range of permissions e.g. 'plots.plot.<0-100>'<br>
|
* Check a range of permissions e.g. 'plots.plot.<0-100>'<br>
|
||||||
* Returns highest integer in range.
|
* Returns highest integer in range.
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player to check
|
||||||
* to check
|
* @param stub to check
|
||||||
* @param stub
|
* @param range tp check
|
||||||
* to check
|
|
||||||
* @param range
|
|
||||||
* tp check
|
|
||||||
* @return permitted range
|
* @return permitted range
|
||||||
*/
|
*/
|
||||||
public static int hasPermissionRange(final Player player, final String stub, final int range) {
|
public static int hasPermissionRange(final Player player, final String stub, final int range) {
|
||||||
@ -230,10 +225,8 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* - Op has all permissions <br>
|
* - Op has all permissions <br>
|
||||||
* - checks for '*' nodes
|
* - checks for '*' nodes
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player to check
|
||||||
* to check
|
* @param perms to check
|
||||||
* @param perms
|
|
||||||
* to check
|
|
||||||
* @return true of player has permissions
|
* @return true of player has permissions
|
||||||
*/
|
*/
|
||||||
public static boolean hasPermissions(final Player player, final String[] perms) {
|
public static boolean hasPermissions(final Player player, final String[] perms) {
|
||||||
@ -266,6 +259,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the uuid saver
|
* Get the uuid saver
|
||||||
|
*
|
||||||
* @return uuid saver
|
* @return uuid saver
|
||||||
* @see com.intellectualcrafters.plot.uuid.UUIDSaver;
|
* @see com.intellectualcrafters.plot.uuid.UUIDSaver;
|
||||||
*/
|
*/
|
||||||
@ -288,10 +282,8 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* - Op has all permissions <br>
|
* - Op has all permissions <br>
|
||||||
* - checks for '*' nodes
|
* - checks for '*' nodes
|
||||||
*
|
*
|
||||||
* @param player
|
* @param player to check
|
||||||
* to check
|
* @param perm to check
|
||||||
* @param perm
|
|
||||||
* to check
|
|
||||||
* @return true if player has the permission
|
* @return true if player has the permission
|
||||||
*/
|
*/
|
||||||
public static boolean hasPermission(final Player player, final String perm) {
|
public static boolean hasPermission(final Player player, final String perm) {
|
||||||
@ -328,6 +320,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a sorted list of plots
|
* Get a sorted list of plots
|
||||||
|
*
|
||||||
* @return sorted list
|
* @return sorted list
|
||||||
*/
|
*/
|
||||||
public static LinkedHashSet<Plot> getPlotsSorted() {
|
public static LinkedHashSet<Plot> getPlotsSorted() {
|
||||||
@ -339,8 +332,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param player
|
* @param player player
|
||||||
* player
|
|
||||||
* @return Set Containing the players plots
|
* @return Set Containing the players plots
|
||||||
*/
|
*/
|
||||||
public static Set<Plot> getPlots(final Player player) {
|
public static Set<Plot> getPlots(final Player player) {
|
||||||
@ -390,8 +382,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world plot world
|
||||||
* plot world
|
|
||||||
* @return plots in world
|
* @return plots in world
|
||||||
*/
|
*/
|
||||||
public static HashMap<PlotId, Plot> getPlots(final World world) {
|
public static HashMap<PlotId, Plot> getPlots(final World world) {
|
||||||
@ -418,8 +409,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world plotworld(?)
|
||||||
* plotworld(?)
|
|
||||||
* @return true if the world is a plotworld
|
* @return true if the world is a plotworld
|
||||||
*/
|
*/
|
||||||
public static boolean isPlotWorld(final World world) {
|
public static boolean isPlotWorld(final World world) {
|
||||||
@ -427,8 +417,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world plotworld(?)
|
||||||
* plotworld(?)
|
|
||||||
* @return true if the world is a plotworld
|
* @return true if the world is a plotworld
|
||||||
*/
|
*/
|
||||||
public static boolean isPlotWorld(final String world) {
|
public static boolean isPlotWorld(final String world) {
|
||||||
@ -436,8 +425,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param world
|
* @param world World to get manager for
|
||||||
* World to get manager for
|
|
||||||
* @return manager for world
|
* @return manager for world
|
||||||
*/
|
*/
|
||||||
public static PlotManager getPlotManager(final World world) {
|
public static PlotManager getPlotManager(final World world) {
|
||||||
@ -491,6 +479,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a plot
|
* Remove a plot
|
||||||
|
*
|
||||||
* @param world The Plot World
|
* @param world The Plot World
|
||||||
* @param id The Plot ID
|
* @param id The Plot ID
|
||||||
* @param callEvent Whether or not to call the PlotDeleteEvent
|
* @param callEvent Whether or not to call the PlotDeleteEvent
|
||||||
@ -512,8 +501,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Replace the plot object with an updated version
|
* Replace the plot object with an updated version
|
||||||
*
|
*
|
||||||
* @param plot
|
* @param plot plot object
|
||||||
* plot object
|
|
||||||
*/
|
*/
|
||||||
public static void updatePlot(final Plot plot) {
|
public static void updatePlot(final Plot plot) {
|
||||||
final String world = plot.world;
|
final String world = plot.world;
|
||||||
@ -545,10 +533,8 @@ public class PlotMain extends JavaPlugin {
|
|||||||
* - Add new plots to the end.<br>
|
* - Add new plots to the end.<br>
|
||||||
* - The task then only needs to go through the first few plots
|
* - The task then only needs to go through the first few plots
|
||||||
*
|
*
|
||||||
* @param plugin
|
* @param plugin Plugin
|
||||||
* Plugin
|
* @param async Call async?
|
||||||
* @param async
|
|
||||||
* Call async?
|
|
||||||
*/
|
*/
|
||||||
private static void checkExpired(final JavaPlugin plugin, final boolean async) {
|
private static void checkExpired(final JavaPlugin plugin, final boolean async) {
|
||||||
if (async) {
|
if (async) {
|
||||||
@ -633,8 +619,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Send a message to the console.
|
* Send a message to the console.
|
||||||
*
|
*
|
||||||
* @param string
|
* @param string message
|
||||||
* message
|
|
||||||
*/
|
*/
|
||||||
public static void sendConsoleSenderMessage(final String string) {
|
public static void sendConsoleSenderMessage(final String string) {
|
||||||
if (getMain().getServer().getConsoleSender() == null) {
|
if (getMain().getServer().getConsoleSender() == null) {
|
||||||
@ -646,6 +631,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Teleport a player to a plot
|
* Teleport a player to a plot
|
||||||
|
*
|
||||||
* @param player Player to teleport
|
* @param player Player to teleport
|
||||||
* @param from Previous Location
|
* @param from Previous Location
|
||||||
* @param plot Plot to teleport to
|
* @param plot Plot to teleport to
|
||||||
@ -669,8 +655,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Send a message to the console
|
* Send a message to the console
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c message
|
||||||
* message
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public static void sendConsoleSenderMessage(final C c) {
|
public static void sendConsoleSenderMessage(final C c) {
|
||||||
@ -680,8 +665,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Broadcast publicly
|
* Broadcast publicly
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c message
|
||||||
* message
|
|
||||||
*/
|
*/
|
||||||
public static void Broadcast(final C c) {
|
public static void Broadcast(final C c) {
|
||||||
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + c.s()));
|
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + c.s()));
|
||||||
@ -699,8 +683,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
/**
|
/**
|
||||||
* Broadcast a message to all admins
|
* Broadcast a message to all admins
|
||||||
*
|
*
|
||||||
* @param c
|
* @param c message
|
||||||
* message
|
|
||||||
*/
|
*/
|
||||||
public static void BroadcastWithPerms(final C c) {
|
public static void BroadcastWithPerms(final C c) {
|
||||||
for (final Player player : Bukkit.getOnlinePlayers()) {
|
for (final Player player : Bukkit.getOnlinePlayers()) {
|
||||||
@ -713,6 +696,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload all translations
|
* Reload all translations
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public static void reloadTranslations() throws IOException {
|
public static void reloadTranslations() throws IOException {
|
||||||
@ -721,6 +705,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Ge the last played time
|
* Ge the last played time
|
||||||
|
*
|
||||||
* @param uuid UUID for the player
|
* @param uuid UUID for the player
|
||||||
* @return last play time as a long
|
* @return last play time as a long
|
||||||
*/
|
*/
|
||||||
@ -968,6 +953,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a plotworld config section
|
* Create a plotworld config section
|
||||||
|
*
|
||||||
* @param plotworld World to create the section for
|
* @param plotworld World to create the section for
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
@ -1299,6 +1285,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Add a Plot world
|
* Add a Plot world
|
||||||
|
*
|
||||||
* @param world World to add
|
* @param world World to add
|
||||||
* @param plotworld PlotWorld Object
|
* @param plotworld PlotWorld Object
|
||||||
* @param manager Plot Manager for the new world
|
* @param manager Plot Manager for the new world
|
||||||
@ -1313,6 +1300,7 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a plot world
|
* Remove a plot world
|
||||||
|
*
|
||||||
* @param world World to remove
|
* @param world World to remove
|
||||||
*/
|
*/
|
||||||
public static void removePlotWorld(final String world) {
|
public static void removePlotWorld(final String world) {
|
||||||
@ -1323,21 +1311,13 @@ public class PlotMain extends JavaPlugin {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all plots
|
* Get all plots
|
||||||
|
*
|
||||||
* @return All Plos in a hashmap (world, Hashmap contiang ids and objects))
|
* @return All Plos in a hashmap (world, Hashmap contiang ids and objects))
|
||||||
*/
|
*/
|
||||||
public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() {
|
public static HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() {
|
||||||
return plots;
|
return plots;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set all plots
|
|
||||||
*
|
|
||||||
* @param plots New Plot LinkedHashMap
|
|
||||||
*/
|
|
||||||
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
|
||||||
PlotMain.plots = plots;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set all plots
|
* Set all plots
|
||||||
*
|
*
|
||||||
@ -1348,6 +1328,15 @@ public class PlotMain extends JavaPlugin {
|
|||||||
// PlotMain.plots.putAll(plots);
|
// PlotMain.plots.putAll(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set all plots
|
||||||
|
*
|
||||||
|
* @param plots New Plot LinkedHashMap
|
||||||
|
*/
|
||||||
|
public static void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) {
|
||||||
|
PlotMain.plots = plots;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the PlotSquared World Generator
|
* Get the PlotSquared World Generator
|
||||||
*
|
*
|
||||||
|
@ -33,7 +33,7 @@ import org.bukkit.entity.Player;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("deprecated")
|
@SuppressWarnings("deprecation")
|
||||||
public class Denied extends SubCommand {
|
public class Denied extends SubCommand {
|
||||||
|
|
||||||
public Denied() {
|
public Denied() {
|
||||||
|
@ -53,7 +53,7 @@ public class Inbox extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Integer tier = null;
|
Integer tier;
|
||||||
final UUID uuid = plr.getUniqueId();
|
final UUID uuid = plr.getUniqueId();
|
||||||
if (PlotMain.hasPermission(plr, "plots.admin")) {
|
if (PlotMain.hasPermission(plr, "plots.admin")) {
|
||||||
tier = 0;
|
tier = 0;
|
||||||
@ -151,14 +151,13 @@ public class Inbox extends SubCommand {
|
|||||||
}
|
}
|
||||||
plot.settings.removeComments(comments);
|
plot.settings.removeComments(comments);
|
||||||
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
|
PlayerFunctions.sendMessage(plr, C.COMMENT_REMOVED, "all comments in that category");
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
final List<String> recipients = Arrays.asList(new String[]{"A", "O", "H", "T", "E"});
|
final List<String> recipients = Arrays.asList("A", "O", "H", "T", "E");
|
||||||
int count = 1;
|
int count = 1;
|
||||||
final StringBuilder message = new StringBuilder();
|
final StringBuilder message = new StringBuilder();
|
||||||
String prefix = "";
|
String prefix = "";
|
||||||
for (final PlotComment comment : comments) {
|
for (final PlotComment comment : comments) {
|
||||||
message.append(prefix + "[" + count + "]&6[&c" + recipients.get(tier2) + "&6] &7" + comment.senderName + "&f: " + comment.comment);
|
message.append(prefix).append("[").append(count).append("]&6[&c").append(recipients.get(tier2)).append("&6] &7").append(comment.senderName).append("&f: ").append(comment.comment);
|
||||||
prefix = "\n";
|
prefix = "\n";
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -103,16 +103,8 @@ public class Info extends SubCommand {
|
|||||||
|
|
||||||
// Wildcard player {added}
|
// Wildcard player {added}
|
||||||
{
|
{
|
||||||
if (plot.helpers == null) {
|
containsEveryone = plot.helpers != null && plot.helpers.contains(DBFunc.everyone);
|
||||||
containsEveryone = false;
|
trustedEveryone = plot.trusted != null && plot.trusted.contains(DBFunc.everyone);
|
||||||
} else {
|
|
||||||
containsEveryone = plot.helpers.contains(DBFunc.everyone);
|
|
||||||
}
|
|
||||||
if (plot.trusted == null) {
|
|
||||||
trustedEveryone = false;
|
|
||||||
} else {
|
|
||||||
trustedEveryone = plot.trusted.contains(DBFunc.everyone);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Unclaimed?
|
// Unclaimed?
|
||||||
@ -183,7 +175,7 @@ public class Info extends SubCommand {
|
|||||||
final String denied = getPlayerList(plot.denied);
|
final String denied = getPlayerList(plot.denied);
|
||||||
final String rating = String.format("%.1f", DBFunc.getRatings(plot));
|
final String rating = String.format("%.1f", DBFunc.getRatings(plot));
|
||||||
final String flags = "&6" + (StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), "&7, &6") : "none");
|
final String flags = "&6" + (StringUtils.join(plot.settings.getFlags(), "").length() > 0 ? StringUtils.join(plot.settings.getFlags(), "&7, &6") : "none");
|
||||||
final boolean build = player == null ? true : plot.hasRights(player);
|
final boolean build = player == null || plot.hasRights(player);
|
||||||
|
|
||||||
String owner = "none";
|
String owner = "none";
|
||||||
if (plot.owner != null) {
|
if (plot.owner != null) {
|
||||||
|
@ -49,7 +49,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
|
|||||||
public static final String
|
public static final String
|
||||||
MAIN_PERMISSION = "plots.use";
|
MAIN_PERMISSION = "plots.use";
|
||||||
|
|
||||||
private static SubCommand[] _subCommands =
|
private final static SubCommand[] _subCommands =
|
||||||
new SubCommand[]{
|
new SubCommand[]{
|
||||||
new Ban(), new Unban(),
|
new Ban(), new Unban(),
|
||||||
new OP(), new DEOP(),
|
new OP(), new DEOP(),
|
||||||
@ -71,7 +71,7 @@ public class MainCommand implements CommandExecutor, TabCompleter {
|
|||||||
new Comment(), new Database(),
|
new Comment(), new Database(),
|
||||||
new Swap(), new MusicSubcommand()};
|
new Swap(), new MusicSubcommand()};
|
||||||
|
|
||||||
public static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
|
public final static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
|
||||||
{
|
{
|
||||||
addAll(Arrays.asList(_subCommands));
|
addAll(Arrays.asList(_subCommands));
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ import java.util.ArrayList;
|
|||||||
*/
|
*/
|
||||||
public class Merge extends SubCommand {
|
public class Merge extends SubCommand {
|
||||||
|
|
||||||
public static String[] values = new String[]{"north", "east", "south", "west"};
|
public final static String[] values = new String[]{"north", "east", "south", "west"};
|
||||||
public static String[] aliases = new String[]{"n", "e", "s", "w"};
|
public final static String[] aliases = new String[]{"n", "e", "s", "w"};
|
||||||
|
|
||||||
public Merge() {
|
public Merge() {
|
||||||
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS, true);
|
super(Command.MERGE, "Merge the plot you are standing on with another plot.", "merge", CommandCategory.ACTIONS, true);
|
||||||
|
@ -53,8 +53,8 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public class Set extends SubCommand {
|
public class Set extends SubCommand {
|
||||||
|
|
||||||
public static String[] values = new String[]{"biome", "wall", "wall_filling", "floor", "alias", "home", "flag"};
|
public final static String[] values = new String[]{"biome", "wall", "wall_filling", "floor", "alias", "home", "flag"};
|
||||||
public static String[] aliases = new String[]{"b", "w", "wf", "f", "a", "h", "fl"};
|
public final static String[] aliases = new String[]{"b", "w", "wf", "f", "a", "h", "fl"};
|
||||||
|
|
||||||
public Set() {
|
public Set() {
|
||||||
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
|
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
|
||||||
|
@ -49,7 +49,7 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class Setup extends SubCommand implements Listener {
|
public class Setup extends SubCommand implements Listener {
|
||||||
|
|
||||||
public static Map<String, SetupObject> setupMap = new HashMap<>();
|
public final static Map<String, SetupObject> setupMap = new HashMap<>();
|
||||||
|
|
||||||
public Setup() {
|
public Setup() {
|
||||||
super("setup", "plots.admin", "Setup a PlotWorld", "setup {world} {generator}", "setup", CommandCategory.ACTIONS, false);
|
super("setup", "plots.admin", "Setup a PlotWorld", "setup {world} {generator}", "setup", CommandCategory.ACTIONS, false);
|
||||||
@ -208,12 +208,11 @@ public class Setup extends SubCommand implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private class SetupObject {
|
private class SetupObject {
|
||||||
String world;
|
final String world;
|
||||||
String plugin;
|
final String plugin;
|
||||||
|
final ConfigurationNode[] step;
|
||||||
int current = 0;
|
int current = 0;
|
||||||
|
|
||||||
ConfigurationNode[] step;
|
|
||||||
|
|
||||||
public SetupObject(final String world, final PlotWorld plotworld, final String plugin) {
|
public SetupObject(final String world, final PlotWorld plotworld, final String plugin) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.step = plotworld.getSettingNodes();
|
this.step = plotworld.getSettingNodes();
|
||||||
|
@ -60,7 +60,7 @@ public abstract class SubCommand {
|
|||||||
/**
|
/**
|
||||||
* Is this a player-online command?
|
* Is this a player-online command?
|
||||||
*/
|
*/
|
||||||
public boolean isPlayer;
|
public final boolean isPlayer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param cmd Command /plot {cmd} <-- That!
|
* @param cmd Command /plot {cmd} <-- That!
|
||||||
|
@ -33,7 +33,9 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Citymonstret on 2014-08-01.
|
* Created 2014-08-01 for PlotSquared
|
||||||
|
*
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class Swap extends SubCommand {
|
public class Swap extends SubCommand {
|
||||||
|
|
||||||
@ -76,6 +78,7 @@ public class Swap extends SubCommand {
|
|||||||
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
assert plot != null;
|
||||||
if (plot.id.equals(plotid)) {
|
if (plot.id.equals(plotid)) {
|
||||||
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
PlayerFunctions.sendMessage(plr, C.NOT_VALID_PLOT_ID);
|
||||||
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
PlayerFunctions.sendMessage(plr, C.SWAP_SYNTAX);
|
||||||
|
@ -382,7 +382,7 @@ public enum C {
|
|||||||
*
|
*
|
||||||
* @see com.intellectualsites.translation.TranslationLanguage
|
* @see com.intellectualsites.translation.TranslationLanguage
|
||||||
*/
|
*/
|
||||||
protected static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
|
protected final static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The TranslationManager
|
* The TranslationManager
|
||||||
|
@ -29,71 +29,58 @@ package com.intellectualcrafters.plot.config;
|
|||||||
*/
|
*/
|
||||||
public class Settings {
|
public class Settings {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default kill road mobs: true
|
||||||
|
*/
|
||||||
|
public final static boolean KILL_ROAD_MOBS_DEFAULT = true;
|
||||||
|
/**
|
||||||
|
* Default mob pathfinding: true
|
||||||
|
*/
|
||||||
|
public final static boolean MOB_PATHFINDING_DEFAULT = true;
|
||||||
/**
|
/**
|
||||||
* Teleport to path on login
|
* Teleport to path on login
|
||||||
*/
|
*/
|
||||||
public static boolean TELEPORT_ON_LOGIN = false;
|
public static boolean TELEPORT_ON_LOGIN = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mob Cap Enabled
|
* Mob Cap Enabled
|
||||||
*/
|
*/
|
||||||
public static boolean MOB_CAP_ENABLED = false;
|
public static boolean MOB_CAP_ENABLED = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Mob Cap
|
* The Mob Cap
|
||||||
*/
|
*/
|
||||||
public static int MOB_CAP = 20;
|
public static int MOB_CAP = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display titles
|
* Display titles
|
||||||
*/
|
*/
|
||||||
public static boolean TITLES = true;
|
public static boolean TITLES = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Schematic Save Path
|
* Schematic Save Path
|
||||||
*/
|
*/
|
||||||
public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics";
|
public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Max allowed plots
|
* Max allowed plots
|
||||||
*/
|
*/
|
||||||
public static int MAX_PLOTS = 20;
|
public static int MAX_PLOTS = 20;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WorldGuard region on claimed plots
|
* WorldGuard region on claimed plots
|
||||||
*/
|
*/
|
||||||
public static boolean WORLDGUARD = false;
|
public static boolean WORLDGUARD = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* metrics
|
* metrics
|
||||||
*/
|
*/
|
||||||
public static boolean METRICS = true;
|
public static boolean METRICS = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* plot specific resource pack
|
* plot specific resource pack
|
||||||
*/
|
*/
|
||||||
public static String PLOT_SPECIFIC_RESOURCE_PACK = "";
|
public static String PLOT_SPECIFIC_RESOURCE_PACK = "";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kill road mobs?
|
* Kill road mobs?
|
||||||
*/
|
*/
|
||||||
public static boolean KILL_ROAD_MOBS;
|
public static boolean KILL_ROAD_MOBS;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default kill road mobs: true
|
|
||||||
*/
|
|
||||||
public static boolean KILL_ROAD_MOBS_DEFAULT = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* mob pathfinding?
|
* mob pathfinding?
|
||||||
*/
|
*/
|
||||||
public static boolean MOB_PATHFINDING;
|
public static boolean MOB_PATHFINDING;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default mob pathfinding: true
|
|
||||||
*/
|
|
||||||
public static boolean MOB_PATHFINDING_DEFAULT = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Delete plots on ban?
|
* Delete plots on ban?
|
||||||
*/
|
*/
|
||||||
|
@ -33,24 +33,43 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* DB Functions
|
||||||
|
*
|
||||||
|
* @author Empire92
|
||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public class DBFunc {
|
public class DBFunc {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The "global" uuid
|
||||||
|
*/
|
||||||
|
public static final UUID everyone = UUID.fromString("1-1-3-3-7");
|
||||||
|
/**
|
||||||
|
* Abstract Database Manager
|
||||||
|
*/
|
||||||
public static AbstractDB dbManager;
|
public static AbstractDB dbManager;
|
||||||
|
|
||||||
// TODO MongoDB @Brandon
|
/**
|
||||||
|
* Set the owner of a plot
|
||||||
public static UUID everyone = UUID.fromString("1-1-3-3-7");
|
* @param plot Plot Object
|
||||||
|
* @param uuid New Owner
|
||||||
|
*/
|
||||||
public static void setOwner(final Plot plot, final UUID uuid) {
|
public static void setOwner(final Plot plot, final UUID uuid) {
|
||||||
dbManager.setOwner(plot, uuid);
|
dbManager.setOwner(plot, uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create all settings + (helpers, denied, trusted)
|
||||||
|
* @param plots List containing all plot objects
|
||||||
|
*/
|
||||||
public static void createAllSettingsAndHelpers(final ArrayList<Plot> plots) {
|
public static void createAllSettingsAndHelpers(final ArrayList<Plot> plots) {
|
||||||
dbManager.createAllSettingsAndHelpers(plots);
|
dbManager.createAllSettingsAndHelpers(plots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create all plots
|
||||||
|
* @param plots A list containing plot objects
|
||||||
|
*/
|
||||||
public static void createPlots(final ArrayList<Plot> plots) {
|
public static void createPlots(final ArrayList<Plot> plots) {
|
||||||
dbManager.createPlots(plots);
|
dbManager.createPlots(plots);
|
||||||
}
|
}
|
||||||
@ -58,7 +77,7 @@ public class DBFunc {
|
|||||||
/**
|
/**
|
||||||
* Create a plot
|
* Create a plot
|
||||||
*
|
*
|
||||||
* @param plot
|
* @param plot Plot to create
|
||||||
*/
|
*/
|
||||||
public static void createPlot(final Plot plot) {
|
public static void createPlot(final Plot plot) {
|
||||||
dbManager.createPlot(plot);
|
dbManager.createPlot(plot);
|
||||||
@ -76,7 +95,7 @@ public class DBFunc {
|
|||||||
/**
|
/**
|
||||||
* Delete a plot
|
* Delete a plot
|
||||||
*
|
*
|
||||||
* @param plot
|
* @param plot Plot to delete
|
||||||
*/
|
*/
|
||||||
public static void delete(final String world, final Plot plot) {
|
public static void delete(final String world, final Plot plot) {
|
||||||
dbManager.delete(world, plot);
|
dbManager.delete(world, plot);
|
||||||
@ -85,8 +104,8 @@ public class DBFunc {
|
|||||||
/**
|
/**
|
||||||
* Create plot settings
|
* Create plot settings
|
||||||
*
|
*
|
||||||
* @param id
|
* @param id Plot ID
|
||||||
* @param plot
|
* @param plot Plot Object
|
||||||
*/
|
*/
|
||||||
public static void createPlotSettings(final int id, final Plot plot) {
|
public static void createPlotSettings(final int id, final Plot plot) {
|
||||||
dbManager.createPlotSettings(id, plot);
|
dbManager.createPlotSettings(id, plot);
|
||||||
@ -95,8 +114,9 @@ public class DBFunc {
|
|||||||
/**
|
/**
|
||||||
* Get a plot id
|
* Get a plot id
|
||||||
*
|
*
|
||||||
* @param plot_id
|
* @param world World
|
||||||
* @return
|
* @param id2 Plot ID
|
||||||
|
* @return ID
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* public static int getId(String world, PlotId id2) { Statement stmt =
|
* public static int getId(String world, PlotId id2) { Statement stmt =
|
||||||
@ -113,7 +133,7 @@ public class DBFunc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return
|
* @return Plots
|
||||||
*/
|
*/
|
||||||
public static LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
public static LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||||
return dbManager.getPlots();
|
return dbManager.getPlots();
|
||||||
|
@ -39,7 +39,7 @@ public abstract class Database {
|
|||||||
/**
|
/**
|
||||||
* Plugin instance, use for plugin.getDataFolder()
|
* Plugin instance, use for plugin.getDataFolder()
|
||||||
*/
|
*/
|
||||||
protected Plugin plugin;
|
protected final Plugin plugin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Database
|
* Creates a new Database
|
||||||
|
@ -1,7 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot.database;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Citymonstret on 2014-09-23.
|
|
||||||
*/
|
|
||||||
public class FlatFileManager {
|
|
||||||
}
|
|
@ -97,9 +97,7 @@ public class MySQL extends Database {
|
|||||||
|
|
||||||
final Statement statement = this.connection.createStatement();
|
final Statement statement = this.connection.createStatement();
|
||||||
|
|
||||||
final ResultSet result = statement.executeQuery(query);
|
return statement.executeQuery(query);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -110,9 +108,7 @@ public class MySQL extends Database {
|
|||||||
|
|
||||||
final Statement statement = this.connection.createStatement();
|
final Statement statement = this.connection.createStatement();
|
||||||
|
|
||||||
final int result = statement.executeUpdate(query);
|
return statement.executeUpdate(query);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -195,12 +195,12 @@ public class PlotMeConverter {
|
|||||||
final PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
|
final PlotId id = new PlotId(Integer.parseInt(plot.id.split(";")[0]), Integer.parseInt(plot.id.split(";")[1]));
|
||||||
com.intellectualcrafters.plot.object.Plot pl;
|
com.intellectualcrafters.plot.object.Plot pl;
|
||||||
if (online) {
|
if (online) {
|
||||||
pl = new com.intellectualcrafters.plot.object.Plot(id, plot.getOwnerId(), plot.getBiome(), psAdded, psTrusted, psDenied,
|
pl = new com.intellectualcrafters.plot.object.Plot(id, plot.getOwnerId(), psAdded, psTrusted, psDenied,
|
||||||
|
|
||||||
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
|
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
|
||||||
} else {
|
} else {
|
||||||
final String owner = plot.getOwner();
|
final String owner = plot.getOwner();
|
||||||
pl = new com.intellectualcrafters.plot.object.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), plot.getBiome(), psAdded, psTrusted, psDenied,
|
pl = new com.intellectualcrafters.plot.object.Plot(id, UUID.nameUUIDFromBytes(("OfflinePlayer:" + owner).getBytes(Charsets.UTF_8)), psAdded, psTrusted, psDenied,
|
||||||
|
|
||||||
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
|
"", PlotHomePosition.DEFAULT, null, world.getName(), new boolean[]{false, false, false, false});
|
||||||
}
|
}
|
||||||
|
@ -383,7 +383,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() {
|
||||||
final LinkedHashMap<String, HashMap<PlotId, Plot>> newplots = new LinkedHashMap<String, HashMap<PlotId, Plot>>();
|
final LinkedHashMap<String, HashMap<PlotId, Plot>> newplots = new LinkedHashMap<>();
|
||||||
try {
|
try {
|
||||||
final DatabaseMetaData data = connection.getMetaData();
|
final DatabaseMetaData data = connection.getMetaData();
|
||||||
ResultSet rs = data.getColumns(null, null, prefix + "plot", "plot_id");
|
ResultSet rs = data.getColumns(null, null, prefix + "plot", "plot_id");
|
||||||
@ -408,12 +408,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
} catch (final Exception e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
final HashMap<Integer, Plot> plots = new HashMap<Integer, Plot>();
|
final HashMap<Integer, Plot> plots = new HashMap<>();
|
||||||
|
|
||||||
Statement stmt = null;
|
Statement stmt = null;
|
||||||
try {
|
try {
|
||||||
|
|
||||||
Set<String> worlds = new HashSet<String>();
|
Set<String> worlds = new HashSet<>();
|
||||||
if (PlotMain.config.contains("worlds")) {
|
if (PlotMain.config.contains("worlds")) {
|
||||||
worlds = PlotMain.config.getConfigurationSection("worlds").getKeys(false);
|
worlds = PlotMain.config.getConfigurationSection("worlds").getKeys(false);
|
||||||
}
|
}
|
||||||
@ -448,7 +448,7 @@ public class SQLManager implements AbstractDB {
|
|||||||
user = UUID.fromString(o);
|
user = UUID.fromString(o);
|
||||||
uuids.put(o, user);
|
uuids.put(o, user);
|
||||||
}
|
}
|
||||||
p = new Plot(plot_id, user, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), "", PlotHomePosition.DEFAULT, null, worldname, new boolean[]{false, false, false, false});
|
p = new Plot(plot_id, user, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), "", PlotHomePosition.DEFAULT, null, worldname, new boolean[]{false, false, false, false});
|
||||||
plots.put(id, p);
|
plots.put(id, p);
|
||||||
}
|
}
|
||||||
// stmt.close();
|
// stmt.close();
|
||||||
@ -924,7 +924,6 @@ public class SQLManager implements AbstractDB {
|
|||||||
h.put(var, val);
|
h.put(var, val);
|
||||||
}
|
}
|
||||||
stmt.close();
|
stmt.close();
|
||||||
;
|
|
||||||
} catch (final SQLException e) {
|
} catch (final SQLException e) {
|
||||||
Logger.add(LogLevel.WARNING, "Failed to load settings for plot: " + id);
|
Logger.add(LogLevel.WARNING, "Failed to load settings for plot: " + id);
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -36,8 +36,8 @@ import java.util.logging.Level;
|
|||||||
*/
|
*/
|
||||||
public class SQLite extends Database {
|
public class SQLite extends Database {
|
||||||
|
|
||||||
private Connection connection;
|
|
||||||
private final String dbLocation;
|
private final String dbLocation;
|
||||||
|
private Connection connection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new SQLite instance
|
* Creates a new SQLite instance
|
||||||
@ -98,9 +98,7 @@ public class SQLite extends Database {
|
|||||||
|
|
||||||
final Statement statement = this.connection.createStatement();
|
final Statement statement = this.connection.createStatement();
|
||||||
|
|
||||||
final ResultSet result = statement.executeQuery(query);
|
return statement.executeQuery(query);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -111,8 +109,6 @@ public class SQLite extends Database {
|
|||||||
|
|
||||||
final Statement statement = this.connection.createStatement();
|
final Statement statement = this.connection.createStatement();
|
||||||
|
|
||||||
final int result = statement.executeUpdate(query);
|
return statement.executeUpdate(query);
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
package com.intellectualcrafters.plot.database.sqlobjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Citymonstret on 2014-10-28.
|
|
||||||
*/
|
|
||||||
public class PlotTable extends SQLTable {
|
|
||||||
|
|
||||||
public PlotTable() {
|
|
||||||
super("plots", "hello", null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void create() {
|
|
||||||
// TODO Auto-generated method stub
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,45 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
|
||||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
|
||||||
// /
|
|
||||||
// This program is free software; you can redistribute it and/or modify /
|
|
||||||
// it under the terms of the GNU General Public License as published by /
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or /
|
|
||||||
// (at your option) any later version. /
|
|
||||||
// /
|
|
||||||
// This program is distributed in the hope that it will be useful, /
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
|
||||||
// GNU General Public License for more details. /
|
|
||||||
// /
|
|
||||||
// You should have received a copy of the GNU General Public License /
|
|
||||||
// along with this program; if not, write to the Free Software Foundation, /
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
|
||||||
// /
|
|
||||||
// You can contact us via: support@intellectualsites.com /
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
package com.intellectualcrafters.plot.database.sqlobjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Citymonstret on 2014-10-28.
|
|
||||||
*/
|
|
||||||
public class SQLField {
|
|
||||||
|
|
||||||
private final SQLType type;
|
|
||||||
private final Object value;
|
|
||||||
|
|
||||||
public SQLField(final SQLType type, final Object value) {
|
|
||||||
this.type = type;
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SQLType getType() {
|
|
||||||
return this.type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getValue() {
|
|
||||||
return this.value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,50 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
|
||||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
|
||||||
// /
|
|
||||||
// This program is free software; you can redistribute it and/or modify /
|
|
||||||
// it under the terms of the GNU General Public License as published by /
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or /
|
|
||||||
// (at your option) any later version. /
|
|
||||||
// /
|
|
||||||
// This program is distributed in the hope that it will be useful, /
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
|
||||||
// GNU General Public License for more details. /
|
|
||||||
// /
|
|
||||||
// You should have received a copy of the GNU General Public License /
|
|
||||||
// along with this program; if not, write to the Free Software Foundation, /
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
|
||||||
// /
|
|
||||||
// You can contact us via: support@intellectualsites.com /
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
package com.intellectualcrafters.plot.database.sqlobjects;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Citymonstret on 2014-10-28.
|
|
||||||
*/
|
|
||||||
public abstract class SQLTable {
|
|
||||||
|
|
||||||
private final String name;
|
|
||||||
private final SQLField[] fields;
|
|
||||||
|
|
||||||
public SQLTable(final String name, final String primaryKey, final SQLField... fields) {
|
|
||||||
this.name = Settings.DB.PREFIX + name;
|
|
||||||
this.fields = fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SQLField[] getFields() {
|
|
||||||
return this.fields;
|
|
||||||
}
|
|
||||||
|
|
||||||
public abstract void create();
|
|
||||||
|
|
||||||
}
|
|
@ -1,61 +0,0 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
|
||||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
|
||||||
// /
|
|
||||||
// This program is free software; you can redistribute it and/or modify /
|
|
||||||
// it under the terms of the GNU General Public License as published by /
|
|
||||||
// the Free Software Foundation; either version 3 of the License, or /
|
|
||||||
// (at your option) any later version. /
|
|
||||||
// /
|
|
||||||
// This program is distributed in the hope that it will be useful, /
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
|
||||||
// GNU General Public License for more details. /
|
|
||||||
// /
|
|
||||||
// You should have received a copy of the GNU General Public License /
|
|
||||||
// along with this program; if not, write to the Free Software Foundation, /
|
|
||||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
|
||||||
// /
|
|
||||||
// You can contact us via: support@intellectualsites.com /
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
package com.intellectualcrafters.plot.database.sqlobjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Citymonstret on 2014-10-28.
|
|
||||||
*/
|
|
||||||
public enum SQLType {
|
|
||||||
|
|
||||||
INTEGER(0, "integer", Integer.class, 11),
|
|
||||||
VARCHAR("", "varchar", String.class, 300),
|
|
||||||
BOOL(false, "bool", Boolean.class, 1);
|
|
||||||
|
|
||||||
private Object defaultValue;
|
|
||||||
private String sqlName;
|
|
||||||
private Class javaClass;
|
|
||||||
private int length;
|
|
||||||
|
|
||||||
SQLType(final Object defaultValue, final String sqlName, final Class javaClass, final int length) {
|
|
||||||
this.defaultValue = defaultValue;
|
|
||||||
this.sqlName = sqlName;
|
|
||||||
this.javaClass = javaClass;
|
|
||||||
this.length = length;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLength() {
|
|
||||||
return this.length;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return this.sqlName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Class getJavaClass() {
|
|
||||||
return this.javaClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object getDefaultValue() {
|
|
||||||
return this.defaultValue;
|
|
||||||
}
|
|
||||||
}
|
|
@ -42,7 +42,7 @@ public class FlagManager {
|
|||||||
// - Mob cap
|
// - Mob cap
|
||||||
// - customized plot composition
|
// - customized plot composition
|
||||||
|
|
||||||
private static ArrayList<AbstractFlag> flags = new ArrayList<>();
|
private final static ArrayList<AbstractFlag> flags = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Register an AbstractFlag with PlotSquared
|
* Register an AbstractFlag with PlotSquared
|
||||||
|
@ -10,7 +10,7 @@ public abstract class FlagValue<T> {
|
|||||||
private Class<T> clazz;
|
private Class<T> clazz;
|
||||||
|
|
||||||
public FlagValue() {
|
public FlagValue() {
|
||||||
this.clazz = (Class<T>) this.getClass();
|
this.clazz = (Class<T>) getClass();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FlagValue(Class<T> clazz) {
|
public FlagValue(Class<T> clazz) {
|
||||||
|
@ -33,6 +33,7 @@ import org.bukkit.block.Block;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public class DefaultPlotManager extends PlotManager {
|
public class DefaultPlotManager extends PlotManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -186,10 +187,7 @@ public class DefaultPlotManager extends PlotManager {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isInPlotAbs(final PlotWorld plotworld, final Location loc, final PlotId plotid) {
|
public boolean isInPlotAbs(final PlotWorld plotworld, final Location loc, final PlotId plotid) {
|
||||||
final PlotId result = getPlotIdAbs(plotworld, loc);
|
final PlotId result = getPlotIdAbs(plotworld, loc);
|
||||||
if (result == null) {
|
return result != null && result == plotid;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return result == plotid;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -40,49 +40,49 @@ public class DefaultPlotWorld extends PlotWorld {
|
|||||||
/**
|
/**
|
||||||
* Default Road Height: 64
|
* Default Road Height: 64
|
||||||
*/
|
*/
|
||||||
public static int ROAD_HEIGHT_DEFAULT = 64;
|
public final static int ROAD_HEIGHT_DEFAULT = 64;
|
||||||
/**
|
/**
|
||||||
* Default plot height: 64
|
* Default plot height: 64
|
||||||
*/
|
*/
|
||||||
public static int PLOT_HEIGHT_DEFAULT = 64;
|
public final static int PLOT_HEIGHT_DEFAULT = 64;
|
||||||
/**
|
/**
|
||||||
* Default Wall Height: 64
|
* Default Wall Height: 64
|
||||||
*/
|
*/
|
||||||
public static int WALL_HEIGHT_DEFAULT = 64;
|
public final static int WALL_HEIGHT_DEFAULT = 64;
|
||||||
/**
|
/**
|
||||||
* Default plot width: 32
|
* Default plot width: 32
|
||||||
*/
|
*/
|
||||||
public static int PLOT_WIDTH_DEFAULT = 32;
|
public final static int PLOT_WIDTH_DEFAULT = 32;
|
||||||
/**
|
/**
|
||||||
* Default road width: 7
|
* Default road width: 7
|
||||||
*/
|
*/
|
||||||
public static int ROAD_WIDTH_DEFAULT = 7;
|
public final static int ROAD_WIDTH_DEFAULT = 7;
|
||||||
/**
|
/**
|
||||||
* Default main block: 1
|
* Default main block: 1
|
||||||
*/
|
*/
|
||||||
public static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 1, (byte) 0)};
|
public final static PlotBlock[] MAIN_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 1, (byte) 0)};
|
||||||
/**
|
/**
|
||||||
* Default top blocks: {"2"}
|
* Default top blocks: {"2"}
|
||||||
*/
|
*/
|
||||||
public static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 2, (byte) 0)};
|
public final static PlotBlock[] TOP_BLOCK_DEFAULT = new PlotBlock[]{new PlotBlock((short) 2, (byte) 0)};
|
||||||
/**
|
/**
|
||||||
* Default wall block: 44
|
* Default wall block: 44
|
||||||
*/
|
*/
|
||||||
public static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0);
|
public final static PlotBlock WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 0);
|
||||||
public static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1);
|
public final static PlotBlock CLAIMED_WALL_BLOCK_DEFAULT = new PlotBlock((short) 44, (byte) 1);
|
||||||
/**
|
/**
|
||||||
* Default wall filling: 1
|
* Default wall filling: 1
|
||||||
*/
|
*/
|
||||||
public static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
|
public final static PlotBlock WALL_FILLING_DEFAULT = new PlotBlock((short) 1, (byte) 0);
|
||||||
/**
|
/**
|
||||||
* Default road stripes: 35
|
* Default road stripes: 35
|
||||||
*/
|
*/
|
||||||
public static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock((short) 98, (byte) 0);
|
public final static PlotBlock ROAD_STRIPES_DEFAULT = new PlotBlock((short) 98, (byte) 0);
|
||||||
public static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
|
public final static boolean ROAD_STRIPES_ENABLED_DEFAULT = false;
|
||||||
/**
|
/**
|
||||||
* Default road block: 155
|
* Default road block: 155
|
||||||
*/
|
*/
|
||||||
public static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
|
public final static PlotBlock ROAD_BLOCK_DEFAULT = new PlotBlock((short) 155, (byte) 0);
|
||||||
/**
|
/**
|
||||||
* Road Height
|
* Road Height
|
||||||
*/
|
*/
|
||||||
|
@ -36,12 +36,14 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Citymonstret The default generator is very messy, as we have decided
|
* The default generator is very messy, as we have decided
|
||||||
* to try externalize all calculations from within the loop. - You will
|
* to try externalize all calculations from within the loop. - You will
|
||||||
* see a lot of slower implementations have a single for loop. - This is
|
* see a lot of slower implementations have a single for loop. - This is
|
||||||
* perfectly fine to do, it will just mean world generation may take
|
* perfectly fine to do, it will just mean world generation may take
|
||||||
* somewhat longer
|
* somewhat longer
|
||||||
* @auther Empire92
|
*
|
||||||
|
* @author Citymonstret
|
||||||
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class WorldGenerator extends PlotGenerator {
|
public class WorldGenerator extends PlotGenerator {
|
||||||
/**
|
/**
|
||||||
@ -330,7 +332,6 @@ public class WorldGenerator extends PlotGenerator {
|
|||||||
setCuboidRegion(16 - value, (16 - value) + 1, this.wallheight, this.wallheight + 1, start, 16, this.floor2); //
|
setCuboidRegion(16 - value, (16 - value) + 1, this.wallheight, this.wallheight + 1, start, 16, this.floor2); //
|
||||||
}
|
}
|
||||||
if ((roadStartZ <= 16) && (roadStartZ > 1)) {
|
if ((roadStartZ <= 16) && (roadStartZ > 1)) {
|
||||||
final int val = roadStartZ;
|
|
||||||
int start, end;
|
int start, end;
|
||||||
if ((plotMinX + 2) <= 16) {
|
if ((plotMinX + 2) <= 16) {
|
||||||
start = 16 - plotMinX - 1;
|
start = 16 - plotMinX - 1;
|
||||||
@ -345,11 +346,10 @@ public class WorldGenerator extends PlotGenerator {
|
|||||||
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
|
if (!(((plotMinX + 2) <= 16) || ((roadStartX - 1) <= 16))) {
|
||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
setCuboidRegion(0, end, this.wallheight, this.wallheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2);
|
setCuboidRegion(0, end, this.wallheight, this.wallheight + 1, (16 - roadStartZ) + 1, (16 - roadStartZ) + 2, this.floor2);
|
||||||
setCuboidRegion(start, 16, this.wallheight, this.wallheight + 1, (16 - val) + 1, (16 - val) + 2, this.floor2);
|
setCuboidRegion(start, 16, this.wallheight, this.wallheight + 1, (16 - roadStartZ) + 1, (16 - roadStartZ) + 2, this.floor2);
|
||||||
}
|
}
|
||||||
if ((roadStartX <= 16) && (roadStartX > 1)) {
|
if ((roadStartX <= 16) && (roadStartX > 1)) {
|
||||||
final int val = roadStartX;
|
|
||||||
int start, end;
|
int start, end;
|
||||||
if ((plotMinZ + 2) <= 16) {
|
if ((plotMinZ + 2) <= 16) {
|
||||||
start = 16 - plotMinZ - 1;
|
start = 16 - plotMinZ - 1;
|
||||||
@ -364,8 +364,8 @@ public class WorldGenerator extends PlotGenerator {
|
|||||||
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
|
if (!(((plotMinZ + 2) <= 16) || ((roadStartZ - 1) <= 16))) {
|
||||||
start = 0;
|
start = 0;
|
||||||
}
|
}
|
||||||
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.wallheight, this.wallheight + 1, 0, end, this.floor2); //
|
setCuboidRegion((16 - roadStartX) + 1, (16 - roadStartX) + 2, this.wallheight, this.wallheight + 1, 0, end, this.floor2); //
|
||||||
setCuboidRegion((16 - val) + 1, (16 - val) + 2, this.wallheight, this.wallheight + 1, start, 16, this.floor2); //
|
setCuboidRegion((16 - roadStartX) + 1, (16 - roadStartX) + 2, this.wallheight, this.wallheight + 1, start, 16, this.floor2); //
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,24 +42,24 @@ public class XPopulator extends BlockPopulator {
|
|||||||
* information about how a BlockPopulator works.
|
* information about how a BlockPopulator works.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
final int plotsize;
|
||||||
|
final int pathsize;
|
||||||
|
final PlotBlock wall;
|
||||||
|
final PlotBlock wallfilling;
|
||||||
|
final PlotBlock floor1;
|
||||||
|
final PlotBlock floor2;
|
||||||
|
final int size;
|
||||||
|
final int roadheight;
|
||||||
|
final int wallheight;
|
||||||
|
final int plotheight;
|
||||||
|
final PlotBlock[] plotfloors;
|
||||||
|
final PlotBlock[] filling;
|
||||||
private final DefaultPlotWorld plotworld;
|
private final DefaultPlotWorld plotworld;
|
||||||
int plotsize;
|
final private double pathWidthLower;
|
||||||
int pathsize;
|
|
||||||
PlotBlock wall;
|
|
||||||
PlotBlock wallfilling;
|
|
||||||
PlotBlock floor1;
|
|
||||||
PlotBlock floor2;
|
|
||||||
int size;
|
|
||||||
Biome biome;
|
Biome biome;
|
||||||
int roadheight;
|
|
||||||
int wallheight;
|
|
||||||
int plotheight;
|
|
||||||
PlotBlock[] plotfloors;
|
|
||||||
PlotBlock[] filling;
|
|
||||||
private int X;
|
private int X;
|
||||||
private int Z;
|
private int Z;
|
||||||
private long state;
|
private long state;
|
||||||
private double pathWidthLower;
|
|
||||||
|
|
||||||
public XPopulator(final PlotWorld pw) {
|
public XPopulator(final PlotWorld pw) {
|
||||||
this.plotworld = (DefaultPlotWorld) pw;
|
this.plotworld = (DefaultPlotWorld) pw;
|
||||||
|
@ -33,7 +33,7 @@ import java.util.Set;
|
|||||||
@SuppressWarnings({"unused", "deprecation"})
|
@SuppressWarnings({"unused", "deprecation"})
|
||||||
public class EntityListener implements Listener {
|
public class EntityListener implements Listener {
|
||||||
|
|
||||||
public static HashMap<String, HashMap<Plot, HashSet<Integer>>> entityMap = new HashMap<>();
|
public final static HashMap<String, HashMap<Plot, HashSet<Integer>>> entityMap = new HashMap<>();
|
||||||
|
|
||||||
public EntityListener() {
|
public EntityListener() {
|
||||||
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
BukkitScheduler scheduler = Bukkit.getServer().getScheduler();
|
||||||
|
@ -733,19 +733,6 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onChangeWorld(final PlayerChangedWorldEvent event) {
|
|
||||||
/*
|
|
||||||
* if (isPlotWorld(event.getFrom()) &&
|
|
||||||
* (Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1)) {
|
|
||||||
* event.getPlayer().setResourcePack("");
|
|
||||||
* }
|
|
||||||
* else {
|
|
||||||
* textures(event.getPlayer());
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void BlockCreate(final BlockPlaceEvent event) {
|
public void BlockCreate(final BlockPlaceEvent event) {
|
||||||
final World world = event.getPlayer().getWorld();
|
final World world = event.getPlayer().getWorld();
|
||||||
|
@ -50,8 +50,8 @@ import java.util.*;
|
|||||||
@SuppressWarnings({"deprecation", "unused"})
|
@SuppressWarnings({"deprecation", "unused"})
|
||||||
public class PlotPlusListener extends PlotListener implements Listener {
|
public class PlotPlusListener extends PlotListener implements Listener {
|
||||||
|
|
||||||
private static HashMap<String, Interval> feedRunnable = new HashMap<>();
|
private final static HashMap<String, Interval> feedRunnable = new HashMap<>();
|
||||||
private static HashMap<String, Interval> healRunnable = new HashMap<>();
|
private final static HashMap<String, Interval> healRunnable = new HashMap<>();
|
||||||
|
|
||||||
public static void startRunnable(final JavaPlugin plugin) {
|
public static void startRunnable(final JavaPlugin plugin) {
|
||||||
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
plugin.getServer().getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() {
|
||||||
@ -229,10 +229,10 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class Interval {
|
public static class Interval {
|
||||||
public int interval;
|
public final int interval;
|
||||||
public int amount;
|
public final int amount;
|
||||||
|
public final int max;
|
||||||
public int count = 0;
|
public int count = 0;
|
||||||
public int max;
|
|
||||||
|
|
||||||
public Interval(final int interval, final int amount, final int max) {
|
public Interval(final int interval, final int amount, final int max) {
|
||||||
this.interval = interval;
|
this.interval = interval;
|
||||||
@ -247,7 +247,7 @@ public class PlotPlusListener extends PlotListener implements Listener {
|
|||||||
* @author Citymonstret
|
* @author Citymonstret
|
||||||
*/
|
*/
|
||||||
public static class RecordMeta {
|
public static class RecordMeta {
|
||||||
public static List<RecordMeta> metaList = new ArrayList<>();
|
public final static List<RecordMeta> metaList = new ArrayList<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (int x = 3; x < 12; x++) {
|
for (int x = 3; x < 12; x++) {
|
||||||
|
@ -45,11 +45,11 @@ public class Plot implements Cloneable {
|
|||||||
/**
|
/**
|
||||||
* plot ID
|
* plot ID
|
||||||
*/
|
*/
|
||||||
public PlotId id;
|
public final PlotId id;
|
||||||
/**
|
/**
|
||||||
* plot world
|
* plot world
|
||||||
*/
|
*/
|
||||||
public String world;
|
public final String world;
|
||||||
/**
|
/**
|
||||||
* plot owner
|
* plot owner
|
||||||
*/
|
*/
|
||||||
@ -92,7 +92,6 @@ public class Plot implements Cloneable {
|
|||||||
* @param plotBiome
|
* @param plotBiome
|
||||||
* @param helpers
|
* @param helpers
|
||||||
* @param denied
|
* @param denied
|
||||||
*
|
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
@ -144,7 +143,6 @@ public class Plot implements Cloneable {
|
|||||||
* @param helpers
|
* @param helpers
|
||||||
* @param denied
|
* @param denied
|
||||||
* @param merged
|
* @param merged
|
||||||
*
|
|
||||||
* @deprecated
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -25,8 +25,8 @@ package com.intellectualcrafters.plot.object;
|
|||||||
* @author Empire92
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class PlotBlock {
|
public class PlotBlock {
|
||||||
public short id;
|
public final short id;
|
||||||
public byte data;
|
public final byte data;
|
||||||
|
|
||||||
public PlotBlock(final short id, final byte data) {
|
public PlotBlock(final short id, final byte data) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
@ -28,8 +28,8 @@ public enum PlotHomePosition {
|
|||||||
CENTER("Center", 'c'),
|
CENTER("Center", 'c'),
|
||||||
DEFAULT("Default", 'd');
|
DEFAULT("Default", 'd');
|
||||||
|
|
||||||
private String string;
|
private final String string;
|
||||||
private char ch;
|
private final char ch;
|
||||||
|
|
||||||
PlotHomePosition(final String string, final char ch) {
|
PlotHomePosition(final String string, final char ch) {
|
||||||
this.string = string;
|
this.string = string;
|
||||||
|
@ -26,11 +26,11 @@ public class PlotId {
|
|||||||
/**
|
/**
|
||||||
* x value
|
* x value
|
||||||
*/
|
*/
|
||||||
public Integer x;
|
public final Integer x;
|
||||||
/**
|
/**
|
||||||
* y value
|
* y value
|
||||||
*/
|
*/
|
||||||
public Integer y;
|
public final Integer y;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
* PlotId class (PlotId x,y values do not correspond to Block locations)
|
||||||
|
@ -38,7 +38,7 @@ import java.util.HashMap;
|
|||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public class PlotSelection {
|
public class PlotSelection {
|
||||||
|
|
||||||
public static HashMap<String, PlotSelection> currentSelection = new HashMap<>();
|
public final static HashMap<String, PlotSelection> currentSelection = new HashMap<>();
|
||||||
|
|
||||||
private final PlotBlock[] plotBlocks;
|
private final PlotBlock[] plotBlocks;
|
||||||
|
|
||||||
|
@ -39,6 +39,10 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class PlotSettings {
|
public class PlotSettings {
|
||||||
|
/**
|
||||||
|
* Plot
|
||||||
|
*/
|
||||||
|
private final Plot plot;
|
||||||
/**
|
/**
|
||||||
* merged plots
|
* merged plots
|
||||||
*/
|
*/
|
||||||
@ -59,10 +63,6 @@ public class PlotSettings {
|
|||||||
* Home Position
|
* Home Position
|
||||||
*/
|
*/
|
||||||
private PlotHomePosition position;
|
private PlotHomePosition position;
|
||||||
/**
|
|
||||||
* Plot
|
|
||||||
*/
|
|
||||||
private Plot plot;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -42,26 +42,27 @@ public abstract class PlotWorld {
|
|||||||
// TODO make this configurable
|
// TODO make this configurable
|
||||||
// make non static and static_default_valu + add config option
|
// make non static and static_default_valu + add config option
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
public static ArrayList<Material> BLOCKS = new ArrayList<>(Arrays.asList(new Material[]{ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND,
|
public final static ArrayList<Material> BLOCKS = new ArrayList<>(Arrays.asList(new Material[]{ACACIA_STAIRS, BEACON, BEDROCK, BIRCH_WOOD_STAIRS, BOOKSHELF, BREWING_STAND, BRICK, BRICK_STAIRS, BURNING_FURNACE, CAKE_BLOCK, CAULDRON, CLAY_BRICK, CLAY, COAL_BLOCK, COAL_ORE, COBBLE_WALL, COBBLESTONE, COBBLESTONE_STAIRS, COMMAND, DARK_OAK_STAIRS, DAYLIGHT_DETECTOR, DIAMOND_ORE, DIAMOND_BLOCK, DIRT, DISPENSER, DROPPER, EMERALD_BLOCK, EMERALD_ORE, ENCHANTMENT_TABLE, ENDER_PORTAL_FRAME, ENDER_STONE, FURNACE, GLOWSTONE, GOLD_ORE, GOLD_BLOCK, GRASS, GRAVEL, GLASS, HARD_CLAY, HAY_BLOCK, HUGE_MUSHROOM_1, HUGE_MUSHROOM_2, IRON_BLOCK, IRON_ORE, JACK_O_LANTERN, JUKEBOX, JUNGLE_WOOD_STAIRS, LAPIS_BLOCK, LAPIS_ORE, LEAVES, LEAVES_2, LOG, LOG_2, MELON_BLOCK, MOB_SPAWNER, MOSSY_COBBLESTONE, MYCEL, NETHER_BRICK, NETHER_BRICK_STAIRS, NETHERRACK, NOTE_BLOCK, OBSIDIAN, PACKED_ICE, PUMPKIN, QUARTZ_BLOCK, QUARTZ_ORE, QUARTZ_STAIRS, REDSTONE_BLOCK, SANDSTONE, SAND,
|
||||||
SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126)}));
|
SANDSTONE_STAIRS, SMOOTH_BRICK, SMOOTH_STAIRS, SNOW_BLOCK, SOUL_SAND, SPONGE, SPRUCE_WOOD_STAIRS, STONE, WOOD, WOOD_STAIRS, WORKBENCH, WOOL, getMaterial(44), getMaterial(126)}));
|
||||||
public static boolean AUTO_MERGE_DEFAULT = false;
|
public final static boolean AUTO_MERGE_DEFAULT = false;
|
||||||
public static boolean MOB_SPAWNING_DEFAULT = false;
|
public final static boolean MOB_SPAWNING_DEFAULT = false;
|
||||||
public static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
public final static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
||||||
public static boolean PLOT_CHAT_DEFAULT = false;
|
public final static boolean PLOT_CHAT_DEFAULT = false;
|
||||||
public static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
|
public final static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
|
||||||
public static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
public final static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
||||||
public static String SCHEMATIC_FILE_DEFAULT = "null";
|
public final static String SCHEMATIC_FILE_DEFAULT = "null";
|
||||||
public static List<String> SCHEMATICS_DEFAULT = null;
|
public final static List<String> SCHEMATICS_DEFAULT = null;
|
||||||
public static List<String> DEFAULT_FLAGS_DEFAULT = new ArrayList<>();
|
public final static List<String> DEFAULT_FLAGS_DEFAULT = new ArrayList<>();
|
||||||
public static boolean USE_ECONOMY_DEFAULT = false;
|
public final static boolean USE_ECONOMY_DEFAULT = false;
|
||||||
public static double PLOT_PRICE_DEFAULT = 100;
|
public final static double PLOT_PRICE_DEFAULT = 100;
|
||||||
public static double MERGE_PRICE_DEFAULT = 100;
|
public final static double MERGE_PRICE_DEFAULT = 100;
|
||||||
public static double SELL_PRICE_DEFAULT = 75;
|
public final static double SELL_PRICE_DEFAULT = 75;
|
||||||
public static boolean PVP_DEFAULT = false;
|
public final static boolean PVP_DEFAULT = false;
|
||||||
public static boolean PVE_DEFAULT = false;
|
public final static boolean PVE_DEFAULT = false;
|
||||||
public static boolean SPAWN_EGGS_DEFAULT = false;
|
public final static boolean SPAWN_EGGS_DEFAULT = false;
|
||||||
public static boolean SPAWN_CUSTOM_DEFAULT = true;
|
public final static boolean SPAWN_CUSTOM_DEFAULT = true;
|
||||||
public static boolean SPAWN_BREEDING_DEFAULT = false;
|
public final static boolean SPAWN_BREEDING_DEFAULT = false;
|
||||||
|
public final String worldname;
|
||||||
public boolean AUTO_MERGE;
|
public boolean AUTO_MERGE;
|
||||||
public boolean MOB_SPAWNING;
|
public boolean MOB_SPAWNING;
|
||||||
public Biome PLOT_BIOME;
|
public Biome PLOT_BIOME;
|
||||||
@ -80,7 +81,6 @@ public abstract class PlotWorld {
|
|||||||
public boolean SPAWN_EGGS;
|
public boolean SPAWN_EGGS;
|
||||||
public boolean SPAWN_CUSTOM;
|
public boolean SPAWN_CUSTOM;
|
||||||
public boolean SPAWN_BREEDING;
|
public boolean SPAWN_BREEDING;
|
||||||
public String worldname;
|
|
||||||
|
|
||||||
public PlotWorld(final String worldname) {
|
public PlotWorld(final String worldname) {
|
||||||
this.worldname = worldname;
|
this.worldname = worldname;
|
||||||
|
@ -25,7 +25,7 @@ package com.intellectualcrafters.plot.object;
|
|||||||
* @author Empire92
|
* @author Empire92
|
||||||
*/
|
*/
|
||||||
public class StringWrapper {
|
public class StringWrapper {
|
||||||
public String value;
|
public final String value;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -28,14 +28,14 @@ package com.intellectualcrafters.plot.util;
|
|||||||
*/
|
*/
|
||||||
public class Lag implements Runnable {
|
public class Lag implements Runnable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Ticks
|
||||||
|
*/
|
||||||
|
public final static long[] T = new long[600];
|
||||||
/**
|
/**
|
||||||
* Tick count
|
* Tick count
|
||||||
*/
|
*/
|
||||||
public static int TC = 0;
|
public static int TC = 0;
|
||||||
/**
|
|
||||||
* Ticks
|
|
||||||
*/
|
|
||||||
public static long[] T = new long[600];
|
|
||||||
/**
|
/**
|
||||||
* something :_:
|
* something :_:
|
||||||
*/
|
*/
|
||||||
|
@ -474,9 +474,7 @@ public class Metrics {
|
|||||||
json.append(':');
|
json.append(':');
|
||||||
json.append('{');
|
json.append('{');
|
||||||
boolean firstGraph = true;
|
boolean firstGraph = true;
|
||||||
final Iterator<Graph> iter = this.graphs.iterator();
|
for (Graph graph : this.graphs) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
final Graph graph = iter.next();
|
|
||||||
final StringBuilder graphJson = new StringBuilder();
|
final StringBuilder graphJson = new StringBuilder();
|
||||||
graphJson.append('{');
|
graphJson.append('{');
|
||||||
for (final Plotter plotter : graph.getPlotters()) {
|
for (final Plotter plotter : graph.getPlotters()) {
|
||||||
@ -541,9 +539,7 @@ public class Metrics {
|
|||||||
// Is this the first update this hour?
|
// Is this the first update this hour?
|
||||||
if (response.equals("1") || response.contains("This is your first update this hour")) {
|
if (response.equals("1") || response.contains("This is your first update this hour")) {
|
||||||
synchronized (this.graphs) {
|
synchronized (this.graphs) {
|
||||||
final Iterator<Graph> iter = this.graphs.iterator();
|
for (Graph graph : this.graphs) {
|
||||||
while (iter.hasNext()) {
|
|
||||||
final Graph graph = iter.next();
|
|
||||||
for (final Plotter plotter : graph.getPlotters()) {
|
for (final Plotter plotter : graph.getPlotters()) {
|
||||||
plotter.reset();
|
plotter.reset();
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,6 @@ import com.intellectualcrafters.plot.object.PlotId;
|
|||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Biome;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.ChatPaginator;
|
import org.bukkit.util.ChatPaginator;
|
||||||
|
|
||||||
@ -176,7 +175,7 @@ public class PlayerFunctions {
|
|||||||
return plots.get(id);
|
return plots.get(id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Plot(id, null, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName());
|
return new Plot(id, null, new ArrayList<UUID>(), new ArrayList<UUID>(), world.getName());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ import com.intellectualcrafters.plot.config.C;
|
|||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||||
import com.intellectualcrafters.plot.object.*;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
|
|
||||||
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;
|
||||||
@ -49,10 +47,10 @@ import java.util.UUID;
|
|||||||
*/
|
*/
|
||||||
@SuppressWarnings({"unused", "javadoc", "deprecation"})
|
@SuppressWarnings({"unused", "javadoc", "deprecation"})
|
||||||
public class PlotHelper {
|
public class PlotHelper {
|
||||||
|
public final static HashMap<Plot, Integer> runners = new HashMap<>();
|
||||||
public static boolean canSetFast = false;
|
public static boolean canSetFast = false;
|
||||||
public static boolean canSendChunk = false;
|
public static boolean canSendChunk = false;
|
||||||
public static ArrayList<String> runners_p = new ArrayList<>();
|
public static ArrayList<String> runners_p = new ArrayList<>();
|
||||||
public static HashMap<Plot, Integer> runners = new HashMap<>();
|
|
||||||
static long state = 1;
|
static long state = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -860,6 +858,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieve the location of the default plot home position
|
* Retrieve the location of the default plot home position
|
||||||
|
*
|
||||||
* @param plot Plot
|
* @param plot Plot
|
||||||
* @return the location
|
* @return the location
|
||||||
*/
|
*/
|
||||||
@ -871,6 +870,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plot home
|
* Get the plot home
|
||||||
|
*
|
||||||
* @param w World
|
* @param w World
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
* @return Plot Home Location
|
* @return Plot Home Location
|
||||||
@ -882,6 +882,7 @@ public class PlotHelper {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh the plot chunks
|
* Refresh the plot chunks
|
||||||
|
*
|
||||||
* @param world World in which the plot is located
|
* @param world World in which the plot is located
|
||||||
* @param plot Plot Object
|
* @param plot Plot Object
|
||||||
*/
|
*/
|
||||||
@ -903,16 +904,14 @@ public class PlotHelper {
|
|||||||
if (canSendChunk) {
|
if (canSendChunk) {
|
||||||
Chunk chunk = world.getChunkAt(x, z);
|
Chunk chunk = world.getChunkAt(x, z);
|
||||||
chunks.add(chunk);
|
chunks.add(chunk);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
world.refreshChunk(x, z);
|
world.refreshChunk(x, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
SendChunk.sendChunk(chunks);
|
SendChunk.sendChunk(chunks);
|
||||||
}
|
} catch (Throwable e) {
|
||||||
catch (Throwable e) {
|
|
||||||
canSendChunk = false;
|
canSendChunk = false;
|
||||||
for (int x = minChunkX; x <= maxChunkX; x++) {
|
for (int x = minChunkX; x <= maxChunkX; x++) {
|
||||||
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
for (int z = minChunkZ; z <= maxChunkZ; z++) {
|
||||||
|
@ -38,7 +38,7 @@ public class PlotSquaredException extends RuntimeException {
|
|||||||
public static enum PlotError {
|
public static enum PlotError {
|
||||||
PLOTMAIN_NULL("The PlotMain instance was null"),
|
PLOTMAIN_NULL("The PlotMain instance was null"),
|
||||||
MISSING_DEPENDENCY("Missing Dependency");
|
MISSING_DEPENDENCY("Missing Dependency");
|
||||||
private String errorHeader;
|
private final String errorHeader;
|
||||||
|
|
||||||
PlotError(final String errorHeader) {
|
PlotError(final String errorHeader) {
|
||||||
this.errorHeader = errorHeader;
|
this.errorHeader = errorHeader;
|
||||||
|
@ -426,7 +426,7 @@ public class ReflectionUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class RefExecutor {
|
public class RefExecutor {
|
||||||
Object e;
|
final Object e;
|
||||||
|
|
||||||
public RefExecutor(final Object e) {
|
public RefExecutor(final Object e) {
|
||||||
this.e = e;
|
this.e = e;
|
||||||
@ -530,7 +530,7 @@ public class ReflectionUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public class RefExecutor {
|
public class RefExecutor {
|
||||||
Object e;
|
final Object e;
|
||||||
|
|
||||||
public RefExecutor(final Object e) {
|
public RefExecutor(final Object e) {
|
||||||
this.e = e;
|
this.e = e;
|
||||||
|
@ -1,37 +1,50 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
|
||||||
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Chunk;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An utility that can be used to send chunks, rather than
|
||||||
|
* using bukkit code to do so (uses heavy NMS)
|
||||||
|
*
|
||||||
|
* @author Empire92
|
||||||
|
*/
|
||||||
public class SendChunk {
|
public class SendChunk {
|
||||||
|
|
||||||
|
// Ref Class
|
||||||
private static final RefClass classWorld = getRefClass("{nms}.World");
|
private static final RefClass classWorld = getRefClass("{nms}.World");
|
||||||
private static final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
private static final RefClass classEntityPlayer = getRefClass("{nms}.EntityPlayer");
|
||||||
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
|
private static final RefClass classChunkCoordIntPair = getRefClass("{nms}.ChunkCoordIntPair");
|
||||||
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
private static final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
private static final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
|
|
||||||
|
// Ref Method
|
||||||
private static RefMethod methodGetHandle;
|
private static RefMethod methodGetHandle;
|
||||||
|
|
||||||
|
// Ref Field
|
||||||
private static RefField chunkCoordIntPairQueue;
|
private static RefField chunkCoordIntPairQueue;
|
||||||
private static RefField players;
|
private static RefField players;
|
||||||
private static RefField locX;
|
private static RefField locX;
|
||||||
private static RefField locZ;
|
private static RefField locZ;
|
||||||
private static RefField world;
|
private static RefField world;
|
||||||
|
|
||||||
|
// Ref Constructor
|
||||||
private static RefConstructor ChunkCoordIntPairCon;
|
private static RefConstructor ChunkCoordIntPairCon;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Constructor
|
||||||
|
*
|
||||||
|
* @throws NoSuchMethodException
|
||||||
|
*/
|
||||||
public SendChunk() throws NoSuchMethodException {
|
public SendChunk() throws NoSuchMethodException {
|
||||||
methodGetHandle = classCraftChunk.getMethod("getHandle");
|
methodGetHandle = classCraftChunk.getMethod("getHandle");
|
||||||
chunkCoordIntPairQueue = classEntityPlayer.getField("chunkCoordIntPairQueue");
|
chunkCoordIntPairQueue = classEntityPlayer.getField("chunkCoordIntPairQueue");
|
||||||
|
@ -68,13 +68,14 @@ public class UUIDHandler {
|
|||||||
*
|
*
|
||||||
* @see org.bukkit.Server#getOnlineMode()
|
* @see org.bukkit.Server#getOnlineMode()
|
||||||
*/
|
*/
|
||||||
private static boolean online = Bukkit.getServer().getOnlineMode();
|
private final static boolean online = Bukkit.getServer().getOnlineMode();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Map containing names and UUIDs
|
* Map containing names and UUIDs
|
||||||
|
*
|
||||||
* @see com.google.common.collect.BiMap
|
* @see com.google.common.collect.BiMap
|
||||||
*/
|
*/
|
||||||
private static BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
private final static BiMap<StringWrapper, UUID> uuidMap = HashBiMap.create(new HashMap<StringWrapper, UUID>());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the map containing all names/uuids
|
* Get the map containing all names/uuids
|
||||||
|
@ -7,9 +7,9 @@ package com.intellectualsites.translation;
|
|||||||
*/
|
*/
|
||||||
public class TranslationAsset {
|
public class TranslationAsset {
|
||||||
|
|
||||||
private TranslationObject trans;
|
private final TranslationObject trans;
|
||||||
private String translated;
|
private final String translated;
|
||||||
private TranslationLanguage lang;
|
private final TranslationLanguage lang;
|
||||||
|
|
||||||
public TranslationAsset(TranslationObject trans, String translated, TranslationLanguage lang) {
|
public TranslationAsset(TranslationObject trans, String translated, TranslationLanguage lang) {
|
||||||
this.trans = trans;
|
this.trans = trans;
|
||||||
|
@ -2,9 +2,17 @@ package com.intellectualsites.translation;
|
|||||||
|
|
||||||
public class TranslationLanguage {
|
public class TranslationLanguage {
|
||||||
|
|
||||||
private String countryCode;
|
public static final TranslationLanguage englishAmerican
|
||||||
private String languageCode;
|
= (new TranslationLanguage("American English", "us", "en"));
|
||||||
private String friendlyName;
|
public static final TranslationLanguage englishBritish
|
||||||
|
= (new TranslationLanguage("British English", "gb", "en"));
|
||||||
|
public static final TranslationLanguage swedishSwedish
|
||||||
|
= (new TranslationLanguage("Swedish", "sv", "se"));
|
||||||
|
public static final TranslationLanguage russianRussian
|
||||||
|
= (new TranslationLanguage("Russian", "ru", "ru"));
|
||||||
|
private final String countryCode;
|
||||||
|
private final String languageCode;
|
||||||
|
private final String friendlyName;
|
||||||
|
|
||||||
public TranslationLanguage(String friendlyName, String countryCode, String languageCode) {
|
public TranslationLanguage(String friendlyName, String countryCode, String languageCode) {
|
||||||
this.friendlyName = friendlyName;
|
this.friendlyName = friendlyName;
|
||||||
@ -12,6 +20,14 @@ public class TranslationLanguage {
|
|||||||
this.languageCode = languageCode;
|
this.languageCode = languageCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static TranslationLanguage[] values() {
|
||||||
|
return new TranslationLanguage[]{
|
||||||
|
englishAmerican,
|
||||||
|
englishBritish,
|
||||||
|
swedishSwedish
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return friendlyName;
|
return friendlyName;
|
||||||
}
|
}
|
||||||
@ -29,22 +45,4 @@ public class TranslationLanguage {
|
|||||||
/* en_US */
|
/* en_US */
|
||||||
return languageCode.toLowerCase() + "_" + countryCode.toUpperCase();
|
return languageCode.toLowerCase() + "_" + countryCode.toUpperCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final TranslationLanguage englishAmerican
|
|
||||||
= (new TranslationLanguage("American English", "us", "en"));
|
|
||||||
public static final TranslationLanguage englishBritish
|
|
||||||
= (new TranslationLanguage("British English", "gb", "en"));
|
|
||||||
public static final TranslationLanguage swedishSwedish
|
|
||||||
= (new TranslationLanguage("Swedish", "sv", "se"));
|
|
||||||
public static final TranslationLanguage russianRussian
|
|
||||||
= (new TranslationLanguage("Russian", "ru", "ru"));
|
|
||||||
|
|
||||||
|
|
||||||
public static TranslationLanguage[] values() {
|
|
||||||
return new TranslationLanguage[]{
|
|
||||||
englishAmerican,
|
|
||||||
englishBritish,
|
|
||||||
swedishSwedish
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,13 @@ import java.util.*;
|
|||||||
public class TranslationManager {
|
public class TranslationManager {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The instance
|
* Objects
|
||||||
*/
|
*/
|
||||||
private TranslationManager instance;
|
private final LinkedList<TranslationObject> translationObjects;
|
||||||
|
/**
|
||||||
|
* The translations
|
||||||
|
*/
|
||||||
|
private final LinkedHashMap<String, TranslationAsset> translatedObjects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -24,34 +28,6 @@ public class TranslationManager {
|
|||||||
this(new TranslationObject[]{});
|
this(new TranslationObject[]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Don't use this!
|
|
||||||
*
|
|
||||||
* @return this
|
|
||||||
*/
|
|
||||||
public TranslationManager instance() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Objects
|
|
||||||
*/
|
|
||||||
private LinkedList<TranslationObject> translationObjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The translations
|
|
||||||
*/
|
|
||||||
private LinkedHashMap<String, TranslationAsset> translatedObjects;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get the translation objects
|
|
||||||
*
|
|
||||||
* @return objects
|
|
||||||
*/
|
|
||||||
public List<TranslationObject> translations() {
|
|
||||||
return translationObjects;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -62,7 +38,56 @@ public class TranslationManager {
|
|||||||
= new LinkedList<TranslationObject>(Arrays.asList(translationObjects));
|
= new LinkedList<TranslationObject>(Arrays.asList(translationObjects));
|
||||||
this.translatedObjects
|
this.translatedObjects
|
||||||
= new LinkedHashMap<String, TranslationAsset>();
|
= new LinkedHashMap<String, TranslationAsset>();
|
||||||
instance = this;
|
}
|
||||||
|
|
||||||
|
public static List<TranslationObject> transformEnum(Object[] os) {
|
||||||
|
List<TranslationObject> eList = new ArrayList<TranslationObject>();
|
||||||
|
for (Object o : os) {
|
||||||
|
eList.add(
|
||||||
|
new TranslationObject(o.toString(), o.toString().toLowerCase().replace("_", " "), "", "")
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return eList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void scan(Class c, TranslationManager manager) throws IllegalAccessException {
|
||||||
|
Field[] fields = c.getDeclaredFields();
|
||||||
|
Annotation annotation;
|
||||||
|
for (Field field : fields) {
|
||||||
|
if (field.getType() != String.class || (annotation = field.getAnnotation(Translation.class)) == null)
|
||||||
|
continue;
|
||||||
|
Translation t = (Translation) annotation;
|
||||||
|
String key = field.getName();
|
||||||
|
// Make sure we can get the value
|
||||||
|
field.setAccessible(true);
|
||||||
|
String defaultValue = (String) field.get(c);
|
||||||
|
manager.addTranslationObject(
|
||||||
|
new TranslationObject(
|
||||||
|
key,
|
||||||
|
defaultValue,
|
||||||
|
t.description(),
|
||||||
|
t.creationDescription()
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Don't use this!
|
||||||
|
*
|
||||||
|
* @return this
|
||||||
|
*/
|
||||||
|
public TranslationManager instance() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the translation objects
|
||||||
|
*
|
||||||
|
* @return objects
|
||||||
|
*/
|
||||||
|
public List<TranslationObject> translations() {
|
||||||
|
return translationObjects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -149,38 +174,6 @@ public class TranslationManager {
|
|||||||
return instance();
|
return instance();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static List<TranslationObject> transformEnum(Object[] os) {
|
|
||||||
List<TranslationObject> eList = new ArrayList<TranslationObject>();
|
|
||||||
for (Object o : os) {
|
|
||||||
eList.add(
|
|
||||||
new TranslationObject(o.toString(), o.toString().toLowerCase().replace("_", " "), "", "")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
return eList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void scan(Class c, TranslationManager manager) throws IllegalAccessException {
|
|
||||||
Field[] fields = c.getDeclaredFields();
|
|
||||||
Annotation annotation;
|
|
||||||
for (Field field : fields) {
|
|
||||||
if (field.getType() != String.class || (annotation = field.getAnnotation(Translation.class)) == null)
|
|
||||||
continue;
|
|
||||||
Translation t = (Translation) annotation;
|
|
||||||
String key = field.getName();
|
|
||||||
// Make sure we can get the value
|
|
||||||
field.setAccessible(true);
|
|
||||||
String defaultValue = (String) field.get(c);
|
|
||||||
manager.addTranslationObject(
|
|
||||||
new TranslationObject(
|
|
||||||
key,
|
|
||||||
defaultValue,
|
|
||||||
t.description(),
|
|
||||||
t.creationDescription()
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public TranslationManager debug(PrintStream out) {
|
public TranslationManager debug(PrintStream out) {
|
||||||
for (TranslationObject object : translations()) {
|
for (TranslationObject object : translations()) {
|
||||||
out.println(object.getKey() + ":");
|
out.println(object.getKey() + ":");
|
||||||
|
@ -31,7 +31,6 @@ public class TranslationObject {
|
|||||||
}
|
}
|
||||||
this.key = key.toLowerCase();
|
this.key = key.toLowerCase();
|
||||||
this.defaultValue = defaultValue.replace("\n", "&-");
|
this.defaultValue = defaultValue.replace("\n", "&-");
|
||||||
;
|
|
||||||
this.description = description;
|
this.description = description;
|
||||||
this.creationDescription = creationDescription;
|
this.creationDescription = creationDescription;
|
||||||
}
|
}
|
||||||
|
@ -19,23 +19,18 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public class YamlTranslationFile extends TranslationFile {
|
public class YamlTranslationFile extends TranslationFile {
|
||||||
|
|
||||||
private File path;
|
final private TranslationLanguage language;
|
||||||
private TranslationLanguage language;
|
final private String name;
|
||||||
private String name;
|
final private TranslationManager manager;
|
||||||
private File file;
|
private File file;
|
||||||
private HashMap<String, String> map;
|
private HashMap<String, String> map;
|
||||||
private String[] header;
|
private String[] header;
|
||||||
private boolean fancyHead = false;
|
private boolean fancyHead = false;
|
||||||
private YamlTranslationFile instance;
|
private YamlTranslationFile instance;
|
||||||
private TranslationManager manager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reload
|
* YAML Object
|
||||||
*/
|
*/
|
||||||
public void reload() {
|
private Yaml yaml;
|
||||||
this.map = new HashMap<String, String>();
|
|
||||||
this.read();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
@ -45,7 +40,6 @@ public class YamlTranslationFile extends TranslationFile {
|
|||||||
* @param name project name
|
* @param name project name
|
||||||
*/
|
*/
|
||||||
public YamlTranslationFile(File path, TranslationLanguage language, String name, TranslationManager manager) {
|
public YamlTranslationFile(File path, TranslationLanguage language, String name, TranslationManager manager) {
|
||||||
this.path = path;
|
|
||||||
this.language = language;
|
this.language = language;
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.manager = manager;
|
this.manager = manager;
|
||||||
@ -68,6 +62,14 @@ public class YamlTranslationFile extends TranslationFile {
|
|||||||
this.instance = this;
|
this.instance = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reload
|
||||||
|
*/
|
||||||
|
public void reload() {
|
||||||
|
this.map = new HashMap<String, String>();
|
||||||
|
this.read();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the header
|
* Set the header
|
||||||
*
|
*
|
||||||
@ -164,11 +166,6 @@ public class YamlTranslationFile extends TranslationFile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* YAML Object
|
|
||||||
*/
|
|
||||||
private Yaml yaml;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the YAML object
|
* Get the YAML object
|
||||||
*
|
*
|
||||||
|
@ -125,8 +125,8 @@ public class Test1 {
|
|||||||
boolean passed = false;
|
boolean passed = false;
|
||||||
try {
|
try {
|
||||||
Object plot = new Plot(new PlotId(0, 0), DBFunc.everyone, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), null, PlotHomePosition.DEFAULT, null, "testworld", new boolean[]{false, false, false, false});
|
Object plot = new Plot(new PlotId(0, 0), DBFunc.everyone, Biome.FOREST, new ArrayList<UUID>(), new ArrayList<UUID>(), new ArrayList<UUID>(), null, PlotHomePosition.DEFAULT, null, "testworld", new boolean[]{false, false, false, false});
|
||||||
passed = plot != null;
|
passed = true;
|
||||||
} catch (Throwable e) {
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
return passed;
|
return passed;
|
||||||
@ -223,7 +223,6 @@ public class Test1 {
|
|||||||
plots.get("testworld").put(id,
|
plots.get("testworld").put(id,
|
||||||
new Plot(id,
|
new Plot(id,
|
||||||
DBFunc.everyone,
|
DBFunc.everyone,
|
||||||
Biome.FOREST,
|
|
||||||
new ArrayList<UUID>(),
|
new ArrayList<UUID>(),
|
||||||
new ArrayList<UUID>(),
|
new ArrayList<UUID>(),
|
||||||
new ArrayList<UUID>(),
|
new ArrayList<UUID>(),
|
||||||
|
Loading…
Reference in New Issue
Block a user