Skip to content

Developer API

Randy edited this page Jul 21, 2017 · 9 revisions

This page does get forgotten about so if something doesn't work as it should please let me know so I can update this page.


Using McInfected

  • To start off you would probably want to add McInfected to either your plugin's depends or softdepends.
    depend: [McInfected] or softdepend: [McInfected]

  • McInfected mcInfected = (McInfected)(Bukkit.getPluginManager().getPlugin("McInfected")

Table Of Contents

Lobbies

Lobbies are probably going to be the main thing that you need to get/use.
McInfected#getLobbyManager().getLobby("LobbyName") will return the LobbyManager instance. From here you can get the lobby.

Arenas

In order to get an arena you'll need to get the ArenaManager from the Lobby.
McInfected#getLobbyManager().getLobby("LobbyName").getArenaManager() From there you can get the arena's info.

Players

In McInfected players get saved as an IPlayer. You can get the player's IPlayer by getting the LobbyManager and then getting the IPlayer.
McInfected#getLobbyManager().getIPlayer(player)

Stats

To get a player's stats you'll need to get their IStats, there are two ways to do this.

  1. Use IPlayer#getIStats()
  2. Create a new IStats. IStats stats = new IStats("playername") This will check if the player is in the lobby and if the answer is yes it will grab their IStats instead of making a brand new one.

Event

McInfected has a few events that you can listen to:

McInfected

  • McInfectedGameEndEvent--Called when the game ends
  • McInfectedGameScoreboardUpdateEvent--Called when the scoreboard gets updated
  • McInfectedGameTimerEvent--Called when the game type changes
  • McInfectedPlayerDeathEvent--Called when a player dies
  • McInfectedPlayerEquipEvent--Called when a player gets equiped
  • McInfectedPlayerInfectEvent--Called when a player gets infected
  • McInfectedPlayerJoinEvent--Called when a player joins
  • McInfectedPlayerLeaveEvent--Called when a player leaves
  • McInfectedPlayerResetEvent--Called when a player gets reset
  • McInfectedPlayerRespawnEvent--Called when the player is respawned
  • McInfectedPlayerRestoreEvent--Called when the player's inventory, etc is restored
  • McInfectedReloadEvent--Called when McInfected reloads

McInfected Ranks

  • McInfectedPlayerExpChangeEvent --Called when a player's exp gets changed
  • McInfectedPlayerRankChangeEvent --Called when a player's rank changes
Clone this wiki locally