Search in sources :

Example 1 with BukkitPermissionAttachmentManager

use of com.fastasyncworldedit.bukkit.BukkitPermissionAttachmentManager in project FastAsyncWorldEdit by IntellectualSites.

the class WorldEditPlugin method onLoad.

@Override
public void onLoad() {
    // FAWE start
    // This is already covered by Spigot, however, a more pesky warning with a proper explanation over "Ambiguous plugin name..." can't hurt.
    Plugin[] plugins = Bukkit.getServer().getPluginManager().getPlugins();
    for (Plugin p : plugins) {
        if (p.getName().equals("WorldEdit")) {
            LOGGER.warn("You installed WorldEdit alongside FastAsyncWorldEdit. That is unneeded and will cause unforeseen issues, " + "because FastAsyncWorldEdit already provides WorldEdit. " + "Stop your server and delete the 'worldedit-bukkit' jar from your plugins folder.");
        }
    }
    // FAWE end
    INSTANCE = this;
    // noinspection ResultOfMethodCallIgnored
    getDataFolder().mkdirs();
    WorldEdit worldEdit = WorldEdit.getInstance();
    // Setup platform
    platform = new BukkitServerInterface(this, getServer());
    worldEdit.getPlatformManager().register(platform);
    // FAWE start - Migrate from config-legacy to worldedit-config
    migrateLegacyConfig();
    // FAWE end
    // FAWE start - Modify WorldEdit config name
    config = new BukkitConfiguration(new YAMLProcessor(new File(getDataFolder(), "worldedit-config.yml"), true), this);
    // FAWE end
    // FAWE start - Setup permission attachments
    permissionAttachmentManager = new BukkitPermissionAttachmentManager(this);
    // FAWE end
    Path delChunks = Paths.get(getDataFolder().getPath(), DELCHUNKS_FILE_NAME);
    if (Files.exists(delChunks)) {
        ChunkDeleter.runFromFile(delChunks, true);
    }
    // FAWE start - Delete obsolete DummyFawe from pre 1.14 days
    if (this.getDataFolder().getParentFile().listFiles(file -> {
        if (file.getName().equals("DummyFawe.jar")) {
            file.delete();
            return true;
        }
        return false;
    }).length > 0) {
        LOGGER.warn("DummyFawe detected and automatically deleted! This file is no longer necessary.");
    }
// FAWE end
}
Also used : Path(java.nio.file.Path) WorldEdit(com.sk89q.worldedit.WorldEdit) YAMLProcessor(com.sk89q.util.yaml.YAMLProcessor) BukkitPermissionAttachmentManager(com.fastasyncworldedit.bukkit.BukkitPermissionAttachmentManager) File(java.io.File) Plugin(org.bukkit.plugin.Plugin) JavaPlugin(org.bukkit.plugin.java.JavaPlugin)

Aggregations

BukkitPermissionAttachmentManager (com.fastasyncworldedit.bukkit.BukkitPermissionAttachmentManager)1 YAMLProcessor (com.sk89q.util.yaml.YAMLProcessor)1 WorldEdit (com.sk89q.worldedit.WorldEdit)1 File (java.io.File)1 Path (java.nio.file.Path)1 Plugin (org.bukkit.plugin.Plugin)1 JavaPlugin (org.bukkit.plugin.java.JavaPlugin)1