Skip to content

Instantly share code, notes, and snippets.

View nopresnik's full-sized avatar

Nathan Opresnik nopresnik

  • Melbourne, Australia
View GitHub Profile
public class Events implements Listener {
HashMap<String, Long> cooldownJump = new HashMap<String, Long>();
HashMap<String, Long> cooldownSponge = new HashMap<String, Long>();
public JMod plugin;
public Events(JMod instance) {
plugin = instance;
}
public void chainHat() {
ShapedRecipe chainHat = new ShapedRecipe(new ItemStack(Material.CHAINMAIL_HELMET));
chainHat.shape("ISI",
"SXS",
"XXX");
chainHat.setIngredient('I', Material.IRON_INGOT);
chainHat.setIngredient('S', Material.STRING);
chainHat.setIngredient('X', Material.AIR);
Util.logger("Loaded recipe for: Chainmail Helmet");
}
this.getServer().getScheduler().scheduleSyncRepeatingTask(this, new Runnable() {
@Override
public void run() {
checkForIron();
}
}, 20L, 20L);
public void checkForIron() {
for (Player p : getServer().getOnlinePlayers()) {
if (ArmourAbilities.hasIron(p)) { //Checks if player is wearing full set of iron
messageStaff("Message");
public void messageStaff(String message) {
for (Player p : getServer().getOnlinePlayers()) {
if (p.hasPermission("your.permission")) {
p.sendMessage(message);
@EventHandler
public void onBlockBreak(BlockBreakEvent event) {
Block block = event.getBlock();
Player player = event.getPlayer();
if (block.getType() == Material.DIAMOND_ORE) {
player.sendMessage("I can has diamonds!");
}
}
/msg $player $shit = >>>
msg('[me -> ' pinfo($player, 0), '] ' $)
tmsg($player, '[me <- ' pinfo($player, 0), '] ' $)
<<<
#This set of commands, /msg, /r, and /cmsg replaces the built in message system
#and allows for colored messages by mods, so they are more prominent
mods:/cmsg $player [$] = >>>
tmsg($player, concat('[', color(red), player(), color(white), '->Me] ', color(green), $))
msg(concat('[', color(red), 'Me', color(white), '->', pinfo($player, 0), '] ', color(green), $))
store_value(concat('last_message_', pinfo($player, 0)), player())
<<<
all:/msg $player [$] = >>>
try(