void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs args) { Vector3S v = new Vector3S(args.X, args.Z, args.Y); if (store[sender.Level.Name].Contains(v)) { object msg = sender.Level.ExtraData["MessageBlock" + v]; if (msg != null && msg.GetType() == typeof(string) && ((string)msg).Length > 0) { if (((string)msg).StartsWith("c")) { if (removeCommandOnAir && (args.Action == ActionType.Delete || args.Holding == 0)) { Remove(sender.Level, v); } else if (protectBlockType) { args.Cancel(); } } else { if (removeMessageOnAir && (args.Action == ActionType.Delete || args.Holding == 0)) { Remove(sender.Level, v); } else if (protectBlockType) { args.Cancel(); } } } } }
public void BlockChange(Player p, BlockChangeEventArgs args) { p.OnPlayerBlockChange.Normal -= BlockChange; WorldComponent.GenerateTree(p, args.X, args.Z, args.Y, (TreeType)p.ExtraData["TreeType"], ServerSettings.GetSettingBoolean("TreesGoThrough")); args.Cancel(); p.ExtraData.Remove("TreeType"); }
void BlockChange(Player sender, BlockChangeEventArgs e) { e.Cancel(); var raw = (BrushData)sender.ExtraData.GetIfExist <object, object> ("BrushData"); if (raw == null) { sender.SendMessage("An error occurred while trying to brush"); sender.OnPlayerBlockChange.Normal -= BlockChange; return; } byte block = raw.Block != 255 ? raw.Block : e.Holding; Vector3S loc = new Vector3S(e.X, e.Z, e.Y); IBrush b = (IBrush)Activator.CreateInstance(raw.BrushType); var qq = b.Draw(loc, raw.Block, raw.Size); if (sender.Group.MaxBlockChange < qq.Count()) { sender.SendMessage("You cannot set that many blocks"); return; } foreach (var fml in qq) { sender.SendBlockChange((ushort)fml.x, (ushort)fml.z, (ushort)fml.y, block); } #if DEBUG sender.SendMessage(string.Format("Brushed {0} blocks", qq.Count())); #endif }
//public void CatchBlock2(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass) public void CatchBlock2(Player sender, BlockChangeEventArgs args) { args.Cancel(); args.Unregister(); sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y)); CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos"); Vector3S FirstBlock = cpos.FirstBlock; ushort xx, zz, yy; int count = 0; for (xx = Math.Min((ushort)(FirstBlock.x), args.X); xx <= Math.Max((ushort)(FirstBlock.x), args.X); ++xx) { for (zz = Math.Min((ushort)(FirstBlock.z), args.Z); zz <= Math.Max((ushort)(FirstBlock.z), args.Z); ++zz) { for (yy = Math.Min((ushort)(FirstBlock.y), args.Y); yy <= Math.Max((ushort)(FirstBlock.y), args.Y); ++yy) { if (cpos.ignore == null || !cpos.ignore.Contains(sender.Level.GetBlock(xx, zz, yy))) { count++; } } } } sender.SendMessage(count + " blocks are between (" + FirstBlock.x + ", " + FirstBlock.z + ", " + FirstBlock.y + ") and (" + args.X + ", " + args.Z + ", " + args.Y + ")"); }
void OnBlockChange(Player sender, BlockChangeEventArgs e) { sender.OnPlayerBlockChange.Normal -= OnBlockChange; e.Cancel(); using (var data = Database.fillData("SELECT * FROM Blocks WHERE X = '" + e.X + "' AND Y = '" + e.Y + "' AND Z = '" + e.Z + "' AND Level = '" + sender.Level.Name.MySqlEscape() + "';")) { if (data.Rows.Count == 0) { sender.SendMessage("This block has not been modified since the map was cleared or created."); return; } for (int i = 0; i < data.Rows.Count; i++) { string username; string color; string block; string time; bool deleted; using (var playerData = Database.fillData("SELECT * FROM _players WHERE UID = " + data.Rows[i]["UID"].ToString())) { username = playerData.Rows[0]["Name"].ToString(); color = playerData.Rows[0]["color"].ToString(); } block = ((Block)byte.Parse(data.Rows[i]["Block"].ToString())).Name; time = DateTime.Parse(data.Rows[i]["Date"].ToString()).ToString("yyyy-MM-dd HH:mm:ss"); deleted = data.Rows[i]["Deleted"].ToString().ToLower() == "true"; sender.SendMessage((deleted ? "&4Destroyed by " : "&3Created by ") + Server.DefaultColor + color + username + Server.DefaultColor + ", using &3" + block + Server.DefaultColor + " At " + time); } } if (sender.StaticCommandsEnabled) { sender.SendMessage("Break block to get info"); sender.OnPlayerBlockChange.Normal += OnBlockChange; } }
void OnAllPlayersBlockChange_Low(Player sender, BlockChangeEventArgs args) { if (args.Canceled) { return; } if (args.Action == ActionType.Place) { #region Dirt/Grass if (autoGrass && args.Holding == Block.BlockList.DIRT && Block.CanPassLight(sender.Level.GetBlock(args.X, args.Z, args.Y + 1))) { args.Holding = Block.BlockList.GRASS; } if (autoDirt && args.Holding != Block.BlockList.AIR && sender.Level.GetBlock(args.X, args.Z, args.Y - 1) == Block.BlockList.GRASS) { sender.Level.BlockChange(args.X, args.Z, (ushort)(args.Y - 1), Block.BlockList.DIRT, sender); } #endregion if (autoDoubleStair && args.Holding == Block.BlockList.STAIR && sender.Level.GetBlock(args.X, args.Z, args.Y - 1) == Block.BlockList.STAIR) { args.Cancel(); sender.Level.BlockChange(args.X, args.Z, (ushort)(args.Y - 1), Block.BlockList.DOUBLE_STAIR, sender); } } else { if (autoGrass && sender.Level.GetBlock(args.X, args.Z, args.Y - 1) == Block.BlockList.DIRT) { sender.Level.BlockChange(args.X, args.Z, (ushort)(args.Y - 1), Block.BlockList.GRASS, sender); } } }
void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) { args.Cancel(); if (args.Current == 0 && args.Action == ActionType.Delete) { args.Current = 20; } sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal; if (sender.ExtraData["Cursor"] != null) { Vector3S cursor; if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S)) { cursor = (Vector3S)sender.ExtraData["Cursor"]; } else { cursor = new Vector3S(); cursor.FromString((string)sender.ExtraData["Cursor"]); } if (args.Action == ActionType.Place) { sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding); } else { sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false); } } sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal; Curse(sender); }
void CatchBlockTwo(Player sender, BlockChangeEventArgs e) { e.Cancel(); sender.OnPlayerBlockChange.Normal -= CatchBlockTwo; try { BlockInfo raw = (BlockInfo)sender.ExtraData.GetIfExist <object, object>("Command.Line"); Vector3S from = raw.Pos; Vector3S to = new Vector3S(e.X, e.Z, e.Y); byte block = raw.Block; IEnumerable <Vector3S> path = from.PathTo(to); if (sender.Group.MaxBlockChange < path.Count()) { sender.SendMessage("You are not allowed to change that many blocks"); return; } foreach (var pos in path) { if (!sender.Level.IsInBounds(pos)) { continue; } BlockQueue.Addblock(sender, (ushort)pos.x, (ushort)pos.y, (ushort)pos.z, block); } sender.SendMessage(string.Format("Changed {0} blocks in a line", path.Count())); } catch (Exception er) { sender.SendMessage("An Error occurred while trying to make a pretty line"); Logger.LogError(er); } }
private void OnPlayerBlockChangeOnNormal2(Player sender, BlockChangeEventArgs args) { args.Unregister(); args.Cancel(); var data = (KeyValuePair <KeyValuePair <string, byte>, Vector3D>)sender.GetDatapass(Name); new Zone(data.Value, new Vector3D(args.X, args.Z, args.Y), sender, data.Key.Key, data.Key.Value); }
void add_Normal(Player sender, BlockChangeEventArgs args) { sender.OnPlayerBlockChange.Normal -= add_Normal; args.Cancel(); string message = (string)sender.GetDatapass("MessageBlockMessage"); add(sender.Level, args.X, args.Z, args.Y, message, sender); }
void BlockChange1(Player sender, BlockChangeEventArgs args) { CatchPos cpos = (CatchPos)sender.GetDatapass(Name); cpos.pos = new Vector3S((short)args.X, (short)args.Z, (short)args.Y); args.Cancel(); sender.OnPlayerBlockChange.Normal -= BlockChange1; sender.SetDatapass(Name, cpos); sender.OnPlayerBlockChange.Normal += BlockChange2; }
public void CatchBlock2(Player p, BlockChangeEventArgs args) { p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock2); CatchPos cpos = (CatchPos)p.GetDatapass(this.Name); cpos.pos2 = new Vector3S(args.X, args.Z, args.Y); args.Cancel(); Replace(cpos, p); }
public void BC1(Player p, BlockChangeEventArgs args) { p.ExtraData["Mark1"] = new Vector3S(args.X, args.Z, args.Y); p.SendMessage("First coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")"); args.Unregister(); args.Cancel(); p.SendMessage("Break or place a block to select the second point."); p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(BC2); }
public void BC1(Player p, BlockChangeEventArgs args) { p.ExtraData["Mark1"] = new Vector3S(args.X, args.Z, args.Y); p.SendMessage("First coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")"); args.Unregister(); args.Cancel(); p.SendMessage("Break or place a block to select the second point."); p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(BC2); }
public void CatchBlock(Player sender, BlockChangeEventArgs args) { CatchPos cpos = (CatchPos)sender.GetDatapass("CmdReplace_cpos"); ; cpos.pos = new Vector3S(args.X, args.Y, args.Z); args.Unregister(); args.Cancel(); sender.SetDatapass("CmdReplace_cpos", cpos); sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2); }
public void CatchBlock1(Player p, BlockChangeEventArgs args) { CatchPos cpos = (CatchPos)p.GetDatapass(this.Name); cpos.pos = new Vector3S(args.X, args.Z, args.Y); args.Cancel(); p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock1); p.SetDatapass(this.Name, cpos); p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2); }
void CatchBlockOne(Player sender, BlockChangeEventArgs e) { BlockInfo block = (BlockInfo)sender.ExtraData.GetIfExist <object, object>("Command.Line"); sender.ExtraData.ChangeOrCreate <object, object>("Command.Line", new BlockInfo(block.Block != 255 ? block.Block : e.Holding, new Vector3S(e.X, e.Z, e.Y))); e.Cancel(); sender.OnPlayerBlockChange.Normal -= CatchBlockOne; sender.OnPlayerBlockChange.Normal += new Event <Player, BlockChangeEventArgs> .EventHandler(CatchBlockTwo); }
void BlockChange2(Player sender, BlockChangeEventArgs args) { //string direction = null; sender.OnPlayerBlockChange.Normal -= BlockChange2; CatchPos cpos = (CatchPos)sender.GetDatapass(this.Name); foreach (Vector3S v in BlockString(cpos.message, cpos.pos, new Vector3S(args.X, args.Z, args.Y), sender.Level.Size)) { sender.Level.BlockChange(v, args.Holding, sender); } args.Cancel(); return; }
private void OnPlayerBlockChangeOnNormal(Player sender, BlockChangeEventArgs args) { args.Unregister(); args.Cancel(); var data = (KeyValuePair <string, byte>)sender.GetDatapass(Name); sender.SetDatapass(Name, new KeyValuePair <KeyValuePair <string, byte>, Vector3D>(data, new Vector3D(args.X, args.Z, args.Y))); sender.SendMessage("Now, please place a 2nd block to finish defining the region"); sender.OnPlayerBlockChange.Normal += OnPlayerBlockChangeOnNormal2; }
void BlockChange1(Player sender, BlockChangeEventArgs args) { CatchPos cpos = (CatchPos)sender.GetDatapass(Name); cpos.pos = new Vector3S((short)args.X, (short)args.Z, (short)args.Y); args.Cancel(); sender.OnPlayerBlockChange.Normal -= BlockChange1; sender.SetDatapass(Name, cpos); sender.OnPlayerBlockChange.Normal += BlockChange2; }
public void CatchBlock2(Player p, BlockChangeEventArgs args) { p.OnPlayerBlockChange.Normal -= new Event <Player, BlockChangeEventArgs> .EventHandler(CatchBlock2); CatchPos cpos = (CatchPos)p.GetDatapass(this.Name); cpos.pos2 = new Vector3S(args.X, args.Z, args.Y); args.Cancel(); Replace(cpos, p); }
//public void CatchBlock(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass) public void CatchBlock(Player sender, BlockChangeEventArgs args) { args.Cancel(); args.Unregister(); sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y)); CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos"); cpos.FirstBlock = new Vector3S(args.X, args.Z, args.Y); sender.SetDatapass("CmdMeasure_cpos", cpos); sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2); //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock2), (object)cpos); }
public void CatchBlock2(Player p, BlockChangeEventArgs args) { p.OnPlayerBlockChange.Normal -= new Event <Player, BlockChangeEventArgs> .EventHandler(CatchBlock2); CatchPos cpos = (CatchPos)p.GetDatapass(this.Name); cpos.secondPos = new Vector3S(args.X, args.Z, args.Y); cpos.block = args.Holding; args.Cancel(); Cuboid(cpos, p); }
public void CatchBlock1(Player p, BlockChangeEventArgs args) { CatchPos cpos = new CatchPos(); cpos.pos = new Vector3S(args.X, args.Z, args.Y); args.Cancel(); p.OnPlayerBlockChange.Normal -= new Event <Player, BlockChangeEventArgs> .EventHandler(CatchBlock1); p.SetDatapass(this.Name, cpos); p.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2); }
void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs args) { string username = Helper.GetOwner(new Vector3S(args.X, args.Z, args.Y), sender.Level.Name); if (username == null) //no owner, ADD ALL THE BLOCKS { return; } if ((AllowList.Count == 0 && username != sender.Username) || (AllowList.ContainsKey(username) && !AllowList[username].Contains(sender) && sender.Group.Permission > (byte)PermissionLevel.Operator && args.Action != ActionType.Place)) { sender.SendMessage("U silly head, you didnt make this. Ask " + username + " to add you to list"); args.Cancel(); } if (!hasPlayerInfo(sender)) { players.Add(new PlayerInfo(sender)); return; } PlayerInfo pi = getPlayerInfo(sender); if (pi.LastBlock == args.Holding && args.Action == ActionType.Place) { if (pi.LastPlace.AddMilliseconds(1000) > DateTime.Now) { pi.offense++; } else { pi.offense--; } if (getPlayerInfo(sender).kicked) { args.Cancel(); } } }
private void OnAllPlayersBlockChangeOnHigh(Player sender, BlockChangeEventArgs args) { var zones = Zone.FindAllWithin(new Vector3D(args.X, args.Z, args.Y)); foreach (var zone in zones) { if (zone.CanBuildIn(sender)) continue; sender.SendMessage("You cannot build in this Zone! This zone if for: " + (PlayerGroup.FindPermInt(zone.Permission) ?? ("Permission: " + zone.Permission)) + " or higher!"); args.Cancel(); return; } }
//public void CatchBlock(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass) public void CatchBlock(Player sender, BlockChangeEventArgs args) { args.Cancel(); args.Unregister(); sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y)); CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos"); cpos.FirstBlock = new Vector3S(args.X, args.Z, args.Y); sender.SetDatapass("CmdMeasure_cpos", cpos); sender.OnPlayerBlockChange.Normal += new BlockChangeEvent.EventHandler(CatchBlock2); //p.CatchNextBlockchange(new Player.BlockChangeDelegate(CatchBlock2), (object)cpos); }
void BlockChange2(Player sender, BlockChangeEventArgs args) { //string direction = null; sender.OnPlayerBlockChange.Normal -= BlockChange2; CatchPos cpos = (CatchPos)sender.GetDatapass(this.Name); foreach (Vector3S v in BlockString(cpos.message, cpos.pos, new Vector3S(args.X, args.Z, args.Y), sender.Level.Size)) { sender.Level.BlockChange(v, args.Holding, sender); } args.Cancel(); return; }
void BlockChange2(Player sender, BlockChangeEventArgs args) { //string direction = null; sender.OnPlayerBlockChange.Normal -= BlockChange2; CatchPos cpos = (CatchPos)sender.GetDatapass(this.Name); foreach (Vector3S v in BlockString(cpos.message, cpos.pos, new Vector3S(args.X, args.Z, args.Y), sender.Level.CWMap.Size)) { BlockQueue.Addblock(sender, (ushort)v.x, (ushort)v.y, (ushort)v.z, args.Holding); } args.Cancel(); return; }
public void BC2(Player p, BlockChangeEventArgs args) { Vector3S _s = new Vector3S(); p.ExtraData["Mark2"] = new Vector3S(args.X, args.Z, args.Y); p.SendMessage("Second coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")"); args.Unregister(); args.Cancel(); Vector3S m1 = (Vector3S)p.ExtraData["Mark1"]; Vector3S m2 = (Vector3S)p.ExtraData["Mark2"]; p.SendMessage("Marked coordinates:"); p.SendMessage("(" + m1.x + ", " + m1.z + ", " + m1.y + "), (" + m2.x + ", " + m2.z + ", " + m2.y + ")"); p.ExtraData["HasMarked"] = true; }
void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs args) { Vector3S v = new Vector3S(args.X, args.Z, args.Y); if (store[sender.Level.Name].Contains(v)) { object msg = sender.Level.ExtraData["MessageBlock" + v]; if (msg != null && msg.GetType() == typeof(string) && ((string)msg).Length > 0) { if (((string)msg).StartsWith("c")) { if (removeCommandOnAir && (args.Action == ActionType.Delete || args.Holding == 0)) { Remove(sender.Level, v); } else if (protectBlockType) { args.Cancel(); } } else { if (removeMessageOnAir && (args.Action == ActionType.Delete || args.Holding == 0)) { Remove(sender.Level, v); } else if (protectBlockType) { args.Cancel(); } } } } }
public void BC2(Player p, BlockChangeEventArgs args) { Vector3S _s = new Vector3S(); p.ExtraData["Mark2"] = new Vector3S(args.X, args.Z, args.Y); p.SendMessage("Second coordinate marked. (" + args.X + ", " + args.Z + ", " + args.Y + ")"); args.Unregister(); args.Cancel(); Vector3S m1 = (Vector3S)p.ExtraData["Mark1"]; Vector3S m2 = (Vector3S)p.ExtraData["Mark2"]; p.SendMessage("Marked coordinates:"); p.SendMessage("(" + m1.x + ", " + m1.z + ", " + m1.y + "), (" + m2.x + ", " + m2.z + ", " + m2.y + ")"); p.ExtraData["HasMarked"] = true; }
private void OnAllPlayersBlockChangeOnHigh(Player sender, BlockChangeEventArgs args) { var zones = Zone.FindAllWithin(new Vector3D(args.X, args.Z, args.Y)); foreach (var zone in zones) { if (zone.CanBuildIn(sender)) { continue; } sender.SendMessage("You cannot build in this Zone! This zone if for: " + (PlayerGroup.FindPermInt(zone.Permission) ?? ("Permission: " + zone.Permission)) + " or higher!"); args.Cancel(); return; } }
//public void CatchBlock2(Player p, ushort x, ushort z, ushort y, byte NewType, bool placed, object DataPass) public void CatchBlock2(Player sender, BlockChangeEventArgs args) { args.Cancel(); args.Unregister(); sender.SendBlockChange(args.X, args.Z, args.Y, sender.Level.GetBlock(args.X, args.Z, args.Y)); CatchPos cpos = (CatchPos)sender.GetDatapass("CmdMeasure_cpos"); Vector3S FirstBlock = cpos.FirstBlock; ushort xx, zz, yy; int count = 0; for (xx = Math.Min((ushort)(FirstBlock.x), args.X); xx <= Math.Max((ushort)(FirstBlock.x), args.X); ++xx) for (zz = Math.Min((ushort)(FirstBlock.z), args.Z); zz <= Math.Max((ushort)(FirstBlock.z), args.Z); ++zz) for (yy = Math.Min((ushort)(FirstBlock.y), args.Y); yy <= Math.Max((ushort)(FirstBlock.y), args.Y); ++yy) { if (cpos.ignore == null || !cpos.ignore.Contains(sender.Level.GetBlock(xx, zz, yy))) { count++; } } sender.SendMessage(count + " blocks are between (" + FirstBlock.x + ", " + FirstBlock.z + ", " + FirstBlock.y + ") and (" + args.X + ", " + args.Z + ", " + args.Y + ")"); }
public void OnAllPlayersBlockChange(Player sender, BlockChangeEventArgs evt) { byte perBuild = 0; try { perBuild = (byte)sender.Level.Settings.perbuild; } catch { } if (sender.Group.Permission < perBuild) { sender.SendMessage("You cannot build here"); evt.Cancel(); } }
void OnBlockChange(Player sender, BlockChangeEventArgs e) { sender.OnPlayerBlockChange.Normal -= OnBlockChange; e.Cancel(); int count = 0; foreach (var info in BlockChangeHistory.About(sender.Level.Name, e.X, e.Z, e.Y)) { string name = Player.GetName(info.Item2); string color = Player.GetColor(info.Item2); sender.SendMessage(((name == null) ? "nobody" : ((color == null) ? "" : color) + name) + " changed to " + ((info.Item1 == 0) ? "&4" : "&3") + ((Block)info.Item1).Name + " " + Server.DefaultColor + "at " + new DateTime(info.Item3).ToString("dd/MM/yy HH:mm:ss")); count++; } sender.SendMessage(count + Server.DefaultColor + " changes listed."); if (sender.StaticCommandsEnabled) { sender.SendMessage("Break block to get info"); sender.OnPlayerBlockChange.Normal += OnBlockChange; } }
void remove_Normal(Player sender, BlockChangeEventArgs args) { sender.OnPlayerBlockChange.Normal -= remove_Normal; args.Cancel(); Vector3S v = new Vector3S(args.X, args.Z, args.Y); PluginMessageBlock pmb = (PluginMessageBlock)Plugin.getByType(typeof(PluginMessageBlock).Name); if (pmb == null) { sender.SendMessage(typeof(PluginMessageBlock).Name + " is currently not loaded"); return; } if (pmb.Remove(sender.Level, v)) { sender.SendMessage("Message block removed"); } else { sender.SendMessage("There was already no message set for this block"); } }
void OnPlayerBlockChange_Normal(Player sender, BlockChangeEventArgs args) { args.Cancel(); if (args.Current == 0 && args.Action == ActionType.Delete) args.Current = 20; sender.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal; if (sender.ExtraData["Cursor"] != null) { Vector3S cursor; if (sender.ExtraData["Cursor"].GetType() == typeof(Vector3S)) cursor = (Vector3S)sender.ExtraData["Cursor"]; else { cursor = new Vector3S(); cursor.FromString((string)sender.ExtraData["Cursor"]); } if (args.Action == ActionType.Place) { sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y + 1), args.Holding); } else { sender.Click((ushort)cursor.x, (ushort)cursor.z, (ushort)(cursor.y), args.Holding, false); } } sender.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal; Curse(sender); }
public void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs evt) { byte perBuildMax = byte.MaxValue; if (sender.Level.ExtraData.ContainsKey("perbuildmax")) { try { perBuildMax = (byte)sender.Level.ExtraData["perbuildmax"]; } catch { perBuildMax = byte.MaxValue; } } if (sender.Group.Permission > perBuildMax) { sender.SendMessage("You cannot build here"); evt.Cancel(); } }
public void OnAllPlayersBlockChange(Player sender, BlockChangeEventArgs evt) { byte perBuild = 0; if (sender.Level.ExtraData.ContainsKey("perbuild")) { try { perBuild = (byte)sender.Level.ExtraData["perbuild"]; } catch { perBuild = 0; } } if (sender.Group.Permission < perBuild) { sender.SendMessage("You cannot build here"); evt.Cancel(); } }
public void CatchBlock2(Player p, BlockChangeEventArgs args) { p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock2); CatchPos cpos = (CatchPos)p.GetDatapass(this.Name); Cuboid(cpos, args.Holding, p, args.X, args.Y, args.Z); args.Cancel(); }
void CatchBlockTwo(Player sender, BlockChangeEventArgs e) { e.Cancel(); sender.OnPlayerBlockChange.Normal -= CatchBlockTwo; try { BlockInfo raw = (BlockInfo)sender.ExtraData.GetIfExist<object, object>("Command.Line"); Vector3S from = raw.Pos; Vector3S to = new Vector3S(e.X, e.Z, e.Y); byte block = raw.Block; IEnumerable<Vector3S> path = from.PathTo(to); if (sender.Group.MaxBlockChange < path.Count()) { sender.SendMessage("You are not allowed to change that many blocks"); return; } foreach (var pos in path) { if (!sender.Level.IsInBounds(pos)) continue; BlockQueue.Addblock(sender, (ushort)pos.x, (ushort)pos.y, (ushort)pos.z, block); } sender.SendMessage(string.Format("Changed {0} blocks in a line", path.Count())); } catch (Exception er) { sender.SendMessage("An Error occurred while trying to make a pretty line"); Logger.LogError(er); } }
void BlockChange2(Player sender, BlockChangeEventArgs args) { //string direction = null; sender.OnPlayerBlockChange.Normal -= BlockChange2; CatchPos cpos = (CatchPos)sender.GetDatapass(this.Name); foreach (Vector3S v in BlockString(cpos.message, cpos.pos, new Vector3S(args.X, args.Z, args.Y), sender.Level.CWMap.Size)) { BlockQueue.Addblock(sender, (ushort)v.x, (ushort)v.y, (ushort)v.z, args.Holding); } args.Cancel(); return; }
public void OnAllPlayersBlockChange(Player sender, BlockChangeEventArgs evt) { byte perBuild = 0; if (sender.Level.ExtraData.ContainsKey("perbuild")) { try { perBuild = (byte)sender.Level.ExtraData["perbuild"]; } catch { perBuild = 0; } } if (sender.Group.Permission < perBuild) { sender.SendMessage("You cannot build here"); evt.Cancel(); } }
void add_Normal(Player sender, BlockChangeEventArgs args) { sender.OnPlayerBlockChange.Normal -= add_Normal; args.Cancel(); string message = (string)sender.GetDatapass("MessageBlockMessage"); add(sender.Level, args.X, args.Z, args.Y, message, sender); }
void BlockChange(Player sender, BlockChangeEventArgs e) { e.Cancel(); var raw = (BrushData)sender.ExtraData.GetIfExist<object, object> ("BrushData"); if(raw == null){ sender.SendMessage("An error occurred while trying to brush"); sender.OnPlayerBlockChange.Normal -= BlockChange; return; } byte block = raw.Block != 255 ? raw.Block : e.Holding; Vector3S loc = new Vector3S(e.X, e.Z, e.Y); IBrush b = (IBrush)Activator.CreateInstance(raw.BrushType); var qq = b.Draw(loc, raw.Block, raw.Size); if (sender.Group.MaxBlockChange < qq.Count()) { sender.SendMessage("You cannot set that many blocks"); return; } foreach (var fml in qq) sender.SendBlockChange((ushort)fml.x, (ushort)fml.z, (ushort)fml.y, block); #if DEBUG sender.SendMessage(string.Format("Brushed {0} blocks", qq.Count())); #endif }
void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs args) { string username = Helper.GetOwner(new Vector3S(args.X, args.Z, args.Y), sender.Level.Name); if (username == null) //no owner, ADD ALL THE BLOCKS return; if ((AllowList.Count == 0 && username != sender.Username) || (AllowList.ContainsKey(username) && !AllowList[username].Contains(sender) && sender.Group.Permission > (byte)PermissionLevel.Operator && args.Action != ActionType.Place)) { sender.SendMessage("U silly head, you didnt make this. Ask " + username + " to add you to list"); args.Cancel(); } if (!hasPlayerInfo(sender)) { players.Add(new PlayerInfo(sender)); return; } PlayerInfo pi = getPlayerInfo(sender); if (pi.LastBlock == args.Holding && args.Action == ActionType.Place) { if (pi.LastPlace.AddMilliseconds(1000) > DateTime.Now) pi.offense++; else pi.offense--; if (getPlayerInfo(sender).kicked) args.Cancel(); } }
public void OnAllPlayersBlockChange(Player sender, BlockChangeEventArgs evt) { byte perBuild = 0; try { perBuild = (byte)sender.Level.Settings.perbuild; } catch { } if (sender.Group.Permission < perBuild) { sender.SendMessage("You cannot build here"); evt.Cancel(); } }
public void OnBlockChange(Player Player, BlockChangeEventArgs args) { ExtraPlayerData p = FindPlayer(Player); #region Block Placing Limit if (p.AmountOfBlocksLeft <= 0 && ZombieRoundEnabled && args.Action == ActionType.Place) { Player.SendMessage("[Zombie Survival]: " + Colors.red + "You don't have any more blocks! You can buy more at the /store!"); args.Cancel(); return; } if (ZombieRoundEnabled && args.Action == ActionType.Place && !p.Referee) p.AmountOfBlocksLeft -= 1; if ((p.AmountOfBlocksLeft % 10 == 0 || p.AmountOfBlocksLeft < 6) && ZombieRoundEnabled && args.Action == ActionType.Place && !p.Referee) p.Player.SendMessage("[Zombie Survival]: " + Colors.red + "You have " + p.AmountOfBlocksLeft + " blocks left!"); #endregion #region Anti-spleef/bedrock if (args.Action == ActionType.Delete && Player.Level.GetBlock(args.X, args.Z, args.Y) == Block.BlockList.BEDROCK && !p.Referee) { p.Player.SendMessage("[Zombie Survival]: " + Colors.red + "You cannot break this >:("); if (p.TheTypeOfNotification != 1) WOM.GlobalSendAlert(Player.Username + " tried to break bedrock (Hacking?)"); p.TheTypeOfNotification = 1; args.Cancel(); return; } if (args.Action == ActionType.Delete && !p.Referee) { foreach (Player z in Server.Players.ToArray()) { if (new Vector3S(args.X, args.Z, (ushort)(args.Y + 2)) == (z.Pos / 32) && !z.IsHidden && z != Player) { p.Player.SendMessage("[Zombie Survival]: " + Colors.red + "You cannot spleef another player >:("); if (p.TheTypeOfNotification != 2) WOM.GlobalSendAlert(Player.Username + " spleefed " + z.Username); p.TheTypeOfNotification = 2; args.Cancel(); return; } } } #endregion #region Anti-pillaring if (args.Y - p.LastYValue == 1 && !p.Referee) { p.AmountOfPillars += 1; if (p.AmountOfPillars > 7) { p.Player.Kick("You are not allowed to pillar on this server!"); } } else { if (p.AmountOfPillars > 0) { p.AmountOfPillars -= 1; } } p.LastYValue = args.Y; #endregion }
public void OnAllPlayersBlockChange_Normal(Player sender, BlockChangeEventArgs evt) { byte perBuildMax = byte.MaxValue; if (sender.Level.ExtraData.ContainsKey("perbuildmax")) { try { perBuildMax = (byte)sender.Level.ExtraData["perbuildmax"]; } catch { perBuildMax = byte.MaxValue; } } if (sender.Group.Permission > perBuildMax) { sender.SendMessage("You cannot build here"); evt.Cancel(); } }
void CatchBlockOne(Player sender, BlockChangeEventArgs e) { BlockInfo block = (BlockInfo)sender.ExtraData.GetIfExist<object, object>("Command.Line"); sender.ExtraData.ChangeOrCreate<object, object>("Command.Line", new BlockInfo(block.Block != 255 ? block.Block : e.Holding, new Vector3S(e.X, e.Z, e.Y))); e.Cancel(); sender.OnPlayerBlockChange.Normal -= CatchBlockOne; sender.OnPlayerBlockChange.Normal += new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlockTwo); }
void remove_Normal(Player sender, BlockChangeEventArgs args) { sender.OnPlayerBlockChange.Normal -= remove_Normal; args.Cancel(); Vector3S v = new Vector3S(args.X, args.Z, args.Y); PluginMessageBlock pmb = (PluginMessageBlock)Plugin.getByType(typeof(PluginMessageBlock).Name); if (pmb == null) { sender.SendMessage(typeof(PluginMessageBlock).Name + " is currently not loaded"); return; } if (pmb.Remove(sender.Level, v)) { sender.SendMessage("Message block removed"); } else { sender.SendMessage("There was already no message set for this block"); } }
public void CatchBlock2(Player p, BlockChangeEventArgs args) { p.OnPlayerBlockChange.Normal -= new Event<Player, BlockChangeEventArgs>.EventHandler(CatchBlock2); CatchPos cpos = (CatchPos)p.GetDatapass(this.Name); cpos.secondPos = new Vector3S(args.X, args.Z, args.Y); cpos.block = args.Holding; args.Cancel(); Cuboid(cpos, p); }
void CatchBlockTwo(Player sender, BlockChangeEventArgs e) { e.Cancel(); sender.OnPlayerBlockChange.Normal -= CatchBlockTwo; try { BlockInfo raw = (BlockInfo)sender.ExtraData.GetIfExist<object, object>("Command.Line"); Vector3S from = raw.Pos; Vector3S to = new Vector3S(e.X, e.Z, e.Y); byte block = raw.Block; IEnumerable<Vector3S> path = from.PathTo(to); foreach (var pos in path) { if (!sender.Level.IsInBounds(pos)) continue; sender.Level.BlockChange(pos, block); } sender.SendMessage(string.Format("Changed {0} blocks in a line", path.Count())); } catch (Exception er) { sender.SendMessage("An Error occurred while trying to make a pretty line"); Logger.LogError(er); } sender.ExtraData.Remove("Command.Line"); }