Skip to content

Instantly share code, notes, and snippets.

View redraskal's full-sized avatar

Benjamin Ryan redraskal

View GitHub Profile

Keybase proof

I hereby claim:

  • I am JediMasterSoda on github.
  • I am jedimastersoda (https://keybase.io/jedimastersoda) on keybase.
  • I have a public key whose fingerprint is 29D1 EC7D CB64 6CF3 0015 0609 5EA5 EA56 B2C0 504F

To claim this, I am signing this object:

@redraskal
redraskal / no.js
Created November 26, 2018 20:06
idk
let currentLyric = 0
let lyrics = ["Maybe I'll be Tracer","I'm already Tracer","What about Widowmaker?","I'm already Widowmaker","I'll be Bastion","Nerf Bastion!","You're right. So, Winston","I wanna be Winston","I guess I'll be Genji","I'm already Genji","Then I'll be McCree","I already chose McCree","I have an idea","What's your idea?","You should be...","I'm not gonna be Mercy"]
function sendChatMessage(msg) {
let elem = document.querySelector('body > div.docs-chat-pane-container > div > div.docs-chat-edit-container > textarea')
elem.value = msg
elem.className = 'docs-chat-edit-box docs-chat-edit-box-focus'
let ev = document.createEvent('Event')
ev.initEvent('keydown')
ev.which = ev.keyCode = 13
@redraskal
redraskal / CustomBook.java
Last active December 3, 2017 19:14
A TextComponent based book system that you can force players to open! (Reflection used) [1.8+ SUPPORT] Example: https://twitter.com/redradkal/status/924371895713239040
import net.md_5.bungee.api.chat.ClickEvent;
import net.md_5.bungee.api.chat.HoverEvent;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.chat.ComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;
@redraskal
redraskal / NBTUtils.java
Created October 23, 2017 02:21
Quick write-up of an NBT utils class for 1.8. (Sorry, no reflection rn)
import net.minecraft.server.v1_8_R3.NBTTagByte;
import net.minecraft.server.v1_8_R3.NBTTagCompound;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
/**
* Created by Redraskal_2 on 3/5/2017.
*/
public class NBTUtils {
@redraskal
redraskal / DirectoryFromPath.java
Created October 17, 2016 21:53
Returns a directory as a String from a Path (with a file extension)
/**
* A complicated way to determine a directory from a file Path
* @param path
* @return
*/
public static String getDirectory(Path path) {
String ab = path.toAbsolutePath().toString();
ab = ab.replace(File.separator, "/");
int s = (ab.split("/").length - 1);
int c = 0;
@redraskal
redraskal / LoreRemover.java
Created September 13, 2016 00:41
This snippet of code removes any unwanted default Minecraft lore you may experience! (ex. enchantments, potion effects, metadata...)
public static ItemStack removeDefaultLores(ItemStack itemStack) {
net.minecraft.server.v1_8_R3.ItemStack craftItemStack = CraftItemStack.asNMSCopy(itemStack);
NBTTagCompound nbt = craftItemStack.getTag();
if(nbt == null) {
nbt = new NBTTagCompound();
}
nbt.setInt("HideFlags", 63);
craftItemStack.setTag(nbt);
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.ArmorStand;
import org.bukkit.event.EventHandler;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
@redraskal
redraskal / Configuration.java
Created May 30, 2016 03:01
A simple way of saving configuration files!
import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;
import java.nio.file.DirectoryNotEmptyException;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
import java.nio.file.Path;
import java.util.logging.Level;
@redraskal
redraskal / Title.java
Created May 24, 2016 00:36
A simple method of creating a colored Action Bar! Side-note: use the bukkit api, as the bungeecord ChatColor class tends to error out
public class Title {
public enum Action {
TITLE(EnumTitleAction.TITLE),
SUBTITLE(EnumTitleAction.SUBTITLE);
private EnumTitleAction t;
private Action(EnumTitleAction titleAction) {
this.t = titleAction;
@redraskal
redraskal / ActionBar.java
Created May 24, 2016 00:25
A simple method of creating a colored Action Bar! Side-note: use the bukkit api, as the bungeecord ChatColor class tends to error out
public static void sendPacket(Player player, String message) {
CraftPlayer cP = (CraftPlayer) player;
IChatBaseComponent icbc = IChatBaseComponent.ChatSerializer.a("{\"text\": \"" + ChatColor.translateAlternateColorCodes('&', message) + "\"}");
PacketPlayOutChat bar = new PacketPlayOutChat(icbc, (byte)2);
cP.getHandle().playerConnection.sendPacket(bar);
}