當前位置: 首頁>>代碼示例>>Java>>正文


Java BukkitImplAdapter類代碼示例

本文整理匯總了Java中com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter的典型用法代碼示例。如果您正苦於以下問題:Java BukkitImplAdapter類的具體用法?Java BukkitImplAdapter怎麽用?Java BukkitImplAdapter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BukkitImplAdapter類屬於com.sk89q.worldedit.bukkit.adapter包,在下文中一共展示了BukkitImplAdapter類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: checkWorldEditAdapter

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public boolean checkWorldEditAdapter() {
    String className = "com.sk89q.worldedit.bukkit.adapter.impl.";
    try {
        Class<?> cls = Class.forName(className + "Spigot_" + getVersion());
        if (!BukkitImplAdapter.class.isAssignableFrom(cls)) {
            this.plugin.getLogger().warning("WARN: WorldEdit has no valid bukkit adapter for this server version!");
            this.plugin.getLogger().warning(
                    "WARN: All Snapshot actions like /land save, /land restore and /land reset are disabled!");
            this.plugin.getLogger().warning("WARN: Please update your worldedit for full support!");
            return false;
        }
    } catch (ClassNotFoundException e) {
        this.plugin.getLogger().warning("WARN: WorldEdit has no valid bukkit adapter for this server version!");
        this.plugin.getLogger()
                .warning("WARN: All Snapshot actions like /land save or /land restore are disabled!");
        this.plugin.getLogger().warning("WARN: Please update your worldedit for full support!");
        return false;
    }
    return true;
}
 
開發者ID:MineGaming,項目名稱:cubit,代碼行數:21,代碼來源:WorldEditFunctions.java

示例2: AsyncWorld

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
/**
 * @deprecated use {@link #wrap(org.bukkit.World)} instead
 * @param parent
 * @param queue
 */
