This commit is contained in:
Brandon 2023-05-25 01:02:33 +01:00
commit ca1b675b9a
1001 changed files with 84488 additions and 0 deletions

40
Network/eHub/build.gradle Normal file
View File

@ -0,0 +1,40 @@
plugins {
id 'java'
}
group 'com.elevatemc'
version '1.0'
sourceSets {
main.java.srcDirs = ['src/main/java']
main.resources.srcDirs = ['src/main/resources']
}
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly files('../lib/espigot.jar')
compileOnly files('../lib/primespigot.jar')
compileOnly files('../lib/universespigot.jar')
compileOnly project(':eLib')
compileOnly 'com.github.koca2000:NoteBlockAPI:1.6.1'
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
}
processResources {
def props = [version: 'git rev-parse --verify --short HEAD'.execute().text.trim()]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}

Binary file not shown.

View File

@ -0,0 +1,7 @@
main: com.elevatemc.ehub.eHub
name: eHub
version: '7227fd6'
description: The hub plugin for ElevateMC
author: ElevateMC Development Team
website: https://elevatemc.com
depend: [eLib, Prime]

View File

@ -0,0 +1,2 @@
Manifest-Version: 1.0

View File

@ -0,0 +1,34 @@
package com.elevatemc.ehub.command;
import com.elevatemc.ehub.eHub;
import com.elevatemc.elib.command.Command;
import com.elevatemc.elib.command.param.Parameter;
import com.xxmicloxx.NoteBlockAPI.model.Song;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
public final class MusicCommands {
@Command(names = {"music skip"}, permission = "music.skip")
public static void skip(Player sender) {
eHub.getInstance().getRadioSongPlayer().playNextSong();
sender.sendMessage(ChatColor.GREEN + "Skipped this song!");
}
@Command(names = {"music list"}, permission = "music.list")
public static void list(Player sender) {
eHub.getInstance().getRadioSongPlayer().getPlaylist().getSongList().forEach(song -> {
sender.sendMessage(ChatColor.YELLOW + song.getTitle());
});
}
@Command(names = {"music play"}, permission = "music.play")
public static void play(Player sender, @Parameter(name="song-name", wildcard = true) String name) {
Song song = eHub.getInstance().getRadioSongPlayer().getPlaylist().getSongList().stream().filter(s -> s.getTitle().equalsIgnoreCase(name)).findFirst().orElse(null);
if (song == null) {
sender.sendMessage(ChatColor.RED + "Could not find that song!");
return;
}
eHub.getInstance().getRadioSongPlayer().playSong(eHub.getInstance().getRadioSongPlayer().getPlaylist().getIndex(song));
}
}

View File

@ -0,0 +1,29 @@
package com.elevatemc.ehub.command;
import com.elevatemc.elib.command.Command;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public final class SpawnCommands {
@Command(names = {"setspawn"}, permission = "op")
public static void setSpawn(Player sender) {
Location loc = sender.getLocation();
sender.getWorld().setSpawnLocation(
loc.getBlockX() + 0.5,
loc.getBlockY(),
loc.getBlockZ() + 0.5,
loc.getYaw(),
loc.getPitch()
);
sender.sendMessage(ChatColor.YELLOW + "Spawn point updated!");
}
@Command(names = {"spawn"}, permission = "op")
public static void teleportToSpawn(Player sender) {
sender.teleport(sender.getWorld().getSpawnLocation());
sender.sendMessage(ChatColor.GREEN + "You have been teleported to spawn!");
}
}

View File

@ -0,0 +1,115 @@
package com.elevatemc.ehub.database;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.armor.ArmorType;
import com.elevatemc.ehub.type.particle.ParticleType;
import com.elevatemc.elib.eLib;
import com.google.gson.*;
import lombok.Getter;
@Getter
public class RedisManager {
private final eHub instance = eHub.getInstance();
private final JsonParser parser;
public RedisManager() {
parser = new JsonParser();
}
//How we load all the cosmetics for the player via redis
public void load (Profile profile) {
eLib.getInstance().runRedisCommand(jedis -> {
if (jedis.hexists("user", profile.getUuid().toString())) {
String stringObject = jedis.hget("users", profile.getUuid().toString());
JsonObject object = parser.parse(stringObject).getAsJsonObject();
String armorType = object.get("armorType").getAsString().toUpperCase();
profile.setArmorType(armorType.isEmpty() ? null : ArmorType.valueOf(armorType));
if (profile.getArmorType() != null) {
profile.setEnchanted(object.get("enchanted").getAsBoolean());
profile.setAstronaut(object.get("astronaut").getAsBoolean());
JsonArray array = object.get("armors").getAsJsonArray();
int i = 0;
for (JsonElement element : array) {
profile.getArmors() [i] = element.getAsBoolean();
i++;
}
}
String name = object.get("particleType").getAsString();
profile.setParticleType(name == null ? null : name.isEmpty() ? null : ParticleType.valueOf(name.replace(" Particle", "").toUpperCase()));
} else {
JsonObject object = new JsonObject();
JsonArray array = new JsonArray();
object.addProperty("armorType", "");
object.addProperty("particleType", "");
for (boolean value : profile.getArmors()) {
array.add(new JsonPrimitive(value));
}
object.add("armors", array);
object.addProperty("enchanted", false);
object.addProperty("astronaut", false);
jedis.hset("users", profile.getUuid().toString(), object.toString());
}
return null;
});
}
//How we save armor via redis
public void saveArmor (Profile profile, ArmorType type) {
eLib.getInstance().runRedisCommand(jedis -> {
String stringObject = jedis.hget("users", profile.getUuid().toString());
JsonObject object = parser.parse(stringObject).getAsJsonObject();
if (type != null) {
JsonArray array = new JsonArray();
object.addProperty("enchanted", profile.isEnchanted());
for (boolean value : profile.getArmors()) {
array.add(new JsonPrimitive(value));
}
object.add("armors", array);
}
object.addProperty("astronaut", profile.isAstronaut());
object.addProperty("armorType", type == null ? "" : type.getName());
jedis.hset("users", profile.getUuid().toString(), object.toString());
return null;
});
}
//How we save Particles via redis
public void saveParticle (Profile profile, ParticleType type) {
eLib.getInstance().runRedisCommand(jedis -> {
String stringObject = jedis.hget("users", profile.getUuid().toString());
JsonObject object = parser.parse(stringObject).getAsJsonObject();
object.addProperty("particleType", type == null ? "" : type.getName());
jedis.hset("users", profile.getUuid().toString(), object.toString());
return null;
});
}
}

View File

@ -0,0 +1,149 @@
package com.elevatemc.ehub;
import cc.fyre.universe.Universe;
import cc.fyre.universe.server.Server;
import com.elevatemc.ehub.database.RedisManager;
import com.elevatemc.ehub.listener.*;
import com.elevatemc.ehub.profile.manager.ProfileManager;
import com.elevatemc.ehub.queue.QueueHandler;
import com.elevatemc.ehub.scoreboard.eHubScoreboardConfiguration;
import com.elevatemc.ehub.tab.eHubTabProvider;
import com.elevatemc.ehub.type.armor.task.ArmorTask;
import com.elevatemc.ehub.type.particle.task.ParticleTask;
import com.elevatemc.ehub.utils.PlayerCountTask;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.tab.data.TabList;
import com.google.common.collect.ImmutableList;
import com.mysql.jdbc.StringUtils;
import com.xxmicloxx.NoteBlockAPI.model.Playlist;
import com.xxmicloxx.NoteBlockAPI.model.RepeatMode;
import com.xxmicloxx.NoteBlockAPI.model.Song;
import com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer;
import com.xxmicloxx.NoteBlockAPI.utils.NBSDecoder;
import dev.apposed.prime.spigot.Prime;
import lombok.Getter;
import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public final class eHub extends JavaPlugin {
@Getter private static eHub instance;
@Getter private Prime prime;
@Getter private QueueHandler queueHandler;
@Getter
private RedisManager redisManager;
@Getter
private ParticleTask particleTask;
@Getter
private ProfileManager profileManager;
@Getter
private ArmorTask armorTask;
private final List<String> serversToPing = ImmutableList.of("ALL", "Practice");
@Getter RadioSongPlayer radioSongPlayer = null;
@Override
public void onEnable() {
instance = this;
prime = Prime.getPlugin(Prime.class);
queueHandler = new QueueHandler();
getServer().getPluginManager().registerEvents(new HubListener(), this);
getServer().getPluginManager().registerEvents(new PreventionListener(), this);
getServer().getPluginManager().registerEvents(new FunListener(), this);
setupMusicPlayer();
this.loadManagers();
this.loadHandlers();
this.loadTasks();
getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
getServer().getScheduler().runTaskTimer(this, new PlayerCountTask(serversToPing), 0, 20L);
eLib.getInstance().getCommandHandler().registerAll(this);
eLib.getInstance().getScoreboardHandler().setConfiguration(eHubScoreboardConfiguration.create());
eLib.getInstance().getTabHandler().setTabList(new TabList(this, new eHubTabProvider()));
}
public String getGlobalPlayerCount() {
int players = 0;
for (Server server : Universe.getInstance().getUniverseHandler().getServers()) {
players += server.getOnlinePlayers().get();
}
return String.valueOf(players);
}
public String getServerPlayerCount(String server) {
return String.valueOf(Universe.getInstance().getUniverseHandler().serverFromName(server).getOnlinePlayers().get());
}
public String getMaxPlayerCount(String server) {
return String.valueOf(Universe.getInstance().getUniverseHandler().serverFromName("Elevate-Practice").getMaximumPlayers().get());
}
public void setupMusicPlayer() {
if (!getDataFolder().exists()) getDataFolder().mkdir();
File songsDirectory = new File(getDataFolder(), "songs");
if (!songsDirectory.exists()) songsDirectory.mkdir();
if (songsDirectory.isDirectory()) {
ArrayList<Song> songs = new ArrayList<>();
for (File file : songsDirectory.listFiles()) {
if (file.isDirectory()) continue;
Song song = NBSDecoder.parse(file);
if (song == null) continue;
if (StringUtils.isEmptyOrWhitespaceOnly(song.getTitle())) {
file.delete();
Bukkit.getLogger().warning("File " + file.getName() + " has no title, deleted!");
continue;
}
if (song.getTitle().length() > 12) {
song = new Song(song.getSpeed(), song.getLayerHashMap(), song.getSongHeight(), song.getLength(), song.getTitle().substring(0, 12) + "", song.getAuthor(), song.getOriginalAuthor(), song.getDescription(), song.getPath(), song.getFirstCustomInstrumentIndex(), song.getCustomInstruments(), song.isStereo());
}
songs.add(song);
}
Bukkit.getLogger().info("Loaded " + songs.size() + " songs.");
radioSongPlayer = new RadioSongPlayer(new Playlist(songs.toArray(new Song[0])));
radioSongPlayer.setRepeatMode(RepeatMode.ALL);
radioSongPlayer.setPlaying(true);
radioSongPlayer.setRandom(true);
}
getServer().getPluginManager().registerEvents(new MusicListener(), this);
}
private void loadManagers() {
redisManager = new RedisManager();
profileManager = new ProfileManager();
}
private void loadTasks() {
armorTask = new ArmorTask();
particleTask = new ParticleTask();
}
private void loadHandlers() {
getServer().getPluginManager().registerEvents(new PlayerListener(), this);
}
@Override
public void onDisable() {
armorTask.cancel();
particleTask.cancel();
getProfileManager().getProfiles().clear();
}
}

View File

@ -0,0 +1,133 @@
package com.elevatemc.ehub.listener;
import com.elevatemc.ehub.eHub;
import com.elevatemc.elib.util.ParticleEffect;
import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.*;
import org.bukkit.metadata.FixedMetadataValue;
import org.bukkit.util.Vector;
import org.spigotmc.event.entity.EntityDismountEvent;
public class FunListener implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent e) {
e.getPlayer().setAllowFlight(true);
}
@EventHandler
public void onDoubleJumpMove(PlayerMoveEvent e) {
Player player = e.getPlayer();
if (player.getGameMode().equals(GameMode.CREATIVE)) return;
if (!((LivingEntity) player).isOnGround())
if (player.getAllowFlight()) return;
boolean onGround = ((Entity)player).isOnGround();
if (player.hasMetadata("DOUBLE_JUMPED") && onGround) {
player.removeMetadata("DOUBLE_JUMPED", eHub.getInstance());
player.setAllowFlight(true);
}
}
@EventHandler
public void onDoubleJumpFlight(PlayerToggleFlightEvent e) {
Player player = e.getPlayer();
if (player.getGameMode().equals(GameMode.CREATIVE)) return;
e.setCancelled(true);
player.setFlying(false);
player.setAllowFlight(false);
if (player.hasMetadata("BOOSTED")) {
player.removeMetadata("BOOSTED", eHub.getInstance());
}
if (!player.hasMetadata("DOUBLE_JUMPED")) {
player.setMetadata("DOUBLE_JUMPED", new FixedMetadataValue(eHub.getInstance(), true));
final Location loc = player.getLocation();
final double otherBoost = 2.5;
final Sound sound = Sound.PISTON_EXTEND;
final Vector vector = loc.getDirection().multiply(otherBoost).setY(1.75);
player.setVelocity(vector);
player.playSound(loc, sound, 2,2);
ParticleEffect.CLOUD.display(0 ,-0.5F, 0, 0.05F, 25, loc, player);
}
}
@EventHandler
public void onSneak(PlayerToggleSneakEvent e) {
if (e.isSneaking()) {
Player player = e.getPlayer();
if (player.getGameMode().equals(GameMode.CREATIVE)) return;
boolean onGround = ((Entity)player).isOnGround();
if (!player.hasMetadata("BOOSTED") && !onGround) {
player.setMetadata("BOOSTED", new FixedMetadataValue(eHub.getInstance(), true));
final Location loc = player.getLocation();
final double otherBoost = 3;
final Sound sound = Sound.BAT_TAKEOFF;
final Vector vector = loc.getDirection().multiply(otherBoost);
player.setVelocity(vector);
player.playSound(loc, sound, 2,2);
ParticleEffect.FLAME.display(0 ,-0.5F, 0, 0.05F, 25, loc, player);
}
}
}
@EventHandler
public void onProjectileLaunch(ProjectileLaunchEvent e) {
if (e.getEntity().getShooter() instanceof Player) {
final Player player = (Player)e.getEntity().getShooter();
if (e.getEntity() instanceof EnderPearl) {
Entity pearl = player.getVehicle();
if (pearl != null) {
pearl.remove();
}
Projectile proj = e.getEntity();
if (proj.getType() == EntityType.ENDER_PEARL) {
Bukkit.getScheduler().runTaskLater(eHub.getInstance(), () -> {
if (!proj.isDead()) {
proj.setPassenger(player);
}
player.getInventory().getItem(player.getInventory().getHeldItemSlot()).setAmount(64);
}, 3L);
}
} else {
e.getEntity().remove();
}
}
}
@EventHandler
public void onEntityDismount(EntityDismountEvent e) {
if (e.getEntity() instanceof Player) {
final Player player = (Player)e.getEntity();
if (player != null && player.getVehicle() instanceof EnderPearl) {
Entity pearl = player.getVehicle();
if (pearl != null) {
player.eject();
pearl.remove();
}
}
}
}
@EventHandler
public void onQuit(PlayerQuitEvent e) {
Player player = e.getPlayer();
Entity pearl = player.getVehicle();
if (pearl != null) {
pearl.remove();
return;
}
}
}

