mirror of
https://github.com/barkeser2002/CatServer.git
synced 2026-09-25 10:06:11 +03:00
91 lines
3.8 KiB
Diff
91 lines
3.8 KiB
Diff
--- ../src-base/minecraft/net/minecraft/tileentity/TileEntitySign.java
|
|
+++ ../src-work/minecraft/net/minecraft/tileentity/TileEntitySign.java
|
|
@@ -24,7 +24,7 @@
|
|
{
|
|
public final ITextComponent[] signText = new ITextComponent[] {new TextComponentString(""), new TextComponentString(""), new TextComponentString(""), new TextComponentString("")};
|
|
public int lineBeingEdited = -1;
|
|
- private boolean isEditable = true;
|
|
+ public boolean isEditable = true;
|
|
private EntityPlayer player;
|
|
private final CommandResultStats stats = new CommandResultStats();
|
|
|
|
@@ -38,6 +38,10 @@
|
|
compound.setString("Text" + (i + 1), s);
|
|
}
|
|
|
|
+ if (Boolean.getBoolean("convertLegacySigns")) {
|
|
+ compound.setBoolean("Bukkit.isConverted", true);
|
|
+ }
|
|
+
|
|
this.stats.writeStatsToNBT(compound);
|
|
return compound;
|
|
}
|
|
@@ -59,7 +63,7 @@
|
|
}
|
|
public boolean canUseCommand(int permLevel, String commandName)
|
|
{
|
|
- return true;
|
|
+ return permLevel <= 2; //Forge: Fixes MC-75630 - Exploit with signs and command blocks
|
|
}
|
|
public BlockPos getPosition()
|
|
{
|
|
@@ -79,19 +83,38 @@
|
|
}
|
|
};
|
|
|
|
+ // CraftBukkit start - Add an option to convert signs correctly
|
|
+ // This is done with a flag instead of all the time because
|
|
+ // we have no way to tell whether a sign is from 1.7.10 or 1.8
|
|
+
|
|
+ boolean oldSign = Boolean.getBoolean("convertLegacySigns") && !compound.getBoolean("Bukkit.isConverted");
|
|
+
|
|
for (int i = 0; i < 4; ++i)
|
|
{
|
|
String s = compound.getString("Text" + (i + 1));
|
|
- ITextComponent itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
|
|
+ // ITextComponent itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
|
|
+ if (s != null && s.length() > 2048) {
|
|
+ s = "\"\"";
|
|
+ }
|
|
|
|
try
|
|
{
|
|
- this.signText[i] = TextComponentUtils.processComponent(icommandsender, itextcomponent, (Entity)null);
|
|
+ ITextComponent ichatbasecomponent = ITextComponent.Serializer.jsonToComponent(s);
|
|
+
|
|
+ if (oldSign) {
|
|
+ signText[i] = org.bukkit.craftbukkit.util.CraftChatMessage.fromString(s)[0];
|
|
+ continue;
|
|
+ }
|
|
+ // CraftBukkit end
|
|
+
|
|
+ try {
|
|
+ this.signText[i] = TextComponentUtils.processComponent(icommandsender, ichatbasecomponent, (Entity) null);
|
|
+ } catch (CommandException commandexception) {
|
|
+ this.signText[i] = ichatbasecomponent;
|
|
+ }
|
|
+ } catch (com.google.gson.JsonParseException jsonparseexception) {
|
|
+ this.signText[i] = new TextComponentString(s);
|
|
}
|
|
- catch (CommandException var7)
|
|
- {
|
|
- this.signText[i] = itextcomponent;
|
|
- }
|
|
}
|
|
|
|
this.stats.readStatsFromNBT(compound);
|
|
@@ -201,7 +224,12 @@
|
|
|
|
if (clickevent.getAction() == ClickEvent.Action.RUN_COMMAND)
|
|
{
|
|
- playerIn.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
|
|
+ // playerIn.getServer().getCommandManager().executeCommand(icommandsender, clickevent.getValue());
|
|
+ CommandBlockBaseLogic.executeSafely(icommandsender, new org.bukkit.craftbukkit.command.ProxiedNativeCommandSender(
|
|
+ icommandsender,
|
|
+ new org.bukkit.craftbukkit.command.CraftBlockCommandSender(icommandsender),
|
|
+ playerIn.getBukkitEntity()
|
|
+ ), clickevent.getValue());
|
|
}
|
|
}
|
|
}
|