This commit is contained in:
boy0001 2015-02-23 10:12:33 +11:00
parent a5731d94be
commit 22700aa88b
7 changed files with 57 additions and 12 deletions

View File

@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.PlotMeConverter;
import com.intellectualcrafters.plot.events.PlotDeleteEvent;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.BukkitHybridUtils;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridUtils;
@ -39,6 +40,8 @@ import com.intellectualcrafters.plot.listeners.PlayerEvents_1_8;
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
import com.intellectualcrafters.plot.listeners.WorldEditListener;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.titles.AbstractTitle;
import com.intellectualcrafters.plot.titles.DefaultTitle;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ConsoleColors;
import com.intellectualcrafters.plot.util.MainUtil;
@ -54,6 +57,9 @@ import com.intellectualcrafters.plot.util.bukkit.SetBlockFast_1_8;
import com.intellectualcrafters.plot.util.bukkit.SetBlockManager;
import com.intellectualcrafters.plot.util.bukkit.SetBlockSlow;
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@ -102,8 +108,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void onEnable() {
MAIN = new PlotSquared(this);
THIS = this;
MAIN = new PlotSquared(this);
if (Settings.METRICS) {
try {
final Metrics metrics = new Metrics(this);
@ -127,6 +133,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
public void log(String message) {
message = message.replaceAll("\u00B2", "2");
if ((THIS == null) || (Bukkit.getServer().getConsoleSender() == null)) {
System.out.println(ChatColor.stripColor(ConsoleColors.fromString(message)));
} else {
@ -337,4 +344,36 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
public SetupUtils initSetupUtils() {
return new BukkitSetupUtils();
}
@Override
public UUIDWrapper initUUIDHandler() {
boolean checkVersion = checkVersion(1, 7, 6);
if (!checkVersion) {
log(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false;
FlagManager.removeFlag(FlagManager.getFlag("titles"));
}
else {
AbstractTitle.TITLE_CLASS = new DefaultTitle();
}
if (Settings.OFFLINE_MODE) {
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
Settings.OFFLINE_MODE = true;
}
else if (checkVersion) {
UUIDHandler.uuidWrapper = new DefaultUUIDWrapper();
Settings.OFFLINE_MODE = false;
}
else {
UUIDHandler.uuidWrapper = new OfflineUUIDWrapper();
Settings.OFFLINE_MODE = true;
}
if (Settings.OFFLINE_MODE) {
log(C.PREFIX.s()+" &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit");
}
else {
log(C.PREFIX.s()+" &6PlotSquared is using online UUIDs");
}
return UUIDHandler.uuidWrapper;
}
}

View File

@ -9,6 +9,7 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
public interface IPlotMain {
public void log(String message);
@ -43,6 +44,8 @@ public interface IPlotMain {
public HybridUtils initHybridUtils();
public UUIDWrapper initUUIDHandler();
public boolean initPlotMeConverter();
public void getGenerator(String world, String name);

View File

@ -437,6 +437,8 @@ public class PlotSquared {
IMP.registerPlotPlusEvents();
IMP.registerForceFieldEvents();
IMP.registerWorldEditEvents();
// create UUIDWrapper
UUIDHandler.uuidWrapper = IMP.initUUIDHandler();
// create Hybrid utility class
HybridUtils.manager = IMP.initHybridUtils();
// create setup util class
@ -771,9 +773,6 @@ public class PlotSquared {
storage.set(node.getKey(), node.getValue());
}
}
}
public static void showDebug() {
Settings.DB.USE_MYSQL = storage.getBoolean("mysql.use");
Settings.DB.USER = storage.getString("mysql.user");
Settings.DB.PASSWORD = storage.getString("mysql.password");
@ -790,10 +789,13 @@ public class PlotSquared {
Settings.API_URL = config.getString("uuid.api.location");
Settings.CUSTOM_API = config.getBoolean("uuid.api.custom");
Settings.UUID_FECTHING = config.getBoolean("uuid.fetching");
C.COLOR_1 = "\u00A7" + (style.getString("color.1"));
C.COLOR_2 = "\u00A7" + (style.getString("color.2"));
C.COLOR_3 = "\u00A7" + (style.getString("color.3"));
C.COLOR_4 = "\u00A7" + (style.getString("color.4"));
}
public static void showDebug() {
C.COLOR_1 = "&" + (style.getString("color.1"));
C.COLOR_2 = "&" + (style.getString("color.2"));
C.COLOR_3 = "&" + (style.getString("color.3"));
C.COLOR_4 = "&" + (style.getString("color.4"));
if (Settings.DEBUG) {
final Map<String, String> settings = new HashMap<>();
settings.put("Kill Road Mobs", "" + Settings.KILL_ROAD_MOBS);

View File

@ -53,7 +53,7 @@ public class Claim extends SubCommand {
// final PlayerClaimPlotEvent event = new PlayerClaimPlotEvent(player, plot, auto);
// Bukkit.getPluginManager().callEvent(event);
// boolean result = event.isCancelled();
boolean result = true;
boolean result = false;
if (!result) {
MainUtil.createPlot(player.getUUID(), plot);

View File

@ -84,6 +84,7 @@ public class MainCommand {
}
final List<String> help = new ArrayList<>();
help.add(C.HELP_HEADER.s());
System.out.print(C.HELP_HEADER.s());
// HELP_CATEGORY("&cCategory: &6%category%&c, Page: %current%&c/&6%max%&c, Displaying: &6%dis%&c/&6%total%"),
help.add(C.HELP_CATEGORY.s().replace("%category%", category == null ? "All" : category.toString()).replace("%current%", "" + (page + 1)).replace("%max%", "" + (totalPages + 1)).replace("%dis%", "" + (commands.size() % perPage)).replace("%total%", "" + commands.size()));
SubCommand cmd;
@ -158,7 +159,7 @@ public class MainCommand {
for (final String string : helpMenu(player, cato, page)) {
help.append(string).append("\n");
}
player.sendMessage(MainUtil.colorise('&', help.toString()));
MainUtil.sendMessage(player, help.toString());
// return PlayerFunctions.sendMessage(player, help.toString());
} else {
for (final SubCommand command : subCommands) {

View File

@ -444,7 +444,7 @@ public enum C {
* @see com.intellectualsites.translation.TranslationLanguage
*/
protected final static TranslationLanguage lang = new TranslationLanguage("PlotSquared", "this", "use");
public static String COLOR_1 = "\u00A76", COLOR_2 = "\u00A77", COLOR_3 = "\u00A78", COLOR_4 = "\u00A73";
public static String COLOR_1 = "&6", COLOR_2 = "&7", COLOR_3 = "&8", COLOR_4 = "&3";
/**
* The TranslationManager
*

View File

@ -1,5 +1,5 @@
name: ${project.name}
main: com.intellectualcrafters.plot.PlotSquared
main: com.intellectualcrafters.plot.BukkitMain
version: ${project.version}
load: STARTUP
description: >