mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
Various
Fix compatibility with bukkit 1.5 Recover on failed fancy message initialization Fix /2 remove *
This commit is contained in:
parent
047f9a75b9
commit
817a5bc16e
@ -52,7 +52,7 @@ import com.plotsquared.bukkit.util.BukkitEconHandler;
|
|||||||
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
import com.plotsquared.bukkit.util.BukkitEventUtil;
|
||||||
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
import com.plotsquared.bukkit.util.BukkitHybridUtils;
|
||||||
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
|
||||||
import com.plotsquared.bukkit.util.BukkitPlainChatManager;
|
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
||||||
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
|
||||||
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
import com.plotsquared.bukkit.util.BukkitSetupUtils;
|
||||||
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
import com.plotsquared.bukkit.util.BukkitTaskManager;
|
||||||
@ -428,7 +428,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
|
|||||||
new SendChunk();
|
new SendChunk();
|
||||||
MainUtil.canSendChunk = true;
|
MainUtil.canSendChunk = true;
|
||||||
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
} catch (ClassNotFoundException | NoSuchFieldException | NoSuchMethodException e) {
|
||||||
e.printStackTrace();
|
PS.debug(SendChunk.class + " does not support " + StringMan.getString(getServerVersion()));
|
||||||
MainUtil.canSendChunk = false;
|
MainUtil.canSendChunk = false;
|
||||||
}
|
}
|
||||||
if (PS.get().checkVersion(getServerVersion(), 1, 9, 0)) {
|
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) {
|
if (Settings.Chat.INTERACTIVE) {
|
||||||
return new BukkitChatManager();
|
return new BukkitChatManager();
|
||||||
} else {
|
} else {
|
||||||
return new BukkitPlainChatManager();
|
return new PlainChatManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -64,9 +64,8 @@ public final class Reflection {
|
|||||||
try {
|
try {
|
||||||
clazz = Class.forName(fullName);
|
clazz = Class.forName(fullName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
_loadedNMSClasses.put(className, null);
|
_loadedNMSClasses.put(className, null);
|
||||||
return null;
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
_loadedNMSClasses.put(className, clazz);
|
_loadedNMSClasses.put(className, clazz);
|
||||||
return clazz;
|
return clazz;
|
||||||
@ -89,9 +88,8 @@ public final class Reflection {
|
|||||||
try {
|
try {
|
||||||
clazz = Class.forName(fullName);
|
clazz = Class.forName(fullName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
|
||||||
_loadedOBCClasses.put(className, null);
|
_loadedOBCClasses.put(className, null);
|
||||||
return null;
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
_loadedOBCClasses.put(className, clazz);
|
_loadedOBCClasses.put(className, clazz);
|
||||||
return clazz;
|
return clazz;
|
||||||
@ -110,8 +108,7 @@ public final class Reflection {
|
|||||||
try {
|
try {
|
||||||
return getMethod(obj.getClass(), "getHandle").invoke(obj);
|
return getMethod(obj.getClass(), "getHandle").invoke(obj);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
throw new RuntimeException(e);
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,6 @@ public class DefaultTitleManager_183 extends DefaultTitleManager {
|
|||||||
this.chatBaseComponent = Reflection.getNMSClass("IChatBaseComponent");
|
this.chatBaseComponent = Reflection.getNMSClass("IChatBaseComponent");
|
||||||
this.packetActions = Reflection.getNMSClass("PacketPlayOutTitle$EnumTitleAction");
|
this.packetActions = Reflection.getNMSClass("PacketPlayOutTitle$EnumTitleAction");
|
||||||
this.nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
|
this.nmsChatSerializer = Reflection.getNMSClass("IChatBaseComponent$ChatSerializer");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -85,7 +85,7 @@ public class BukkitLocalQueue<T> extends BasicLocalBlockQueue<T> {
|
|||||||
if (block != null) {
|
if (block != null) {
|
||||||
int x = MainUtil.x_loc[layer][j];
|
int x = MainUtil.x_loc[layer][j];
|
||||||
int y = MainUtil.y_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);
|
Block existing = chunk.getBlock(x, y, z);
|
||||||
int existingId = existing.getTypeId();
|
int existingId = existing.getTypeId();
|
||||||
if (existingId == block.id) {
|
if (existingId == block.id) {
|
||||||
|
@ -54,7 +54,7 @@ public class Kick extends SubCommand {
|
|||||||
}
|
}
|
||||||
players.add(pp);
|
players.add(pp);
|
||||||
}
|
}
|
||||||
break;
|
continue;
|
||||||
}
|
}
|
||||||
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
|
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
|
||||||
if (pp != null) {
|
if (pp != null) {
|
||||||
@ -67,8 +67,7 @@ public class Kick extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for (PlotPlayer player2 : players) {
|
for (PlotPlayer player2 : players) {
|
||||||
Location location2 = player2.getLocation();
|
if (!plot.equals(player2.getCurrentPlot())) {
|
||||||
if (!player2.getLocation().getWorld().equals(location2.getWorld()) || !plot.equals(location2.getPlot())) {
|
|
||||||
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1650,7 +1650,7 @@ public class Plot {
|
|||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(getDenied())) {
|
for (UUID other : new HashSet<>(getDenied())) {
|
||||||
result = result || rmvDenied(other);
|
result = rmvDenied(other) || result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1677,7 +1677,7 @@ public class Plot {
|
|||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(getTrusted())) {
|
for (UUID other : new HashSet<>(getTrusted())) {
|
||||||
result = result || rmvTrusted(other);
|
result = rmvTrusted(other) || result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@ -1707,7 +1707,7 @@ public class Plot {
|
|||||||
if (uuid == DBFunc.everyone) {
|
if (uuid == DBFunc.everyone) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
for (UUID other : new HashSet<>(this.members)) {
|
for (UUID other : new HashSet<>(this.members)) {
|
||||||
result = result || rmvMember(other);
|
result = rmvMember(other) || result;
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
import com.intellectualcrafters.plot.util.ChatManager;
|
||||||
|
|
||||||
public class PlotMessage {
|
public class PlotMessage {
|
||||||
@ -8,7 +10,13 @@ public class PlotMessage {
|
|||||||
private Object builder;
|
private Object builder;
|
||||||
|
|
||||||
public PlotMessage() {
|
public PlotMessage() {
|
||||||
|
try {
|
||||||
reset(ChatManager.manager);
|
reset(ChatManager.manager);
|
||||||
|
} catch (Throwable e) {
|
||||||
|
PS.debug("PlotSquared doesn't support fancy chat for " + PS.get().IMP.getServerVersion());
|
||||||
|
ChatManager.manager = new PlainChatManager();
|
||||||
|
reset(ChatManager.manager);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PlotMessage(String text) {
|
public PlotMessage(String text) {
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package com.plotsquared.bukkit.util;
|
package com.intellectualcrafters.plot.object.chat;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.PlotMessage;
|
import com.intellectualcrafters.plot.object.PlotMessage;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.ChatManager;
|
import com.intellectualcrafters.plot.util.ChatManager;
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
public class PlainChatManager extends ChatManager<List<StringBuilder>> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<StringBuilder> builder() {
|
public List<StringBuilder> builder() {
|
||||||
@ -29,7 +29,7 @@ public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void text(PlotMessage message, String text) {
|
public void text(PlotMessage message, String text) {
|
||||||
message.$(this).add(new StringBuilder(ChatColor.stripColor(text)));
|
message.$(this).add(new StringBuilder(C.color(text)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
Loading…
Reference in New Issue
Block a user