55import jakarta .servlet .http .HttpServletResponse ;
66import net .dv8tion .jda .api .JDA ;
77import org .mangorage .mangobotplugin .commands .trick .Trick ;
8- import org .mangorage .mangobotplugin .commands .trick .TrickCommand ;
9- import org .mangorage .mangobotsite .website .impl .ObjectMap ;
8+ import org .mangorage .mangobotplugin .commands .trick .TrickManager ;
109import org .mangorage .mangobotsite .website .impl .StandardHttpServlet ;
1110import org .mangorage .mangobotsite .website .util .MapBuilder ;
12- import org .mangorage .mangobotsite .website .util .WebConstants ;
1311import java .io .IOException ;
1412import java .time .Instant ;
1513import java .util .Comparator ;
@@ -44,7 +42,7 @@ private static long getLong(String value) {
4442 protected void doGet (HttpServletRequest req , HttpServletResponse resp ) throws ServletException , IOException {
4543 // Retrieve shared objects from the servlet context
4644 var map = getObjectMap ();
47- var command = map .get ("trickCommand " , TrickCommand .class );
45+ var trickManager = map .get ("trickManager " , TrickManager .class );
4846 var jda = map .get ("jda" , JDA .class );
4947
5048 resp .setContentType ("text/html" );
@@ -54,7 +52,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
5452 if (guildId != null ) {
5553 try {
5654 long id = Long .parseLong (guildId );
57- if (command .getTricksForGuild (id ).isEmpty ()) {
55+ if (trickManager .getTricksForGuild (id ).isEmpty ()) {
5856 processTemplate (
5957 MapBuilder .of ()
6058 .self (this )
@@ -82,7 +80,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
8280 }
8381 }
8482
85- var trick = guildId != null && trickId != null ? command . getTrick ( trickId , Long .parseLong (guildId )) : null ;
83+ var trick = guildId != null && trickId != null ? trickManager . getTrickForGuildByName ( Long .parseLong (guildId ), trickId ) : null ;
8684
8785 if (trickId != null && guildId != null && trick == null ) {
8886 processTemplate (
@@ -110,7 +108,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
110108 if (guildId == null ) {
111109 b .put (
112110 "guilds" ,
113- command . getGuilds ()
111+ trickManager . getAllGuilds ()
114112 .stream ()
115113 .map (id -> new Guild (id .toString (), getGuild (jda , id )))
116114 .toList ()
@@ -119,7 +117,7 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws Se
119117
120118 if (guildId != null ) {
121119 b .put ("tricks" ,
122- command .getTricksForGuild (Long .parseLong (guildId ))
120+ trickManager .getTricksForGuild (Long .parseLong (guildId ))
123121 .stream ()
124122 .sorted (Comparator .comparing (Trick ::getTrickID ))
125123 .toList ()
0 commit comments