This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Built using Matthew Sachin's documentation as reference | |
* https://github.com/MathewSachin/NIco/wiki/Ico,-Cur-and-PE-Formats | |
* See example function 'test' | |
* | |
* Abilities: | |
* Read a cursor or icon file and get it's image data (raw) | |
* | |
* Future plans: | |
* Read and then parse into different data sets for convenience like: | |
* 1d arrays of hex/web colors, or int colors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ctrlIsDown = false; | |
var fillChar = "▓"; | |
var points = [{x:undefined,y:undefined},{x:undefined,y:undefined}]; | |
var lastPointModified = false; //false = 1, true = 2 | |
var cursorCoordsGlobal = {x:0,y:0}; | |
function onClick (evt) { | |
if (evt.button != 0) return; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let pi = 3.141592653589793; //All the digits I could remember.. | |
let radians = (degrees) => degrees * (pi / 180); | |
let degrees = (radians) => radians * (180 / pi); | |
let lerp = (a, b, c) => a + c * (b - a); | |
let dist = (x1, y1, x2, y2) => Math.sqrt( | |
Math.pow(x1 - x2, 2) + | |
Math.pow(y1 - y2, 2) | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**Get char from world coordinates | |
* @param {Integer} x world coordinate | |
* @param {Integer} y world coordinate | |
*/ | |
let getCharFromXY = (x, y)=> { | |
return getChar( | |
Math.floor(x / 16), | |
Math.floor(y / 8), | |
x - Math.floor(x / 16) * 16, | |
y - Math.floor(y / 8) * 8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Imports | |
//Aliases | |
var PlayerInteractEvent = org.bukkit.event.player.PlayerInteractEvent; | |
var Material = org.bukkit.Material; | |
//List of concrete colors | |
var concreteColors = [ | |
Material.BLACK_CONCRETE, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Imports | |
//Aliases | |
var PlayerChatEvent = org.bukkit.event.player.PlayerChatEvent; | |
//Event listener | |
function onPlayerChat (evt) { | |
//Get the message | |
var msg = evt.getMessage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sphere (worldname, x, y, z, diameter, clearMethod) { | |
var Material = org.bukkit.Material; | |
if (clearMethod === undefined) clearMethod = "none"; | |
var r = diameter/2; | |
var w = server.getWorld(worldname); | |
if (!w) throw "No world by name of " + worldname; | |
var b = w.getBlockAt(x, y, z); | |
var bl = b.getLocation(); | |
var bv = bl.toVector(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class OWOTPos { | |
static TileWidth = 16; | |
static TileHeight = 8; | |
constructor() { | |
this.tileX = 0; | |
this.tileY = 0; | |
this.charX = 0; | |
this.charY = 0; | |
this.x = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/**Linear interpolation between from and to, using 0.0 - 1.0 interpolant `by`*/ | |
export const lerp = (from: number, to: number, by: number): number => { | |
return from*(1-by)+to*by; | |
} | |
/**Performs the inverse of lerp | |
* Will give you the interpolant given the interpolated number and its bounds (to and from) | |
*/ | |
export const inverseLerp = (from: number, to: number, value: number): number => { | |
return (value - from) / (to - from); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# example usage: ` ./user-kick jon ` - kicks 'jon' pts sessions off | |
# this works by mapping username to pts port, then pts port to process id, and killing the process with kill -9 | |
# commands run: | |
# 'who' - for finding pts ports | |
# 'grep' - for filtering command output | |
# 'ps' - for listing processes by their pts port | |
# 'kill' - for terminating the process ids |
OlderNewer