-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from Oribuin/v1.2.0
v1.2.0
- Loading branch information
Showing
62 changed files
with
3,650 additions
and
1,627 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
41 changes: 41 additions & 0 deletions
41
src/main/java/xyz/oribuin/eternaltags/command/argument/CategoryArgumentHandler.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,41 @@ | ||
package xyz.oribuin.eternaltags.command.argument; | ||
|
||
import dev.rosewood.rosegarden.RosePlugin; | ||
import dev.rosewood.rosegarden.command.framework.ArgumentParser; | ||
import dev.rosewood.rosegarden.command.framework.RoseCommandArgumentHandler; | ||
import dev.rosewood.rosegarden.command.framework.RoseCommandArgumentInfo; | ||
import dev.rosewood.rosegarden.utils.StringPlaceholders; | ||
import xyz.oribuin.eternaltags.manager.TagsManager; | ||
import xyz.oribuin.eternaltags.obj.Category; | ||
|
||
import java.util.List; | ||
import java.util.Map; | ||
|
||
public class CategoryArgumentHandler extends RoseCommandArgumentHandler<Category> { | ||
|
||
public CategoryArgumentHandler(RosePlugin rosePlugin) { | ||
super(rosePlugin, Category.class); | ||
} | ||
|
||
@Override | ||
protected Category handleInternal(RoseCommandArgumentInfo argumentInfo, ArgumentParser argumentParser) throws HandledArgumentException { | ||
String input = argumentParser.next(); | ||
Category value = this.rosePlugin.getManager(TagsManager.class).getCategory(input.toLowerCase()); | ||
if (value == null || value.isGlobal()) | ||
throw new HandledArgumentException("argument-handler-category", StringPlaceholders.single("input", input)); | ||
|
||
return value; | ||
} | ||
|
||
@Override | ||
protected List<String> suggestInternal(RoseCommandArgumentInfo argumentInfo, ArgumentParser argumentParser) { | ||
argumentParser.next(); | ||
|
||
return this.rosePlugin.getManager(TagsManager.class).getCachedCategories() | ||
.entrySet() | ||
.stream().filter(entry -> !entry.getValue().isGlobal()) | ||
.map(Map.Entry::getKey) | ||
.toList(); | ||
} | ||
|
||
} |
35 changes: 35 additions & 0 deletions
35
src/main/java/xyz/oribuin/eternaltags/command/argument/MaterialArgumentHandler.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,35 @@ | ||
package xyz.oribuin.eternaltags.command.argument; | ||
|
||
import dev.rosewood.rosegarden.RosePlugin; | ||
import dev.rosewood.rosegarden.command.framework.ArgumentParser; | ||
import dev.rosewood.rosegarden.command.framework.RoseCommandArgumentHandler; | ||
import dev.rosewood.rosegarden.command.framework.RoseCommandArgumentInfo; | ||
import dev.rosewood.rosegarden.utils.StringPlaceholders; | ||
import org.bukkit.Material; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
public class MaterialArgumentHandler extends RoseCommandArgumentHandler<Material> { | ||
|
||
public MaterialArgumentHandler(RosePlugin rosePlugin) { | ||
super(rosePlugin, Material.class); | ||
} | ||
|
||
@Override | ||
protected Material handleInternal(RoseCommandArgumentInfo argumentInfo, ArgumentParser argumentParser) throws HandledArgumentException { | ||
String input = argumentParser.next(); | ||
Material value = Material.matchMaterial(input); | ||
if (value == null) | ||
throw new HandledArgumentException("argument-handler-material", StringPlaceholders.single("input", input)); | ||
|
||
return value; | ||
} | ||
|
||
@Override | ||
protected List<String> suggestInternal(RoseCommandArgumentInfo argumentInfo, ArgumentParser argumentParser) { | ||
argumentParser.next(); | ||
|
||
return Arrays.stream(Material.values()).map(material -> material.name().toLowerCase()).toList(); | ||
} | ||
} |
40 changes: 0 additions & 40 deletions
40
src/main/java/xyz/oribuin/eternaltags/command/argument/TagOptionArgumentHandler.java
This file was deleted.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
src/main/java/xyz/oribuin/eternaltags/command/command/CategoriesCommand.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,43 @@ | ||
package xyz.oribuin.eternaltags.command.command; | ||
|
||
import dev.rosewood.rosegarden.RosePlugin; | ||
import dev.rosewood.rosegarden.command.framework.CommandContext; | ||
import dev.rosewood.rosegarden.command.framework.RoseCommand; | ||
import dev.rosewood.rosegarden.command.framework.RoseCommandWrapper; | ||
import dev.rosewood.rosegarden.command.framework.annotation.RoseExecutable; | ||
import org.bukkit.entity.Player; | ||
import xyz.oribuin.eternaltags.gui.MenuProvider; | ||
import xyz.oribuin.eternaltags.gui.menu.CategoryGUI; | ||
|
||
public class CategoriesCommand extends RoseCommand { | ||
|
||
public CategoriesCommand(RosePlugin rosePlugin, RoseCommandWrapper parent) { | ||
super(rosePlugin, parent); | ||
} | ||
|
||
@RoseExecutable | ||
public void execute(CommandContext context) { | ||
MenuProvider.get(CategoryGUI.class).open((Player) context.getSender()); | ||
} | ||
|
||
@Override | ||
protected String getDefaultName() { | ||
return "categories"; | ||
} | ||
|
||
@Override | ||
public String getDescriptionKey() { | ||
return "command-categories-description"; | ||
} | ||
|
||
@Override | ||
public String getRequiredPermission() { | ||
return "eternaltags.categories"; | ||
} | ||
|
||
@Override | ||
public boolean isPlayerOnly() { | ||
return true; | ||
} | ||
|
||
} |
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
Oops, something went wrong.