mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-23 12:06:15 +01:00
worldborder + offline player conversion
This commit is contained in:
parent
3f92b43ccf
commit
1837a9a247
@ -24,7 +24,6 @@ package com.intellectualcrafters.plot.commands;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
@ -35,7 +34,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.util.PlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
|
||||
@SuppressWarnings("deprecation") public class Helpers extends SubCommand {
|
||||
public class Helpers extends SubCommand {
|
||||
|
||||
public Helpers() {
|
||||
super(Command.HELPERS, "Manage plot helpers", "helpers {add|remove} {player}", CommandCategory.ACTIONS, true);
|
||||
|
@ -39,7 +39,7 @@ public class plugin extends SubCommand {
|
||||
public static String downloads, version;
|
||||
|
||||
public plugin() {
|
||||
super("plugin", "plots.use", "Show plugin information", "plugin", "pl", CommandCategory.INFO, false);
|
||||
super("plugin", "plots.use", "Show plugin information", "plugin", "version", CommandCategory.INFO, false);
|
||||
}
|
||||
|
||||
public static void setup(final JavaPlugin plugin) {
|
||||
@ -99,7 +99,7 @@ public class plugin extends SubCommand {
|
||||
{
|
||||
add(String.format("&c>> &6PlotSquared (Version: %s)", PlotMain.getMain().getDescription().getVersion()));
|
||||
add(String.format("&c>> &6Made by Citymonstret and Empire92"));
|
||||
add(String.format("&c>> &6Download at &lhttp://i-s.link/ps"));
|
||||
add(String.format("&c>> &6Download at &lhttp://www.spigotmc.org/resources/1177"));
|
||||
add(String.format("&c>> &cNewest Version (Spigot): %s", version));
|
||||
add(String.format("&c>> &cTotal Downloads (Spigot): %s", downloads));
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.database;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.sql.Connection;
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.ResultSet;
|
||||
@ -119,8 +120,15 @@ public class PlotMeConverter {
|
||||
if (name.equals("*")) {
|
||||
owner = DBFunc.everyone;
|
||||
} else {
|
||||
sendMessage("&cCould not identify owner for plot: " + id);
|
||||
continue;
|
||||
try {
|
||||
UUID uuid = uuidFromBytes(r.getBytes("ownerId"));
|
||||
owner = UUIDHandler.getUUID(UUIDHandler.getName(uuid));
|
||||
}
|
||||
catch (Exception e) {}
|
||||
if (owner == null) {
|
||||
sendMessage("&cCould not identify owner for plot: " + id +" -> " + name);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
final Plot plot = new Plot(id, owner, new ArrayList<UUID>(), new ArrayList<UUID>(), world);
|
||||
@ -311,4 +319,10 @@ public class PlotMeConverter {
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
private UUID uuidFromBytes(byte[] byteArray) {
|
||||
ByteBuffer wrapped = ByteBuffer.wrap(byteArray);
|
||||
long minor = wrapped.getLong();
|
||||
long major = wrapped.getLong();
|
||||
return new UUID(major, minor);
|
||||
}
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
|
||||
}
|
||||
String worldname = q.getWorld().getName();
|
||||
if (PlotHelper.worldBorder.containsKey(worldname)) {
|
||||
int border = PlotHelper.worldBorder.get(worldname);
|
||||
int border = PlotHelper.getBorder(worldname);
|
||||
boolean passed = false;
|
||||
if (t.getBlockX() >= border) {
|
||||
q.setX(border);
|
||||
|
@ -67,10 +67,10 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
public static HashMap<String, PlotId> lastPlot = new HashMap<>();
|
||||
public static HashMap<String, Integer> worldBorder = new HashMap<>();
|
||||
|
||||
public static int getBorder(World world) {
|
||||
String worldname = world.getName();
|
||||
public static int getBorder(String worldname) {
|
||||
if (worldBorder.containsKey(worldname)) {
|
||||
return worldBorder.get(worldname);
|
||||
PlotWorld plotworld = PlotMain.getWorldSettings(worldname);
|
||||
return worldBorder.get(worldname) + 16;
|
||||
}
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
@ -80,6 +80,9 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
if (!plotworld.WORLD_BORDER) {
|
||||
return;
|
||||
}
|
||||
if (!worldBorder.containsKey(world)) {
|
||||
worldBorder.put(world,0);
|
||||
}
|
||||
for (Plot plot : PlotMain.getPlots(world).values()) {
|
||||
updateWorldBorder(plot);
|
||||
}
|
||||
|
@ -17,6 +17,7 @@ import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.uuid.DefaultUUIDWrapper;
|
||||
import com.intellectualcrafters.plot.uuid.OfflineUUIDWrapper;
|
||||
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
|
||||
|
||||
public class UUIDHandler {
|
||||
@ -203,8 +204,8 @@ public class UUIDHandler {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
// Read from disk
|
||||
if (Settings.UUID_FROM_DISK) {
|
||||
// Read from disk OR convert directly to offline UUID
|
||||
if (Settings.UUID_FROM_DISK || uuidWrapper instanceof OfflineUUIDWrapper) {
|
||||
OfflinePlayer op = Bukkit.getOfflinePlayer(name);
|
||||
uuid = UUIDHandler.uuidWrapper.getUUID(op);
|
||||
add(new StringWrapper(name), uuid);
|
||||
|
Loading…
Reference in New Issue
Block a user