Skip to content

Instantly share code, notes, and snippets.

@WizardlyBump17
WizardlyBump17 / gist:da216252f5e814aac59afae55cfe4dc6
Last active July 7, 2019 15:13
Invisible minecraft enchantments
/*
* File name: Glow.java
*/
import java.lang.reflect.Field;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.enchantments.EnchantmentTarget;
import org.bukkit.inventory.ItemStack;
@WizardlyBump17
WizardlyBump17 / gist:dea00a5fbf17be70d4081bfdae907fe0
Created March 19, 2019 19:36
Send message actionbar to players (1.8 only)
package packetplayoutchat;
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
@WizardlyBump17
WizardlyBump17 / Scroller.java
Created March 22, 2020 18:05 — forked from noobmobile/Scroller.java
Crie inventários com páginas infinitas, utilizando o pattern builder
package com.dont.testes.utils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
@WizardlyBump17
WizardlyBump17 / Event.java
Created March 27, 2020 19:02
Sistema de eventos igual o do Bukkit
package event;
public abstract class Event {
public String getName() {
return getClass().getSimpleName();
}
}
public Object nbtToJava(Object nbt) {
if (!(nbt instanceof NBTBase))
return nbt;
NBTBase base = (NBTBase) nbt;
if (base instanceof NBTTagByte)
return ((NBTTagByte) base).f();
if (base instanceof NBTTagByteArray)
return ((NBTTagByteArray) base).c();
if (base instanceof NBTTagShort)
package com.wizardlybump17.imperiumphones;
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.Logger;
import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.apache.logging.log4j.message.Message;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
@WizardlyBump17
WizardlyBump17 / FortuneCalculadora2Thousand.java
Created May 17, 2021 22:08
gambiarra pra tentar pegar os drops de um item, funciona com fortuna e silk touch kappa
private static final Map<Material, Material> DROPS = new HashMap<Material, Material>() {{
put(Material.CARROT, Material.CARROT_ITEM);
put(Material.POTATO, Material.POTATO_ITEM);
put(Material.NETHER_WARTS, Material.NETHER_STALK);
put(Material.COCOA, Material.INK_SACK);
put(Material.COAL_ORE, Material.COAL);
put(Material.DIAMOND_ORE, Material.DIAMOND);
put(Material.EMERALD_ORE, Material.EMERALD);
put(Material.LAPIS_ORE, Material.INK_SACK);
put(Material.REDSTONE_ORE, Material.REDSTONE);
@WizardlyBump17
WizardlyBump17 / DropCounter3000UpdatedWizardlyBump17.java
Last active May 19, 2021 16:28
Get the block drops. Works with fortune and silk touch
private static final Map<Material, BlockDrop> FIXED_BLOCKS = new HashMap<Material, BlockDrop>() {{
put(Material.CARROT, new BlockDrop(new MaterialData(Material.CARROT_ITEM)));
put(Material.POTATO, new BlockDrop(new MaterialData(Material.POTATO_ITEM)));
put(Material.NETHER_WARTS, new BlockDrop(new MaterialData(Material.NETHER_STALK)));
put(Material.COCOA, new BlockDrop(new MaterialData(Material.INK_SACK, (byte) 3)));
put(Material.IRON_ORE, new BlockDrop(new MaterialData(Material.IRON_ORE)));
put(Material.GOLD_ORE, new BlockDrop(new MaterialData(Material.GOLD_ORE)));
put(Material.COAL_ORE, new BlockDrop(new MaterialData(Material.COAL), new MaterialData(Material.COAL_ORE)));
put(Material.DIAMOND_ORE, new BlockDrop(new MaterialData(Material.DIAMOND), new MaterialData(Material.DIAMOND_ORE)));
put(Material.EMERALD_ORE, new BlockDrop(new MaterialData(Material.EMERALD), new MaterialData(Material.EMERALD_ORE)));
@WizardlyBump17
WizardlyBump17 / LeitorDeSQLReaderBoladao87923463874.java
Created June 15, 2021 20:26
beta version of my .sql reader 😳
@RequiredArgsConstructor
public class SQLUtil {
private static final Pattern PLACEHOLDER = Pattern.compile("\\{[a-zA-Z0-9_?]+}");
private static final Connection CONNECTION;
static {
Connection con;
try {
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(Bukkit.getPluginManager().getPlugin("WLib"), PacketType.fromClass(PacketPlayOutSetSlot.class), PacketType.fromClass(PacketPlayOutEntityMetadata.class), PacketType.fromClass(PacketPlayOutEntityEquipment.class)) {
@SneakyThrows
@Override
public void onPacketSending(PacketEvent event) {
final Object handle = event.getPacket().getHandle();
if (handle instanceof PacketPlayOutSetSlot)
setSlot((PacketPlayOutSetSlot) handle);