change to register all commands at once to use bulk overwrite features
This commit is contained in:
		| @@ -2,6 +2,7 @@ package net.tomatentum.marinara.registry; | |||||||
|  |  | ||||||
| import java.lang.reflect.Method; | import java.lang.reflect.Method; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
|  | import java.util.Collection; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Optional; | import java.util.Optional; | ||||||
|  |  | ||||||
| @@ -45,7 +46,7 @@ public class InteractionRegistry { | |||||||
|                 defs.add(new ApplicationCommandDefinition(def.applicationCommand()).addExecutableCommand(def)); |                 defs.add(new ApplicationCommandDefinition(def.applicationCommand()).addExecutableCommand(def)); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         defs.forEach(wrapper::registerApplicationCommand); |         wrapper.registerApplicationCommands(defs.toArray(new ApplicationCommandDefinition[0])); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public void handle(Object context) { |     public void handle(Object context) { | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ public abstract class LibraryWrapper { | |||||||
|         interactionSubscriber = new ArrayList<>(); |         interactionSubscriber = new ArrayList<>(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public abstract void registerApplicationCommand(ApplicationCommandDefinition def);  |     public abstract void registerApplicationCommands(ApplicationCommandDefinition[] defs);  | ||||||
|  |  | ||||||
|     public void handleInteraction(Object context) { |     public void handleInteraction(Object context) { | ||||||
|         interactionSubscriber.forEach((o) -> o.accept(context)); |         interactionSubscriber.forEach((o) -> o.accept(context)); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user