What is it?
Game Framework is an easy to use, event-based bukkit plugin that developers can hook into to easily create new Minecraft gamemodes. The plugin allows developers to bypass the annoying hassle that plagues us all - Threads and Runnables. This plugin handles it all for you, and presents it in a simple-event based structure.
How do I use it?
Note: Using the function GameFramework.getState() returns the current game state of the game. Similarly, using GameFramework.getTime() returns the time left in the current timer.
Configuration
Upon starting up, GameFramework will create a config.yml. The default values inside are all 30. lobby.time changes the length of the lobby. ingame.countdown is the length of the countdown time before ingame starts. ingame.time is the length of the ingame. restart.time is the length of the restarting time.
What do you mean, "Event Based" system?
The event based system means that all time-related problems will run on an event. For example, right when the server fires up, a LobbyStartEvent is thrown. You may want to say a message for the available maps, or the map it's going to play, etc. Similarly, every time the timer ticks down one, a TimeChangeEvent is thrown. This is useful if you want to broadcast how much time is left every minute, 5 minutes, etc.
There is an event for nearly every significant phase of a game, so don't worry! A full list of events are listed below.
This plugin has no permissions. The only command is '/state' and is for console use only. It allows the console to see the gamestate and time.
Example Plugin
The test plugin can be found here. Feel free to use any part of that code as your own, it is to simply to show the functionality of the events. This is a very, very basic example of how this framework can be used, a fully functional Ultra Hardcore plugin has been created on this framework!
Game Framework is an easy to use, event-based bukkit plugin that developers can hook into to easily create new Minecraft gamemodes. The plugin allows developers to bypass the annoying hassle that plagues us all - Threads and Runnables. This plugin handles it all for you, and presents it in a simple-event based structure.
How do I use it?
- Download the plugin file (.jar)
- Add the file to your /plugins/ folder
- Add the file to your projects Build Path
- Done! Start hooking into the events and code away!
Note: Using the function GameFramework.getState() returns the current game state of the game. Similarly, using GameFramework.getTime() returns the time left in the current timer.
Configuration
Upon starting up, GameFramework will create a config.yml. The default values inside are all 30. lobby.time changes the length of the lobby. ingame.countdown is the length of the countdown time before ingame starts. ingame.time is the length of the ingame. restart.time is the length of the restarting time.
What do you mean, "Event Based" system?
The event based system means that all time-related problems will run on an event. For example, right when the server fires up, a LobbyStartEvent is thrown. You may want to say a message for the available maps, or the map it's going to play, etc. Similarly, every time the timer ticks down one, a TimeChangeEvent is thrown. This is useful if you want to broadcast how much time is left every minute, 5 minutes, etc.
There is an event for nearly every significant phase of a game, so don't worry! A full list of events are listed below.
- Lobby Start Event
- Lobby Attempt End Event
- Lobby End Event
- Lobby Restart Event
- Ingame Countdown Start Event
- Ingame Countdown End Event
- Ingame Start Event
- Ingame End Event
- Restarting Start Event
- Restart Event
- Time Change Event
Spoiler
Spoiler
Lobby Start Event is the very first even that is called - it is called as the server finishes initialising (usually just after the world is loaded). In the test plugin, it is used to display the "Waiting for x player(s)" message. The event changes the GameState from null or GameState.RESTARTING to GameState.LOBBY. This event is also called every time the lobby restarts (After LobbyRestartEvent). This could be useful to display a "now in lobby" message, or, send a BungeeCord plugin message to display the lobby status on another server's sign. Note: This can be thrown many times, be careful with duplicate instances of
Lobby Attempt End Event must be listened for in order to start the game. This event is used to determine if the ingame is to be started or not. LobbyAttemptEndEvent.startGame() is the method that must be called in order to start the game. If this method is not called, a LobbyRestartEvent is called and the lobby restarts. In the test plugin, this is used to check if there is a player ingame. If no player is ingame, the lobby restarts, but if there is one or more the game begins. In, for example, a Survival Games plugin this would be used to check if there are 12 players in the server, ready to play or not.
Lobby Restart Event is called every time the lobby, as the name states, restarts. The event is called only if LobbyAttemptEndEvent.startGame() is not called. In the test plugin, this is used to display the "Lobby restarted!" message. The main uses of this would to notify players that the lobby has restarted, to tell the players how many more players are needed, etc. Note: Directly after this event, LobbyStartEvent is called again.
LobbyEndEvent is called once the lobby has ended, and the ingame state is set to begin. This is called ONLY if LobbyAttemptEndEvent.startGame() is called. This is not used in the test plugin. The main uses of this event would be to teleport players into the arena, or initialise/setup anything needed.
Ingame Countdown Start Event (what a mouthful!) is called directly after LobbyEndEvent, and changes the GameState from GameState.LOBBY to GameState.INGAME_COUNTDOWN. This is used to in the test plugin to for the "The first person to break a piece of wood wins!" message, give the players resistance, heal them, and teleport them. Primary uses for this would be to teleport players to the correct areas, send them messages, give starting loot, organise teams, send BungeeCord plugin messages to another server's sign to update the game status, etc.
Ingame Countdown End Event is called as soon as the Countdown timer reaches zero. The test plugin uses this event to display a "Good luck!" message. Primary uses would be to remove barriers allowing players to move, fill chests/place loot, etc.
Ingame Start Event is called directly after IngameCountdownEndEvent. This event changes the GameState from GameState.INGAME_COUNTDOWN to GameState.INGAME. The test plugin does not use this event. A typical use of this event would be to announce the game has begun.
Ingame End Event is called once the ingame timer reaches zero. This is critical for ending the ingame phase! You can throw this event if the game ends prematurely! Call this event like you would any other, and the ingame will end and restarting will begin. The test plugin uses this to announce the winner. The primary uses of this would be to display who won, add the necessary points for victory/participation, etc.
Restarting Start Event is called directly after IngameEndEvent. This event changes the GameState from GameState.INGAME to GameState.RESTARTING. This event is used in the test plugin to clear players inventories, set them to Creative.
Restart Event is the final event called before the plugin is, in essence, restarted. It is called when the restarting timer reaches zero. The plugin will not literally restart, but the GameState is set back from GameState.RESTARTING to GameState.LOBBY. The timer is also set to the specified length determined in the config.yml. A typical use of this event would be to send players back to the lobby, display a restarting message, etc.
This is the most critical event called by the plugin. This event is called every 20 game ticks (appx. 1/second) . As stated above, this is called all throughout the game. The methods attached to this are TimeChangeEvent.getTime() which returns the current seconds left in the timer, and TimeChangeEvent.getState(), which returns the current GameState. The test plugin uses this to display the "x seconds left" messages. A typical use of this would be to send time updates, messages, alerts, etc.
Permissions/Commands
- LobbyStartEvent
Lobby Start Event is the very first even that is called - it is called as the server finishes initialising (usually just after the world is loaded). In the test plugin, it is used to display the "Waiting for x player(s)" message. The event changes the GameState from null or GameState.RESTARTING to GameState.LOBBY. This event is also called every time the lobby restarts (After LobbyRestartEvent). This could be useful to display a "now in lobby" message, or, send a BungeeCord plugin message to display the lobby status on another server's sign. Note: This can be thrown many times, be careful with duplicate instances of
- LobbyAttemptEndEvent
Lobby Attempt End Event must be listened for in order to start the game. This event is used to determine if the ingame is to be started or not. LobbyAttemptEndEvent.startGame() is the method that must be called in order to start the game. If this method is not called, a LobbyRestartEvent is called and the lobby restarts. In the test plugin, this is used to check if there is a player ingame. If no player is ingame, the lobby restarts, but if there is one or more the game begins. In, for example, a Survival Games plugin this would be used to check if there are 12 players in the server, ready to play or not.
- LobbyRestartEvent
Lobby Restart Event is called every time the lobby, as the name states, restarts. The event is called only if LobbyAttemptEndEvent.startGame() is not called. In the test plugin, this is used to display the "Lobby restarted!" message. The main uses of this would to notify players that the lobby has restarted, to tell the players how many more players are needed, etc. Note: Directly after this event, LobbyStartEvent is called again.
- LobbyEndEvent
LobbyEndEvent is called once the lobby has ended, and the ingame state is set to begin. This is called ONLY if LobbyAttemptEndEvent.startGame() is called. This is not used in the test plugin. The main uses of this event would be to teleport players into the arena, or initialise/setup anything needed.
- IngameCountdownStartEvent
Ingame Countdown Start Event (what a mouthful!) is called directly after LobbyEndEvent, and changes the GameState from GameState.LOBBY to GameState.INGAME_COUNTDOWN. This is used to in the test plugin to for the "The first person to break a piece of wood wins!" message, give the players resistance, heal them, and teleport them. Primary uses for this would be to teleport players to the correct areas, send them messages, give starting loot, organise teams, send BungeeCord plugin messages to another server's sign to update the game status, etc.
- IngameCountdownEndEvent
Ingame Countdown End Event is called as soon as the Countdown timer reaches zero. The test plugin uses this event to display a "Good luck!" message. Primary uses would be to remove barriers allowing players to move, fill chests/place loot, etc.
- IngameStartEvent
Ingame Start Event is called directly after IngameCountdownEndEvent. This event changes the GameState from GameState.INGAME_COUNTDOWN to GameState.INGAME. The test plugin does not use this event. A typical use of this event would be to announce the game has begun.
- IngameEndEvent
Ingame End Event is called once the ingame timer reaches zero. This is critical for ending the ingame phase! You can throw this event if the game ends prematurely! Call this event like you would any other, and the ingame will end and restarting will begin. The test plugin uses this to announce the winner. The primary uses of this would be to display who won, add the necessary points for victory/participation, etc.
- RestartingStartEvent
Restarting Start Event is called directly after IngameEndEvent. This event changes the GameState from GameState.INGAME to GameState.RESTARTING. This event is used in the test plugin to clear players inventories, set them to Creative.
- RestartEvent
Restart Event is the final event called before the plugin is, in essence, restarted. It is called when the restarting timer reaches zero. The plugin will not literally restart, but the GameState is set back from GameState.RESTARTING to GameState.LOBBY. The timer is also set to the specified length determined in the config.yml. A typical use of this event would be to send players back to the lobby, display a restarting message, etc.
- TimeChangeEvent
This is the most critical event called by the plugin. This event is called every 20 game ticks (appx. 1/second) . As stated above, this is called all throughout the game. The methods attached to this are TimeChangeEvent.getTime() which returns the current seconds left in the timer, and TimeChangeEvent.getState(), which returns the current GameState. The test plugin uses this to display the "x seconds left" messages. A typical use of this would be to send time updates, messages, alerts, etc.
This plugin has no permissions. The only command is '/state' and is for console use only. It allows the console to see the gamestate and time.
Example Plugin
The test plugin can be found here. Feel free to use any part of that code as your own, it is to simply to show the functionality of the events. This is a very, very basic example of how this framework can be used, a fully functional Ultra Hardcore plugin has been created on this framework!
Quick facts
- Edition: Minecraft Java
- File type: .jar
- Minecraft versions listed: 1.11, 1.12, 1.13
- How to install: Install the matching mod loader (Forge, Fabric or NeoForge) for your Minecraft version. → Download the .jar. → Put it in the .minecraft/mods folder and launch that loader profile.
- Where to get it: Opens on Spigot — not every file is mirrored on our own servers.
Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.
Game Framework is a free Minecraft Java mod. Compatible with Minecraft 1.11, 1.12, 1.13, 1.14. Downloaded 550 times (via Spigot). Download it and open it directly in the game.