-
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
35 changed files
with
1,195 additions
and
228 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
68 changes: 68 additions & 0 deletions
68
src/main/java/xiamomc/morph/commands/subcommands/plugin/MakeSkillItemSubCommand.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,68 @@ | ||
package xiamomc.morph.commands.subcommands.plugin; | ||
|
||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import xiamomc.morph.MorphPluginObject; | ||
import xiamomc.morph.messages.CommandStrings; | ||
import xiamomc.morph.messages.MessageUtils; | ||
import xiamomc.morph.misc.permissions.CommonPermissions; | ||
import xiamomc.morph.utilities.ItemUtils; | ||
import xiamomc.pluginbase.Command.ISubCommand; | ||
import xiamomc.pluginbase.Messages.FormattableMessage; | ||
|
||
import java.util.List; | ||
|
||
public class MakeSkillItemSubCommand extends MorphPluginObject implements ISubCommand | ||
{ | ||
@Override | ||
public @NotNull String getCommandName() | ||
{ | ||
return "make_disguise_tool"; | ||
} | ||
|
||
@Override | ||
public @Nullable String getPermissionRequirement() | ||
{ | ||
return CommonPermissions.MAKE_DISGUISE_TOOL; | ||
} | ||
|
||
@Override | ||
public FormattableMessage getHelpMessage() | ||
{ | ||
return new FormattableMessage(plugin, "make selected a disguise tool"); | ||
} | ||
|
||
private final List<String> emptyList = List.of(); | ||
|
||
@Override | ||
public @Nullable List<String> onTabComplete(List<String> args, CommandSender source) | ||
{ | ||
return emptyList; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(@NotNull CommandSender sender, @NotNull String[] args) | ||
{ | ||
if (!(sender instanceof Player player)) | ||
{ | ||
sender.sendMessage(MessageUtils.prefixes(sender, CommandStrings.noPermissionMessage())); | ||
return true; | ||
} | ||
|
||
var item = player.getEquipment().getItemInMainHand(); | ||
if (item.isEmpty() || item.getType().isAir()) | ||
{ | ||
sender.sendMessage(MessageUtils.prefixes(sender, CommandStrings.illegalArgumentString().resolve("detail", "air... :("))); | ||
return true; | ||
} | ||
|
||
item = ItemUtils.buildSkillItemFrom(item); | ||
player.getEquipment().setItemInMainHand(item); | ||
|
||
sender.sendMessage(MessageUtils.prefixes(sender, CommandStrings.success())); | ||
|
||
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.