@@ -24,51 +24,50 @@ public final class SiegeKitStandEntity extends ArmorStandEntity {
2424 @ Nullable
2525 private final GameTeam team ;
2626
27- private final SiegeKit type ;
27+ private final SiegeKit kit ;
2828 private final SiegeActive game ;
2929
3030 public SiegeKitStandEntity (World world , SiegeActive game , SiegeKitStandLocation stand ) {
3131 super (EntityType .ARMOR_STAND , world );
32- this .type = stand .type ();
33- this .team = stand .team ();
32+ this .kit = stand .type ();
3433 this .controllingFlag = stand .flag ();
34+ this .team = this .controllingFlag != null ? this .controllingFlag .team : stand .team ();
3535 this .game = game ;
3636 this .setPose (EntityPose .CROUCHING );
3737
3838 this .updatePositionAndAngles (stand .pos ().x , stand .pos ().y , stand .pos ().z , stand .yaw (), 0 );
3939
40- this .setCustomName (this .type .name );
40+ this .setCustomName (this .kit .name () );
4141 this .setInvulnerable (true );
4242 this .setCustomNameVisible (true );
4343 this .setShowArms (true );
44- this .type .equipArmourStand (this );
44+ this .kit .equipArmourStand (this );
4545 }
4646
4747 public GameTeam getTeam () {
48- if (this .controllingFlag != null ) {
49- return this .controllingFlag .team ;
50- } else {
51- return this .team ;
52- }
48+ return this .controllingFlag != null ? this .controllingFlag .team : this .team ;
5349 }
5450
5551 public void onControllingFlagCaptured () {
56- this .type .equipArmourStand (this );
52+ this .kit .equipArmourStand (this );
5753 }
5854
5955 @ Override
60- public ActionResult interactAt (PlayerEntity player , Vec3d hitPos , Hand hand ) {
61- SiegePlayer participant = this .game .participant ((ServerPlayerEntity ) player );
62- if (participant == null || ((ServerPlayerEntity ) player ).interactionManager .getGameMode () != GameMode .SURVIVAL ) {
56+ public ActionResult interactAt (PlayerEntity playerEntity , Vec3d hitPos , Hand hand ) {
57+ var player = (ServerPlayerEntity ) playerEntity ;
58+ SiegePlayer participant = this .game .participant (player );
59+
60+ if (participant == null || player .interactionManager .getGameMode () != GameMode .SURVIVAL ) {
6361 return ActionResult .FAIL ;
6462 }
6563
6664 if (participant .team != this .getTeam ()) {
6765 return ActionResult .FAIL ;
6866 }
6967
70- participant .kit = this .type ;
71- this .type .equipPlayer ((ServerPlayerEntity ) player , participant , this .game .world , this .game .config );
68+ participant .kit .returnResources (player , participant );
69+ participant .kit = this .kit ;
70+ this .kit .equipPlayer (player , participant , this .game .config , player .getWorld ().getTime ());
7271 return ActionResult .SUCCESS ;
7372 }
7473
@@ -78,7 +77,7 @@ public boolean isImmobile() {
7877 }
7978
8079 @ Override
81- public void takeKnockback ( double strength , double x , double z ) {
82- super . takeKnockback ( strength , x , z ) ;
80+ public boolean isMarker ( ) {
81+ return true ;
8382 }
8483}
0 commit comments