• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SpigotTimings类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bukkit.craftbukkit.SpigotTimings的典型用法代码示例。如果您正苦于以下问题:Java SpigotTimings类的具体用法?Java SpigotTimings怎么用?Java SpigotTimings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SpigotTimings类属于org.bukkit.craftbukkit包,在下文中一共展示了SpigotTimings类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: run

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
public void run() {
    // Spigot start - Wrap custom timings on Tasks
    if (!Bukkit.getServer().getPluginManager().useTimings()) {
        task.run();
        return;
    }
    if (timings == null && this.getOwner() != null && this.isSync()) {
        timings = SpigotTimings.getPluginTaskTimings(this, period);
    }
    if (timings != null) {
        timings.startTiming();
    }
    task.run();
    if (timings != null) {
        timings.stopTiming();
    }
    // Spigot end
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:19,代码来源:CraftTask.java


示例2: aB

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
public void aB() {
    SpigotTimings.serverCommandTimer.startTiming(); // Spigot
    while (!this.j.isEmpty()) {
        ServerCommand servercommand = (ServerCommand) this.j.remove(0);

        // CraftBukkit start - ServerCommand for preprocessing
        ServerCommandEvent event = new ServerCommandEvent(this.console, servercommand.command);
        this.server.getPluginManager().callEvent(event);
        servercommand = new ServerCommand(event.getCommand(), servercommand.source);

        // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
        this.server.dispatchServerCommand(this.console, servercommand);
        // CraftBukkit end
    }
    SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:17,代码来源:DedicatedServer.java


示例3: aL

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
public void aL() {
    SpigotTimings.serverCommandTimer.startTiming(); // Spigot
    while (!this.serverCommandQueue.isEmpty()) {
        ServerCommand servercommand = (ServerCommand) this.serverCommandQueue.remove(0);

        // CraftBukkit start - ServerCommand for preprocessing
        ServerCommandEvent event = new ServerCommandEvent(console, servercommand.command);
        server.getPluginManager().callEvent(event);
        if (event.isCancelled()) continue;
        servercommand = new ServerCommand(event.getCommand(), servercommand.source);

        // this.getCommandHandler().a(servercommand.source, servercommand.command); // Called in dispatchServerCommand
        server.dispatchServerCommand(console, servercommand);
        // CraftBukkit end
    }

    SpigotTimings.serverCommandTimer.stopTiming(); // Spigot
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:19,代码来源:DedicatedServer.java


示例4: CraftTask

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
CraftTask(String timingName, final Plugin plugin, final Runnable task, final int id, final long period) {
    this.plugin = plugin;
    this.task = task;
    this.id = id;
    this.period = period;
    this.timingName = timingName == null && task == null ? "Unknown" : timingName;
    timings = this.isSync() ? SpigotTimings.getPluginTaskTimings(this, period) : null;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:9,代码来源:CraftTask.java


示例5: checkIfActive

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Checks if the entity is active for this tick.
 *
 * @param entity
 * @return
 */
public static boolean checkIfActive(Entity entity)
{
    SpigotTimings.checkIfActiveTimer.startTiming();

    boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;

    // Should this entity tick?
    if ( !isActive )
    {
        if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
        {
            // Check immunities every 20 ticks.
            if ( checkEntityImmunities( entity ) )
            {
                // Triggered some sort of immunity, give 20 full ticks before we check again.
                entity.activatedTick = MinecraftServer.currentTick + 20;
            }
            isActive = true;
        }
        // Add a little performance juice to active entities. Skip 1/4 if not immune.
    } else if ( !entity.defaultActivationState && entity.ticksExisted % 4 == 0 && !checkEntityImmunities( entity ) )
    {
        isActive = false;
    }

    // Cauldron - we check for entities in forced chunks in World.updateEntityWithOptionalForce
    // Make sure not on edge of unloaded chunk
    int x = net.minecraft.util.MathHelper.floor_double( entity.posX );
    int z = net.minecraft.util.MathHelper.floor_double( entity.posZ );
    if ( isActive && !entity.worldObj.doChunksNearChunkExist( x, 0, z, 16 ) ) {
        isActive = false;
    }

    SpigotTimings.checkIfActiveTimer.stopTiming();
    return isActive;
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:43,代码来源:ActivationRange.java


示例6: activateEntities

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world)
{
    SpigotTimings.entityActivationCheckTimer.startTiming();
    final int miscActivationRange = world.spigotConfig.miscActivationRange;
    final int animalActivationRange = world.spigotConfig.animalActivationRange;
    final int monsterActivationRange = world.spigotConfig.monsterActivationRange;

    int maxRange = Math.max( monsterActivationRange, animalActivationRange );
    maxRange = Math.max( maxRange, miscActivationRange );
    maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );

    for ( Entity player : new ArrayList<Entity>( world.players ) )
    {

        player.activatedTick = MinecraftServer.currentTick;
        growBB( maxBB, player.boundingBox, maxRange, 256, maxRange );
        growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange );
        growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange );
        growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange );

        int i = MathHelper.floor( maxBB.a / 16.0D );
        int j = MathHelper.floor( maxBB.d / 16.0D );
        int k = MathHelper.floor( maxBB.c / 16.0D );
        int l = MathHelper.floor( maxBB.f / 16.0D );

        for ( int i1 = i; i1 <= j; ++i1 )
        {
            for ( int j1 = k; j1 <= l; ++j1 )
            {
                if ( world.getWorld().isChunkLoaded( i1, j1 ) )
                {
                    activateChunkEntities( world.getChunkAt( i1, j1 ) );
                }
            }
        }
    }
    SpigotTimings.entityActivationCheckTimer.stopTiming();
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:45,代码来源:ActivationRange.java


示例7: checkIfActive

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Checks if the entity is active for this tick.
 *
 * @param entity
 * @return
 */
public static boolean checkIfActive(Entity entity)
{
    SpigotTimings.checkIfActiveTimer.startTiming();
    boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;

    // Should this entity tick?
    if ( !isActive )
    {
        if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
        {
            // Check immunities every 20 ticks.
            if ( checkEntityImmunities( entity ) )
            {
                // Triggered some sort of immunity, give 20 full ticks before we check again.
                entity.activatedTick = MinecraftServer.currentTick + 20;
            }
            isActive = true;
        }
        // Add a little performance juice to active entities. Skip 1/4 if not immune.
    } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) )
    {
        isActive = false;
    }
    int x = MathHelper.floor( entity.locX );
    int z = MathHelper.floor( entity.locZ );
    // Make sure not on edge of unloaded chunk
    if ( isActive && !entity.world.areChunksLoaded( x, 0, z, 16 ) )
    {
        isActive = false;
    }
    SpigotTimings.checkIfActiveTimer.stopTiming();
    return isActive;
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:40,代码来源:ActivationRange.java


