public override bool Interact(Level currentLevel, Player player, BlockCoordinates blockCoordinates, BlockFace face) { Sign signEntity = currentLevel.GetBlockEntity(blockCoordinates) as Sign; if (signEntity == null) return false; string world = signEntity.Text1; if (player.Level.LevelId.Equals(world)) return true; if (!Worlds.ContainsKey(player.Level.LevelId)) { Worlds.Add(player.Level.LevelId, player.Level); } if (!Worlds.ContainsKey(world)) { var mobHuntLevel = new MobHuntLevel(world, new FlatlandWorldProvider()); mobHuntLevel.Initialize(); Worlds.Add(world, mobHuntLevel); } Level level = Worlds[world]; player.SpawnLevel(level); level.BroadcastTextMessage(string.Format("{0} teleported to world <{1}>.", player.Username, level.LevelId)); return true; }
public override bool Interact(Level world, Player player, BlockCoordinates blockCoordinates, BlockFace face, Vector3 faceCoords) { Item itemInHande = player.Inventory.GetItemInHand(); ItemFrameBlockEntity blockEntity = world.GetBlockEntity(blockCoordinates) as ItemFrameBlockEntity; if (blockEntity != null) { blockEntity.SetItem(itemInHande); world.SetBlockEntity(blockEntity); } return true; }
public override bool Interact(Level currentLevel, Player player, BlockCoordinates blockCoordinates, BlockFace face) { Sign signEntity = currentLevel.GetBlockEntity(blockCoordinates) as Sign; if (signEntity == null) return false; string world = signEntity.Text1; if (player.Level.LevelId.Equals(world)) return true; _gameManager.Join(player, world); _gameManager.RegisterSign(signEntity, currentLevel); return true; }