The expansions folder in the fishing plugin is vital for extending the functionalities of the plugin. It is structured into three sub-folders, each designated for a specific type of expansion: game extensions, requirement extensions, and action extensions. You can install the expansion jar like PlaceholderAPI expansions
Create a game expansion
Here's an easy example to introduce how to create a basic expansion.
chat_game_1:game-type:chat_gametitle: - 'Type in {word} to fish'subtitle: - 'This is subtitle'words: - 'Apple' - 'Zombie' - 'Diamond'chat_game_2:game-type:chat_gametitle: - 'Type in {word} to fish'subtitle: - 'This is another game''s subtitle'words: - 'Banana' - 'Skeleton' - 'Emerald'
GameExpansion
This is the primary expansion class
getVersion(): Returns the version of this expansion.
getAuthor(): Returns the name of the expansion's author.
getGameType(): Specifies the type of game, in this case, "chat_game".
getGameFactory(): Produces a new instance of MyGameFactory.
GameFactory
This class is responsible for creating a new game instance.
setArgs(ConfigurationSection section): This method extracts segments from the configuration file and supplies the data for a new MyGameInstance.
GameInstance
This represents the core instance of the game and is responsible for all game logic.
Constructor: Initializes the titles, subtitles, and words.
start(Player player, FishHook hook, GameSettings settings): This method initiates the game for the given player. Upon starting the game for a player, it randomizes and displays titles, subtitles, and a word on their screen. If the player correctly types the word in chat, the game concludes.