Skip to content

Instantly share code, notes, and snippets.

View AustinLMayes's full-sized avatar

Austin Mayes AustinLMayes

View GitHub Profile
@AustinLMayes
AustinLMayes / StringUtils.java
Created January 31, 2014 00:21
Required: T, Found Object
public static final <T> T bestMatch(String search, Collection<T> options, double threshold) {
Object bestObj = null;
double bestScore = 0.0D;
for (Iterator i = options.iterator(); i.hasNext(); ) { Object obj = i.next();
double score = LiquidMetal.score(obj.toString(), search);
if (score > bestScore) {
bestObj = obj;
bestScore = score;
} else if (score == bestScore) {
bestObj = null;
@AustinLMayes
AustinLMayes / gist:9200109
Created February 25, 2014 00:18
banCheck
@EventHandler(priority = EventPriority.NORMAL)
public void onLogin(PlayerLoginEvent event) {
Player player = e.getPlayer();
List<Infraction> permanantBans = getInfractions(query, InfractionPacket.PunishmentType.PERMANANT_BAN);
if(!permanantBans.isEmpty()){
Infraction last = permanantBans.get(permanantBans.size() - 1);
event.setKickMessage(ChatColor.DARK_RED + "Permanently Banned! " + ChatColor.GOLD + "» " + ChatColor.AQUA + last.getReason());
event.setResult(PlayerLoginEvent.Result.KICK_BANNED);
}
@EventHandler(priority = EventPriority.NORMAL)
public void onLogin(PlayerLoginEvent e) {
Player player = e.getPlayer();
List<Infraction> permanantBans = getInfractions(query, InfractionPacket.PunishmentType.PERMANANT_BAN);
if(!permanantBans.isEmpty()){
Infraction last = permanantBans.get(permanantBans.size() - 1);
event.disallow(PlayerLoginEvent.Result.KICK_BANNED, ChatColor.DARK_RED + "Permanently Banned! " + ChatColor.GOLD + "» " + ChatColor.AQUA + last.getReason());
}
List<Infraction> tempBans = getInfractions(query, InfractionPacket.PunishmentType.BAN);
Austins-iMac:Desktop Austin$ node api.js
---- cyan-kf ----
type: cuboid
min: 31,35,-882
max: 49,32,-876
FLAG: build
who: *
message: &cYou cannot build in this part of the path!
---- purple-kf ----
type: cuboid
Austins-iMac:Desktop Austin$ node api.js
Quintus: DTM (v1), Created By: G_SKIPPY
REGIONS:
--- cyan-kf ---
type: cuboid
min: 31,35,-882
max: 49,32,-876
FLAG: build
- who: *
- message: &cYou cannot build in this part of the path!
@AustinLMayes
AustinLMayes / yamldoc.md
Last active August 29, 2015 14:27
YAMLBuddy Doc

###AvicusYAMLBuddy###

This plugin is a tool that will generate Avicus-ready YAML from regions and inventories.

####Requirements####

  • WorldEdit

####Commands#### /yamlbuddy   - Parent command, all commands should be prefixed with this.
  inventory  - Inventory parent command. All functions dealing with inventories are prefixed with this.

@AustinLMayes
AustinLMayes / commons.js
Last active August 29, 2015 14:27
My Chaos Bot.
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function inWater(bot) {
if ((bot.blockAt(bot.entity.position.offset(0, -1, 0)) == null || bot.blockAt(bot.entity.position) == null)) {return false;};
return (bot.blockAt(bot.entity.position.offset(0, -1, 0)).name == "water" || bot.blockAt(bot.entity.position).name == "water")
}
module.exports.inWater=inWater;
String line = "lel";
Runtime.getRuntime().exec(line);
@AustinLMayes
AustinLMayes / gist:8225165
Last active January 2, 2016 00:39
Make a new user
cd home/rails/AltitudeWebsite/current
RAILS_ENV=production bundle exec rails console
u = User.new(:email => "uremail", :password => 'urpassword', :username => 'mcusername' , :password_confirmation => 'password', :admin => true)
u.save!
@AustinLMayes
AustinLMayes / original.xml
Created July 12, 2017 01:50
The Power of Inclusion and Groups
<map name="Bounce Mania" version="1.0.0" spec="1.0.0">
<include src="defaults.xml"/>
<authors>
<author uuid="47b15675a0484e8f863a0cbf86ba22dc"/>
<!-- profbananaslug -->
</authors>
<teams>
<team id="yellow" color="yellow" min="1" max="100">{colors.yellow}</team>
<team id="orange" color="orange" min="1" max="100">{colors.orange}</team>
</teams>