This file contains 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
@EventHandler(priority = EventPriority.HIGH) | |
public void zombieIsMasterRace(CreatureSpawnEvent e) { | |
if (e.getEntityType() == EntityType.ZOMBIE) { // convert ALL zombies in ALL worlds | |
if (ZombieSpawner.getSurvivorsZombie((Zombie) e.getEntity()) == null) { | |
e.setCancelled(true); | |
ZombieSpawner.spawnLeveledZombie(e.getLocation()); | |
} | |
return; | |
} | |
final Entity entity = e.getEntity(); |
This file contains 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
from json import loads | |
from urllib.request import urlopen | |
from statistics import mean, median, mode, stdev, variance | |
def getPointsList(transactions): | |
points = [] | |
for transaction in transactions: | |
points.append(transaction["amount"]) | |
return points |
This file contains 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
from os import listdir | |
from urllib2 import urlopen | |
from sys import argv | |
from subprocess import call | |
if len(argv) < 2: | |
quit() | |
words = argv[1:] | |
for word in words: | |
files = listdir(".") | |
if ("%s.mp3" % word) in files: continue |
This file contains 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
/** | |
* ZNC Push Module | |
* | |
* Allows the user to enter a Push user and API token, and sends | |
* channel highlights and personal messages to Push. | |
* | |
* Copyright (c) 2011 John Reese | |
* Licensed under the MIT license | |
*/ |
This file contains 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
// --- Expected behavior --- | |
// FROM PLAYER : | |
// /kh : Show kick history of self (first) | |
// /kh 2 : Show kick history of self (second) | |
// /kh person : Show kick history of person (first) | |
// /kh person 2 : Show kick history of person (second) | |
// FROM CONSOLE : | |
// /kh : Usage | |
// /kh 2 : Usage |
This file contains 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
private class Pair<T, U> { | |
private final T first; | |
private final U second; | |
private Pair(T first, U second) { | |
this.first = first; | |
this.second = second; | |
} | |
public T getFirst() { |
This file contains 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
@EventHandler | |
public void onFood(FoodLevelChangeEvent e) { | |
e.setFoodLevel(e.getFoodLevel() / 2); | |
} |
This file contains 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 APIAPI { | |
public static boolean isAPI() { | |
return APIAPI.isAPI(); | |
} | |
} |
This file contains 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 Bicycle { | |
// code | |
} | |
public class CoolBike extends Bicycle { | |
// code | |
} | |
public void doSomething(Class<? extends Bicycle> bikeClass) { | |
new Runnable() { |
This file contains 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
final AbstractEventRegistrar aer = new AbstractEventRegistrar(this); | |
aer.registerAbstractListener(InventoryEvent.class, new Listener() { | |
@EventHandler | |
public <T extends InventoryEvent> void onInventoryEvent(T e) { | |
if (e instanceof Cancellable) { | |
final Cancellable c = (Cancellable) e; | |
c.setCancelled(true); | |
} | |
} | |
}, EventPriority.HIGHEST); |
OlderNewer