本文整理汇总了C#中MCGalaxy.Player.RevertBlock方法的典型用法代码示例。如果您正苦于以下问题:C# Player.RevertBlock方法的具体用法?C# Player.RevertBlock怎么用?C# Player.RevertBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MCGalaxy.Player
的用法示例。
在下文中一共展示了Player.RevertBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RevertAndClearState
protected static void RevertAndClearState(Player p, ushort x, ushort y, ushort z) {
p.ClearBlockchange();
p.RevertBlock(x, y, z);
}
示例2: Blockchange
public void Blockchange(Player p, ushort x, ushort y, ushort z, byte type, byte extType = 0) {
string errorLocation = "start";
retry:
try
{
if (x < 0 || y < 0 || z < 0) return;
if (x >= Width || y >= Height || z >= Length) return;
byte b = GetTile(x, y, z), extB = 0;
if (b == Block.custom_block)
extB = GetExtTile(x, y, z);
errorLocation = "Permission checking";
if (!CheckAffectPermissions(p, x, y, z, b, type, extType)) {
p.RevertBlock(x, y, z); return;
}
if (b == Block.sponge && physics > 0 && type != Block.sponge)
PhysSpongeRemoved(PosToInt(x, y, z));
if (b == Block.lava_sponge && physics > 0 && type != Block.lava_sponge)
PhysSpongeRemoved(PosToInt(x, y, z), true);
errorLocation = "Undo buffer filling";
Player.UndoPos Pos;
Pos.x = x; Pos.y = y; Pos.z = z;
Pos.mapName = name;
Pos.type = b; Pos.extType = extB;
Pos.newtype = type; Pos.newExtType = extType;
Pos.timePlaced = DateTime.Now;
p.UndoBuffer.Add(Pos);
errorLocation = "Setting tile";
p.loginBlocks++;
p.overallBlocks++;
SetTile(x, y, z, type);
if (b == Block.custom_block && type != Block.custom_block)
RevertExtTileNoCheck(x, y, z);
if (type == Block.custom_block)
SetExtTileNoCheck(x, y, z, extType);
errorLocation = "Block sending";
bool diffBlock = Block.Convert(b) != Block.Convert(type);
if (!diffBlock && b == Block.custom_block)
diffBlock = extType != extB;
if (diffBlock && !Instant)
Player.GlobalBlockchange(this, x, y, z, type, extType);
errorLocation = "Growing grass";
if (GetTile(x, (ushort)(y - 1), z) == Block.grass && GrassDestroy && !Block.LightPass(type)) {
Blockchange(p, x, (ushort)(y - 1), z, Block.dirt);
}
errorLocation = "Adding physics";
if (p.PlayingTntWars && type == Block.smalltnt) AddCheck(PosToInt(x, y, z), "", false, p);
if (physics > 0) if (Block.Physics(type)) AddCheck(PosToInt(x, y, z), "", false, p);
changed = true;
backedup = false;
} catch (OutOfMemoryException) {
Player.SendMessage(p, "Undo buffer too big! Cleared!");
p.UndoBuffer.Clear();
goto retry;
} catch (Exception e) {
Server.ErrorLog(e);
Chat.GlobalMessageOps(p.name + " triggered a non-fatal error on " + name);
Chat.GlobalMessageOps("Error location: " + errorLocation);
Server.s.Log(p.name + " triggered a non-fatal error on " + name);
Server.s.Log("Error location: " + errorLocation);
}
}
示例3: Player_PlayerBlockChange
void Player_PlayerBlockChange(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
{
if (started)
{
if (p.level == mainlevel && !blueteam.members.Contains(p) && !redteam.members.Contains(p))
{
p.RevertBlock(x, y, z);
Player.SendMessage(p, "You are not on a team!");
Plugin.CancelPlayerEvent(PlayerEvents.BlockChange, p);
}
if (p.level == mainlevel && blueteam.members.Contains(p) && x == redbase.x && y == redbase.y && z == redbase.z && mainlevel.GetTile(redbase.x, redbase.y, redbase.z) != Block.air)
{
Chat.GlobalMessageLevel(mainlevel, blueteam.color + p.name + " took the " + redteam.color + " red team's FLAG!");
GetPlayer(p).hasflag = true;
}
if (p.level == mainlevel && redteam.members.Contains(p) && x == bluebase.x && y == bluebase.y && z == bluebase.z && mainlevel.GetTile(bluebase.x, bluebase.y, bluebase.z) != Block.air)
{
Chat.GlobalMessageLevel(mainlevel, redteam.color + p.name + " took the " + blueteam.color + " blue team's FLAG");
GetPlayer(p).hasflag = true;
}
if (p.level == mainlevel && blueteam.members.Contains(p) && x == bluebase.x && y == bluebase.y && z == bluebase.z && mainlevel.GetTile(bluebase.x, bluebase.y, bluebase.z) != Block.air)
{
if (GetPlayer(p).hasflag)
{
Chat.GlobalMessageLevel(mainlevel, blueteam.color + p.name + " RETURNED THE FLAG!");
GetPlayer(p).hasflag = false;
GetPlayer(p).cap++;
GetPlayer(p).points += cappoint;
blueteam.points++;
mainlevel.Blockchange(redbase.x, redbase.y, redbase.z, Block.red);
p.RevertBlock(x, y, z);
Plugin.CancelPlayerEvent(PlayerEvents.BlockChange, p);
if (blueteam.points >= maxpoints)
{
End();
return;
}
}
else
{
Player.SendMessage(p, "You cant take your own flag!");
p.RevertBlock(x, y, z);
Plugin.CancelPlayerEvent(PlayerEvents.BlockChange, p);
}
}
if (p.level == mainlevel && redteam.members.Contains(p) && x == redbase.x && y == redbase.y && z == redbase.z && mainlevel.GetTile(redbase.x, redbase.y, redbase.z) != Block.air)
{
if (GetPlayer(p).hasflag)
{
Chat.GlobalMessageLevel(mainlevel, redteam.color + p.name + " RETURNED THE FLAG!");
GetPlayer(p).hasflag = false;
GetPlayer(p).points += cappoint;
GetPlayer(p).cap++;
redteam.points++;
mainlevel.Blockchange(bluebase.x, bluebase.y, bluebase.z, Block.blue);
p.RevertBlock(x, y, z);
Plugin.CancelPlayerEvent(PlayerEvents.BlockChange, p);
if (redteam.points >= maxpoints)
{
End();
return;
}
}
else
{
Player.SendMessage(p, "You cant take your own flag!");
p.RevertBlock(x, y, z);
Plugin.CancelPlayerEvent(PlayerEvents.BlockChange, p);
}
}
}
}