View File

@ -0,0 +1,234 @@
package com.elevatemc.ehub.listener;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.menu.cosmetics.CosmeticsMenu;
import com.elevatemc.ehub.menu.selector.ServerSelector;
import com.elevatemc.ehub.utils.HubItems;
import com.elevatemc.elib.util.Pair;
import dev.apposed.prime.spigot.module.profile.Profile;
import dev.apposed.prime.spigot.module.profile.ProfileHandler;
import dev.apposed.prime.spigot.module.profile.identity.ProfileIdentity;
import dev.apposed.prime.spigot.module.profile.punishment.Punishment;
import dev.apposed.prime.spigot.module.profile.punishment.type.PunishmentType;
import dev.apposed.prime.spigot.module.rank.meta.RankMeta;
import dev.apposed.prime.spigot.module.server.scoreboard.PrimeScoreboardStyle;
import dev.apposed.prime.spigot.util.Color;
import org.apache.commons.lang.StringUtils;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.*;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.metadata.FixedMetadataValue;
import java.util.Optional;
public class HubListener implements Listener {
private static final ProfileHandler profileHandler = eHub.getInstance().getPrime().getModuleHandler().getModule(ProfileHandler.class);
private static final String networkName = eHub.getInstance().getPrime().getConfig().getString("network.name");
private static final String appealLink = eHub.getInstance().getPrime().getConfig().getString("network.appeal");
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
e.setJoinMessage(null);
for (Player otherPlayer : Bukkit.getOnlinePlayers()) {
player.hidePlayer(otherPlayer);
otherPlayer.hidePlayer(player);
}
player.spigot().setCollidesWithEntities(false);
player.setGameMode(GameMode.SURVIVAL);
player.teleport(player.getWorld().getSpawnLocation());
PlayerInventory inventory = player.getInventory();
inventory.clear();
inventory.setArmorContents(null);
if (player.hasMetadata("MUSIC_DISABLED")) {
inventory.setItem(7, HubItems.MUSIC_DISABLED);
} else {
inventory.setItem(7, HubItems.MUSIC_ENABLED);
}
inventory.setItem(4, HubItems.COSMETICS);
inventory.setItem(8, HubItems.ENDER_PEARLS);
inventory.setHeldItemSlot(0);
player.setWalkSpeed(0.3F);
player.playSound(player.getLocation(), Sound.SUCCESSFUL_HIT, 1, 1);
player.sendMessage(StringUtils.repeat(" \n", 100));
profileHandler.load(player.getUniqueId()).thenAccept(profile -> {
if (profile.hasActivePunishment(PunishmentType.BAN)) {
player.setMetadata("banned", new FixedMetadataValue(eHub.getInstance(), true));
Optional<Punishment> punishmentOptional = profile.getActivePunishment(PunishmentType.BAN);
if (punishmentOptional.isPresent()) {
Punishment punishment = punishmentOptional.get();
if (punishment.getRemaining() == Long.MAX_VALUE) {
player.sendMessage(
ChatColor.translateAlternateColorCodes('&', "&cYour account has been permanently suspended from the " + networkName + " Network.\n\n&cAppeal on " + appealLink + ".")
);
} else {
player.sendMessage(
ChatColor.translateAlternateColorCodes('&', "&cYour account has been suspended from the " + networkName + " Network for " + punishment.formatDuration() + ".\n\n&cAppeal on " + appealLink + ".")
);
}
return;
}
}
if (profile.hasActivePunishment(PunishmentType.BLACKLIST)) {
player.setMetadata("banned", new FixedMetadataValue(eHub.getInstance(), true));
Optional<Punishment> punishmentOptional = profile.getActivePunishment(PunishmentType.BAN);
if (punishmentOptional.isPresent()) {
player.sendMessage(
ChatColor.translateAlternateColorCodes('&', "&cYour account has been permanently blacklisted from the " + networkName + " Network" + "\n&cAppeal on " + appealLink + ".")
);
player.setMetadata("related", new FixedMetadataValue(eHub.getInstance(), "related"));
return;
}
}
// identity check - if they have a rank that allows them to bypass ip bans this will be skipped
if (!profile.hasMeta(RankMeta.IP_BYPASS)) {
for (ProfileIdentity identity : profile.getIdentities()) {
Optional<Profile> punishedIdentityOptional = profileHandler.identityIsPunished(identity);
if (punishedIdentityOptional.isPresent()) {
Profile punishedProfile = punishedIdentityOptional.get();
if (punishedProfile.hasActivePunishment(PunishmentType.BAN)) {
player.setMetadata("banned", new FixedMetadataValue(eHub.getInstance(), true));
Optional<Punishment> punishmentOptional = punishedProfile.getActivePunishment(PunishmentType.BAN);
if (punishmentOptional.isPresent()) {
Punishment punishment = punishmentOptional.get();
if (punishment.getRemaining() == Long.MAX_VALUE) {
player.sendMessage(
ChatColor.translateAlternateColorCodes('&', "&cYour account has been permanently suspended from the " + networkName + " Network\n&cThis punishment is in relation to &r" + punishedProfile.getColoredName() + "\n&cAppeal on " + appealLink + ".")
);
} else {
player.sendMessage(
ChatColor.translateAlternateColorCodes('&', "&cYour account has been suspended from the " + networkName + " Network for " + punishment.formatDuration() + "\n&cThis punishment is in relation to &r" + punishedProfile.getColoredName() + "\n&cAppeal on " + appealLink + ".")
);
}
player.setMetadata("related", new FixedMetadataValue(eHub.getInstance(), "related"));
return;
}
}
if (punishedProfile.hasActivePunishment(PunishmentType.BLACKLIST)) {
Optional<Punishment> punishmentOptional = punishedProfile.getActivePunishment(PunishmentType.BLACKLIST);
if (punishmentOptional.isPresent()) {
player.sendMessage(
ChatColor.translateAlternateColorCodes('&', "&cYour account has been permanently blacklisted from the " + networkName + " Network\n&cThis punishment is in relation to &r" + punishedProfile.getColoredName() + "\n&cAppeal on " + appealLink + ".")
);
player.setMetadata("related", new FixedMetadataValue(eHub.getInstance(), "related"));
return;
}
}
if (!punishedProfile.hasActivePunishment(PunishmentType.BAN) && !punishedProfile.hasActivePunishment(PunishmentType.BLACKLIST)) {
player.removeMetadata("related", eHub.getInstance());
}
}
}
}
if(!profile.hasActivePunishment(PunishmentType.BLACKLIST) && !profile.hasActivePunishment(PunishmentType.BAN) && !player.hasMetadata("related")) {
player.removeMetadata("banned", eHub.getInstance());
}
});
if(!player.hasMetadata("banned")) inventory.setItem(0, HubItems.SELECT_SERVER);
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
player.sendMessage("");
player.sendMessage("" + style.getKey() + "Welcome to the " + style.getKey() + ChatColor.BOLD + "Elevate Network" + style.getValue() + "!");
player.sendMessage("");
player.sendMessage(" " + ChatColor.GRAY + "" + style.getKey() + " Website: " + style.getValue() + "https://elevatemc.com");
player.sendMessage(" " + ChatColor.GRAY + "" + style.getKey() + " Store: " + style.getValue() + "https://store.elevatemc.com");
player.sendMessage(" " + ChatColor.GRAY + "" + style.getKey() + " Twitter: " + style.getValue() + "https://twitter.com/elevatemcnet");
player.sendMessage(" " + ChatColor.GRAY + "" + style.getKey() + " Discord: " + style.getValue() + "https://elevatemc.com/discord");
player.sendMessage(" " + ChatColor.GRAY + "" + style.getKey() + " Telegram: " + style.getValue() + "https://t.me/ElevateMC");
player.sendMessage(" " + ChatColor.GRAY + "" + style.getKey() + " NameMC: " + style.getValue() + "https://namemc.com/elevatemc.com");
player.sendMessage("");
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent e) {
e.setQuitMessage(null);
Player player = e.getPlayer();
eHub.getInstance().getQueueHandler().getPositions().remove(e.getPlayer().getUniqueId());
if (player.getVehicle() != null) {
player.getVehicle().leaveVehicle();
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent e) {
if (!e.hasItem() || !e.getAction().name().contains("RIGHT_")) {
return;
}
ItemStack item = e.getItem();
if(e.getPlayer().hasMetadata("banned")) return;
if (item.isSimilar(HubItems.SELECT_SERVER)) {
new ServerSelector().openMenu(e.getPlayer());
return;
}
if (item.isSimilar(HubItems.COSMETICS)) {
new CosmeticsMenu().openMenu(e.getPlayer());
return;
}
if (item.isSimilar(HubItems.ENDER_PEARLS)) {
return;
}
Player player = e.getPlayer();
Inventory inventory = player.getInventory();
if (item.isSimilar(HubItems.MUSIC_DISABLED)) {
player.removeMetadata("MUSIC_DISABLED", eHub.getInstance());
eHub.getInstance().getRadioSongPlayer().addPlayer(player);
inventory.setItem(4, HubItems.MUSIC_ENABLED);
return;
}
if (item.isSimilar(HubItems.MUSIC_ENABLED)) {
player.setMetadata("MUSIC_DISABLED", new FixedMetadataValue(eHub.getInstance(), true));
eHub.getInstance().getRadioSongPlayer().removePlayer(player);
inventory.setItem(4, HubItems.MUSIC_DISABLED);
return;
}
if (!e.getPlayer().hasMetadata("build")) {
e.setCancelled(true);
}
}
@EventHandler
public void onChat(AsyncPlayerChatEvent event) {
if(!event.getPlayer().hasMetadata("banned")) return;
event.setCancelled(true);
event.getPlayer().sendMessage(Color.translate("&cYou are not allowed to type in chat!"));
}
@EventHandler
public void onCommand(PlayerCommandPreprocessEvent event) {
if(!event.getPlayer().hasMetadata("banned")) return;
if(!event.getMessage().equalsIgnoreCase("/register") && !event.getMessage().equalsIgnoreCase("/resetpassword")) {
event.getPlayer().sendMessage(Color.translate("&cThe only command you are allowed to run is /register."));
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,19 @@
package com.elevatemc.ehub.listener;
import com.elevatemc.ehub.eHub;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
public class MusicListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
if (!player.hasMetadata("MUSIC_DISABLED")) {
eHub.getInstance().getRadioSongPlayer().addPlayer(player);
}
}
}

View File

@ -0,0 +1,47 @@
package com.elevatemc.ehub.listener;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.elib.util.TaskUtil;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
public class PlayerListener implements Listener {
private final eHub plugin = eHub.getInstance();
@EventHandler(ignoreCancelled = true)
public void onAsyncPlayerPreLoginEvent(AsyncPlayerPreLoginEvent event) {
Profile profile = new Profile(event.getUniqueId());
plugin.getRedisManager().load(profile);
}
@EventHandler(ignoreCancelled = true)
public void onPlayerJoinEvent(PlayerJoinEvent event) {
Player player = event.getPlayer();
for (ItemStack stack : player.getInventory().getArmorContents()) {
stack.setType(Material.AIR);
}
player.updateInventory();
}
@EventHandler
public void onPlayerQuitEvent(PlayerQuitEvent event) {
TaskUtil.runTaskAsynchronously(() -> {
Profile profile = plugin.getProfileManager().getByUuid(event.getPlayer().getUniqueId());
plugin.getRedisManager().saveArmor(profile, profile.getArmorType());
plugin.getRedisManager().saveParticle(profile, profile.getParticleType());
plugin.getProfileManager().getProfiles().remove(profile.getUuid());
});
}
}

View File

@ -0,0 +1,104 @@
package com.elevatemc.ehub.listener;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.FoodLevelChangeEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryMoveItemEvent;
import org.bukkit.event.player.PlayerAchievementAwardedEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.weather.WeatherChangeEvent;
public class PreventionListener implements Listener {
@EventHandler
public void onBreak(BlockBreakEvent e) {
if (!e.getPlayer().hasMetadata("build")) {
e.setCancelled(true);
}
}
@EventHandler
public void onPlace(BlockPlaceEvent e) {
if (!e.getPlayer().hasMetadata("build")) {
e.setCancelled(true);
}
}
@EventHandler
public void onClick(InventoryClickEvent e) {
if (!e.getWhoClicked().hasMetadata("build")) {
e.setCancelled(true);
}
}
@EventHandler
public void onBurn(BlockBurnEvent e) {
e.setCancelled(true);
}
@EventHandler
public void onItemDrop(PlayerDropItemEvent e) {
e.setCancelled(true);
}
@EventHandler
public void onItemPickup(PlayerPickupItemEvent e) {
e.setCancelled(true);
}
@EventHandler
public void onItemMove(InventoryMoveItemEvent e) {
e.setCancelled(true);
}
@EventHandler
public void onWeatherChange(WeatherChangeEvent e) {
e.setCancelled(e.toWeatherState());
}
@EventHandler
public void onDamage(FoodLevelChangeEvent e) {
if(e.getEntity() instanceof Player) {
e.setFoodLevel(20);
}
}
@EventHandler
public void onDamage(EntityDamageEvent e) {
if(e.getEntity() instanceof Player) {
e.setCancelled(true);
}
}
@EventHandler
public void onDamage(PlayerAchievementAwardedEvent e) {
e.setCancelled(true);
}
@EventHandler
public void onMove(PlayerMoveEvent e) {
Location location = e.getTo();
if (location.getY() < 5 || location.getX() > 300 || location.getZ() > 300) {
Player player = e.getPlayer();
if (player.getVehicle() != null) {
Entity pearl = player.getVehicle();
if (pearl != null) {
player.eject();
pearl.remove();
}
}
player.teleport(player.getWorld().getSpawnLocation());
}
}
}

View File

@ -0,0 +1,133 @@
package com.elevatemc.ehub.menu.cosmetics;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.armor.ArmorType;
import com.elevatemc.ehub.type.particle.ParticleType;
import com.elevatemc.ehub.utils.CC;
import com.elevatemc.ehub.utils.ItemBuilder;
import com.elevatemc.elib.menu.Button;
import com.elevatemc.elib.menu.Menu;
import com.google.common.collect.Maps;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class CosmeticsMenu extends Menu {
@Override
public String getTitle(Player player) {
return CC.DARK_AQUA + "Cosmetics";
}
@Override
public int size(Player player) {
return 9;
}
@Override
public boolean isPlaceholder() {
return true;
}
@Override
public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = Maps.newHashMap();
Profile profile = eHub.getInstance().getProfileManager().getByUuid(player.getUniqueId());
ArmorType armorType = profile.getArmorType();
buttons.put(2, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setName(CC.AQUA + "Armor")
.addEnchantment(Enchantment.DURABILITY)
.setLore(Arrays.asList(
"",
CC.GRAY + "Change your armor design.",
"",
CC.AQUA + "Selected Armor" + CC.GRAY + ": " + CC.WHITE + (armorType == null ? "None" : armorType.getName()),
"",
CC.AQUA + "Click to view Armor Designs."))
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
if (eHub.getInstance().getProfileManager().getByUuid(player.getUniqueId()).getArmorType() == null) {
new RanksMenu().openMenu(player);
} else {
new EditorMenu().openMenu(player);
}
Button.playSuccess(player);
}
});
ParticleType particleType = profile.getParticleType();
buttons.put(6, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(Material.NETHER_STAR)
.setName(CC.AQUA + "Particles")
.setLore(Arrays.asList(
"",
CC.GRAY + "A lot of different particles",
CC.GRAY + "are spawning around you.",
"",
CC.AQUA + "Selected Particle" + CC.GRAY + ": " + CC.WHITE + (particleType == null ? "None" : particleType.getName().replace(" Particle", "")),
"",
CC.AQUA + "Click to view list of Particles."))
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
new ParticlesMenu().openMenu(player);
Button.playSuccess(player);
}
});
return buttons;
}
}

