Java Code Examples for org.bukkit.plugin.Plugin#getName()

The following examples show how to use org.bukkit.plugin.Plugin#getName() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Updater.java    From TrMenu with MIT License 5 votes vote down vote up
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);
}
 
Example 2
Source File: EZPlaceholderHook.java    From PlaceholderAPI with GNU General Public License v3.0 4 votes vote down vote up
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();
}
 
Example 3
Source File: TLogger.java    From TabooLib with MIT License 4 votes vote down vote up
public TLogger(String pattern, Plugin plugin, int level) {
    this.pattern = pattern;
    this.name = plugin.getName();
    this.level = level;
}
 
Example 4
Source File: Gui.java    From IF with The Unlicense 4 votes vote down vote up
/**
 * 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);
    }
}
 
Example 5
Source File: PlotMeFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public PlotMeFeature(final Plugin plotmePlugin, final FaweBukkit p3) {
    super(plotmePlugin.getName());
    this.plotme = ((PlotMe_CorePlugin) plotmePlugin).getAPI();
    this.plugin = p3;

}
 
Example 6
Source File: Worldguard.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public Worldguard(final Plugin p2, final FaweBukkit p3) {
    super(p2.getName());
    this.worldguard = this.getWorldGuard();
    this.plugin = p3;

}
 
Example 7
Source File: ASkyBlockHook.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public ASkyBlockHook(final Plugin aSkyBlock, final FaweBukkit p3) {
    super(aSkyBlock.getName());
    this.aSkyBlock = aSkyBlock;
    this.plugin = p3;

}
 
Example 8
Source File: GriefPreventionFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public GriefPreventionFeature(final Plugin griefpreventionPlugin, final FaweBukkit p3) {
    super(griefpreventionPlugin.getName());
    this.griefprevention = griefpreventionPlugin;
    this.plugin = p3;
}
 
Example 9
Source File: FactionsUUIDFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public FactionsUUIDFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
    super(factionsPlugin.getName());
    this.instance = Board.getInstance();
}
 
Example 10
Source File: FactionsFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public FactionsFeature(final Plugin factionsPlugin, final FaweBukkit p3) {
    super(factionsPlugin.getName());
    this.factions = factionsPlugin;
    this.plugin = p3;
    BoardColl.get();
}
 
Example 11
Source File: FactionsOneFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
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);
}
 
Example 12
Source File: ResidenceFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public ResidenceFeature(final Plugin residencePlugin, final FaweBukkit p3) {
    super(residencePlugin.getName());
    this.residence = residencePlugin;
    this.plugin = p3;

}
 
Example 13
Source File: PreciousStonesFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public PreciousStonesFeature(final Plugin preciousstonesPlugin, final FaweBukkit p3) {
    super(preciousstonesPlugin.getName());
    this.preciousstones = preciousstonesPlugin;
    this.plugin = p3;

}
 
Example 14
Source File: TownyFeature.java    From FastAsyncWorldedit with GNU General Public License v3.0 4 votes vote down vote up
public TownyFeature(final Plugin townyPlugin, final FaweBukkit p3) {
    super(townyPlugin.getName());
    this.towny = townyPlugin;
    this.plugin = p3;
}