mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 01:12:47 +01:00
(Probably) fixed the sign exploit
This commit is contained in:
parent
cdcb947532
commit
c607d212d4
2 changed files with 53 additions and 0 deletions
|
@ -776,6 +776,17 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) {
|
if (this.e.world.f(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c)) {
|
||||||
TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c);
|
TileEntity tileentity = this.e.world.getTileEntity(packet130updatesign.a, packet130updatesign.b, packet130updatesign.c);
|
||||||
|
if (tileentity instanceof TileEntitySign) {
|
||||||
|
TileEntitySign sign = (TileEntitySign)tileentity;
|
||||||
|
if (!sign.fresh) {
|
||||||
|
int x = packet130updatesign.a;
|
||||||
|
int y = packet130updatesign.b;
|
||||||
|
int z = packet130updatesign.c;
|
||||||
|
server.getLogger().severe("Player " + getPlayer().getName() + "/" + getPlayer().getAddress().toString() + " just tried to change the sign text at " +
|
||||||
|
x + "," + y + "," + z + " - very likely an exploit attempt. Recommend ban.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -817,6 +828,8 @@ public class NetServerHandler extends NetHandler implements ICommandListener {
|
||||||
for (int l = 0; l < 4; ++l) {
|
for (int l = 0; l < 4; ++l) {
|
||||||
event.setLine(l, "");
|
event.setLine(l, "");
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
tileentitysign.fresh = false;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
|
|
40
src/main/java/net/minecraft/server/TileEntitySign.java
Normal file
40
src/main/java/net/minecraft/server/TileEntitySign.java
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
package net.minecraft.server;
|
||||||
|
|
||||||
|
public class TileEntitySign extends TileEntity {
|
||||||
|
|
||||||
|
public String[] a = new String[] { "", "", "", ""};
|
||||||
|
public int b = -1;
|
||||||
|
public boolean fresh = true; // Craftbukkit
|
||||||
|
|
||||||
|
public TileEntitySign() {}
|
||||||
|
|
||||||
|
public void b(NBTTagCompound nbttagcompound) {
|
||||||
|
super.b(nbttagcompound);
|
||||||
|
nbttagcompound.a("Text1", this.a[0]);
|
||||||
|
nbttagcompound.a("Text2", this.a[1]);
|
||||||
|
nbttagcompound.a("Text3", this.a[2]);
|
||||||
|
nbttagcompound.a("Text4", this.a[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void a(NBTTagCompound nbttagcompound) {
|
||||||
|
fresh = false; // Craftbukkit
|
||||||
|
super.a(nbttagcompound);
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
this.a[i] = nbttagcompound.i("Text" + (i + 1));
|
||||||
|
if (this.a[i].length() > 15) {
|
||||||
|
this.a[i] = this.a[i].substring(0, 15);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Packet e() {
|
||||||
|
String[] astring = new String[4];
|
||||||
|
|
||||||
|
for (int i = 0; i < 4; ++i) {
|
||||||
|
astring[i] = this.a[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Packet130UpdateSign(this.e, this.f, this.g, astring);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue