public override void Use(Player p, params string[] args) { if (args.Length >= 2) { Help(p); return; } if (args.Length == 1) { Player who = Player.FindPlayer(args[0]); // cannot use a using here or players dissapear. if (who != null) { if (!who.IsOnFire) { who.SetFire(true); Player.GlobalMessage(String.Format("{0} was set on fire by {1}", who.username, p.username)); } else { who.SetFire(false); Player.GlobalMessage(String.Format("{0} was extinguished by {1}", who.username, p.username)); } return; } Help(p); } if (args.Length == 0) { p.SetFire(!p.IsOnFire ? true : false); p.SendMessage("You are on fire = " + p.IsOnFire); return; } }
public override void Use(Player p, params string[] args) { if (args.Length < 2) { Help(p); return; } Player pr = Player.FindPlayer(args[0]); Group gr = Group.FindGroup(args[1]); if (pr == p) { p.SendMessage(HelpBot + "You can't change your own rank."); return; } if (!GroupUtils.IsHigherRank(p.group, gr)) { p.SendMessage(HelpBot + "You can't rank someone higher than your own rank."); return; } if (gr != null && pr != null) { pr.group = gr; p.SendMessage("There have a nice day!"); pr.SendMessage(HelpBot + p.username + " set your rank to " + gr.Name + ". Congratulations!"); } }
public override void Use(Player p, params string[] args) { //TODO: Add in checks so you can't kick people higher ranked than you if (args.Length == 0 || args[0].ToLower() == "help") { Help(p); return; } Player KickPlayer = Player.FindPlayer(args[0]); if (KickPlayer != null && KickPlayer != p) { if (args.Length >= 2) { StringBuilder reason = new StringBuilder(); for (int i = 1; i < args.Length; i++) { reason.Append(args[i] + " "); } reason.Remove(reason.Length - 1, 1); KickPlayer.Kick(reason.ToString()); } else { KickPlayer.Kick("You were kicked by " + p.username); } } else if (KickPlayer == p) { p.SendMessage(HelpBot + "Why are you trying to kick yourself??"); } else if (KickPlayer == null) p.SendMessage(HelpBot + "Cannot find player: " + args[0]); }
public override void Use(Player p, params string[] args) { if (args.Length == 0) { Help(p); return; } else if (args.Length == 1) { Random rand = new Random(); int seed = new Random().Next(); p.SendMessage("Creating world with seed: " + seed); double x = 0; double y = 127; double z = 0; World temp = new World(x, y, z, args[0], seed); //while (Chunk.GetChunk((int)x, (int)z, temp).GetBlock((int)x, (int)(y - 1), (int)z) == 0) // y--; temp.SpawnY = y; World.worlds.Add(temp); p.SendMessage("World " + args[0] + " MADE!"); } else if (args.Length == 2 || args.Length == 3) { int seed = Convert.ToInt32(args[1]); p.SendMessage("Creating world with seed: " + seed); double x = 0; double y = 127; double z = 0; World temp = new World(x, y, z, args[0], seed); if (args.Length == 3) { int limit = Convert.ToInt32(args[2]); if (limit > 2) temp.ChunkLimit = limit; else { p.SendMessage("maxchunks cannot be less than 3. creating with maxchunks 3."); temp.ChunkLimit = 3; } } World.worlds.Add(temp); p.SendMessage("World " + args[0] + " MADE!"); } }
public override void Use(Player p, params string[] args) { if (args.Length != 1) { Help(p); return; } int radius; try { radius = Convert.ToInt32(args[0]); } catch { p.SendMessage("Invalid radius."); return; } if (radius > 15) { p.SendMessage("Radius too big"); return; } if (radius < 3) { p.SendMessage("Radius too small"); return; } p.viewdistance = radius; }
public Item ParseItem(Player p, string[] args) { Item item = Item.Nothing; if (args.Length < 1) { Help(p); return null; } if (!short.TryParse(args[0], out item.id)) { if (args[0].Contains(":")) { try { item.id = short.Parse(args[0].Substring(0, args[0].IndexOf(':'))); item.meta = short.Parse(args[0].Substring(args[0].IndexOf(':') + 1)); } catch { p.SendMessage(HelpBot + "Something is wrong with the item ID.", WrapMethod.Chat); return null; } } else { short[] foundItem = FindBlocks.FindItem(args[0]); if (foundItem[0] == -1) { p.SendMessage(HelpBot + "Item not found.", WrapMethod.Chat); return null; } item.id = foundItem[0]; item.meta = foundItem[1]; } } if (args.Length >= 2 && !byte.TryParse(args[1], out item.count)) { p.SendMessage(HelpBot + "Something is wrong with the amount.", WrapMethod.Chat); return null; } return item; }
public override void Use(Player p, params string[] args) { SpheroidData cd; cd.x = 0; cd.y = 0; cd.z = 0; cd.type = -1; cd.vertical = false; if (args.Length >= 2) { try { cd.type = Convert.ToInt16(args[0]); } catch { cd.type = FindBlocks.FindBlock(args[0]); } if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; } cd.vertical = (args[1].ToLower() == "vertical"); } else if (args.Length >= 1) { cd.vertical = (args[0].ToLower() == "vertical"); if (!cd.vertical) { try { cd.type = Convert.ToInt16(args[0]); } catch { cd.type = FindBlocks.FindBlock(args[0]); } if (!FindBlocks.ValidBlock(cd.type)) { p.SendMessage("There is no block \"" + args[0] + "\"."); return; } } } p.ClearBlockChange(); p.BlockChangeObject = cd; p.OnBlockChange += Blockchange1; p.SendMessage("Place/delete a block at 2 corners for the spheroid."); }
public static void Register(Player.OnPlayerChat 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 OnPlayerChatEvent(method, priority, plugin)); Organize(); }
public override void Use(Player p, params string[] args) { if (args.Length != 0 && args.Length != 1) { Help(p); return; } if (args.Length == 1) { int update = IntParseFast(args[0].ToLower()); if (update > 0 & update < 10000) { p.FlyingUpdate = update; p.SendMessage("Flying update interval set to " + IntParseFast(args[0])); } else if (update == 61964 || update == 29964) Help(p); else p.SendMessage("Cant set interval to " + args[0]); return; } if (p.isFlying) { p.isFlying = false; p.SendMessage("Stopped flying"); return; } p.SendMessage("You are now flying. &cJump!"); p.isFlying = true; //Thread flyThread = new Thread(() => //{ //flyingcode(p); //}) { Name = "FlyThread-" + p.username }; //flyThread.Start(); }
public override void Use(Player p, params string[] args) { World w; if (p == null) { if (args.Length != 1) Logger.Log("Must specify a map."); w = World.Find(args[0]); if (w == null) { Logger.Log("Could not find level"); return; } Logger.Log("Map Info For: " + w.name); Logger.Log("Seed: " + w.seed); Logger.Log(String.Format("Spawn: {0} {1} {2}", w.SpawnX, w.SpawnY, w.SpawnZ)); Logger.Log(w.ChunkLimit != 1875000 ? "Chumk Limit: " + w.ChunkLimit : "Chumk Limit: None"); Logger.Log("Level-Type: " + w.leveltype); Logger.Log("Time: " + w.time); return; } switch (args.Length) { case 1: w = World.Find(args[0]); break; case 0: w = p.level; break; default: Help(p); return; } if (w == null) { p.SendMessage("Could not find level"); return; } p.SendMessage("Map Info For: " + w.name); p.SendMessage("Seed: " + w.seed); p.SendMessage(String.Format("Spawn: {0} {1} {2}", w.SpawnX, w.SpawnY, w.SpawnZ)); p.SendMessage(w.ChunkLimit != 1875000 ? "Chumk Limit: " + w.ChunkLimit : "Chumk Limit: None"); p.SendMessage("Level-Type: " + w.leveltype); p.SendMessage("Time: " + w.time); }
public override void Use(Player p, params string[] args) { if (args.Length == 0) { Help(p); return; } Player pr = Player.FindPlayer(args[0]); if (pr == null) { p.SendMessage(HelpBot + "Could not find player."); return; } if (pr == p) { p.SendMessage(HelpBot + "You can't promote yourself."); return; } if (GroupUtils.PromotePlayer(pr)) { p.SendMessage(HelpBot + "Player promoted."); pr.SendMessage(HelpBot + p.username + " promoted you. Congratulations!"); } else p.SendMessage(HelpBot + "Could not promote player"); }
public override void Use(Player p, params string[] args) { p.ClearBlockChange(); p.BlockChangeObject = args.Length > 0 ? byte.Parse(args[0]) : (byte)0; p.OnBlockChange += Blockchange1; p.SendMessage("Place/delete a block where you want the tree."); //p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1); }
public override void Use(Player p, params string[] args) { if (args.Length == 0 || args[0].ToLower() == "help") { Help(p); return; } Player.GlobalMessage(p.username + " " + String.Join(" ", args)); }
void Blockchange1(Player p, int x, int y, int z, short type) { p.ClearBlockChange(); p.SendBlockChange(x, (byte)y, z, p.level.GetBlock(x, y, z), p.level.GetMeta(x, y, z)); p.SendMessage("Position: " + x + "," + y + "," + z); p.SendMessage("Type: " + p.level.GetBlock(x, y, z)); p.SendMessage("Meta: " + p.level.GetMeta(x, y, z)); p.SendMessage("Extra: " + p.level.GetExtra(x, y, z)); }
public Entity(Player pl, World l) : this(l) { p = pl; isPlayer = true; UpdateChunks(false, false); Entities.Add(id, this); }
internal static void Call(Player p, string reason) { events.ForEach(delegate(OnPlayerKickEvent p1) { try { p1.method(p, reason); } catch (Exception e) { Logger.Log("The plugin " + p1.plugin.name + " errored when calling the PlayerKick Event!"); Logger.LogErrorToFile(e); } }); }
internal static void Call(Player p) { events.ForEach(delegate(OnCrouchChangeEvent p1) { try { p1.method(p); } catch (Exception e) { Logger.Log("The plugin " + p1.plugin.name + " errored when calling the PlayerCrouchChange Event!"); Logger.LogErrorToFile(e); } }); }
internal static void Call(string message, Player p) { events.ForEach(delegate(OnPlayerChatEvent p1) { try { p1.method(message, p); } catch (Exception e) { Logger.Log("The plugin " + p1.plugin.name + " errored when calling the PlayerChat Event!"); Logger.LogErrorToFile(e); } }); }
public override void Use(Player p, params string[] args) { if (args.Length < 1) { Help(p); return; } try { byte phase = byte.Parse(args[0]); if (phase < 0 || phase > 7) { p.SendMessage("Phase must be between 0 and 7 inclusive.", WrapMethod.Chat); return; } p.level.moonPhase = phase; } catch { Help(p); return; } }
internal static void Call(Player p) { events.ForEach(delegate(PlayerDisconnectEvent p1) { try { p1.method(p); } catch (Exception e) { Logger.Log("The plugin " + p1.plugin.name + " errored when calling the OnPlayerAuth Event!"); Logger.LogErrorToFile(e); } }); }
public override void Use(Player p, params string[] args) { if (args.Length == 0) { Help(p); return; } if (args.Length == 1) { string name; Player pl = Player.FindPlayer(args[0].ToLower()); if (pl != null) name = pl.username.ToLower(); else name = args[0].ToLower(); if(Server.VIPList.Contains(name)) { Server.VIPList.Remove(name); p.SendMessage(HelpBot + name + " removed from VIP List."); } else { Server.VIPList.Add(name); p.SendMessage(HelpBot + name + " added to VIP List."); } } else { foreach(string s in args) { string name; Player pl = Player.FindPlayer(s.ToLower()); if (pl != null) name = pl.username.ToLower(); else name = s.ToLower(); if(Server.VIPList.Contains(name)) { Server.VIPList.Remove(name); } else { Server.VIPList.Add(name); } } p.SendMessage(HelpBot + "VIP list modified."); } }
public override void Use(Player p, params string[] args) { switch (args.Length) { case 1: try { if (World.Find(args[0]) == null) { World.LoadLVL(args[0]); p.SendMessage("Loaded " + args[0]); } else p.SendMessage("Level already loaded."); } catch { p.SendMessage("Failed to Load " + args[0]); } break; default: Help(p); break; } }
public override void Use(Player p, params string[] args) { if (args.Length == 0 || args.Length > 1) { Help(p); return; } Player q = Player.FindPlayer(args[0]); int x = (int)Math.Round(q.pos.X, 0, MidpointRounding.AwayFromZero); int y = (int)Math.Round(q.pos.Y, 0, MidpointRounding.AwayFromZero); int z = (int)Math.Round(q.pos.Z, 0, MidpointRounding.AwayFromZero); World w = World.Find(p.level.name); w.Lightning(x, y, z); q.hurt(6); }
public override void Use(Player p, params string[] args) { if (args.Length == 0) { Help(p); return; } if (Server.BanList.Contains(args[0].ToLower())) { Server.BanList.Remove(args[0].ToLower()); p.SendMessage(HelpBot + args[0] + " was unbanned."); } else p.SendMessage(HelpBot + "Couldn't find that banned player."); }
public override void Use(Player p, params string[] args) { if (p == null) { p.SendMessage("You can't execute this command as console!"); return; } string line = "NONE"; foreach (string line2 in Server.homedata.ToArray()) { if (line2.Contains(p.username.ToLower())) { line = line2; } } if (line == "NONE") { p.SendMessage("You haven't set a home yet! Use /sethome"); return; } p.Teleport_Player(Convert.ToDouble(line.Split('|')[1]), Convert.ToDouble(line.Split('|')[2]), Convert.ToDouble(line.Split('|')[3])); p.SendMessage("You have been teleported to your home!"); }
public override void Use(Player p, params string[] args) { StringBuilder devlist = new StringBuilder(); foreach (string dev in Server.devs) devlist.Append(dev.Capitalize()).Append(',').Append(' '); devlist.Remove(devlist.Length - 2, 2); p.SendMessage(Color.DarkBlue + "ForgeCraft Development Team: " + Color.DarkRed + devlist.ToString(), WrapMethod.Chat); //lol it was ForgetCraft if (!p.IsConsole) { short slot = (short)p.inventory.FindEmptySlot(); if (slot == -1) return; if (Server.devs.Contains(p.username.ToLower())) p.inventory.Add(278, 1, 0); } }
public override void Use(Player p, params string[] args) { switch (args.Length) { case 0: World.SaveLVL(p.level); p.SendMessage("Saved " + p.level.name); break; case 1: World w = World.Find(args[0]); if (w == null) { p.SendMessage("Spcified world does not exist: " + p.level.name); return; } World.SaveLVL(w); p.SendMessage("Saved " + w.name); break; default: Help(p); break; } }
public override void Use(Player p, params string[] args) { if (args.Length < 1 || String.IsNullOrEmpty(args[0])) { Server.mode = Server.mode == 0 ? (byte)1 : (byte)0; foreach (Player pl in Player.players) pl.Mode = Server.mode; Player.GlobalMessage("The server game mode is now " + (Server.mode == 0 ? Color.DarkRed + "Survival" : Color.DarkGreen + "Creative") + Color.ServerDefaultColor + "!"); } else { Player pl = Player.FindPlayer(args[0]); if (pl == null) { p.SendMessage("Could not find player."); return; } pl.Mode = pl.Mode == 0 ? (byte)1 : (byte)0; pl.SendMessage("Your game mode is now " + (pl.Mode == 0 ? Color.DarkRed + "Survival" : Color.DarkGreen + "Creative") + Color.ServerDefaultColor + "!"); } }
public override void Use(Player p, params string[] args) { if (args.Length >= 1) { Help(p); } if (!p.DoNotDisturb) { p.DoNotDisturb = true; p.SendMessage("You will not be able to recieve or send any global chat. Type /dnd again to recieve chat again", WrapMethod.Chat); } else if (p.DoNotDisturb) { p.DoNotDisturb = false; p.SendMessage("You will now be able to recieve and send global chat again. I don't why you'd want to though.", WrapMethod.Chat); } }
public override void Use(Player p, params string[] args) { if (args.Length < 1) { Help(p); return; } byte meta = 0; try { meta = byte.Parse(args[0]); } catch { p.SendMessage("Invalid input."); return; } if (meta < 0) meta = 0; else if (meta > 15) meta = 15; p.ClearBlockChange(); p.BlockChangeObject = meta; p.OnBlockChange += Blockchange1; p.SendMessage("Place/delete a block to change it's meta data."); }