Skip to content

Instantly share code, notes, and snippets.

:atom:
Powered by 5 Hour Energy

Daniel Ennis aikar

View GitHub Profile
View ExplosiveArrow.java
/*
* Copyright (c) 2018. Starlis LLC / dba Empire Minecraft
*
* This source code is proprietary software and must not be redistributed without Starlis LLC's approval
*
*/
package com.empireminecraft.items.uncommon;
import com.destroystokyo.paper.event.entity.ArrowHitBlockEvent;
View timings2.diff
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
index 98079dc0..64531fcc 100644
--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java
+++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java
@@ -2,6 +2,8 @@ package co.aikar.timings;
import static co.aikar.timings.TimingsManager.*;
+import org.jetbrains.annotations.NotNull;
+
View timings.diff
diff --git a/src/main/java/co/aikar/timings/FullServerTickHandler.java b/src/main/java/co/aikar/timings/FullServerTickHandler.java
index f6d61673..64531fcc 100644
--- a/src/main/java/co/aikar/timings/FullServerTickHandler.java
+++ b/src/main/java/co/aikar/timings/FullServerTickHandler.java
@@ -53,8 +53,7 @@ public class FullServerTickHandler extends TimingHandler {
long start = System.nanoTime();
TimingsManager.tick();
long diff = System.nanoTime() - start;
- CURRENT = TIMINGS_TICK;
- TIMINGS_TICK.addDiff(diff);
View java8.patch
commit 0b8e5141862ffa710d1b8448b2d28924d442b9a2
Author: Aikar <aikar@aikar.co>
Date: Wed Apr 3 23:37:33 2019 -0400
Add World#getNearbyEntities Helpers and Java 8
The server requires Java 8 so there's no reason we shouldn't go ahead
and unlock the power of Java 8 on the API.
This PR is an example of how Java 8 enables API-Only API additions
View pom.xml
<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">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.empireminecraft</groupId>
<artifactId>empirecraft-parent</artifactId>
<relativePath>../pom.xml</relativePath>
<version>dev-SNAPSHOT</version>
View gist:14f04ec1633541149ee9aa60711c6ad0
Caused by: org.apache.maven.plugin.MojoExecutionException: Fatal error compiling
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1086)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:168)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.codehaus.plexus.compiler.CompilerException: java.lang.RuntimeException: Field 'errWriter' not found
at org.codehaus.plexus.compiler.javac.JavaxToolsCompiler.compileInProcess(JavaxToolsCompiler.java:173)
at org.codehaus.plexus.compiler.javac.JavacCompiler.performCompile(JavacCompiler.java:174)
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:1075)
View World.java
package org.bukkit;
import java.io.File;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.generator.ChunkGenerator;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
View PlayerExtensions.java
/*
* Copyright (c) 2019. Starlis LLC / dba Empire Minecraft
*
* This source code is proprietary software and must not be redistributed without Starlis LLC's approval
*
*/
package EMC.extensions.org.bukkit.entity.Player;
import com.empireminecraft.data.PlayerDataKeys;
import com.empireminecraft.features.friends.FriendsList;
View LoreBuilder.java
/*
* Copyright (c) 2016. Starlis LLC / dba Empire Minecraft
*
* This source code is proprietary software and must not be redistributed without Starlis LLC's approval
*
*/
package com.empireminecraft.util;
import com.empireminecraft.api.meta.Meta;
@aikar
aikar / Listener.java
Created Mar 28, 2019
Example of using PlayerDeathEvent#getItemsToKeep
View Listener.java
@EventHandler(ignoreCancelled = true)
public void onPlayerDeath(PlayerDeathEvent event) {
for (Iterator<ItemStack> iterator = event.getDrops().iterator(); iterator.hasNext(); ) {
ItemStack drop = iterator.next();
List<String> lore = drop.getLore();
if (lore != null && !lore.isEmpty()) {
if (lore.get(0).contains("(SOULBOUND)")) {
iterator.remove();
event.getItemsToKeep().add(drop);
You can’t perform that action at this time.