本文整理汇总了Java中org.bukkit.event.world.ChunkUnloadEvent.isCancelled方法的典型用法代码示例。如果您正苦于以下问题:Java ChunkUnloadEvent.isCancelled方法的具体用法?Java ChunkUnloadEvent.isCancelled怎么用?Java ChunkUnloadEvent.isCancelled使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.world.ChunkUnloadEvent
的用法示例。
在下文中一共展示了ChunkUnloadEvent.isCancelled方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onChunkUnload(ChunkUnloadEvent event)
{
if(!event.isCancelled())
{
Chunk chunk = event.getChunk();
for(Machine machine : SQTechBase.machines)
{
if(machine.getMachineType() instanceof Harvester)
{
if(machine.getGUIBlock().getLocation().getChunk() == chunk)
{
main.setInactive(machine);
machine.data.put("blocked", false);
}
}
}
}
}
示例2: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST)
public void onChunkUnload(ChunkUnloadEvent event)
{
if(!event.isCancelled())
{
Chunk chunk = event.getChunk();
for(Machine machine : SQTechBase.machines)
{
if(machine.getMachineType().name == "Drill")
{
if(machine.getGUIBlock().getLocation().getChunk() == chunk)
{
machine.data.put("isActive", false);
machine.data.put("blocked", false);
}
}
}
}
}
示例3: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
@HookHandler(priority = Priority.CRITICAL, ignoreCanceled = true)
public void onChunkUnload(final ChunkUnloadHook hook) {
ChunkUnloadEvent event =
new ChunkUnloadEvent(new CanaryChunk(hook.getChunk(), new CanaryWorld(hook.getWorld())));
event.setCancelled(hook.isCanceled());
server.getPluginManager().callEvent(event);
if (event.isCancelled()) {
hook.setCanceled();
}
}
示例4: unloadChunks
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
public boolean unloadChunks() {
if (!this.world.savingDisabled) {
// CraftBukkit start
Server server = this.world.getServer();
for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); i++) {
long chunkcoordinates = this.unloadQueue.popFirst();
Chunk chunk = this.chunks.get(chunkcoordinates);
if (chunk == null) continue;
// Almura - Remove the chunk from cache if it is unloaded
Chunk result = world.lastChunkAccessed;
if (result != null && result.x == chunk.x && result.z == chunk.z) {
world.lastChunkAccessed = null;
}
// Almura end
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
// this.unloadQueue.remove(integer);
this.chunks.remove(chunkcoordinates); // CraftBukkit
}
}
// CraftBukkit end
if (this.e != null) {
this.e.a();
}
}
return this.chunkProvider.unloadChunks();
}
示例5: unloadChunks
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
public boolean unloadChunks() {
if (!this.world.savingDisabled) {
// CraftBukkit start
Server server = this.world.getServer();
for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); i++) {
long chunkcoordinates = this.unloadQueue.popFirst();
Chunk chunk = this.chunks.get(chunkcoordinates);
if (chunk == null) continue;
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
// this.unloadQueue.remove(integer);
this.chunks.remove(chunkcoordinates); // CraftBukkit
}
}
// CraftBukkit end
if (this.e != null) {
this.e.a();
}
}
return this.chunkProvider.unloadChunks();
}
示例6: onChunkUnload
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
@EventHandler
public void onChunkUnload(ChunkUnloadEvent event) {
if (event.isCancelled()) return;
Chunk chunk = event.getChunk();
List<Frame> frames = this.manager.getFramesInChunk(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
for (Frame frame : frames) {
frame.setEntity(null);
}
}
示例7: unloadChunks
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
public boolean unloadChunks() {
if (!this.world.savingDisabled) {
// CraftBukkit start
Server server = this.world.getServer();
for (int i = 0; i < 100 && !this.unloadQueue.isEmpty(); i++) {
long chunkcoordinates = this.unloadQueue.popFirst();
Chunk chunk = this.chunks.get(chunkcoordinates);
if (chunk == null) continue;
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled()) {
if (chunk != null) {
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
this.chunks.remove(chunkcoordinates); // CraftBukkit
}
// this.unloadQueue.remove(olong);
// this.chunks.remove(olong.longValue());
// Update neighbor counts
for (int x = -2; x < 3; x++) {
for (int z = -2; z < 3; z++) {
if (x == 0 && z == 0) {
continue;
}
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
}
}
}
}
}
// CraftBukkit end
if (this.f != null) {
this.f.a();
}
}
return this.chunkProvider.unloadChunks();
}
示例8: unloadQueuedChunks
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
public boolean unloadQueuedChunks()
{
if (!this.worldObj.levelSaving)
{
// Cauldron start - remove any chunk that has a ticket associated with it
if (!this.chunksToUnload.isEmpty())
{
for (ChunkCoordIntPair forcedChunk : this.worldObj.getPersistentChunks().keys())
{
this.chunksToUnload.remove(forcedChunk.chunkXPos, forcedChunk.chunkZPos);
}
}
// Cauldron end
// CraftBukkit start
Server server = this.worldObj.getServer();
for (int i = 0; i < 100 && !this.chunksToUnload.isEmpty(); i++)
{
long chunkcoordinates = this.chunksToUnload.popFirst();
Chunk chunk = this.loadedChunkHashMap.get(chunkcoordinates);
if (chunk == null)
{
continue;
}
// Cauldron static - check if the chunk was accessed recently and keep it loaded if there are players in world
/*if (!shouldUnloadChunk(chunk) && this.worldObj.playerEntities.size() > 0)
{
CauldronHooks.logChunkUnload(this, chunk.xPosition, chunk.zPosition, "** Chunk kept from unloading due to recent activity");
continue;
}*/
// Cauldron end
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
server.getPluginManager().callEvent(event);
if (!event.isCancelled())
{
CauldronHooks.logChunkUnload(this, chunk.xPosition, chunk.zPosition, "Unloading Chunk at");
chunk.onChunkUnload();
this.safeSaveChunk(chunk);
this.safeSaveExtraChunkData(chunk);
// this.unloadQueue.remove(olong);
this.loadedChunkHashMap.remove(chunkcoordinates); // CraftBukkit
this.loadedChunks.remove(chunk); // Cauldron - vanilla compatibility
ForgeChunkManager.putDormantChunk(chunkcoordinates, chunk);
if(this.loadedChunkHashMap.size() == 0 && ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !DimensionManager.shouldLoadSpawn(this.worldObj.provider.dimensionId)){
DimensionManager.unloadWorld(this.worldObj.provider.dimensionId);
return currentChunkProvider.unloadQueuedChunks();
}
}
}
// CraftBukkit end
if (this.currentChunkLoader != null)
{
this.currentChunkLoader.chunkTick();
}
}
return this.currentChunkProvider.unloadQueuedChunks();
}
示例9: unloadChunks
import org.bukkit.event.world.ChunkUnloadEvent; //导入方法依赖的package包/类
public boolean unloadChunks() {
if (!this.world.savingDisabled) {
if (!this.unloadQueue.isEmpty()) {
Iterator iterator = this.unloadQueue.iterator();
for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove()) {
Long olong = (Long) iterator.next();
Chunk chunk = (Chunk) this.chunks.get(olong);
if (chunk != null && chunk.d) {
// CraftBukkit start
ChunkUnloadEvent event = new ChunkUnloadEvent(chunk.bukkitChunk);
this.world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
continue;
}
// Update neighbor counts
for (int x = -2; x < 3; x++) {
for (int z = -2; z < 3; z++) {
if (x == 0 && z == 0) {
continue;
}
Chunk neighbor = this.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
if (neighbor != null) {
neighbor.setNeighborUnloaded(-x, -z);
chunk.setNeighborUnloaded(x, z);
}
}
}
// CraftBukkit end
chunk.removeEntities();
this.saveChunk(chunk);
this.saveChunkNOP(chunk);
this.chunks.remove(olong);
++i;
}
}
}
this.chunkLoader.a();
}
return false;
}