Skip to content

Commit

Permalink
generic type for input in ActionBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Jun 30, 2024
1 parent f969ae6 commit 995e1d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@

/**
* The builder for the {@link Action}
*
* @param <I> the type of the input
*/
public class ActionBuilder extends FunctionalMassBuilder<ActionInput, Action> {
public class ActionBuilder<I extends ActionInput> extends FunctionalMassBuilder<I, Action> {
@Override
protected String getType(ActionInput input) {
protected String getType(I input) {
return input.getType();
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.hsgamer.hscore.bukkit.action.builder;

import me.hsgamer.hscore.action.builder.ActionBuilder;
import me.hsgamer.hscore.action.builder.ActionInput;
import me.hsgamer.hscore.bukkit.action.*;
import org.bukkit.plugin.Plugin;

Expand All @@ -17,8 +18,9 @@ private BukkitActionBuilder() {
*
* @param actionBuilder the action builder
* @param plugin the plugin
* @param <I> the type of the input
*/
public static void register(ActionBuilder actionBuilder, Plugin plugin) {
public static <I extends ActionInput> void register(ActionBuilder<I> actionBuilder, Plugin plugin) {
actionBuilder.register(input -> new BroadcastAction(input.getValue()), "broadcast");
actionBuilder.register(input -> new ConsoleAction(plugin, input.getValue()), "console");
actionBuilder.register(input -> new DelayAction(plugin, input.getValue()), "delay");
Expand Down

0 comments on commit 995e1d1

Please sign in to comment.