1
0
mirror of https://e.coding.net/circlecloud/SimpleProtect.git synced 2024-11-22 01:49:03 +00:00

add lose file...

Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
j502647092 2015-07-26 17:31:38 +08:00
parent dbbba9741e
commit 417b1ff950
2 changed files with 175 additions and 0 deletions

View File

@ -0,0 +1,112 @@
package cn.citycraft.SimpleProtect;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import cn.citycraft.SimpleProtect.config.Config;
import cn.citycraft.SimpleProtect.listen.BreakFarm;
import cn.citycraft.SimpleProtect.listen.Explosion;
import cn.citycraft.SimpleProtect.listen.HighRedstone;
import cn.citycraft.SimpleProtect.listen.NetherDoor;
import cn.citycraft.SimpleProtect.listen.Nightvision;
import cn.citycraft.SimpleProtect.listen.Spam;
import cn.citycraft.SimpleProtect.listen.Tip;
import cn.citycraft.SimpleProtect.utils.VersionChecker;
public class SimpleProtect extends JavaPlugin {
public String servername;
public String pluginname;
public String getfullmsg(String path) {
return servername + pluginname + " " + getmessage(path);
}
public String getmessage(String path) {
return Config.getMessage(path);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
switch (args.length) {
case 1:
switch (args[0]) {
case "setspawn":
if (sender instanceof Player) {
Location l = ((Player) sender).getLocation();
Config.getInstance().set("SafeNetherDoor.World", l.getWorld().getName());
Config.getInstance().set("SafeNetherDoor.X", l.getBlockX());
Config.getInstance().set("SafeNetherDoor.Y", l.getBlockY());
Config.getInstance().set("SafeNetherDoor.Z", l.getBlockZ());
sender.sendMessage(pluginname + Config.getMessage("SafeNetherDoor.Set"));
}
return true;
case "reload":
onLoad();
sender.sendMessage(pluginname + "§a配置文件已重载!");
}
break;
}
return false;
}
@Override
public void onEnable() {
getServer().getConsoleSender().sendMessage(
"==========" + servername + pluginname + "==========");
PluginManager pm = Bukkit.getPluginManager();
if (Config.getInstance().getBoolean("Tip.Enable", true)) {
pm.registerEvents(new Tip(this), this);
getLogger().info("保护插件提醒功能已加载!");
}
if (Config.getInstance().getBoolean("SafeNetherDoor.Enable", true)) {
pm.registerEvents(new NetherDoor(this), this);
getLogger().info("防止登录卡地狱门已加载!");
}
if (Config.getInstance().getBoolean("BreakFarm.Enable", true)) {
pm.registerEvents(new BreakFarm(this), this);
getLogger().info("防止玩家踩坏耕地已加载!");
}
if (Config.getInstance().getBoolean("Explosion.Enable", true)) {
pm.registerEvents(new Explosion(), this);
getLogger().info("防止爆炸破坏地形已加载!");
}
if (Config.getInstance().getBoolean("Nightvision.Enable", true)) {
pm.registerEvents(new Nightvision(this), this);
getLogger().info("防止无限夜视作弊已加载!");
}
if (Config.getInstance().getBoolean("HighRedstone.Enable", true)) {
HighRedstone redstone = new HighRedstone(this);
pm.registerEvents(redstone, this);
Bukkit.getScheduler().runTaskTimer(this, redstone, 20, 20);
getLogger().info("防止玩家高频红石已加载!");
}
if (Config.getInstance().getBoolean("Spam.Enable", true)) {
Spam spam = new Spam(this);
Bukkit.getPluginManager().registerEvents(spam, this);
Bukkit.getScheduler().runTaskTimer(this, spam, 20, 20);
getCommand("spam").setExecutor(spam);
getLogger().info("防止玩家聊天刷屏已加载!");
}
getServer().getConsoleSender().sendMessage(
"==========" + servername + pluginname + "==========");
new VersionChecker(this);
}
@Override
public void onLoad() {
Config.load(this, "1.0");
servername = getmessage("servername");
pluginname = getmessage("pluginname");
}
}

63
src/config.yml Normal file
View File

@ -0,0 +1,63 @@
#本文件为保护插件的主配置文件
version: 1.0
#服务器名称
servername: ''
#插件名称
pluginname: '&6[&b保护系统&6]&r'
#登陆提示
Tip:
#是否开启
Enable: true
Message:
- '&a服务器已开启保护功能'
- '&c将会实时监控您的操作'
- '&e挖矿请带上火把或药水'
#耕地保护配置
BreakFarm:
#是否开启
Enable: true
Tip: '&c服务器已开启耕地保护请不要踩庄稼'
#爆炸保护配置
Explosion:
#是否开启
Enable: true
#高频红石检测
HighRedstone:
#是否开启
Enable: true
Maxevents: 35
Find: '&c发现高频红石 &3世界%world% &d坐标 X:%x% Y:%y% Z:%z% §a已清理'
Check: '&c高频红石数据监测 &5上述高频红石由 &6玩家&a%player%& 6放置'
Admin: '&c发现您放置高频红石,由于您是管理员,在服务器重启之前此高频将不会被清理,请用完后及时清理!'
#防止无限夜视
Nightvision:
#是否开启
Enable: true
Tip: '&c为防止无限夜视作弊已阻止挖矿请插火把或用夜视药水'
#安全地狱门
SafeNetherDoor:
#是否开启
Enable: true
Tip: '&5为防止您卡在地狱门现在将您传送回主城'
Set: '&a新的传送点已设置'
World: world
X: 0
Y: 70
Z: 0
#刷屏保护
Spam:
#是否开启
Enable: true
ChatWait: 3
SameChatWait: 8
CommandWait: 2
SameCommandWait: 3
KickCheck: 3
KickReset: 10