MinecraftTimings

This library lets Bukkit Plugin developers SAFELY add Timings support to their plugin.

License

License

Categories

Categories

Net Minecraft Business Logic Libraries
GroupId

GroupId

net.gmcbm.dependencies
ArtifactId

ArtifactId

minecraft-timings
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

jar
Description

Description

MinecraftTimings
This library lets Bukkit Plugin developers SAFELY add Timings support to their plugin.
Project URL

Project URL

https://github.com/gmcbm-backup/minecraft-timings
Project Organization

Project Organization

Global Minecraft Ban Manager
Source Code Management

Source Code Management

https://github.com/gmcbm-backup/minecraft-timings

Download minecraft-timings

How to add to project

<!-- https://jarcasting.com/artifacts/net.gmcbm.dependencies/minecraft-timings/ -->
<dependency>
    <groupId>net.gmcbm.dependencies</groupId>
    <artifactId>minecraft-timings</artifactId>
    <version>1.0.4</version>
</dependency>
// https://jarcasting.com/artifacts/net.gmcbm.dependencies/minecraft-timings/
implementation 'net.gmcbm.dependencies:minecraft-timings:1.0.4'
// https://jarcasting.com/artifacts/net.gmcbm.dependencies/minecraft-timings/
implementation ("net.gmcbm.dependencies:minecraft-timings:1.0.4")
'net.gmcbm.dependencies:minecraft-timings:jar:1.0.4'
<dependency org="net.gmcbm.dependencies" name="minecraft-timings" rev="1.0.4">
  <artifact name="minecraft-timings" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.gmcbm.dependencies', module='minecraft-timings', version='1.0.4')
)
libraryDependencies += "net.gmcbm.dependencies" % "minecraft-timings" % "1.0.4"
[net.gmcbm.dependencies/minecraft-timings "1.0.4"]

Dependencies

provided (2)

Group / Artifact Type Version
com.google.code.findbugs : jsr305 jar 3.0.2
com.destroystokyo.paper » paper-api jar 1.11.2-R0.1-SNAPSHOT

Project Modules

There are no modules declared in this project.

Minecraft Timings Library

Build status (Travis) Build status (Jenkins) Github last commit date Codecov Code Climate maintainability Snyk Vulnerabilities for GitHub Repo License Maven Central


This library lets Bukkit Plugin developers SAFELY add Timings support to their plugin.

There are 2 versions of Timings

  • V1: Used by Spigot. Developed by Aikar and labeled "Spigot Timings"
  • V2: Relabeled "Minecraft Timings", and supported by many various server software products.

Timings v2 added a proper API, however implementing it meant that your plugin would REQUIRE Paper, or else things would blow up around Timings.

This library will safely analyze the current environment, and load an appropriate timings integration according to what is available.

If using on CraftBukkit, or older versions of Spigot before Timings got added, then a "no op" Timings handler will be used that does nothing.

On Spigot, Timings v1 will be used.

On everything else (Paper 1.8.8+), v2 will be used.

Usage

Simply add my maven repo to your plugin and add v1.0.2 as a dependency, and shade/shadow it in.

Maven

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <!-- Repo -->
    <repositories>
        <repository>
            <id>aikar</id>
            <url>http://repo.aikar.co/nexus/content/groups/aikar/</url>
        </repository>
    </repositories>
    
    <!-- Dep -->
    <dependencies>
        <dependency>
            <groupId>co.aikar</groupId>
            <artifactId>minecraft-timings</artifactId>
            <version>1.0.4</version>
        </dependency>
    </dependencies>
    
    <!-- Shade -->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
                    <relocations>
                        <relocation>
                            <pattern>co.aikar.timings.lib</pattern>
                            <shadedPattern>[YOUR PLUGIN PACKAGE].timingslib</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Gradle

buildscript {
    repositories {
        jcenter()
    }

    dependencies {
        classpath "com.github.jengelman.gradle.plugins:shadow:1.2.4"
    }
}

apply plugin: "com.github.johnrengelman.shadow"
apply plugin: 'java'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'

repositories {
    maven { url = "http://repo.aikar.co/nexus/content/groups/aikar/" }
    maven { url = "https://hub.spigotmc.org/nexus/content/groups/public/" }
}

dependencies {
    compile "co.aikar:minecraft-timings:1.0.4"
}

shadowJar {
   relocate 'co.aikar.timings.lib', '[YOUR PLUGIN PACKAGE].timingslib'
}

Code

In your plugin

private static TimingManager timingManager;
public void onEnable() {
    timingManager = TimingManager.of(this);
}
public static MCTiming timing(String name) {
    return timingManager.of(name);
}

Then use YourPlugin.timing("Foo") or don't use static and just use a dependency injection approach.

net.gmcbm.dependencies

Global Minecraft Ban Manager Backup

Hosting Backups of gmcbm dependencies

Versions

Version
1.0.4