mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-27 03:04:43 +02:00
Merge branch 'feature/rm-redundant-methods' of https://github.com/manuelgu/PlotSquared into manuelgu-feature/rm-redundant-methods
This commit is contained in:
@ -87,7 +87,6 @@ import org.bukkit.generator.ChunkGenerator;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
@ -97,12 +96,12 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
|
||||
|
||||
public static BukkitMain THIS;
|
||||
public static WorldEditPlugin worldEdit;
|
||||
|
||||
|
||||
private int[] version;
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getServerVersion() {
|
||||
if (version == null) {
|
||||
@ -123,20 +122,20 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
THIS = this;
|
||||
new PS(this, "Bukkit");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
PS.get().disable();
|
||||
Bukkit.getScheduler().cancelTasks(this);
|
||||
THIS = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void log(String message) {
|
||||
if ((THIS != null) && (Bukkit.getServer().getConsoleSender() != null)) {
|
||||
@ -151,20 +150,20 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
System.out.println(ConsoleColors.fromString(message));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void disable() {
|
||||
if (THIS != null) {
|
||||
onDisable();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int[] getPluginVersion() {
|
||||
final String[] split = getDescription().getVersion().split("\\.");
|
||||
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), Integer.parseInt(split[2]) };
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerCommands() {
|
||||
final BukkitCommand bcmd = new BukkitCommand();
|
||||
@ -174,25 +173,25 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
plotCommand.setTabCompleter(bcmd);
|
||||
MainCommand.getInstance().addCommand(new DebugUUID());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public File getDirectory() {
|
||||
return getDataFolder();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public File getWorldContainer() {
|
||||
return Bukkit.getWorldContainer();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public TaskManager getTaskManager() {
|
||||
return new BukkitTaskManager();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void runEntityTask() {
|
||||
log(C.PREFIX.s() + "KillAllEntities started.");
|
||||
log(C.PREFIX + "KillAllEntities started.");
|
||||
TaskManager.runTaskRepeat(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -335,7 +334,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
|
||||
final HybridGen result = new HybridGen();
|
||||
@ -344,7 +343,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return (ChunkGenerator) result.specify();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerPlayerEvents() {
|
||||
getServer().getPluginManager().registerEvents(new PlayerEvents(), this);
|
||||
@ -355,23 +354,23 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
getServer().getPluginManager().registerEvents(new PlayerEvents_1_8_3(), this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerInventoryEvents() {
|
||||
// Part of PlayerEvents - can be moved if necessary
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerPlotPlusEvents() {
|
||||
PlotPlusListener.startRunnable(this);
|
||||
getServer().getPluginManager().registerEvents(new PlotPlusListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerForceFieldEvents() {
|
||||
getServer().getPluginManager().registerEvents(new ForceFieldListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean initWorldEdit() {
|
||||
if (getServer().getPluginManager().getPlugin("WorldEdit") != null) {
|
||||
@ -388,7 +387,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EconHandler getEconomyHandler() {
|
||||
try {
|
||||
@ -400,7 +399,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PlotQueue initPlotQueue() {
|
||||
try {
|
||||
@ -439,12 +438,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
return new SlowQueue();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public WorldUtil initWorldUtil() {
|
||||
return new BukkitUtil();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean initPlotMeConverter() {
|
||||
TaskManager.runTaskLaterAsync(new Runnable() {
|
||||
@ -463,7 +462,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}, 20);
|
||||
return (Bukkit.getPluginManager().getPlugin("PlotMe") != null) || (Bukkit.getPluginManager().getPlugin("AthionPlots") != null);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GeneratorWrapper<?> getGenerator(final String world, final String name) {
|
||||
if (name == null) {
|
||||
@ -480,17 +479,17 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
return new BukkitPlotGenerator(new HybridGen());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public HybridUtils initHybridUtils() {
|
||||
return new BukkitHybridUtils();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SetupUtils initSetupUtils() {
|
||||
return new BukkitSetupUtils();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public UUIDHandlerImplementation initUUIDHandler() {
|
||||
final boolean checkVersion = PS.get().checkVersion(getServerVersion(), 1, 7, 6);
|
||||
@ -514,7 +513,7 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
Settings.OFFLINE_MODE = true;
|
||||
}
|
||||
if (!checkVersion) {
|
||||
log(C.PREFIX.s() + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||
log(C.PREFIX + " &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
|
||||
Settings.TITLES = false;
|
||||
FlagManager.removeFlag(FlagManager.getFlag("titles"));
|
||||
} else {
|
||||
@ -524,59 +523,59 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
}
|
||||
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");
|
||||
log(C.PREFIX + " &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");
|
||||
log(C.PREFIX + " &6PlotSquared is using online UUIDs");
|
||||
}
|
||||
return Settings.USE_SQLUUIDHANDLER ? new SQLUUIDHandler(wrapper) : new FileUUIDHandler(wrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChunkManager initChunkManager() {
|
||||
return new BukkitChunkManager();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public EventUtil initEventUtil() {
|
||||
return new BukkitEventUtil();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void unregister(final PlotPlayer player) {
|
||||
BukkitUtil.removePlayer(player.getName());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerChunkProcessor() {
|
||||
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerWorldEvents() {
|
||||
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InventoryUtil initInventoryUtil() {
|
||||
return new BukkitInventoryUtil();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getServerName() {
|
||||
return Bukkit.getServerName();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void startMetrics() {
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
log(C.PREFIX.s() + "&6Metrics enabled.");
|
||||
log(C.PREFIX + "&6Metrics enabled.");
|
||||
} catch (IOException e) {
|
||||
log(C.PREFIX.s() + "&cFailed to load up metrics.");
|
||||
log(C.PREFIX + "&cFailed to load up metrics.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void setGenerator(final String worldname) {
|
||||
World world = BukkitUtil.getWorld(worldname);
|
||||
@ -615,18 +614,18 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
PS.get().loadWorld(worldname, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public SchematicHandler initSchematicHandler() {
|
||||
return new BukkitSchematicHandler();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public AbstractTitle initTitleManager() {
|
||||
// Already initialized in UUID handler
|
||||
return AbstractTitle.TITLE_CLASS;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public PlotPlayer wrapPlayer(final Object obj) {
|
||||
if (obj instanceof Player) {
|
||||
@ -640,13 +639,13 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getNMSPackage() {
|
||||
String name = Bukkit.getServer().getClass().getPackage().getName();
|
||||
return name.substring(name.lastIndexOf('.') + 1);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ChatManager<?> initChatManager() {
|
||||
if (Settings.FANCY_CHAT) {
|
||||
@ -655,12 +654,12 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
return new BukkitPlainChatManager();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public GeneratorWrapper<?> wrapPlotGenerator(IndependentPlotGenerator generator) {
|
||||
return new BukkitPlotGenerator(generator);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getPluginIds() {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
|
@ -42,7 +42,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
|
||||
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
|
||||
import com.plotsquared.general.commands.Argument;
|
||||
import com.plotsquared.general.commands.CommandDeclaration;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.IOException;
|
||||
@ -63,16 +62,16 @@ usage = "/plot uuidconvert <lower|offline|online>",
|
||||
requiredType = RequiredType.CONSOLE,
|
||||
category = CommandCategory.DEBUG)
|
||||
public class DebugUUID extends SubCommand {
|
||||
|
||||
|
||||
public DebugUUID() {
|
||||
requiredArguments = new Argument[] { Argument.String };
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean onCommand(final PlotPlayer player, final String[] args) {
|
||||
final UUIDWrapper currentUUIDWrapper = UUIDHandler.getUUIDWrapper();
|
||||
final UUIDWrapper newWrapper;
|
||||
|
||||
|
||||
switch (args[0].toLowerCase()) {
|
||||
case "lower":
|
||||
newWrapper = new LowerOfflineUUIDWrapper();
|
||||
@ -104,7 +103,7 @@ public class DebugUUID extends SubCommand {
|
||||
MainUtil.sendMessage(player, "&7Retype the command with the override parameter when ready :)");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (currentUUIDWrapper.getClass().getCanonicalName().equals(newWrapper.getClass().getCanonicalName())) {
|
||||
MainUtil.sendMessage(player, "&cUUID mode already in use!");
|
||||
return false;
|
||||
@ -114,14 +113,14 @@ public class DebugUUID extends SubCommand {
|
||||
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||
entry.getValue().kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished.");
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Initializing map");
|
||||
|
||||
final HashMap<UUID, UUID> uCMap = new HashMap<>();
|
||||
final HashMap<UUID, UUID> uCReverse = new HashMap<>();
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Collecting playerdata");
|
||||
|
||||
|
||||
final HashSet<String> worlds = new HashSet<>();
|
||||
worlds.add(WorldUtil.IMP.getMainWorld());
|
||||
worlds.add("world");
|
||||
@ -142,7 +141,7 @@ public class DebugUUID extends SubCommand {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
uuids.add(uuid);
|
||||
} catch (final Exception e) {
|
||||
MainUtil.sendMessage(player, C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||
MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current);
|
||||
}
|
||||
}
|
||||
final File playersFolder = new File(worldname + File.separator + "players");
|
||||
@ -158,7 +157,7 @@ public class DebugUUID extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Populating map");
|
||||
UUID uuid2;
|
||||
final UUIDWrapper wrapper = new DefaultUUIDWrapper();
|
||||
@ -172,7 +171,7 @@ public class DebugUUID extends SubCommand {
|
||||
uCReverse.put(uuid2, uuid);
|
||||
}
|
||||
} catch (final Throwable e) {
|
||||
MainUtil.sendMessage(player, C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||
MainUtil.sendMessage(player, C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||
}
|
||||
}
|
||||
for (final String name : names) {
|
||||
@ -204,7 +203,7 @@ public class DebugUUID extends SubCommand {
|
||||
MainUtil.sendMessage(player, "&a - Successfully repopulated");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Replacing cache");
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
@ -215,9 +214,9 @@ public class DebugUUID extends SubCommand {
|
||||
UUIDHandler.add(new StringWrapper(name), entry.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Scanning for applicable files (uuids.txt)");
|
||||
|
||||
|
||||
final File file = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (file.exists()) {
|
||||
try {
|
||||
@ -250,12 +249,12 @@ public class DebugUUID extends SubCommand {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Replacing wrapper");
|
||||
UUIDHandler.setUUIDWrapper(newWrapper);
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Updating plot objects");
|
||||
|
||||
|
||||
for (final Plot plot : PS.get().getPlots()) {
|
||||
final UUID value = uCMap.get(plot.owner);
|
||||
if (value != null) {
|
||||
@ -265,13 +264,13 @@ public class DebugUUID extends SubCommand {
|
||||
plot.getMembers().clear();
|
||||
plot.getDenied().clear();
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Deleting database");
|
||||
final AbstractDB database = DBFunc.dbManager;
|
||||
final boolean result = database.deleteTables();
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Creating tables");
|
||||
|
||||
|
||||
try {
|
||||
database.createTables();
|
||||
if (!result) {
|
||||
@ -294,7 +293,7 @@ public class DebugUUID extends SubCommand {
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (newWrapper instanceof OfflineUUIDWrapper) {
|
||||
PS.get().config.set("UUID.force-lowercase", false);
|
||||
PS.get().config.set("UUID.offline", true);
|
||||
@ -307,9 +306,9 @@ public class DebugUUID extends SubCommand {
|
||||
} catch (IOException e) {
|
||||
MainUtil.sendMessage(player, "Could not save configuration. It will need to be manuall set!");
|
||||
}
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&7 - Populating tables");
|
||||
|
||||
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
@ -322,7 +321,7 @@ public class DebugUUID extends SubCommand {
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
MainUtil.sendMessage(player, "&aIt is now safe for players to join");
|
||||
MainUtil.sendMessage(player, "&cConversion is still in progress, you will be notified when it is complete");
|
||||
}
|
||||
|
@ -10,12 +10,15 @@ import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
import com.plotsquared.bukkit.util.NbtFactory;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FilenameFilter;
|
||||
@ -28,16 +31,16 @@ import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
|
||||
public FileUUIDHandler(final UUIDWrapper wrapper) {
|
||||
super(wrapper);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean startCaching(final Runnable whenDone) {
|
||||
return super.startCaching(whenDone) && cache(whenDone);
|
||||
}
|
||||
|
||||
|
||||
public boolean cache(final Runnable whenDone) {
|
||||
final File container = Bukkit.getWorldContainer();
|
||||
final List<World> worlds = Bukkit.getWorlds();
|
||||
@ -50,7 +53,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
PS.debug(C.PREFIX.s() + "&6Starting player data caching for: " + world);
|
||||
PS.debug(C.PREFIX + "&6Starting player data caching for: " + world);
|
||||
final File uuidfile = new File(PS.get().IMP.getDirectory(), "uuids.txt");
|
||||
if (uuidfile.exists()) {
|
||||
try {
|
||||
@ -112,7 +115,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
e.printStackTrace();
|
||||
PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||
PS.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -150,7 +153,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
uuids.add(uuid);
|
||||
} catch (final Exception e) {
|
||||
PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current);
|
||||
PS.debug(C.PREFIX + "Invalid playerdata: " + current);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -195,7 +198,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
} catch (final Throwable e) {
|
||||
PS.debug(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||
PS.debug(C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||
}
|
||||
}
|
||||
for (final String name : names) {
|
||||
@ -226,7 +229,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
|
@ -30,7 +30,7 @@ import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
|
||||
final String PROFILE_URL = "https://sessionserver.mojang.com/session/minecraft/profile/";
|
||||
final int MAX_REQUESTS = 500;
|
||||
final int INTERVAL = 12000;
|
||||
@ -56,13 +56,13 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
startCaching(null);
|
||||
}
|
||||
|
||||
|
||||
private Connection getConnection() {
|
||||
synchronized (_sqLite) {
|
||||
return _sqLite.getConnection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean startCaching(final Runnable whenDone) {
|
||||
if (!super.startCaching(whenDone)) {
|
||||
@ -192,10 +192,10 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void fetchUUID(final String name, final RunnableVal<UUID> ifFetch) {
|
||||
PS.debug(C.PREFIX.s() + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!");
|
||||
PS.debug(C.PREFIX + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!");
|
||||
if (ifFetch == null) {
|
||||
return;
|
||||
}
|
||||
@ -227,7 +227,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void handleShutdown() {
|
||||
super.handleShutdown();
|
||||
@ -237,7 +237,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
throw new SQLUUIDHandlerException("Couldn't close database connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean add(final StringWrapper name, final UUID uuid) {
|
||||
// Ignoring duplicates
|
||||
@ -250,7 +250,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, uuid.toString());
|
||||
statement.setString(2, name.toString());
|
||||
statement.execute();
|
||||
PS.debug(C.PREFIX.s() + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
PS.debug(C.PREFIX + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
|
||||
} catch (final SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* This is useful for name changes
|
||||
*/
|
||||
@ -275,7 +275,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, name.value);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.execute();
|
||||
PS.debug(C.PREFIX.s() + "Name change for '" + uuid + "' to '" + name.value + "'");
|
||||
PS.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + "'");
|
||||
} catch (final SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
Reference in New Issue
Block a user