mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 12:05:51 -04:00
gun should always revert blockchanges made by player
This commit is contained in:
parent
4bf0b21023
commit
5c1a9654d5
@ -31,15 +31,11 @@ namespace MCGalaxy.Commands.Fun {
|
||||
p.Message("Guns cannot be used on this map!"); return;
|
||||
}
|
||||
if (p.weapon != null && message.Length == 0) {
|
||||
p.weapon.Disable();
|
||||
p.weapon = null;
|
||||
return;
|
||||
p.weapon.Disable(); return;
|
||||
}
|
||||
|
||||
Gun gun = GetGun(p, message);
|
||||
if (gun == null) { Help(p); return; }
|
||||
|
||||
p.weapon = gun;
|
||||
gun.Enable(p);
|
||||
}
|
||||
|
||||
|
@ -42,11 +42,12 @@ namespace MCGalaxy.Games {
|
||||
}
|
||||
this.p = p;
|
||||
p.ClearBlockchange();
|
||||
p.weapon = this;
|
||||
p.Blockchange += BlockClickCallback;
|
||||
|
||||
if (p.Supports(CpeExt.PlayerClick)) {
|
||||
p.Message(Name + " engaged, click to fire at will");
|
||||
} else {
|
||||
p.Blockchange += BlockClickCallback;
|
||||
p.Message(Name + " engaged, fire at will");
|
||||
aimer = new AimBox();
|
||||
aimer.Hook(p);
|
||||
@ -67,8 +68,9 @@ namespace MCGalaxy.Games {
|
||||
Weapon weapon = p.weapon;
|
||||
if (weapon == null) return;
|
||||
|
||||
// always revert block back, client assumes changes always succeed
|
||||
p.RevertBlock(x, y, z);
|
||||
// defer to player click handler
|
||||
// defer to player click handler if used
|
||||
if (weapon.aimer == null) return;
|
||||
|
||||
if (!p.level.Config.Guns) { weapon.Disable(); return; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user