This file contains 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 abstract class MainThreadExecutor { | |
public MainThreadExecutor() { | |
MinecraftServer.getServer().processQueue.add(new Runnable() { | |
@Override | |
public void run() { | |
call(); | |
} | |
}); | |
} |
This file contains 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 class Properties { | |
public static void savePropertiesFile() { | |
((DedicatedServer) MinecraftServer.getServer()).propertyManager.savePropertiesFile(); | |
} | |
public static void setServerProperty(ServerProperty property, Object value) { | |
((DedicatedServer) MinecraftServer.getServer()).propertyManager.setProperty(property.getPropertyName(), value); | |
} |
This file contains 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 class Logging { | |
private static final String PREFIX = "MyPrefix"; | |
public static void logStatistic(String message) { | |
logWithExtra("Statistic", message); | |
} | |
public static void logDebug(String message) { | |
logWithExtra("Debug", message); |
This file contains 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 class Announcer { | |
private final String[] announcements; | |
private final int secondsBetween; | |
private BukkitTask announcementTask; | |
public Announcer(int secondsBetween, String... announcements) { | |
this.secondsBetween = secondsBetween; | |
this.announcements = announcements; |
This file contains 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 abstract class AbstractInventory { | |
private static final String SERVER_VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; | |
private static Method handleInventoryCloseEvent; | |
private static Method getHandle; | |
private static Field defaultContainer; | |
private static Field activeContainer; | |
static { |
This file contains 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
echo "----------- [ DELETE SCREEN SESSION ] -----------" | |
screen -ls | |
read -p "Please supply the screen id you would like to delete: " id | |
read -p "Are you sure you want to delete screen $id? [y/N]: " des | |
if [[ $des =~ [yY](es)* ]] | |
then | |
echo "Deleting...." | |
screen -S $id -p 0 -X quit | |
echo "Done!" | |
fi |
This file contains 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
read -p "What is the file path? " path | |
read -p "What is the groupId? " groupId | |
read -p "What is the artifactId? " artifactId | |
read -p "What is the version? " version | |
mvn install:install-file -Dfile=$path -DgroupId=$groupId -DartifactId=$artifactId -Dversion=$version -Dpackaging=jar -DgeneratePom=true |
This file contains 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 abstract class AbstractInventory { | |
private static final String SERVER_VERSION = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; | |
private static Method handleInventoryCloseEvent; | |
private static Method getHandle; | |
private static Field defaultContainer; | |
private static Field activeContainer; | |
static { |
This file contains 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 class InstanceManager<T> { | |
private final List<T> instances = new ArrayList<>(); | |
public InstanceManager(Class<T> superclass, String packageSearch) { | |
new Reflections(packageSearch).getSubTypesOf(superclass).forEach(clazz -> { | |
try { | |
instances.add(clazz.newInstance()); | |
} catch (InstantiationException | IllegalAccessException e) { | |
e.printStackTrace(); |
This file contains 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 class RandomTeleporter { | |
private final LoadingCache<Pair<Location, Location>, List<Pair<Integer, Integer>>> locationCache = CacheBuilder.newBuilder() | |
.expireAfterAccess(1, TimeUnit.MINUTES) | |
.maximumSize(5) | |
.build(new CacheLoader<Pair<Location, Location>, List<Pair<Integer, Integer>>>() { | |
@Override | |
public List<Pair<Integer, Integer>> load(Pair<Location, Location> bounds) throws Exception { | |
final List<Pair<Integer, Integer>> ret = new ArrayList<>(); | |
final Location bounds1 = bounds.getLeft(); |
OlderNewer