Skip to content

Instantly share code, notes, and snippets.

View Terrobility's full-sized avatar

Terrobility Terrobility

View GitHub Profile
wrapper = new WrapperPlayServerPlayerInfo(); // make new packet
wrapper.setAction(EnumWrappers.PlayerInfoAction.ADD_PLAYER); // set action
data = (list = new ArrayList<PlayerInfoData>()); // make empty list with player info data
new PlayerInfoData(WrappedGameProfile.fromHandle((Object)profile.get().loadProfile()), ThreadLocalRandom.current().nextInt(this.i.settings.getPingMin(), this.i.settings.getPingMax()), EnumWrappers.NativeGameMode.SURVIVAL, WrappedChatComponent.fromText(StringUtils.substring(this.i.settings.getPrefix() + profile.get().getName(), 0, 16))); // add the data for the new fake player to the list
list.add(playerInfoData);
wrapper.setData(data); // set that list as the packet's data
ProtocolLibrary.getProtocolManager().broadcastServerPacket(wrapper.getHandle()); // send that packet to everyone online
// shit code, I know. that's straight from the decompiler
@Terrobility
Terrobility / config.yml
Created August 13, 2016 17:04
ArchonList prototype config
# Please don't change the config version.
config-version: 1
use-display-name: false
format: "&8[%rank%&8] &7[&a%online% Online&7] &7%players%"
no-players: "&cNone"
separator: "&a, &7"
@Terrobility
Terrobility / install.sh
Last active January 15, 2019 18:20
Install essential stuff for Debian/Ubuntu
#!/bin/bash
# Install Java 8.
echo "deb http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee /etc/apt/sources.list.d/webupd8team-java.list
echo "deb-src http://ppa.launchpad.net/webupd8team/java/ubuntu xenial main" | tee -a /etc/apt/sources.list.d/webupd8team-java.list
apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys EEA14886
apt -y update && apt -y upgrade
echo oracle-java8-installer shared/accepted-oracle-license-v1-1 select true | sudo /usr/bin/debconf-set-selections
apt install -y oracle-java8-installer
apt install -y oracle-java8-set-default
@Terrobility
Terrobility / brandon.txt
Created June 29, 2016 19:54
EULA Questions Answered @ Wed 29/Jun/2016
Hello,
We're sorry for the delayed response. Since we have received a lot questions regarding the commercial guidelines when it comes to servers, we wanted to provide you with some additional clarifications and examples of what you can sell for hard versus soft currency.
Examples of things you can sell for hard currency, “real money”, (as long as it doesn’t give the player any unfair advantage):
-Personal time or weather in lobby.
-The ability to see which players that are nearby, in creative mode.
@Terrobility
Terrobility / waterfall.sh
Last active June 27, 2016 16:10
Waterfall startup script. Automatically downloads and runs the latest Waterfall jar.
#!/bin/bash
# Waterfall information: https://aquifermc.org/pages/about-waterfall/
while true
do
echo "Running start-up script..."
# Download latest jar.
wget -O Waterfall.jar https://ci.getwaterfall.xyz/repository/download/Waterfall_Build/lastSuccessful/Waterfall.jar
@Terrobility
Terrobility / taco.sh
Last active January 8, 2017 09:05
TacoSpigot startup script. Automatically downloads and runs the latest TacoSpigot jar.
#!/bin/bash
# TacoSpigot information: https://aquifermc.org/threads/58/
while true
do
echo "Running start-up script..."
# Download latest jar.
wget -O TacoSpigot.jar https://ci.techcable.net/job/TacoSpigot/lastStableBuild/artifact/build/TacoSpigot.jar
# 1.9.4: https://github.com/TacoSpigot/TacoSpigot/releases/download/v1.9.4-R0.1/TacoSpigot.jar
package xyz.suppixel.rideArrow;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
#!/bin/bash
iptables -F
iptables -A INPUT -p tcp --tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp ! --syn -m state --state NEW -j DROP
iptables -A INPUT -p tcp --tcp-flags ALL ALL -j DROP
iptables -A INPUT -i lo -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 80 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT
iptables -A INPUT -p tcp -m tcp --dport 25 -j ACCEPT
ItemStack spawner = new ItemStack(e.getBlock().getType());
ItemMeta im = spawner.getItemMeta();
// You must get the spawned type in the form of a string, otherwise it will not work in the display name.
im.setDisplayName(ChatColor.WHITE + ((CreatureSpawner)e.getBlock().getState()).getSpawnedType().name().toLowerCase() + ChatColor.WHITE + " spawner");
// Before you were creating an aray and then converting it to list which isn't good. This way you create a list and add to it directly.
ArrayList<String> newLore = new ArrayList<>();
newLore.add("§8[§e§oCollected with §d§oCrowbar§8]");
im.setLore(newLore);
spawner.setItemMeta(im);
spawner.setDurability(((CreatureSpawner)e.getBlock().getState()).getSpawnedType().getTypeId());
@Terrobility
Terrobility / ColorCodeUtil.java
Last active June 16, 2016 00:12
Color code util class.
package me.terrobility;
import java.util.ArrayList;
import java.util.List;
public class ColorCodeUtil {
private static String translateAlternateColorCodes(char altColorChar, String textToTranslate) {
char[] b = textToTranslate.toCharArray();
for (int i = 0; i < b.length - 1; i++) {
// Check for color codes.