@@ -40,7 +40,7 @@ In this section, you will learn:
4040 ```` java
4141 package org.angellock.impl.extensions ;
4242
43- import org.angellock.impl.AbstractRobot ;
43+ import org.angellock.impl.RobotPlayer ;
4444 import org.angellock.impl.events.handlers.LoginHandler ;
4545 import org.angellock.impl.providers.AbstractPlugin ;
4646
@@ -73,7 +73,7 @@ In this section, you will learn:
7373 }
7474
7575 @Override
76- public void onEnable (AbstractRobot entityBot ) {
76+ public void onEnable (RobotPlayer entityBot ) {
7777 getListeners(). add(
7878 new LoginHandler (). addExtraAction((loginPacket) - > {
7979 getLogger(). info(loginPacket. getCommonPlayerSpawnInfo(). getGameMode(). name());
@@ -117,7 +117,7 @@ These methods aiming to build the chain calling style for simplicity.
117117import org.angellock.impl.api.state.LoginStateMachine ;
118118
119119@Override
120- public void onEnable(AbstractRobot entityBot) {
120+ public void onEnable(RobotPlayer entityBot) {
121121
122122 LoginStateMachine loginStateMachine = new LoginStateMachine ();
123123
@@ -150,7 +150,7 @@ you can simply add `.and()` branch statement in that state node. **For example:*
150150import org.angellock.impl.api.state.LoginStateMachine ;
151151
152152@Override
153- public void onEnable(AbstractRobot entityBot) {
153+ public void onEnable(RobotPlayer entityBot) {
154154
155155 LoginStateMachine loginStateMachine = new LoginStateMachine ();
156156
@@ -161,8 +161,8 @@ public void onEnable(AbstractRobot entityBot) {
161161 .source(LoginState . VERIFY ). whenReceive(" 机器人验证已完毕" ). goal(LoginState . REGISTER , registerAction)
162162 .source(LoginState . REGISTER ). whenReceive(" 已成功注册" ). goal(LoginState . JOIN , joinAction)
163163 .source(LoginState . LOGIN ). whenReceive(" 已成功登录" ). goal(LoginState . JOIN , joinAction)
164- .resetOnlyWhen(KickReason . HUMAN_VERIFICATION ).
165- build(); // This method will build the state machine object without return value
164+ .resetOnlyWhen(KickReason . HUMAN_VERIFICATION )
165+ . build(); // This method will build the state machine object without return value
166166}
167167```
168168** Explanation:**
@@ -249,7 +249,7 @@ Added below code to `onEnable()` method in `ExamplePlugin`:
249249``` java
250250...
251251@Override
252- public void onEnable(AbstractRobot entityBot) {
252+ public void onEnable(RobotPlayer entityBot) {
253253 registerEvent(new MyListener ());
254254}
255255```
@@ -267,7 +267,7 @@ import org.geysermc.mcprotocollib.protocol.data.game.entity.type.EntityType;
267267
268268public class ExamplePlugin extends AbstractPlugin implements IListener {
269269 @Override
270- public void onEnable (AbstractRobot entityBot ) {
270+ public void onEnable (RobotPlayer entityBot ) {
271271 registerEvent(this ); // Because plugin class implemented IListener, so it is also a Listener Type.
272272 }
273273
@@ -329,7 +329,7 @@ public class ExamplePlugin extends AbstractPlugin implements IListener {
329329
330330 ```` java
331331 @Override
332- public void onEnable(AbstractRobot entityBot) {
332+ public void onEnable(RobotPlayer entityBot) {
333333 getListeners(). add(
334334 new LoginHandler (). addExtraAction((loginPacket) - > {
335335 getLogger(). info(loginPacket. getCommonPlayerSpawnInfo(). getGameMode());
@@ -366,7 +366,7 @@ public class ExamplePlugin extends AbstractPlugin implements IListener {
366366 import org.angellock.impl.extensions.examples.MyHandler ;
367367
368368 @Override
369- public void onEnable(AbstractRobot entityBot) {
369+ public void onEnable(RobotPlayer entityBot) {
370370 getListeners(). add(
371371 new MyHandler (). addExtraAction((playerChatPacket) - > {
372372 getLogger(). info(playerChatPacket. getContent()); // Example Action.
@@ -396,7 +396,7 @@ public class ExamplePlugin extends AbstractPlugin implements IListener {
396396 and prints sub-commands you passed, the code looks like this:
397397 ``` java
398398 @Override
399- public void onEnable(AbstractRobot abstractRobot ) {
399+ public void onEnable(RobotPlayer robot ) {
400400 getCommands(). register(new CommandBuilder (). withName(" test" ). allowedUsers(" PlayerName" ). build((response, botInstance) - > {
401401 String [] subCommand = response. getCommandList(); // get command list contains main-command and sub-command.
402402
@@ -409,7 +409,7 @@ public class ExamplePlugin extends AbstractPlugin implements IListener {
409409 ** An Example of getting command-sender and command list:**
410410 ``` java
411411 @Override
412- public void onEnable(AbstractRobot abstractRobot ) {
412+ public void onEnable(RobotPlayer robot ) {
413413 getCommands(). register(new CommandBuilder (). withName(" uid" ). allowedUsers(" Melibertan" ). build((response, botInstance) - > {
414414 String [] subCommand = response. getCommandList(); // get command list contains main-command and sub-command.
415415 String commandSender = response. getSender(); // get player who have sent this command.
@@ -452,12 +452,12 @@ public class ExampleMessageListener implements IListener {
452452Step 2:
453453
454454``` java
455- import org.angellock.impl.AbstractRobot ;
455+ import org.angellock.impl.RobotPlayer ;
456456import org.angellock.impl.plugin.AbstractPlugin ;
457457
458458public class MessagePlugin extends AbstractPlugin {
459459 @Override
460- public void onEnable (AbstractRobot robot ){
460+ public void onEnable (RobotPlayer robot ){
461461 getEvents(). registerListeners(new ExampleMessageListener (), this );
462462 }
463463}
@@ -471,7 +471,7 @@ import org.angellock.impl.plugin.AbstractPlugin;
471471
472472public class SendMsgPlugin extends AbstractPlugin {
473473 @Override
474- public void onEnable (AbstractRobot robot ) {
474+ public void onEnable (RobotPlayer robot ) {
475475 if (... ){ // when the sending condition is meet
476476 BotManager . getBotByName(" bot#1" ) // you can specify on which bot you want to send to. (you define on config file)
477477 .callHandleableEvent(new MessageBroadcastEvent (" something you want to send" ));
@@ -493,9 +493,9 @@ DolphinAPI also implemented player event system, allowing you to detect and pred
493493 import org.angellock.impl.providers.AbstractPlugin;
494494 public class TestPlayerPlugin extends AbstractPlugin {
495495 @Override
496- public void onEnable(AbstractRobot abstractRobot ) {
496+ public void onEnable(RobotPlayer robot ) {
497497 getListeners().add(new EntityMovePacket().addExtraAction((movepacket)->{
498- getLogger().info("Moving player position: "+abstractRobot .getOnlinePlayers().get(movepacket.getEntityId()).getPosition());
498+ getLogger().info("Moving player position: "+robot .getOnlinePlayers().get(movepacket.getEntityId()).getPosition());
499499 }));
500500 }
501501
@@ -524,11 +524,11 @@ DolphinAPI also implemented player event system, allowing you to detect and pred
524524 import org.angellock.impl.ingame.IPlayer;
525525 ...
526526 @Override
527- public void onEnable(AbstractRobot abstractRobot ) {
528- IPlayer target = abstractRobot .getOnlinePlayers().get(movepacket.getEntityId());
527+ public void onEnable(RobotPlayer robot ) {
528+ IPlayer target = robot .getOnlinePlayers().get(movepacket.getEntityId());
529529 if(target != null){
530- if(target.getPosition().getDistance(abstractRobot .getPosition()) < 7){
531- abstractRobot .getSession().disconnect("Test");
530+ if(target.getPosition().getDistance(robot .getPosition()) < 7){
531+ robot .getSession().disconnect("Test");
532532 }
533533 }
534534 }
0 commit comments