Skip to content

Instantly share code, notes, and snippets.

@tehbeard
tehbeard / gist:5187521
Created March 18, 2013 14:27
Getting package at runtime, (even if shaded to another package hopefully)
package foo.bar;
public class TestClass {
public static void main(String[] args){
//Get package at runtime
System.out.println(TestClass.class.getPackage().getName());
}
}
$.fn.ajaxThatForm = function(opts){
this.each(function(i,el){
var formParams = {
action : $(this).attr("action"),
method : $(this).attr("method")
};
$.extend(formParams,opts);
var formData = new FormData();
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.0</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
general:
debug: false
stats:
configversion: ${project.config.version}
trackcreativemode: false
database:
type: "transfer"
host: "NA"
username: "NA"
password: "NA"
/*******************************************************************************
* Copyright (c) 2012 turt2live (Travis Ralston).
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser Public License v2.1
* which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
*
* Contributors:
* turt2live (Travis Ralston) - initial API and implementation
******************************************************************************/
@tehbeard
tehbeard / gist:3967030
Created October 28, 2012 00:35
BuscriptPlugin.java.chunk
private File getStartupScript() {
File scriptFile = new File(getDataFolder(), "startup-script.txt");
if (!scriptFile.exists()) {
try {
this.saveResource("startup-script.txt", false);
if (!scriptFile.exists()) {
scriptFile.createNewFile();
}
} catch (IOException e) {
getLogger().severe("Error creating script file: " + e.getMessage());
@tehbeard
tehbeard / gist:3967028
Created October 28, 2012 00:34
Buscript.java.chunk
/**
* Set a top level variable
* @param name variable to set to
* @param object value for variable
*/
public void setTopLevelVariable(String name,Object object){
getGlobalScope().put(name, getGlobalScope(), object);
}
@tehbeard
tehbeard / gist:3851868
Created October 8, 2012 10:32
Copying and filtering resource files to target Directory
<resource>
<targetPath>${project.build.directory}</targetPath>
<directory>${basedir}/src/main/resources/</directory>
<filtering>true</filtering>
<includes>
<include>{FILENAME.GOES.HERE}</include>
</includes>
</resource>
private static Novaember main;
public static Novaember getMain() { return main; }
public EventListener(Novaember main) {
this.main = main;
}
@EventHandler(priority = EventPriority.MONITOR)
public void playerLogin(PlayerLoginEvent event) {
@tehbeard
tehbeard / gist:3227109
Created August 1, 2012 14:04
documentation of trait storage for CitiTrader
wallet: //More info when it becomes it's own plugin, just copy paste for now
type: PRIVATE
amount: '0.0'
account: ''
//meat of chest based traders
stockroom:
enableRightClick: true //enable right click to purchase items (T/F)
enableLeftClick: false //enable left click to sell items (T/F)