public void Use(Entity.Player p, string[] args) { if (args.Length != 1) { Help(p); return; } var lvl = Level.FindLevel(args[0]); if (lvl != null) { foreach (var pe in lvl.Players) { pe.Level = Server.Mainlevel; } lvl.Unload(); } foreach (var trashCan in Level.UnloadedLevels) { if (trashCan.ToLower() == args[0].ToLower()) { Backup.BackupLevel(trashCan, "-deleted"); File.Delete(FileUtils.LevelsPath + trashCan + ".lvl"); } } Player.UniversalChat("Level \"" + args[0] + "\" was deleted"); }
public void Help(Entity.Player p) { p.SendMessage("/redo [time] redos undid changes whitin the last [time] seconds on the current map for you"); p.SendMessage("/redo [name] [time] [map] redos changes for another player on selected map"); p.SendMessage("/redo [name] [time] redos changes for another player on your current map"); p.SendMessage("Note: The new blocks will look like you built them, not the other player"); }
public PlayerInventoryManager(Entity.Player player) { _player = player; for (var i = 0; i <= 45; i++) { _slots[i] = (new ItemStack(-1, 0, 0)); } SetSlot(5, 310, 0, 1); //Diamond helmet SetSlot(6, 311, 0, 1); //Diamond chestplate SetSlot(7, 312, 0, 1); //Diamond leggings SetSlot(8, 313, 0, 1); //Diamond boots SetSlot(36, 276, 0, 1); //Diamond sword SetSlot(37, 277, 0, 1); //Diamond shovel SetSlot(38, 278, 0, 1); //Diamond pickaxe SetSlot(39, 279, 0, 1); //Diamond axe SetSlot(43, 5, 0, 64); SetSlot(44, 332, 0, 64); SetSlot(41, 327, 0, 1); SetSlot(42, 326, 0, 1); SetSlot(40, 325, 0, 1); UpdateHandItems(); }
public void Use(Entity.Player p, string[] args) { int time = 30; long uid = -1; Level where = null; if (args.Length == 1) { try { time = int.Parse(args[0]); } catch { p.SendMessage("The time was incorrect, using 30 seconds instead"); } } if (args.Length == 2) { uid = Player.GetUID(args[0]); if (uid == -1) { p.SendMessage("Player not found"); return; } try { time = int.Parse(args[1]); } catch { p.SendMessage("The time was incorrect, using 30 seconds instead"); } } if (args.Length == 3) { uid = Player.GetUID(args[0]); if (uid == -1) { p.SendMessage("Player not found"); return; } try { time = int.Parse(args[1]); } catch { p.SendMessage("The time was incorrect, using 30 seconds instead"); } where = Level.FindLevel(args[2]); if (where == null) { p.SendMessage("Level " + args[2] + " does not exist or is not loaded"); return; } } if (uid == -1) { uid = p.UID; } if (where == null) { where = p.Level; } int count = 0; foreach (var ch in RedoHistory.Redo((uint)uid, where.Name, DateTime.Now.AddSeconds(-time).Ticks)) { where.BlockChange(ch.Item1, ch.Item2, ch.Item3, ch.Item4, p); count++; } p.SendMessage("&e" + count + MCForge.Core.Server.DefaultColor + " Blocks changed"); }
public void Use(Entity.Player p, string[] args) { long since = 0; long uid = -1; if (args.Length == 0) { uid = p.UID; } else { uid = Player.GetUID(args[0]); } if (uid == -1) { p.SendMessage("Player not found"); return; } if (args.Length > 1) { try { since = DateTime.Now.AddSeconds(-int.Parse(args[1])).Ticks; } catch (Exception e) { if (e.GetType() == typeof(FormatException)) { p.SendMessage("Not supported number format"); } else if (e.GetType() == typeof(OverflowException)) { p.SendMessage("Your number was out of range"); } } } foreach (var block in BlockChangeHistory.GetCurrentIfUID(p.Level.Name, (uint)uid, since)) { if (block.Item4 == 0) { p.SendBlockChange(block.Item1, block.Item2, block.Item3, MCForge.World.Block.NameToBlock("red")); } else { p.SendBlockChange(block.Item1, block.Item2, block.Item3, MCForge.World.Block.NameToBlock("green")); } } p.SendMessage("Highlighting " + ((uid == p.UID) ? p.DisplayName : args[0])); }
public void Initialize() { _logger.Info("Starting..."); Map = new World.Chunk(); Player = new Entity.Player(); Players = new Dictionary <long, Entity.Player>(); NetPeerConfiguration config = new NetPeerConfiguration(Properties.Resources.Title); config.ConnectionTimeout = 10; config.EnableMessageType(NetIncomingMessageType.ConnectionLatencyUpdated); _client = new NetClient(config); _client.Start(); _logger.Info("Started."); }
public void Use(Entity.Player p, string[] args) { if (args.Length == 1 && args[0] == "stop") { p.OnPlayerRotate.Normal -= OnPlayerRotate_Normal; p.OnPlayerMove.Normal -= OnPlayerMove_Normal; p.OnPlayerBigMove.Normal -= OnPlayerBigMove_Normal; p.OnPlayerBlockChange.Normal -= OnPlayerBlockChange_Normal; if (p.ExtraData["Cursor"] != null) { Vector3S old; if (p.ExtraData["Cursor"].GetType() == typeof(Vector3S)) { old = (Vector3S)p.ExtraData["Cursor"]; } else { old = new Vector3S(); old.FromString((string)p.ExtraData["Cursor"]); } p.SendBlockChange((ushort)old.x, (ushort)old.z, (ushort)old.y, p.Level.GetBlock(old)); p.ExtraData["Cursor"] = null; } if (p.ExtraData["CursorGlassCenter"] != null) { Vector3S old; if (p.ExtraData["CursorGlassCenter"].GetType() == typeof(Vector3S)) { old = (Vector3S)p.ExtraData["CursorGlassCenter"]; } else { old = new Vector3S(); old.FromString((string)p.ExtraData["CursorGlassCenter"]); } p.ResendBlockChange(surrounder, old); } return; } p.OnPlayerRotate.Normal += OnPlayerRotate_Normal; p.OnPlayerMove.Normal += OnPlayerMove_Normal; p.OnPlayerBigMove.Normal += OnPlayerBigMove_Normal; p.OnPlayerBlockChange.Normal += OnPlayerBlockChange_Normal; }
public void TakeHit(Entity.Player source, int damage = 1, DamageCause cause = DamageCause.Unknown) { if (LastDamageCause == DamageCause.Unknown) { LastDamageCause = cause; } LastDamageSource = source; Health -= damage; if (Entity == null) { return; } var player = Entity as Entity.Player; if (player != null) { player.SendHealth(); player.PlayerAnimation(Animations.TakeDamage); } }
public void Help(Entity.Player p) { p.SendMessage("/highlight <name> [time] - highlights changes of a player"); }
public void Help(Entity.Player p) { }
public void Help(Entity.Player p) { p.SendMessage("/deletelvl <lvl name> - deletes the specified <level>"); }
public void OnPlayerDeath(Entity.Player player) { _backgroundMusic.Pause(); Play(_gameOver); }