Skip to content

Instantly share code, notes, and snippets.

@vemacs
vemacs / Tutorial.java
Created April 11, 2013 22:39
A simple tutorial Bukkit plugin
package com.reddit.admincraft.Tutorial;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.PlayerJoinEvent;
import org.bukkit.plugin.java.JavaPlugin;
@vemacs
vemacs / TossCanceller.java
Created May 18, 2013 00:28
Cancels tosses for nonops
package com.nullblock.vemacs.tosscanceller;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class TossCanceller extends JavaPlugin implements Listener {
public void onDisable() {
@vemacs
vemacs / Tutorial.md
Last active July 29, 2022 10:00
Instructions for setting up a Spigot server using mark2 on a fresh Ubuntu Server 14.04 LTS install.

This guide is outdated

Please check out the official installation guide here: https://github.com/mark2devel/mark2/blob/master/INSTALL.md

Prerequisites

  • a vswap OpenVZ VPS or a KVM/Xen/VMware VPS with Ubuntu Server 14.04 LTS installed (architecture doesn't matter), or a dedicated server
  • patience and a willingness to learn
  • approximately 10 minutes of time
@vemacs
vemacs / mark2.properties
Last active December 18, 2015 02:29
Default mark2.properties setup
java.cli.X.ms=1024M
java.cli.X.mx=1024M
# Use whatever mark2 saved the JAR as here
mark2.jar-path=spigot*.jar
# Saving notifications aren't really useful
plugin.save.warn-message=
plugin.save.message=
# This helps stop GC hangs
java.cli.XX.UseConcMarkSweepGC=true
@vemacs
vemacs / scripts.txt
Created June 5, 2013 01:29
easy mark2 scripts.txt setup
# Saves the map every 15 minutes
*/15 * * * * ~save
# Restarts Spigot every 24 hours
0 12 * * * ~restart
# Warns 5 minutes before restart
55 11 * * * /say Server restarting in 5 minutes
@vemacs
vemacs / Instacraft.sh
Last active December 18, 2015 02:29
A fully functioning Minecraft server in 2 minutes on a clean Ubuntu Server 12.04 setup
#!/bin/bash
echo Instacraft for Ubuntu 12.04 by vemacs
echo THIS SCRIPT IS NOT SUPPORTED, AND IF IT BREAKS, TOO BAD
echo Please use the guide instead: https://gist.github.com/vemacs/5663144
currentuser=$UID
if [ $currentuser != 0 ]
then
echo "You need to be root to run this. "
echo "Try running sudo -i first, and then download this script again."
exit
package net.thechunk.mark2bungee;
import com.google.common.base.Joiner;
import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
import net.md_5.bungee.api.event.PlayerDisconnectEvent;
import net.md_5.bungee.api.event.PluginMessageEvent;
import net.md_5.bungee.api.event.ServerConnectedEvent;
import net.md_5.bungee.api.plugin.Command;
@vemacs
vemacs / wemuxcord.md
Last active January 31, 2020 19:21
Simple guide for using wemux for BungeeCord

I really should script a wrapper or something over this, but it's so simple, there's no real point.

  1. Install wemux (install git if your distro doesn't have it):

     sudo apt-get install git tmux
     sudo git clone git://github.com/zolrath/wemux.git /usr/local/share/wemux
     sudo ln -s /usr/local/share/wemux/wemux /usr/local/bin/wemux
     sudo cp /usr/local/share/wemux/wemux.conf.example /usr/local/etc/wemux.conf
     sudo sed -i -e s/change_this/minecraft/g /usr/local/etc/wemux.conf
    
  2. Create a separate minecraft user if you care, and add their home dir to a group called mcadmin:

@vemacs
vemacs / Skin.php
Last active August 29, 2015 13:58 — forked from tonybruess/Skin.php
<?php
class Skin {
public static function get($username) {
$steve = in_array(strtolower($username), array("steve", "player", "default"));
if(!$steve) $contents = self::fetch('http://skins.minecraft.net/MinecraftSkins/' . $username . '.png');
$defaultImage = WideImage::load("char.png");
$defaultType = "image/png";
if ($steve || $contents === false) {
$img = $defaultImage;
package net.thechunk.purchases;
import net.thechunk.chunklib.uuid.UUIDFetcher;
import net.thechunk.chunklib.uuid.UUIDUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;