Skip to content

Instantly share code, notes, and snippets.

View nsporillo's full-sized avatar
🎯
Focusing

Nick Porillo nsporillo

🎯
Focusing
View GitHub Profile
@nsporillo
nsporillo / minechat.js
Last active November 18, 2017 06:16
Decent CLI chat client for minecraft 1.6.4 using minecraft-protocol Uses https://github.com/loopj/commonjs-ansi-colorDoesn't support all colors AFAIK, furthermore it's probably not the most efficient way to handle colored chat. Used buffers to deal with the § character, not sure if this can be done without doing that.
var readline = require('readline');
var color = require("ansi-color").set;
var mc = require('../');
var c = new Buffer("§", "utf-8")
var colors = new Array();
colors[c.toString('utf-8') + '0'] = 'black+white_bg';
colors[c.toString('utf-8') + '1'] = 'white+blue_bg';
colors[c.toString('utf-8') + '2'] = 'green';
colors[c.toString('utf-8') + '3'] = 'blue';
@nsporillo
nsporillo / commentkiller
Last active January 23, 2016 00:47
Simple Python script which removes all comments from a source generated from JD-GUI
import os
import fnmatch
import re
pattern = re.compile(r"(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)|(//.*)")
for root, dirs, files in os.walk("."):
for name in fnmatch.filter(files, "*.java"):
file = os.path.join(root, name)
with open(file, mode='r+') as f:
public boolean isOutsideWorldBorder1(FLocation flocation) {
World world = flocation.getWorld();
WorldBorder border = world.getWorldBorder();
Chunk chunk = border.getCenter().getChunk();
// chunkToRegion for the fast divide by 32
int lim = FLocation.chunkToRegion((int) border.getSize());
int diffX = (int) Math.abs(chunk.getX() - flocation.getX());
int diffZ = (int) Math.abs(chunk.getZ() - flocation.getZ());
return diffX > lim || diffZ > lim;
}
@nsporillo
nsporillo / conf.json
Created April 1, 2015 20:28
Default conf.json file
{
"baseCommandAliases": [
"f"
],
"allowNoSlashCommand": true,
"colorMember": "GREEN",
"colorAlly": "LIGHT_PURPLE",
"colorTruce": "DARK_PURPLE",
"colorNeutral": "WHITE",
"colorEnemy": "RED",
C:\Users\Nick\My Documents\GitHub\TagEdge>mvn clean package
[INFO] Scanning for projects...
[INFO]
[INFO] Using the builder org.apache.maven.lifecycle.internal.builder.singlethrea
ded.SingleThreadedBuilder with a thread count of 1
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building TagEdge 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: https://hub.spigotmc.org/nexus/content/groups/public/net/minelink/C
@nsporillo
nsporillo / error.log
Created April 22, 2015 00:01
Error log
17.04 20:54:01 [Server] INFO ... 13 more
17.04 20:54:01 [Server] INFO at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44) ~[custom.jar:git-Spigot-1.7.9-R0.2-205-g0a049fa]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.P.onCommand(P.java:197) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.P.handleCommand(P.java:185) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.zcore.MPlugin.handleCommand(MPlugin.java:259) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.zcore.MPlugin.handleCommand(MPlugin.java:296) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.zcore.MCommand.execute(MCommand.java:127) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.cmd.FCommand.execute(FCommand.java:50) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.zcore.MCommand.execute(MCommand.java:109) ~[?:?]
17.04 20:54:01 [Server] INFO at com.massivecraft.factions.cmd.FCommand.execute(FCommand.java:50) ~[?:?]
@nsporillo
nsporillo / final.asm
Created May 12, 2015 17:45
final project
##########################################################
# Nick Porillo #
# Final Project: Base2 to Base10 and Base16 converter #
# Description: Input base 2, get the base 10 and base 16 #
##########################################################
# Program logic #
# 1) Run program, enter a base2 string #
# 2) Output will be 1 line with base10, 1 with base 16 #
##########################################################
alice = id
bob = not
test = all success tosses
where success (a, b) = alice a == b || bob b == a
tosses = zip toss toss
toss = enumFrom minBound
main = print test
alice = id
bob = not
test = all success tosses
where success (a, b) = alice a == b || bob b == a
tosses = zip toss toss
toss = enumFrom minBound
main = print test
@nsporillo
nsporillo / gist:45a1a5881978e0cdede7
Created June 16, 2015 22:53
Error log should have gone here
7:01:08] [pool-8-thread-2/INFO]: [Buycraft] Loaded 11 package(s) into the cache.
[17:01:08] [Server thread/ERROR]: Could not pass event PlayerJoinEvent to Factions v0.0.7-b55
org.bukkit.event.EventException
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:305) ~[spigot.jar:git-Spigot-c136710-350cb99]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[spigot.jar:git-Spigot-c136710-350cb99]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:502) [spigot.jar:git-Spigot-c136710-350cb99]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:487) [spigot.jar:git-Spigot-c136710-350cb99]
at net.minecraft.server.v1_8_R2.PlayerList.onPlayerJoin(PlayerList.java:296) [spigot.jar:git-Spigot-c136710-350cb99]
at net.minecraft.server.v1_8_R2.PlayerList.a(PlayerList.java:156) [spigot.jar:git-Spigot-c136710-350cb99]
at net.minecraft.server.v1_8_R2.LoginListener.b(LoginListener.java:144) [spigot.jar:git-Spigot-c136710-350cb99]