View File

@ -0,0 +1,413 @@
package com.elevatemc.ehub.menu.cosmetics;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.armor.ArmorType;
import com.elevatemc.ehub.utils.CC;
import com.elevatemc.ehub.utils.ItemBuilder;
import com.elevatemc.elib.menu.Button;
import com.elevatemc.elib.menu.Menu;
import com.google.common.collect.Maps;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class EditorMenu extends Menu {
@Override
public String getTitle(Player player) {
return CC.DARK_AQUA + "Choose your Armor";
}
@Override
public int size(Player player) {
return 54;
}
@Override
public boolean isPlaceholder() {
return true;
}
@Override
public boolean isAutoUpdate() {
return true;
}
@Override
public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = Maps.newHashMap();
Profile profile = eHub.getInstance().getProfileManager().getByUuid(player.getUniqueId());
ArmorType type = profile.getArmorType();
buttons.put(14, new Button() {
@Override
public String getName(Player player) {
return CC.B_GREEN + "Choose your armor";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.GRAY + "Changes your armor design.",
"",
CC.AQUA + "Current Armor" + CC.GRAY + ": " + (type == null ? CC.WHITE + "None" : type.getDisplayColor() + type.getName()),
"",
CC.GRAY + "Click to change your " + CC.B_AQUA + "Armor Design.");
}
@Override
public Material getMaterial(Player player) {
return Material.PAPER;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
new RanksMenu().openMenu(player);
Button.playSuccess(player);
};
});
buttons.put(45, new Button() {
@Override
public String getName(Player player) {
return CC.B_RED + "Back";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.RED + "Click here to return to",
CC.RED + "the previous menu.");
}
@Override
public Material getMaterial(Player player) {
return Material.REDSTONE;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
new CosmeticsMenu().openMenu(player);
Button.playSuccess(player);
}
});
if (type == null) {
return buttons;
}
buttons.put(12, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(type.getItems()[3].clone())
.setName(CC.RED + "Helmet")
.setLore(Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "helmet armor piece on you?",
"",
profile.getArmors()[3] ?
CC.RED + "Click to turn it off." :
CC.GREEN + "Click to turn it on."))
.setColor(type == ArmorType.ELEVATE ? Color.fromRGB(type.getR(), type.getG(), type.getB()) : type.getColor())
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
profile.setAstronaut(false);
profile.getArmors()[3] = !profile.getArmors()[3];
Button.playFail(player);
}
});
buttons.put(21, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(type.getItems()[2].clone())
.setName(CC.RED + "Chestplate")
.setLore(Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "chestplate armor piece on you?",
"",
profile.getArmors()[2] ?
CC.RED + "Click to turn it off." :
CC.GREEN + "Click to turn it on."))
.setColor(type == ArmorType.ELEVATE ? Color.fromRGB(type.getR(), type.getG(), type.getB()) : type.getColor())
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
profile.getArmors()[2] = !profile.getArmors()[2];
Button.playFail(player);
}
});
buttons.put(30, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(type.getItems()[1].clone())
.setName(CC.RED + "Leggings")
.setLore(Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "leggings armor piece on you?",
"",
profile.getArmors()[1] ?
CC.RED + "Click to turn it off." :
CC.GREEN + "Click to turn it on."))
.setColor(type == ArmorType.ELEVATE ? Color.fromRGB(type.getR(), type.getG(), type.getB()) : type.getColor())
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
profile.getArmors()[1] = !profile.getArmors()[1];
Button.playFail(player);
}
});
buttons.put(39, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(type.getItems()[0].clone())
.setName(CC.RED + "Boots")
.setLore(Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "boots armor piece on you?",
"",
profile.getArmors()[0] ?
CC.RED + "Click to turn it off." :
CC.GREEN + "Click to turn it on."))
.setColor(type == ArmorType.ELEVATE ? Color.fromRGB(type.getR(), type.getG(), type.getB()) : type.getColor())
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
profile.getArmors()[0] = !profile.getArmors()[0];
Button.playFail(player);
}
});
buttons.put(23, new Button() {
@Override
public String getName(Player player) {
return (profile.isEnchanted() ? CC.B_RED : CC.B_GREEN) + "Enchantment";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "your armor enchanted?",
"",
profile.isEnchanted() ?
CC.RED + "Click to turn it off." :
CC.GREEN + "Click to turn it on.");
}
@Override
public Material getMaterial(Player player) {
return Material.INK_SACK;
}
@Override
public byte getDamageValue(Player player) {
return (byte) (profile.isEnchanted() ? 1 : 10);
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
profile.setEnchanted(!profile.isEnchanted());
Button.playFail(player);
}
});
buttons.put(32, new Button() {
@Override
public String getName(Player player) {
return (profile.isAstronaut() ? CC.B_RED : CC.B_GREEN) + "Astronaut Helmet";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "Astronaut Helmet placed",
CC.GRAY + "on your head?",
"",
profile.isAstronaut() ?
CC.RED + "Click to turn it off." :
CC.GREEN + "Click to turn it on.");
}
@Override
public Material getMaterial(Player player) {
return Material.INK_SACK;
}
@Override
public byte getDamageValue(Player player) {
return (byte) (profile.isAstronaut() ? 1 : 10);
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
profile.setAstronaut(!profile.isAstronaut());
profile.getArmors()[3] = !profile.isAstronaut();
Button.playFail(player);
}
});
buttons.put(41, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(Material.INK_SACK)
.setName(check(profile) ? CC.B_RED + "All Armor Pieces" : CC.B_GREEN + "All Armor Pieces")
.setLore(Arrays.asList(
"",
CC.GRAY + "Do you want to have",
CC.GRAY + "all armor pieces",
CC.GRAY + "placed on you?",
"",
areAllTrue(profile.getArmors()) ?
CC.RED + "Click to remove them." :
CC.GREEN + "Click to add them."))
.setDurability(check(profile) ? 1 : 10)
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
if (profile.isAstronaut() && areAllTrue(profile.getArmors())) {
profile.setAstronaut(false);
}
if (areAllTrue(profile.getArmors())) {
for (int i = 0; i < 4; i++) {
profile.getArmors()[i] = false;
}
} else {
for (int i = 0; i < 4; i++) {
profile.getArmors()[i] = true;
}
}
Button.playFail(player);
}
});
return buttons;
}
private boolean check(Profile profile) {
profile.getArmors()[3] = profile.isAstronaut() || profile.getArmors()[3];
return areAllTrue(profile.getArmors());
}
private boolean areAllTrue(boolean[] array) {
for (boolean value : array) {
if (!value) {
return false;
}
}
return true;
}
}

View File

@ -0,0 +1,163 @@
package com.elevatemc.ehub.menu.cosmetics;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.particle.ParticleType;
import com.elevatemc.ehub.utils.CC;
import com.elevatemc.elib.menu.Button;
import com.elevatemc.elib.menu.Menu;
import com.elevatemc.elib.util.cosmetics.ArmorUtil;
import com.google.common.collect.Maps;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class ParticlesMenu extends Menu {
@Override
public String getTitle(Player player) {
return CC.DARK_AQUA + "Choose Your Particle";
}
@Override
public int size(Player player) {
return 27;
}
@Override
public boolean isPlaceholder() {
return true;
}
@Override
public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = Maps.newHashMap();
buttons.put(18, new Button() {
@Override
public String getName(Player player) {
return CC.B_RED + "Back";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.RED + "Click here to return to",
CC.RED + "the previous menu.");
}
@Override
public Material getMaterial(Player player) {
return Material.REDSTONE;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
new CosmeticsMenu().openMenu(player);
Button.playSuccess(player);
}
});
Profile profile = eHub.getInstance().getProfileManager().getByUuid(player.getUniqueId());
int count = 10;
for (ParticleType type : ParticleType.values()) {
buttons.put(count, new Button() {
@Override
public String getName(Player player) {
return type.getDisplayColor() + type.getName();
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList("",
CC.GRAY + "Changes your particle",
CC.GRAY + "to " + type.getDisplayColor() + type.getName() + CC.GRAY + " particle.",
CC.GRAY + "Left click to select.",
"",
profile.getParticleType() == type ? CC.GREEN + "That effect is already selected." :
(type.hasPermission(player) ? CC.GRAY + "Click here to select " + CC.B_AQUA + type.getName() + CC.GRAY + "." :
CC.RED + "You don't own this particle."));
}
@Override
public Material getMaterial(Player player) {
return Material.WOOL;
}
@Override
public byte getDamageValue(Player player) {
return (byte) (ArmorUtil.parseColor(type.getColor()));
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
ParticleType type = ParticleType.getByName(ChatColor.stripColor(getName(player)));
if (profile.getParticleType() == type) {
Button.playFail(player);
player.sendMessage(CC.B_RED + type.getName() + CC.RED + " effect is already selected!");
return;
}
if (!type.hasPermission(player)) {
Button.playFail(player);
player.sendMessage(CC.RED + "You don't have " + CC.B + type.getName() + CC.RED + " particle.");
return;
}
Button.playSuccess(player);
profile.setParticleType(type);
player.sendMessage(type.getDisplayColor() + type.getName() + CC.YELLOW + " is now set as your particle effect.");
player.closeInventory();
}
});
count += 2;
}
if (profile.getParticleType() != null) {
buttons.put(4, new Button() {
@Override
public String getName(Player player) {
return CC.B_GREEN + "Remove your Particle";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList("",
CC.GRAY + "By clicking this item you will",
CC.GRAY + "remove your current particle.",
"",
CC.RED + "Click here to remove your " + profile.getParticleType().getDisplayColor() + profile.getParticleType().getName() + CC.RED + ".");
}
@Override
public Material getMaterial(Player player) {
return Material.LEVER;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
player.sendMessage(CC.GREEN + "You have deactivated your " + profile.getParticleType().getDisplayColor() + profile.getParticleType().getName() + CC.GREEN + ".");
profile.setParticleType(null);
Button.playSuccess(player);
}
});
}
return buttons;
}
}

View File

@ -0,0 +1,208 @@
package com.elevatemc.ehub.menu.cosmetics;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.armor.ArmorType;
import com.elevatemc.ehub.utils.CC;
import com.elevatemc.ehub.utils.ItemBuilder;
import com.elevatemc.elib.menu.Button;
import com.elevatemc.elib.menu.pagination.PaginatedMenu;
import com.google.common.collect.Maps;
import org.bukkit.ChatColor;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
public class RanksMenu extends PaginatedMenu {
@Override
public String getPrePaginatedTitle(Player player) {
return CC.DARK_AQUA + "Ranks";
}
public int getMaxItemsPerPage(Player player) {
return 36;
}
@Override
public boolean isPlaceholder() {
return true;
}
@Override
public boolean isAutoUpdate() {
return true;
}
@Override
public Map<Integer, Button> getGlobalButtons(Player player) {
Map<Integer, Button> buttons = Maps.newHashMap();
if (!player.hasPermission("core.cosmetic.armor.mod")) {
buttons.put(18, new Button() {
@Override
public String getName(Player player) {
return CC.B_RED + "Back";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.RED + "Click here to return to",
CC.RED + "the previous menu.");
}
@Override
public Material getMaterial(Player player) {
return Material.REDSTONE;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
new EditorMenu().openMenu(player);
Button.playSuccess(player);
}
});
return buttons;
} else {
buttons.put(27, new Button() {
@Override
public String getName(Player player) {
return CC.B_RED + "Back";
}
@Override
public List<String> getDescription(Player player) {
return Arrays.asList(
"",
CC.RED + "Click here to return to",
CC.RED + "the previous menu.");
}
@Override
public Material getMaterial(Player player) {
return Material.REDSTONE;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
new EditorMenu().openMenu(player);
Button.playSuccess(player);
}
});
return buttons;
}
}
@Override
public Map<Integer, Button> getAllPagesButtons(Player player) {
Map<Integer, Button> buttons = Maps.newHashMap();
Profile profile = eHub.getInstance().getProfileManager().getByUuid(player.getUniqueId());
int slot = 0;
for (ArmorType type : ArmorType.values()) {
if (!type.hasPermission(player) && !type.isDonator()) {
continue;
}
buttons.put(slot++, new Button() {
@Override
public ItemStack getButtonItem(Player player) {
return new ItemBuilder(Material.LEATHER_CHESTPLATE)
.setColor(type == ArmorType.ELEVATE ? Color.fromRGB(type.getR(), type.getG(), type.getB()) : type.getColor())
.setName(type.getDisplayColor() + type.getName())
.setLore(Arrays.asList("",
CC.AQUA + "Click here to select " + type.getDisplayColor() + type.getName() + CC.AQUA + "."))
.get();
}
@Override
public String getName(Player player) {
return null;
}
@Override
public List<String> getDescription(Player player) {
return null;
}
@Override
public Material getMaterial(Player player) {
return null;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
String name = ChatColor.stripColor(getButtonItem(player).getItemMeta().getDisplayName());
ArmorType type = ArmorType.valueOf(name.replace(" ", "_").replace("+", "_PLUS").toUpperCase());
if (!type.hasPermission(player)) {
player.sendMessage(CC.RED + "No permission.");
return;
}
if (profile.getArmorType() == type) {
Button.playFail(player);
player.sendMessage(type.getDisplayColor() + type.getName() + CC.RED + " is already selected.");
return;
}
profile.setArmorType(type);
for (int i = 0; i < 4; i++) {
if (profile.isAstronaut() && i == 3) {
profile.getArmors()[i] = false;
}
profile.getArmors()[i] = true;
}
Button.playSuccess(player);
player.closeInventory();
}
});
}
Map<Integer, Button> formattedButtons = Maps.newHashMap();
int slotfix = 0, nextCheck = 0;
for (Button formattedButton : buttons.values()) {
if (slotfix == nextCheck - 1) {
slotfix++;
}
if (slotfix == nextCheck) {
nextCheck += 9;
formattedButtons.put(slotfix, Button.placeholder(Material.STAINED_GLASS_PANE, (byte) 15, " "));
formattedButtons.put(slotfix + 8, Button.placeholder(Material.STAINED_GLASS_PANE, (byte) 15, " "));
slotfix++;
}
formattedButtons.put(slotfix++, formattedButton);
}
buttons = formattedButtons;
return buttons;
}
}

