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 | |
| bucket="milkyway-backups" | |
| server="MILKYWAY" | |
| subject="MYSQL" | |
| databases=$(mysql -e "show databases;" | grep -Ev "(Database|information_schema|performance_schema|phpmyadmin)") | |
| masterfile="$server-$subject-$(date +"%Y-%m-%d").tar.gz" | |
| tmpdir="/tmp/backup-$(echo $RANDOM % 999999 + 1 | bc)" | |
| masterfile="/tmp/$masterfile" |
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
| /** | |
| * Converts the player inventory to a String array of Base64 strings. First string is the content and second string is the armor. | |
| * | |
| * @param playerInventory to turn into an array of strings. | |
| * @return Array of strings: [ main content, armor content ] | |
| * @throws IllegalStateException | |
| */ | |
| public static String[] playerInventoryToBase64(PlayerInventory playerInventory) throws IllegalStateException { | |
| //get the main content part, this doesn't return the armor | |
| String content = toBase64(playerInventory); |
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
| @SuppressWarnings("unused") | |
| public class Emoji { | |
| public static final String A = "\uD83C\uDD70"; | |
| public static final String AB = "\uD83C\uDD8E"; | |
| public static final String ABC = "\uD83D\uDD24"; | |
| public static final String ABCD = "\uD83D\uDD21"; | |
| public static final String ACCEPT = "\uD83C\uDE51"; | |
| public static final String AERIAL_TRAMWAY = "\uD83D\uDEA1"; | |
| public static final String AIRPLANE = "\u2708"; |
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
| private static Class<?> blockPositionClass = null; | |
| private static Class<?> blockDataClass = null; | |
| private static Class<?> craftWorldClass = null; | |
| /** | |
| * Change a given block extremely quickly using NMS & Reflection | |
| * @param block Block to change | |
| * @param material Material to set the block to | |
| * @param data Any associated data for the block's material | |
| */ |
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
| import org.bukkit.Bukkit; | |
| import org.bukkit.ChatColor; | |
| import org.bukkit.Material; | |
| import org.bukkit.entity.Player; | |
| import org.bukkit.event.EventHandler; | |
| import org.bukkit.event.HandlerList; | |
| import org.bukkit.event.Listener; | |
| import org.bukkit.event.inventory.InventoryClickEvent; | |
| import org.bukkit.event.inventory.InventoryCloseEvent; | |
| import org.bukkit.event.player.PlayerQuitEvent; |
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
| RegisteredListener registeredListener = new RegisteredListener(new Listener() {}, (listener, event) -> { | |
| List<Class> ignoredEvents = Arrays.asList(new Class[] { | |
| BlockFadeEvent.class, | |
| EntityAirChangeEvent.class, | |
| PlayerMoveEvent.class, | |
| PlayerAnimationEvent.class, | |
| BlockPhysicsEvent.class, | |
| VehicleUpdateEvent.class | |
| }); | |
| if (ignoredEvents.contains(event.getClass())) 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
| package com.scarsz.playground; | |
| import java.util.HashMap; | |
| import java.util.LinkedHashMap; | |
| import java.util.Map; | |
| import java.util.Random; | |
| import java.util.concurrent.atomic.AtomicInteger; | |
| /** | |
| * Made by Scarsz |
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
| public enum PokemonGenerationThreeWithTypes { | |
| Bulbasaur(Type.Grass, Type.Poison), | |
| Ivysaur(Type.Grass, Type.Poison), | |
| Venusaur(Type.Grass, Type.Poison), | |
| Charmander(Type.Fire), | |
| Charmeleon(Type.Fire), | |
| Charizard(Type.Fire, Type.Flying), | |
| Squirtle(Type.Water), | |
| Wartortle(Type.Water), |
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
| private int getOnlinePlayers() { | |
| try { | |
| Method onlinePlayerMethod = Server.class.getMethod("getOnlinePlayers"); | |
| if (onlinePlayerMethod.getReturnType().equals(Collection.class)) { | |
| return ((Collection<?>) onlinePlayerMethod.invoke(Bukkit.getServer())).size(); | |
| } else { | |
| return ((Player[]) onlinePlayerMethod.invoke(Bukkit.getServer())).length; | |
| } | |
| } catch (Exception e) { | |
| e.printStackTrace(); |