PlayerActionsAPI icon

PlayerActionsAPI -----

Player Actions API allows to transform a string list into a list of actions



PlayerActionsAPI

Player Actions API allows to transform a string list into a list of actions, send a message to the player, execute a command in the console etc. This API uses the same syntax as DeluxeMenu.

Actions

Action Description

  • [broadcast] Broadcast a message to the server.
  • [chat] Send a chat message as the player performing the action.
  • [close] Close the viewers open menu.
  • [console] Execute a command from the console.
  • [message] Send a message to the menu viewer.
  • [player] Execute a command from the player.

You can add a tick delay to your action by using this: <delay:{ticks}> You must set the delay after defining the action to perform.

Example
Code (YAML):

commands
:
  - "[console] give %player% diamond"
  - "[message] <delay:10> &bAction &f&l» &fExample message"
 
Developer

JitPack: https://jitpack.io/#Maxlego08/PlayerActionsAPI

Maven
Code (Text):

<repositories>
   <repository>
       <id>jitpack.io</id>
       <url>https://jitpack.io</url>
   </repository>
</repositories>
<dependency>
   <groupId>com.github.Maxlego08</groupId>
   <artifactId>PlayerActionsAPI</artifactId>
   <version>{version}</version>
</dependency>
 
Gradle
Code (Text):

dependencyResolutionManagement {
   repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
   repositories {
       mavenCentral()
       maven { url 'https://jitpack.io' }
   }
}
dependencies {
   implementation 'com.github.Maxlego08:PlayerActionsAPI:{version}'
}
 
Do not forget to relocate the sources so as not to complicate with other plugin.

How to use

This configuration allows to execute a command and after a delay of 10 tickets to send a message

Code (YAML):

commands
:
 - "[console] give %player% diamond"
  - "[message] <delay:10> &bAction &f&l» &fExample message"
 
Load Actions

The first step and turn your string list into an action list.
Code (Java):

public class Example extends JavaPlugin {

   @Override
    public void onEnable ( ) {
       List <String > commands = getConfig ( ). getStringList ( "commands" ) ;
       List <Action > actions = ActionsAPI. loadActions (commands ) ;
    }
}
 
Use actions

To use the actions just run the execute method. The method requires a plugin and a player.

Code (Java):

public class Example extends JavaPlugin {
 
    public void execute (List <Action > actions, Player player ) {
      actions. forEach (command -> command. execute ( this, player ) ) ;
    }
}
 
Resource Information
Author:
----------
Total Downloads: 41
First Release: Jul 9, 2024
Last Update: Jul 11, 2024
Category: ---------------
All-Time Rating:
0 ratings
Version -----
Released: --------------------
Downloads: ------
Version Rating:
----------------------
-- ratings