mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@ -15,6 +15,7 @@ import com.intellectualcrafters.plot.object.PlotArea;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
import com.intellectualcrafters.plot.object.SetupObject;
|
||||
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
||||
import com.intellectualcrafters.plot.util.AbstractTitle;
|
||||
import com.intellectualcrafters.plot.util.ChatManager;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
@ -52,7 +53,6 @@ import com.plotsquared.bukkit.util.BukkitEconHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||
import com.plotsquared.bukkit.util.BukkitPlainChatManager;
|
||||
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
||||
@ -428,7 +428,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
new SendChunk();
|
||||
MainUtil.canSendChunk = true;
|
||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||
e.printStackTrace();
|
||||
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||
MainUtil.canSendChunk = false;
|
||||
}
|
||||
if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
||||
@ -653,7 +653,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
||||
if (Settings.Chat.INTERACTIVE) {
|
||||
return new BukkitChatManager();
|
||||
} else {
|
||||
return new BukkitPlainChatManager();
|
||||
return new PlainChatManager();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,20 @@ import java.util.Map;
|
||||
*/
|
||||
public final class Reflection {
|
||||
|
||||
/**
|
||||
* Stores loaded classes from the {@code net.minecraft.server} package.
|
||||
*/
|
||||
private static final Map<String, Class<?>> _loadedNMSClasses = new HashMap<String, Class<?>>();
|
||||
/**
|
||||
* Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages).
|
||||
*/
|
||||
private static final Map<String, Class<?>> _loadedOBCClasses = new HashMap<String, Class<?>>();
|
||||
private static final Map<Class<?>, Map<String, Field>> _loadedFields = new HashMap<Class<?>, Map<String, Field>>();
|
||||
/**
|
||||
* Contains loaded methods in a cache.
|
||||
* The map maps [types to maps of [method names to maps of [parameter types to method instances]]].
|
||||
*/
|
||||
private static final Map<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>> _loadedMethods = new HashMap<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>>();
|
||||
private static String _versionString;
|
||||
|
||||
private Reflection() { }
|
||||
@ -37,16 +51,6 @@ public final class Reflection {
|
||||
return _versionString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores loaded classes from the {@code net.minecraft.server} package.
|
||||
*/
|
||||
private static final Map<String, Class<?>> _loadedNMSClasses = new HashMap<String, Class<?>>();
|
||||
|
||||
/**
|
||||
* Stores loaded classes from the {@code org.bukkit.craftbukkit} package (and subpackages).
|
||||
*/
|
||||
private static final Map<String, Class<?>> _loadedOBCClasses = new HashMap<String, Class<?>>();
|
||||
|
||||
/**
|
||||
* Gets a {@link Class} object representing a type contained within the {@code net.minecraft.server} versioned package.
|
||||
* The class instances returned by this method are cached, such that no lookup will be done twice (unless multiple threads are accessing this method simultaneously).
|
||||
@ -64,9 +68,8 @@ public final class Reflection {
|
||||
try {
|
||||
clazz = Class.forName(fullName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
_loadedNMSClasses.put(className, null);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
_loadedNMSClasses.put(className, clazz);
|
||||
return clazz;
|
||||
@ -89,9 +92,8 @@ public final class Reflection {
|
||||
try {
|
||||
clazz = Class.forName(fullName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
_loadedOBCClasses.put(className, null);
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
_loadedOBCClasses.put(className, clazz);
|
||||
return clazz;
|
||||
@ -110,13 +112,10 @@ public final class Reflection {
|
||||
try {
|
||||
return getMethod(obj.getClass(), "getHandle").invoke(obj);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static final Map<Class<?>, Map<String, Field>> _loadedFields = new HashMap<Class<?>, Map<String, Field>>();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Field} instance declared by the specified class with the specified name.
|
||||
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
||||
@ -161,12 +160,6 @@ public final class Reflection {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Contains loaded methods in a cache.
|
||||
* The map maps [types to maps of [method names to maps of [parameter types to method instances]]].
|
||||
*/
|
||||
private static final Map<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>> _loadedMethods = new HashMap<Class<?>, Map<String, Map<ArrayWrapper<Class<?>>, Method>>>();
|
||||
|
||||
/**
|
||||
* Retrieves a {@link Method} instance declared by the specified class with the specified name and argument types.
|
||||
* Java access modifiers are ignored during this retrieval. No guarantee is made as to whether the field
|
||||
|
@ -30,7 +30,6 @@ public class DefaultTitleManager_183 extends DefaultTitleManager {
|
||||
this.chatBaseComponent = Reflection.getNMSClass("IChatBaseComponent");
|
||||
this.packetActions = Reflection.getNMSClass("PacketPlayOutTitle$EnumTitleAction");
|
||||
this.nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,47 +0,0 @@
|
||||
package com.plotsquared.bukkit.util;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.ChatManager;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||
|
||||
@Override
|
||||
public List<StringBuilder> builder() {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void color(PlotMessage message, String color) {
|
||||
List<StringBuilder> parts = message.$(this);
|
||||
parts.get(parts.size() - 1).insert(0, color);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tooltip(PlotMessage message, PlotMessage... tooltips) {}
|
||||
|
||||
@Override
|
||||
public void command(PlotMessage message, String command) {}
|
||||
|
||||
@Override
|
||||
public void text(PlotMessage message, String text) {
|
||||
message.$(this).add(new StringBuilder(ChatColor.stripColor(text)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void send(PlotMessage plotMessage, PlotPlayer player) {
|
||||
StringBuilder built = new StringBuilder();
|
||||
for (StringBuilder sb : plotMessage.$(this)) {
|
||||
built.append(sb);
|
||||
}
|
||||
player.sendMessage(built.toString());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suggest(PlotMessage plotMessage, String command) {}
|
||||
|
||||
}
|
@ -26,9 +26,8 @@ import java.util.HashSet;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
|
||||
*
|
||||
|
||||
* An utility that can be used to send chunks, rather than using bukkit code
|
||||
* to do so (uses heavy NMS).
|
||||
*/
|
||||
public class SendChunk {
|
||||
|
||||
@ -40,7 +39,7 @@ public class SendChunk {
|
||||
private final RefMethod methodInitLighting;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Constructor.
|
||||
*/
|
||||
public SendChunk() throws ClassNotFoundException, NoSuchMethodException, NoSuchFieldException {
|
||||
RefConstructor tempMapChunk;
|
||||
|
@ -85,7 +85,7 @@ public class BukkitLocalQueue<T> extends BasicLocalBlockQueue<T> {
|
||||
if (block != null) {
|
||||
int x = MainUtil.x_loc[layer][j];
|
||||
int y = MainUtil.y_loc[layer][j];
|
||||
int z = MainUtil.y_loc[layer][j];
|
||||
int z = MainUtil.z_loc[layer][j];
|
||||
Block existing = chunk.getBlock(x, y, z);
|
||||
int existingId = existing.getTypeId();
|
||||
if (existingId == block.id) {
|
||||
|
Reference in New Issue
Block a user