Skip to content

Instantly share code, notes, and snippets.

package me.exerosis.example;
import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.Inventory;
import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
createDirectories(path.getParent());
if (!exists(path)) {
if (resource != null) {
InputStream stream = getSystemResourceAsStream(this.resource.toString());
if (stream == null)
throw new IllegalStateException("Could not find a resource at: " + resource);
copy(stream, path);
} else
createFile(path);
}
createDirectories(path.getParent());
if (!exists(path)) {
if (resource != null) {
InputStream stream = getSystemResourceAsStream(this.resource.toString());
if (stream == null)
throw new IllegalStateException("Could not find a resource at: " + resource);
copy(stream, path);
} else
createFile(path);
}
public static void main(String[] args) {
DataSource source = new HikariDataSource(new HikariConfig("sql.properties"));
Observable<Connection> pool = fromCallable(source::getConnection);
String players = "players";
Field<String> name = field("name");
Field<Integer> level = field("level");
Field<Double> boost = field("boost");
class PlayerData {
public static <Up, From, To> ObservableTransformer<Up, To> subingZip(
Observable<From> source,
BiFunction<Up, From, To> combiner
) {
return upstream -> upstream.map(up -> {
From from = source.blockingFirst();
return combiner.apply(up, from);
});
}
public static int LCSDistance(@NotNull String first, @NotNull String second) {
int m = first.length();
int n = second.length();
int[][] dp = new int[m + 1][n + 1];
for (int i = 0; i <= m; i++) {
for (int j = 0; j <= n; j++) {
if (i == 0 || j == 0) {
dp[i][j] = 0;
} else if (first.charAt(i - 1) == second.charAt(j - 1)) {
private static final Field VEHICLE;
private static final Field PASSENGERS;
static {
Field vehicle = null, passengers = null;
for (Field field : PacketPlayOutMount.class.getDeclaredFields()) {
if (field.getType() == int.class) {
field.setAccessible(true);
vehicle = field;
} else if (field.getType() == int[].class) {
static class MultipleNameTags {
private static final Field VEHICLE;
private static final Field PASSENGERS;
static {
try {
VEHICLE = PacketPlayOutMount.class.getDeclaredField("a");
VEHICLE.setAccessible(true);
PASSENGERS = PacketPlayOutMount.class.getDeclaredField("b");
PASSENGERS.setAccessible(true);
package com.penzzly.engine.core.components.player;
import com.penzzly.engine.architecture.base.Component;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import java.util.function.Predicate;
package com.penzzly.engine.core.mini.partial;
import org.apache.commons.lang3.text.StrLookup;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
import java.util.function.Supplier;
public class StringReplacer<Type> implements Function<Type, StrLookup> {