Skip to content

Instantly share code, notes, and snippets.

View sainttx's full-sized avatar

Matthew Steglinski sainttx

View GitHub Profile
@sainttx
sainttx / TestPlugin.java
Created September 6, 2022 21:05
Test plugin using a menu
package com.sainttx.test;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Material;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.inventory.ItemStack;
@sainttx
sainttx / PlayerConnection.java
Created January 12, 2018 00:40
WIP/Broken - Progress of an attempt to implement reach detection in net.minecraft.server
private double getDistanceToAABB(Vec3D o, Vec3D d, AxisAlignedBB aabb) {
double l = Double.NEGATIVE_INFINITY;
double h = Double.POSITIVE_INFINITY;
for (int i = 0 ; i < 3 ; i++) {
double aabbv1, aabbv2, ro, rd;
if (i == 0) {
aabbv1 = aabb.a;
@Command(
aliases = {"show", "i", "info", "who"},
usage = "<faction>",
desc = "Show details about a faction",
max = 1
)
@Require("factions.show")
public void show(CommandSender sender, @Optional Faction faction) {
if (!(sender instanceof Player) && faction == null) {
sender.sendMessage("/f show <faction>");
package org.ipvp.piston.util;
import java.util.concurrent.TimeUnit;
public class TimeFormatUtil {
// The possible formattable units
private final static TimeUnit[] formattableUnit =
new TimeUnit[] { TimeUnit.DAYS, TimeUnit.HOURS, TimeUnit.MINUTES, TimeUnit.SECONDS };
public class AnimationPlayer {
private ArmorStand armorStand;
private List<Frame> frames = new ArrayList<>();
public void playFrame(int num) {
playFrame(frames.get(num));
}
public void playFrame(Frame frame) {
@sainttx
sainttx / BadgeDemo.java
Created May 10, 2017 14:38
Store badge data in LuckPerms user data cache
private Badge[] getBadgeLayout(Player target) {
LuckPermsApi api = LuckPerms.getApi();
User user = api.getUser(target.getUniqueId());
Optional<UserData> optData = user.getUserDataCache();
// Return 7 null badges if the user has nothing present
if (!optData.isPresent()) {
return new Badge[7];
}
package com.doctordark.hcf.scoreboard.provider;
import com.doctordark.hcf.DateTimeFormats;
import com.doctordark.hcf.HCF;
import com.doctordark.hcf.eventgame.EventTimer;
import com.doctordark.hcf.eventgame.eotw.EotwHandler;
import com.doctordark.hcf.eventgame.faction.ConquestFaction;
import com.doctordark.hcf.eventgame.faction.EventFaction;
import com.doctordark.hcf.eventgame.faction.KothFaction;
import com.doctordark.hcf.eventgame.tracker.ConquestTracker;
package com.doctordark.hcf.timer.type;
import com.doctordark.hcf.HCF;
import com.doctordark.hcf.timer.PlayerTimer;
import com.doctordark.hcf.util.DurationFormatter;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
package org.ipvp.tab.data;
/**
* A read-only representation of raw skin data provided by Mojangs session servers
*/
public final class Skin {
private final String value;
private final String signature;
@sainttx
sainttx / movies_database.txt
Last active January 15, 2017 01:35
Database for relational algebra, editor provided by http://dbis-uibk.github.io/relax/calc.htm#
-- this is an example
group: example
roles = {
mid:number, aid:number, character:string
1, 1, Jack_Torrance
3, 1, Jake_JJ_Gittes
1, 3, Delbert_Grady