示例8: activateEntities

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world)
{
    SpigotTimings.entityActivationCheckTimer.startTiming();
    final int miscActivationRange = world.spigotConfig.miscActivationRange;
    final int animalActivationRange = world.spigotConfig.animalActivationRange;
    final int monsterActivationRange = world.spigotConfig.monsterActivationRange;

    int maxRange = Math.max( monsterActivationRange, animalActivationRange );
    maxRange = Math.max( maxRange, miscActivationRange );
    maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );

    for ( Entity player : (List<Entity>) world.players )
    {

        player.activatedTick = MinecraftServer.currentTick;
        growBB( maxBB, player.boundingBox, maxRange, 256, maxRange );
        growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange );
        growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange );
        growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange );

        int i = MathHelper.floor( maxBB.a / 16.0D );
        int j = MathHelper.floor( maxBB.d / 16.0D );
        int k = MathHelper.floor( maxBB.c / 16.0D );
        int l = MathHelper.floor( maxBB.f / 16.0D );

        for ( int i1 = i; i1 <= j; ++i1 )
        {
            for ( int j1 = k; j1 <= l; ++j1 )
            {
                if ( world.getWorld().isChunkLoaded( i1, j1 ) )
                {
                    activateChunkEntities( world.getChunkAt( i1, j1 ) );
                }
            }
        }
    }
    SpigotTimings.entityActivationCheckTimer.stopTiming();
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:45,代码来源:ActivationRange.java


示例9: checkIfActive

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Checks if the entity is active for this tick.
 *
 * @param entity
 * @return
 */
