本文整理匯總了Java中org.bukkit.event.world.WorldUnloadEvent.isCancelled方法的典型用法代碼示例。如果您正苦於以下問題:Java WorldUnloadEvent.isCancelled方法的具體用法?Java WorldUnloadEvent.isCancelled怎麽用?Java WorldUnloadEvent.isCancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.bukkit.event.world.WorldUnloadEvent
的用法示例。
在下文中一共展示了WorldUnloadEvent.isCancelled方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: unloadWorld
import org.bukkit.event.world.WorldUnloadEvent; //導入方法依賴的package包/類
@Override
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
}
net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worlds.contains(handle))) {
return false;
}
if (handle.playerEntities.size() > 0) {
return false;
}
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
pluginManager.callEvent(e);
if (e.isCancelled()) {
return false;
}
if (save) {
try {
handle.saveAllChunks(true, null);
handle.flush();
WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
getPluginManager().callEvent(event);
} catch (net.minecraft.world.MinecraftException ex) {
getLogger().log(Level.SEVERE, null, ex);
FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, "Failed to save world " + handle.getWorld().getName() + " while unloading it.");
}
}
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(handle)); // Cauldron - fire unload event before removing world
worlds.remove(world.getName().toLowerCase());
DimensionManager.setWorld(handle.provider.dimensionId, null); // Cauldron - remove world from DimensionManager
return true;
}
示例2: unloadWorld
import org.bukkit.event.world.WorldUnloadEvent; //導入方法依賴的package包/類
@Override
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
}
WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worlds.contains(handle))) {
return false;
}
if (!(handle.dimension > 1)) {
return false;
}
if (handle.players.size() > 0) {
return false;
}
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
pluginManager.callEvent(e);
if (e.isCancelled()) {
return false;
}
if (save) {
try {
handle.save(true, null);
handle.saveLevel();
} catch (ExceptionWorldConflict ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}
worlds.remove(world.getName().toLowerCase());
console.worlds.remove(console.worlds.indexOf(handle));
return true;
}
示例3: unloadWorld
import org.bukkit.event.world.WorldUnloadEvent; //導入方法依賴的package包/類
@Override
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
}
net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worlds.contains(handle))) {
return false;
}
if (handle.playerEntities.size() > 0) {
return false;
}
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
pluginManager.callEvent(e);
if (e.isCancelled()) {
return false;
}
if (save) {
try {
handle.saveAllChunks(true, null);
handle.flush();
WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
getPluginManager().callEvent(event);
} catch (net.minecraft.world.MinecraftException ex) {
getLogger().log(Level.SEVERE, null, ex);
FMLLog.log(org.apache.logging.log4j.Level.ERROR, ex, "Failed to save world " + handle.getWorld().getName() + " while unloading it.");
}
}
MinecraftForge.EVENT_BUS.post(new WorldEvent.Unload(handle)); // Cauldron - fire unload event before removing world
worlds.remove(world.getName().toLowerCase(java.util.Locale.ROOT));
DimensionManager.setWorld(handle.provider.dimensionId, null); // Cauldron - remove world from DimensionManager
return true;
}
示例4: unloadWorld
import org.bukkit.event.world.WorldUnloadEvent; //導入方法依賴的package包/類
@Override
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
}
WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worlds.contains(handle))) {
return false;
}
if (!(handle.dimension > 1)) {
return false;
}
if (handle.players.size() > 0) {
return false;
}
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
pluginManager.callEvent(e);
if (e.isCancelled()) {
return false;
}
if (save) {
try {
handle.save(true, null);
handle.saveLevel();
WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
getPluginManager().callEvent(event);
} catch (ExceptionWorldConflict ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}
worlds.remove(world.getName().toLowerCase());
console.worlds.remove(console.worlds.indexOf(handle));
return true;
}
示例5: unloadWorld
import org.bukkit.event.world.WorldUnloadEvent; //導入方法依賴的package包/類
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
}
WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worlds.contains(handle))) {
return false;
}
if (!(handle.dimension > 1)) {
return false;
}
if (handle.players.size() > 0) {
return false;
}
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
pluginManager.callEvent(e);
if (e.isCancelled()) {
return false;
}
if (save) {
try {
handle.save(true, null);
handle.saveLevel();
WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
getPluginManager().callEvent(event);
} catch (ExceptionWorldConflict ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}
worlds.remove(world.getName().toLowerCase());
console.worlds.remove(console.worlds.indexOf(handle));
return true;
}
示例6: unloadWorld
import org.bukkit.event.world.WorldUnloadEvent; //導入方法依賴的package包/類
public boolean unloadWorld(World world, boolean save) {
if (world == null) {
return false;
}
net.minecraft.world.WorldServer handle = ((CraftWorld) world).getHandle();
if (!(console.worlds.contains(handle))) {
return false;
}
if (!(handle.dimension > 1)) {
return false;
}
if (handle.field_73010_i.size() > 0) {
return false;
}
WorldUnloadEvent e = new WorldUnloadEvent(handle.getWorld());
pluginManager.callEvent(e);
if (e.isCancelled()) {
return false;
}
if (save) {
try {
handle.func_73044_a(true, (net.minecraft.util.IProgressUpdate) null);
handle.func_73041_k();
WorldSaveEvent event = new WorldSaveEvent(handle.getWorld());
getPluginManager().callEvent(event);
} catch (net.minecraft.world.MinecraftException ex) {
getLogger().log(Level.SEVERE, null, ex);
}
}
worlds.remove(world.getName().toLowerCase());
console.worlds.remove(console.worlds.indexOf(handle));
return true;
}