mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-17 11:35:08 -04:00
If server supports BlockPermissions, disable block perm behaviour of map MOTD
This commit is contained in:
parent
8ba0d4203f
commit
59b2f22687
@ -127,17 +127,18 @@ namespace ClassicalSharp.Entities {
|
||||
|
||||
/// <summary> Sets the user type of this user. This is used to control permissions for grass,
|
||||
/// bedrock, water and lava blocks on servers that don't support CPE block permissions. </summary>
|
||||
public void SetUserType(byte value) {
|
||||
public void SetUserType(byte value, bool setBlockPerms) {
|
||||
bool isOp = value >= 100 && value <= 127;
|
||||
UserType = value;
|
||||
CanSeeAllNames = isOp;
|
||||
if (!setBlockPerms) return;
|
||||
|
||||
BlockInfo.CanPlace[Block.Bedrock] = isOp;
|
||||
BlockInfo.CanDelete[Block.Bedrock] = isOp;
|
||||
|
||||
BlockInfo.CanPlace[Block.Water] = isOp;
|
||||
BlockInfo.CanPlace[Block.StillWater] = isOp;
|
||||
BlockInfo.CanPlace[Block.Lava] = isOp;
|
||||
BlockInfo.CanPlace[Block.StillLava] = isOp;
|
||||
CanSeeAllNames = isOp;
|
||||
}
|
||||
|
||||
/// <summary> Disables any hacks if their respective CanHackX value is set to false. </summary>
|
||||
|
@ -14,7 +14,7 @@ namespace ClassicalSharp.Network {
|
||||
internal int ServerExtensionsCount;
|
||||
internal bool sendHeldBlock, useMessageTypes;
|
||||
internal int envMapVer = 2, blockDefsExtVer = 2;
|
||||
internal bool needD3Fix, extEntityPos, twoWayPing;
|
||||
internal bool needD3Fix, extEntityPos, twoWayPing, blockPerms;
|
||||
|
||||
public void Reset(Game game) {
|
||||
ServerExtensionsCount = 0;
|
||||
@ -38,6 +38,8 @@ namespace ClassicalSharp.Network {
|
||||
useMessageTypes = true;
|
||||
} else if (ext == "ExtPlayerList") {
|
||||
net.UsingExtPlayerList = true;
|
||||
} else if (ext == "BlockPermissions") {
|
||||
blockPerms = true;
|
||||
} else if (ext == "PlayerClick") {
|
||||
net.UsingPlayerClick = true;
|
||||
} else if (ext == "EnvMapAppearance") {
|
||||
|
@ -59,7 +59,7 @@ namespace ClassicalSharp.Network.Protocols {
|
||||
net.ServerMotd = reader.ReadString();
|
||||
game.Chat.SetLogName(net.ServerName);
|
||||
|
||||
game.LocalPlayer.Hacks.SetUserType(reader.ReadUInt8());
|
||||
game.LocalPlayer.Hacks.SetUserType(reader.ReadUInt8(), !net.cpeData.blockPerms);
|
||||
game.LocalPlayer.Hacks.HacksFlags = net.ServerName + net.ServerMotd;
|
||||
game.LocalPlayer.Hacks.UpdateHacksState();
|
||||
}
|
||||
@ -264,7 +264,7 @@ namespace ClassicalSharp.Network.Protocols {
|
||||
}
|
||||
|
||||
void HandleSetPermission() {
|
||||
game.LocalPlayer.Hacks.SetUserType(reader.ReadUInt8());
|
||||
game.LocalPlayer.Hacks.SetUserType(reader.ReadUInt8(), !net.cpeData.blockPerms);
|
||||
game.LocalPlayer.Hacks.UpdateHacksState();
|
||||
}
|
||||
|
||||
|
@ -221,10 +221,11 @@ void HacksComp_ParseAllFlag(HacksComp* hacks, const UInt8* incFlag, const UInt8*
|
||||
}
|
||||
}
|
||||
|
||||
void HacksComp_SetUserType(HacksComp* hacks, UInt8 value) {
|
||||
void HacksComp_SetUserType(HacksComp* hacks, UInt8 value, bool setBlockPerms) {
|
||||
bool isOp = value >= 100 && value <= 127;
|
||||
hacks->UserType = value;
|
||||
hacks->CanSeeAllNames = isOp;
|
||||
if (!setBlockPerms) return;
|
||||
|
||||
Block_CanPlace[BLOCK_BEDROCK] = isOp;
|
||||
Block_CanDelete[BLOCK_BEDROCK] = isOp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user