public static boolean checkIfActive(Entity entity)
{
    SpigotTimings.checkIfActiveTimer.startTiming();
    boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;

    // Should this entity tick?
    if ( !isActive )
    {
        if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
        {
            // Check immunities every 20 ticks.
            if ( checkEntityImmunities( entity ) )
            {
                // Triggered some sort of immunity, give 20 full ticks before we check again.
                entity.activatedTick = MinecraftServer.currentTick + 20;
            }
            isActive = true;
        }
        // Add a little performance juice to active entities. Skip 1/4 if not immune.
    } else if ( !entity.defaultActivationState && entity.ticksLived % 4 == 0 && !checkEntityImmunities( entity ) )
    {
        isActive = false;
    }
    int x = MathHelper.floor( entity.locX );
    int z = MathHelper.floor( entity.locZ );
    // Make sure not on edge of unloaded chunk
    Chunk chunk = entity.world.getChunkIfLoaded( x >> 4, z >> 4 );
    if ( isActive && !( chunk != null && chunk.areNeighborsLoaded( 1 ) ) )
    {
        isActive = false;
    }
    SpigotTimings.checkIfActiveTimer.stopTiming();
    return isActive;
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:41,代码来源:ActivationRange.java


示例10: activateEntities

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world)
{
    SpigotTimings.entityActivationCheckTimer.startTiming();
    final int miscActivationRange = world.spigotConfig.miscActivationRange;
    final int animalActivationRange = world.spigotConfig.animalActivationRange;
    final int monsterActivationRange = world.spigotConfig.monsterActivationRange;

    int maxRange = Math.max( monsterActivationRange, animalActivationRange );
    maxRange = Math.max( maxRange, miscActivationRange );
    maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange );

    for ( EntityHuman player : world.players )
    {

        player.activatedTick = MinecraftServer.currentTick;
        maxBB = player.getBoundingBox().grow( maxRange, 256, maxRange );
        miscBB = player.getBoundingBox().grow( miscActivationRange, 256, miscActivationRange );
        animalBB = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange );
        monsterBB = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange );

        int i = MathHelper.floor( maxBB.a / 16.0D );
        int j = MathHelper.floor( maxBB.d / 16.0D );
        int k = MathHelper.floor( maxBB.c / 16.0D );
        int l = MathHelper.floor( maxBB.f / 16.0D );

        for ( int i1 = i; i1 <= j; ++i1 )
        {
            for ( int j1 = k; j1 <= l; ++j1 )
            {
                if ( world.getWorld().isChunkLoaded( i1, j1 ) )
                {
                    activateChunkEntities( world.getChunkAt( i1, j1 ) );
                }
            }
        }
    }
    SpigotTimings.entityActivationCheckTimer.stopTiming();
}
 
开发者ID:bergerkiller,项目名称:SpigotSource,代码行数:45,代码来源:ActivationRange.java


示例11: activateEntities

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Find what entities are in range of the players in the world and set
 * active if in range.
 *
 * @param world
 */
