3333 */
3434public final class GlowEntity {
3535
36+ /**
37+ * このフィールドは、主にスクリプトの検索に利用されます。
38+ */
3639 public static final GlowEntityPacket DEFAULT = new GlowEntityPacket ();
3740
3841 private final int id ;
@@ -45,6 +48,15 @@ public final class GlowEntity {
4548 private boolean dead ;
4649 private boolean [] flag = ArrayUtils .EMPTY_BOOLEAN_ARRAY ;
4750
51+ /**
52+ * コンストラクタ
53+ * @param id - エンティティのID
54+ * @param uuid - エンティティの{@link UUID}
55+ * @param sbPlayer - 送信者
56+ * @param teamColor - 発光色
57+ * @param blockCoords - 座標
58+ * @param flagSize - フラグの初期容量
59+ */
4860 private GlowEntity (final int id , @ NotNull UUID uuid , @ NotNull SBPlayer sbPlayer , @ NotNull TeamColor teamColor , @ NotNull BlockCoords blockCoords , final int flagSize ) {
4961 this .id = id ;
5062 this .x = blockCoords .getX ();
@@ -58,6 +70,16 @@ private GlowEntity(final int id, @NotNull UUID uuid, @NotNull SBPlayer sbPlayer,
5870 }
5971 }
6072
73+ /**
74+ * {@link GlowEntity}を作成します。
75+ * @param nmsEntity - {@code net.minecraft.server.vX_X_RX.Entity}
76+ * @param sbPlayer - 送信者
77+ * @param teamColor - 発光色
78+ * @param blockCoords - 座標
79+ * @param flagSize - フラグの初期容量
80+ * @return {@link GlowEntity} - インスタンス
81+ * @throws ReflectiveOperationException - リフレクション関係で例外が発生した場合にスローされます。
82+ */
6183 @ NotNull
6284 static GlowEntity create (@ NotNull Object nmsEntity , @ NotNull SBPlayer sbPlayer , @ NotNull TeamColor teamColor , @ NotNull BlockCoords blockCoords , final int flagSize ) throws ReflectiveOperationException {
6385 int id = (int ) PackageType .NMS .invokeMethod (nmsEntity , "EntityMagmaCube" , "getId" );
@@ -67,57 +89,110 @@ static GlowEntity create(@NotNull Object nmsEntity, @NotNull SBPlayer sbPlayer,
6789 return glowEntity ;
6890 }
6991
92+ /**
93+ * エンティティIDを取得します。
94+ * @return {@link int} - エンティティID
95+ */
7096 public int getId () {
7197 return id ;
7298 }
7399
100+ /**
101+ * エンティティのX座標を取得します。
102+ * @return {@link int} - X座標
103+ */
74104 public int getX () {
75105 return x ;
76106 }
77107
108+ /**
109+ * エンティティのY座標を取得します。
110+ * @return {@link int} - Y座標
111+ */
78112 public int getY () {
79113 return y ;
80114 }
81115
116+ /**
117+ * エンティティのZ座標を取得します。
118+ * @return {@link int} - Z座標
119+ */
82120 public int getZ () {
83121 return z ;
84122 }
85123
124+ /**
125+ * エンティティのUUIDを取得します。
126+ * @return {@link UUID} - エンティティのUUID
127+ */
86128 @ NotNull
87129 public UUID getUniqueId () {
88130 return uuid ;
89131 }
90-
132+
133+ /**
134+ * 送信者を取得します。
135+ * @return {@link SBPlayer} - 送信者
136+ */
91137 @ NotNull
92138 public SBPlayer getSBPlayer () {
93139 return sbPlayer ;
94140 }
95141
142+ /**
143+ * 発光色(チームの色)を取得します。
144+ * @return {@link TeamColor} - 発光色
145+ */
96146 @ NotNull
97147 public TeamColor getTeamColor () {
98148 return teamColor ;
99149 }
100150
101- public boolean removeEntry () {
102- return teamColor .getTeam ().removeEntry (uuid .toString ());
103- }
104-
151+ /**
152+ * フラグを取得します。
153+ * <p>
154+ * 条件等を設定したい場合に利用してください。
155+ * @return {@link boolean} - フラグ
156+ */
105157 public boolean [] getFlag () {
106158 return flag ;
107159 }
108160
161+ /**
162+ * エンティティが消滅しているのかどうかを設定します。
163+ * @param dead - 消滅しているのかどうか。
164+ */
109165 void setDead (boolean dead ) {
110166 this .dead = dead ;
167+ if (dead ) {
168+ teamColor .getTeam ().removeEntry (uuid .toString ());
169+ } else {
170+ teamColor .getTeam ().addEntry (uuid .toString ());
171+ }
111172 }
112173
174+ /**
175+ * エンティティが消滅しているのかどうか。
176+ * @return {@link boolean} - 消滅している場合は{@code true}
177+ */
113178 public boolean isDead () {
114179 return dead ;
115180 }
116181
182+ /**
183+ * エンティティの座標を比較します。
184+ * @param block - ブロック
185+ * @return {@link boolean} - 一致する場合は{@code true}
186+ */
117187 public boolean compare (@ NotNull Block block ) {
118188 return getX () == block .getX () && getY () == block .getY () && getZ () == block .getZ ();
119189 }
120190
191+ /**
192+ * エンティティの座標を比較します。
193+ * @param blockCoords - ブロックの座標
194+ * @return {@link boolean} - 一致する場合は{@code true}
195+ */
121196 public boolean compare (@ NotNull BlockCoords blockCoords ) {
122197 return blockCoords .compare (getX (), getY (), getZ ());
123198 }
0 commit comments