/// <summary> /// Register this event /// </summary> /// <param name="method">This is the delegate that will get called when this event occurs</param> /// <param name="priority">The priority (imporantce) of this call</param> /// <param name="plugin">The plugin object that is registering the event</param> public static void Register(Player.BlockchangeEventHandler method, Priority priority, Plugin plugin) { if (Find(plugin) != null) { throw new Exception("The user tried to register 2 of the same event!"); } events.Add(new OnBlockChangeEvent(method, priority, plugin)); Organize(); }
public override void Use(Player p, string message) { if (p == null) { Player.SendMessage(p, "This command can only be used in-game!"); return; } if (p.level.permissionbuild > p.group.Permission) { p.SendMessage("You can not edit this map."); return; } string[] parts = message.Split(' '); Player.BlockchangeEventHandler newHandler = null; bool help; switch (parts[0].ToLower()) { case "cone": if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeCone); break; case "hcone": if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeHCone); break; case "icone": if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeICone); break; case "hicone": if (!CheckTwoArgs(p, 1, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeHICone); break; case "pyramid": if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangePyramid); break; case "hpyramid": if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeHPyramid); break; case "ipyramid": if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeIPyramid); break; case "hipyramid": if (!CheckTwoArgs(p, 2, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeHIPyramid); break; case "sphere": if (!CheckOneArg(p, 3, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeSphere); break; case "hsphere": if (!CheckOneArg(p, 3, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeHSphere); break; case "volcano": if (!CheckTwoArgs(p, 4, parts, out help)) { if (help) Help(p); return; } newHandler = new Player.BlockchangeEventHandler(BlockchangeVolcano); break; } Player.SendMessage(p, "Place a block"); p.ClearBlockchange(); p.Blockchange += newHandler; }
internal OnBlockChangeEvent(Player.BlockchangeEventHandler method, Priority priority, Plugin plugin) { this.plugin = plugin; this.priority = priority; this.method = method; }