Skip to content

Instantly share code, notes, and snippets.

View gabrielbs21's full-sized avatar
🎯
Focusing

Gabriel Santos gabrielbs21

🎯
Focusing
View GitHub Profile
{"name":"Primário","settings":"{\"settings\":\"{\\n \\\"workbench.colorTheme\\\": \\\"One Dark Pro\\\",\\n \\\"workbench.productIconTheme\\\": \\\"fluent-icons\\\",\\n \\\"workbench.iconTheme\\\": \\\"eq-material-theme-icons\\\",\\n \\\"emmet.syntaxProfiles\\\": {\\n \\\"javascript\\\": \\\"jsx\\\"\\n },\\n \\\"workbench.startupEditor\\\": \\\"newUntitledFile\\\",\\n \\\"editor.fontSize\\\": 16,\\n \\\"javascript.suggest.autoImports\\\": true,\\n \\\"javascript.updateImportsOnFileMove.enabled\\\": \\\"always\\\",\\n \\\"editor.rulers\\\": [\\n 80,\\n 120\\n ],\\n \\\"extensions.ignoreRecommendations\\\": true,\\n \\\"typescript.tsserver.log\\\": \\\"off\\\",\\n \\\"files.associations\\\": {\\n \\\".sequelizerc\\\": \\\"javascript\\\",\\n \\\".stylelintrc\\\": \\\"json\\\",\\n \\\"*.tsx\\\": \\\"typescriptreact\\\",\\n \\\".env.*\\\": \\\"dotenv\\\",\\n \\\".prettierrc\\\": \\\"json\\\"\\n },\\n \\\"screencastMode.onlyKeyboardShortcuts\\\": true,\\n \\\"cSpell.u
@gabrielbs21
gabrielbs21 / RandomCollection.java
Created May 4, 2021 15:37
Create a data collection to randomly pick it up.
import java.util.NavigableMap;
import java.util.Random;
import java.util.TreeMap;
public class RandomCollection<E> {
private final NavigableMap<Double, E> map = new TreeMap<>();
private final Random random;
private double total = 0;
@gabrielbs21
gabrielbs21 / ItemBuilder.java
Last active March 17, 2021 04:16
A complete ItemBuilder
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import lombok.Getter;
import org.apache.commons.codec.binary.Base64;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
@gabrielbs21
gabrielbs21 / BukkitSerialization.java
Last active September 18, 2020 03:25 — forked from graywolf336/BukkitSerialization.java
Serialize and deserialize the player's inventory, including armor and content.
/**
* 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);