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 java.util.Arrays; | |
| import org.bukkit.Material; | |
| import org.bukkit.entity.Player; | |
| import org.bukkit.inventory.ItemStack; | |
| import org.bukkit.inventory.meta.ItemMeta; | |
| public class NamedItem { | |
| public static void give(Player toPlayer, Material material, String name, String[] lore) { |
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 java.lang.reflect.Field; | |
| import org.bukkit.Bukkit; | |
| import org.bukkit.command.SimpleCommandMap; | |
| import org.bukkit.plugin.PluginManager; | |
| import org.bukkit.plugin.SimplePluginManager; | |
| public class IsCommandCheck { | |
| public boolean isCommand(String command) { |
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.google.common.escape.Escaper; | |
| import com.google.common.io.BaseEncoding; | |
| import com.google.common.net.UrlEscapers; | |
| import com.google.common.primitives.Ints; | |
| import java.security.InvalidKeyException; | |
| import java.security.NoSuchAlgorithmException; | |
| import java.security.SecureRandom; | |
| import java.util.Arrays; | |
| import java.util.Calendar; |
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 io.netty.buffer.ByteBuf; | |
| import io.netty.buffer.ByteBufHolder; | |
| import io.netty.channel.Channel; | |
| import io.netty.channel.ChannelDuplexHandler; | |
| import io.netty.channel.ChannelHandlerContext; | |
| import io.netty.channel.ChannelPromise; | |
| import java.util.concurrent.atomic.AtomicLong; | |
| public class NettyTrafficCounter extends ChannelDuplexHandler { |
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 java.io.File; | |
| import java.net.URISyntaxException; | |
| public class JarUtils { | |
| public static File getCurrentJar() throws URISyntaxException { | |
| return new File(JarUtils.class.getProtectionDomain().getCodeSource().getLocation().toURI().getPath()); | |
| } | |
| } |
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 java.io.File; | |
| public class FolderSize { | |
| private static long getFolderSize(File folder) { | |
| long size = 0; | |
| for (File file : folder.listFiles()) { | |
| if (file == null) { | |
| continue; |
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 java.sql.Connection; | |
| import java.sql.PreparedStatement; | |
| import java.sql.ResultSet; | |
| import java.sql.SQLException; | |
| import java.sql.Statement; | |
| import java.sql.Timestamp; | |
| import java.util.HashMap; | |
| import java.util.Iterator; | |
| import java.util.LinkedList; | |
| import java.util.List; |
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 java.io.File; | |
| import java.util.logging.Level; | |
| import java.util.logging.Logger; | |
| import org.hyperic.sigar.CpuInfo; | |
| import org.hyperic.sigar.CpuPerc; | |
| import org.hyperic.sigar.FileSystemUsage; | |
| import org.hyperic.sigar.Mem; | |
| import org.hyperic.sigar.NetInterfaceStat; | |
| import org.hyperic.sigar.Sigar; |
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.mindrot.jbcrypt.BCrypt; | |
| public class BCryptHasher { | |
| public static String hashPassword(String rawPassword) { | |
| //generate a different salt for each user | |
| return BCrypt.hashpw(rawPassword, BCrypt.gensalt()); | |
| } | |
| public static boolean checkPassword(String passwordHash, String userInput) { |
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
| /* | |
| * Example output: | |
| SI BINARY | |
| 0: 0 B 0 B | |
| 27: 27 B 27 B | |
| 999: 999 B 999 B | |
| 1000: 1.0 kB 1000 B | |
| 1023: 1.0 kB 1023 B | |
| 1024: 1.0 kB 1.0 KiB |