Skip to content

Commit 727abcd

Browse files
committed
feature #105: allow dominion plugin to manage world behavior
1 parent 945717a commit 727abcd

1 file changed

Lines changed: 27 additions & 19 deletions

File tree

src/main/java/cn/lunadeer/dominion/api/DominionAPI.java

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -232,36 +232,44 @@ public static DominionAPI getInstance() {
232232
*/
233233
public abstract Integer memberCount();
234234

235+
235236
/**
236-
* Checks if the specified player has the specified privilege flag in the given dominion.
237+
* Checks if a player has a specific privilege flag at the given location.
237238
* <p>
238-
* If no-permission, it will send a message to the player.
239+
* This method verifies whether the player has permission for the specified privilege flag
240+
* at the given location, considering the dominion (if any) that covers the location.
241+
* If the player lacks the required privilege, appropriate messages or events may be triggered.
239242
*
240-
* @param dom the dominion to check
241-
* @param flag the privilege flag to check
242-
* @param player the player to check
243-
* @return true if the player has the specified privilege flag, false otherwise
243+
* @param location the location to check the privilege flag at
244+
* @param flag the privilege flag to check
245+
* @param player the player whose privileges are being checked
246+
* @return true if the player has the privilege flag at the location, false otherwise
244247
*/
245-
public abstract boolean checkPrivilegeFlag(@Nullable DominionDTO dom, @NotNull PriFlag flag, @NotNull Player player);
248+
public abstract boolean checkPrivilegeFlag(@NotNull Location location, @NotNull PriFlag flag, @NotNull Player player);
246249

247250
/**
248-
* Checks if the specified player has the specified privilege flag in the given dominion.
251+
* Checks if a player has a specific privilege flag at the given location without triggering messages or events.
249252
* <p>
250-
* If no-permission, it will not send a message to the player.
253+
* This method performs the same privilege check as {@link #checkPrivilegeFlag(Location, PriFlag, Player)}
254+
* but operates silently, without sending any messages to the player or triggering related events.
255+
* This is useful for internal checks where user feedback is not desired.
251256
*
252-
* @param dom the dominion to check
253-
* @param flag the privilege flag to check
254-
* @param player the player to check
255-
* @return true if the player has the specified privilege flag, false otherwise
257+
* @param location the location to check the privilege flag at
258+
* @param flag the privilege flag to check
259+
* @param player the player whose privileges are being checked
260+
* @return true if the player has the privilege flag at the location, false otherwise
256261
*/
257-
public abstract boolean checkPrivilegeFlagSilence(@Nullable DominionDTO dom, @NotNull PriFlag flag, @NotNull Player player);
262+
public abstract boolean checkPrivilegeFlagSilence(@NotNull Location location, @NotNull PriFlag flag, @NotNull Player player);
258263

259264
/**
260-
* Checks if the specified environment flag is set in the given dominion.
265+
* Checks if the specified environment flag is set at the given location.
266+
* <p>
267+
* This method determines whether the provided environment flag is enabled at the specified location,
268+
* considering the dominion (if any) that covers the location.
261269
*
262-
* @param dom the dominion to check, or null to check the global environment
263-
* @param flag the environment flag to check
264-
* @return true if the environment flag is set, false otherwise
270+
* @param location the location to check for the environment flag
271+
* @param flag the environment flag to check
272+
* @return true if the environment flag is set at the location, false otherwise
265273
*/
266-
public abstract boolean checkEnvironmentFlag(@Nullable DominionDTO dom, @NotNull EnvFlag flag);
274+
public abstract boolean checkEnvironmentFlag(@NotNull Location location, @NotNull EnvFlag flag);
267275
}

0 commit comments

Comments
 (0)