public static void activateEntities(World world)
{
    SpigotTimings.entityActivationCheckTimer.startTiming();
    // Cauldron start - proxy world support
    final int miscActivationRange = world.getSpigotConfig().miscActivationRange;
    final int animalActivationRange = world.getSpigotConfig().animalActivationRange;
    final int monsterActivationRange = world.getSpigotConfig().monsterActivationRange;
    // Cauldron end

    int maxRange = Math.max( monsterActivationRange, animalActivationRange );
    maxRange = Math.max( maxRange, miscActivationRange );
    maxRange = Math.min( ( world.getSpigotConfig().viewDistance << 4 ) - 8, maxRange ); // Cauldron

    for ( Entity player : new ArrayList<Entity>( world.playerEntities ) )
    {

        player.activatedTick = MinecraftServer.currentTick;
        growBB( maxBB, player.boundingBox, maxRange, 256, maxRange );
        growBB( miscBB, player.boundingBox, miscActivationRange, 256, miscActivationRange );
        growBB( animalBB, player.boundingBox, animalActivationRange, 256, animalActivationRange );
        growBB( monsterBB, player.boundingBox, monsterActivationRange, 256, monsterActivationRange );

        int i = MathHelper.floor_double( maxBB.minX / 16.0D );
        int j = MathHelper.floor_double( maxBB.maxX / 16.0D );
        int k = MathHelper.floor_double( maxBB.minZ / 16.0D );
        int l = MathHelper.floor_double( maxBB.maxZ / 16.0D );

        for ( int i1 = i; i1 <= j; ++i1 )
        {
            for ( int j1 = k; j1 <= l; ++j1 )
            {
                if ( world.getWorld().isChunkLoaded( i1, j1 ) )
                {
                    activateChunkEntities( world.getChunkFromChunkCoords( i1, j1 ) );
                }
            }
        }
    }
    SpigotTimings.entityActivationCheckTimer.stopTiming();
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:47,代码来源:ActivationRange.java


示例12: checkIfActive

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
/**
 * Checks if the entity is active for this tick.
 *
 * @param entity
 * @return
 */
public static boolean checkIfActive(Entity entity)
{
    SpigotTimings.checkIfActiveTimer.startTiming();

    boolean isActive = entity.activatedTick >= MinecraftServer.currentTick || entity.defaultActivationState;

    // Should this entity tick?
    if ( !isActive )
    {
        if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 )
        {
            // Check immunities every 20 ticks.
            if ( checkEntityImmunities( entity ) )
            {
                // Triggered some sort of immunity, give 20 full ticks before we check again.
                entity.activatedTick = MinecraftServer.currentTick + 20;
            }
            isActive = true;
        }
        // Add a little performance juice to active entities. Skip 1/4 if not immune.
    } else if ( !entity.defaultActivationState && entity.ticksExisted % 4 == 0 && !checkEntityImmunities( entity ) )
    {
        isActive = false;
    }

    // Cauldron - we check for entities in forced chunks in World.updateEntityWithOptionalForce
    // Make sure not on edge of unloaded chunk
    int x = net.minecraft.util.MathHelper.floor_double( entity.posX );
    int z = net.minecraft.util.MathHelper.floor_double( entity.posZ );
    
    if ( isActive && !(entity.worldObj.isActiveBlockCoord(x, z) || entity.worldObj.doChunksNearChunkExist( x, 0, z, 16 ) )) {
        isActive = false;
    }
    
    if(entity instanceof EntityFireworkRocket || !entity.isAddedToChunk()) // Force continued activation for teleporting entities
    {
    	isActive = true;
    }
    SpigotTimings.checkIfActiveTimer.stopTiming();
    return isActive;
}
 
开发者ID:CyberdyneCC,项目名称:Thermos,代码行数:48,代码来源:ActivationRange.java


