Skip to content

Instantly share code, notes, and snippets.

View RoboMWM's full-sized avatar

RoboMWM

View GitHub Profile
@noahlz
noahlz / maxsubarray.c
Created June 29, 2012 18:31
Implementation of the O(N) max subarray algorithm described in Programming Pearls.
#include <stdio.h>
// see http://stackoverflow.com/a/7943955/7507
int main(int argc, char *argv[]) {
int bestSoFar = 0;
int bestNow = 0;
int bestStartIndexSoFar = -1;
int bestStopIndexSoFar = -1;
@Dinnerbone
Dinnerbone / gist:3736487
Created September 17, 2012 09:49
New Minecraft target selector syntax!

Syntax

All target selectors start with @. The following character is the selector type. For example, @p means 'closest player'.

Target selectors may have additional, optional arguments. You can specify these in [ ], using the syntax a=0. For example, @p[a=0,b=5,c=-500].

There is a special short syntax for just specifying x, y, z and r arguments; simply list their values separated by a comma, without x=. For example: @p[100,64,-100,5] for 5 range, x=100, y=64 and z=-100. Each of these are optional and skippable by leaving them empty. For example, to just specify y coordinate: @p[,64].

Global Arguments:

  • x - X coordinate for search center. Default is senders coordinate, or 0.
  • y - Y coordinate for search center. Default is senders coordinate, or 0.
@aadnk
aadnk / ExampleMod.java
Last active December 25, 2022 22:47
Intercept the TAB packet without ProtocolLib. Disallow tab completion of command names, but not parameters.
package com.comphenix.example;
import org.bukkit.plugin.java.JavaPlugin;
public class ExampleMod extends JavaPlugin {
private TabInterceptor interceptor;
@Override
public void onEnable() {
// Use ProtocolLib if its present
@aadnk
aadnk / AABB.java
Created October 23, 2013 18:25
A simple AABB intersection algorithm for Bukkit. Returns the intersection point as well.
/**
* Represents an axix-aligned bounding box.
*
* @author Kristian
*/
public class AABB {
public static class Vec3D {
/**
* Point with the coordinate (1, 1, 1).
*/
@EvilSeph
EvilSeph / log4j2.xml
Created December 11, 2013 11:55
Minecraft 1.7 default log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="net.minecraft,com.mojang">
<Appenders>
<Console name="SysOut" target="SYSTEM_OUT">
<PatternLayout pattern="[%d{HH:mm:ss}] [%t/%level]: %msg%n" />
</Console>
<Queue name="ServerGuiConsole">
<PatternLayout pattern="[%d{HH:mm:ss} %level]: %msg%n" />
</Queue>
<RollingRandomAccessFile name="File" fileName="logs/latest.log" filePattern="logs/%d{yyyy-MM-dd}-%i.log.gz">
@EvilSeph
EvilSeph / log4j2.xml
Created December 11, 2013 12:57
Bukkit 1.6 style logging log4j2 configuration
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" packages="net.minecraft,com.mojang">
<Appenders>
<Console name="WINDOWS_COMPAT" target="SYSTEM_OUT"></Console>
<Queue name="TerminalConsole">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n" />
</Queue>
<RandomAccessFile name="File" fileName="server.log">
<PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss} [%level] %msg%n" />
</RandomAccessFile>
@DarkBlade12
DarkBlade12 / Line.java
Last active May 12, 2022 02:25
This class allows you to iterate over the blocks that are between two locations
import java.util.Iterator;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.entity.LivingEntity;
import org.bukkit.util.BlockIterator;
import org.bukkit.util.Vector;
@mkotb
mkotb / SimpleScoreboard.java
Last active December 24, 2022 02:29
Non-flickering scoreboard implementation; create scoreboards with ease.
import com.google.common.base.Charsets;
import com.google.common.base.Splitter;
import com.google.common.collect.Lists;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player;
import org.bukkit.scoreboard.*;
import java.lang.reflect.Constructor;
@BretFisher
BretFisher / repair-windows-update.bat
Last active May 9, 2024 04:16
Reset Windows Update components RE: KB971058
@echo off
REM Automation of Steps to Reset Windows Updates
REM Tested on Server 2012 R2, likely works on everything Win7/2008R2 and up
REM by Bret Fisher bret@bretfisher.com
REM also find this info and more in a blog article at http://www.fishbrains.com/2015/01/29/untitled/
REM Origional Steps (identical to this): http://support.microsoft.com/kb/971058
REM This file Copyright MIT License
REM Stop Services
@zachbr
zachbr / paper.md
Last active January 22, 2016 00:17
PaperSpigot paper.yml temporary "wiki" (air quotes) : Please use https://paper.readthedocs.org/