Instantly share code, notes, and snippets.

:atom:
Powered by 5 Hour Energy

Daniel Ennis aikar

View GitHub Profile
View SomePlugin.java
package co.aikar.someplugin;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockState;
import org.bukkit.block.Chest;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
View ChunkStateFix.patch
commit ba4afed44f76c2d0b8ba63439ecc28b6c2212d05
Author: Aikar <aikar@aikar.co>
Date: Fri Feb 15 01:08:19 2019 -0500
Allow Saving of Oversized Chunks
The Minecraft World Region File format has a hard cap of 1MB per chunk.
This is due to the fact that the header of the file format only allocates
a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector.
View SpongeCommandContexts.java
/*
* Copyright (c) 2016-2017 Daniel Ennis (Aikar) - MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
View prunegit
#!/bin/bash
pwd=`pwd`
for dir in $(find . -type d -name ".git" | sed 's/\/.git//g'); do
cd "$pwd/$dir"
git reflog expire --expire-unreachable=3d
git gc --prune=5d
git gc --aggressive
git prune
done
View checkout-pr
#!/usr/bin/env bash
if [ -z "$1" ]; then
echo "$0 <prID>"
exit 1;
fi
repo=$(git remote get-url origin | sed -E 's/(.*@)?github.com(:|\/)//g' | sed 's/.git$//g')
data=$(curl -q https://api.github.com/repos/$repo/pulls/$1 2>/dev/null)
url=$(echo -e "$data" | grep --color=none ssh_url | head -n 1 |awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
ref=$(echo -e "$data" | grep --color=none '"head":' -A 3 | grep ref | head -n 1 |awk '{print $2}' | sed 's/"//g' | sed 's/,//g')
prevbranch=$(\git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')
View diff.patch
commit a825b5c4138e5b3a048b045d6fe65400c1900ae7
Author: Aikar <aikar@aikar.co>
Date: Wed Oct 31 20:44:51 2018 -0400
x
diff --git a/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java b/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java
index e589aa356c..a796af2921 100644
--- a/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java
+++ b/src/main/java/com/destroystokyo/paper/util/PriorityQueuedExecutor.java
View merge.diff
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b766e00d0b..1af92ed007 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -569,4 +569,10 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() {
preventMovingIntoUnloadedChunks = getBoolean("settings.prevent-moving-into-unloaded-chunks", false);
}
+
+ public double mergeEntityMovement = 0.075D;
View move.patch
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b766e00d0b..2042b9bd71 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -569,4 +569,10 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() {
preventMovingIntoUnloadedChunks = getBoolean("settings.prevent-moving-into-unloaded-chunks", false);
}
+
+ public double optimizeEntityMovement = 0.5D;
View move.patch
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
index b766e00d0b..2042b9bd71 100644
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
@@ -569,4 +569,10 @@ public class PaperWorldConfig {
private void preventMovingIntoUnloadedChunks() {
preventMovingIntoUnloadedChunks = getBoolean("settings.prevent-moving-into-unloaded-chunks", false);
}
+
+ public double optimizeEntityMovement = 0.5D;
View ChunkMap.java
package net.minecraft.server;
import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap;
import java.util.Map;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class ChunkMap extends Long2ObjectOpenHashMap<Chunk> {
private static final Logger a = LogManager.getLogger();