示例13: run

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
public void run() {
    try {
        if (this.init()) {
            // Spigot start
            for (long lastTick = 0L; this.isRunning; this.R = true) {
                long curTime = System.nanoTime();
                long wait = TICK_TIME - (curTime - lastTick) - catchupTime;
                if (wait > 0) {
                    Thread.sleep(wait / 1000000);
                    catchupTime = 0;
                    continue;
                } else {
                    catchupTime = Math.min(TICK_TIME * TPS, Math.abs(wait));
                }
                currentTPS = (currentTPS * 0.95) + (1E9 / (curTime - lastTick) * 0.05);
                lastTick = curTime;
                MinecraftServer.currentTick++;
                SpigotTimings.serverTickTimer.startTiming();
                this.s();
                SpigotTimings.serverTickTimer.stopTiming();
                org.spigotmc.CustomTimingsHandler.tick();
                org.spigotmc.WatchdogThread.tick();
            }
            // Spigot end
        } else {
            this.a((CrashReport) null);
        }
    } catch (Throwable throwable) {
        throwable.printStackTrace();
        this.getLogger().severe("Encountered an unexpected exception " + throwable.getClass().getSimpleName(), throwable);
        CrashReport crashreport = null;

        if (throwable instanceof ReportedException) {
            crashreport = this.b(((ReportedException) throwable).a());
        } else {
            crashreport = this.b(new CrashReport("Exception in server tick loop", throwable));
        }

        File file1 = new File(new File(this.q(), "crash-reports"), "crash-" + (new SimpleDateFormat("yyyy-MM-dd_HH.mm.ss")).format(new Date()) + "-server.txt");

        if (crashreport.a(file1, this.getLogger())) {
            this.getLogger().severe("This crash report has been saved to: " + file1.getAbsolutePath());
        } else {
            this.getLogger().severe("We were unable to save this crash report to disk.");
        }

        this.a(crashreport);
    } finally {
        try {
            org.spigotmc.WatchdogThread.doStop();
            this.stop();
            this.isStopped = true;
        } catch (Throwable throwable1) {
            throwable1.printStackTrace();
        } finally {
            // CraftBukkit start - Restore terminal to original settings
            try {
                this.reader.getTerminal().restore();
            } catch (Exception e) {
            }
            // CraftBukkit end
            this.r();
        }
    }
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:66,代码来源:MinecraftServer.java


示例14: World

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, IConsoleLogManager iconsolelogmanager, ChunkGenerator gen, org.bukkit.World.Environment env) {
    this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot
    this.generator = gen;
    this.world = new CraftWorld((WorldServer) this, gen, env);
    this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
    this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
    // CraftBukkit end
    // Spigot start
    this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
    this.chunkTickList = new gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
    this.chunkTickList.setAutoCompactionFactor( 0 );
    // Spigot end

    this.O = this.random.nextInt(12000);
    this.H = new int['\u8000'];
    this.dataManager = idatamanager;
    this.methodProfiler = methodprofiler;
    this.worldMaps = new WorldMapCollection(idatamanager);
    this.logAgent = iconsolelogmanager;
    this.worldData = idatamanager.getWorldData();
    if (worldprovider != null) {
        this.worldProvider = worldprovider;
    } else if (this.worldData != null && this.worldData.j() != 0) {
        this.worldProvider = WorldProvider.byDimension(this.worldData.j());
    } else {
        this.worldProvider = WorldProvider.byDimension(0);
    }

    if (this.worldData == null) {
        this.worldData = new WorldData(worldsettings, s);
    } else {
        this.worldData.setName(s);
    }

    this.worldProvider.a(this);
    this.chunkProvider = this.j();
    if (!this.worldData.isInitialized()) {
        try {
            this.a(worldsettings);
        } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.a(throwable, "Exception initializing level");

            try {
                this.a(crashreport);
            } catch (Throwable throwable1) {
                ;
            }

            throw new ReportedException(crashreport);
        }

        this.worldData.d(true);
    }

    VillageCollection villagecollection = (VillageCollection) this.worldMaps.get(VillageCollection.class, "villages");

    if (villagecollection == null) {
        this.villages = new VillageCollection(this);
        this.worldMaps.a("villages", this.villages);
    } else {
        this.villages = villagecollection;
        this.villages.a(this);
    }

    this.A();
    this.a();

    this.getServer().addWorld(this.world); // CraftBukkit
    timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot
}
 
开发者ID:AlmuraDev,项目名称:Almura-Server,代码行数:71,代码来源:World.java


