JumpPlate/src/main/java/cn/citycraft/JumpPlate/JumpPlateCommand.java

33 lines
1.4 KiB
Java

package cn.citycraft.JumpPlate;
import cn.citycraft.PluginHelper.commands.HandlerCommand;
import cn.citycraft.PluginHelper.commands.HandlerCommands;
import cn.citycraft.PluginHelper.commands.InvokeCommandEvent;
/**
* 跳板命令
*
* @since 2016年2月22日 上午11:00:52
* @author 喵♂呜
*/
public class JumpPlateCommand implements HandlerCommands {
@HandlerCommand(name = "reload", description = "重载插件配置", permission = "JumpPlate.reload")
public void reloadCommand(final InvokeCommandEvent e) {
JumpPlate.instence.onLoad();
e.getSender().sendMessage(JumpPlate.instence.pluginname + "§a配置文件已重载!");
}
@HandlerCommand(name = "set", description = "设置基岩跳板高度", minimumArguments = 1, permission = "JumpPlate.reload", possibleArguments = "<跳板高度(1-10)>")
public void setCommand(final InvokeCommandEvent e) {
try {
final double drb = Double.parseDouble(e.getArgs()[0]);
JumpPlate.instence.getConfig().set("BEDROCK", drb);
JumpPlate.instence.getConfig().save();
e.getSender().sendMessage(JumpPlate.instence.pluginname + "§a基岩的跳板弹跳倍数已设置为 " + drb + "倍!");
} catch (final NumberFormatException ex) {
e.getSender().sendMessage(JumpPlate.instence.pluginname + "§c参数非法 请输入数字 1-10");
}
}
}