Skip to content

Commit

Permalink
Update 2019-7-26 16:30
Browse files Browse the repository at this point in the history
  • Loading branch information
WinfXK committed Jul 26, 2019
1 parent ac6aa80 commit 2339990
Show file tree
Hide file tree
Showing 10 changed files with 1,465 additions and 1,256 deletions.
9 changes: 6 additions & 3 deletions Knickers/plugin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Knickers
main: xiaokai.knickers.Knickers
api:
- 1.0.0
version: 1.0d
version: 1.1d
load: POSTWORLD
website: http://EpicFX.cn
description: 多功能菜单,如传送、命令、提示等功能,并且支持多功能个人商店!并且支持自定义商品搜索等!后期还会加入更多功能哦!
Expand All @@ -12,13 +12,16 @@ loadbefore:
commands:
mis:
description: §9菜单工具主命令
permission: MiniatureS.Command.main
permission: Knickers.Command.main
usage: §b/§6mis §chelp
aliases:
- miniature
- miniatures
- 菜单
- knickers
- 内裤
- 胖次
permissions:
MiniatureS.Command.main:
Knickers.Command.main:
description: 菜单工具主命令
default: true
6 changes: 5 additions & 1 deletion Knickers/resources/Config.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
#配置开始==================
#每个玩家进服的时候都会给一个,当拿着这个玩意右键的时候打开菜单主页,特殊值可以不限定,当特殊值为x时默认匹配所有,特殊值默认为0,当这个值为空(null{在Yml文件内用~表示})时不适用快捷工具!
快捷工具: '347:0'
#当这个值为真时,撤销使用快捷工具打开的事件
打开撤销: true
货币单位: 金币
检测更新: true
检测更新间隔: 21600
#假如玩家在这个时间段内双击,将无法用快捷工具多次打开主页,防止刷屏
屏蔽玩家双击间隔: 500
仅允许白名单管理菜单: false
白名单: []
白名单: []
定时检查快捷工具间隔: 60
是否允许玩家丢弃快捷工具: false
5 changes: 5 additions & 0 deletions Knickers/resources/Message.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,17 @@
没有按钮时提示: §4这个页面还不存在按钮哦!快去找管理员添加一个吧~
权限不足: §4你无权限执行此操作!
金币不足: §4您的{MoneyName}不足!{n}{n}{n}{n}
撤销丢掉快捷工具的提示: §6{ItemName}§f(§9{{ItemID}}§f)§4是你的命根子!你不能丢掉你的命根子!
命令:
无法打开界面: §4无法打开此界面!{Error}
未输入想要打开的界面的配置文件名: 请输入想要打开的界面的配置文件名(支持只输入部分)
界面:
打开按钮失败: §4打开按钮失败:§6{Error}
取消按钮: '{RandColor}取消'
返回上级: '{RandColor}返回上级'
执行命令:
标题: §6提示
打开失败: §4无法执行该命令!{Error}
Tpa界面:
传送请求被拒绝: §6亲爱的§9{TpaPlayer}§6您好, 您的请求已被§8{Player}{Msg}!
发请求的标题: §6提示
Expand Down
273 changes: 179 additions & 94 deletions Knickers/src/xiaokai/knickers/Knickers.java
Original file line number Diff line number Diff line change
@@ -1,94 +1,179 @@
package xiaokai.knickers;

import java.time.Duration;
import java.time.Instant;

import cn.nukkit.Player;
import cn.nukkit.command.Command;
import cn.nukkit.command.CommandSender;
import cn.nukkit.plugin.PluginBase;
import cn.nukkit.plugin.PluginManager;
import cn.nukkit.utils.TextFormat;
import xiaokai.knickers.event.Monitor;
import xiaokai.knickers.event.PlayerEvent;
import xiaokai.knickers.form.MakeForm;
import xiaokai.knickers.mtp.Belle;
import xiaokai.knickers.mtp.Kick;
import xiaokai.tool.Tool;

/**
* @author Winfxk
*/
public class Knickers extends PluginBase {
private Instant loadTime = Instant.now();
/**
* 插件缓存数据集合
*/
protected static Kick kick;

@Override
public boolean onCommand(CommandSender player, Command command, String label, String[] args) {
new Thread() {
public void run() {
Belle.exMaterials((Player) player);
}
}.start();
MakeForm.Main((Player) player);
return true;
}

/**
* 明人不说暗话!这就是插件启动事件
*/
@Override
public void onEnable() {
super.onEnable();
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new PlayerEvent(kick), this);
pm.registerEvents(new Monitor(kick), this);
this.getServer().getLogger().info(Tool.getColorFont(this.getName() + "启动!") + "§6耗时:§9"
+ ((float) (Duration.between(loadTime, Instant.now()).toMillis()) / 1000));
}

/**
* 返回货币的名称,如“金币”
*
* @return
*/
public static String getMoneyName() {
return kick.config.getString("货币单位");
}

/**
* ????这都看不懂??这是插件关闭事件
*/
@Override
public void onDisable() {
this.getServer().getLogger()
.info(Tool.getColorFont(this.getName() + "关闭!") + TextFormat.GREEN + "本次运行时长" + TextFormat.BLUE
+ Tool.getTimeBy(((float) (Duration.between(loadTime, Instant.now()).toMillis()) / 1000)));
super.onDisable();
}

/**
* PY已准备好!插件加载事件
*/
@Override
public void onLoad() {
this.getServer().getLogger().info(Tool.getColorFont(this.getName() + "正在加载..."));
kick = new Kick(this);
}

public static Kick getKick() {
return kick;
}

/**
* 快来和本插件PY交易吧~
*
* @return 插件主类对象
*/
public static Knickers getPY() {
return kick.mis;
}
}
package xiaokai.knickers;