示例15: u

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
protected void u() throws ExceptionWorldConflict { // CraftBukkit - added throws
    SpigotTimings.serverTickTimer.startTiming(); // Spigot
    long i = System.nanoTime();

    ++this.ticks;
    if (this.R) {
        this.R = false;
        this.methodProfiler.a = true;
        this.methodProfiler.a();
    }

    this.methodProfiler.a("root");
    this.v();
    if (i - this.V >= 5000000000L) {
        this.V = i;
        this.q.setPlayerSample(new ServerPingPlayerSample(this.D(), this.C()));
        GameProfile[] agameprofile = new GameProfile[Math.min(this.C(), 12)];
        int j = MathHelper.nextInt(this.r, 0, this.C() - agameprofile.length);

        for (int k = 0; k < agameprofile.length; ++k) {
            agameprofile[k] = ((EntityPlayer) this.u.players.get(j + k)).getProfile();
        }

        Collections.shuffle(Arrays.asList(agameprofile));
        this.q.b().a(agameprofile);
    }

    if ((this.autosavePeriod > 0) && ((this.ticks % this.autosavePeriod) == 0)) { // CraftBukkit
        SpigotTimings.worldSaveTimer.startTiming(); // Spigot
        this.methodProfiler.a("save");
        this.u.savePlayers();
        // Spigot Start
        // We replace this with saving each individual world as this.saveChunks(...) is broken,
        // and causes the main thread to sleep for random amounts of time depending on chunk activity
        server.playerCommandState = true;
        for (World world : worlds) {
            world.getWorld().save();
        }
        server.playerCommandState = false;
        // this.saveChunks(true);
        // Spigot End
        this.methodProfiler.b();
        SpigotTimings.worldSaveTimer.stopTiming(); // Spigot
    }

    this.methodProfiler.a("tallying");
    this.g[this.ticks % 100] = System.nanoTime() - i;
    this.methodProfiler.b();
    this.methodProfiler.a("snooper");
    if (getSnooperEnabled() && !this.l.d() && this.ticks > 100) { // Spigot
        this.l.a();
    }

    if (getSnooperEnabled() && this.ticks % 6000 == 0) { // Spigot
        this.l.b();
    }

    this.methodProfiler.b();
    this.methodProfiler.b();
    org.spigotmc.WatchdogThread.tick(); // Spigot
    SpigotTimings.serverTickTimer.stopTiming(); // Spigot
    org.spigotmc.CustomTimingsHandler.tick(); // Spigot
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:64,代码来源:MinecraftServer.java


示例16: World

import org.bukkit.craftbukkit.SpigotTimings; //导入依赖的package包/类
public World(IDataManager idatamanager, String s, WorldSettings worldsettings, WorldProvider worldprovider, MethodProfiler methodprofiler, ChunkGenerator gen, org.bukkit.World.Environment env) {
    this.spigotConfig = new org.spigotmc.SpigotWorldConfig( s ); // Spigot
    this.generator = gen;
    this.world = new CraftWorld((WorldServer) this, gen, env);
    this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit
    this.ticksPerMonsterSpawns = this.getServer().getTicksPerMonsterSpawns(); // CraftBukkit
    // CraftBukkit end
    // Spigot start
    this.chunkTickRadius = (byte) ( ( this.getServer().getViewDistance() < 7 ) ? this.getServer().getViewDistance() : 7 );
    this.chunkTickList = new net.minecraft.util.gnu.trove.map.hash.TLongShortHashMap( spigotConfig.chunksPerTick * 5, 0.7f, Long.MIN_VALUE, Short.MIN_VALUE );
    this.chunkTickList.setAutoCompactionFactor( 0 );
    // Spigot end

    this.K = this.random.nextInt(12000);
    this.allowMonsters = true;
    this.allowAnimals = true;
    this.L = new ArrayList();
    this.I = new int['\u8000'];
    this.dataManager = idatamanager;
    this.methodProfiler = methodprofiler;
    this.worldMaps = new PersistentCollection(idatamanager);
    this.worldData = idatamanager.getWorldData();
    if (worldprovider != null) {
        this.worldProvider = worldprovider;
    } else if (this.worldData != null && this.worldData.j() != 0) {
        this.worldProvider = WorldProvider.byDimension(this.worldData.j());
    } else {
        this.worldProvider = WorldProvider.byDimension(0);
    }

    if (this.worldData == null) {
        this.worldData = new WorldData(worldsettings, s);
    } else {
        this.worldData.setName(s);
    }

    this.worldProvider.a(this);
    this.chunkProvider = this.j();
    timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings
    if (!this.worldData.isInitialized()) {
        try {
            this.a(worldsettings);
        } catch (Throwable throwable) {
            CrashReport crashreport = CrashReport.a(throwable, "Exception initializing level");

            try {
                this.a(crashreport);
            } catch (Throwable throwable1) {
                ;
            }

            throw new ReportedException(crashreport);
        }

        this.worldData.d(true);
    }

    PersistentVillage persistentvillage = (PersistentVillage) this.worldMaps.get(PersistentVillage.class, "villages");

    if (persistentvillage == null) {
        this.villages = new PersistentVillage(this);
        this.worldMaps.a("villages", this.villages);
    } else {
        this.villages = persistentvillage;
        this.villages.a(this);
    }

    this.B();
    this.a();

    this.getServer().addWorld(this.world); // CraftBukkit
}
 
开发者ID:pvginkel,项目名称:Tweakkit-Server,代码行数:73,代码来源:World.java



注:本文中的org.bukkit.craftbukkit.SpigotTimings类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RangeSlicesQuery类代码示例发布时间:2022-05-22
下一篇:
Java NodeStatusUpdaterImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap