This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class TransparentImage { | |
| protected static function createTransparent($width, $height) { | |
| $canvas = imagecreatetruecolor($width, $height); | |
| imagealphablending($canvas, true); | |
| imagesavealpha($canvas, true); | |
| $transparent = imagecolorallocatealpha($canvas, 255, 255, 255, 127); | |
| imagefill($canvas, 0, 0, $transparent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class UUIDDeserialize { | |
| public static void main(String[] args) throws SQLException { | |
| byte[] mostBits = ArrayUtils.subarray(uuidBytes, 0, 8); | |
| byte[] leastBits = ArrayUtils.subarray(uuidBytes, 8, 16); | |
| long mostByte = Longs.fromByteArray(mostBits); | |
| long leastByte = Longs.fromByteArray(leastBits); | |
| new UUID(mostByte, leastByte); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Use https://travis-ci.org/ for automatic testing | |
| # This is a java project | |
| language: java | |
| script: mvn compile test | |
| jdk: [oraclejdk8] | |
| # if one build failed, exit testing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * Diff Match and Patch | |
| * | |
| * Copyright 2006 Google Inc. | |
| * http://code.google.com/p/google-diff-match-patch/ | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * This task should run every second | |
| */ | |
| public class TicksPerSecond implements Runnable { | |
| private static final int INTERVAL_CHECK = 1; | |
| private static float lastTicks = 20.0F; | |
| /** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.apache.commons.lang.Validate; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.Location; | |
| import org.bukkit.entity.Player; | |
| import org.bukkit.util.Vector; | |
| /** | |
| * Source: https://www.spigotmc.org/threads/code-snippet-helpful-snippets-for-bukkit-plugins.35124/ | |
| */ | |
| public class TargetPlayerLook { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.github.games647.minecraft.bukkit; | |
| import java.lang.reflect.InvocationTargetException; | |
| import java.lang.reflect.Method; | |
| import java.util.Arrays; | |
| import java.util.Collection; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.entity.Player; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.common.base.Charsets; | |
| import com.google.common.base.Objects; | |
| import com.google.common.collect.Maps; | |
| import java.util.Map; | |
| import java.util.UUID; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.Location; | |
| import org.bukkit.OfflinePlayer; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.bukkit.entity.Player; | |
| public class CardinalDirection { | |
| public enum Direction { | |
| NW, | |
| N, | |
| NE, | |
| E, | |
| SE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import org.bukkit.Material; | |
| import org.bukkit.entity.Player; | |
| import org.bukkit.inventory.Inventory; | |
| import org.bukkit.inventory.ItemStack; | |
| import org.bukkit.inventory.PlayerInventory; | |
| public class EmptyInventoryCheck { | |
| public static boolean isIventoryEmpty(PlayerInventory playerInventory) { | |
| if (isIventoryEmpty((Inventory) playerInventory)) { |