-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bc2c66b
commit 5bdd15f
Showing
44 changed files
with
1,087 additions
and
852 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
plugins { | ||
id("java") | ||
} | ||
|
||
java { | ||
toolchain.languageVersion.set(JavaLanguageVersion.of(21)) | ||
} | ||
|
||
// utf-8 | ||
tasks.withType<JavaCompile> { | ||
options.encoding = "UTF-8" | ||
} | ||
|
||
dependencies { | ||
compileOnly("io.papermc.paper:paper-api:1.20.1-R0.1-SNAPSHOT") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package cn.lunadeer.dominion.api; | ||
|
||
import cn.lunadeer.dominion.api.dtos.DominionDTO; | ||
import cn.lunadeer.dominion.api.dtos.GroupDTO; | ||
import cn.lunadeer.dominion.api.dtos.MemberDTO; | ||
import org.bukkit.Location; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.UUID; | ||
|
||
public interface Cache { | ||
/** | ||
* 获取玩家当前所在领地 | ||
* | ||
* @param player 玩家 | ||
* @return 玩家当前所在领地 如果玩家不在任何领地内,则返回null | ||
*/ | ||
@Nullable DominionDTO getPlayerCurrentDominion(@NotNull Player player); | ||
|
||
/** | ||
* 获取指定位置的领地信息 | ||
* | ||
* @param loc 位置 | ||
* @return 领地信息 如果位置不在任何领地内,则返回null | ||
*/ | ||
@Nullable DominionDTO getDominionByLoc(@NotNull Location loc); | ||
|
||
/** | ||
* 根据 ID 获取权限组对象 | ||
* | ||
* @param id 权限组 ID | ||
* @return 权限组对象 如果权限组不存在,则返回null | ||
*/ | ||
@Nullable GroupDTO getGroup(@NotNull Integer id); | ||
|
||
/** | ||
* 获取玩家在指定领地的成员信息 | ||
* | ||
* @param player 玩家 | ||
* @param dominion 领地 | ||
* @return 玩家在指定领地的成员信息 如果玩家不属于领地成员,则返回null | ||
*/ | ||
@Nullable MemberDTO getMember(@NotNull Player player, @NotNull DominionDTO dominion); | ||
|
||
/** | ||
* 获取玩家在指定领地的成员信息 | ||
* | ||
* @param player_uuid 玩家 UUID | ||
* @param dominion 领地 | ||
* @return 玩家在指定领地的成员信息 如果玩家不属于领地成员,则返回null | ||
*/ | ||
@Nullable MemberDTO getMember(@NotNull UUID player_uuid, @NotNull DominionDTO dominion); | ||
|
||
/** | ||
* 获取指定 ID 的领地信息 | ||
* | ||
* @param id 领地 ID | ||
* @return 领地信息 如果领地不存在,则返回null | ||
*/ | ||
@Nullable DominionDTO getDominion(@NotNull Integer id); | ||
|
||
/** | ||
* 获取玩家当前正在使用的权限组称号 | ||
* | ||
* @param uuid 玩家 UUID | ||
* @return 权限组对象 如果玩家没有使用任何权限组,则返回null | ||
*/ | ||
@Nullable GroupDTO getPlayerUsingGroupTitle(@NotNull UUID uuid); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package cn.lunadeer.dominion.api; | ||
|
||
public interface Dominion { | ||
|
||
static Cache getInstance() throws ClassNotFoundException, NoSuchFieldException, IllegalAccessException { | ||
// Cache.instance is a static field in the Cache class | ||
return (Cache) Class.forName("cn.lunadeer.dominion.Cache").getDeclaredField("instance").get(null); | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
api/src/main/java/cn/lunadeer/dominion/api/dtos/DominionDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
package cn.lunadeer.dominion.api.dtos; | ||
|
||
import org.bukkit.Location; | ||
import org.bukkit.World; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.UUID; | ||
|
||
public interface DominionDTO { | ||
// getters and setters | ||
Integer getId(); | ||
|
||
UUID getOwner(); | ||
|
||
String getName(); | ||
|
||
@Nullable World getWorld(); | ||
|
||
UUID getWorldUid(); | ||
|
||
Integer getX1(); | ||
|
||
Integer getY1(); | ||
|
||
Integer getZ1(); | ||
|
||
Integer getX2(); | ||
|
||
Integer getY2(); | ||
|
||
Integer getZ2(); | ||
|
||
Integer getSquare(); | ||
|
||
Integer getVolume(); | ||
|
||
Integer getWidthX(); | ||
|
||
Integer getHeight(); | ||
|
||
Integer getWidthZ(); | ||
|
||
Integer getParentDomId(); | ||
|
||
String getJoinMessage(); | ||
|
||
String getLeaveMessage(); | ||
|
||
Boolean getFlagValue(Flag flag); | ||
|
||
Location getTpLocation(); | ||
|
||
Location getLocation1(); | ||
|
||
Location getLocation2(); | ||
|
||
int getColorR(); | ||
|
||
int getColorG(); | ||
|
||
int getColorB(); | ||
|
||
String getColor(); | ||
|
||
int getColorHex(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package cn.lunadeer.dominion.api.dtos; | ||
|
||
public interface Flag { | ||
String getFlagName(); | ||
|
||
String getDisplayName(); | ||
|
||
String getDescription(); | ||
|
||
Boolean getDefaultValue(); | ||
|
||
Boolean getEnable(); | ||
} |
19 changes: 19 additions & 0 deletions
19
api/src/main/java/cn/lunadeer/dominion/api/dtos/GroupDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package cn.lunadeer.dominion.api.dtos; | ||
|
||
import net.kyori.adventure.text.Component; | ||
|
||
public interface GroupDTO { | ||
Integer getId(); | ||
|
||
Integer getDomID(); | ||
|
||
String getName(); | ||
|
||
Component getNameColoredComponent(); | ||
|
||
String getNameColoredBukkit(); | ||
|
||
Boolean getAdmin(); | ||
|
||
Boolean getFlagValue(Flag flag); | ||
} |
17 changes: 17 additions & 0 deletions
17
api/src/main/java/cn/lunadeer/dominion/api/dtos/MemberDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package cn.lunadeer.dominion.api.dtos; | ||
|
||
import java.util.UUID; | ||
|
||
public interface MemberDTO { | ||
Integer getId(); | ||
|
||
UUID getPlayerUUID(); | ||
|
||
Boolean getAdmin(); | ||
|
||
Integer getDomID(); | ||
|
||
Integer getGroupId(); | ||
|
||
Boolean getFlagValue(Flag flag); | ||
} |
15 changes: 15 additions & 0 deletions
15
api/src/main/java/cn/lunadeer/dominion/api/dtos/PrivilegeTemplateDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package cn.lunadeer.dominion.api.dtos; | ||
|
||
import java.util.UUID; | ||
|
||
public interface PrivilegeTemplateDTO { | ||
Integer getId(); | ||
|
||
UUID getCreator(); | ||
|
||
String getName(); | ||
|
||
Boolean getAdmin(); | ||
|
||
Boolean getFlagValue(Flag flag); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.