本文整理匯總了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;
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
}
示例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());
}
}
示例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);
}
}
示例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);
}
}
示例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;
}
}
示例11: getAdapter
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
public BukkitImplAdapter getAdapter() {
return adapter;
}
示例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;
}
示例13: getAdapter
import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; //導入依賴的package包/類
private static BukkitImplAdapter getAdapter() {
return BukkitQueue_0.getAdapter();
}