public void playerWantsToJoin(MiniPEPlayer player) { if (!playsJump(player)) { if (isAMatchFree() || getMatchCount() < MAX_MATCHES) { // Spieler can join a match if (isAMatchFree()) { // there is a match the player can join getFirstFreeMatch().addPlayer(player); } else { // create a new match for the player JumpMatch m = new JumpMatch(this); m.addPlayer(player); Matches.Add(m); } } else { // there is no match to play at the moment player.SendMessage("§b[MiniPE] There is no match you can join at the moment.", MessageType.Chat); } } }
/* * returns the match from a player */ public JumpMatch getMatchByPlayer(MiniPEPlayer player) { foreach (JumpMatch match in Matches) { if (match.isInMatch(player)) { return(match); } } return(null); }
/* * Checks if a player plays jump n run */ public Boolean playsJump(MiniPEPlayer player) { foreach (JumpMatch match in Matches) { if (match.isInMatch(player)) { return(true); } } return(false); }
public Boolean isInMatch(MiniPEPlayer player) { foreach (Player p in Players) { if (player.Username.Equals(p.Username)) { return(true); } } return(false); }
public Package overRedstoneBlock(McpeMovePlayer message, MiniPEPlayer player) // <- isn't working too { if (jumpManager.playsJump(player)) { if (player.Level.GetBlock(new BlockCoordinates((int)player.KnownPosition.X, (int)player.KnownPosition.Y - 1, (int)player.KnownPosition.Z)).Id == 152) { jumpManager.getMatchByPlayer(player).removePlayer(player); } } return(message); }
public void removePlayer(MiniPEPlayer player) { // remove player from list Players.Remove(player); // teleport player back to lobby player.SpawnLevel(manager.manager.lobbyLevel, new PlayerLocation { X = (int)manager.manager.spawnPos.X, Y = (int)manager.manager.spawnPos.Y, Z = (int)manager.manager.spawnPos.Z, Yaw = 91, Pitch = 28, HeadYaw = 91, }); }
public void addPlayer(MiniPEPlayer player) { // add player to list Players.Add(player); // send a message to the player player.SendMessage("§b[MiniPE] Joining...", MessageType.Chat); // teleport the player to the jump n run player.SpawnLevel(level, new PlayerLocation { X = 340, Y = 10, Z = 454, Yaw = 91, Pitch = 28, HeadYaw = 91, }); }
public Package inWater(McpeMovePlayer message, MiniPEPlayer player) // <- this is not called I think (maybe because of the Server creates no MiniPEPlayer Objects) { if (jumpManager.playsJump(player)) { if (player.Level.GetBlock(new BlockCoordinates(player.KnownPosition)).Id == 8) { player.KnownPosition = new PlayerLocation(new Vector3(340, 10, 454)); player.SendMovePlayer(true); } if (player.Level.GetBlock(new BlockCoordinates(player.KnownPosition)).Id == 9) { player.KnownPosition = new PlayerLocation(new Vector3(340, 10, 454)); player.SendMovePlayer(true); } } return(message); }