View File

@ -0,0 +1,57 @@
package com.elevatemc.ehub.menu.selector;
import com.elevatemc.ehub.eHub;
import com.elevatemc.elib.menu.Button;
import com.elevatemc.elib.util.Pair;
import com.google.common.collect.ImmutableList;
import dev.apposed.prime.spigot.module.server.scoreboard.PrimeScoreboardStyle;
import lombok.AllArgsConstructor;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@AllArgsConstructor
public class ServerButton extends Button {
private final Material material;
private final String name;
private final String server;
private final String region;
private final List<String> description;
@Override
public String getName(Player player) {
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
return style.getKey().toString() + ChatColor.BOLD + name;
}
@Override
public List<String> getDescription(Player player) {
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
List<String> meta = new ArrayList<>();
meta.add("");
meta.add(style.getKey() + "" + style.getValue() + "Playing: " + style.getKey() + eHub.getInstance().getServerPlayerCount("Elevate-Practice"));
meta.add(style.getKey() + "" + style.getValue() + "Region: " + style.getKey() + region);
return Stream.concat(description.stream(), meta.stream())
.collect(Collectors.toList());
}
@Override
public Material getMaterial(Player player) {
return material;
}
@Override
public void clicked(Player player, int slot, ClickType clickType) {
player.closeInventory();
eHub.getInstance().getQueueHandler().joinQueue(player, server);
}
}

View File

@ -0,0 +1,43 @@
package com.elevatemc.ehub.menu.selector;
import com.elevatemc.elib.menu.Button;
import com.elevatemc.elib.menu.Menu;
import com.elevatemc.elib.util.Pair;
import com.google.common.collect.ImmutableList;
import dev.apposed.prime.spigot.module.server.scoreboard.PrimeScoreboardStyle;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.Map;
public class ServerSelector extends Menu {
public ServerSelector() {
setAutoUpdate(true);
setPlaceholder(true);
}
@Override
public String getTitle(Player player) {
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
return style.getKey() + "Select a Game";
}
@Override
public Map<Integer, Button> getButtons(Player player) {
Map<Integer, Button> buttons = new HashMap<>();
buttons.put(13, new ServerButton(Material.IRON_SWORD, "Practice NA", "Practice", "North America",
ImmutableList.of(
ChatColor.GRAY + "Our official practice playing experience",
ChatColor.GRAY + "with multiple features"
)
));
return buttons;
}
@Override
public int size(Player player) {
return 9*3;
}
}

View File

@ -0,0 +1,32 @@
package com.elevatemc.ehub.profile;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.type.armor.ArmorType;
import com.elevatemc.ehub.type.particle.ParticleType;
import lombok.Getter;
import lombok.Setter;
import java.util.UUID;
@Getter
@Setter
public class Profile {
private final eHub instance = eHub.getInstance();
private final UUID uuid;
private ArmorType armorType;
private ParticleType particleType;
private boolean enchanted, astronaut;
private boolean[] armors;
public Profile(UUID uuid) {
this.uuid = uuid;
this.armorType = null;
this.particleType = null;
this.enchanted = false;
this.astronaut = false;
this.armors = new boolean[] {true, true, true, true};
getInstance().getProfileManager().getProfiles().put(uuid, this);
}
}

View File

@ -0,0 +1,22 @@
package com.elevatemc.ehub.profile.manager;
import com.elevatemc.ehub.profile.Profile;
import lombok.Getter;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
@Getter
public class ProfileManager {
private final Map<UUID, Profile> profiles;
public ProfileManager() {
profiles = new HashMap<>();
}
public Profile getByUuid(UUID uuid) {
return profiles.get(uuid);
}
}

View File

@ -0,0 +1,32 @@
package com.elevatemc.ehub.queue;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.queue.listener.MessageListener;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import lombok.Getter;
import org.bukkit.entity.Player;
import java.util.HashMap;
import java.util.UUID;
public class QueueHandler {
public QueueHandler() {
eHub.getInstance().getServer().getMessenger().registerOutgoingPluginChannel( eHub.getInstance(), "equeue:main");
eHub.getInstance().getServer().getMessenger().registerIncomingPluginChannel( eHub.getInstance(), "equeue:main", new MessageListener());
}
@Getter private HashMap<UUID, QueuePosition> positions = new HashMap<>();
public void setPosition(Player player, String server, int position, int total) {
getPositions().put(player.getUniqueId(), new QueuePosition(server, position, total));
}
public void joinQueue(Player player, String queueName) {
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF( "joinqueue" );
out.writeUTF(queueName);
player.sendPluginMessage(eHub.getInstance(), "equeue:main", out.toByteArray());
}
}

View File

@ -0,0 +1,11 @@
package com.elevatemc.ehub.queue;
import lombok.AllArgsConstructor;
import lombok.Getter;
@AllArgsConstructor
public class QueuePosition {
@Getter private String server;
@Getter private int position;
@Getter private int total;
}

View File

