generated from Rosewood-Development/RoseTemplate
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Showing
23 changed files
with
374 additions
and
34 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
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
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
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
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
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
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
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
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
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
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
36 changes: 36 additions & 0 deletions
36
src/main/java/xyz/oribuin/fishing/command/argument/FishArgument.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,36 @@ | ||
package xyz.oribuin.fishing.command.argument; | ||
|
||
import dev.rosewood.rosegarden.command.framework.Argument; | ||
import dev.rosewood.rosegarden.command.framework.ArgumentHandler; | ||
import dev.rosewood.rosegarden.command.framework.CommandContext; | ||
import dev.rosewood.rosegarden.command.framework.InputIterator; | ||
import dev.rosewood.rosegarden.utils.StringPlaceholders; | ||
import xyz.oribuin.fishing.FishingPlugin; | ||
import xyz.oribuin.fishing.fish.Fish; | ||
import xyz.oribuin.fishing.manager.TierManager; | ||
|
||
import java.util.List; | ||
|
||
public class FishArgument extends ArgumentHandler<Fish> { | ||
|
||
public FishArgument() { | ||
super(Fish.class); | ||
} | ||
|
||
@Override | ||
public Fish handle(CommandContext context, Argument argument, InputIterator inputIterator) throws HandledArgumentException { | ||
String input = inputIterator.next(); | ||
Fish fish = FishingPlugin.get().getManager(TierManager.class).getFish(input); | ||
if (fish != null) return fish; | ||
|
||
throw new HandledArgumentException("argument-handler-fish", StringPlaceholders.of("input", input)); | ||
} | ||
|
||
@Override | ||
public List<String> suggest(CommandContext context, Argument argument, String[] args) { | ||
return FishingPlugin.get().getManager(TierManager.class).allFish().stream() | ||
.map(Fish::name) | ||
.toList(); | ||
} | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/xyz/oribuin/fishing/command/argument/SkillArgument.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,33 @@ | ||
package xyz.oribuin.fishing.command.argument; | ||
|
||
import dev.rosewood.rosegarden.command.framework.Argument; | ||
import dev.rosewood.rosegarden.command.framework.ArgumentHandler; | ||
import dev.rosewood.rosegarden.command.framework.CommandContext; | ||
import dev.rosewood.rosegarden.command.framework.InputIterator; | ||
import dev.rosewood.rosegarden.utils.StringPlaceholders; | ||
import xyz.oribuin.fishing.skill.Skill; | ||
import xyz.oribuin.fishing.skill.SkillRegistry; | ||
|
||
import java.util.List; | ||
|
||
public class SkillArgument extends ArgumentHandler<Skill> { | ||
|
||
public SkillArgument() { | ||
super(Skill.class); | ||
} | ||
|
||
@Override | ||
public Skill handle(CommandContext context, Argument argument, InputIterator inputIterator) throws HandledArgumentException { | ||
String input = inputIterator.next(); | ||
Skill skill = SkillRegistry.get(input); | ||
if (skill != null) return skill; | ||
|
||
throw new HandledArgumentException("argument-handler-skill", StringPlaceholders.of("input", input)); | ||
} | ||
|
||
@Override | ||
public List<String> suggest(CommandContext context, Argument argument, String[] args) { | ||
return SkillRegistry.all().values().stream().map(Skill::name).toList(); | ||
} | ||
|
||
} |
34 changes: 34 additions & 0 deletions
34
src/main/java/xyz/oribuin/fishing/command/argument/TierArgument.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,34 @@ | ||
package xyz.oribuin.fishing.command.argument; | ||
|
||
import dev.rosewood.rosegarden.command.framework.Argument; | ||
import dev.rosewood.rosegarden.command.framework.ArgumentHandler; | ||
import dev.rosewood.rosegarden.command.framework.CommandContext; | ||
import dev.rosewood.rosegarden.command.framework.InputIterator; | ||
import dev.rosewood.rosegarden.utils.StringPlaceholders; | ||
import xyz.oribuin.fishing.FishingPlugin; | ||
import xyz.oribuin.fishing.fish.Tier; | ||
import xyz.oribuin.fishing.manager.TierManager; | ||
|
||
import java.util.List; | ||
|
||
public class TierArgument extends ArgumentHandler<Tier> { | ||
|
||
public TierArgument() { | ||
super(Tier.class); | ||
} | ||
|
||
@Override | ||
public Tier handle(CommandContext context, Argument argument, InputIterator inputIterator) throws HandledArgumentException { | ||
String input = inputIterator.next(); | ||
Tier tier = FishingPlugin.get().getManager(TierManager.class).get(input); | ||
if (tier != null) return tier; | ||
|
||
throw new HandledArgumentException("argument-handler-tier", StringPlaceholders.of("input", input)); | ||
} | ||
|
||
@Override | ||
public List<String> suggest(CommandContext context, Argument argument, String[] args) { | ||
return FishingPlugin.get().getManager(TierManager.class).getTiers().keySet().stream().toList(); | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/xyz/oribuin/fishing/command/impl/admin/GiveCommand.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,30 @@ | ||
package xyz.oribuin.fishing.command.impl.admin; | ||
|
||
import dev.rosewood.rosegarden.RosePlugin; | ||
import dev.rosewood.rosegarden.command.framework.ArgumentsDefinition; | ||
import dev.rosewood.rosegarden.command.framework.BaseRoseCommand; | ||
import dev.rosewood.rosegarden.command.framework.CommandInfo; | ||
import xyz.oribuin.fishing.command.impl.admin.give.GiveAugmentCommand; | ||
import xyz.oribuin.fishing.command.impl.admin.give.GiveFishCommand; | ||
|
||
public class GiveCommand extends BaseRoseCommand { | ||
|
||
public GiveCommand(RosePlugin rosePlugin) { | ||
super(rosePlugin); | ||
} | ||
|
||
@Override | ||
protected CommandInfo createCommandInfo() { | ||
return CommandInfo.builder("give") | ||
.descriptionKey("command-give-description") | ||
.permission("fishing.admin") | ||
.arguments(this.createArguments()) | ||
.build(); | ||
} | ||
|
||
private ArgumentsDefinition createArguments() { | ||
return ArgumentsDefinition.builder() | ||
.requiredSub(new GiveAugmentCommand(this.rosePlugin), new GiveFishCommand(this.rosePlugin)); | ||
} | ||
|
||
} |
Oops, something went wrong.