Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| cefaa4a712 | |||
| 322bc18e9b | |||
| fffb3115c0 |
@@ -35,7 +35,7 @@ index fcdfd4f6de5e1c2d5e80c7f3d8cb0b33a62d257d..6eaa4e9bd1ecbfa531313ce1f470d55e
|
||||
metrics.addCustomChart(new Metrics.DrilldownPie("java_version", () -> {
|
||||
Map<String, Map<String, Integer>> map = new HashMap<>();
|
||||
diff --git a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
index 45611868dfdfee05380c390a11e8041685a76a19..f6df01c381c7f8bb3c2da6d8833adc9c9f24bd37 100644
|
||||
index 45611868dfdfee05380c390a11e8041685a76a19..434dcd0216a217d6f5a7dc008efd069c125c823f 100644
|
||||
--- a/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
+++ b/src/main/java/com/destroystokyo/paper/PaperVersionFetcher.java
|
||||
@@ -40,8 +40,8 @@ public class PaperVersionFetcher implements VersionFetcher {
|
||||
@@ -44,8 +44,8 @@ index 45611868dfdfee05380c390a11e8041685a76a19..f6df01c381c7f8bb3c2da6d8833adc9c
|
||||
private static final int DISTANCE_UNKNOWN = -2;
|
||||
- private static final String DOWNLOAD_PAGE = "https://github.com/LuminolMC/Luminol"; // Luminol
|
||||
- private static final String REPOSITORY = "LuminolMC/Luminol"; // Luminol
|
||||
+ private static final String DOWNLOAD_PAGE = "https://github.com/LuminolMC/Lophine"; // Luminol // Lophine
|
||||
+ private static final String REPOSITORY = "LuminolMC/Lophine"; // Luminol // Lophine
|
||||
+ private static final String DOWNLOAD_PAGE = "https://github.com/LophineCraft/Lophine"; // Luminol // Lophine
|
||||
+ private static final String REPOSITORY = "LophineCraft/Lophine"; // Luminol // Lophine
|
||||
private static final ServerBuildInfo BUILD_INFO = ServerBuildInfo.buildInfo();
|
||||
private static final String USER_AGENT = BUILD_INFO.brandName() + "/" + BUILD_INFO.asString(VERSION_SIMPLE) + " (https://papermc.io)";
|
||||
private static final Gson GSON = new Gson();
|
||||
|
||||
+1
-1
@@ -70,7 +70,7 @@ public class FakePlayerCompatConfig implements IConfigModule {
|
||||
|
||||
@Override
|
||||
public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) {
|
||||
if (commandPlayer) {
|
||||
if (commandPlayer && command == null) {
|
||||
command = new BotCommand("player");
|
||||
command.register();
|
||||
}
|
||||
|
||||
+1
-1
@@ -95,7 +95,7 @@ public class FakeplayerConfig implements IConfigModule {
|
||||
|
||||
@Override
|
||||
public void onLoaded(CommentedFileConfig configInstance, @Nullable Set<Exception> exs) {
|
||||
if (enable) {
|
||||
if (enable && command == null) {
|
||||
command = new BotCommand("bot");
|
||||
command.register();
|
||||
}
|
||||
|
||||
@@ -27,10 +27,11 @@ import org.leavesmc.leaves.command.bot.subcommands.*;
|
||||
import static org.leavesmc.leaves.command.CommandUtils.registerPermissions;
|
||||
|
||||
public class BotCommand extends RootNode {
|
||||
private static final String PERM_BASE = "bukkit.command.bot";
|
||||
private static final String PERM_BASE_BOT = "bukkit.command.bot";
|
||||
private static final String PERM_BASE_PLAYER = "bukkit.command.player";
|
||||
|
||||
public BotCommand(String key) {
|
||||
super(key, PERM_BASE);
|
||||
super(key, getPermBase(key));
|
||||
this.children(
|
||||
ListCommand::new,
|
||||
ConfigCommand::new,
|
||||
@@ -44,15 +45,26 @@ public class BotCommand extends RootNode {
|
||||
|
||||
@Override
|
||||
protected ArgumentBuilder<CommandSourceStack, ?> compile() {
|
||||
registerPermissions(PERM_BASE, this.children);
|
||||
registerPermissions(getPermBase(this.getName()), this.children);
|
||||
return super.compile();
|
||||
}
|
||||
|
||||
public static boolean hasPermission(@NotNull CommandSender sender) {
|
||||
return sender.hasPermission(PERM_BASE);
|
||||
return sender.hasPermission(PERM_BASE_BOT) || sender.hasPermission(PERM_BASE_PLAYER);
|
||||
}
|
||||
|
||||
public static boolean hasPermission(@NotNull CommandSender sender, String subcommand) {
|
||||
return sender.hasPermission(PERM_BASE) || sender.hasPermission(PERM_BASE + "." + subcommand);
|
||||
return sender.hasPermission(PERM_BASE_BOT) || sender.hasPermission(PERM_BASE_BOT + "." + subcommand)
|
||||
|| sender.hasPermission(PERM_BASE_PLAYER) || sender.hasPermission(PERM_BASE_PLAYER + "." + subcommand);
|
||||
}
|
||||
|
||||
public static String getPermBase(String key) {
|
||||
if (key.equals("bot")) {
|
||||
return PERM_BASE_BOT;
|
||||
}
|
||||
if (key.equals("player")) {
|
||||
return PERM_BASE_PLAYER;
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid key: " + key);
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -56,11 +56,13 @@ public class StartCommand extends LiteralNode {
|
||||
ServerBot bot = getBot(context);
|
||||
CommandSender sender = context.getSender();
|
||||
|
||||
action.loadCommand(context);
|
||||
if (bot.addBotAction(action, sender)) {
|
||||
// Create a new instance of the action to avoid sharing state between multiple actions
|
||||
AbstractBotAction<?> newAction = action.create();
|
||||
newAction.loadCommand(context);
|
||||
if (bot.addBotAction(newAction, sender)) {
|
||||
sender.sendMessage(join(spaces(),
|
||||
text("Action", GRAY),
|
||||
text(action.getName(), AQUA).hoverEvent(showText(text(action.getActionDataString()))),
|
||||
text(newAction.getName(), AQUA).hoverEvent(showText(text(newAction.getActionDataString()))),
|
||||
text("has been issued to", GRAY),
|
||||
asAdventure(bot.getDisplayName())
|
||||
));
|
||||
|
||||
+2
-2
@@ -141,13 +141,13 @@ public class StopCommand extends LiteralNode {
|
||||
if (canceled.isEmpty()) {
|
||||
sender.sendMessage(join(spaces(),
|
||||
asAdventure(bot.getDisplayName()).append(text("'s", GRAY)),
|
||||
text("'s action list cleared", GRAY)
|
||||
text("action list cleared", GRAY)
|
||||
));
|
||||
} else {
|
||||
sender.sendMessage(join(spaces(),
|
||||
text("Tried to clear", GRAY),
|
||||
asAdventure(bot.getDisplayName()).append(text("'s", GRAY)),
|
||||
text("'s action list, but following actions' stop was canceled by plugin:", GRAY)
|
||||
text("action list, but following actions' stop was canceled by plugin:", GRAY)
|
||||
));
|
||||
for (AbstractBotAction<?> action : canceled) {
|
||||
context.getSender().sendMessage(
|
||||
|
||||
Reference in New Issue
Block a user