import java.io.File;
import java.time.Duration;
import java.time.Instant;
import java.util.ArrayList;
import java.util.List;

import cn.nukkit.Player;
import cn.nukkit.command.Command;
import cn.nukkit.command.CommandSender;
import cn.nukkit.plugin.PluginBase;
import cn.nukkit.plugin.PluginManager;
import cn.nukkit.utils.TextFormat;
import xiaokai.knickers.event.Monitor;
import xiaokai.knickers.event.PlayerEvent;
import xiaokai.knickers.form.MakeForm;
import xiaokai.knickers.mtp.Belle;
import xiaokai.knickers.mtp.Kick;
import xiaokai.tool.Tool;

/**
* @author Winfxk
*/
@SuppressWarnings("unchecked")
public class Knickers extends PluginBase {
private Instant loadTime = Instant.now();
/**
* 插件缓存数据集合
*/
protected static Kick kick;

@Override
public boolean onCommand(CommandSender player, Command command, String label, String[] args) {
if (player.isPlayer()) {
new Thread() {
public void run() {
Belle.exMaterials((Player) player);
}
}.start();
if (args.length < 1)
return MakeForm.Main((Player) player);
} else if (args.length < 1)
return false;
switch (args[0]) {
case "help":
case "h":
case "帮助":
player.sendMessage(
"§4=====§6=====§a=====§e=====§f[§9命令帮助§f]§e=====§a=====§6=====§4=====\n§f/§bmis §dhelp §c:§9打开命令帮助\n§f/§bmis §dadmin §2<§3玩家名§2> §c:§9添加或删除管理员权限\n§f/§bmis §dshow §2<§3文件名§2> §c:§9打开一个界面[文件名支持只写部分]\n§f/§bmis §dui §c:§9打开主页面\n§f/§bmis §c:§9打开主页并且检查是否拥有快捷工具");
return true;
case "admin":
case "a":
case "管理":
if (!Kick.isAdmin(player)) {
player.sendMessage(kick.Message.getMessage("权限不足"));
return true;
}
if (args.length < 2 || args[1] == null || args[1].isEmpty()) {
player.sendMessage("§4请输入想要添加或删除管理员的玩家名称!");
return true;
}
List<Object> list = kick.config.getList("白名单") == null ? new ArrayList<Object>()
: kick.config.getList("白名单");
if (list.contains(args[1])) {
for (int i = 0; i < list.size(); i++)
if (list.get(i).equals(args[1]))
list.remove(i);
} else
list.add(args[1]);
kick.config.set("白名单", list);
if (kick.config.save())
player.sendMessage("§6您已" + (list.contains(args[1]) ? "§e添加§9" : "§4删除§9") + args[1] + "§6的管理员权限");
else
player.sendMessage("§4设置异常!");
return true;
case "show":
case "打开":
case "open":
if (!player.isPlayer()) {
player.sendMessage("§4请在游戏内执行此命令!");
return true;
}
if (args.length < 2 || args[1] == null || args[1].isEmpty()) {
player.sendMessage(kick.Message.getSon("命令", "未输入想要打开的界面的配置文件名", new String[] { "{Player}" },
new String[] { player.getName() }));
return true;
}
String ConfigName = args[1];
File dFile = new File(getDataFolder(), Kick.MenuConfigPath);
File file = new File(dFile, ConfigName);
boolean isOK = false;
if (!file.exists()) {
String ConfigNames = (ConfigName.lastIndexOf("yml") == ConfigName.length() - 3) ? ConfigName
: ConfigName + ".yml";
file = new File(dFile, ConfigNames);
if (!file.exists()) {
for (String FileN : dFile.list()) {
file = new File(dFile, FileN);
if (file.isFile() && FileN.contains(ConfigName)) {
isOK = true;
break;
}
}
} else
isOK = file.isFile();
} else
isOK = file.isFile();
if (isOK)
return MakeForm.OpenMenu((Player) player, file);
else
player.sendMessage(kick.Message.getSon("命令", "无法打开界面", new String[] { "{Error}", "{Player}" },
new Object[] { "找不到该界面", player.getName() }));
return true;
case "ui":
if (!player.isPlayer()) {
player.sendMessage("§4请在游戏内执行此命令!");
return true;
}
return MakeForm.Main((Player) player);
}
return false;
}

/**
* 明人不说暗话!这就是插件启动事件
*/
@Override
public void onEnable() {
super.onEnable();
PluginManager pm = getServer().getPluginManager();
pm.registerEvents(new PlayerEvent(kick), this);
pm.registerEvents(new Monitor(kick), this);
this.getServer().getLogger().info(Tool.getColorFont(this.getName() + "启动!") + "§6耗时:§9"
+ ((float) (Duration.between(loadTime, Instant.now()).toMillis()) / 1000));
}

/**
* 返回货币的名称,如“金币”
*
* @return
*/
public static String getMoneyName() {
return kick.config.getString("货币单位");
}

/**
* ????这都看不懂??这是插件关闭事件
*/
@Override
public void onDisable() {
this.getServer().getLogger()
.info(Tool.getColorFont(this.getName() + "关闭!") + TextFormat.GREEN + "本次运行时长" + TextFormat.BLUE
+ Tool.getTimeBy(((float) (Duration.between(loadTime, Instant.now()).toMillis()) / 1000)));
super.onDisable();
}

/**
* PY已准备好!插件加载事件
*/
@Override
public void onLoad() {
this.getServer().getLogger().info(Tool.getColorFont(this.getName() + "正在加载..."));
kick = new Kick(this);
}

public static Kick getKick() {
return kick;
}

/**
* 快来和本插件PY交易吧~
*
* @return 插件主类对象
*/
public static Knickers getPY() {
return kick.mis;
}
}
Loading

0 comments on commit 2339990

Please sign in to comment.