mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 06:36:45 +01:00
More work on ACF integration
This commit is contained in:
parent
2d342f8a3d
commit
f45c70b694
@ -63,7 +63,7 @@ dependencies {
|
|||||||
api("org.spongepowered:configurate-yaml:3.7-SNAPSHOT")
|
api("org.spongepowered:configurate-yaml:3.7-SNAPSHOT")
|
||||||
api("org.spongepowered:configurate-hocon:3.7-SNAPSHOT")
|
api("org.spongepowered:configurate-hocon:3.7-SNAPSHOT")
|
||||||
api("co.aikar:acf-core:0.5.0-SNAPSHOT") //Don't change without updating the artifacts for its dependencies (see the other comments)
|
api("co.aikar:acf-core:0.5.0-SNAPSHOT") //Don't change without updating the artifacts for its dependencies (see the other comments)
|
||||||
api("co.aikar:acf-bukkit:0.5.0-SNAPSHOT") //Don't change without updating the artifacts for its dependencies (see the other comments)
|
api("co.aikar:acf-paper:0.5.0-SNAPSHOT") //Don't change without updating the artifacts for its dependencies (see the other comments)
|
||||||
// api("co.aikar:locales:1.0-SNAPSHOT") //ACF 0.5.0-SNAPSHOT is dependent on this version of locales
|
// api("co.aikar:locales:1.0-SNAPSHOT") //ACF 0.5.0-SNAPSHOT is dependent on this version of locales
|
||||||
// api("co.aikar:table:1.0.0-SNAPSHOT") //ACF 0.5.0-SNAPSHOT is dependent on this version of table
|
// api("co.aikar:table:1.0.0-SNAPSHOT") //ACF 0.5.0-SNAPSHOT is dependent on this version of table
|
||||||
// api("net.jodah:expiring-map:0.5.8") //ACF 0.5.0-SNAPSHOT is dependent on this version of expiring map
|
// api("net.jodah:expiring-map:0.5.8") //ACF 0.5.0-SNAPSHOT is dependent on this version of expiring map
|
||||||
|
@ -1,15 +1,22 @@
|
|||||||
package com.gmail.nossr50.commands.admin;
|
package com.gmail.nossr50.commands.admin;
|
||||||
|
|
||||||
import co.aikar.commands.BaseCommand;
|
import co.aikar.commands.BaseCommand;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
|
import co.aikar.commands.annotation.Default;
|
||||||
import co.aikar.commands.annotation.Dependency;
|
import co.aikar.commands.annotation.Dependency;
|
||||||
import co.aikar.commands.annotation.Description;
|
import co.aikar.commands.annotation.Description;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
@CommandAlias("nbttools")
|
||||||
@Description("Read or Modify values of NBT on an item in-hand")
|
@Description("Read or Modify values of NBT on an item in-hand")
|
||||||
public class NBTToolsCommand extends BaseCommand {
|
public class NBTToolsCommand extends BaseCommand {
|
||||||
|
|
||||||
@Dependency
|
@Dependency
|
||||||
private mcMMO pluginRef;
|
private mcMMO pluginRef;
|
||||||
|
|
||||||
|
@Default
|
||||||
|
public void onCommand(Player player) {
|
||||||
|
player.sendMessage("hi");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.commands.admin;
|
package com.gmail.nossr50.commands.admin;
|
||||||
|
|
||||||
import co.aikar.commands.BaseCommand;
|
import co.aikar.commands.BaseCommand;
|
||||||
|
import co.aikar.commands.annotation.CommandAlias;
|
||||||
import co.aikar.commands.annotation.Default;
|
import co.aikar.commands.annotation.Default;
|
||||||
import co.aikar.commands.annotation.Dependency;
|
import co.aikar.commands.annotation.Dependency;
|
||||||
import co.aikar.commands.annotation.Description;
|
import co.aikar.commands.annotation.Description;
|
||||||
@ -10,18 +11,19 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
||||||
|
@CommandAlias("mmodebug")
|
||||||
@Description("Puts the player into debug mode, which helps problem solve bugs in mcMMO.")
|
@Description("Puts the player into debug mode, which helps problem solve bugs in mcMMO.")
|
||||||
public class PlayerDebugCommand extends BaseCommand {
|
public class PlayerDebugCommand extends BaseCommand {
|
||||||
|
|
||||||
@Dependency
|
@Dependency
|
||||||
private mcMMO pluginRef;
|
private mcMMO plugin;
|
||||||
|
|
||||||
@Default
|
@Default
|
||||||
public void onCommand(CommandSender sender) {
|
public void onCommand(CommandSender sender) {
|
||||||
if(sender instanceof Player) {
|
if(sender instanceof Player) {
|
||||||
McMMOPlayer mcMMOPlayer = pluginRef.getUserManager().getPlayer((Player) sender);
|
McMMOPlayer mcMMOPlayer = plugin.getUserManager().getPlayer((Player) sender);
|
||||||
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
mcMMOPlayer.toggleDebugMode(); //Toggle debug mode
|
||||||
pluginRef.getNotificationManager().sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
plugin.getNotificationManager().sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode()));
|
||||||
} else {
|
} else {
|
||||||
//TODO: Localize
|
//TODO: Localize
|
||||||
sender.sendMessage("Players only");
|
sender.sendMessage("Players only");
|
||||||
|
@ -218,6 +218,7 @@ public class mcMMO extends JavaPlugin {
|
|||||||
|
|
||||||
scheduleTasks();
|
scheduleTasks();
|
||||||
commandRegistrationManager = new CommandRegistrationManager(this);
|
commandRegistrationManager = new CommandRegistrationManager(this);
|
||||||
|
commandRegistrationManager.registerACFCommands();
|
||||||
commandRegistrationManager.registerCommands();
|
commandRegistrationManager.registerCommands();
|
||||||
|
|
||||||
nbtManager = new NBTManager();
|
nbtManager = new NBTManager();
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package com.gmail.nossr50.util.commands;
|
package com.gmail.nossr50.util.commands;
|
||||||
|
|
||||||
import co.aikar.commands.BukkitCommandManager;
|
import co.aikar.commands.PaperCommandManager;
|
||||||
import com.gmail.nossr50.commands.*;
|
import com.gmail.nossr50.commands.*;
|
||||||
import com.gmail.nossr50.commands.admin.NBTToolsCommand;
|
import com.gmail.nossr50.commands.admin.NBTToolsCommand;
|
||||||
import com.gmail.nossr50.commands.admin.PlayerDebugCommand;
|
import com.gmail.nossr50.commands.admin.PlayerDebugCommand;
|
||||||
@ -29,15 +29,70 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
public final class CommandRegistrationManager {
|
public final class CommandRegistrationManager {
|
||||||
private final mcMMO pluginRef;
|
private final mcMMO pluginRef;
|
||||||
private String permissionsMessage;
|
private String permissionsMessage;
|
||||||
private BukkitCommandManager bukkitCommandManager;
|
//NOTE: Does not actually require paper, will work for bukkit
|
||||||
|
private PaperCommandManager commandManager;
|
||||||
|
|
||||||
public CommandRegistrationManager(mcMMO pluginRef) {
|
public CommandRegistrationManager(mcMMO pluginRef) {
|
||||||
this.pluginRef = pluginRef;
|
this.pluginRef = pluginRef;
|
||||||
permissionsMessage = pluginRef.getLocaleManager().getString("mcMMO.NoPermission");
|
permissionsMessage = pluginRef.getLocaleManager().getString("mcMMO.NoPermission");
|
||||||
bukkitCommandManager = new BukkitCommandManager(pluginRef);
|
commandManager = new PaperCommandManager(pluginRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register ACF Commands
|
||||||
|
*/
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
|
public void registerACFCommands() {
|
||||||
|
//Register ACF Commands
|
||||||
|
registerNBTToolsCommand();
|
||||||
|
registerMmoDebugCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register exception handlers for the ACF commands
|
||||||
|
*/
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
|
private void registerExceptionHandlers() {
|
||||||
|
registerDefaultExceptionHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register default exception handler
|
||||||
|
*/
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
|
private void registerDefaultExceptionHandler() {
|
||||||
|
commandManager.setDefaultExceptionHandler((command, registeredCommand, sender, args, t) -> {
|
||||||
|
pluginRef.getLogger().warning("Error occurred while executing command " + command.getName());
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register contexts for ACF
|
||||||
|
*/
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
|
private void registerContexts() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the NBT Tools command
|
||||||
|
*/
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
|
private void registerNBTToolsCommand() {
|
||||||
|
commandManager.registerCommand(new NBTToolsCommand());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the MMO Debug command
|
||||||
|
*/
|
||||||
|
//TODO: Properly rewrite ACF integration later
|
||||||
|
private void registerMmoDebugCommand() {
|
||||||
|
commandManager.registerCommand(new PlayerDebugCommand());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerSkillCommands() {
|
private void registerSkillCommands() {
|
||||||
@ -121,40 +176,6 @@ public final class CommandRegistrationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialize ACF commands
|
|
||||||
*/
|
|
||||||
private void initACF() {
|
|
||||||
//TODO: See if needed
|
|
||||||
bukkitCommandManager.enableUnstableAPI("help");
|
|
||||||
|
|
||||||
|
|
||||||
registerACFCommands();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register ACF Commands
|
|
||||||
*/
|
|
||||||
private void registerACFCommands() {
|
|
||||||
//Register ACF Commands
|
|
||||||
registerNBTToolsCommand();
|
|
||||||
registerMmoDebugCommand();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the NBT Tools command
|
|
||||||
*/
|
|
||||||
private void registerNBTToolsCommand() {
|
|
||||||
bukkitCommandManager.registerCommand(new NBTToolsCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Register the MMO Debug command
|
|
||||||
*/
|
|
||||||
private void registerMmoDebugCommand() {
|
|
||||||
bukkitCommandManager.registerCommand(new PlayerDebugCommand());
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerAddlevelsCommand() {
|
private void registerAddlevelsCommand() {
|
||||||
PluginCommand command = pluginRef.getCommand("addlevels");
|
PluginCommand command = pluginRef.getCommand("addlevels");
|
||||||
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.addlevels"));
|
command.setDescription(pluginRef.getLocaleManager().getString("Commands.Description.addlevels"));
|
||||||
@ -455,7 +476,6 @@ public final class CommandRegistrationManager {
|
|||||||
public void registerCommands() {
|
public void registerCommands() {
|
||||||
// Generic Commands
|
// Generic Commands
|
||||||
registerMmoInfoCommand();
|
registerMmoInfoCommand();
|
||||||
registerMmoDebugCommand();
|
|
||||||
registerMcabilityCommand();
|
registerMcabilityCommand();
|
||||||
registerMcgodCommand();
|
registerMcgodCommand();
|
||||||
registerMcChatSpyCommand();
|
registerMcChatSpyCommand();
|
||||||
@ -504,8 +524,5 @@ public final class CommandRegistrationManager {
|
|||||||
registerMcmmoReloadCommand();
|
registerMcmmoReloadCommand();
|
||||||
// Admin commands
|
// Admin commands
|
||||||
registerReloadLocaleCommand();
|
registerReloadLocaleCommand();
|
||||||
|
|
||||||
//ACF Commands
|
|
||||||
initACF();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,12 +19,6 @@ load: POSTWORLD
|
|||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
nbttools:
|
|
||||||
description: Modify or Read NBT from an item in hand
|
|
||||||
permission: mcmmo.commands.nbttools
|
|
||||||
mmodebug:
|
|
||||||
aliases: [mcmmodebugmode]
|
|
||||||
description: Toggles a debug mode which will print useful information to chat
|
|
||||||
mmoinfo:
|
mmoinfo:
|
||||||
aliases: [mcinfo]
|
aliases: [mcinfo]
|
||||||
description: Info pages for mcMMO
|
description: Info pages for mcMMO
|
||||||
|
Loading…
Reference in New Issue
Block a user