@ -0,0 +1,40 @@
package com.elevatemc.ehub.queue.listener;
import com.elevatemc.ehub.eHub;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteStreams;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.messaging.PluginMessageListener;
import java.util.UUID;
public class MessageListener implements PluginMessageListener {
@Override
public void onPluginMessageReceived(String s, Player p, byte[] bytes) {
if (!s.equalsIgnoreCase("equeue:main")) {
return;
}
try {
ByteArrayDataInput in = ByteStreams.newDataInput(bytes);
String subchannel = in.readUTF();
if (subchannel.equals("position")) {
String playerUUIDString = in.readUTF();
UUID uuid;
try {
uuid = UUID.fromString(playerUUIDString);
} catch (Exception ex) {
ex.printStackTrace();
return;
}
Player player = Bukkit.getPlayer(uuid);
String server = in.readUTF();
int position = in.readInt();
int total = in.readInt();
eHub.getInstance().getQueueHandler().setPosition(player, server, position, total);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,86 @@
package com.elevatemc.ehub.scoreboard;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.queue.QueueHandler;
import com.elevatemc.ehub.queue.QueuePosition;
import com.elevatemc.elib.autoreboot.AutoRebootHandler;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.scoreboard.construct.ScoreGetter;
import com.elevatemc.elib.util.Pair;
import com.elevatemc.elib.util.TimeUtils;
import com.xxmicloxx.NoteBlockAPI.model.Song;
import com.xxmicloxx.NoteBlockAPI.songplayer.RadioSongPlayer;
import dev.apposed.prime.spigot.module.profile.Profile;
import dev.apposed.prime.spigot.module.profile.ProfileHandler;
import dev.apposed.prime.spigot.module.profile.punishment.Punishment;
import dev.apposed.prime.spigot.module.profile.punishment.type.PunishmentType;
import dev.apposed.prime.spigot.module.server.scoreboard.PrimeScoreboardStyle;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.util.Date;
import java.util.LinkedList;
import java.util.Optional;
public class eHubScoreGetter implements ScoreGetter {
private static final ProfileHandler profileHandler = eHub.getInstance().getPrime().getModuleHandler().getModule(ProfileHandler.class);
@Override
public void getScores(LinkedList<String> scores, Player player) {
Profile profile = profileHandler.getCache().getIfPresent(player.getUniqueId());
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
if (profile != null) {
if (profile.hasActivePunishment(PunishmentType.BAN) || profile.hasActivePunishment(PunishmentType.BLACKLIST)|| player.hasMetadata("related")) {
scores.add("&4&l✘ You are banned ✘");
scores.add("&4Type /register to appeal");
} else {
RadioSongPlayer radioSongPlayer = eHub.getInstance().getRadioSongPlayer();
QueueHandler queueHandler = eHub.getInstance().getQueueHandler();
scores.add(style.getKey().toString() + ChatColor.BOLD + "Info:");
scores.add(style.getKey() + "" + style.getValue() + "Rank: " + profile.getHighestActiveNonHiddenGrant().getRank().getColoredDisplay());
scores.add(style.getKey() + "" + style.getValue() + "Global: " + style.getKey() + eHub.getInstance().getGlobalPlayerCount());
scores.add(" ");
scores.add(style.getKey().toString() + ChatColor.BOLD + "Servers:");
scores.add(style.getKey() + "" + style.getValue() + "Practice: " + style.getKey() + eHub.getInstance().getServerPlayerCount("Elevate-Practice") + "/" + eHub.getInstance().getMaxPlayerCount("Elevate-Practice"));
if (radioSongPlayer.getPlayerUUIDs().contains(player.getUniqueId())) {
Song song = radioSongPlayer.getSong();
String title = song.getTitle();
if (title.length() > 30) {
title = title.substring(0, 30);
}
scores.add(" ");
scores.add(style.getKey().toString() + ChatColor.BOLD + "Music:");
scores.add(style.getKey() + "" + style.getValue() + "Title: " + style.getKey() + title);
}
if (queueHandler.getPositions().containsKey(player.getUniqueId())) {
scores.add(" ");
QueuePosition queuePosition = queueHandler.getPositions().get(player.getUniqueId());
scores.add(style.getKey().toString() + ChatColor.BOLD + "Queue:");
scores.add(style.getKey() + "┃&r " + style.getValue() + queuePosition.getServer() + ": " + style.getKey() + queuePosition.getPosition() + "/" + queuePosition.getTotal());
}
}
} else {
scores.add("&7Loading...");
}
if (scores.size() <= 13) {
scores.add("");
}
if (scores.size() <= 13) {
scores.add(style.getKey() + " elevatemc.com ");
}
if (scores.size() <= 13) {
scores.addFirst("");
}
if (scores.size() <= 13) {
scores.addFirst( ChatColor.GRAY.toString() + ChatColor.ITALIC + " " + eHubScoreboardConfiguration.date + " ");
}
}
}

View File

@ -0,0 +1,41 @@
package com.elevatemc.ehub.scoreboard;
import com.elevatemc.ehub.eHub;
import com.elevatemc.elib.scoreboard.config.ScoreboardConfiguration;
import com.elevatemc.elib.scoreboard.construct.TitleGetter;
import com.elevatemc.elib.util.Pair;
import dev.apposed.prime.spigot.module.server.scoreboard.PrimeScoreboardStyle;
import dev.apposed.prime.spigot.util.Color;
import org.apache.commons.lang.StringEscapeUtils;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
import java.text.SimpleDateFormat;
import java.util.Date;
public final class eHubScoreboardConfiguration {
private final static SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yy");
public static String date;
public static ScoreboardConfiguration create() {
ScoreboardConfiguration configuration = new ScoreboardConfiguration();
Bukkit.getScheduler().runTaskTimerAsynchronously(eHub.getInstance(), () -> {
date = dateFormat.format(new Date());
}, 0L, 20 * 60 * 5);
configuration.setTitleGetter(new TitleGetter() {
@Override
public String getTitle(Player player) {
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
return Color.translate(style.getKey().toString() + ChatColor.BOLD + "Elevate &7" + "" + style.getValue() + " Hub");
}
});
configuration.setScoreGetter(new eHubScoreGetter());
return (configuration);
}
}

View File

@ -0,0 +1,127 @@
package com.elevatemc.ehub.tab;
import cc.fyre.universe.Universe;
import com.elevatemc.ehub.eHub;
import com.elevatemc.elib.tab.provider.TabProvider;
import com.elevatemc.elib.util.Pair;
import com.google.common.collect.HashBasedTable;
import com.google.common.collect.Table;
import com.mojang.authlib.properties.Property;
import dev.apposed.prime.spigot.module.profile.Profile;
import dev.apposed.prime.spigot.module.profile.ProfileHandler;
import dev.apposed.prime.spigot.module.server.scoreboard.PrimeScoreboardStyle;
import org.bukkit.ChatColor;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.Optional;
public class eHubTabProvider implements TabProvider {
private static final ProfileHandler profileHandler = eHub.getInstance().getPrime().getModuleHandler().getModule(ProfileHandler.class);
@Override
public Table<Integer, Integer, String> provide(Player player) {
Table<Integer, Integer, String> layout = HashBasedTable.create();
Profile profile = profileHandler.getCache().getIfPresent(player.getUniqueId());
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
layout.put(0, 1, style.getKey().toString() + ChatColor.BOLD + "ElevateMC");
layout.put(1, 1, style.getValue() + "Online: " + eHub.getInstance().getGlobalPlayerCount());
layout.put(2, 0, style.getKey().toString() + ChatColor.BOLD + "Website");
layout.put(3, 0, style.getValue() + "elevatemc.com");
layout.put(5, 0, style.getKey().toString() + ChatColor.BOLD + "Telegram");
layout.put(6, 0, style.getValue() + "t.me/elevatemc");
// Too big for 1.7
// layout.put(8, 0, style.getKey().toString() + ChatColor.BOLD + "Twitter");
// layout.put(9, 0, style.getValue() + "twitter.com/elevatemc");
layout.put(2, 2, style.getKey().toString() + ChatColor.BOLD + "Teamspeak");
layout.put(3, 2, style.getValue() + "ts.elevatemc.com");
layout.put(5, 2, style.getKey().toString() + ChatColor.BOLD + "Store");
layout.put(6, 2, style.getValue() + "store.elevatemc.com");
// layout.put(8, 2, style.getKey().toString() + ChatColor.BOLD + "NameMC");
// layout.put(9, 2, style.getValue() + "/namemc");
layout.put(3, 1, style.getKey().toString() + ChatColor.BOLD + "Your Rank:");
if (profile != null) {
layout.put(4, 1, style.getValue() + profile.getHighestActiveNonHiddenGrant().getRank().getColoredDisplay());
} else {
layout.put(4, 1, style.getValue() + "Loading...");
}
layout.put(6, 1, style.getKey().toString() + ChatColor.BOLD + "Server Info:");
layout.put(7, 1, style.getKey() + "Practice: " + style.getValue() + eHub.getInstance().getServerPlayerCount("Elevate-Practice") + "/" + eHub.getInstance().getMaxPlayerCount("Elevate-Practice"));
return layout;
}
@Override
public String getHeader(Player player) {
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
return
"\n&8▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒\n" +
"&8▒" + style.getKey() + "▟██&8▒" + style.getKey() + "█&8▒▒▒" + style.getKey() + "▟██&8▒" + style.getKey() + "█&8▒" + style.getKey() + "█&8▒" + style.getKey() + "▟█▙&8▒" + style.getKey() + "███&8▒" + style.getKey() + "▟██&8▒\n" +
"&8▒" + style.getKey() + "█&8▒▒▒" + style.getKey() + "█&8▒▒▒" + style.getKey() + "█&8▒▒▒" + style.getKey() + "█&8▒" + style.getKey() + "█&8▒" + style.getKey() + "█&8▒" + style.getKey() + "█&8▒▒" + style.getKey() + "█&8▒&8▒" + style.getKey() + "█&8▒▒▒\n" +
"&8▒" + style.getKey() + "█▀&8▒▒" + style.getKey() + "█&8▒▒▒" + style.getKey() + "█▀&8▒▒" + style.getKey() + "█▟▛&8▒" + style.getKey() + "█▀█&8▒&8▒" + style.getKey() + "█&8▒&8▒" + style.getKey() + "█▀&8▒▒\n" +
"&8▒" + style.getKey() + "▜██&8▒" + style.getKey() + "▜██&8▒" + style.getKey() + "▜██&8▒" + style.getKey() + "▜▛&8▒&8▒" + style.getKey() + "█&8▒" + style.getKey() + "█&8▒&8▒" + style.getKey() + "█&8▒&8▒" + style.getKey() + "▜██&8▒\n" +
"&8▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒\n" +
"\n" +
style.getKey() + "Welcome to the &lElevate Network" + style.getKey() + "!" +
"\n";
}
@Override
public String getFooter(Player player) {
final Pair<ChatColor, ChatColor> style = PrimeScoreboardStyle.getStyle(player);
return "\n" + style.getKey() + "store.elevatemc.com\n";
}
private static final Property STORE = new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTY1NjQyOTYxMjc3MSwKICAicHJvZmlsZUlkIiA6ICI0M2NmNWJkNjUyMDM0YzU5ODVjMDIwYWI3NDE0OGQxYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJrYW1pbDQ0NSIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iZDQ2NjJjODFhZjE2OGQ5MjZkODExYTAyZTdhZTYxOWViODM0OGNkZDU4OTRiNDE0MDI1ZDhiZThjZTA0MzUyIgogICAgfQogIH0KfQ==", "aMXPfoEJ57sqgnWz93KnlD7n+LEmgbc+tjhQZl4v6G7zW0Ad+jwirO5KJokZJtxNLrqL/3a+LmJBijsd08zHUWkpZWbZc6DUjxqV7sAHohpKhLIgDGG9ZXzkd34AtoUEhpWiDr5nthljhOcZxDbBgpGqJUJxAQxlI3/KBZQSGyXw2jrTep99YlrIzsfk9hEYGYbnjNa3BCXN7ua/gq6uq40rh7wMIhES7jBSAbwMgDuqoc0f3FkXbjuhBQl+rI7N+vj96GSAhQp4t8ijNvqHvtvM+OlgO7PmvGsq55U51nWWSTVw9ddsWLwj6edjAI48tQsO511BTk/6o5RJavCcx3CV3AtujG1Ovd8xKlGiZg06u02A21C3ViO/HaLMdXQqvD2Pl30R84fs3fUuWrKeD2ZUhBJU3VrBMB9Pu97KtuA8eoIgP32dhYHpSLEwYNl0DnCOmN7QDHIeo6cdc5ARdRZ6kaj2K+L8oflYRRV2QasgJRvspWzyLlqz8hnXiczptns1pyGe1aElCZA7iLIZpWfki/ljchu4+0bV0mOAIWtFqPj40YJE3Srp2eZqjmHIHh3xXs+DfU5IJ5NXEtyrJEp/8WDgQUZgiEc65U2Of+9xTZFgddlMaJwV243nvm/+H1qU1QgK2L27PcnZcF960sAhP/ZAd31D0nYPKcpRuwI=");
private static final Property PLAIN_COLOR_STORE = new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTY1NjUzMDEwMzkyNiwKICAicHJvZmlsZUlkIiA6ICJmZTYxY2RiMjUyMTA0ODYzYTljY2E2ODAwZDRiMzgzZSIsCiAgInByb2ZpbGVOYW1lIiA6ICJNeVNoYWRvd3MiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvY2YzOTE5ZjUxNzg4NTlkZGMwOWQyZWU1YTlmN2RmZjVjODEyZTVhMjk2MjIwNjQ1N2E2Yjc0NmIwMmU0NzMwIgogICAgfQogIH0KfQ==", "o5+MVlyvH17ihr0/bL4QTO34ezmR5+zpWRsJkv8dNG/9rJpRnjifD6lMdI7+pBpvmesREc8/5i0RkvZme+/ASBfzOeGGA5ePUYEPaaXcK765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ybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS85YTk1ZDZlNDA3ODI4YTM0MDI0NzA4M2E5YTNjOWY1MDQyMDBkNzk3ZTNmYmI0NjFmOGIxNzNkN2NkZjIzZWZmIgogICAgfQogIH0KfQ==", "ETIO4ghhnBoL88HsoFOS+SDSrIlwRZ2CSUJ+Ki+ULtW4PKqBNcTs9Tkug9eYLph6Zsd9XHzvRZIOCka0d9N9RYtTNL262lMJj1S6mKJGhFC3+n14rn2uvlZliN5nYdZH/U0NaszvZ926jnE9GH6M9VBGYnN8Ax5uLkm6QQUbBZABce43KmEi5q1cvJZKAHS+yub2fmv2qfv/S7NLAfcATQquVLTmwVj9IJc8QQJXvbvB28ar1F1IUKIvxGjcFgr5/Oq4YjSgBv7Ge6oJYxvI7fYnOwwOsyYcimXV5NookI8UiAunSpjtYDByN85eSPjCDjUu/gO6F97fWDFJh52b2FAmsFU87pGDDlEiaca6Ku9LILPRVf9923f6duMXZGATGeTPswigaIjiSmXDtyEjLv+COP9G+zul9yvK4M0fFJH7iEig0xKj7ZNGQb4QN25v0LEwbygmYm/CXoWJOhPf69vlx01nlGNweAR4U3tZ5C31mrUIIsIC6xGBCoy0QHoS0rAhEz58mSqthqibjU2n8UbTxL3Cytz0kraY9ZsdVHEPFRJx7/lfB2+/7mB1JjMYwzxNwTKYsjze2bjr3rAmm+tViAsDMbhRROKrm9rQfFnsS4vW9n32OTvfXkGyQ1TbPamz7T/eesWz/1FbmSI8l6/MCf7SwKTgqHaTJOPyPyU=");
private static final Property PLAIN_COLOR_TELEGRAM = new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTY1NjUyOTk3MDE5MiwKICAicHJvZmlsZUlkIiA6ICI4NTRhYTNiNDVkZDk0OTNhYmZiZThkNWU4MTBjNmMyYyIsCiAgInByb2ZpbGVOYW1lIiA6ICJERERhdmlkYSIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCi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JIRUtUMCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8zZTBkMDdhZmM4YjlmZGIyODVmOTA2NDcwNjgyZDQzMWE2ZmFmMDYxYmQwYTlhYTJlZGViMzIzNzZhMTE4YzYyIgogICAgfQogIH0KfQ==", "FWcUxMtAQih7OE4CC0A5jtrxPkwWmtr32kloEj7L1lQ7RDgEliCeMHsb/tUWWHpWKwczllEnZJ1sNAqJ8XcW3A2+INELThapQAu/stPP+hOEcsZf4/DrJeTgIWlkkUyr1uT45bgFCllBsl0Jx4YI+36ZplC5B0Ci34fjJrQvOHidswYoEf/yYUOLI2b3dngofmi4t69Ec87g9xOHoEeKhMIPLup+wl7an5RrLxb+G7+G3daufZ792a1o3kju+mBYV32fAA4D1/LXweanGaoFJGN2PN8tnydlGWXXcth38EjFR3Vh7Xq11JaU8/JWonpkl+R6RU16aWdXu/inKtMhfiS8wqUkkQPCDHgLx2zdkRcz7aD4medM9cl3sPSrsNDwL4sRHZY4Emu7mlfSyG9QlOhWhdYkQdHk3usaHvGMQem1f5JYRLUL4PhGhqOiKLZ5oOCPUcbTSSyXnCOkPReaByiOOweAZp0gM/oqhGRpRz90i+m44P8JnT8VYvs8vWF+CxRuPXMESCKD0ebtFZcPKNjMUYzx9DuaoOg+UxBPLKGAjob9e6m09ayde4d08zAXUXYQdE/NGP2xPWtcl8N1ZJWJMXMKeC5fjhzV70EqJIcS73L++aaY8gNZrdXBZiR0oKcxjrOC4OV06dnD5+inGF0RkxfG9omYLvtHl9Vxoyk=");
private static final Property RANK = new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTY1NjUzMTMyNzUwNiwKICAicHJvZmlsZUlkIiA6ICIwNTkyNTIxZGNjZWE0NzRkYjE0M2NmMDg2MDA1Y2FkNyIsCiAgInByb2ZpbGVOYW1lIiA6ICJwdXIyNCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9lYzM4NzA5YThmYWNkOTI2M2EzNDMzOGZhYTQ2ZDk2YWUwYmExZmM4MTQyNTllMTNjYTc4YTY4ODkyOTkwMGZkIgogICAgfQogIH0KfQ==", "thV8esXRHwzH4C/2RoiPahhSNlpssRFpWZI38S3QWiJWBdeuPvKxYj9eb+Znh0nRPF4WS4e/kfL0Zq6B3XzRbgBMgv/Uoy/5oDmrEWOIAloBrTCsdmoXvg9roPj2J5TaasExpuZE5xWKNenA0f2DyGdcHdC5uJausgId6iGR4N+6XmkV+BChlI6OTMsNwdeslgWTU/d7XVclHqE3Ji/oyZnv1JX1sIzzvzuqxF3tCtnOYJybsLlR+1H7kAfbRm7v29FXafHlNHOtRHo1oSZH/PUz2ZFClBlUuIyV0eF4URoYaTrb4+a04NMdohiwb9/1Ot4Fd2MgD4Q40V+WP7foa6hTOE4WMMKrxLWqZ7KK+QF7sdvD8XTGW+ZFscSrobUhW7bCdDjNrf/s43/iL2Wp50m+DpQHnVN5Wz2gm696q9rkbPNNSCS82NVLCRdHZMEs/KdJBJLSYQB/OmYCT985PutdgSqsEeUE6YUemVNbC/bnsvIMgV0DOCCTfrLdGnSRZ+epCUTXU3CjL11lTwKjSemY5xjaxJX1pVTqekgiwjPb+Eqk5+lIQOC30nnGQR6qMQPNLda5AZzi2qtpMnCHqRj2CXGtE8L2fWuWbess+Ip9D1F5kDzD7DwkJQbM2lbigbrE7vDfMo35I7pUdsZd0KJHPAbpb0D+nyl/WxQNFyg=");
private static final Property SERVER_INFO = new Property("textures", "ewogICJ0aW1lc3RhbXAiIDogMTY1NjUzMDU2MTYxOCwKICAicHJvZmlsZUlkIiA6ICJkOGNkM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w2j/H4=");
@Override
public Table<Integer, Integer, Property> getHeads(Player player) {
Table<Integer, Integer, Property> heads = HashBasedTable.create();
// Website
heads.put(2, 0, WEBSITE);
heads.put(3, 0, PLAIN_COLOR_WEBSITE);
heads.put(5, 0, TELEGRAM);
heads.put(6, 0, PLAIN_COLOR_TELEGRAM);
heads.put(2, 2, TEAMSPEAK);
heads.put(3, 2, PLAIN_COLOR_TEAMSPEAK);
heads.put(5, 2, STORE);
heads.put(6, 2, PLAIN_COLOR_STORE);
heads.put(0, 1, ELEVATE);
heads.put(1, 1, INFO_PLAIN);
heads.put(3, 1, RANK);
heads.put(4, 1, INFO_PLAIN);
heads.put(6, 1, SERVER_INFO);
heads.put(7, 1, INFO_PLAIN);
return heads;
}
}

View File

@ -0,0 +1,217 @@
package com.elevatemc.ehub.type.armor;
import com.elevatemc.ehub.utils.CC;
import com.elevatemc.elib.util.cosmetics.ArmorUtil;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
@Getter
public enum ArmorType {
BASIC("Basic", CC.GRAY, Color.GRAY, 8, null),
VIP("VIP", CC.GREEN, Color.LIME, 5, null),
MVP("MVP", CC.BLUE, Color.BLUE, 11, null),
PRO("PRO", CC.GOLD, Color.ORANGE, 1, null),
ELEVATE("Elevate", CC.DARK_AQUA, Color.BLUE, 11, (Runnable) () -> {
ArmorType type = ArmorType.ELEVATE;
if (type.helper >= 600) {
type.reverse = true;
} else if (type.helper <= 0) {
type.reverse = false;
}
if (type.reverse) {
type.helper -= 2;
} else {
type.helper += 2;
}
Color color = ArmorUtil.COLORS.get(type.helper);
if (color != null) {
type.r = color.getRed();
type.g = color.getGreen();
type.b = color.getBlue();
int glassColor = ArmorUtil.parseColor(color);
if (glassColor != -1) {
type.astronaut = glassColor;
}
}
}),
MEDIA("Media", CC.PINK, Color.fromRGB(255, 0, 255), 6, (Runnable) () -> {
ArmorType type = ArmorType.MEDIA;
if (type.r >= 255) {
type.reverse = true;
} else if (type.r <= 170) {
type.reverse = false;
}
if (type.reverse) {
type.r -= 2;
type.b -= 2;
} else {
type.r += 2;
type.b += 2;
}
}),
MOD("Moderator", CC.DARK_PURPLE, Color.PURPLE, 2, (Runnable) () -> {
ArmorType type = ArmorType.MOD;
if (type.b <= 50) {
type.reverse = true;
} else if (type.b >= 102) {
type.reverse = false;
}
if (type.reverse) {
if (type.r > 51) {
type.r--;
}
type.b++;
} else {
if (type.r < 80) {
type.r++;
}
type.b--;
}
}),
ADMIN("Admin", CC.RED, Color.RED, 14, (Runnable) () -> {
ArmorType type = ArmorType.ADMIN;
if (type.r >= 255) {
type.reverse = true;
} else if (type.r <= 161) {
type.reverse = false;
}
if (type.reverse) {
type.r -= 2;
} else {
type.r += 2;
}
}),
DEVELOPER("Developer", CC.AQUA, Color.AQUA, 3, (Runnable) () -> {
ArmorType type = ArmorType.DEVELOPER;
if (type.b >= 255) {
type.reverse = true;
} else if (type.b <= 153) {
type.reverse = false;
}
if (type.reverse) {
if (type.g > 76) {
type.g -= 2;
}
type.b -= 3;
} else {
if (type.g < 128) {
type.g += 2;
}
type.b += 2;
}
}),
OWNER("Owner", CC.D_RED, Color.MAROON, 14, (Runnable) () -> {
ArmorType type = ArmorType.OWNER;
if (type.r >= 200) {
type.reverse = true;
} else if (type.r <= 128) {
type.reverse = false;
}
if (type.reverse) {
type.r -= 2;
} else {
type.r += 2;
}
});
private final String name, displayColor;
private final Color color;
private int astronaut;
private int r, g, b, helper;
@Setter
private Runnable runnable;
private String armorType;
@Setter
private boolean reverse;
private ItemStack[] items;
ArmorType(String name, String displayColor, Color color, int astronaut, Object object) {
this.name = name;
this.displayColor = displayColor;
this.color = color;
this.astronaut = astronaut;
if(object != null) {
if (object instanceof String) {
armorType = (String) object;
} else {
runnable = (Runnable) object;
}
}
r = color.getRed();
g = color.getGreen();
b = color.getBlue();
reverse = false;
}
public boolean isDonator() {
return ordinal() <= 3;
}
public boolean hasPermission(Player player) {
return player.hasPermission(getPermissionForAll()) || player.hasPermission(getPermission());
}
public String getPermissionForAll() {
return "core.cosmetic.armor.*";
}
public String getPermission() {
return "core.cosmetic.armor." + name().toLowerCase();
}
public ItemStack[] getItems() {
if (items != null) {
return items;
}
items = new ItemStack[4];
items[3] = new ItemStack(Material.LEATHER_HELMET);
items[2] = new ItemStack(Material.LEATHER_CHESTPLATE);
items[1] = new ItemStack(Material.LEATHER_LEGGINGS);
items[0] = new ItemStack(Material.LEATHER_BOOTS);
return items;
}
}

View File

@ -0,0 +1,94 @@
package com.elevatemc.ehub.type.armor.task;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.armor.ArmorType;
import com.elevatemc.ehub.utils.ItemBuilder;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.scheduler.BukkitRunnable;
public class ArmorTask extends BukkitRunnable {
public ArmorTask() {
runTaskTimerAsynchronously(eHub.getInstance(), 40L, 1L);
}
@Override
public void run() {
for (ArmorType type : ArmorType.values()) {
if (type.getRunnable() == null && type.getArmorType() == null) {
for (ItemStack item : type.getItems()) {
if (item == null) {
continue;
}
ItemBuilder.copyOf(item).setColor(type.getColor());
}
continue;
}
Color color = null;
if (type.getRunnable() != null) {
type.getRunnable().run();
color = Color.fromRGB(type.getR(), type.getG(), type.getB());
} else if (type.getArmorType() != null) {
ArmorType newType = ArmorType.valueOf(type.getArmorType());
color = Color.fromRGB(newType.getR(), newType.getG(), newType.getB());
}
if (color == null) {
continue;
}
for (ItemStack item : type.getItems()) {
if (item == null) {
continue;
}
ItemBuilder.copyOf(item).setColor(color);
}
}
for (Player player : Bukkit.getOnlinePlayers()) {
Profile profile = eHub.getInstance().getProfileManager().getByUuid(player.getUniqueId());
ArmorType type = profile.getArmorType();
if (type == null) {
continue;
}
PlayerInventory inventory = player.getInventory();
for (ItemStack item : type.getItems()) {
ItemBuilder builder = ItemBuilder.copyOf(item);
if (profile.isEnchanted()) {
builder.addEnchantment(Enchantment.DURABILITY);
} else {
builder.clearEnchantments();
}
}
inventory.setHelmet(profile.isAstronaut() ?
new ItemBuilder(Material.STAINED_GLASS).setDurability(type.getAstronaut()).get() : profile.getArmors()[3] ? type.getItems()[3] : null);
inventory.setChestplate(profile.getArmors()[2] ? type.getItems()[2] : null);
inventory.setLeggings(profile.getArmors()[1] ? type.getItems()[1] : null);
inventory.setBoots(profile.getArmors()[0] ? type.getItems()[0] : null);
player.updateInventory();
}
}
}

View File

@ -0,0 +1,113 @@
package com.elevatemc.ehub.type.particle;
import com.elevatemc.ehub.type.particle.impl.ParticleCallable;
import com.elevatemc.ehub.type.particle.impl.ParticleMeta;
import com.elevatemc.ehub.utils.CC;
import com.elevatemc.ehub.utils.ParticleUtil;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Color;
import org.bukkit.Effect;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import java.util.ArrayList;
import java.util.Arrays;
import static com.elevatemc.elib.util.ParticleMath.cos;
import static com.elevatemc.elib.util.ParticleMath.sin;
@Getter
public enum ParticleType {
VIP("VIP Particle", CC.GREEN, 32, Color.LIME, (location, player) -> {
double angle = (double) ParticleType.VIP.ticks * 0.19634954084936207;
double cos = Math.cos(angle);
double sin = Math.sin(angle);
Location topRingLocation = location.clone().add(0.1, 0, 0.1).add(0.8 * cos, 1.4, 0.8 * sin);
for (int i = 0; i < 5; ++i) {
ParticleUtil.sendsParticleToAll(new ParticleMeta(topRingLocation, Effect.HAPPY_VILLAGER));
}
}),
MVP("MVP Particle", CC.BLUE, 32, Color.BLUE, (location, player) -> {
Location location2 = location.clone().add(0.1, 0.0, 0.1);
double angle = (double) ParticleType.MVP.ticks * 0.19634954084936207;
double cos = Math.cos(angle);
double sin = Math.sin(angle);
Location bottomRingLocation = location2.clone().add(0.8 * cos, 0.6, 0.8 * sin);
Location topRingLocation = location2.clone().add(0.8 * cos, 1.4, 0.8 * sin);
for (int i = 0; i < 5; ++i) {
ParticleUtil.sendsParticleToAll(new ParticleMeta(bottomRingLocation, Effect.LAVADRIP));
ParticleUtil.sendsParticleToAll(new ParticleMeta(topRingLocation, Effect.LAVADRIP));
}
}),
PRO("Pro Particle", CC.GOLD, 40, Color.ORANGE, (location, player) -> {
Location location2 = location.clone().add(0.1, 0.0, 0.1);
double angle = (double) ParticleType.PRO.ticks * 0.15707963267948966;
double cos = Math.cos(angle);
double sin = Math.sin(angle);
ArrayList<ParticleMeta> particleMetaList = new ArrayList<>();
particleMetaList.add(new ParticleMeta(location2.clone().add(1.0 * cos, 0.5 + 1.0 * cos, 1.0 * sin), Effect.WATERDRIP));
particleMetaList.add(new ParticleMeta(location2.clone().add(1.0 * cos, 1.0 + 1.0 * cos, 1.0 * sin), Effect.WATERDRIP));
particleMetaList.add(new ParticleMeta(location2.clone().add(1.0 * cos, 1.5 + 1.0 * cos, 1.0 * sin), Effect.WATERDRIP));
ParticleUtil.sendsParticleToAll(particleMetaList.toArray(new ParticleMeta[0]));
}),
ELEVATE("Elevate Particle", CC.DARK_AQUA, 32, Color.TEAL, (location, player) -> {
double angle = (double) ParticleType.ELEVATE.ticks * 0.19634954084;
double cos = Math.cos(angle);
double sin = Math.sin(angle);
for (double t = 0; t <= 2 * Math.PI; t += Math.PI / 8) {
for (double i = 0; i <= 1; i += 1) {
Location cone = location.clone().add(0.4 * (2 * Math.PI - t) * 0.5 * cos(t + angle + i * Math.PI), 0.5 * t, 0.4 * (2 * Math.PI - t) * 0.5 * sin(t + angle + i * Math.PI));
ParticleUtil.sendsParticleToAll(new ParticleMeta(cone, Effect.COLOURED_DUST));
}
}
});
private final String name, displayColor;
private final int frequency;
private final Color color;
private final ParticleCallable callable;
@Setter
private int ticks;
public static ParticleType getByName(String input) {
return Arrays.stream(values()).filter((type) -> type.name().equalsIgnoreCase(input) || type.getName().equalsIgnoreCase(input)).findFirst().orElse(null);
}
public boolean hasPermission(Player player) {
return player.hasPermission(getPermissionForAll()) || player.hasPermission(getPermission());
}
public String getPermissionForAll() {
return "core.cosmetics.particle.*";
}
public String getPermission() {
return "core.cosmetics.particle." + name().toLowerCase();
}
ParticleType(String name, String displayColor, int frequency, Color color, ParticleCallable callable) {
this.name = name;
this.callable = callable;
this.displayColor = displayColor;
this.frequency = frequency;
this.color = color;
this.ticks = 0;
}
}

View File

@ -0,0 +1,8 @@
package com.elevatemc.ehub.type.particle.impl;
import org.bukkit.Location;
import org.bukkit.entity.Player;
public interface ParticleCallable {
void call(Location location, Player player);
}

View File

@ -0,0 +1,27 @@
package com.elevatemc.ehub.type.particle.impl;
import java.beans.ConstructorProperties;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.Effect;
import org.bukkit.Location;
@Getter
@Setter
public final class ParticleMeta {
private final Location location;
private final Effect effect;
private float offsetX = 0.0f;
private float offsetY = 0.0f;
private float offsetZ = 0.0f;
private float speed = 1.0f;
private int amount = 1;
@ConstructorProperties(value={"location", "effect"})
public ParticleMeta(Location location, Effect effect) {
this.location = location;
this.effect = effect;
}
}

View File

@ -0,0 +1,38 @@
package com.elevatemc.ehub.type.particle.task;
import com.elevatemc.ehub.eHub;
import com.elevatemc.ehub.profile.Profile;
import com.elevatemc.ehub.type.particle.ParticleType;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
public class ParticleTask extends BukkitRunnable {
private final eHub plugin = eHub.getInstance();
public ParticleTask() {
runTaskTimerAsynchronously(eHub.getInstance(), 40L, 1L);
}
@Override
public void run() {
for (ParticleType particle : ParticleType.values()) {
if (particle.getTicks() >= particle.getFrequency()) {
particle.setTicks(-1);
}
particle.setTicks(particle.getTicks() + 1);
}
for (Player player : Bukkit.getOnlinePlayers()) {
Profile profile = plugin.getProfileManager().getByUuid(player.getUniqueId());
ParticleType type = profile.getParticleType();
if (type == null) {
continue;
}
type.getCallable().call(player.getLocation(), player);
}
}
}

View File

@ -0,0 +1,81 @@
package com.elevatemc.ehub.utils;
import org.bukkit.ChatColor;
//Thank you qLib
public final class CC {
public static final String BLUE = ChatColor.BLUE.toString();
public static final String AQUA = ChatColor.AQUA.toString();
public static final String YELLOW = ChatColor.YELLOW.toString();
public static final String RED = ChatColor.RED.toString();
public static final String GRAY = ChatColor.GRAY.toString();
public static final String GOLD = ChatColor.GOLD.toString();
public static final String GREEN = ChatColor.GREEN.toString();
public static final String WHITE = ChatColor.WHITE.toString();
public static final String BLACK = ChatColor.BLACK.toString();
public static final String BOLD = ChatColor.BOLD.toString();
public static final String ITALIC = ChatColor.ITALIC.toString();
public static final String STRIKE_THROUGH = ChatColor.STRIKETHROUGH.toString();
public static final String RESET = ChatColor.RESET.toString();
public static final String MAGIC = ChatColor.MAGIC.toString();
public static final String OBFUSCATED = MAGIC;
public static final String B = BOLD;
public static final String M = MAGIC;
public static final String O = MAGIC;
public static final String I = ITALIC;
public static final String S = STRIKE_THROUGH;
public static final String R = RESET;
public static final String DARK_BLUE = ChatColor.DARK_BLUE.toString();
public static final String DARK_AQUA = ChatColor.DARK_AQUA.toString();
public static final String DARK_GRAY = ChatColor.DARK_GRAY.toString();
public static final String DARK_GREEN = ChatColor.DARK_GREEN.toString();
public static final String DARK_PURPLE = ChatColor.DARK_PURPLE.toString();
public static final String DARK_RED = ChatColor.DARK_RED.toString();
public static final String D_BLUE = DARK_BLUE;
public static final String D_AQUA = DARK_AQUA;
public static final String D_GRAY = DARK_GRAY;
public static final String D_GREEN = DARK_GREEN;
public static final String D_PURPLE = DARK_PURPLE;
public static final String D_RED = DARK_RED;
public static final String LIGHT_PURPLE = ChatColor.LIGHT_PURPLE.toString();
public static final String L_PURPLE = LIGHT_PURPLE;
public static final String PINK = L_PURPLE;
public static final String B_BLUE = BLUE + B;
public static final String B_AQUA = AQUA + B;
public static final String B_YELLOW = YELLOW + B;
public static final String B_RED = RED + B;
public static final String B_GRAY = GRAY + B;
public static final String B_GOLD = GOLD + B;
public static final String B_GREEN = GREEN + B;
public static final String B_WHITE = WHITE + B;
public static final String B_BLACK = BLACK + B;
public static final String BD_BLUE = D_BLUE + B;
public static final String BD_AQUA = D_AQUA + B;
public static final String BD_GRAY = D_GRAY + B;
public static final String BD_GREEN = D_GREEN + B;
public static final String BD_PURPLE = D_PURPLE + B;
public static final String BD_RED = D_RED + B;
public static final String BL_PURPLE = L_PURPLE + B;
public static final String I_BLUE = BLUE + I;
public static final String I_AQUA = AQUA + I;
public static final String I_YELLOW = YELLOW + I;
public static final String I_RED = RED + I;
public static final String I_GRAY = GRAY + I;
public static final String I_GOLD = GOLD + I;
public static final String I_GREEN = GREEN + I;
public static final String I_WHITE = WHITE + I;
public static final String I_BLACK = BLACK + I;
public static final String ID_RED = D_RED + I;
public static final String ID_BLUE = D_BLUE + I;
public static final String ID_AQUA = D_AQUA + I;
public static final String ID_GRAY = D_GRAY + I;
public static final String ID_GREEN = D_GREEN + I;
public static final String ID_PURPLE = D_PURPLE + I;
public static final String IL_PURPLE = L_PURPLE + I;
public static final String S_GRAY = GRAY + STRIKE_THROUGH;
public static String formatInteger(int value) {
return String.format("%,d", value);
}
}

View File

@ -0,0 +1,32 @@
package com.elevatemc.ehub.utils;
import com.elevatemc.elib.util.ItemUtils;
import lombok.experimental.UtilityClass;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import java.util.Collections;
@UtilityClass
public final class HubItems {
public static final ItemStack SELECT_SERVER = new ItemStack(Material.WATCH);
public static final ItemStack MUSIC_ENABLED = new ItemStack(Material.GREEN_RECORD);
public static final ItemStack MUSIC_DISABLED = new ItemStack(Material.RECORD_3);
public static final ItemStack COSMETICS = new ItemStack(Material.NETHER_STAR);
public static final ItemStack ENDER_PEARLS = new ItemStack(Material.ENDER_PEARL);
static {
ItemUtils.setDisplayName(SELECT_SERVER, ChatColor.DARK_AQUA + "Games " + ChatColor.GRAY + "(Right Click)" );
ItemUtils.setLore(SELECT_SERVER, Collections.singletonList(ChatColor.GRAY + "Use this item to select the game you wish to play"));
ItemUtils.setDisplayName(MUSIC_ENABLED, ChatColor.DARK_AQUA + "Toggle Music: " + ChatColor.GREEN + "Enabled " + ChatColor.GRAY + "(Right Click)" );
ItemUtils.setDisplayName(MUSIC_DISABLED, ChatColor.DARK_AQUA + "Toggle Music: " + ChatColor.RED + "Disabled " + ChatColor.GRAY + "(Right Click)" );
ItemUtils.setLore(MUSIC_ENABLED, Collections.singletonList(ChatColor.GRAY + "Use this item to toggle the music"));
ItemUtils.setLore(MUSIC_DISABLED, Collections.singletonList(ChatColor.GRAY + "Use this item to toggle the music"));
ItemUtils.setDisplayName(COSMETICS, ChatColor.DARK_AQUA + "Cosmetics " + ChatColor.GRAY + "(Right Click)");
ItemUtils.setDisplayName(ENDER_PEARLS, ChatColor.DARK_AQUA + "Ender Pearl " + ChatColor.GRAY + "(Right Click)");
ItemUtils.setLore(ENDER_PEARLS, Collections.singletonList(ChatColor.GRAY + "Use this item to fly away with enderpearls"));
ENDER_PEARLS.setAmount(64);
}
}

View File

@ -0,0 +1,167 @@
package com.elevatemc.ehub.utils;
import dev.apposed.prime.spigot.util.Color;
import org.bukkit.Material;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.LeatherArmorMeta;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.material.MaterialData;
import java.util.ArrayList;
import java.util.List;
//Thank you qLib
public class ItemBuilder {
private final ItemStack itemStack;
public static ItemBuilder copyOf(ItemBuilder builder) {
return new ItemBuilder(builder.get());
}
public static ItemBuilder copyOf(ItemStack item) {
return new ItemBuilder(item);
}
public ItemBuilder(Material material) {
itemStack = new ItemStack(material);
}
public ItemBuilder(ItemStack itemStack) {
this.itemStack = itemStack;
}
public ItemBuilder setAmount(int amount) {
itemStack.setAmount(Math.min(amount, 64));
return this;
}
public ItemBuilder setName(String name) {
ItemMeta meta = itemStack.getItemMeta();
meta.setDisplayName(Color.translate(name));
itemStack.setItemMeta(meta);
return this;
}
public ItemBuilder addLoreLine(String name) {
ItemMeta meta = itemStack.getItemMeta();
List<String> lore = meta.getLore();
if (lore == null) {
lore = new ArrayList<>();
}
lore.add(Color.translate(name));
meta.setLore(lore);
itemStack.setItemMeta(meta);
return this;
}
public ItemBuilder setLore(List<String> lore) {
List<String> toSet = new ArrayList<>();
ItemMeta meta = itemStack.getItemMeta();
lore.forEach((string) -> toSet.add(Color.translate(string)));
meta.setLore(toSet);
itemStack.setItemMeta(meta);
return this;
}
public ItemBuilder setDurability(int durability) {
itemStack.setDurability((short)durability);
return this;
}
public ItemBuilder setData(int data) {
itemStack.setData(new MaterialData(itemStack.getType(), (byte)data));
return this;
}
public ItemBuilder addEnchantment(Enchantment enchantment, int level) {
itemStack.addUnsafeEnchantment(enchantment, level);
return this;
}
public ItemBuilder addEnchantment(Enchantment enchantment) {
itemStack.addUnsafeEnchantment(enchantment, 1);
return this;
}
public ItemBuilder setType(Material material) {
itemStack.setType(material);
return this;
}
public ItemBuilder clearLore() {
ItemMeta meta = itemStack.getItemMeta();
meta.setLore(new ArrayList<>());
itemStack.setItemMeta(meta);
return this;
}
public ItemBuilder clearEnchantments() {
itemStack.getEnchantments().keySet().forEach(itemStack::removeEnchantment);
return this;
}
public ItemBuilder setColor(org.bukkit.Color color) {
if (itemStack.getType() != Material.LEATHER_BOOTS
&& itemStack.getType() != Material.LEATHER_CHESTPLATE
&& itemStack.getType() != Material.LEATHER_HELMET
&& itemStack.getType() != Material.LEATHER_LEGGINGS) {
throw new IllegalArgumentException("color() only applicable for leather armor.");
} else {
LeatherArmorMeta meta = (LeatherArmorMeta) itemStack.getItemMeta();
meta.setColor(color);
itemStack.setItemMeta(meta);
return this;
}
}
public ItemBuilder setOwner(String owner) {
SkullMeta meta = (SkullMeta) itemStack.getItemMeta();
meta.setOwner(owner);
itemStack.setItemMeta(meta);
return this;
}
public ItemStack get() {
return itemStack;
}
public static void rename(ItemStack stack, String name) {
ItemMeta meta = stack.getItemMeta();
meta.setDisplayName(Color.translate(name));
stack.setItemMeta(meta);
}
public static ItemStack createItem(Material material, String name) {
ItemStack item = new ItemStack(material);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(Color.translate(name));
item.setItemMeta(meta);
return item;
}
public static ItemStack createItem(Material material, String name, int amount) {
ItemStack item = new ItemStack(material, amount);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(Color.translate(name));
item.setItemMeta(meta);
return item;
}
public static ItemStack createItem(Material material, String name, int amount, int damage) {
ItemStack item = new ItemStack(material, amount, (short) damage);
ItemMeta meta = item.getItemMeta();
meta.setDisplayName(Color.translate(name));
item.setItemMeta(meta);
return item;
}
}

View File

@ -0,0 +1,60 @@
package com.elevatemc.ehub.utils;
import com.elevatemc.ehub.type.particle.impl.ParticleMeta;
import com.elevatemc.elib.util.Pair;
import net.minecraft.server.v1_8_R3.EnumParticle;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldParticles;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
import org.bukkit.entity.Player;
import java.util.ArrayList;
public class ParticleUtil {
public static void sendsParticleToAll(ParticleMeta... particleMetas) {
ArrayList<Pair<Location, Packet>> packets = new ArrayList<>();
for (ParticleMeta meta : particleMetas) {
PacketPlayOutWorldParticles packet;
packet = new PacketPlayOutWorldParticles();
packet.a = EnumParticle.values()[meta.getEffect().getId()];
packet.j = false;
packet.b = (float) meta.getLocation().getX();
packet.c = (float) meta.getLocation().getY();
packet.d = (float) meta.getLocation().getZ();
packet.e = meta.getOffsetX();
packet.f = meta.getOffsetY();
packet.g = meta.getOffsetZ();
packet.h = meta.getSpeed();
packet.i = meta.getAmount();
packets.add(new Pair<>(meta.getLocation(), packet));
}
for (Pair<Location, Packet> pair : packets) {
double squared = 256 * 256;
Location center = pair.getKey();
String worldName = center.getWorld().getName();
for (Player player : Bukkit.getOnlinePlayers()) {
if (!player.getWorld().getName().equals(worldName) || player.getLocation().distanceSquared(center) > squared) {
continue;
}
((CraftPlayer)player).getHandle().playerConnection.sendPacket(pair.getValue());
}
}
}
private ParticleUtil() {
throw new UnsupportedOperationException("This is a utility class and cannot be instantiated");
}
}

View File

@ -0,0 +1,37 @@
package com.elevatemc.ehub.utils;
import com.elevatemc.ehub.eHub;
import org.bukkit.Bukkit;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.List;
public class PlayerCountTask implements Runnable {
List<String> servers;
public PlayerCountTask(List<String> servers) {
this.servers = servers;
}
public void run() {
if (eHub.getInstance().getServer().getOnlinePlayers().size() == 0) {
return;
}
for (String server : servers) {
pingBungee(server);
}
}
private void pingBungee(String server) {
ByteArrayOutputStream b = new ByteArrayOutputStream();
DataOutputStream out = new DataOutputStream(b);
try {
out.writeUTF("PlayerCount");
out.writeUTF(server);
} catch (Exception ex) {
ex.printStackTrace();
}
Bukkit.getServer().sendPluginMessage(eHub.getInstance(), "BungeeCord", b.toByteArray());
}
}

View File

@ -0,0 +1,7 @@
main: com.elevatemc.ehub.eHub
name: eHub
version: '${version}'
description: The hub plugin for ElevateMC
author: ElevateMC Development Team
website: https://elevatemc.com
depend: [eLib, Prime]

63
Network/eLib/build.gradle Normal file
View File

@ -0,0 +1,63 @@
plugins {
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'java'
id 'maven-publish'
}
group 'com.elevatemc'
version '1.0'
sourceSets {
main.java.srcDirs = ['src/main/java']
main.resources.srcDirs = ['src/main/resources']
}
compileJava.options.encoding = 'UTF-8'
repositories {
mavenCentral()
maven {
url 'https://repo.dmulloy2.net/repository/public/'
}
maven { url 'https://jitpack.io' }
}
dependencies {
compileOnly 'org.projectlombok:lombok:1.18.22'
annotationProcessor 'org.projectlombok:lombok:1.18.22'
compileOnly files('../lib/espigot.jar')
compileOnly files('../lib/primespigot.jar')
compileOnly files('../lib/lcapi.jar')
implementation 'org.mongodb:mongo-java-driver:3.12.10'
implementation 'redis.clients:jedis:4.2.0'
implementation 'org.reflections:reflections:0.10.2'
shadow 'org.mongodb:mongo-java-driver:3.12.10'
shadow 'redis.clients:jedis:4.2.0'
shadow 'org.reflections:reflections:0.10.2'
}
shadowJar {
configurations = [project.configurations.shadow]
}
build {
dependsOn(shadowJar)
}
publishing {
publications {
shadow(MavenPublication) { publication ->
project.shadow.component(publication)
}
}
}
processResources {
def props = [version: 'git rev-parse --verify --short HEAD'.execute().text.trim()]
inputs.properties props
filteringCharset 'UTF-8'
filesMatching('plugin.yml') {
expand props
}
}

View File

@ -0,0 +1,43 @@
package com.elevatemc.elib.autoreboot;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.autoreboot.task.ServerRebootTask;
import lombok.Getter;
public class AutoRebootHandler {
@Getter private ServerRebootTask serverRebootTask = null;
public AutoRebootHandler() {
eLib.getInstance().getCommandHandler().registerPackage(eLib.getInstance(),"com.elevatemc.elib.autoreboot.command");
}
public void rebootServer(long time) {
if (this.serverRebootTask != null) {
throw new IllegalStateException("A reboot is already in progress.");
}
this.serverRebootTask = new ServerRebootTask(time);
this.serverRebootTask.runTaskTimer(eLib.getInstance(),20L,20L);
}
public boolean isRebooting() {
return this.serverRebootTask != null;
}
public int getRebootSecondsRemaining() {
return this.serverRebootTask == null ? -1 : this.serverRebootTask.getSecondsRemaining();
}
public void cancelReboot() {
if (this.serverRebootTask == null) {
return;
}
this.serverRebootTask.cancel();
this.serverRebootTask = null;
}
}

View File

@ -0,0 +1,27 @@
package com.elevatemc.elib.autoreboot.command;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.command.Command;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class RebootCancelCommand {
@Command(
names = {"shutdown cancel"},
permission = "elib.command.reboot.cancel"
)
public static void execute(CommandSender sender) {
if (!eLib.getInstance().getAutoRebootHandler().isRebooting()) {
sender.sendMessage(ChatColor.RED + "No reboot has been scheduled.");
return;
}
eLib.getInstance().getAutoRebootHandler().cancelReboot();
eLib.getInstance().getServer().broadcastMessage(ChatColor.RED + "" + ChatColor.DARK_RED + ChatColor.STRIKETHROUGH + "------------------------" + ChatColor.RED + "");
eLib.getInstance().getServer().broadcastMessage(ChatColor.RED + "The server reboot has been cancelled.");
eLib.getInstance().getServer().broadcastMessage(ChatColor.RED + "" + ChatColor.DARK_RED + ChatColor.STRIKETHROUGH + "------------------------" + ChatColor.RED + "");
}
}

View File

@ -0,0 +1,26 @@
package com.elevatemc.elib.autoreboot.command;
import com.elevatemc.elib.command.param.Parameter;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.command.Command;
import com.elevatemc.elib.util.TimeUtils;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
public class RebootScheduleCommand {
@Command(
names = {"shutdown","shutdown schedule", "reboot", "reboot schedule"},
permission = "elib.command.reboot.schedule"
)
public static void execute(CommandSender sender,@Parameter(name = "time")long time) {
if(eLib.getInstance().getAutoRebootHandler().isRebooting()) {
sender.sendMessage(ChatColor.RED + "Server is currently restarting already!");
return;
}
eLib.getInstance().getAutoRebootHandler().rebootServer(time);
sender.sendMessage(ChatColor.GOLD + "Scheduled a reboot in " + TimeUtils.formatIntoDetailedString((int)(time / 1000)));
}
}

View File

@ -0,0 +1,60 @@
package com.elevatemc.elib.autoreboot.task;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.util.TaskUtil;
import com.elevatemc.elib.util.TimeUtils;
import lombok.Getter;
import org.bukkit.ChatColor;
import org.bukkit.scheduler.BukkitRunnable;
import com.elevatemc.elib.util.message.MessageBuilder;
import com.elevatemc.elib.util.message.MessageTranslator;
public class ServerRebootTask extends BukkitRunnable {
private static final String line = MessageTranslator.translate("&4&m---------------------------------");
@Getter private int secondsRemaining;
@Getter private boolean wasWhitelisted;
public ServerRebootTask(long time) {
this.secondsRemaining = (int)(time / 1000);
this.wasWhitelisted = eLib.getInstance().getServer().hasWhitelist();
}
public void run() {
if (this.secondsRemaining == 300) {
eLib.getInstance().getServer().setWhitelist(true);
} else if (this.secondsRemaining == 5) {
eLib.getInstance().getServer().setWhitelist(this.wasWhitelisted);
eLib.getInstance().getLogger().info("Sending everyone to hub...");
TaskUtil.runSync(() -> {
for (Player player : Bukkit.getOnlinePlayers()) {
player.kickPlayer(ChatColor.RED + "The server was shutdown...");
}
});
}
if (secondsRemaining > 0 && (secondsRemaining <= 10 || (secondsRemaining <= 60 && secondsRemaining % 5 == 0) || (secondsRemaining % 30 == 0))) {
String message = MessageBuilder
.error("Server is rebooting in {}.")
.prefix("")
.element(TimeUtils.formatIntoMMSS(secondsRemaining))
.build();
Bukkit.broadcastMessage(line);
Bukkit.broadcastMessage(message);
Bukkit.broadcastMessage(line);
}
if (secondsRemaining <= 0) {
TaskUtil.runSync(Bukkit::shutdown);
}
secondsRemaining--;
}
public synchronized void cancel() throws IllegalStateException {
super.cancel();
eLib.getInstance().getServer().setWhitelist(this.wasWhitelisted);
}
}

View File

@ -0,0 +1,285 @@
package com.elevatemc.elib.border;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.border.event.border.BorderChangeEvent;
import com.elevatemc.elib.border.runnable.BorderTask;
import com.elevatemc.elib.cuboid.Cuboid;
import lombok.Getter;
import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
public class Border {
@Getter private final Location origin;
@Getter private Material material;
@Getter private int size;
@Getter private int height;
@Getter private boolean wrapTerrain;
@Getter private BorderConfiguration borderConfiguration;
@Getter private Effect particle;
@Getter private BorderTask borderTask;
@Getter private Cuboid physicalBounds;
@Getter private static final boolean[] airBlocks = new boolean[256];
public Border(Location origin,Material material,int size,int height) {
this.material = Material.BEDROCK;
this.wrapTerrain = false;
this.borderConfiguration = BorderConfiguration.DEFAULT_CONFIGURATION;
this.origin = origin;
this.size = size;
this.height = height;
this.material = material == null ? Material.BEDROCK : material;
this.physicalBounds = new Cuboid(origin.clone().add((double)(size + 1), (double)origin.getWorld().getMaxHeight() - origin.getY(), (double)(size + 1)), origin.clone().subtract((double)(size + 1), origin.getY(), (double)(size + 1)));
this.borderTask = new BorderTask(this);
eLib.getInstance().getBorderHandler().addBorder(this);
}
public Cuboid contract(int amount) {
this.size -= amount;
final Cuboid prev = this.physicalBounds.clone();
this.physicalBounds = this.physicalBounds.inset(Cuboid.CuboidDirection.HORIZONTAL, amount);
return prev;
}
public Cuboid expand(int amount) {
this.size += amount;
final Cuboid prev = this.physicalBounds.clone();
this.physicalBounds = this.physicalBounds.expand(Cuboid.CuboidDirection.NORTH, amount).expand(Cuboid.CuboidDirection.SOUTH, amount).expand(Cuboid.CuboidDirection.EAST, amount).expand(Cuboid.CuboidDirection.WEST, amount);
return prev;
}
public Cuboid setSize(int size) {
return this.setSize(size, true);
}
public Cuboid setSize(int size, boolean callEvent) {
return this.setSize(size, this.height, callEvent);
}
public Cuboid setSize(int size, int height, boolean callEvent) {
int previousSize = this.size;
this.size = size;
this.height = height;
Cuboid prev = this.physicalBounds.clone();
this.physicalBounds = new Cuboid(this.origin.clone().add((double)(size + 1), (double)this.origin.getWorld().getMaxHeight() - this.origin.getY(), (double)(size + 1)), this.origin.clone().subtract((double)(size + 1), this.origin.getY(), (double)(size + 1)));
if (callEvent) {
eLib.getInstance().getServer().getPluginManager().callEvent(new BorderChangeEvent(this,previousSize,prev,BorderTask.BorderAction.SET));
}
return prev;
}
public boolean contains(Block block) {
return this.contains(block.getX(), block.getZ());
}
public boolean contains(Entity entity) {
return this.contains(entity.getLocation());
}
public boolean contains(Location location) {
return this.contains(location.getBlockX(), location.getBlockZ());
}
public boolean contains(int x, int z) {
return x > this.physicalBounds.getLowerX() && x < this.physicalBounds.getUpperX() && z > this.physicalBounds.getLowerZ() && z < this.physicalBounds.getUpperZ();
}
public void fill() {
World world = this.origin.getWorld();
int xMin = this.physicalBounds.getLowerX();
int xMax = this.physicalBounds.getUpperX();
int zMin = this.physicalBounds.getLowerZ();
int zMax = this.physicalBounds.getUpperZ();
int tick = 0;
int chunksPerTick = 20;
int chunkX;
for(chunkX = zMin >> 4; chunkX <= zMax >> 4; ++chunkX) {
final int finalChunkX = chunkX;
eLib.getInstance().getServer().getScheduler().runTaskLater(eLib.getInstance(), () -> {
Chunk chunk = world.getChunkAt(xMin >> 4, finalChunkX);
for(int z = Math.max(zMin, finalChunkX << 4); z < Math.min(zMax, finalChunkX + 1 << 4); ++z) {
this.fillAtXZ(world, chunk, xMin, z);
}
}, (long)(tick++ / chunksPerTick));
eLib.getInstance().getServer().getScheduler().runTaskLater(eLib.getInstance(), () -> {
Chunk chunk = world.getChunkAt(xMax >> 4, finalChunkX);
for(int z = Math.max(zMin + 1, finalChunkX << 4); z < Math.min(zMax + 1, finalChunkX + 1 << 4); ++z) {
this.fillAtXZ(world, chunk, xMax, z);
}
}, (long)(tick++ / chunksPerTick));
}
for(chunkX = xMin >> 4; chunkX <= xMax >> 4; ++chunkX) {
final int finalChunkX = chunkX;
eLib.getInstance().getServer().getScheduler().runTaskLater(eLib.getInstance(), () -> {
Chunk chunk = world.getChunkAt(finalChunkX, zMin >> 4);
for(int x = Math.max(xMin + 1, finalChunkX << 4); x < Math.min(xMax + 1, finalChunkX + 1 << 4); ++x) {
this.fillAtXZ(world, chunk, x, zMin);
}
}, (long)(tick++ / chunksPerTick));
eLib.getInstance().getServer().getScheduler().runTaskLater(eLib.getInstance(), () -> {
Chunk chunk = world.getChunkAt(finalChunkX, zMax >> 4);
for(int x = Math.max(xMin, finalChunkX << 4); x < Math.min(xMax, finalChunkX + 1 << 4); ++x) {
this.fillAtXZ(world, chunk, x, zMax);
}
}, (long)(tick++ / chunksPerTick));
}
}
private void fillAtXZ(World world, Chunk chunk, int x, int z) {
int y;
if (this.wrapTerrain) {
for(y = world.getHighestBlockYAt(x, z); airBlocks[chunk.getBlock(x, y, z).getType().getId()] && y > 0; --y) {
;
}
for(y += this.height; y >= 0; --y) {
chunk.getBlock(x, y, z).setTypeIdAndData(this.material.getId(), (byte)0, false);
}
} else {
for(y = 0; y <= this.origin.getBlockY() + this.height; ++y) {
chunk.getBlock(x, y, z).setTypeIdAndData(this.material.getId(), (byte)0, false);
}
}
}
public Location correctLocation(Location location) {
Cuboid cuboid = this.getPhysicalBounds();
int validX = location.getBlockX();
int validZ = location.getBlockZ();
EnsureAction xAction = null;
EnsureAction zAction = null;
if (location.getBlockX() + 2 > cuboid.getUpperX()) {
xAction = EnsureAction.DECREASE;
validX = xAction.apply(cuboid.getUpperX(), 4);
} else if (location.getBlockX() - 2 < cuboid.getLowerX()) {
xAction = EnsureAction.INCREASE;
validX = xAction.apply(cuboid.getLowerX(), 4);
}
if (location.getBlockZ() + 2 > cuboid.getUpperZ()) {
zAction = EnsureAction.DECREASE;
validZ = zAction.apply(cuboid.getUpperZ(), 4);
} else if (location.getBlockZ() - 2 < cuboid.getLowerZ()) {
zAction = EnsureAction.INCREASE;
validZ = zAction.apply(cuboid.getLowerZ(), 4);
}
int validY = location.getWorld().getHighestBlockYAt(validX, validZ);
Location validLoc = new Location(location.getWorld(), (double)validX + 0.5D, (double)validY + 0.5D, (double)validZ + 0.5D);
for(int var9 = 0; !isSafe(validLoc) && var9++ < 30; validLoc = new Location(location.getWorld(), (double)validX + 0.5D, (double)validY + 0.5D, (double)validZ + 0.5D)) {
if (xAction != null) {
validX = xAction.apply(validX, 1);
}
if (zAction != null) {
validZ = zAction.apply(validZ, 1);
}
validY = location.getWorld().getHighestBlockYAt(validX, validZ);
}
validLoc.setPitch(location.getPitch());
validLoc.setYaw(location.getYaw());
return validLoc;
}
private static boolean isSafe(Location location) {
return location.getBlock().getRelative(BlockFace.DOWN).getType().isSolid() && location.getBlock().isEmpty() && location.getBlock().getRelative(BlockFace.UP).isEmpty();
}
public Cuboid getPhysicalBounds() {
return this.physicalBounds.clone();
}
public Border setMaterial(Material material) {
this.material = material;
return this;
}
public Border setHeight(int height) {
this.height = height;
return this;
}
public Border setWrapTerrain(boolean wrapTerrain) {
this.wrapTerrain = wrapTerrain;
return this;
}
public Border setBorderConfiguration(BorderConfiguration borderConfiguration) {
this.borderConfiguration = borderConfiguration;
return this;
}
public Border setParticle(Effect particle) {
this.particle = particle;
return this;
}
static {
airBlocks[Material.LOG.getId()] = true;
airBlocks[Material.LOG_2.getId()] = true;
airBlocks[Material.LEAVES.getId()] = true;
airBlocks[Material.LEAVES_2.getId()] = true;
airBlocks[Material.HUGE_MUSHROOM_1.getId()] = true;
airBlocks[Material.HUGE_MUSHROOM_2.getId()] = true;
airBlocks[Material.SNOW.getId()] = true;
for (int i = 0; i < Material.values().length; i++) {
final Material material = Material.values()[i];
if (material.isBlock() && !material.isSolid()) {
airBlocks[material.getId()] = true;
}
}
airBlocks[Material.WATER.getId()] = false;
airBlocks[Material.STATIONARY_WATER.getId()] = false;
airBlocks[Material.LAVA.getId()] = false;
airBlocks[Material.STATIONARY_LAVA.getId()] = false;
}
public enum EnsureAction {
INCREASE,
DECREASE;
public int apply(int previous, int amount) {
return this == INCREASE ? previous + amount : previous - amount;
}
}
}

View File

@ -0,0 +1,28 @@
package com.elevatemc.elib.border;
import com.elevatemc.elib.border.event.border.BorderChangeEvent;
import com.elevatemc.elib.border.event.player.PlayerEnterBorderEvent;
import com.elevatemc.elib.border.event.player.PlayerExitBorderEvent;
import com.elevatemc.elib.border.action.DefaultBorderActions;
import lombok.Getter;
import java.util.HashSet;
import java.util.Set;
import java.util.function.Consumer;
public class BorderConfiguration {
public static final BorderConfiguration DEFAULT_CONFIGURATION = new BorderConfiguration();
@Getter private final Set<Consumer<BorderChangeEvent>> defaultBorderChangeActions = new HashSet<>();
@Getter private final Set<Consumer<PlayerEnterBorderEvent>> defaultBorderEnterActions = new HashSet<>();
@Getter private final Set<Consumer<PlayerExitBorderEvent>> defaultBorderExitActions = new HashSet<>();
public BorderConfiguration() {
this.defaultBorderChangeActions.add(DefaultBorderActions.ENSURE_PLAYERS_IN_BORDER);
this.defaultBorderExitActions.add(DefaultBorderActions.PUSHBACK_ON_EXIT);
this.defaultBorderExitActions.add(DefaultBorderActions.CANCEL_EXIT);
}
}

View File

@ -0,0 +1,33 @@
package com.elevatemc.elib.border;
import com.elevatemc.elib.eLib;
import com.elevatemc.elib.border.runnable.EnsureInsideRunnable;
import com.elevatemc.elib.border.listener.BorderListener;
import com.elevatemc.elib.border.listener.InternalBorderListener;
import lombok.Getter;
import org.bukkit.World;
import java.util.HashMap;
import java.util.Map;
public class BorderHandler {
@Getter private final Map<World,Border> borderMap = new HashMap<>();
public BorderHandler() {
eLib.getInstance().getServer().getPluginManager().registerEvents(new BorderListener(), eLib.getInstance());
eLib.getInstance().getServer().getPluginManager().registerEvents(new InternalBorderListener(), eLib.getInstance());
new EnsureInsideRunnable().runTaskTimer(eLib.getInstance(), 5L, 5L);
}
public Border getBorderForWorld(World world) {
return this.borderMap.get(world);
}
void addBorder(Border border) {
this.borderMap.put(border.getOrigin().getWorld(), border);
}
}

Some files were not shown because too many files have changed in this diff Show More