mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
Fix /bind with source block being custom causing error
This commit is contained in:
parent
4cecface9c
commit
497236be31
@ -67,7 +67,7 @@ namespace MCGalaxy.Blocks {
|
||||
}
|
||||
|
||||
// Use red wool to detonate c4
|
||||
BlockID held = p.BlockBindings[(BlockRaw)p.RawHeldBlock];
|
||||
BlockID held = p.BlockBindings[p.RawHeldBlock];
|
||||
if (held == Block.Red) {
|
||||
Player.Message(p, "Placed detonator block, delete it to detonate.");
|
||||
C4Det(p, Block.C4Detonator, x, y, z); return;
|
||||
|
@ -114,13 +114,12 @@ namespace MCGalaxy.Commands.Moderation {
|
||||
Block.GetName(who, block));
|
||||
}
|
||||
|
||||
for (int i = 0; i < who.BlockBindings.Length; i++) {
|
||||
block = who.BlockBindings[i];
|
||||
BlockID defaultBinding = Block.FromRaw((byte)i);
|
||||
if (block == defaultBinding) continue;
|
||||
for (int b = 0; b < who.BlockBindings.Length; b++) {
|
||||
block = who.BlockBindings[b];
|
||||
if (block == b) continue;
|
||||
|
||||
if (!CommandParser.IsBlockAllowed(who, "place", block)) {
|
||||
who.BlockBindings[i] = defaultBinding;
|
||||
who.BlockBindings[b] = (BlockID)b;
|
||||
Player.Message(who, " Hence, binding for &b{0} %Swas unbound",
|
||||
Block.GetName(who, defaultBinding));
|
||||
}
|
||||
|
@ -31,8 +31,8 @@ namespace MCGalaxy.Commands.Building {
|
||||
if (args.Length > 2) { Help(p); return; }
|
||||
|
||||
if (args[0].CaselessEq("clear")) {
|
||||
for (int i = 0; i < p.BlockBindings.Length; i++) {
|
||||
p.BlockBindings[i] = Block.FromRaw((byte)i);
|
||||
for (int b = 0; b < p.BlockBindings.Length; b++) {
|
||||
p.BlockBindings[b] = (BlockID)b;
|
||||
}
|
||||
Player.Message(p, "All bindings were unbound.");
|
||||
return;
|
||||
|
@ -332,13 +332,13 @@ namespace MCGalaxy {
|
||||
ushort x, y, z;
|
||||
IntToPos(C.Index, out x, out y, out z);
|
||||
|
||||
BlockID block = (BlockID)(args.Value1 | (args.ExtBlock << 8));
|
||||
BlockID block = (BlockID)(args.Value1 | (args.ExtBlock << Block.ExtendedShift));
|
||||
Blockchange(C.Index, block, true, default(PhysicsArgs));
|
||||
} else if (args.Type2 == PhysicsArgs.Revert) {
|
||||
ushort x, y, z;
|
||||
IntToPos(C.Index, out x, out y, out z);
|
||||
|
||||
BlockID block = (BlockID)(args.Value2 | (args.ExtBlock << 8));
|
||||
BlockID block = (BlockID)(args.Value2 | (args.ExtBlock << Block.ExtendedShift));
|
||||
Blockchange(C.Index, block, true, default(PhysicsArgs));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -195,7 +195,7 @@ namespace MCGalaxy {
|
||||
|
||||
public BlockID ModeBlock;
|
||||
public BlockID RawHeldBlock = Block.Stone;
|
||||
public BlockID[] BlockBindings = new BlockID[Block.Count];
|
||||
public BlockID[] BlockBindings = new BlockID[Block.ExtendedCount];
|
||||
public string[] CmdBindings = new string[10];
|
||||
public string[] CmdArgsBindings = new string[10];
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace MCGalaxy {
|
||||
}
|
||||
|
||||
BlockID held = block;
|
||||
if (!Block.IsPhysicsType(block)) block = BlockBindings[(BlockRaw)block];
|
||||
block = BlockBindings[block];
|
||||
if (!CheckManualChange(old, block, deletingBlock)) {
|
||||
RevertBlock(x, y, z); return;
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ namespace MCGalaxy {
|
||||
internal Player() {
|
||||
spamChecker = new SpamChecker(this);
|
||||
SessionID = Interlocked.Increment(ref sessionCounter) & SessionIDMask;
|
||||
for (int i = 0; i < BlockBindings.Length; i++) {
|
||||
BlockBindings[i] = Block.FromRaw((byte)i);
|
||||
for (int b = 0; b < BlockBindings.Length; b++) {
|
||||
BlockBindings[b] = (BlockID)b;
|
||||
}
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace MCGalaxy {
|
||||
|
||||
public BlockID GetHeldBlock() {
|
||||
if (ModeBlock != Block.Air) return ModeBlock;
|
||||
return BlockBindings[(BlockRaw)RawHeldBlock];
|
||||
return BlockBindings[RawHeldBlock];
|
||||
}
|
||||
|
||||
public void SetPrefix() {
|
||||
@ -472,7 +472,7 @@ namespace MCGalaxy {
|
||||
SelectionHandler callback = selCallback;
|
||||
ClearSelection();
|
||||
|
||||
if (!Block.IsPhysicsType(block)) block = p.BlockBindings[(BlockRaw)block];
|
||||
block = p.BlockBindings[block];
|
||||
bool canRepeat = callback(this, selMarks, state, block);
|
||||
|
||||
if (canRepeat && staticCommands) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user