mirror of
https://e.coding.net/circlecloud/GuiACK.git
synced 2024-12-04 16:38:48 +00:00
fix command error。。。
This commit is contained in:
parent
37fa0a28f8
commit
044d029ff1
@ -1,76 +1,76 @@
|
||||
package cn.citycraft.GuiACK;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.mcstats.Metrics;
|
||||
|
||||
import cn.citycraft.GuiACK.gui.VerifyGui;
|
||||
import cn.citycraft.GuiACK.listen.PlayerListen;
|
||||
import cn.citycraft.GuiACK.runnable.TaskManager;
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
public class GuiACK extends JavaPlugin {
|
||||
public boolean isEconomy;
|
||||
public Economy economy = null;
|
||||
FileConfig config;
|
||||
public int tasktime;
|
||||
public double reward;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length != 1)
|
||||
return false;
|
||||
if (args[0].equalsIgnoreCase("reload") && (sender.hasPermission("gack.reload") || sender.isOp())) {
|
||||
onLoad();
|
||||
sender.sendMessage("配置文件已重载!");
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("test") && sender instanceof Player && (sender.hasPermission("gack.test") || sender.isOp()))
|
||||
VerifyGui.open((Player) sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (setupEconomy()) {
|
||||
isEconomy = true;
|
||||
this.getLogger().info("发现Vault 载入数据...");
|
||||
} else {
|
||||
this.getLogger().warning("发现Vault 但是无法找到经济插件 关闭插件...");
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
this.getServer().getPluginManager().registerEvents(new PlayerListen(this), this);
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
TaskManager.add(p);
|
||||
this.getLogger().info("图形化防挂机验证码加载完毕!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
config = new FileConfig(this);
|
||||
tasktime = config.getInt("TaskTime");
|
||||
reward = config.getDouble("Reward");
|
||||
VerifyGui.init(config.getStringList("VerifyList"));
|
||||
TaskManager.init(this);
|
||||
}
|
||||
|
||||
public boolean setupEconomy() {
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null)
|
||||
economy = economyProvider.getProvider();
|
||||
return (economy != null);
|
||||
}
|
||||
|
||||
}
|
||||
package cn.citycraft.GuiACK;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.mcstats.Metrics;
|
||||
|
||||
import cn.citycraft.GuiACK.gui.VerifyGui;
|
||||
import cn.citycraft.GuiACK.listen.PlayerListen;
|
||||
import cn.citycraft.GuiACK.runnable.TaskManager;
|
||||
import cn.citycraft.PluginHelper.config.FileConfig;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
public class GuiACK extends JavaPlugin {
|
||||
public boolean isEconomy;
|
||||
public Economy economy = null;
|
||||
FileConfig config;
|
||||
public int tasktime;
|
||||
public double reward;
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
if (args.length != 1)
|
||||
return false;
|
||||
if (args[0].equalsIgnoreCase("reload")) {
|
||||
onLoad();
|
||||
sender.sendMessage("配置文件已重载!");
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("test") && sender instanceof Player)
|
||||
VerifyGui.open((Player) sender);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
if (setupEconomy()) {
|
||||
isEconomy = true;
|
||||
this.getLogger().info("发现Vault 载入数据...");
|
||||
} else {
|
||||
this.getLogger().warning("发现Vault 但是无法找到经济插件 关闭插件...");
|
||||
setEnabled(false);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
Metrics metrics = new Metrics(this);
|
||||
metrics.start();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
this.getServer().getPluginManager().registerEvents(new PlayerListen(this), this);
|
||||
for (Player p : Bukkit.getOnlinePlayers())
|
||||
TaskManager.add(p);
|
||||
this.getLogger().info("图形化防挂机验证码加载完毕!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLoad() {
|
||||
config = new FileConfig(this);
|
||||
tasktime = config.getInt("TaskTime");
|
||||
reward = config.getDouble("Reward");
|
||||
VerifyGui.init(config.getStringList("VerifyList"));
|
||||
TaskManager.init(this);
|
||||
}
|
||||
|
||||
public boolean setupEconomy() {
|
||||
RegisteredServiceProvider<Economy> economyProvider = getServer().getServicesManager().getRegistration(net.milkbowl.vault.economy.Economy.class);
|
||||
if (economyProvider != null)
|
||||
economy = economyProvider.getProvider();
|
||||
return (economy != null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,17 +1,25 @@
|
||||
name: ${project.artifactId}
|
||||
description: ${project.description}
|
||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||
version: ${project.version}
|
||||
auther: 喵♂呜
|
||||
website: http://ci.citycraft.cn:8800/jenkins/job/${project.artifactId}/
|
||||
commands:
|
||||
gack:
|
||||
description: gack
|
||||
usage: §b使用/gack [test(测试插件)|reload(重载插件)]!
|
||||
permissions:
|
||||
gack.test:
|
||||
description: 测试插件权限!
|
||||
default: op
|
||||
gack.reload:
|
||||
description: 重新载入插件!
|
||||
name: ${project.artifactId}
|
||||
description: ${project.description}
|
||||
main: ${project.groupId}.${project.artifactId}.${project.artifactId}
|
||||
version: ${project.version}
|
||||
auther: 喵♂呜
|
||||
website: http://ci.citycraft.cn:8800/jenkins/job/${project.artifactId}/
|
||||
commands:
|
||||
gack:
|
||||
description: gack
|
||||
usage: §b使用/gack [test(测试插件)|reload(重载插件)]!
|
||||
permission: gack.*
|
||||
permission-message: §c你没有 <permission> 的权限来执行此命令!
|
||||
permissions:
|
||||
gack.*:
|
||||
description: 图形化防挂机插件所有权限!
|
||||
default: op
|
||||
children:
|
||||
gack.test: true
|
||||
gack.reload: true
|
||||
gack.test:
|
||||
description: 测试插件权限!
|
||||
default: op
|
||||
gack.reload:
|
||||
description: 重新载入插件!
|
||||
default: op
|
Loading…
Reference in New Issue
Block a user