Need help with making portals like in TheBridge minigame

Discussion in 'Spigot Plugin Development' started by Grechka, Jun 20, 2018.

  1. I am making TheBridge mini-game like on Hypixel. How can I make the end portals into which a player jumps and gets a point for his team? I also don't know how to store these end portals' locations in the config.yml.
     
  2. place the blocks in the world with Bukkit, then

    listn 2 EntityPortalEnterEvent
     
  3. Can you explain in more details? How the plugin can understand where is the portal of the first team and where is of the second?
     
  4. I'm going to guide you step a step:
    1. Create a class named Arena, this is going to be your arena object. You'll need a name or UUID, a minPlayers and maxPlayers to pass to the Arena constructor. Here's the Arena Class i use in my minigame plugin:
      Code (Text):

      import TeamConfiguration.Team;
      import org.bukkit.Location;
      import org.bukkit.entity.Player;
      import java.util.ArrayList;
      import java.util.List;

      public class Arena {
          private String name;
          private int maxPlayers;
          private int minPlayers;
          private List<Player> players;
          private List<Team> teams;
          private List<Team> aliveTeams;
          private Boolean isStarted;
          private Location lobby;
          private Location Spectator;
          private int time;
          public Arena(String name, Integer minPlayers, Integer maxPlayers,int time, Location lobby,Location Spectator){
              this.name = name;
              this.maxPlayers = maxPlayers;
              this.minPlayers = minPlayers;
              this.players = new ArrayList<>();
              this.aliveTeams = new ArrayList<>();
              this.teams = new ArrayList<>();
              this.time = time;
              this.isStarted = false;
              this.lobby = lobby;
              this.Spectator = Spectator;

          }

          public int getMaxPlayers() {
              return maxPlayers;
          }

          public void setMaxPlayers(int maxPlayers) {
              this.maxPlayers = maxPlayers;
          }

          public int getMinPlayers() {
              return minPlayers;
          }

          public void setMinPlayers(int minPlayers) {
              this.minPlayers = minPlayers;
          }

          public List<Player> getPlayers() {
              return players;
          }

          public void addPlayer(Player player) {
              players.add(player);
          }

          public List<Team> getAliveTeams() {
              return aliveTeams;
          }

          public void addAliveTeam(Team team) {
              aliveTeams.add(team);
          }

          public Boolean getStarted() {
              return isStarted;
          }

          public void setStarted(Boolean started) {
              isStarted = started;
          }

          public Location getLobby() {
              return lobby;
          }

          public void setLobby(Location lobby) {
              this.lobby = lobby;
          }

          public String getName() {
              return name;
          }

          public void setName(String name) {
              this.name = name;
          }

          public Location getSpectator() { return Spectator; }

          public void setSpectator(Location spectator) { Spectator = spectator; }

          public int getTime() { return time; }

          public void setTime(int time) { this.time = time; }

          public List<Team> getTeams() { return teams; }

          public void addTeam(Team team) { this.teams.add(team); }

          public void broadcastMessage(String message){
              for(Player player : getPlayers()){
                  player.sendMessage(message);
              }
          }
      }
       
    2. Now you need a Team and a Portal object. This is the team class I use in my minigame plugin(Just change Cake with Portal):
      Code (Text):

      import ArenaConfiguration.Arena;
      import Game.Cake;
      import Util.Colors;
      import org.bukkit.Location;
      import org.bukkit.entity.Player;

      import java.util.ArrayList;
      import java.util.List;

      public class Team {
          private Location spawn;
          private Location spawner;
          private Colors color;
          private Cake Cake;
          private Arena arena;
          private String name;
          private int minPlayers;
          private int maxPlayers;
          private String prefix;
          private List<Player> players;
          public Team(String name, Arena arena, Integer minPlayers, Integer maxPlayers, String prefix, Colors color, Location spawn, Location spawner, Cake Cake){
              this.name = name;
              this.minPlayers = minPlayers;
              this.maxPlayers = maxPlayers;
              this.arena = arena;
              this.prefix = prefix;
              this.spawn = spawn;
              this.spawner = spawner;
              this.Cake = Cake;
              this.color = color;
              this.players = new ArrayList<>();
          }

          public Location getSpawn() {
              return spawn;
          }

          public void setSpawn(Location spawn) {
              this.spawn = spawn;
          }


          public String getName() {
              return name;
          }

          public void setName(String name) {
              this.name = name;
          }

          public int getMinPlayers() {
              return minPlayers;
          }

          public void setMinPlayers(int minPlayers) {
              this.minPlayers = minPlayers;
          }

          public int getMaxPlayers() {
              return maxPlayers;
          }

          public void setMaxPlayers(int maxPlayers) {
              this.maxPlayers = maxPlayers;
          }

          public String getPrefix() {
              return prefix;
          }

          public void setPrefix(String prefix) {
              this.prefix = prefix;
          }

          public List<Player> getPlayers() {
              return players;
          }

          public void addPlayer(Player player) {
              players.add(player);
          }

          public Arena getArena() {
              return arena;
          }

          public void setArena(Arena arena) {
              this.arena = arena;
          }

          public Cake getCake() {
              return Cake;
          }

          public void setCake(Cake cake) {
              this.Cake = cake;
          }

          public Location getSpawner() { return spawner; }

          public void setSpawner(Location spawner) { this.spawner = spawner; }

          public Colors getColor() { return color; }
      }
       
      . For the Portal object you do it
    3. Now setup all the stuff you need for a minigame and then create a class that implements Listener that gets the location of the portal and the player, gets the player team and then get the portal of his team: if the portal they enetered is his just let him fall otherwise get the portal in which they entered and get the team that has that portal then take them away a point.
    4. If this is too complicate pm me I can do it for you (Paid)
     
  5. I know how to make a minigame plugin. How can I make multiple block
    end portal for team?
     
  6. A List of Blocks
     
  7. What other minigames have you completed?
     
  8. But how can I store this list of Blocks in the Config.yml?
     
  9. List<String> myList = new ArrayList<>();
    getConfig().set("My config", myList)