If Op user type and not using block permissions, the player should be able to place grass, water, lava, and admincrete.

This commit is contained in:
UnknownShadow200 2015-09-21 11:13:37 +10:00
parent fb566ac505
commit 3d9d2a0e76
3 changed files with 19 additions and 13 deletions

View File

@ -149,7 +149,7 @@ namespace ClassicalSharp {
Move( xMoving, zMoving, 0.02f * 1.7f, ropeDrag, ropeGrav, 1 );
} else {
float factor = !flying && onGround ? 0.1f : 0.02f;
float yMul = Math.Max( 1, multiply / 5f );
float yMul = Math.Max( 1, multiply / 5f );
Move( xMoving, zMoving, factor * multiply, normalDrag, normalGrav, yMul );
if( BlockUnderFeet == Block.Ice ) {
@ -173,7 +173,7 @@ namespace ClassicalSharp {
void Move( float xMoving, float zMoving, float factor, Vector3 drag, float gravity, float yMul ) {
AdjHeadingVelocity( zMoving, xMoving, factor );
Velocity.Y *= yMul;
if( !noClip )
if( !noClip )
MoveAndWallSlide();
Position += Velocity;
@ -212,6 +212,20 @@ namespace ClassicalSharp {
}
}
public void SetUserType( byte value, bool useBlockPermissions ) {
UserType = value;
if( !useBlockPermissions ) {
game.CanPlace[(int)Block.Bedrock] = value == 0x64;
game.CanDelete[(int)Block.Bedrock] = value == 0x64;
game.CanPlace[(int)Block.Grass] = value == 0x64;
game.CanPlace[(int)Block.Water] = value == 0x64;
game.CanPlace[(int)Block.StillWater] = value == 0x64;
game.CanPlace[(int)Block.Lava] = value == 0x64;
game.CanPlace[(int)Block.StillLava] = value == 0x64;
}
}
internal Vector3 lastPos, nextPos;
internal float lastYaw, nextYaw, lastPitch, nextPitch;
public void SetInterpPosition( float t ) {

View File

@ -186,7 +186,7 @@ namespace ClassicalSharp {
}
internal bool CanPick( byte block ) {
return !( block == 0 || ( BlockInfo.IsLiquid( block ) && !CanPlace[block] && !CanDelete[block] ) );
return !(block == 0 || (BlockInfo.IsLiquid( block ) && !(CanPlace[block] && CanDelete[block])));
}
public KeyMap Keys = new KeyMap();

View File

@ -261,11 +261,7 @@ namespace ClassicalSharp {
byte protocolVer = reader.ReadUInt8();
ServerName = reader.ReadAsciiString();
ServerMotd = reader.ReadAsciiString();
byte userType = reader.ReadUInt8();
if( !useBlockPermissions ) {
game.CanDelete[(int)Block.Bedrock] = userType == 0x64;
}
game.LocalPlayer.UserType = userType;
game.LocalPlayer.SetUserType( reader.ReadUInt8(), useBlockPermissions );
receivedFirstPosition = false;
game.LocalPlayer.ParseHackFlags( ServerName, ServerMotd );
} break;
@ -409,11 +405,7 @@ namespace ClassicalSharp {
case PacketId.SetPermission:
{
byte userType = reader.ReadUInt8();
if( !useBlockPermissions ) {
game.CanDelete[(int)Block.Bedrock] = userType == 0x64;
}
game.LocalPlayer.UserType = userType;
game.LocalPlayer.SetUserType( reader.ReadUInt8(), useBlockPermissions );
} break;
case PacketId.CpeExtInfo: