Skip to content

Instantly share code, notes, and snippets.

@riking
riking / The Code
Created March 8, 2012 23:57 — forked from anonymous/The Code
Generation Help
public void generateSurface(World world, Random rand, int chunkX, int chunkZ)
{
for(int a= 0; a < 32; a++)
{
int randPosX = chunkX + rand.nextInt(16);
int randPosY = rand.nextInt(64);
int randPosZ = chunkZ + rand.nextInt(16);
(new WorldGenMinable(mod_Ores.Emerald.blockID, 8)).generate(world, rand, randPosX, randPosY, randPosZ);
}
@riking
riking / gist:2920416
Created June 12, 2012 22:05
braille.py
kane@KANEUBUNTU:~/projects/Python-2.5.2$ ./python
Python 2.5.2 (r252:60911, Jun 12 2012, 15:02:42)
[GCC 4.6.3] on linux3
Type "help", "copyright", "credits" or "license" for more information.
>>> import braille
[30, 17, 12, 30, 17, 12]
>>>
@riking
riking / ShortsPuzzle.java
Last active December 13, 2015 18:18
Java puzzler. From a Google Tech Talk.
import java.util.Set;
import java.util.HashSet;
public class ShortsPuzzle {
public static void main(String[] args) {
Set<Short> shortSet = new HashSet<Short>();
for (short i = 0; i < 100; i++)
{
shortSet.add(i);
shortSet.remove(i - 1);
:start
set /P inp=%cd%^>
%inp%
goto start
@riking
riking / Command.java
Created February 21, 2013 02:54
Lots of detail has been stripped. Command is the main class, holding the lists. ModuleChoose is a sample usage.
public abstract class Command implements Comparable<Command> {
private static final Map<Command, Object> cmdSources = Collections.synchronizedMap(new HashMap<Command, Object>());
private static final Map<String, Command> cmds = Collections.synchronizedSortedMap(new TreeMap<String, Command>());
private static final List<String> aliases = Collections.synchronizedList(new ArrayList<String>());
public static enum EType {
Channel, Private, Notice, Console;
}
public static void addCommand(Object source, String name, Command command) {
@riking
riking / AetherCraftClaimChecker.java
Last active December 14, 2015 08:59
Extensible version of Factions' Player.canClaimForFactionAtLocation(Faction forFaction, Location location, boolean notifyFailure). More work will need to be done to make this usable, like sending the message from the ClaimResult, keeping a modifiable global instance of a IFClaimChecker. Even per-player claim checkers would be possible.
package com.aethercraft.factions;
import org.bukkit.Location;
import com.massivecraft.factions.FLocation;
import com.massivecraft.factions.Faction;
import com.massivecraft.factions.claims.DefaultClaimChecker;
public class AetherCraftClaimChecker extends DefaultClaimChecker
{
@riking
riking / Skill.java
Created March 7, 2013 04:51
Heroes: Skill.damageEntity(LivingEntity target, LivingEntity attacker, int damage, DamageCause cause, boolean knockback)
int oldHealth = target.getHealth();
int newHealth = oldHealth - edbe.getDamage();
if (newHealth < 0) {
newHealth = 0;
}
EntityLiving el = ((CraftLivingEntity) target).getHandle();
target.setLastDamage(edbe.getDamage());
el.aS = oldHealth;
el.hurtTicks = (el.aW = 10);
el.aX = 0.0F;
@riking
riking / gist:5166576
Created March 15, 2013 00:40
Mirror of the League of Legends Season 3 FAQ, retrieved on March 14, 2013

#The Season 3 Championship Series

League Championship Series (LCS)

Do the teams that qualified for the LCS have to stick with the same five members, or can they replace players?

An LCS qualifying spot belongs to the organization as a whole, and the team will be responsible for maintaining their lineup. Each team is required to have at least a starting five and two subs, but they’ll be able to rotate players the way you'd expect in any traditional sport. This includes trading players, signing free agents and releasing players from the roster.

What will happen to partner events like those run by IPL, MLG, IEM, DreamHack, etc. this coming year?

Partner events like these will host tournaments for challenger teams. Winning teams can earn a spot in the Promotion Tournament happening at the All-Star break, where they’ll have the opportunity to break into the LCS. There won’t be a circuit point system for partner events this year.

How’d you decide on the 17+ age requirement for NA and EU tournaments

private void triggerRedstone(final PhysicalShop plugin) {
if(!plugin.getConfig().getBoolean(TRIGGER_REDSTONE)) return;
final BlockFace face = ShopHelpers.getBack(sign);
switch(face) {
case NORTH:
case SOUTH:
case WEST:
case EAST:
break;
default:
import java.lang.reflect.Field;
import java.util.HashMap;
import java.io.StringWriter;
import java.io.PrintWriter;
import java.util.Arrays;
class ScoreboardCrash
{
ScoreboardCrash(b paramb)
{
}