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 com.mojang.authlib.GameProfile; | |
| import net.minecraft.core.BlockPosition; | |
| import net.minecraft.world.entity.player.EntityHuman; | |
| import net.minecraft.world.item.ItemWorldMap; | |
| import net.minecraft.world.item.Items; | |
| import net.minecraft.world.level.saveddata.maps.WorldMap; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.Chunk; | |
| import org.bukkit.craftbukkit.v1_17_R1.CraftWorld; | |
| import org.bukkit.craftbukkit.v1_17_R1.map.CraftMapView; |
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.Location; | |
| import org.bukkit.World; | |
| import org.bukkit.block.Block; | |
| import org.bukkit.util.Vector; | |
| import java.util.Iterator; | |
| import java.util.NoSuchElementException; | |
| public class BlockIterator implements Iterator<Block> { |
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 static RayTraceResult rayTracePlayer(Location start, Vector direction, double maxDistance, double raySize, Predicate<Player> filter) { | |
| if (maxDistance < 0.0D) | |
| return null; | |
| Vector startPos = start.toVector(); | |
| Entity nearestHitEntity = null; | |
| RayTraceResult nearestHitResult = null; | |
| double nearestDistanceSq = 1.7976931348623157E308D; | |
| for (Player player : Bukkit.getOnlinePlayers()) { |
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
| @EventHandler(ignoreCancelled = true, priority = EventPriority.HIGH) | |
| public void onCursorClick(InventoryClickEvent event) { | |
| if (event.getCursor() == null || event.getCursor().getType() == Material.AIR) | |
| return; | |
| ItemStack cursor = event.getCursor(); | |
| Phone phone = dao.getPhone(cursor); | |
| if (phone == null) | |
| 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.wizardlybump17.eclipsecrates.util; | |
| import com.mojang.datafixers.util.Pair; | |
| import net.minecraft.network.protocol.game.*; | |
| import net.minecraft.network.syncher.DataWatcherObject; | |
| import net.minecraft.network.syncher.DataWatcherRegistry; | |
| import net.minecraft.server.level.EntityPlayer; | |
| import net.minecraft.world.entity.EnumItemSlot; | |
| import net.minecraft.world.entity.decoration.EntityArmorStand; | |
| import org.bukkit.Location; |
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
| 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); |
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
| @RequiredArgsConstructor | |
| public class SQLUtil { | |
| private static final Pattern PLACEHOLDER = Pattern.compile("\\{[a-zA-Z0-9_?]+}"); | |
| private static final Connection CONNECTION; | |
| static { | |
| Connection con; | |
| try { |
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 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))); |
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 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); |
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.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; |