下面列出了org.bukkit.plugin.Plugin#getName ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
public static void init(Plugin plugin) {
url = "https://api.github.com/repos/Arasple/" + plugin.getName() + "/releases/latest";
version = TrMenu.getTrVersion();
newVersion = version;
setAutoUpdate();
if (!String.valueOf(version).equalsIgnoreCase(plugin.getDescription().getVersion().split("-")[0])) {
TLocale.sendToConsole("ERROR.VERSION");
Bukkit.shutdown();
}
Bukkit.getPluginManager().registerEvents(new Updater(), plugin);
}
public EZPlaceholderHook(Plugin plugin, String identifier) {
Validate.notNull(plugin, "Plugin can not be null!");
Validate.notNull(identifier, "Placeholder name can not be null!");
this.identifier = identifier;
this.plugin = plugin.getName();
}
public TLogger(String pattern, Plugin plugin, int level) {
this.pattern = pattern;
this.name = plugin.getName();
this.level = level;
}
/**
* Loads a Gui from a given input stream.
* Throws a {@link RuntimeException} instead of returning null in case of a failure.
*
* @param instance the class instance for all reflection lookups
* @param inputStream the file
* @return the gui
* @see #load(Object, InputStream)
*/
@NotNull
public static Gui loadOrThrow(@NotNull Object instance, @NotNull InputStream inputStream) {
Plugin plugin = JavaPlugin.getProvidingPlugin(Gui.class);
try {
Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(inputStream);
Element documentElement = document.getDocumentElement();
documentElement.normalize();
Gui gui = new Gui(plugin, Integer.parseInt(documentElement.getAttribute("rows")), ChatColor
.translateAlternateColorCodes('&', documentElement.getAttribute("title")));
if (documentElement.hasAttribute("field"))
XMLUtil.loadFieldAttribute(instance, documentElement, gui);
if (documentElement.hasAttribute("onTopClick")) {
gui.setOnTopClick(XMLUtil.loadOnEventAttribute(instance,
documentElement, InventoryClickEvent.class, "onTopClick"));
}
if (documentElement.hasAttribute("onBottomClick")) {
gui.setOnBottomClick(XMLUtil.loadOnEventAttribute(instance,
documentElement, InventoryClickEvent.class, "onBottomClick"));
}
if (documentElement.hasAttribute("onGlobalClick")) {
gui.setOnGlobalClick(XMLUtil.loadOnEventAttribute(instance,
documentElement, InventoryClickEvent.class, "onGlobalClick"));
}
if (documentElement.hasAttribute("onOutsideClick")) {
gui.setOnOutsideClick(XMLUtil.loadOnEventAttribute(instance,
documentElement, InventoryClickEvent.class, "onOutsideClick"));
}
if (documentElement.hasAttribute("onClose")) {
gui.setOnClose(XMLUtil.loadOnEventAttribute(instance,
documentElement, InventoryCloseEvent.class, "onClose"));
}
if (documentElement.hasAttribute("populate")) {
MethodUtils.invokeExactMethod(instance, "populate", gui, Gui.class);
} else {
NodeList childNodes = documentElement.getChildNodes();
for (int i = 0; i < childNodes.getLength(); i++) {
Node item = childNodes.item(i);
if (item.getNodeType() == Node.ELEMENT_NODE)
gui.addPane(loadPane(instance, item));
}
}
return gui;
} catch (Exception e) {
throw new XMLLoadException("Error loading " + plugin.getName() + "'s gui with associated class: "
+ instance.getClass().getSimpleName(), e);
}
}
public PlotMeFeature(final Plugin plotmePlugin, final FaweBukkit p3) {
super(plotmePlugin.getName());
this.plotme = ((PlotMe_CorePlugin) plotmePlugin).getAPI();
this.plugin = p3;
}
public Worldguard(final Plugin p2, final FaweBukkit p3) {
super(p2.getName());
this.worldguard = this.getWorldGuard();
this.plugin = p3;
}
public ASkyBlockHook(final Plugin aSkyBlock, final FaweBukkit p3) {
super(aSkyBlock.getName());
this.aSkyBlock = aSkyBlock;
this.plugin = p3;
}
public GriefPreventionFeature(final Plugin griefpreventionPlugin, final FaweBukkit p3) {
super(griefpreventionPlugin.getName());
this.griefprevention = griefpreventionPlugin;
this.plugin = p3;
}
public FactionsUUIDFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
this.instance = Board.getInstance();
}
public FactionsFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
super(factionsPlugin.getName());
this.factions = factionsPlugin;
this.plugin = p3;
BoardColl.get();
}
public FactionsOneFeature(final Plugin factionsPlugin, final FaweBukkit p3) throws Throwable {
super(factionsPlugin.getName());
this.clazzBoard = Class.forName("com.massivecraft.factions.Board");
this.methodGetFactionAt = clazzBoard.getDeclaredMethod("getFactionAt", FLocation.class);
}
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
super(residencePlugin.getName());
this.residence = residencePlugin;
this.plugin = p3;
}
public PreciousStonesFeature(final Plugin preciousstonesPlugin, final FaweBukkit p3) {
super(preciousstonesPlugin.getName());
this.preciousstones = preciousstonesPlugin;
this.plugin = p3;
}
public TownyFeature(final Plugin townyPlugin, final FaweBukkit p3) {
super(townyPlugin.getName());
this.towny = townyPlugin;
this.plugin = p3;
}