Yet another fix for a "player getting stuck in wall" bug.

I forgot to handle the case where a player is stuck in a wall without
something below (e.g. the infamous minecart ride against a ceiling).
This commit is contained in:
Evenprime 2011-02-18 18:00:47 +01:00
parent 7340933587
commit 461097af56
2 changed files with 14 additions and 6 deletions

View File

@ -3,5 +3,5 @@ name: NoCheatPlugin
author: Evenprime
main: cc.co.evenprime.bukkit.nocheat.NoCheatPlugin
version: 0.4.2
version: 0.4.3

View File

@ -392,11 +392,19 @@ public class NoCheatPluginPlayerListener extends PlayerListener {
else if(types[w.getBlockTypeIdAt(l.getBlockX(), l.getBlockY(), l.getBlockZ())] == BlockType.LADDER ||
types[w.getBlockTypeIdAt(l.getBlockX(), l.getBlockY()+1, l.getBlockZ())] == BlockType.LADDER)
return true;
// check if he is standing "in" an unknown block (we give him the benefit of a doubt and see that as a legit move)
else if(types[w.getBlockTypeIdAt(values[0], values[2], values[3])] == BlockType.UNKNOWN ||
types[w.getBlockTypeIdAt(values[1], values[2], values[3])] == BlockType.UNKNOWN ||
types[w.getBlockTypeIdAt(values[0], values[2], values[4])] == BlockType.UNKNOWN ||
types[w.getBlockTypeIdAt(values[1], values[2], values[4])] == BlockType.UNKNOWN)
// check if he is standing "in" an block that's potentially solid (we give him the benefit of a doubt and see that as a legit move)
// If it is not legit, the MC server already has a safeguard against that (You'll get "xy moved wrongly" on the console in that case)
else if(types[w.getBlockTypeIdAt(values[0], values[2], values[3])] != BlockType.NONSOLID ||
types[w.getBlockTypeIdAt(values[1], values[2], values[3])] != BlockType.NONSOLID||
types[w.getBlockTypeIdAt(values[0], values[2], values[4])] != BlockType.NONSOLID ||
types[w.getBlockTypeIdAt(values[1], values[2], values[4])] != BlockType.NONSOLID)
return true;
// check if his head is "stuck" in an block that's potentially solid (we give him the benefit of a doubt and see that as a legit move)
// If it is not legit, the MC server already has a safeguard against that (You'll get "xy moved wrongly" on the console in that case)
else if(types[w.getBlockTypeIdAt(values[0], values[2]+1, values[3])] != BlockType.NONSOLID ||
types[w.getBlockTypeIdAt(values[1], values[2]+1, values[3])] != BlockType.NONSOLID ||
types[w.getBlockTypeIdAt(values[0], values[2]+1, values[4])] != BlockType.NONSOLID ||
types[w.getBlockTypeIdAt(values[1], values[2]+1, values[4])] != BlockType.NONSOLID)
return true;
else
return false;