mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-07-14 11:24:44 +02:00
General changes
This commit is contained in:
@ -388,10 +388,12 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
|
||||
if (!PS.get().isMainThread(Thread.currentThread())) {
|
||||
TaskManager.runTask(new Runnable() {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void run() {
|
||||
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
|
||||
@ -722,7 +724,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
try {
|
||||
entity.spawn(world, xOffset, zOffset);
|
||||
} catch (Exception e) {
|
||||
PS.debug("Failed to restore entity (e): " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.type);
|
||||
PS.debug("Failed to restore entity (e): " + e.toString());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -743,7 +745,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -786,7 +788,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -803,7 +805,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -820,7 +822,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -840,7 +842,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.getKey().y + "," + (
|
||||
blockLocMaterialEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (blockLocMaterialEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocMaterialEntry
|
||||
.getKey().y + "," + (
|
||||
@ -882,7 +884,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (IllegalArgumentException ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
|
||||
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -901,7 +903,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.getKey().y + "," + (
|
||||
blockLocNoteEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (blockLocNoteEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocNoteEntry
|
||||
.getKey().y + "," + (
|
||||
@ -921,7 +923,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
.getKey().y + "," + (
|
||||
blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (blockLocShortEntry.getKey().x + xOffset) + ","
|
||||
+ blockLocShortEntry.getKey().y + "," + (blockLocShortEntry.getKey().z + zOffset));
|
||||
}
|
||||
@ -1060,7 +1062,11 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
Material id = block.getType();
|
||||
if (storeNormal) {
|
||||
int typeId = id.getId();
|
||||
ids[y] = new PlotBlock((short) typeId, typeId == 0 ? 0 : block.getData());
|
||||
if (typeId == 0) {
|
||||
ids[y] = PlotBlock.EVERYTHING;
|
||||
} else {
|
||||
ids[y] = new PlotBlock((short) typeId, block.getData());
|
||||
}
|
||||
}
|
||||
if (!id.equals(Material.AIR)) {
|
||||
try {
|
||||
|
@ -12,8 +12,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||
import com.intellectualcrafters.plot.util.WorldUtil;
|
||||
import com.plotsquared.bukkit.object.BukkitPlayer;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -34,6 +32,9 @@ import org.bukkit.material.Tree;
|
||||
import org.bukkit.material.WoodenStep;
|
||||
import org.bukkit.material.Wool;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class BukkitUtil extends WorldUtil {
|
||||
|
||||
private static String lastString = null;
|
||||
@ -260,7 +261,7 @@ public class BukkitUtil extends WorldUtil {
|
||||
public String getClosestMatchingName(PlotBlock block) {
|
||||
try {
|
||||
return Material.getMaterial(block.id).name();
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.AbstractList;
|
||||
@ -314,7 +315,7 @@ public class NbtFactory {
|
||||
private static Object invokeMethod(Method method, Object target, Object... params) {
|
||||
try {
|
||||
return method.invoke(target, params);
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
|
||||
throw new RuntimeException("Unable to invoke method " + method + " for " + target, e);
|
||||
}
|
||||
}
|
||||
@ -322,7 +323,7 @@ public class NbtFactory {
|
||||
private static void setFieldValue(Field field, Object target, Object value) {
|
||||
try {
|
||||
field.set(target, value);
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalAccessException | IllegalArgumentException e) {
|
||||
throw new RuntimeException("Unable to set " + field + " for " + target, e);
|
||||
}
|
||||
}
|
||||
@ -330,7 +331,7 @@ public class NbtFactory {
|
||||
private static Object getFieldValue(Field field, Object target) {
|
||||
try {
|
||||
return field.get(target);
|
||||
} catch (Exception e) {
|
||||
} catch (IllegalAccessException | IllegalArgumentException e) {
|
||||
throw new RuntimeException("Unable to retrieve " + field + " for " + target, e);
|
||||
}
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
|
||||
Method getHandle = chunk.getClass().getDeclaredMethod("getHandle");
|
||||
Object c = getHandle.invoke(chunk);
|
||||
Object w = this.methodGetWorld.of(c).call();
|
||||
Class<? extends Object> clazz = c.getClass();
|
||||
Class<?> clazz = c.getClass();
|
||||
Field sections1 = clazz.getDeclaredField("sections");
|
||||
sections1.setAccessible(true);
|
||||
Field tileEntities = clazz.getDeclaredField("tileEntities");
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.plotsquared.bukkit.util.block;
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
@ -13,6 +15,12 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
|
||||
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
|
||||
import com.intellectualcrafters.plot.util.TaskManager;
|
||||
import com.plotsquared.bukkit.util.BukkitUtil;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
@ -22,14 +30,6 @@ import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Set;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.World.Environment;
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
|
||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||
|
||||
public class FastQueue_1_9 extends SlowQueue {
|
||||
|
||||
@ -118,7 +118,7 @@ public class FastQueue_1_9 extends SlowQueue {
|
||||
Entry<?, ?> tile = iterator.next();
|
||||
Object pos = tile.getKey();
|
||||
if (xm == null) {
|
||||
Class<? extends Object> clazz2 = pos.getClass().getSuperclass();
|
||||
Class<?> clazz2 = pos.getClass().getSuperclass();
|
||||
xm = clazz2.getDeclaredMethod("getX");
|
||||
ym = clazz2.getDeclaredMethod("getY");
|
||||
zm = clazz2.getDeclaredMethod("getZ");
|
||||
|
Reference in New Issue
Block a user