mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Got rid of charge command from this branch
This commit is contained in:
parent
90309dabe1
commit
cf1c58dd8b
@ -1,54 +0,0 @@
|
||||
package io.github.thebusybiscuit.slimefun4.core.commands.subcommands;
|
||||
|
||||
import io.github.thebusybiscuit.slimefun4.core.attributes.Rechargeable;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
/**
|
||||
* {@link ChargeCommand} adds an in game command which charges any {@link Rechargeable}
|
||||
* item to max.
|
||||
*
|
||||
* @author FluffyBear
|
||||
*
|
||||
*/
|
||||
class ChargeCommand extends SubCommand {
|
||||
|
||||
ChargeCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||
super(plugin, cmd, "charge", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getDescription() {
|
||||
return "commands.charge.description";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onExecute(CommandSender sender, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
if (sender.hasPermission("slimefun.charge.command")) {
|
||||
Player p = (Player) sender;
|
||||
ItemStack item = p.getInventory().getItemInMainHand();
|
||||
SlimefunItem slimefunItem = SlimefunItem.getByItem(item);
|
||||
if (slimefunItem instanceof Rechargeable) {
|
||||
Rechargeable rechargeableItem = (Rechargeable) slimefunItem;
|
||||
rechargeableItem.setItemCharge(item, rechargeableItem.getMaxItemCharge(item));
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "commands.charge.charge-success", true);
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "commands.charge.not-rechargeable", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.only-players", true);
|
||||
}
|
||||
}
|
||||
}
|
@ -37,7 +37,6 @@ public final class SlimefunSubCommands {
|
||||
commands.add(new SearchCommand(plugin, cmd));
|
||||
commands.add(new DebugFishCommand(plugin, cmd));
|
||||
commands.add(new BackpackCommand(plugin, cmd));
|
||||
commands.add(new ChargeCommand(plugin, cmd));
|
||||
|
||||
return commands;
|
||||
}
|
||||
|
@ -22,10 +22,6 @@ commands:
|
||||
backpack-does-not-exist: '&4The specified backpack does not exist!'
|
||||
restored-backpack-given: '&aYour backpack has been restored and was added to your inventory!'
|
||||
|
||||
charge:
|
||||
description: Charges the item you are holding
|
||||
charge-success: Item has been charged!
|
||||
not-rechargeable: This item can not be charged!
|
||||
|
||||
guide:
|
||||
locked: 'LOCKED'
|
||||
|
@ -49,9 +49,6 @@ permissions:
|
||||
slimefun.command.backpack:
|
||||
description: Allows you to do /sf backpack
|
||||
default: op
|
||||
slimefun.command.charge:
|
||||
description: Allows you to do /sf charge
|
||||
default: op
|
||||
slimefun.android.bypass:
|
||||
description: Allows you to edit other Players Androids
|
||||
default: op
|
||||
|
Loading…
Reference in New Issue
Block a user