lifesteal/src/ca/thetechrobo/smp/Limbo.java

38 lines
1.3 KiB
Java

// Idea of Limbo inspired by Hypixel
package ca.thetechrobo.smp;
import java.time.Instant;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.format.TextColor;
public class Limbo {
public static void tpPlayer(Player p, ScoreboardWrapper sw) {
long currentTS = Instant.now().getEpochSecond();
//long banEnds = currentTS + 432000;
long banEnds = currentTS + 10;
sw.saveLong(p, banEnds , "banExpires");
Location loc = p.getLocation();
sw.save(p, loc.getBlockX(), "prebanX");
sw.save(p, loc.getBlockY(), "prebanY");
sw.save(p, loc.getBlockZ(), "prebanZ");
Component pmsg = Component.text("You have lost all of your lives.")
.color(TextColor.color(245, 5, 5));
p.sendMessage(pmsg);
p.sendMessage(Component.text("You are in Limbo for the next 5 days. A peaceful place, with no one to hear you ")
.append(Component.text(" scream...").color(TextColor.color(255, 0, 0))));
}
public static void debug(Player p, ScoreboardWrapper sw) {
long currentTS = Instant.now().getEpochSecond();
long expiry = sw.loadLong(p, "banExpires", 0L);
Boolean hi = (expiry < currentTS);
sw.load(p, "prebanX", 0, false);
sw.load(p, "prebanY", 0, false);
sw.load(p, "prebanZ", 0, false);
}
}