- 欢迎来到Minecraft插件百科!
- 对百科编辑一脸懵逼?帮助:快速入门带您快速熟悉百科编辑!
- 因近日遭受攻击,百科现已限制编辑,有意编辑请加入插件百科企鹅群:223812289
“PlotSquared/Dev”的版本间的差异
(→开发的东西) |
(→得到一个PlotSquared的实例) |
||
第34行: | 第34行: | ||
写了你自己的脚本?想发到这里?[[https://github.com/IntellectualSites/PlotSquared/issues 欢迎!]] | 写了你自己的脚本?想发到这里?[[https://github.com/IntellectualSites/PlotSquared/issues 欢迎!]] | ||
− | === | + | ===一个PlotSquared的附属插件实例=== |
+ | <pre> | ||
+ | import com.intellectualcrafters.plot.api.PlotAPI; | ||
+ | import org.bukkit.plugin.java.JavaPlugin; | ||
+ | import org.bukkit.plugin.PluginManager; | ||
+ | |||
+ | public class Main extends JavaPlugin { | ||
+ | public PlotAPI api; | ||
+ | |||
+ | @Override | ||
+ | public void onEnable() { | ||
+ | PluginManager manager = Bukkit.getServer().getPluginManager(); | ||
+ | final Plugin plotsquared = manager.getPlugin("PlotSquared"); | ||
+ | |||
+ | // 如果插件没有安装的话就关闭这个插件 | ||
+ | |||
+ | // If you move any PlotSquared related tasks to en external class you | ||
+ | // wouldn't have to disable the plugin if PlotSquared wasn't installed | ||
+ | |||
+ | if(plotsquared != null && !plotsquared.isEnabled()) { | ||
+ | PS.log(null, "&c[ExamplePlugin] Could not find PlotSquared! Disabling plugin..."); | ||
+ | manager.disablePlugin(this); | ||
+ | return; | ||
+ | } | ||
+ | |||
+ | // Do PlotSquared related stuff | ||
+ | api = new PlotAPI(); | ||
+ | |||
+ | // 现在你就可以使用这个API了 | ||
+ | } | ||
+ | } | ||
+ | </pre> | ||
==开发的东西== | ==开发的东西== |
2016年10月24日 (一) 19:44的版本
这里是PlotSquared的开发文档界面~
[原文地址]
目录
有用的类
教程
使用Java语言编码
总览
- 脚本放到 PlotSquared/scripts 目录下
- 语言请使用Java语言
指令
- /plot debugexec run <script> [args...]
- /plot debugexec runasync <script> [args...]
- /plot debugexec
示例脚本
其他脚本
写了你自己的脚本?想发到这里?[欢迎!]
一个PlotSquared的附属插件实例
import com.intellectualcrafters.plot.api.PlotAPI;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.PluginManager;
public class Main extends JavaPlugin {
public PlotAPI api;
@Override
public void onEnable() {
PluginManager manager = Bukkit.getServer().getPluginManager();
final Plugin plotsquared = manager.getPlugin("PlotSquared");
// 如果插件没有安装的话就关闭这个插件
// If you move any PlotSquared related tasks to en external class you
// wouldn't have to disable the plugin if PlotSquared wasn't installed
if(plotsquared != null && !plotsquared.isEnabled()) {
PS.log(null, "&c[ExamplePlugin] Could not find PlotSquared! Disabling plugin...");
manager.disablePlugin(this);
return;
}
// Do PlotSquared related stuff
api = new PlotAPI();
// 现在你就可以使用这个API了
}
}
开发的东西
[源代码]
特有词汇