@@ -126,6 +126,7 @@ private void executeActionsFinal(){
126126 for (int i =currentActionPos ;i <actions .size ();i ++){
127127 CEAction action = actions .get (i );
128128 ActionType actionType = action .getType ();
129+ String apiType = action .getApiType ();
129130
130131 //Replace variables
131132 String actionLine = action .getActionLine ();
@@ -143,22 +144,22 @@ private void executeActionsFinal(){
143144
144145 if (targeterType .equals (ActionTargeterType .TO_ALL )) {
145146 for (Player globalPlayer : Bukkit .getOnlinePlayers ()) {
146- executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,isDebugActions ,targeter ,debugManager );
147+ executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,apiType , isDebugActions ,targeter ,debugManager );
147148 }
148149 }else if (targeterType .equals (ActionTargeterType .TO_TARGET )){
149- executeActionsFromToTarget (variablesProperties ,target ,actionLine ,actionType ,isDebugActions ,targeter ,debugManager );
150+ executeActionsFromToTarget (variablesProperties ,target ,actionLine ,actionType ,apiType , isDebugActions ,targeter ,debugManager );
150151 }else if (targeterType .equals (ActionTargeterType .TO_WORLD )){
151152 String world = parametersLine ;
152153 for (Player globalPlayer : Bukkit .getOnlinePlayers ()) {
153154 if (globalPlayer .getWorld ().getName ().equals (world )){
154- executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,isDebugActions ,targeter ,debugManager );
155+ executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,apiType , isDebugActions ,targeter ,debugManager );
155156 }
156157 }
157158 }else if (targeterType .equals (ActionTargeterType .TO_PLAYER )){
158159 String playerName = parametersLine ;
159160 Player onlinePlayer = Bukkit .getPlayer (playerName );
160161 if (onlinePlayer != null ){
161- executeActionsFromToTarget (variablesProperties ,onlinePlayer ,actionLine ,actionType ,isDebugActions ,targeter ,debugManager );
162+ executeActionsFromToTarget (variablesProperties ,onlinePlayer ,actionLine ,actionType ,apiType , isDebugActions ,targeter ,debugManager );
162163 }
163164 }else if (targeterType .equals (ActionTargeterType .TO_RANGE )){
164165 String [] sep = parametersLine .split (";" );
@@ -177,7 +178,7 @@ private void executeActionsFinal(){
177178 }
178179 }
179180 for (Player globalPlayer : globalPlayers ){
180- executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,isDebugActions ,targeter ,debugManager );
181+ executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,apiType , isDebugActions ,targeter ,debugManager );
181182 }
182183 }else if (targeterType .equals (ActionTargeterType .TO_CONDITION )) {
183184 String toConditionGroup = parametersLine ;
@@ -197,7 +198,7 @@ private void executeActionsFinal(){
197198 }
198199 }
199200 for (Player globalPlayer : players ){
200- executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,isDebugActions ,targeter ,debugManager );
201+ executeActionsFromToTarget (variablesProperties ,globalPlayer ,actionLine ,actionType ,apiType , isDebugActions ,targeter ,debugManager );
201202 }
202203 }
203204 else {
@@ -206,7 +207,7 @@ private void executeActionsFinal(){
206207 if (isDebugActions ){
207208 debugManager .sendActionMessage (event .getName (), actionLine , player , actionType , targeter );
208209 }
209- executeAction (player ,actionType ,actionLine );
210+ executeAction (player ,actionType ,apiType , actionLine );
210211 }
211212
212213 if (onWait ){
@@ -217,17 +218,17 @@ private void executeActionsFinal(){
217218 }
218219
219220 private void executeActionsFromToTarget (VariablesProperties variablesProperties ,Player player ,String actionLine ,ActionType actionType ,
220- boolean isDebugActions ,ActionTargeter targeter ,DebugManager debugManager ){
221+ String apiType , boolean isDebugActions ,ActionTargeter targeter ,DebugManager debugManager ){
221222 //Replaces %to:<variable>% variables
222223 variablesProperties .setToTarget (player );
223224 String toActionLine = VariablesUtils .replaceAllVariablesInLine (actionLine ,variablesProperties ,false );
224225 if (isDebugActions ){
225226 debugManager .sendActionMessage (event .getName (), toActionLine , player , actionType , targeter );
226227 }
227- executeAction (player ,actionType ,toActionLine );
228+ executeAction (player ,actionType ,apiType , toActionLine );
228229 }
229230
230- private void executeAction (Player player ,ActionType type ,String actionLine ){
231+ private void executeAction (Player player ,ActionType type ,String apiType , String actionLine ){
231232 //Non player actions
232233 switch (type ){
233234 case CONSOLE_MESSAGE :
@@ -297,6 +298,9 @@ private void executeAction(Player player,ActionType type,String actionLine){
297298 case EXECUTE_ACTION_GROUP :
298299 ActionUtils .executeActionGroup (actionLine ,this ,plugin );
299300 return ;
301+ case API :
302+ plugin .getApiManager ().executeAction (apiType ,player ,actionLine );
303+ return ;
300304 }
301305
302306 //Player actions
0 commit comments