@Deprecated
public AsyncWorld(World parent, FaweQueue queue) {
    super(queue);
    this.parent = parent;
    this.queue = queue;
    if (queue instanceof BukkitQueue_0) {
        this.adapter = (BukkitImplAdapter) ((BukkitQueue_0) queue).getAdapter();
    } else {
        try {
            WorldEditPlugin instance = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
            Field fieldAdapter = WorldEditPlugin.class.getDeclaredField("bukkitAdapter");
            fieldAdapter.setAccessible(true);
            this.adapter = (BukkitImplAdapter) fieldAdapter.get(instance);
        } catch (Throwable e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:24,代碼來源:AsyncWorld.java

示例3: getBiomeArray

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
@Override
public byte[] getBiomeArray() {
    if (!hasBiomes) return null;
    BukkitImplAdapter adapter = getParent().getAdapter();
    byte[] biomes = new byte[256];
    int index = 0;
    for (int z = 0; z < 16; z++) {
        for (int x = 0; x < 16; x++, index++) {
            Biome biome = snapshot.getBiome(x, z);
            biomes[index] = (byte) adapter.getBiomeId(biome);
        }
    }
    return biomes;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:15,代碼來源:BukkitChunk_All_ReadonlySnapshot.java

示例4: toNative

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public static Tag toNative(Object tag) {
    BukkitImplAdapter adapter = getAdapter();
    if (adapter == null) {
        if (backupAdaper != null) return backupAdaper.toNative(tag);
        return null;
    }
    try {
        return (Tag) methodToNative.invoke(adapter, tag);
    } catch (InvocationTargetException | IllegalAccessException e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:14,代碼來源:BukkitQueue_0.java

示例5: fromNative

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public static Object fromNative(Tag tag) {
    BukkitImplAdapter adapter = getAdapter();
    if (adapter == null) {
        if (backupAdaper != null) return backupAdaper.fromNative(tag);
        return null;
    }
    try {
        return methodFromNative.invoke(adapter, tag);
    } catch (InvocationTargetException | IllegalAccessException e) {
        e.printStackTrace();
    }
    return null;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:14,代碼來源:BukkitQueue_0.java

示例6: setupAdapter

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public static void setupAdapter(BukkitImplAdapter adapter) {
    try {
        if (adapter == null && setupAdapter == (setupAdapter = true)) {
            return;
        }
        WorldEditPlugin instance = (WorldEditPlugin) Bukkit.getPluginManager().getPlugin("WorldEdit");
        Field fieldAdapter = WorldEditPlugin.class.getDeclaredField("bukkitAdapter");
        fieldAdapter.setAccessible(true);
        if (adapter != null) {
            BukkitQueue_0.adapter = adapter;
            fieldAdapter.set(instance, adapter);
        } else {
            BukkitQueue_0.adapter = adapter = (BukkitImplAdapter) fieldAdapter.get(instance);
            if (adapter == null) {
                BukkitQueue_0.adapter = adapter = new FaweAdapter_All();
                fieldAdapter.set(instance, adapter);
            }
        }
        if (adapter != null) {
            for (Method method : adapter.getClass().getDeclaredMethods()) {
                switch (method.getName()) {
                    case "toNative":
                        methodToNative = method;
                        methodToNative.setAccessible(true);
                        break;
                    case "fromNative":
                        methodFromNative = method;
                        methodFromNative.setAccessible(true);
                        break;
                }
            }
        }
        return;
    } catch (Throwable ignore) {
        ignore.printStackTrace();
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:38,代碼來源:BukkitQueue_0.java

示例7: getBlock

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
@Override
public BaseBlock getBlock(Vector position) {
    BukkitImplAdapter adapter = BukkitQueue_0.getAdapter();
    if (adapter != null) {
        return adapter.getBlock(adapt(getWorld(), position));
    } else {
        Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
        return new BaseBlock(bukkitBlock.getTypeId(), bukkitBlock.getData());
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:11,代碼來源:BukkitWorld.java

示例8: setBlock

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
@Override
public boolean setBlock(Vector position, BaseBlock block, boolean notifyAndLight) throws WorldEditException {
    BukkitImplAdapter adapter = BukkitQueue_0.getAdapter();
    if (adapter != null) {
        return adapter.setBlock(adapt(getWorld(), position), block, notifyAndLight);
    } else {
        Block bukkitBlock = getWorld().getBlockAt(position.getBlockX(), position.getBlockY(), position.getBlockZ());
        return bukkitBlock.setTypeIdAndData(block.getType(), (byte) block.getData(), notifyAndLight);
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:11,代碼來源:BukkitWorld.java

示例9: getBiome

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
@Override
public BaseBiome getBiome(Vector2D position) {
    BukkitImplAdapter adapter = BukkitQueue_0.getAdapter();
    if (adapter != null) {
        int id = adapter.getBiomeId(getWorld().getBiome(position.getBlockX(), position.getBlockZ()));
        return new BaseBiome(id);
    } else {
        return new BaseBiome(0);
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:11,代碼來源:BukkitWorld.java

示例10: setBiome

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
    BukkitImplAdapter adapter = BukkitQueue_0.getAdapter();
    if (adapter != null) {
        Biome bukkitBiome = adapter.getBiome(biome.getId());
        getWorld().setBiome(position.getBlockX(), position.getBlockZ(), bukkitBiome);
        return true;
    } else {
        return false;
    }
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:12,代碼來源:BukkitWorld.java

示例11: getAdapter

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public BukkitImplAdapter getAdapter() {
    return adapter;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:4,代碼來源:AsyncWorld.java

示例12: getAdapter

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public static BukkitImplAdapter getAdapter() {
    if (adapter == null) setupAdapter(null);
    if (adapter == null) return backupAdaper;
    return adapter;
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:6,代碼來源:BukkitQueue_0.java

示例13: getAdapter

import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
private static BukkitImplAdapter getAdapter() {
    return BukkitQueue_0.getAdapter();
}
 
開發者ID:boy0001,項目名稱:FastAsyncWorldedit,代碼行數:4,代碼來源:BukkitWorld.java


注:本文中的com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。