mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Changes
Plot auto clear confirmation Add timediff to keep flag Add expired parameter to list cmd Fixes some compatibility issues
This commit is contained in:
@ -369,11 +369,11 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 8, 0)) {
|
||||
try {
|
||||
return new FastQueue_1_8_3();
|
||||
} catch (NoSuchMethodException | RuntimeException e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
return new FastQueue_1_8();
|
||||
} catch (NoSuchMethodException e2) {
|
||||
} catch (Throwable e2) {
|
||||
e2.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
@ -381,7 +381,8 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
|
||||
}
|
||||
try {
|
||||
return new FastQueue_1_7();
|
||||
} catch (NoSuchMethodException e) {
|
||||
} catch (Throwable e) {
|
||||
e.printStackTrace();
|
||||
return new SlowQueue();
|
||||
}
|
||||
}
|
||||
|
@ -343,14 +343,11 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
|
||||
Location loc = pp.getLocation();
|
||||
PlotArea area = loc.getPlotArea();
|
||||
final Plot plot;
|
||||
if (area != null) {
|
||||
plot = area.getPlot(loc);
|
||||
Plot plot = area.getPlot(loc);
|
||||
if (plot != null) {
|
||||
plotEntry(pp, plot);
|
||||
}
|
||||
} else {
|
||||
plot = null;
|
||||
}
|
||||
// Delayed
|
||||
|
||||
@ -361,24 +358,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
||||
if (!player.hasPlayedBefore() && player.isOnline()) {
|
||||
player.saveData();
|
||||
}
|
||||
ExpireManager.dates.put(uuid, System.currentTimeMillis());
|
||||
if (BukkitMain.worldEdit != null) {
|
||||
if (pp.getAttribute("worldedit")) {
|
||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASSED);
|
||||
}
|
||||
}
|
||||
if (PS.get().update != null && Permissions.hasPermission(pp, C.PERMISSION_ADMIN_UPDATE) && Settings.UPDATE_NOTIFICATIONS) {
|
||||
MainUtil.sendMessage(pp, "&6An update for PlotSquared is available: &7/plot update");
|
||||
}
|
||||
if (Settings.TELEPORT_ON_LOGIN && plot != null) {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
plot.teleportPlayer(pp);
|
||||
}
|
||||
});
|
||||
MainUtil.sendMessage(pp, C.TELEPORTED_TO_ROAD);
|
||||
}
|
||||
EventUtil.manager.doJoinTask(pp);
|
||||
}
|
||||
}, 20);
|
||||
}
|
||||
|
@ -668,11 +668,8 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
if (!pLoc.getChunkLoc().equals(loc)) {
|
||||
continue;
|
||||
}
|
||||
PlotBlock plotblock = WorldUtil.IMP.getBlock(pLoc);
|
||||
if (plotblock.id != 0) {
|
||||
Plot plot = pp.getCurrentPlot();
|
||||
pp.teleport(plot.getDefaultHome());
|
||||
}
|
||||
pLoc.setY(WorldUtil.IMP.getHighestBlock(world, pLoc.getX(), pLoc.getZ()));
|
||||
pp.teleport(pLoc);
|
||||
}
|
||||
}
|
||||
|
||||
@ -996,20 +993,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
final int tx = pos2.getX();
|
||||
final int tz = pos2.getZ();
|
||||
for (final Entity entity : entities) {
|
||||
if (entity instanceof Player) {
|
||||
final org.bukkit.Location loc = entity.getLocation();
|
||||
if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) {
|
||||
final Player player = (Player) entity;
|
||||
final PlotPlayer pp = BukkitUtil.getPlayer(player);
|
||||
final Plot plot = pp.getCurrentPlot();
|
||||
if (plot != null) {
|
||||
final Location plotHome = plot.getDefaultHome();
|
||||
if (pp.getLocation().getY() <= plotHome.getY()) {
|
||||
pp.teleport(plotHome);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (!(entity instanceof Player)) {
|
||||
final org.bukkit.Location loc = entity.getLocation();
|
||||
if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) {
|
||||
entity.remove();
|
||||
|
@ -5,17 +5,9 @@ import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.schematic.PlotItem;
|
||||
import com.intellectualcrafters.plot.util.MathMan;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.StringMan;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.intellectualcrafters.plot.util.*;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockState;
|
||||
@ -25,12 +17,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryHolder;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.material.MaterialData;
|
||||
import org.bukkit.material.Sandstone;
|
||||
import org.bukkit.material.Step;
|
||||
import org.bukkit.material.Tree;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.bukkit.material.Wool;
|
||||
import org.bukkit.material.*;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
@ -6,9 +6,9 @@ import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.MapMaker;
|
||||
import com.google.common.io.ByteSink;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.Closeables;
|
||||
import com.google.common.io.Files;
|
||||
import com.google.common.io.InputSupplier;
|
||||
import com.google.common.primitives.Primitives;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
@ -147,21 +147,20 @@ public class NbtFactory {
|
||||
* @return The decoded NBT compound.
|
||||
* @throws IOException If anything went wrong.
|
||||
*/
|
||||
public static NbtCompound fromStream(final ByteSource stream, final StreamOptions option) throws IOException {
|
||||
public static NbtCompound fromStream(final InputSupplier<? extends InputStream> stream, final StreamOptions option) throws IOException {
|
||||
InputStream input = null;
|
||||
DataInputStream data = null;
|
||||
boolean suppress = true;
|
||||
|
||||
try {
|
||||
input = stream.openStream();
|
||||
input = stream.getInput();
|
||||
data = new DataInputStream(new BufferedInputStream(option == StreamOptions.GZIP_COMPRESSION ? new GZIPInputStream(input) : input));
|
||||
|
||||
final NbtCompound result = fromCompound(get().LOAD_COMPOUND.loadNbt(data));
|
||||
suppress = false;
|
||||
return result;
|
||||
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
if (data != null) {
|
||||
Closeables.close(data, suppress);
|
||||
} else if (input != null) {
|
||||
|
@ -34,7 +34,7 @@ public class SlowChunk extends PlotChunk<Chunk> {
|
||||
if (result[y >> 4] == null) {
|
||||
result[y >> 4] = new PlotBlock[4096];
|
||||
}
|
||||
result[MainUtil.CACHE_I[x][y][z]][MainUtil.CACHE_J[x][y][z]] = new PlotBlock((short) id, data);
|
||||
result[MainUtil.CACHE_I[y][x][z]][MainUtil.CACHE_J[y][x][z]] = new PlotBlock((short) id, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,6 +123,9 @@ public class SlowQueue implements PlotQueue<Chunk> {
|
||||
final int z = MainUtil.z_loc[i][j];
|
||||
Block block = chunk.getBlock(x, y, z);
|
||||
PlotBlock newBlock = result2[j];
|
||||
if (newBlock == null) {
|
||||
continue;
|
||||
}
|
||||
switch (newBlock.id) {
|
||||
case -1:
|
||||
if (block.getData() == newBlock.data) {
|
||||
|
@ -2,6 +2,7 @@ package com.plotsquared.bukkit.uuid;
|
||||
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.google.common.io.ByteSource;
|
||||
import com.google.common.io.InputSupplier;
|
||||
import com.intellectualcrafters.plot.PS;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.config.Settings;
|
||||
@ -9,17 +10,14 @@ 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.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.util.*;
|
||||
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;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
@ -102,12 +100,14 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
final UUID uuid = UUID.fromString(s);
|
||||
if (check || all.remove(uuid)) {
|
||||
final File file = new File(playerdataFolder + File.separator + current);
|
||||
final ByteSource is = com.google.common.io.Files.asByteSource(file);
|
||||
final InputSupplier<FileInputStream> is = com.google.common.io.Files.newInputStreamSupplier(file);
|
||||
final NbtFactory.NbtCompound compound = NbtFactory.fromStream(is, NbtFactory.StreamOptions.GZIP_COMPRESSION);
|
||||
final NbtFactory.NbtCompound bukkit = (NbtFactory.NbtCompound) compound.get("bukkit");
|
||||
final String name = (String) bukkit.get("lastKnownName");
|
||||
final long last = (long) bukkit.get("lastPlayed");
|
||||
ExpireManager.dates.put(uuid, last);
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
}
|
||||
} catch (final Exception e) {
|
||||
@ -190,7 +190,9 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
uuid = new UUID(most, least);
|
||||
}
|
||||
}
|
||||
ExpireManager.dates.put(uuid, last);
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
toAdd.put(new StringWrapper(name), uuid);
|
||||
} catch (final Throwable e) {
|
||||
PS.debug(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
|
||||
@ -210,7 +212,9 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
|
||||
final StringWrapper wrap = new StringWrapper(name);
|
||||
final UUID uuid = uuidWrapper.getUUID(op);
|
||||
toAdd.put(wrap, uuid);
|
||||
ExpireManager.dates.put(uuid, last);
|
||||
if (ExpireManager.IMP != null) {
|
||||
ExpireManager.IMP.storeDate(uuid, last);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user