Skip to content

Instantly share code, notes, and snippets.

@Zren
Zren / Test.java
Created February 22, 2011 04:21
Hello World with extensive documentation.
// Open up a new project called Test
// Make a new class called Test
//Now try this code
public class Test {
public static void main(String[] args) {
System.out.println("Hello World");
}
@Zren
Zren / gist:838261
Created February 22, 2011 05:14
Loops
// For loops are a simple way to count numbers in a pattern. In this case the pattern is that all numbers
// increase by one each cycle through the loop. The first cycle will start with the variable i (which
// is an integer (a number, but not a fraction)) as the number 0. Then the next cycle, it's 1, then 2 ...
// All the way until the last cycle where it's 9, then when you add by 1 and make i = 10
for (Assign local seed value; exit conditional; increment or modify the variable) {
System.out.println(i);
}
// The whole time, whenever the cycle forced us to increment the number (+1), then it was also checking the
Once upon a time in a land far far away...
A land covered with the snowiest landscapes, the largest deserts and the biggest forests.
A land flooded by oceans so big, one man couldn't see the other side.
A land carved with mountains that reach for the sun.
In this land called Revessa, there were two kingdoms that lived in peace.
In the North there was Biru, and in the south lived the people of Rosso.
These communities lived in great harmony with each other. Via the trade routes they exchanged
raw materials such as obsidian, netherrack, gold and even diamonds, but also spices and food such as seeds,
wheat... all you can think of. Both nations share the same god, Tuhan.
Plugin test = Bukkit.getServer().getPluginManager().getPlugin("Towny");
if (test == null) {
throw a shitstorm
} else {
Towny towny = (Towny)test;
TownyUniverse universe = towny.getTownyUnverse();
setTowny(universe);
}
@Zren
Zren / Character.java
Created December 7, 2011 19:38
RPG Mechanics (Exp/Stat/Equipment)
public class Character {
private Map<Stat, Integer> stats = new HashMap<Stat, Integer>();
private Map<Stat, Integer> statOffsets = new HashMap<Stat, Integer>();
private Job job;
private LevelCurve levelCurve;
private int level = 1;
private int experience = 0;
private final EquipmentInventory equipmentInventory = new EquipmentInventory();
public Character(Job job) {
@Zren
Zren / DarkMonokai.qss
Last active December 18, 2023 18:06
Dark Monokai - Quassel Theme (qss)
/**
** ____ _ ___ ___ _ _
** | _ \ | | | \/ | | | (_)
** | | \ |__ _ _ __| | __ | . . | ___ _ __ ___ | | __ __ _ _
** | | | | _` | '__| |/ / | |\/| |/ _ \| '_ \ / _ \| |/ // _` | |
** | |_/ /(_| | | | < | | | | (_) | | | | (_) | <| (_| | |
** |____/\__,_|_| |_|\_\ \_| |_/\___/|_| |_|\___/|_|\_\\__,_|_|
**
** Quassel Theme
**
@Zren
Zren / InjectIntoBukkitTask.java
Created May 29, 2012 00:45
Task Injector for Bukkit's Scheduler
package ca.xshade.bukkit.util;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import java.util.TimerTask;
/**
* A task that can be scheduled for one-time or repeated execution by a Timer that will insert the defined task into Bukkit's schedular to
* run on it's next tick.
@Zren
Zren / gist:2955111
Created June 19, 2012 16:28
Recursive CountDownTask (Rounds up into the future second when scheduling)
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.TimeUnit;
public class Test {
// Output:
onPlayerMove()
from = Vector(-44.973586, 63.000000, 184.599402)
to = Vector(-44.976534, 63.000000, 184.491422)
Delta = Vector(-0.002948, 0.000000, -0.107980)
Delta (Normalized) = Vector(-0.027288, 0.000000, -0.999628)
inFront = Vector(-45.003822, 63.000000, 183.491795)
inFront (Block) = Vector(-46.000000, 63.000000, 183.000000)
onPlayerMove()
from = Vector(-44.976534, 63.000000, 184.491422)
to = Vector(-44.926589, 63.000000, 184.349126)
package ca.xshade.bukkit.util.config;
import ca.xshade.bukkit.util.BukkitUtil;
import com.pridemc.games.arena.CuboidRegion;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.configuration.serialization.ConfigurationSerialization;