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