Add staff playtime feature, including backend services, API endpoint, and frontend integration.
WIP
This commit is contained in:
@@ -8,6 +8,7 @@ public enum Databases {
|
||||
LUCK_PERMS("luckperms"),
|
||||
LITE_BANS("litebans"),
|
||||
DISCORD("discordLink"),
|
||||
PROXY_PLAYTIME("proxyplaytime"),
|
||||
VOTING_PLUGIN("votingplugin");
|
||||
|
||||
private final String internalName;
|
||||
|
||||
@@ -19,4 +19,19 @@ public interface TeamMemberMapper {
|
||||
AND world = 'global'
|
||||
""")
|
||||
List<Player> getTeamMembers(@Param("groupPermission") String groupPermission);
|
||||
|
||||
@ConstructorArgs({
|
||||
@Arg(column = "username", javaType = String.class),
|
||||
@Arg(column = "uuid", javaType = UUID.class, typeHandler = UUIDTypeHandler.class)
|
||||
})
|
||||
@Select("""
|
||||
SELECT players.username, players.uuid
|
||||
FROM luckperms_user_permissions AS permissions
|
||||
INNER JOIN luckperms_players AS players ON players.uuid = permissions.uuid
|
||||
WHERE permission IN (${groupPermissions})
|
||||
AND server = 'global'
|
||||
AND world = 'global'
|
||||
""")
|
||||
List<Player> getTeamMembersOfGroupList(@Param("groupPermissions") String groupPermissions);
|
||||
|
||||
}
|
||||
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
package com.alttd.altitudeweb.database.proxyplaytime;
|
||||
|
||||
import com.alttd.altitudeweb.type_handler.UUIDTypeHandler;
|
||||
import org.apache.ibatis.annotations.Arg;
|
||||
import org.apache.ibatis.annotations.ConstructorArgs;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface StaffPlaytimeMapper {
|
||||
@ConstructorArgs({
|
||||
@Arg(column = "uuid", javaType = UUID.class, typeHandler = UUIDTypeHandler.class),
|
||||
@Arg(column = "serverName", javaType = String.class),
|
||||
@Arg(column = "sessionStart", javaType = long.class),
|
||||
@Arg(column = "sessionEnd", javaType = long.class)
|
||||
})
|
||||
@Select("""
|
||||
SELECT uuid,
|
||||
server_name AS serverName,
|
||||
session_start AS sessionStart,
|
||||
session_end AS sessionEnd
|
||||
FROM sessions
|
||||
WHERE session_end > #{from}
|
||||
AND session_start < #{to}
|
||||
AND uuid IN (${staffUUIDs})
|
||||
ORDER BY uuid, session_start
|
||||
""")
|
||||
List<StaffPt> getSessionsDuring(@Param("from") long from,
|
||||
@Param("to") long to,
|
||||
@Param("staffUUIDs") String staffUUIDs);
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.alttd.altitudeweb.database.proxyplaytime;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public record StaffPt(UUID uuid, String serverName, long sessionStart, long sessionEnd) {
|
||||
}
|
||||
@@ -37,6 +37,7 @@ public class Connection {
|
||||
InitializeWebDb.init();
|
||||
InitializeLiteBans.init();
|
||||
InitializeLuckPerms.init();
|
||||
InitializeProxyPlaytime.init();
|
||||
InitializeDiscord.init();
|
||||
InitializeVotingPlugin.init();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.alttd.altitudeweb.setup;
|
||||
|
||||
import com.alttd.altitudeweb.database.Databases;
|
||||
import com.alttd.altitudeweb.database.proxyplaytime.StaffPlaytimeMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
public class InitializeProxyPlaytime {
|
||||
|
||||
protected static void init() {
|
||||
log.info("Initializing ProxyPlaytime");
|
||||
Connection.getConnection(Databases.PROXY_PLAYTIME, (configuration) -> {
|
||||
configuration.addMapper(StaffPlaytimeMapper.class);
|
||||
}).join();
|
||||
log.debug("Initialized ProxyPlaytime");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user