mirror of
https://gitlab.com/phoenix-dvpmt/mmocore.git
synced 2024-11-27 00:45:40 +01:00
Cleaned up command api
This commit is contained in:
parent
ab85dd688b
commit
35d90ae55b
@ -4,6 +4,7 @@ import io.lumine.mythic.lib.MythicLib;
|
|||||||
import io.lumine.mythic.lib.UtilityMethods;
|
import io.lumine.mythic.lib.UtilityMethods;
|
||||||
import io.lumine.mythic.lib.version.SpigotPlugin;
|
import io.lumine.mythic.lib.version.SpigotPlugin;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.social.PartyManager;
|
import net.Indyuce.mmocore.manager.social.PartyManager;
|
||||||
import net.Indyuce.mmocore.api.ConfigFile;
|
import net.Indyuce.mmocore.api.ConfigFile;
|
||||||
import net.Indyuce.mmocore.manager.ActionBarManager;
|
import net.Indyuce.mmocore.manager.ActionBarManager;
|
||||||
@ -250,45 +251,10 @@ public class MMOCore extends JavaPlugin {
|
|||||||
// load guild data after loading player data
|
// load guild data after loading player data
|
||||||
dataProvider.getGuildManager().load();
|
dataProvider.getGuildManager().load();
|
||||||
|
|
||||||
// Command
|
// Toggleable Commands
|
||||||
try {
|
ToggleableCommand.register();
|
||||||
final Field bukkitCommandMap = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
|
||||||
|
|
||||||
bukkitCommandMap.setAccessible(true);
|
|
||||||
CommandMap commandMap = (CommandMap) bukkitCommandMap.get(Bukkit.getServer());
|
|
||||||
|
|
||||||
FileConfiguration config = new ConfigFile("commands").getConfig();
|
|
||||||
|
|
||||||
if (config.contains("player"))
|
|
||||||
commandMap.register("mmocore", new PlayerStatsCommand(config.getConfigurationSection("player")));
|
|
||||||
if (config.contains("attributes"))
|
|
||||||
commandMap.register("mmocore", new AttributesCommand(config.getConfigurationSection("attributes")));
|
|
||||||
if (config.contains("class"))
|
|
||||||
commandMap.register("mmocore", new ClassCommand(config.getConfigurationSection("class")));
|
|
||||||
if (config.contains("waypoints"))
|
|
||||||
commandMap.register("mmocore", new WaypointsCommand(config.getConfigurationSection("waypoints")));
|
|
||||||
if (config.contains("quests"))
|
|
||||||
commandMap.register("mmocore", new QuestsCommand(config.getConfigurationSection("quests")));
|
|
||||||
if (config.contains("skills"))
|
|
||||||
commandMap.register("mmocore", new SkillsCommand(config.getConfigurationSection("skills")));
|
|
||||||
if (config.contains("friends"))
|
|
||||||
commandMap.register("mmocore", new FriendsCommand(config.getConfigurationSection("friends")));
|
|
||||||
if (config.contains("party"))
|
|
||||||
commandMap.register("mmocore", new PartyCommand(config.getConfigurationSection("party")));
|
|
||||||
if (config.contains("guild"))
|
|
||||||
commandMap.register("mmocore", new GuildCommand(config.getConfigurationSection("guild")));
|
|
||||||
if (config.contains("skill-trees"))
|
|
||||||
commandMap.register("mmocore", new SkillTreeCommand(config.getConfigurationSection("skill-trees")));
|
|
||||||
if (hasEconomy() && economy.isValid()) {
|
|
||||||
if (config.contains("withdraw"))
|
|
||||||
commandMap.register("mmocore", new WithdrawCommand(config.getConfigurationSection("withdraw")));
|
|
||||||
if (config.contains("deposit"))
|
|
||||||
commandMap.register("mmocore", new DepositCommand(config.getConfigurationSection("deposit")));
|
|
||||||
}
|
|
||||||
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// Register MMOCore command what soever
|
||||||
MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot();
|
MMOCoreCommandTreeRoot mmoCoreCommand = new MMOCoreCommandTreeRoot();
|
||||||
getCommand("mmocore").setExecutor(mmoCoreCommand);
|
getCommand("mmocore").setExecutor(mmoCoreCommand);
|
||||||
getCommand("mmocore").setTabCompleter(mmoCoreCommand);
|
getCommand("mmocore").setTabCompleter(mmoCoreCommand);
|
||||||
|
@ -125,7 +125,7 @@ public class PlayerData extends OfflinePlayerData implements Closable, Experienc
|
|||||||
private final Map<String, Integer> tableItemClaims = new HashMap<>();
|
private final Map<String, Integer> tableItemClaims = new HashMap<>();
|
||||||
|
|
||||||
// NON-FINAL player data stuff made public to facilitate field change
|
// NON-FINAL player data stuff made public to facilitate field change
|
||||||
public boolean noCooldown, statsLoaded;
|
public boolean noCooldown, statsLoaded, pvpMode;
|
||||||
public CombatRunnable combat;
|
public CombatRunnable combat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class AttributesCommand extends BukkitCommand {
|
public class AttributesCommand extends RegisteredCommand {
|
||||||
public AttributesCommand(ConfigurationSection config) {
|
public AttributesCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.ATTRIBUTES);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the attribute menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,21 +1,19 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ClassCommand extends BukkitCommand {
|
public class ClassCommand extends RegisteredCommand {
|
||||||
public ClassCommand(ConfigurationSection config) {
|
public ClassCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.CLASS);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Select a new class.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,19 +1,17 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.gui.eco.DepositMenu;
|
import net.Indyuce.mmocore.gui.eco.DepositMenu;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class DepositCommand extends BukkitCommand {
|
public class DepositCommand extends RegisteredCommand {
|
||||||
public DepositCommand(ConfigurationSection config) {
|
public DepositCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.DEPOSIT);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the currency deposit menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -3,6 +3,8 @@ package net.Indyuce.mmocore.command;
|
|||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.social.FriendRequest;
|
import net.Indyuce.mmocore.api.player.social.FriendRequest;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import net.Indyuce.mmocore.api.player.social.Request;
|
import net.Indyuce.mmocore.api.player.social.Request;
|
||||||
@ -10,19 +12,15 @@ import org.apache.commons.lang.Validate;
|
|||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class FriendsCommand extends BukkitCommand {
|
public class FriendsCommand extends RegisteredCommand {
|
||||||
public FriendsCommand(ConfigurationSection config) {
|
public FriendsCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.FRIENDS);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the friends menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,6 +2,8 @@ package net.Indyuce.mmocore.command;
|
|||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import net.Indyuce.mmocore.api.player.social.Request;
|
import net.Indyuce.mmocore.api.player.social.Request;
|
||||||
@ -11,20 +13,15 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class GuildCommand extends BukkitCommand {
|
public class GuildCommand extends RegisteredCommand {
|
||||||
|
|
||||||
public GuildCommand(ConfigurationSection config) {
|
public GuildCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.GUILD);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the guilds menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -2,6 +2,8 @@ package net.Indyuce.mmocore.command;
|
|||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import net.Indyuce.mmocore.api.player.social.Request;
|
import net.Indyuce.mmocore.api.player.social.Request;
|
||||||
@ -12,20 +14,15 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public class PartyCommand extends BukkitCommand {
|
public class PartyCommand extends RegisteredCommand {
|
||||||
|
|
||||||
public PartyCommand(ConfigurationSection config) {
|
public PartyCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.PARTY);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the party menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,34 +1,32 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class PlayerStatsCommand extends BukkitCommand {
|
public class PlayerStatsCommand extends RegisteredCommand {
|
||||||
public PlayerStatsCommand(ConfigurationSection config) {
|
public PlayerStatsCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.PLAYER);
|
||||||
|
}
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Show player stats.");
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(CommandSender sender, String label, String[] args) {
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PlayerData data = PlayerData.get((Player) sender);
|
PlayerData data = PlayerData.get((Player) sender);
|
||||||
MMOCommandEvent event = new MMOCommandEvent(data, "profile");
|
MMOCommandEvent event = new MMOCommandEvent(data, "profile");
|
||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
if(!event.isCancelled()) InventoryManager.PLAYER_STATS.newInventory(data).open();
|
if (!event.isCancelled()) InventoryManager.PLAYER_STATS.newInventory(data).open();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,76 @@
|
|||||||
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.api.player.social.Request;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
|
import net.Indyuce.mmocore.guild.provided.GuildInvite;
|
||||||
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.OfflinePlayer;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class PvpModeCommand extends RegisteredCommand {
|
||||||
|
public PvpModeCommand(ConfigurationSection config) {
|
||||||
|
super(config, ToggleableCommand.PVP_MODE);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(CommandSender sender, String label, String[] args) {
|
||||||
|
if (!(sender instanceof Player)) {
|
||||||
|
sender.sendMessage(ChatColor.RED + "This command is for players only.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerData data = PlayerData.get((OfflinePlayer) sender);
|
||||||
|
MMOCommandEvent event = new MMOCommandEvent(data, "guild");
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
|
if (event.isCancelled()) return true;
|
||||||
|
|
||||||
|
if (args.length > 1) {
|
||||||
|
|
||||||
|
final @Nullable GuildInvite invite;
|
||||||
|
if (args.length > 1)
|
||||||
|
|
||||||
|
// Search by request ID
|
||||||
|
try {
|
||||||
|
final UUID uuid = UUID.fromString(args[1]);
|
||||||
|
final Request req = MMOCore.plugin.requestManager.getRequest(uuid);
|
||||||
|
Validate.isTrue(!req.isTimedOut() && req instanceof GuildInvite);
|
||||||
|
invite = (GuildInvite) req;
|
||||||
|
Validate.isTrue(MMOCore.plugin.dataProvider.getGuildManager().isRegistered(invite.getGuild()));
|
||||||
|
} catch (Exception exception) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Search by target player
|
||||||
|
else
|
||||||
|
invite = MMOCore.plugin.requestManager.findRequest(data, GuildInvite.class);
|
||||||
|
|
||||||
|
// No invite found with given identifier/target player
|
||||||
|
if (invite == null)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (args[0].equalsIgnoreCase("accept"))
|
||||||
|
invite.accept();
|
||||||
|
if (args[0].equalsIgnoreCase("deny"))
|
||||||
|
invite.deny();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.inGuild())
|
||||||
|
InventoryManager.GUILD_VIEW.newInventory(data).open();
|
||||||
|
else
|
||||||
|
InventoryManager.GUILD_CREATION.newInventory(data).open();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -1,20 +1,18 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class QuestsCommand extends BukkitCommand {
|
public class QuestsCommand extends RegisteredCommand {
|
||||||
public QuestsCommand(ConfigurationSection config) {
|
public QuestsCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.QUESTS);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the quests menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,23 +1,20 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.ConfigMessage;
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
public class SkillTreeCommand extends BukkitCommand {
|
public class SkillTreesCommand extends RegisteredCommand {
|
||||||
public SkillTreeCommand(ConfigurationSection config) {
|
public SkillTreesCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.SKILL_TREES);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the skills menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -37,8 +34,5 @@ public class SkillTreeCommand extends BukkitCommand {
|
|||||||
MMOCore.plugin.configManager.getSimpleMessage("no-skill-tree").send(player);
|
MMOCore.plugin.configManager.getSimpleMessage("no-skill-tree").send(player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
@ -2,20 +2,18 @@ package net.Indyuce.mmocore.command;
|
|||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class SkillsCommand extends BukkitCommand {
|
public class SkillsCommand extends RegisteredCommand {
|
||||||
public SkillsCommand(ConfigurationSection config) {
|
public SkillsCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.SKILLS);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Opens the skills menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,20 +1,18 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import net.Indyuce.mmocore.manager.InventoryManager;
|
import net.Indyuce.mmocore.manager.InventoryManager;
|
||||||
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
import net.Indyuce.mmocore.api.event.MMOCommandEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class WaypointsCommand extends BukkitCommand {
|
public class WaypointsCommand extends RegisteredCommand {
|
||||||
public WaypointsCommand(ConfigurationSection config) {
|
public WaypointsCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.WAYPOINTS);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Open the waypoints menu.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
|
import net.Indyuce.mmocore.command.api.RegisteredCommand;
|
||||||
|
import net.Indyuce.mmocore.command.api.ToggleableCommand;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.command.defaults.BukkitCommand;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.eco.Withdraw;
|
import net.Indyuce.mmocore.api.eco.Withdraw;
|
||||||
|
|
||||||
public class WithdrawCommand extends BukkitCommand {
|
public class WithdrawCommand extends RegisteredCommand {
|
||||||
public WithdrawCommand(ConfigurationSection config) {
|
public WithdrawCommand(ConfigurationSection config) {
|
||||||
super(config.getString("main"));
|
super(config, ToggleableCommand.WITHDRAW);
|
||||||
|
|
||||||
setAliases(config.getStringList("aliases"));
|
|
||||||
setDescription("Creates a withdraw request.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package net.Indyuce.mmocore.command;
|
package net.Indyuce.mmocore.command.api;
|
||||||
|
|
||||||
import io.lumine.mythic.lib.UtilityMethods;
|
import io.lumine.mythic.lib.UtilityMethods;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
@ -0,0 +1,14 @@
|
|||||||
|
package net.Indyuce.mmocore.command.api;
|
||||||
|
|
||||||
|
import org.bukkit.command.defaults.BukkitCommand;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public abstract class RegisteredCommand extends BukkitCommand {
|
||||||
|
public RegisteredCommand(@NotNull ConfigurationSection config, ToggleableCommand command) {
|
||||||
|
super(config.getString("main"));
|
||||||
|
|
||||||
|
setAliases(config.getStringList("aliases"));
|
||||||
|
setDescription(config.getString("description", command.getDescription()));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,112 @@
|
|||||||
|
package net.Indyuce.mmocore.command.api;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
|
import net.Indyuce.mmocore.api.ConfigFile;
|
||||||
|
import net.Indyuce.mmocore.command.*;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.CommandMap;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Commands which can be disabled using commands.yml
|
||||||
|
*/
|
||||||
|
public enum ToggleableCommand {
|
||||||
|
PLAYER("player", "Displays player stats", config -> new PlayerStatsCommand(config), "p", "profile"),
|
||||||
|
ATTRIBUTES("attributes", "Display and manage attributes", config -> new AttributesCommand(config), "att", "stats"),
|
||||||
|
CLASS("class", "Select a new class", config -> new ClassCommand(config), "c"),
|
||||||
|
WAYPOINTS("waypoints", "Display discovered waypoints", config -> new WaypointsCommand(config), "wp"),
|
||||||
|
QUESTS("quests", "Display available quests", config -> new QuestsCommand(config), "q", "journal"),
|
||||||
|
SKILLS("skills", "Spend skill points to unlock new skills", config -> new SkillsCommand(config), "s"),
|
||||||
|
FRIENDS("friends", "Show online/offline friends", config -> new FriendsCommand(config), "f"),
|
||||||
|
PARTY("party", "Invite players in a party to split exp", config -> new PartyCommand(config)),
|
||||||
|
GUILD("guild", "Show players in current guild", config -> new GuildCommand(config)),
|
||||||
|
WITHDRAW("withdraw", "Withdraw money into coins and notes", config -> new WithdrawCommand(config), v -> MMOCore.plugin.hasEconomy() && MMOCore.plugin.economy.isValid(), "w"),
|
||||||
|
SKILL_TREES("skiltrees", "Open up the skill tree menu", config -> new SkillTreesCommand(config), "st", "trees", "tree"),
|
||||||
|
DEPOSIT("deposit", "Open the currency deposit menu", config -> new DepositCommand(config), "d"),
|
||||||
|
PVP_MODE("pvpmode", "Toggle on/off PVP mode.", config -> new PvpModeCommand(config), "pvp");
|
||||||
|
|
||||||
|
private final String mainLabel;
|
||||||
|
private final String description;
|
||||||
|
private final Function<ConfigurationSection, RegisteredCommand> generator;
|
||||||
|
private final List<String> aliases;
|
||||||
|
private final Predicate<Void> enabled;
|
||||||
|
|
||||||
|
ToggleableCommand(@NotNull String mainLabel, @NotNull String description, @NotNull Function<ConfigurationSection, RegisteredCommand> generator, @NotNull String... aliases) {
|
||||||
|
this(mainLabel, description, generator, null, aliases);
|
||||||
|
}
|
||||||
|
|
||||||
|
ToggleableCommand(@NotNull String mainLabel, @NotNull String description, @NotNull Function<ConfigurationSection, RegisteredCommand> generator, @Nullable Predicate<Void> enabled, @NotNull String... aliases) {
|
||||||
|
this.mainLabel = mainLabel;
|
||||||
|
this.description = description;
|
||||||
|
this.generator = generator;
|
||||||
|
this.aliases = Arrays.asList(aliases);
|
||||||
|
this.enabled = enabled == null ? v -> true : enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainLabel() {
|
||||||
|
return mainLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> getAliases() {
|
||||||
|
return aliases;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getConfigPath() {
|
||||||
|
return name().toLowerCase().replace("_", "-");
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return enabled.test(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void register() {
|
||||||
|
|
||||||
|
// Load default config file
|
||||||
|
if (!new File(MMOCore.plugin.getDataFolder(), "commands.yml").exists()) {
|
||||||
|
final ConfigFile config = new ConfigFile("commands");
|
||||||
|
|
||||||
|
for (ToggleableCommand cmd : values()) {
|
||||||
|
final String path = cmd.getConfigPath();
|
||||||
|
config.getConfig().set(path + ".main", cmd.mainLabel);
|
||||||
|
config.getConfig().set(path + ".aliases", cmd.aliases);
|
||||||
|
config.getConfig().set(path + ".description", cmd.description);
|
||||||
|
}
|
||||||
|
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
|
||||||
|
// Find command map
|
||||||
|
final Field commandMapField = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||||
|
commandMapField.setAccessible(true);
|
||||||
|
final CommandMap commandMap = (CommandMap) commandMapField.get(Bukkit.getServer());
|
||||||
|
|
||||||
|
// Enable commands individually
|
||||||
|
final FileConfiguration config = new ConfigFile("commands").getConfig();
|
||||||
|
for (ToggleableCommand cmd : values())
|
||||||
|
if (cmd.isEnabled() && config.contains(cmd.getConfigPath()))
|
||||||
|
commandMap.register("mmocore", cmd.generator.apply(config.getConfigurationSection(cmd.getConfigPath())));
|
||||||
|
|
||||||
|
} catch (NoSuchFieldException | IllegalArgumentException | IllegalAccessException exception) {
|
||||||
|
MMOCore.plugin.getLogger().log(Level.WARNING, "Unable to register custom commands:");
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -4,7 +4,7 @@ import net.Indyuce.mmocore.MMOCore;
|
|||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
import net.Indyuce.mmocore.api.player.attribute.PlayerAttribute;
|
||||||
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
import net.Indyuce.mmocore.api.player.attribute.PlayerAttributes;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
import net.Indyuce.mmocore.api.player.profess.SavedClassInformation;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||||
import io.lumine.mythic.lib.command.api.Parameter;
|
import io.lumine.mythic.lib.command.api.Parameter;
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
|||||||
import net.Indyuce.mmocore.experience.EXPSource;
|
import net.Indyuce.mmocore.experience.EXPSource;
|
||||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||||
import net.Indyuce.mmocore.experience.Profession;
|
import net.Indyuce.mmocore.experience.Profession;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
|
import net.Indyuce.mmocore.command.MMOCoreCommandTreeRoot;
|
||||||
import net.Indyuce.mmocore.util.TriConsumer;
|
import net.Indyuce.mmocore.util.TriConsumer;
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
|
@ -3,7 +3,7 @@ package net.Indyuce.mmocore.command.rpg.admin;
|
|||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
import net.Indyuce.mmocore.api.player.profess.PlayerClass;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -7,7 +7,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
|||||||
import net.Indyuce.mmocore.experience.EXPSource;
|
import net.Indyuce.mmocore.experience.EXPSource;
|
||||||
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
import net.Indyuce.mmocore.experience.PlayerProfessions;
|
||||||
import net.Indyuce.mmocore.experience.Profession;
|
import net.Indyuce.mmocore.experience.Profession;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import net.Indyuce.mmocore.util.TriConsumer;
|
import net.Indyuce.mmocore.util.TriConsumer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package net.Indyuce.mmocore.command.rpg.admin;
|
package net.Indyuce.mmocore.command.rpg.admin;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -4,7 +4,7 @@ import java.util.function.BiConsumer;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
||||||
import io.lumine.mythic.lib.command.api.Parameter;
|
import io.lumine.mythic.lib.command.api.Parameter;
|
||||||
|
|
||||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.command.api.Parameter;
|
|||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
import net.Indyuce.mmocore.api.quest.trigger.ManaTrigger;
|
||||||
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
import net.Indyuce.mmocore.api.player.profess.resource.PlayerResource;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
@ -5,7 +5,7 @@ import io.lumine.mythic.lib.command.api.Parameter;
|
|||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
|||||||
import io.lumine.mythic.lib.command.api.Parameter;
|
import io.lumine.mythic.lib.command.api.Parameter;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import net.Indyuce.mmocore.util.TriConsumer;
|
import net.Indyuce.mmocore.util.TriConsumer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -4,7 +4,7 @@ import io.lumine.mythic.lib.command.api.CommandTreeNode;
|
|||||||
import io.lumine.mythic.lib.command.api.Parameter;
|
import io.lumine.mythic.lib.command.api.Parameter;
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
import net.Indyuce.mmocore.api.player.PlayerData;
|
import net.Indyuce.mmocore.api.player.PlayerData;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import net.Indyuce.mmocore.waypoint.Waypoint;
|
import net.Indyuce.mmocore.waypoint.Waypoint;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
@ -1,32 +1,37 @@
|
|||||||
package net.Indyuce.mmocore.comp.vault;
|
package net.Indyuce.mmocore.comp.vault;
|
||||||
|
|
||||||
|
import net.Indyuce.mmocore.MMOCore;
|
||||||
|
import net.milkbowl.vault.economy.Economy;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import net.Indyuce.mmocore.MMOCore;
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import net.milkbowl.vault.economy.Economy;
|
|
||||||
|
|
||||||
public class VaultEconomy {
|
public class VaultEconomy {
|
||||||
private Economy economy;
|
|
||||||
|
|
||||||
public VaultEconomy() {
|
@Nullable
|
||||||
try {
|
private final Economy economy;
|
||||||
economy = Bukkit.getServicesManager().getRegistration(Economy.class).getProvider();
|
|
||||||
MMOCore.log(Level.INFO, "Hooked onto Vault");
|
|
||||||
} catch (Exception exception) {
|
|
||||||
MMOCore.plugin.getLogger().log(Level.WARNING, "Vault was found but MMOCore was unable to successfully find/load an economy plugin.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
public VaultEconomy() {
|
||||||
* checks if an economy plugin was found.
|
Economy eco;
|
||||||
*/
|
try {
|
||||||
public boolean isValid() {
|
eco = Bukkit.getServicesManager().getRegistration(Economy.class).getProvider();
|
||||||
return economy != null;
|
MMOCore.log(Level.INFO, "Hooked onto Vault");
|
||||||
}
|
} catch (Exception exception) {
|
||||||
|
MMOCore.plugin.getLogger().log(Level.WARNING, "Vault was found but MMOCore was unable to successfully find/load an economy plugin.");
|
||||||
|
eco = null;
|
||||||
|
}
|
||||||
|
this.economy = eco;
|
||||||
|
}
|
||||||
|
|
||||||
public Economy getEconomy() {
|
/**
|
||||||
return economy;
|
* @return If an economy plugin was found
|
||||||
}
|
*/
|
||||||
|
public boolean isValid() {
|
||||||
|
return economy != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Economy getEconomy() {
|
||||||
|
return economy;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import net.Indyuce.mmocore.gui.api.item.SimplePlaceholderItem;
|
|||||||
import net.Indyuce.mmocore.skill.ClassSkill;
|
import net.Indyuce.mmocore.skill.ClassSkill;
|
||||||
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
import net.Indyuce.mmocore.skill.RegisteredSkill;
|
||||||
import net.Indyuce.mmocore.api.SoundEvent;
|
import net.Indyuce.mmocore.api.SoundEvent;
|
||||||
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
@ -28,7 +29,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class SkillList extends EditableInventory {
|
public class SkillList extends EditableInventory {
|
||||||
public SkillList() {
|
public SkillList() {
|
||||||
super("skill-list");
|
super("skill-list");
|
||||||
}
|
}
|
||||||
@ -340,6 +341,7 @@ public class SkillList extends EditableInventory {
|
|||||||
|
|
||||||
skills = new ArrayList<>(playerData.getProfess().getSkills());
|
skills = new ArrayList<>(playerData.getProfess().getSkills());
|
||||||
skillSlots = getEditable().getByFunction("skill").getSlots();
|
skillSlots = getEditable().getByFunction("skill").getSlots();
|
||||||
|
Validate.notNull(getEditable().getByFunction("active-slot"), "Your skill GUI config file is out-of-date, please regenerate it.");
|
||||||
activeSlotSlots = getEditable().getByFunction("active-slot").getSlots();
|
activeSlotSlots = getEditable().getByFunction("active-slot").getSlots();
|
||||||
passiveSlotSlots = getEditable().getByFunction("passive-slot").getSlots();
|
passiveSlotSlots = getEditable().getByFunction("passive-slot").getSlots();
|
||||||
selected = skills.get(page * skillSlots.size());
|
selected = skills.get(page * skillSlots.size());
|
||||||
|
@ -7,7 +7,7 @@ import net.Indyuce.mmocore.api.player.PlayerData;
|
|||||||
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
import net.Indyuce.mmocore.api.util.input.ChatInput;
|
||||||
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
import net.Indyuce.mmocore.api.util.input.PlayerInput;
|
||||||
import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType;
|
import net.Indyuce.mmocore.api.util.input.PlayerInput.InputType;
|
||||||
import net.Indyuce.mmocore.command.CommandVerbose;
|
import net.Indyuce.mmocore.command.api.CommandVerbose;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -92,7 +92,6 @@ public class ConfigManager {
|
|||||||
loadDefaultFile("restrictions.yml");
|
loadDefaultFile("restrictions.yml");
|
||||||
loadDefaultFile("sounds.yml");
|
loadDefaultFile("sounds.yml");
|
||||||
loadDefaultFile("loot-chests.yml");
|
loadDefaultFile("loot-chests.yml");
|
||||||
loadDefaultFile("commands.yml");
|
|
||||||
loadDefaultFile("exp-tables.yml");
|
loadDefaultFile("exp-tables.yml");
|
||||||
loadDefaultFile("exp-sources.yml");
|
loadDefaultFile("exp-sources.yml");
|
||||||
loadDefaultFile("triggers.yml");
|
loadDefaultFile("triggers.yml");
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
player:
|
|
||||||
main: "player"
|
|
||||||
aliases: ["p", "profile"]
|
|
||||||
attributes:
|
|
||||||
main: "attributes"
|
|
||||||
aliases: ["att", "stats"]
|
|
||||||
class:
|
|
||||||
main: "class"
|
|
||||||
aliases: ["c"]
|
|
||||||
waypoints:
|
|
||||||
main: "waypoints"
|
|
||||||
aliases: ["wp"]
|
|
||||||
quests:
|
|
||||||
main: "quests"
|
|
||||||
aliases: ["q", "journal"]
|
|
||||||
skills:
|
|
||||||
main: "skills"
|
|
||||||
aliases: ["s"]
|
|
||||||
friends:
|
|
||||||
main: "friends"
|
|
||||||
aliases: ["f"]
|
|
||||||
party:
|
|
||||||
main: "party"
|
|
||||||
aliases: []
|
|
||||||
guild:
|
|
||||||
main: "guild"
|
|
||||||
aliases: []
|
|
||||||
withdraw:
|
|
||||||
main: "withdraw"
|
|
||||||
aliases: ["w"]
|
|
||||||
skill-trees:
|
|
||||||
main: "skilltrees"
|
|
||||||
aliase: ["st"]
|
|
||||||
deposit:
|
|
||||||
main: "deposit"
|
|
||||||
aliases: ["d"]
|
|
@ -3,24 +3,24 @@ version: ${project.version}
|
|||||||
main: net.Indyuce.mmocore.MMOCore
|
main: net.Indyuce.mmocore.MMOCore
|
||||||
author: Indyuce
|
author: Indyuce
|
||||||
description: ${project.description}
|
description: ${project.description}
|
||||||
loadbefore: [MMOItems]
|
loadbefore: [ MMOItems ]
|
||||||
depend: [MythicLib]
|
depend: [ MythicLib ]
|
||||||
softdepend: [Vault,MythicMobs,PlaceholderAPI,Residence,Citizens,ProtocolLib]
|
softdepend: [ Vault,MythicMobs,PlaceholderAPI,Residence,Citizens,ProtocolLib ]
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
commands:
|
commands:
|
||||||
mmocore:
|
mmocore:
|
||||||
description: Main command.
|
description: Main command.
|
||||||
aliases: [rpg]
|
aliases: [ rpg ]
|
||||||
permissions:
|
permissions:
|
||||||
mmocore.admin:
|
mmocore.admin:
|
||||||
description: Access to /mmocore
|
description: Access to /mmocore
|
||||||
default: op
|
default: op
|
||||||
mmocore.waypoints:
|
mmocore.waypoints:
|
||||||
description: Access to /waypoints
|
description: Access to /waypoints
|
||||||
default: op
|
default: op
|
||||||
mmocore.currency:
|
mmocore.currency:
|
||||||
description: Access to /deposit and /withdraw
|
description: Access to /deposit and /withdraw
|
||||||
default: op
|
default: op
|
||||||
mmocore.class-select:
|
mmocore.class-select:
|
||||||
description: Access to /class
|
description: Access to /class
|
||||||
default: op
|
default: op
|
||||||
|
Loading…
Reference in New Issue
Block a user