Skip to content

Instantly share code, notes, and snippets.

View hugmanrique's full-sized avatar

Hugo Manrique hugmanrique

View GitHub Profile
@WesJD
WesJD / RandomTeleporter.java
Created August 3, 2016 03:27
Teleport players to random locations with efficiency from Guava
public class RandomTeleporter {
private final LoadingCache<Pair<Location, Location>, List<Pair<Integer, Integer>>> locationCache = CacheBuilder.newBuilder()
.expireAfterAccess(1, TimeUnit.MINUTES)
.maximumSize(5)
.build(new CacheLoader<Pair<Location, Location>, List<Pair<Integer, Integer>>>() {
@Override
public List<Pair<Integer, Integer>> load(Pair<Location, Location> bounds) throws Exception {
final List<Pair<Integer, Integer>> ret = new ArrayList<>();
final Location bounds1 = bounds.getLeft();
if(!(Get-Command git -ErrorAction SilentlyContinue)) {
$gitDir = "$env:LOCALAPPDATA\CustomGit"
if(Test-Path $gitDir) { Remove-Item -Path $gitDir -Recurse -Force }
New-Item -Path $gitDir -ItemType Directory
$gitLatestReleaseApi = (Invoke-WebRequest -UseBasicParsing https://api.github.com/repos/git-for-windows/git/releases/latest).Content | ConvertFrom-Json
$mingitObject = $gitLatestReleaseApi.assets `
| Where-Object {$_.name -match "MinGit-[\d.]*?-64-bit.zip"} `
| Select-Object browser_download_url