Java Code Examples for io.papermc.lib.PaperLib#isPaper()

The following examples show how to use io.papermc.lib.PaperLib#isPaper() . 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: PlantsListener.java    From ExoticGarden with GNU General Public License v3.0 5 votes vote down vote up
@EventHandler
public void onGrow(StructureGrowEvent e) {
    if (PaperLib.isPaper()) {
        if (PaperLib.isChunkGenerated(e.getLocation())) {
            growStructure(e);
        } else {
            PaperLib.getChunkAtAsync(e.getLocation()).thenRun(() -> growStructure(e));
        }
    } else {
        if (!e.getLocation().getChunk().isLoaded()) {
            e.getLocation().getChunk().load();
        }
        growStructure(e);
    }
}
 
Example 2
Source File: Wild.java    From WildernessTp with MIT License 4 votes vote down vote up
public void onEnable() {
    Console.send("&7-----------------------------------------------");
    String[] tmp = Bukkit.getVersion().split("MC: ");
    String version = tmp[tmp.length - 1].substring(0, 4);
    int ver = parseMcVer(version);

    thirteen = ver>=13;
    instance = this;
    this.getCommand("wildtp").setExecutor(new CmdWildTp(this));
    this.getCommand("wild").setExecutor(new CmdWild(this));
    this.getCommand("wild").setTabCompleter(new WildTab());
    this.getCommand("wildtp").setTabCompleter(new WildTpTab());
    this.getConfig().options().copyDefaults(true);
    this.saveConfig();
    this.saveResource("PotionsEffects.txt", true);
    this.saveResource("Biomes.txt", true);
    this.saveResource("Sounds.txt", true);
    this.saveResource("Particles.txt", true);
    Bukkit.getPluginManager().registerEvents(new InvClick(this), this);
    Bukkit.getPluginManager().registerEvents(new SetVal(this), this);
    Bukkit.getPluginManager().registerEvents(new SignChange(this), this);
    Bukkit.getPluginManager().registerEvents(new SignBreak(this), this);
    Bukkit.getPluginManager().registerEvents(new SignClick(this), this);
    Bukkit.getPluginManager().registerEvents(new HookClick(), this);
    Bukkit.getPluginManager().registerEvents(new PlayMoveEvent(this), this);
    Bukkit.getPluginManager().registerEvents(new CommandUseEvent(this), this);
    Bukkit.getPluginManager().registerEvents(new BlockClickEvent(this), this);
    Bukkit.getPluginManager().registerEvents(new PortalEvent(this),this);
    LoadDependencies.loadAll();
    Initializer initialize = new Initializer(this);
    initialize.initializeAll();
    SavePortals save = new SavePortals(this);
    save.createFile();
    LocationsFile locationsFile = new LocationsFile(this);
    locationsFile.createFile();
    cooldownTime = new HashMap<>();
    Sounds.init();
    CheckConfig check = new CheckConfig();
    usageMode = UsageMode.valueOf(this.getConfig().getString("UsageMode"));
    if (this.getConfig().getBoolean("Metrics"))
        new Metrics(this);
    if (!check.isCorrectPots()) {
        Console.send(prefix + "Config for potions is misconfigured please check the documentation on the plugin page to make sure you have configured correctly");
        Console.send(prefix +"&cPlugin will now disable");
        Bukkit.getPluginManager().disablePlugin(this);
    }
    if(!check.checkParticle()){
        Console.send(prefix +"Particle type is invalid disabling particles to stop errors");
        this.getConfig().set("DoParticles",false);
    }
    if (this.getConfig().getInt("Cost") > 0) {
        if (!setupEconomy()) {
            this.getLogger().severe("[%s] - Disabled due to no Vault dependency found!");
            Bukkit.getServer().getPluginManager().disablePlugin(this);
            return;
        }
    }
    if(PaperLib.isPaper()){
        Console.send(prefix + "&bPaper was found ! Async Teleport &aenabled&b.");
    }
    OldFormatConverter.convert();
    checkUpdate();
    getUpdates();
    Console.send("&7-----------------------------------------------");
}