Gems all added, cooldown functional
This commit is contained in:
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
Binary file not shown.
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
7
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
distributionBase=GRADLE_USER_HOME
|
||||||
|
distributionPath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
Binary file not shown.
@@ -1,10 +1,13 @@
|
|||||||
package io.github.thetrouper.sssbliss;
|
package io.github.thetrouper.sssbliss;
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.PDK;
|
import io.github.itzispyder.pdk.PDK;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
import io.github.itzispyder.pdk.utils.misc.JsonSerializable;
|
||||||
import io.github.thetrouper.sssbliss.cmds.*;
|
import io.github.thetrouper.sssbliss.cmds.*;
|
||||||
import io.github.thetrouper.sssbliss.data.config.*;
|
import io.github.thetrouper.sssbliss.data.config.*;
|
||||||
import io.github.thetrouper.sssbliss.events.*;
|
import io.github.thetrouper.sssbliss.events.*;
|
||||||
|
import io.github.thetrouper.sssbliss.server.functions.GemPassiveEffects;
|
||||||
|
import io.github.thetrouper.sssbliss.events.ProjectileHitListener;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
@@ -18,25 +21,17 @@ public final class SSSBliss extends JavaPlugin {
|
|||||||
|
|
||||||
private static SSSBliss instance;
|
private static SSSBliss instance;
|
||||||
private static final File cfgfile = new File("plugins/SSSBliss/main-config.json");
|
private static final File cfgfile = new File("plugins/SSSBliss/main-config.json");
|
||||||
private static final File nbtcfg = new File("plugins/SSSBliss/nbt-config.json");
|
|
||||||
private static final File strctcfg = new File("plugins/SSSBliss/strict.json");
|
|
||||||
private static final File swrcfg = new File("plugins/SSSBliss/swears.json");
|
|
||||||
private static final File fpcfg = new File("plugins/SSSBliss/false-positives.json");
|
|
||||||
private static final File advcfg = new File("plugins/SSSBliss/advanced-config.json");
|
|
||||||
|
|
||||||
public static MainConfig mainConfig = JsonSerializable.load(cfgfile, MainConfig.class, new MainConfig());
|
public static MainConfig mainConfig = JsonSerializable.load(cfgfile, MainConfig.class, new MainConfig());
|
||||||
public static LanguageFile language;
|
public static LanguageFile language;
|
||||||
public static final PluginManager manager = Bukkit.getPluginManager();
|
public static final PluginManager manager = Bukkit.getPluginManager();
|
||||||
|
|
||||||
public static final Logger log = Bukkit.getLogger();
|
public static final Logger log = Bukkit.getLogger();
|
||||||
public static boolean usesDynamicIP;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Plugin startup logic
|
* Plugin startup logic
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onEnable() {
|
public void onEnable() {
|
||||||
|
|
||||||
log.info("\n]======------ Pre-load started! ------======[");
|
log.info("\n]======------ Pre-load started! ------======[");
|
||||||
PDK.init(this);
|
PDK.init(this);
|
||||||
instance = this;
|
instance = this;
|
||||||
@@ -63,19 +58,28 @@ public final class SSSBliss extends JavaPlugin {
|
|||||||
new ChatClickCallback().register();
|
new ChatClickCallback().register();
|
||||||
|
|
||||||
// Events
|
// Events
|
||||||
new CMDBlockExecute().register();
|
new GemUseListener().register();
|
||||||
|
new ProjectileHitListener().register();
|
||||||
|
new DeathListener().register();
|
||||||
|
//new GemMoveListener().register();
|
||||||
|
|
||||||
|
|
||||||
// Scheduled timers
|
// Scheduled timers
|
||||||
log.info("Finished!\n" +
|
SchedulerUtils.repeat(100, GemPassiveEffects::applyPassiveEffects);
|
||||||
" ____ __ ___ \n" +
|
|
||||||
"/\\ _`\\ /\\ \\__ __ /\\_ \\ \n" +
|
log.info("""
|
||||||
"\\ \\,\\L\\_\\ __ ___\\ \\ ,_\\/\\_\\ ___ __\\//\\ \\ \n" +
|
\n,ggggggggggg, \s
|
||||||
" \\/_\\__ \\ /'__`\\/' _ `\\ \\ \\/\\/\\ \\ /' _ `\\ /'__`\\\\ \\ \\ \n" +
|
dP""\"88""\"""\"Y8, ,dPYb, \s
|
||||||
" /\\ \\L\\ \\/\\ __//\\ \\/\\ \\ \\ \\_\\ \\ \\/\\ \\/\\ \\/\\ __/ \\_\\ \\_ \n" +
|
Yb, 88 `8b IP'`Yb \s
|
||||||
" \\ `\\____\\ \\____\\ \\_\\ \\_\\ \\__\\\\ \\_\\ \\_\\ \\_\\ \\____\\/\\____\\\n" +
|
`" 88 ,8P I8 8I gg \s
|
||||||
" \\/_____/\\/____/\\/_/\\/_/\\/__/ \\/_/\\/_/\\/_/\\/____/\\/____/\n" +
|
88aaaad8P" I8 8' "" \s
|
||||||
" ]====---- Advanced Anti-Grief & Chat Filter ----====[");
|
88""\""Y8ba I8 dP gg ,g, ,g, \s
|
||||||
|
88 `8b I8dP 88 ,8'8, ,8'8, \s
|
||||||
|
88 ,8P I8P 88 ,8' Yb ,8' Yb \s
|
||||||
|
88_____,d8',d8b,_ _,88,_,8'_ 8) ,8'_ 8)\s
|
||||||
|
88888888P" 8P'"Y888P""Y8P' "YY8P8PP' "YY8P8P
|
||||||
|
]=- Bliss SMP by obvWolf for Madness4Ever -=[
|
||||||
|
""");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadConfig() {
|
public void loadConfig() {
|
||||||
|
|||||||
@@ -6,63 +6,133 @@ import io.github.itzispyder.pdk.commands.CustomCommand;
|
|||||||
import io.github.itzispyder.pdk.commands.Permission;
|
import io.github.itzispyder.pdk.commands.Permission;
|
||||||
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
import io.github.itzispyder.pdk.commands.completions.CompletionBuilder;
|
||||||
import io.github.thetrouper.sssbliss.SSSBliss;
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
||||||
import io.github.thetrouper.sssbliss.server.util.CipherUtils;
|
import io.github.thetrouper.sssbliss.server.util.CipherUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
import io.github.thetrouper.sssbliss.server.util.Text;
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import net.md_5.bungee.api.chat.HoverEvent;
|
import net.md_5.bungee.api.chat.HoverEvent;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
|
||||||
|
|
||||||
import java.util.HashSet;
|
@CommandRegistry(value = "bliss",permission = @Permission("bliss.debug"),printStackTrace = true)
|
||||||
@CommandRegistry(value = "sssbliss",permission = @Permission("sssbliss.debug"))
|
|
||||||
public class SSSBlissCommand implements CustomCommand {
|
public class SSSBlissCommand implements CustomCommand {
|
||||||
public static boolean debugMode;
|
public static boolean debugMode;
|
||||||
@Override
|
@Override
|
||||||
public void dispatchCommand(CommandSender commandSender, Args args) {
|
public void dispatchCommand(CommandSender commandSender, Args args) {
|
||||||
Player p = (Player) commandSender;
|
Player p = (Player) commandSender;
|
||||||
SSSBliss instance = SSSBliss.getInstance();
|
SSSBliss instance = SSSBliss.getInstance();
|
||||||
switch (args.get(0).toString()) {
|
|
||||||
case "reload" -> {
|
|
||||||
if (!SSSBliss.isTrusted(p)) return;
|
|
||||||
p.sendMessage(Text.prefix("Reloading SSSBliss!"));
|
|
||||||
SSSBliss.log.info("[SSSBliss] Re-Initializing SSSBliss!");
|
|
||||||
instance.loadConfig();
|
|
||||||
}
|
|
||||||
case "full-system-check" -> {
|
|
||||||
|
|
||||||
}
|
String command = args.get(0).toString();
|
||||||
case "debug" -> {
|
|
||||||
switch (args.get(1).toString()) {
|
switch (command) {
|
||||||
case "lang" -> {
|
case "reload" -> handleReloadCommand(p, instance);
|
||||||
p.sendMessage(SSSBliss.language.get("exmaple-message"));
|
case "gems" -> handleGemsCommand(p, args);
|
||||||
}
|
case "debug" -> handleDebugCommand(p, args);
|
||||||
case "toggle" -> {
|
|
||||||
debugMode = !debugMode;
|
|
||||||
p.sendMessage(Text.prefix((debugMode ? "Enabled" : "Disabled") + " debug mode."));
|
|
||||||
}
|
|
||||||
case "encrypt" -> {
|
|
||||||
final String enc = CipherUtils.encrypt(args.getAll(2).toString());
|
|
||||||
final String check = CipherUtils.decrypt(enc);
|
|
||||||
final String main = Text.prefix("Successfully encrypted \"&e" + check + "&7\" using AES.\n &7> &b" + enc);
|
|
||||||
SSSBliss.log.info(args.getAll(2).toString() + "\n" + enc + "\n" + check);
|
|
||||||
TextComponent message = new TextComponent();
|
|
||||||
message.setText(main);
|
|
||||||
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new net.md_5.bungee.api.chat.hover.content.Text("&bClick to copy!")));
|
|
||||||
message.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, enc));
|
|
||||||
p.spigot().sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void handleReloadCommand(Player p, SSSBliss instance) {
|
||||||
|
if (!SSSBliss.isTrusted(p)) return;
|
||||||
|
|
||||||
|
p.sendMessage(Text.prefix("Reloading SSSBliss!"));
|
||||||
|
SSSBliss.log.info("[SSSBliss] Re-Initializing SSSBliss!");
|
||||||
|
instance.loadConfig();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleGemsCommand(Player p, Args args) {
|
||||||
|
if (args.getSize() < 2) return;
|
||||||
|
|
||||||
|
String subCommand = args.get(1).toString();
|
||||||
|
|
||||||
|
switch (subCommand) {
|
||||||
|
case "give" -> handleGiveGemCommand(p, args);
|
||||||
|
case "upgrade" -> handleUpgradeGem(p);
|
||||||
|
case "downgrade" -> handleDowngradeGem(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleGiveGemCommand(Player p, Args args) {
|
||||||
|
if (args.getSize() < 3) return;
|
||||||
|
|
||||||
|
String gemType = args.get(2).toString();
|
||||||
|
|
||||||
|
switch (gemType) {
|
||||||
|
case "fire" -> p.getInventory().setItemInOffHand(Gems.FIRE_GEM.item());
|
||||||
|
case "life" -> p.getInventory().setItemInOffHand(Gems.LIFE_GEM.item());
|
||||||
|
case "puff" -> p.getInventory().setItemInOffHand(Gems.PUFF_GEM.item());
|
||||||
|
case "speed" -> p.getInventory().setItemInOffHand(Gems.SPEED_GEM.item());
|
||||||
|
case "wealth" -> p.getInventory().setItemInOffHand(Gems.WEALTH_GEM.item());
|
||||||
|
case "strength" -> p.getInventory().setItemInOffHand(Gems.STRENGTH_GEM.item());
|
||||||
|
case "astra" -> p.getInventory().setItemInOffHand(Gems.ASTRA_GEM.item());
|
||||||
|
}
|
||||||
|
p.sendMessage(Component.text(color(SSSBliss.mainConfig.plugin.prefix + "Given you a &a%s&7 gem!".formatted(gemType))));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleUpgradeGem(Player p) {
|
||||||
|
GemData upgrade = GemUtils.hasGem(p).upgrade();
|
||||||
|
p.sendMessage("Detected your gem " + upgrade);
|
||||||
|
if (upgrade != null) {
|
||||||
|
p.sendMessage(Component.text("Upgraded your gem!"));
|
||||||
|
p.getInventory().setItemInOffHand(upgrade.item());
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Component.text("Your gem is max upgrade!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void handleDowngradeGem(Player p) {
|
||||||
|
GemData downgrade = GemUtils.hasGem(p).downgrade();
|
||||||
|
p.sendMessage("Detected your gem " + downgrade);
|
||||||
|
if (downgrade != null) {
|
||||||
|
p.sendMessage(Component.text("Downgraded your gem!"));
|
||||||
|
p.getInventory().setItemInOffHand(downgrade.item());
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Component.text("Your gem is max downgrade!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleDebugCommand(Player p, Args args) {
|
||||||
|
if (args.getSize() < 2) return;
|
||||||
|
|
||||||
|
String subCommand = args.get(1).toString();
|
||||||
|
|
||||||
|
switch (subCommand) {
|
||||||
|
case "lang" -> p.sendMessage(SSSBliss.language.get("example-message"));
|
||||||
|
case "toggle" -> handleToggleDebugMode(p);
|
||||||
|
case "encrypt" -> handleEncryptCommand(p, args);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleToggleDebugMode(Player p) {
|
||||||
|
debugMode = !debugMode;
|
||||||
|
p.sendMessage(Text.prefix((debugMode ? "Enabled" : "Disabled") + " debug mode."));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleEncryptCommand(Player p, Args args) {
|
||||||
|
if (args.getSize() < 3) return;
|
||||||
|
|
||||||
|
final String enc = CipherUtils.encrypt(args.getAll(2).toString());
|
||||||
|
final String check = CipherUtils.decrypt(enc);
|
||||||
|
final String main = Text.prefix("Successfully encrypted \"&e" + check + "&7\" using AES.\n &7> &b" + enc);
|
||||||
|
SSSBliss.log.info(args.getAll(2).toString() + "\n" + enc + "\n" + check);
|
||||||
|
TextComponent message = new TextComponent();
|
||||||
|
message.setText(main);
|
||||||
|
message.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new net.md_5.bungee.api.chat.hover.content.Text("&bClick to copy!")));
|
||||||
|
message.setClickEvent(new ClickEvent(ClickEvent.Action.COPY_TO_CLIPBOARD, enc));
|
||||||
|
p.spigot().sendMessage(message);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void dispatchCompletions(CompletionBuilder b) {
|
public void dispatchCompletions(CompletionBuilder b) {
|
||||||
b.then(b.arg("reload","getheat","full-system-check"));
|
b.then(b.arg("reload"));
|
||||||
|
b.then(b.arg("gems").then(
|
||||||
|
b.arg("give")
|
||||||
|
.then(b.arg("fire","life","puff","speed","wealth","strength","astra")))
|
||||||
|
.then(b.arg("upgrade","downgrade")));
|
||||||
b.then(b.arg("debug").then(
|
b.then(b.arg("debug").then(
|
||||||
b.arg("antiswear","antispam","lang","toggle")));
|
b.arg("encrypt","lang","toggle")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,35 +0,0 @@
|
|||||||
package io.github.thetrouper.sssbliss.data;
|
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
|
||||||
import io.github.thetrouper.sssbliss.SSSBliss;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
|
||||||
import org.bukkit.potion.PotionEffect;
|
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
|
||||||
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
public class GemBuilder {
|
|
||||||
|
|
||||||
private ItemStack itemStack;
|
|
||||||
private PotionEffect potionEffect;
|
|
||||||
private Consumer<Player> onRightClick;
|
|
||||||
|
|
||||||
public GemBuilder(ItemStack itemStack) {
|
|
||||||
this.itemStack = itemStack;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GemBuilder effect(PotionEffectType effectType, int amplifier) {
|
|
||||||
this.potionEffect = new PotionEffect(effectType,PotionEffect.INFINITE_DURATION, amplifier, true, true);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public GemBuilder onRightClick(Consumer<Player> onRightClick) {
|
|
||||||
this.onRightClick = onRightClick;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.data;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public record GemData(int dataID, ItemStack item, List<PotionEffect> passive, Consumer<Player> onRightClick,int cooldown, GemData upgrade, GemData downgrade) {
|
||||||
|
public static Builder create(int dataID) {
|
||||||
|
return new Builder(dataID);
|
||||||
|
}
|
||||||
|
public static class Builder {
|
||||||
|
private int dataID;
|
||||||
|
private ItemStack item;
|
||||||
|
private List<PotionEffect> passive;
|
||||||
|
private Consumer<Player> onRightClick;
|
||||||
|
private int cooldown;
|
||||||
|
private GemData upgrade;
|
||||||
|
private GemData downgrade;
|
||||||
|
|
||||||
|
public Builder(int dataID) {
|
||||||
|
this.dataID = dataID;
|
||||||
|
item = ItemBuilder.create()
|
||||||
|
.material(Material.EMERALD)
|
||||||
|
.name("L Bozo forgot to define the item")
|
||||||
|
.build();
|
||||||
|
passive = List.of(new PotionEffect(PotionEffectType.WATER_BREATHING,0,1));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setItem(ItemStack item) {
|
||||||
|
ItemMeta meta = item.getItemMeta();
|
||||||
|
meta.setCustomModelData(this.dataID);
|
||||||
|
item.setItemMeta(meta);
|
||||||
|
this.item = item;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setPassive(List<PotionEffect> passive) {
|
||||||
|
this.passive = passive;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setOnRightClick(Consumer<Player> onRightClick) {
|
||||||
|
this.onRightClick = onRightClick;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setCooldown(int ticks) {
|
||||||
|
this.cooldown = ticks;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setUpgrade(GemData upgrade) {
|
||||||
|
this.upgrade = upgrade;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Builder setDowngrade(GemData downgrade) {
|
||||||
|
this.downgrade = downgrade;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public GemData build() {
|
||||||
|
return new GemData(dataID,item,passive,onRightClick,cooldown,upgrade,downgrade);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,131 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.data.Gems;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GemItems {
|
||||||
|
|
||||||
|
protected static final ItemStack LIFE_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.RED_DYE)
|
||||||
|
.name(Global.instance.color("&c&lLife Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack LIFE_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.RED_DYE)
|
||||||
|
.name(Global.instance.color("&c&lLife Gem &6\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack FIRE_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.MAGMA_CREAM)
|
||||||
|
.name(Global.instance.color("&c&lFire Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack FIRE_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.MAGMA_CREAM)
|
||||||
|
.name(Global.instance.color("&c&lFire Gem &6\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack PUFF_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.PUFFERFISH)
|
||||||
|
.name(Global.instance.color("&b&lPuff Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack PUFF_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.PUFFERFISH)
|
||||||
|
.name(Global.instance.color("&b&lPuff Gem &9\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack SPEED_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.SUGAR)
|
||||||
|
.name(Global.instance.color("&f&lSpeed Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack SPEED_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.SUGAR)
|
||||||
|
.name(Global.instance.color("&f&lSpeed Gem &7\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack WEALTH_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.EMERALD)
|
||||||
|
.name(Global.instance.color("&e&lWealth Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack WEALTH_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.EMERALD)
|
||||||
|
.name(Global.instance.color("&e&lWealth Gem &6\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack STRENGTH_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.COOKED_BEEF)
|
||||||
|
.name(Global.instance.color("&4&lStrength Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack STRENGTH_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.COOKED_BEEF)
|
||||||
|
.name(Global.instance.color("&4&lStrength Gem &c\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack ASTRA_GEM = ItemBuilder.create()
|
||||||
|
.material(Material.NAUTILUS_SHELL)
|
||||||
|
.name(Global.instance.color("&d&lASTRA Gem"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
protected static final ItemStack ASTRA_GEM_UPGRADE = ItemBuilder.create()
|
||||||
|
.material(Material.NAUTILUS_SHELL)
|
||||||
|
.name(Global.instance.color("&d&lAstra Gem &5\uD83E\uDC45"))
|
||||||
|
.enchant(Enchantment.MENDING,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static List<ItemStack> gems = Arrays.asList(
|
||||||
|
FIRE_GEM,
|
||||||
|
FIRE_GEM_UPGRADE,
|
||||||
|
LIFE_GEM,
|
||||||
|
LIFE_GEM_UPGRADE,
|
||||||
|
PUFF_GEM,
|
||||||
|
PUFF_GEM_UPGRADE,
|
||||||
|
SPEED_GEM,
|
||||||
|
SPEED_GEM_UPGRADE,
|
||||||
|
WEALTH_GEM,
|
||||||
|
WEALTH_GEM_UPGRADE,
|
||||||
|
STRENGTH_GEM,
|
||||||
|
STRENGTH_GEM_UPGRADE,
|
||||||
|
ASTRA_GEM,
|
||||||
|
ASTRA_GEM_UPGRADE
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.data.Gems;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.server.functions.GemUses;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.DisplayUtils;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.*;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Gems {
|
||||||
|
|
||||||
|
public static final GemData FIRE_GEM = GemData.create(1000)
|
||||||
|
.setItem(GemItems.FIRE_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,700,0)))
|
||||||
|
.setUpgrade(Upgrades.FIRE_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final GemData LIFE_GEM = GemData.create(1100)
|
||||||
|
.setItem(GemItems.LIFE_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.REGENERATION,700,0)))
|
||||||
|
.setUpgrade(Upgrades.LIFE_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final GemData PUFF_GEM = GemData.create(1200)
|
||||||
|
.setItem(GemItems.PUFF_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.JUMP,700,1)))
|
||||||
|
.setUpgrade(Upgrades.PUFF_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final GemData SPEED_GEM = GemData.create(1300)
|
||||||
|
.setItem(GemItems.SPEED_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.SPEED,700,1)))
|
||||||
|
.setUpgrade(Upgrades.SPEED_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final GemData WEALTH_GEM = GemData.create(1400)
|
||||||
|
.setItem(GemItems.WEALTH_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE,700,1)))
|
||||||
|
.setUpgrade(Upgrades.WEALTH_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final GemData STRENGTH_GEM = GemData.create(1500)
|
||||||
|
.setItem(GemItems.STRENGTH_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,700,0)))
|
||||||
|
.setUpgrade(Upgrades.STRENGTH_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final GemData ASTRA_GEM = GemData.create(1600)
|
||||||
|
.setItem(GemItems.ASTRA_GEM)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,700,0)))
|
||||||
|
.setUpgrade(Upgrades.ASTRA_GEM_UPGRADE.get())
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static List<GemData> gems = Arrays.asList(
|
||||||
|
FIRE_GEM,
|
||||||
|
Upgrades.FIRE_GEM_UPGRADE.get(),
|
||||||
|
LIFE_GEM,
|
||||||
|
Upgrades.LIFE_GEM_UPGRADE.get(),
|
||||||
|
PUFF_GEM,
|
||||||
|
Upgrades.PUFF_GEM_UPGRADE.get(),
|
||||||
|
SPEED_GEM,
|
||||||
|
Upgrades.SPEED_GEM_UPGRADE.get(),
|
||||||
|
WEALTH_GEM,
|
||||||
|
Upgrades.WEALTH_GEM_UPGRADE.get(),
|
||||||
|
STRENGTH_GEM,
|
||||||
|
Upgrades.STRENGTH_GEM_UPGRADE.get(),
|
||||||
|
ASTRA_GEM,
|
||||||
|
Upgrades.ASTRA_GEM_UPGRADE.get()
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,160 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.data.Gems;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.server.functions.GemUses;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.DisplayUtils;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.Fireball;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Villager;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class Upgrades {
|
||||||
|
public static final Supplier<GemData> FIRE_GEM_UPGRADE = () -> GemData.create(1001)
|
||||||
|
.setItem(GemItems.FIRE_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.FIRE_RESISTANCE,700,0)))
|
||||||
|
.setOnRightClick(p->{
|
||||||
|
Location eye = p.getEyeLocation();
|
||||||
|
Fireball shoot = eye.getWorld().spawn(eye,Fireball.class,(fireball)->{
|
||||||
|
});
|
||||||
|
shoot.setVelocity(eye.getDirection().multiply(0.5));
|
||||||
|
shoot.setIsIncendiary(true);
|
||||||
|
shoot.setYield(5);
|
||||||
|
})
|
||||||
|
.setCooldown(1200)
|
||||||
|
.setDowngrade(Gems.FIRE_GEM)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final Supplier<GemData> LIFE_GEM_UPGRADE = () -> GemData.create(1101)
|
||||||
|
.setItem(GemItems.LIFE_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.REGENERATION,700,1)))
|
||||||
|
.setOnRightClick(p->{
|
||||||
|
p.registerAttribute(Attribute.GENERIC_MAX_HEALTH);
|
||||||
|
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40);
|
||||||
|
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,400,10));
|
||||||
|
List<LivingEntity> list = p.getLocation().getNearbyLivingEntities(5,5,5).stream().toList();
|
||||||
|
for (LivingEntity entity : list) {
|
||||||
|
if (entity.equals(p) || !(entity instanceof Player)) continue;
|
||||||
|
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(12);
|
||||||
|
SchedulerUtils.later(400,()->{
|
||||||
|
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
SchedulerUtils.later(400,()->{
|
||||||
|
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.setCooldown(1200)
|
||||||
|
.setDowngrade(Gems.LIFE_GEM)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final Supplier<GemData> PUFF_GEM_UPGRADE = () -> GemData.create(1201)
|
||||||
|
.setItem(GemItems.PUFF_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.JUMP,700,1)))
|
||||||
|
.setOnRightClick(p -> {
|
||||||
|
SoundPlayer sp = new SoundPlayer(p.getLocation(), Sound.ENTITY_PUFFER_FISH_BLOW_OUT,10,0.7F);
|
||||||
|
sp.playWithin(30);
|
||||||
|
for (int rad = 0; rad < 30; rad++) {
|
||||||
|
DisplayUtils.ring(p.getLocation().add(0,0.2,0),rad/10D, Color.WHITE,1);
|
||||||
|
}
|
||||||
|
List<LivingEntity> list = p.getLocation().getNearbyLivingEntities(5,5,5).stream().toList();
|
||||||
|
for (LivingEntity entity : list) {
|
||||||
|
if (entity.equals(p)) continue;
|
||||||
|
entity.setVelocity(entity.getVelocity().setY(2));
|
||||||
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING,400,2));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setCooldown(1200)
|
||||||
|
.setDowngrade(Gems.PUFF_GEM)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final Supplier<GemData> SPEED_GEM_UPGRADE = () -> GemData.create(1301)
|
||||||
|
.setItem(GemItems.SPEED_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.FAST_DIGGING,700,1),
|
||||||
|
new PotionEffect(PotionEffectType.SPEED,700,1)))
|
||||||
|
.setOnRightClick(p -> {
|
||||||
|
SoundPlayer sp = new SoundPlayer(p.getLocation(),Sound.ENTITY_CAT_AMBIENT,10,1.3F);
|
||||||
|
sp.playWithin(30);
|
||||||
|
for (int height = 0; height < 20; height++) {
|
||||||
|
int finalHeight = height;
|
||||||
|
SchedulerUtils.later(height/5, () -> {
|
||||||
|
DisplayUtils.ring(p.getLocation().clone().add(0, (double) finalHeight / 10, 0), 2, Color.YELLOW, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
List<LivingEntity> list = p.getLocation().getNearbyLivingEntities(5,5,5).stream().toList();
|
||||||
|
for (LivingEntity entity : list) {
|
||||||
|
if (entity.equals(p)) continue;
|
||||||
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,3));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setDowngrade(Gems.SPEED_GEM)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final Supplier<GemData> WEALTH_GEM_UPGRADE = () -> GemData.create(1401)
|
||||||
|
.setItem(GemItems.WEALTH_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.HERO_OF_THE_VILLAGE,700,3)))
|
||||||
|
.setOnRightClick(p -> {
|
||||||
|
SoundPlayer sp = new SoundPlayer(p.getLocation(),Sound.ENTITY_VILLAGER_YES,10,1.4F);
|
||||||
|
sp.playWithin(30);
|
||||||
|
for (int height = 0; height < 20; height++) {
|
||||||
|
int finalHeight = height;
|
||||||
|
SchedulerUtils.later(height/4, () -> {
|
||||||
|
DisplayUtils.ring(p.getLocation().clone().add(0, (double) finalHeight / 10, 0), 1, Color.LIME, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
p.getLocation().getWorld().spawn(p.getLocation(), Villager.class);
|
||||||
|
})
|
||||||
|
.setDowngrade(Gems.WEALTH_GEM)
|
||||||
|
.setCooldown(1200)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final Supplier<GemData> STRENGTH_GEM_UPGRADE = () -> GemData.create(1501)
|
||||||
|
.setItem(GemItems.STRENGTH_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.INCREASE_DAMAGE,700,1)))
|
||||||
|
.setOnRightClick(p -> {
|
||||||
|
SoundPlayer sp = new SoundPlayer(p.getLocation(),Sound.ENTITY_ZOMBIE_VILLAGER_CURE,10,0.7F);
|
||||||
|
sp.playWithin(30);
|
||||||
|
for (int height = 0; height < 20; height++) {
|
||||||
|
int finalHeight = height;
|
||||||
|
SchedulerUtils.later(height, () -> {
|
||||||
|
DisplayUtils.ring(p.getLocation().clone().add(0, (double) finalHeight / 10, 0), 2, Color.RED, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
List<LivingEntity> list = p.getLocation().getNearbyLivingEntities(5,5,5).stream().toList();
|
||||||
|
for (LivingEntity entity : list) {
|
||||||
|
if (entity.equals(p)) continue;
|
||||||
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.WITHER,200,1));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setDowngrade(Gems.STRENGTH_GEM)
|
||||||
|
.setCooldown(1200)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static final Supplier<GemData> ASTRA_GEM_UPGRADE = () -> GemData.create(1601)
|
||||||
|
.setItem(GemItems.ASTRA_GEM_UPGRADE)
|
||||||
|
.setPassive(List.of(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,700,1)))
|
||||||
|
.setOnRightClick(p -> {
|
||||||
|
for (int height = 0; height < 20; height++) {
|
||||||
|
int finalHeight = height;
|
||||||
|
SchedulerUtils.later(height/2, () -> {
|
||||||
|
DisplayUtils.ring(p.getLocation().clone().add(0, (double) finalHeight / 10, 0), 2, Color.AQUA, 1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
GemUses.shootAstraTrident(p,0);
|
||||||
|
GemUses.shootAstraTrident(p,5);
|
||||||
|
GemUses.shootAstraTrident(p,10);
|
||||||
|
})
|
||||||
|
.setDowngrade(Gems.ASTRA_GEM)
|
||||||
|
.setCooldown(1200)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
@@ -1,4 +0,0 @@
|
|||||||
package io.github.thetrouper.sssbliss.data.gems;
|
|
||||||
|
|
||||||
public class FireGem {
|
|
||||||
}
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
package io.github.thetrouper.sssbliss.events;
|
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.events.CustomListener;
|
|
||||||
|
|
||||||
public class CMDBlockExecute implements CustomListener {
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class DeathListener implements CustomListener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onPlayerDeath(PlayerDeathEvent e) {
|
||||||
|
GemData gem = GemUtils.hasGem(e.getPlayer());
|
||||||
|
if (gem == null) return;
|
||||||
|
|
||||||
|
e.getItemsToKeep().add(gem.item());
|
||||||
|
e.getDrops().removeIf(drop -> drop.isSimilar(gem.item()));
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onRespawn(PlayerRespawnEvent e) {
|
||||||
|
SchedulerUtils.later(500,()->{
|
||||||
|
GemData downgrade = GemUtils.hasGem(e.getPlayer()).downgrade();
|
||||||
|
if (downgrade == null) {
|
||||||
|
Bukkit.broadcast(Component.text("Your gem could not be downgraded!"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
e.getPlayer().getInventory().setItemInOffHand(downgrade.item());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import static io.github.thetrouper.sssbliss.data.Gems.GemItems.gems;
|
||||||
|
|
||||||
|
public class GemMoveListener implements CustomListener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
|
Player p = (Player) e.getWhoClicked();
|
||||||
|
ItemStack offhand = p.getInventory().getItemInOffHand();
|
||||||
|
ItemStack clicked = ItemBuilder.create().material(Material.AIR).build();
|
||||||
|
if (e.getClickedInventory() != null) {
|
||||||
|
clicked = e.getClickedInventory().getItem(e.getSlot());
|
||||||
|
}
|
||||||
|
if (p.getGameMode().equals(GameMode.CREATIVE)) return;
|
||||||
|
if (GemUtils.isGem(e.getCursor()) || GemUtils.isGem(e.getCurrentItem()) || GemUtils.isGem(e.getWhoClicked().getItemOnCursor())) {
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.getOpenInventory().getTopInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
p.getOpenInventory().getBottomInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
e.getInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
if (e.getClickedInventory() != null) {
|
||||||
|
e.getClickedInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
}
|
||||||
|
if (!GemUtils.isGem(clicked)) {
|
||||||
|
//e.getClickedInventory().setItem(e.getSlot(),clicked);
|
||||||
|
}
|
||||||
|
ItemStack finalClicked = clicked;
|
||||||
|
SchedulerUtils.later(1,()->{
|
||||||
|
p.getOpenInventory().getTopInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
p.getOpenInventory().getBottomInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
e.getInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
if (e.getClickedInventory() != null) {
|
||||||
|
e.getClickedInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
}
|
||||||
|
p.getInventory().removeItem(gems.toArray(new ItemStack[0]));
|
||||||
|
p.getInventory().setItemInOffHand(offhand);
|
||||||
|
if (!GemUtils.isGem(finalClicked)) {
|
||||||
|
//e.getClickedInventory().setItem(e.getSlot(),clicked);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSwap(PlayerSwapHandItemsEvent e) {
|
||||||
|
if (e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) return;
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,72 @@
|
|||||||
package io.github.thetrouper.sssbliss.events;
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
import io.github.itzispyder.pdk.events.CustomListener;
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Cooldown;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Pair;
|
||||||
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.GameMode;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
|
||||||
public class GemUseListener implements CustomListener {
|
import java.util.HashMap;
|
||||||
@EventHandler
|
import java.util.Map;
|
||||||
public void onGemUse(PlayerInteractEvent e) {
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class GemUseListener implements CustomListener {
|
||||||
|
|
||||||
|
Cooldown<Map<UUID,Integer>> gemCooldown = new Cooldown<>();
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onGemUse(PlayerInteractEvent e) {
|
||||||
|
if (!e.getAction().isRightClick()) return;
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
UUID u = e.getPlayer().getUniqueId();
|
||||||
|
GemData gem = GemUtils.hasGem(e.getPlayer());
|
||||||
|
|
||||||
|
p.sendMessage(Component.text(u.toString()));
|
||||||
|
if (gem == null) return;
|
||||||
|
p.sendMessage(Component.text(gem.dataID()));
|
||||||
|
Map<UUID,Integer> gemCool = new HashMap<>();
|
||||||
|
gemCool.put(u,gem.dataID());
|
||||||
|
/*p.sendMessage(Component.text(new GemEntry(u,gem.dataID()).equals(new GemEntry(u,gem.dataID()))));
|
||||||
|
p.sendMessage(Component.text(geme.toString()));
|
||||||
|
if (!p.getInventory().getItemInOffHand().isSimilar(gem.item())) return;*/
|
||||||
|
if (gemCooldown.isOnCooldown(gemCool) && !p.getGameMode().equals(GameMode.CREATIVE)) {
|
||||||
|
/*if (gemCooldown.isOnCooldown(geme)) {
|
||||||
|
e.getPlayer().sendMessage(Component.text(color(SSSBliss.mainConfig.plugin.prefix + "&cYour gem is on cooldown! &7You can use it again in &e%s&7 seconds!".formatted(
|
||||||
|
(gemCooldown.getCooldown(geme))/1000L)
|
||||||
|
)));*/
|
||||||
|
e.getPlayer().sendMessage(Component.text(color(SSSBliss.mainConfig.plugin.prefix + "&cYour gem is on cooldown! &7You can use it again in &e%s&7 seconds!".formatted(
|
||||||
|
(gemCooldown.getCooldown(gemCool))/1000L)
|
||||||
|
)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//gemCooldown.addCooldown(geme,gem.cooldown() * 50L);
|
||||||
|
gemCooldown.setCooldown(gemCool, gem.cooldown() * 50L);
|
||||||
|
try {
|
||||||
|
gem.onRightClick().accept(e.getPlayer());
|
||||||
|
} catch (Exception ignored) {}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/*public static class GemEntry extends Pair<UUID, Integer> {
|
||||||
|
public GemEntry(UUID left, Integer right) {
|
||||||
|
super(left, right);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "{%s, %s}".formatted(left,right);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (!(obj instanceof GemEntry entry)) return false;
|
||||||
|
return entry.left.equals(this.left) && entry.right.intValue() == this.right;
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Trident;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
|
|
||||||
|
public class ProjectileHitListener implements CustomListener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onAstraTridentLand(ProjectileHitEvent e) {
|
||||||
|
if (e.getEntity() instanceof Trident t && t.getScoreboardTags().contains("astra-trident")) {
|
||||||
|
t.remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
private void onAstraTridentHit(ProjectileHitEvent e) {
|
||||||
|
if (e.getHitEntity() != null && e.getEntity() instanceof Trident t && t.getScoreboardTags().contains("astra-trident")) {
|
||||||
|
if (!(e.getHitEntity() instanceof LivingEntity victim)) return;
|
||||||
|
victim.damage(2,(Entity) e.getEntity().getShooter());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,55 +1,22 @@
|
|||||||
package io.github.thetrouper.sssbliss.server.functions;
|
package io.github.thetrouper.sssbliss.server.functions;
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.Global;
|
|
||||||
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
|
||||||
import io.github.itzispyder.pdk.utils.ServerUtils;
|
import io.github.itzispyder.pdk.utils.ServerUtils;
|
||||||
import io.github.thetrouper.sssbliss.data.GemBuilder;
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
import net.kyori.adventure.text.Component;
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class GemPassiveEffects {
|
public class GemPassiveEffects {
|
||||||
|
|
||||||
public static List<GemBuilder> gems = Arrays.asList(
|
|
||||||
new GemBuilder(new ItemBuilder()
|
|
||||||
.material(Material.EMERALD)
|
|
||||||
.name(Global.instance.color("&c&lFire Gem"))
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.effect(PotionEffectType.FIRE_RESISTANCE,1)
|
|
||||||
.onRightClick((p) ->{
|
|
||||||
|
|
||||||
}),
|
|
||||||
new GemBuilder(new ItemBuilder()
|
|
||||||
.material(Material.LAPIS_LAZULI)
|
|
||||||
.name(Global.instance.color("&c&lWater Gem"))
|
|
||||||
.build()
|
|
||||||
)
|
|
||||||
.effect(PotionEffectType.FIRE_RESISTANCE,1)
|
|
||||||
.onRightClick((p) ->{
|
|
||||||
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
public GemBuilder gem = new GemBuilder(new ItemBuilder()
|
|
||||||
.material(Material.EMERALD)
|
|
||||||
.name(Global.instance.color("&c&lFire Gem"))
|
|
||||||
.build()
|
|
||||||
).onRightClick((player)->{
|
|
||||||
player.kick(Component.text("Yipeee!"));
|
|
||||||
}).effect(PotionEffectType.FIRE_RESISTANCE,1);
|
|
||||||
|
|
||||||
public static void applyPassiveEffects() {
|
public static void applyPassiveEffects() {
|
||||||
ServerUtils.forEachPlayer((player)->{
|
ServerUtils.forEachPlayer(GemPassiveEffects::effectPlayer);
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
public static void effectPlayer(Player p) {
|
public static void effectPlayer(Player p) {
|
||||||
|
GemData has = GemUtils.hasGem(p);
|
||||||
|
if (has == null) return;
|
||||||
|
if (has.passive().isEmpty()) return;
|
||||||
|
for (PotionEffect potionEffect : GemUtils.hasGem(p).passive()) {
|
||||||
|
potionEffect.apply(p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.functions;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.SoundPlayer;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.Trident;
|
||||||
|
|
||||||
|
public class GemUses {
|
||||||
|
|
||||||
|
public static void shootAstraTrident(Player p, int tickdelay) {
|
||||||
|
|
||||||
|
SchedulerUtils.later(tickdelay,()->{
|
||||||
|
SoundPlayer shoot = new SoundPlayer(p.getLocation(), Sound.ITEM_TRIDENT_THROW,20,0.6F);
|
||||||
|
shoot.playWithin(30);
|
||||||
|
|
||||||
|
p.getWorld().spawn(p.getEyeLocation(), Trident.class,(trident -> {
|
||||||
|
trident.setShooter(p);
|
||||||
|
trident.setVelocity(p.getLocation().getDirection().multiply(2));
|
||||||
|
trident.getScoreboardTags().add("astra-trident");
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,144 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.util;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Randomizer;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.function.BiFunction;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Function;
|
||||||
|
|
||||||
|
public class DisplayUtils implements Global {
|
||||||
|
|
||||||
|
public static final Function<Particle, Consumer<Location>> PARTICLE_FACTORY = particle -> l -> l.getWorld().spawnParticle(particle, l, 1, 0, 0, 0, 0);
|
||||||
|
public static final BiFunction<Color, Float, Consumer<Location>> DUST_PARTICLE_FACTORY = (color, thickness) -> {
|
||||||
|
Particle.DustOptions dust = new Particle.DustOptions(color, thickness);
|
||||||
|
return l -> l.getWorld().spawnParticle(Particle.REDSTONE, l, 1, 0, 0, 0, 0, dust);
|
||||||
|
};
|
||||||
|
public static final Function<Boolean, Consumer<Location>> FLAME_PARTICLE_FACTORY = soul -> {
|
||||||
|
Particle flame = soul ? Particle.SOUL_FIRE_FLAME : Particle.FLAME;
|
||||||
|
return l -> l.getWorld().spawnParticle(flame, l, 1, 0, 0, 0, 0);
|
||||||
|
};
|
||||||
|
|
||||||
|
public static void ring(Location loc, double radius, Color color, float thickness) {
|
||||||
|
ring(loc, radius, DUST_PARTICLE_FACTORY.apply(color, thickness));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void wave(Location loc, double radius, Color color, float thickness, double gap) {
|
||||||
|
wave(loc, radius, DUST_PARTICLE_FACTORY.apply(color, thickness), gap);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void ring(Location loc, double radius, Consumer<Location> action) {
|
||||||
|
for (int theta = 0; theta < 360; theta += 10) {
|
||||||
|
double x = Math.cos(Math.toRadians(theta)) * radius;
|
||||||
|
double z = Math.sin(Math.toRadians(theta)) * radius;
|
||||||
|
Location newLoc = loc.clone().add(x, 0, z);
|
||||||
|
action.accept(newLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void wave(Location loc, double radius, Consumer<Location> action, double gap) {
|
||||||
|
AtomicReference<Double> i = new AtomicReference<>(gap);
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(instance.getPlugin(), () -> {
|
||||||
|
if (i.get() >= radius) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ring(loc, i.get(), action);
|
||||||
|
i.set(i.get() + gap);
|
||||||
|
}, 0, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void disc(Location loc, double radius, Consumer<Location> action, double gap) {
|
||||||
|
for (double i = gap; i < radius; i += gap) {
|
||||||
|
ring(loc, i, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void helix(Location loc, double radius, Consumer<Location> action, double gap, int height) {
|
||||||
|
int theta = 0;
|
||||||
|
for (double y = 0; y <= height; y += gap) {
|
||||||
|
double x = Math.cos(Math.toRadians(theta)) * radius;
|
||||||
|
double z = Math.sin(Math.toRadians(theta)) * radius;
|
||||||
|
|
||||||
|
Location newLoc = loc.clone().add(x, y, z);
|
||||||
|
action.accept(newLoc);
|
||||||
|
theta += 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void vortex(Location loc, double radius, Consumer<Location> action, double gapH, double gapV, int height) {
|
||||||
|
double r = radius;
|
||||||
|
int theta = 0;
|
||||||
|
for (double y = 0; y <= height; y += gapV) {
|
||||||
|
double x = Math.cos(Math.toRadians(theta)) * r;
|
||||||
|
double z = Math.sin(Math.toRadians(theta)) * r;
|
||||||
|
|
||||||
|
Location newLoc = loc.clone().add(x, y, z);
|
||||||
|
action.accept(newLoc);
|
||||||
|
r += gapH;
|
||||||
|
theta += 10;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void beam(Location loc, Consumer<Location> action, double gap, int height) {
|
||||||
|
for (double y = 0; y <= height; y += gap) {
|
||||||
|
Location newLoc = loc.clone().add(0, y, 0);
|
||||||
|
action.accept(newLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void arc(Location loc, double radius, int angleFrom, int angleTo, Consumer<Location> action) {
|
||||||
|
for (int theta = angleFrom; theta < angleTo; theta += 10) {
|
||||||
|
double x = Math.cos(Math.toRadians(theta)) * radius;
|
||||||
|
double z = Math.sin(Math.toRadians(theta)) * radius;
|
||||||
|
Location newLoc = loc.clone().add(x, 0, z);
|
||||||
|
action.accept(newLoc);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fan(Location loc, double radius, int angleFrom, int angleTo, Consumer<Location> action, double gap) {
|
||||||
|
for (double i = gap; i < radius; i += gap) {
|
||||||
|
arc(loc, i, angleFrom, angleTo, action);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fanWave(Location loc, double radius, int sections, Consumer<Location> action, double gap) {
|
||||||
|
double arcLength = 360.0 / sections;
|
||||||
|
AtomicReference<Double> i = new AtomicReference<>(0.0);
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(instance.getPlugin(), () -> {
|
||||||
|
if (i.get() >= 360) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double start = i.get();
|
||||||
|
fan(loc, radius, (int)start, (int)(start + arcLength), action, gap);
|
||||||
|
i.set(i.get() + arcLength);
|
||||||
|
}, 0, 5);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void fanWaveRandom(Location loc, double radius, int sections, Consumer<Location> action, double gap) {
|
||||||
|
double arcLength = 360.0 / sections;
|
||||||
|
List<Double> ints = new ArrayList<>();
|
||||||
|
for (double start = 0; start < 360; start += arcLength) {
|
||||||
|
ints.add(start);
|
||||||
|
}
|
||||||
|
|
||||||
|
AtomicInteger i = new AtomicInteger(0);
|
||||||
|
Randomizer random = new Randomizer();
|
||||||
|
Bukkit.getScheduler().scheduleSyncRepeatingTask(instance.getPlugin(), () -> {
|
||||||
|
if (i.get() >= sections) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
double start = random.getRandomElement(ints);
|
||||||
|
ints.remove(start);
|
||||||
|
fan(loc, radius, (int)start, (int)(start + arcLength), action, gap);
|
||||||
|
i.getAndIncrement();
|
||||||
|
}, 0, 5);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.util;
|
||||||
|
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.Inventory;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class GemUtils {
|
||||||
|
|
||||||
|
public static GemData hasGem(Player p) {
|
||||||
|
for (GemData gem : Gems.gems) {
|
||||||
|
if (p.getInventory().getItemInOffHand().hasItemMeta() && p.getInventory().getItemInOffHand().getItemMeta().hasCustomModelData() && p.getInventory().getItemInOffHand().getItemMeta().getCustomModelData() == gem.dataID()) {
|
||||||
|
return gem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean isGem(ItemStack i) {
|
||||||
|
for (GemData gem : Gems.gems) {
|
||||||
|
if (i.isSimilar(gem.item())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasGem(Inventory i) {
|
||||||
|
for (ItemStack itemStack : i) {
|
||||||
|
for (GemData gem : Gems.gems) {
|
||||||
|
itemStack.isSimilar(gem.item());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,94 +3,24 @@ version: '${version}'
|
|||||||
main: io.github.thetrouper.sssbliss.SSSBliss
|
main: io.github.thetrouper.sssbliss.SSSBliss
|
||||||
api-version: 1.19
|
api-version: 1.19
|
||||||
authors: [ TheTrouper ]
|
authors: [ TheTrouper ]
|
||||||
description: Detect Block and Ban players who attempt to grief your server.
|
description: Bliss for Madness4Ever
|
||||||
website: https://thetrouper.github.io/
|
website: https://thetrouper.github.io/
|
||||||
permissions:
|
permissions:
|
||||||
sssbliss.message:
|
bliss.staff:
|
||||||
description: Access to the direct messages
|
description: Do admin commands
|
||||||
default: op
|
default: op
|
||||||
sssbliss.reply:
|
bliss.callbacks:
|
||||||
description: Reply commands
|
description: Use callback commands
|
||||||
sssbliss.debug:
|
|
||||||
description: Permission to use debug commands
|
|
||||||
default: op
|
default: op
|
||||||
sssbliss.staff:
|
|
||||||
description: Receive anti-swear and anti-spam warnings
|
|
||||||
default: op
|
|
||||||
sssbliss.chat.antiswear.flags:
|
|
||||||
description: See antiSwear flags
|
|
||||||
default: op
|
|
||||||
sssbliss.chat.antiswear.bypass:
|
|
||||||
description: Bypass the antiSwear
|
|
||||||
default: op
|
|
||||||
sssbliss.chat.antispam.flags:
|
|
||||||
description: See antispam flags
|
|
||||||
default: op
|
|
||||||
sssbliss.chat.antispam.bypass:
|
|
||||||
description: Bypass the antispam
|
|
||||||
default: op
|
|
||||||
sssbliss.chat.*:
|
|
||||||
description: bypass all chat rules and see all flags
|
|
||||||
default: op
|
|
||||||
children:
|
|
||||||
sssbliss.chat.antiswear.flags: true
|
|
||||||
sssbliss.chat.antiswear.bypass: true
|
|
||||||
sssbliss.chat.antispam.flags: true
|
|
||||||
sssbliss.chat.antispam.bypass: true
|
|
||||||
commands:
|
commands:
|
||||||
sssbliss:
|
bliss:
|
||||||
description: A command for testing.
|
description: A command for testing.
|
||||||
usage: /sssbliss
|
usage: /bliss
|
||||||
permission: sssbliss.info
|
permission: bliss.info
|
||||||
permission-message: You do not have permission!
|
permission-message: You do not have permission!
|
||||||
reop:
|
|
||||||
description: Allows trusted players to elevate their permissions
|
|
||||||
usage: /reop
|
|
||||||
socialspy:
|
|
||||||
permission: sssbliss.spy
|
|
||||||
usage: /socialspy
|
|
||||||
permission-message: You do not have permission to use this command!
|
|
||||||
description: View direct messages sent between players
|
|
||||||
aliases:
|
|
||||||
- spy
|
|
||||||
- sspy
|
|
||||||
msg:
|
|
||||||
permission: sssbliss.message
|
|
||||||
usage: /msg <player> [<message>]
|
|
||||||
permission-message: You do not have permission to message through sssbliss!
|
|
||||||
description: Send messages directly to players
|
|
||||||
aliases:
|
|
||||||
- message
|
|
||||||
- etell
|
|
||||||
- tell
|
|
||||||
- t
|
|
||||||
- ewhisper
|
|
||||||
- whisper
|
|
||||||
- w
|
|
||||||
- privatemessage
|
|
||||||
- pm
|
|
||||||
- m
|
|
||||||
- directmessage
|
|
||||||
- dm
|
|
||||||
- sssblissmessage
|
|
||||||
- sm
|
|
||||||
- stell
|
|
||||||
- smsg
|
|
||||||
reply:
|
|
||||||
description: Reply to the last person messaging you
|
|
||||||
usage: /r [<message>]
|
|
||||||
permission: sssbliss.reply
|
|
||||||
permission-message: You do not have permission to reply through sssbliss!
|
|
||||||
aliases:
|
|
||||||
- r
|
|
||||||
- er
|
|
||||||
- rply
|
|
||||||
- ereply
|
|
||||||
- sr
|
|
||||||
- sreply
|
|
||||||
- sssblissreply
|
|
||||||
sssblisscallback:
|
sssblisscallback:
|
||||||
description: Callback for chat click events
|
description: Callback for chat click events
|
||||||
usage: /sssblisscallback
|
usage: /sssblisscallback
|
||||||
permission: sssbliss.callbacks
|
permission: bliss.callbacks
|
||||||
permission-message: You have not been given permission to use SSSBliss Chat Callbacks!
|
permission-message: You have not been given permission to use SSSBliss Chat Callbacks!
|
||||||
Reference in New Issue
Block a user