mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
Added a permission node for the debug fish
This commit is contained in:
parent
dcb00dff20
commit
90685edae6
@ -33,6 +33,7 @@
|
|||||||
* Added Bee protection to Hazmat Suit
|
* Added Bee protection to Hazmat Suit
|
||||||
* Added Enchantment Rune
|
* Added Enchantment Rune
|
||||||
* Added Tape Measure
|
* Added Tape Measure
|
||||||
|
* Added a permission node for /sf debug_fish
|
||||||
|
|
||||||
#### Changes
|
#### Changes
|
||||||
* Refactored and reworked the Generator API
|
* Refactored and reworked the Generator API
|
||||||
|
@ -4,6 +4,7 @@ import java.util.Map;
|
|||||||
|
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.defaults.HelpCommand;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
import io.github.thebusybiscuit.slimefun4.core.services.localization.Language;
|
||||||
@ -23,14 +24,35 @@ public abstract class SubCommand {
|
|||||||
protected final SlimefunPlugin plugin;
|
protected final SlimefunPlugin plugin;
|
||||||
protected final SlimefunCommand cmd;
|
protected final SlimefunCommand cmd;
|
||||||
|
|
||||||
protected SubCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
private final String name;
|
||||||
|
private final boolean hidden;
|
||||||
|
|
||||||
|
protected SubCommand(SlimefunPlugin plugin, SlimefunCommand cmd, String name, boolean hidden) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.cmd = cmd;
|
this.cmd = cmd;
|
||||||
|
|
||||||
|
this.name = name;
|
||||||
|
this.hidden = hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract String getName();
|
/**
|
||||||
|
* This returns the name of this {@link SubCommand}, the name is equivalent to the
|
||||||
|
* first argument given to the actual command.
|
||||||
|
*
|
||||||
|
* @return The name of this {@link SubCommand}
|
||||||
|
*/
|
||||||
|
public final String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
public abstract boolean isHidden();
|
/**
|
||||||
|
* This method returns whether this {@link SubCommand} is hidden from the {@link HelpCommand}.
|
||||||
|
*
|
||||||
|
* @return Whether to hide this {@link SubCommand}
|
||||||
|
*/
|
||||||
|
public final boolean isHidden() {
|
||||||
|
return hidden;
|
||||||
|
}
|
||||||
|
|
||||||
protected void recordUsage(Map<SubCommand, Integer> commandUsage) {
|
protected void recordUsage(Map<SubCommand, Integer> commandUsage) {
|
||||||
commandUsage.merge(this, 1, Integer::sum);
|
commandUsage.merge(this, 1, Integer::sum);
|
||||||
|
@ -17,12 +17,7 @@ import me.mrCookieSlime.Slimefun.api.Slimefun;
|
|||||||
class BackpackCommand extends SubCommand {
|
class BackpackCommand extends SubCommand {
|
||||||
|
|
||||||
BackpackCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
BackpackCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "backpack", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "backpack";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -30,11 +25,6 @@ class BackpackCommand extends SubCommand {
|
|||||||
return "commands.backpack.description";
|
return "commands.backpack.description";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(CommandSender sender, String[] args) {
|
public void onExecute(CommandSender sender, String[] args) {
|
||||||
if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) {
|
if (!(sender instanceof Player) || !sender.hasPermission("slimefun.command.backpack")) {
|
||||||
|
@ -11,17 +11,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class CheatCommand extends SubCommand {
|
class CheatCommand extends SubCommand {
|
||||||
|
|
||||||
CheatCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
CheatCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "cheat", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "cheat";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,23 +11,13 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class DebugFishCommand extends SubCommand {
|
class DebugFishCommand extends SubCommand {
|
||||||
|
|
||||||
DebugFishCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
DebugFishCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "debug_fish", true);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "debug_fish";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onExecute(CommandSender sender, String[] args) {
|
public void onExecute(CommandSender sender, String[] args) {
|
||||||
if (sender instanceof Player && sender.isOp()) {
|
if (sender instanceof Player && sender.hasPermission("slimefun.debugging")) {
|
||||||
((Player) sender).getInventory().addItem(SlimefunItems.DEBUG_FISH);
|
((Player) sender).getInventory().addItem(SlimefunItems.DEBUG_FISH.clone());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
SlimefunPlugin.getLocalization().sendMessage(sender, "messages.no-permission", true);
|
||||||
|
@ -22,17 +22,7 @@ class GiveCommand extends SubCommand {
|
|||||||
private static final String PLACEHOLDER_AMOUNT = "%amount%";
|
private static final String PLACEHOLDER_AMOUNT = "%amount%";
|
||||||
|
|
||||||
GiveCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
GiveCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "give", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "give";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,17 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class GuideCommand extends SubCommand {
|
class GuideCommand extends SubCommand {
|
||||||
|
|
||||||
GuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
GuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "guide", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "guide";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -9,17 +9,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class HelpCommand extends SubCommand {
|
class HelpCommand extends SubCommand {
|
||||||
|
|
||||||
HelpCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
HelpCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "help", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "help";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -12,17 +12,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class OpenGuideCommand extends SubCommand {
|
class OpenGuideCommand extends SubCommand {
|
||||||
|
|
||||||
OpenGuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
OpenGuideCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "open_guide", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "open_guide";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -19,17 +19,7 @@ class ResearchCommand extends SubCommand {
|
|||||||
private static final String PLACEHOLDER_RESEARCH = "%research%";
|
private static final String PLACEHOLDER_RESEARCH = "%research%";
|
||||||
|
|
||||||
ResearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
ResearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "research", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "research";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -14,17 +14,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class SearchCommand extends SubCommand {
|
class SearchCommand extends SubCommand {
|
||||||
|
|
||||||
SearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
SearchCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "search", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "search";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -15,17 +15,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class StatsCommand extends SubCommand {
|
class StatsCommand extends SubCommand {
|
||||||
|
|
||||||
StatsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
StatsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "stats", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "stats";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -13,17 +13,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class TeleporterCommand extends SubCommand {
|
class TeleporterCommand extends SubCommand {
|
||||||
|
|
||||||
TeleporterCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
TeleporterCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "teleporter", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "teleporter";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -10,17 +10,7 @@ import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
|||||||
class TimingsCommand extends SubCommand {
|
class TimingsCommand extends SubCommand {
|
||||||
|
|
||||||
TimingsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
TimingsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "timings", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "timings";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,32 +2,23 @@ package io.github.thebusybiscuit.slimefun4.core.commands.subcommands;
|
|||||||
|
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
import io.github.thebusybiscuit.cscorelib2.chat.ChatColors;
|
||||||
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
|
import io.github.thebusybiscuit.cscorelib2.reflection.ReflectionUtils;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
import io.github.thebusybiscuit.slimefun4.core.commands.SlimefunCommand;
|
||||||
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
import io.github.thebusybiscuit.slimefun4.core.commands.SubCommand;
|
||||||
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
import io.github.thebusybiscuit.slimefun4.implementation.SlimefunPlugin;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.ConsoleCommandSender;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
|
|
||||||
class VersionsCommand extends SubCommand {
|
class VersionsCommand extends SubCommand {
|
||||||
|
|
||||||
VersionsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
VersionsCommand(SlimefunPlugin plugin, SlimefunCommand cmd) {
|
||||||
super(plugin, cmd);
|
super(plugin, cmd, "versions", false);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getName() {
|
|
||||||
return "versions";
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean isHidden() {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,8 +28,8 @@ class VersionsCommand extends SubCommand {
|
|||||||
// so we will just fix this inconsistency for them :)
|
// so we will just fix this inconsistency for them :)
|
||||||
String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName();
|
String serverSoftware = PaperLib.isSpigot() && !PaperLib.isPaper() ? "Spigot" : Bukkit.getName();
|
||||||
|
|
||||||
|
sender.sendMessage(ChatColor.GRAY + "This Server uses the following setup of Slimefun:");
|
||||||
sender.sendMessage(ChatColors.color("&a" + serverSoftware + " &2" + ReflectionUtils.getVersion()));
|
sender.sendMessage(ChatColors.color("&a" + serverSoftware + " &2" + ReflectionUtils.getVersion()));
|
||||||
sender.sendMessage("");
|
|
||||||
sender.sendMessage(ChatColors.color("&aCS-CoreLib &2v" + SlimefunPlugin.getCSCoreLibVersion()));
|
sender.sendMessage(ChatColors.color("&aCS-CoreLib &2v" + SlimefunPlugin.getCSCoreLibVersion()));
|
||||||
sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion()));
|
sender.sendMessage(ChatColors.color("&aSlimefun &2v" + SlimefunPlugin.getVersion()));
|
||||||
|
|
||||||
@ -47,20 +38,22 @@ class VersionsCommand extends SubCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) {
|
if (SlimefunPlugin.getRegistry().isBackwardsCompatible()) {
|
||||||
sender.sendMessage(ChatColor.YELLOW + "Backwards compatibility enabled!");
|
sender.sendMessage(ChatColor.RED + "Backwards compatibility enabled!");
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("");
|
sender.sendMessage("");
|
||||||
|
|
||||||
Collection<Plugin> addons = SlimefunPlugin.getInstalledAddons();
|
Collection<Plugin> addons = SlimefunPlugin.getInstalledAddons();
|
||||||
sender.sendMessage(ChatColors.color("&7Installed Addons &8(" + addons.size() + ")"));
|
sender.sendMessage(ChatColors.color("&7Installed Addons: &8(" + addons.size() + ")"));
|
||||||
|
|
||||||
for (Plugin plugin : addons) {
|
for (Plugin plugin : addons) {
|
||||||
|
String version = plugin.getDescription().getVersion();
|
||||||
|
|
||||||
if (Bukkit.getPluginManager().isPluginEnabled(plugin)) {
|
if (Bukkit.getPluginManager().isPluginEnabled(plugin)) {
|
||||||
sender.sendMessage(ChatColors.color(" &a" + plugin.getName() + " &2v" + plugin.getDescription().getVersion()));
|
sender.sendMessage(ChatColor.GREEN + " " + plugin.getName() + ChatColor.DARK_GREEN + " v" + version);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sender.sendMessage(ChatColors.color(" &c" + plugin.getName() + " &4v" + plugin.getDescription().getVersion()));
|
sender.sendMessage(ChatColor.RED + " " + plugin.getName() + ChatColor.DARK_RED + " v" + version);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,3 +58,6 @@ permissions:
|
|||||||
slimefun.inventory.bypass:
|
slimefun.inventory.bypass:
|
||||||
description: Allows you to open all Slimefun Machines
|
description: Allows you to open all Slimefun Machines
|
||||||
default: op
|
default: op
|
||||||
|
slimefun.debugging:
|
||||||
|
description: Allows you to use the debugging tool from Slimefun
|
||||||
|
default: op
|
||||||
|
Loading…
Reference in New Issue
Block a user