51 lines
1.3 KiB
Java
51 lines
1.3 KiB
Java
package cn.citycraft.ResFly;
|
|
|
|
import org.bukkit.Bukkit;
|
|
import org.bukkit.plugin.Plugin;
|
|
import org.bukkit.plugin.PluginManager;
|
|
import org.bukkit.plugin.java.JavaPlugin;
|
|
|
|
import cn.citycraft.ResFly.config.Config;
|
|
import cn.citycraft.ResFly.listen.PlayerListen;
|
|
|
|
import com.bekvon.bukkit.residence.protection.FlagPermissions;
|
|
|
|
public class ResFly extends JavaPlugin {
|
|
|
|
public String servername;
|
|
public String pluginname;
|
|
|
|
public void onLoad() {
|
|
Config.load(this);
|
|
servername = getmessage("servername");
|
|
pluginname = getmessage("pluginname");
|
|
}
|
|
|
|
public void onEnable() {
|
|
PluginManager pm = this.getServer().getPluginManager();
|
|
Plugin res = pm.getPlugin("Residence");
|
|
if (Config.getInstance().getBoolean("ResFly.Enable", true)) {
|
|
if (res != null && res.isEnabled()) {
|
|
FlagPermissions.addFlag("fly");
|
|
FlagPermissions.addResidenceOnlyFlag("fly");
|
|
Bukkit.getPluginManager()
|
|
.registerEvents(new PlayerListen(this), this);
|
|
getLogger().info("玩家领地飞行控制已加载!");
|
|
} else {
|
|
getLogger().info("未找到领地插件停止加载领地飞行!");
|
|
pm.disablePlugin(this);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
public String getfullmsg(String path) {
|
|
return servername + pluginname + " " + getmessage(path);
|
|
}
|
|
|
|
public String getmessage(String path) {
|
|
return Config.getMessage(path);
|
|
}
|
|
|
|
}
|