ProtMod
ProtMod
ProtMod is a Event Based Minigame engine for Bukkit. The Engine handles the Lobby System and a token shop that can either be global or local.
For Server Owners
Just download the latest Jar and drop it into you plugin folder. Thats it.
Developers
Download the latest JAR and add it to your projects build path.
The first step for you is to check if ProtMod is installed and loaded
Plugin protmod = Bukkit.getPluginManager().getPlugin("ProtMod"); if (protmod == null) { getLogger().severe("ProtMod was not found!"); Bukkit.getPluginManager().disablePlugin(this); return; } if (!protmod.isEnabled()) { protmod.getPluginLoader().enablePlugin(protmod); }
The second step is to get a LobbyManager Object (getName() is your Game ID)
LobbyManager lm = new LobbyManager(getName(), (ProtMod) protmod, this);
Then you need to add a Lobby for your Players
Lobby l = lm.addLobby("lobby");
Add a command that calls (l is the Lobby we created and p is the Player that called the argument)
l.join(p);
The engine checks if the Player is already in a Lobby. If you want other conditions players need to join make a Listener for LobbyJoinEvent
@EventHandler public void onLobbyJoin(LobbyJoinEvent e) { if(e.getPlayer().getName().equals("Notch") { e.setCancelled(true); } }
So now that the Player joined why not say hello ?
@EventHandler public void onLobbyJoined(LobbyJoinedEvent e) { if(!e.getGameID().equals(YOUR GAME ID)) { return; } e.getLobby().broadcastExclusive( ChatColor.GREEN + e.getPlayer().getName() + " joined the Game", e.getPlayer()); e.getPlayer().sendMessage( ChatColor.GREEN + "You successfully joined the Lobby"); }
So now you should check how many players you have
if(l.getPlayerCount() >= 5 ) { l.startGame(); }
So now you started your Game. Create a Listener for the GameStartedEvent
@EventHandler public void onGameStarted(GameStartedEvent e) { if(!e.getGameID().equals(YOUR GAME ID)) { return; } ++YOUR GAME STARTING STUFF++ }
If the server gets reloaded implement the GameForceQuitEvent
@EventHandler public void onGameForceQuit(GameForceQuitEvent e) { if(!e.getGameID().equals(YOUR GAME ID)) { return; } ++YOUR GAME FORCE QUIT STUFF++ }
Then you should also implement an event that handles a normal game ending
@EventHandler public void onGameEnd(GameEndEvent e) { if(!e.getGameID().equals(YOUR GAME ID)) { return; } ++YOUR GAME END STUFF++ }
So now that we have some basic Events implement some checking and call (l is Lobby as always)
l.stopGame();
@edwardb121
http://wiki.bukkit.org/Event_API_Reference
Can you tell me or add a page saying how to create a new Listener please?