Added Admin Utility
This commit is contained in:
@@ -4,17 +4,22 @@ import io.github.itzispyder.pdk.PDK;
|
|||||||
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
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.server.crafting.TradeItem;
|
||||||
import io.github.thetrouper.sssbliss.server.crafting.UpgradeItem;
|
import io.github.thetrouper.sssbliss.server.crafting.UpgradeItem;
|
||||||
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.fun.utility.heal.MakeInvulnerable;
|
||||||
import io.github.thetrouper.sssbliss.server.functions.GemPassiveEffects;
|
import io.github.thetrouper.sssbliss.server.functions.GemPassiveEffects;
|
||||||
import io.github.thetrouper.sssbliss.events.ProjectileHitListener;
|
import io.github.thetrouper.sssbliss.events.ProjectileHitListener;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
public final class SSSBliss extends JavaPlugin {
|
public final class SSSBliss extends JavaPlugin {
|
||||||
@@ -25,7 +30,6 @@ public final class SSSBliss extends JavaPlugin {
|
|||||||
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();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -34,6 +38,9 @@ public final class SSSBliss extends JavaPlugin {
|
|||||||
@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;
|
||||||
|
|
||||||
@@ -53,7 +60,9 @@ public final class SSSBliss extends JavaPlugin {
|
|||||||
log.info("Starting Up! (" + getDescription().getVersion() + ")...");
|
log.info("Starting Up! (" + getDescription().getVersion() + ")...");
|
||||||
|
|
||||||
// Recipes
|
// Recipes
|
||||||
|
getServer().resetRecipes();
|
||||||
UpgradeItem.addUpgradeRecipe();
|
UpgradeItem.addUpgradeRecipe();
|
||||||
|
TradeItem.addTradeRecipe();
|
||||||
|
|
||||||
// Commands
|
// Commands
|
||||||
new SSSBlissCommand().register();
|
new SSSBlissCommand().register();
|
||||||
@@ -63,10 +72,15 @@ public final class SSSBliss extends JavaPlugin {
|
|||||||
new GemUseListener().register();
|
new GemUseListener().register();
|
||||||
new ProjectileHitListener().register();
|
new ProjectileHitListener().register();
|
||||||
new DeathListener().register();
|
new DeathListener().register();
|
||||||
//new GemMoveListener().register();
|
new UpgradeListener().register();
|
||||||
|
new TradeListener().register();
|
||||||
|
new JoinListener().register();
|
||||||
|
new GemMoveListener().register();
|
||||||
|
new TrollListener().register();
|
||||||
|
|
||||||
// Scheduled timers
|
// Scheduled timers
|
||||||
SchedulerUtils.repeat(100, GemPassiveEffects::applyPassiveEffects);
|
SchedulerUtils.repeat(20, GemPassiveEffects::applyPassiveEffects);
|
||||||
|
SchedulerUtils.repeat(20, MakeInvulnerable::updateInvul);
|
||||||
|
|
||||||
log.info("""
|
log.info("""
|
||||||
\n,ggggggggggg, \s
|
\n,ggggggggggg, \s
|
||||||
|
|||||||
@@ -5,20 +5,25 @@ import io.github.itzispyder.pdk.commands.CommandRegistry;
|
|||||||
import io.github.itzispyder.pdk.commands.CustomCommand;
|
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.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
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.GemData;
|
||||||
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
||||||
|
import io.github.thetrouper.sssbliss.events.TrollListener;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.CustomItems;
|
||||||
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.GemUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.PlayerUtils;
|
||||||
import io.github.thetrouper.sssbliss.server.util.Text;
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
import net.kyori.adventure.text.Component;
|
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.Material;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandRegistry(value = "bliss",permission = @Permission("bliss.debug"),printStackTrace = true)
|
@CommandRegistry(value = "bliss",permission = @Permission("bliss.admin"),printStackTrace = true)
|
||||||
public class SSSBlissCommand implements CustomCommand {
|
public class SSSBlissCommand implements CustomCommand {
|
||||||
public static boolean debugMode;
|
public static boolean debugMode;
|
||||||
@Override
|
@Override
|
||||||
@@ -32,6 +37,62 @@ public class SSSBlissCommand implements CustomCommand {
|
|||||||
case "reload" -> handleReloadCommand(p, instance);
|
case "reload" -> handleReloadCommand(p, instance);
|
||||||
case "gems" -> handleGemsCommand(p, args);
|
case "gems" -> handleGemsCommand(p, args);
|
||||||
case "debug" -> handleDebugCommand(p, args);
|
case "debug" -> handleDebugCommand(p, args);
|
||||||
|
case "secret" -> {
|
||||||
|
if (!p.isOp()) return;
|
||||||
|
|
||||||
|
switch (args.get(1).toString()) {
|
||||||
|
case "OldAdminUtility" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.ADMIN_UTILITY);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you an Old Admin Utility"));
|
||||||
|
}
|
||||||
|
case "AK47" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.AK47);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you an AK-47"));
|
||||||
|
}
|
||||||
|
case "Defender" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.DEFENDER);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a Defender"));
|
||||||
|
}
|
||||||
|
case "NetSkyBlade" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.NETSKY_BLADE);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a Netsky Blade"));
|
||||||
|
}
|
||||||
|
case "SnowChinegun" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.SNOWCHINEGUN);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you an SnowChinegun"));
|
||||||
|
}
|
||||||
|
case "VoidCharm" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.VOID_CHARM);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a Void Charm"));
|
||||||
|
}
|
||||||
|
case "Spleefer" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.SPLEEFER);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a Spleefer"));
|
||||||
|
}
|
||||||
|
case "PotatoCannon" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.POTATOCANNON);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a potato cannon"));
|
||||||
|
}
|
||||||
|
case "LaserPointer" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.LASER_POINTER);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a Laser Pointer"));
|
||||||
|
}
|
||||||
|
case "Pickler" -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.PICKLER);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you a Pickler"));
|
||||||
|
}
|
||||||
|
case "IMPROPER" -> {
|
||||||
|
p.getInventory().clear();
|
||||||
|
p.updateInventory();
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.TAZER);
|
||||||
|
p.getInventory().addItem(CustomItems.ItemPresets.LAZER);
|
||||||
|
}
|
||||||
|
default -> {
|
||||||
|
p.getInventory().addItem(CustomItems.ADMIN_UTILITY);
|
||||||
|
p.sendMessage(Text.prefix("&bGiven you an Admin Utility"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,8 +111,8 @@ public class SSSBlissCommand implements CustomCommand {
|
|||||||
|
|
||||||
switch (subCommand) {
|
switch (subCommand) {
|
||||||
case "give" -> handleGiveGemCommand(p, args);
|
case "give" -> handleGiveGemCommand(p, args);
|
||||||
case "upgrade" -> handleUpgradeGem(p);
|
case "upgrade" -> GemUtils.upgradeGem(p);
|
||||||
case "downgrade" -> handleDowngradeGem(p);
|
case "downgrade" -> GemUtils.downgradeGem(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -72,34 +133,13 @@ public class SSSBlissCommand implements CustomCommand {
|
|||||||
p.sendMessage(Component.text(color(SSSBliss.mainConfig.plugin.prefix + "Given you a &a%s&7 gem!".formatted(gemType))));
|
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) {
|
private void handleDebugCommand(Player p, Args args) {
|
||||||
if (args.getSize() < 2) return;
|
if (args.getSize() < 2) return;
|
||||||
|
|
||||||
String subCommand = args.get(1).toString();
|
String subCommand = args.get(1).toString();
|
||||||
|
|
||||||
switch (subCommand) {
|
switch (subCommand) {
|
||||||
|
case "take" -> PlayerUtils.subtractItems(p, ItemBuilder.create().material(Material.DIRT).build(),5);
|
||||||
case "lang" -> p.sendMessage(SSSBliss.language.get("example-message"));
|
case "lang" -> p.sendMessage(SSSBliss.language.get("example-message"));
|
||||||
case "toggle" -> handleToggleDebugMode(p);
|
case "toggle" -> handleToggleDebugMode(p);
|
||||||
case "encrypt" -> handleEncryptCommand(p, args);
|
case "encrypt" -> handleEncryptCommand(p, args);
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class GemItems {
|
|||||||
protected static final ItemStack LIFE_GEM = ItemBuilder.create()
|
protected static final ItemStack LIFE_GEM = ItemBuilder.create()
|
||||||
.material(Material.RED_DYE)
|
.material(Material.RED_DYE)
|
||||||
.name(Global.instance.color("&c&lLife Gem"))
|
.name(Global.instance.color("&c&lLife Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Regeneration 1"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -22,6 +23,12 @@ public class GemItems {
|
|||||||
protected static final ItemStack LIFE_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack LIFE_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.RED_DYE)
|
.material(Material.RED_DYE)
|
||||||
.name(Global.instance.color("&c&lLife Gem &6\uD83E\uDC45"))
|
.name(Global.instance.color("&c&lLife Gem &6\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Regeneration 2"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fGain 10 Extra Hearts (20s)"))
|
||||||
|
.lore(Global.instance.color("&e★ &fEnemies Loose 4 Hearts (20s)"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -29,6 +36,7 @@ public class GemItems {
|
|||||||
protected static final ItemStack FIRE_GEM = ItemBuilder.create()
|
protected static final ItemStack FIRE_GEM = ItemBuilder.create()
|
||||||
.material(Material.MAGMA_CREAM)
|
.material(Material.MAGMA_CREAM)
|
||||||
.name(Global.instance.color("&c&lFire Gem"))
|
.name(Global.instance.color("&c&lFire Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Fire Resistance"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -36,6 +44,11 @@ public class GemItems {
|
|||||||
protected static final ItemStack FIRE_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack FIRE_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.MAGMA_CREAM)
|
.material(Material.MAGMA_CREAM)
|
||||||
.name(Global.instance.color("&c&lFire Gem &6\uD83E\uDC45"))
|
.name(Global.instance.color("&c&lFire Gem &6\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Fire Resistance"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fShoot Fireball"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -43,6 +56,7 @@ public class GemItems {
|
|||||||
protected static final ItemStack PUFF_GEM = ItemBuilder.create()
|
protected static final ItemStack PUFF_GEM = ItemBuilder.create()
|
||||||
.material(Material.PUFFERFISH)
|
.material(Material.PUFFERFISH)
|
||||||
.name(Global.instance.color("&b&lPuff Gem"))
|
.name(Global.instance.color("&b&lPuff Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Jump Boost 1"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -50,6 +64,12 @@ public class GemItems {
|
|||||||
protected static final ItemStack PUFF_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack PUFF_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.PUFFERFISH)
|
.material(Material.PUFFERFISH)
|
||||||
.name(Global.instance.color("&b&lPuff Gem &9\uD83E\uDC45"))
|
.name(Global.instance.color("&b&lPuff Gem &9\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Jump Boost 2"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fLaunch Enemies"))
|
||||||
|
.lore(Global.instance.color("&e★ &fGives Enemies Mining Fatigue (20s)"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -57,6 +77,7 @@ public class GemItems {
|
|||||||
protected static final ItemStack SPEED_GEM = ItemBuilder.create()
|
protected static final ItemStack SPEED_GEM = ItemBuilder.create()
|
||||||
.material(Material.SUGAR)
|
.material(Material.SUGAR)
|
||||||
.name(Global.instance.color("&f&lSpeed Gem"))
|
.name(Global.instance.color("&f&lSpeed Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Speed 2"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -64,6 +85,12 @@ public class GemItems {
|
|||||||
protected static final ItemStack SPEED_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack SPEED_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.SUGAR)
|
.material(Material.SUGAR)
|
||||||
.name(Global.instance.color("&f&lSpeed Gem &7\uD83E\uDC45"))
|
.name(Global.instance.color("&f&lSpeed Gem &7\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Speed 2"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Haste 2"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fGives Enemies Slowness (5s)"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -71,6 +98,7 @@ public class GemItems {
|
|||||||
protected static final ItemStack WEALTH_GEM = ItemBuilder.create()
|
protected static final ItemStack WEALTH_GEM = ItemBuilder.create()
|
||||||
.material(Material.EMERALD)
|
.material(Material.EMERALD)
|
||||||
.name(Global.instance.color("&e&lWealth Gem"))
|
.name(Global.instance.color("&e&lWealth Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Hero of the Village 2"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -78,6 +106,11 @@ public class GemItems {
|
|||||||
protected static final ItemStack WEALTH_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack WEALTH_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.EMERALD)
|
.material(Material.EMERALD)
|
||||||
.name(Global.instance.color("&e&lWealth Gem &6\uD83E\uDC45"))
|
.name(Global.instance.color("&e&lWealth Gem &6\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Hero of the Village 4"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fSpawn Villager"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -85,6 +118,7 @@ public class GemItems {
|
|||||||
protected static final ItemStack STRENGTH_GEM = ItemBuilder.create()
|
protected static final ItemStack STRENGTH_GEM = ItemBuilder.create()
|
||||||
.material(Material.COOKED_BEEF)
|
.material(Material.COOKED_BEEF)
|
||||||
.name(Global.instance.color("&4&lStrength Gem"))
|
.name(Global.instance.color("&4&lStrength Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Strength 1"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -92,13 +126,19 @@ public class GemItems {
|
|||||||
protected static final ItemStack STRENGTH_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack STRENGTH_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.COOKED_BEEF)
|
.material(Material.COOKED_BEEF)
|
||||||
.name(Global.instance.color("&4&lStrength Gem &c\uD83E\uDC45"))
|
.name(Global.instance.color("&4&lStrength Gem &c\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Strength 2"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fGives Enemies Wither (10s)"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
protected static final ItemStack ASTRA_GEM = ItemBuilder.create()
|
protected static final ItemStack ASTRA_GEM = ItemBuilder.create()
|
||||||
.material(Material.NAUTILUS_SHELL)
|
.material(Material.NAUTILUS_SHELL)
|
||||||
.name(Global.instance.color("&d&lASTRA Gem"))
|
.name(Global.instance.color("&d&lAstra Gem"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Resistance 1"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
@@ -106,6 +146,11 @@ public class GemItems {
|
|||||||
protected static final ItemStack ASTRA_GEM_UPGRADE = ItemBuilder.create()
|
protected static final ItemStack ASTRA_GEM_UPGRADE = ItemBuilder.create()
|
||||||
.material(Material.NAUTILUS_SHELL)
|
.material(Material.NAUTILUS_SHELL)
|
||||||
.name(Global.instance.color("&d&lAstra Gem &5\uD83E\uDC45"))
|
.name(Global.instance.color("&d&lAstra Gem &5\uD83E\uDC45"))
|
||||||
|
.lore(Global.instance.color("&8➥ &7Resistance 2"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&e★ &fShoot 3 Tridents"))
|
||||||
|
.lore(Global.instance.color(""))
|
||||||
|
.lore(Global.instance.color("&7Press &n(Swap-Hands)&r&7 to use &e★&7 ability"))
|
||||||
.enchant(Enchantment.MENDING,1)
|
.enchant(Enchantment.MENDING,1)
|
||||||
.flag(ItemFlag.HIDE_ENCHANTS)
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
.build();
|
.build();
|
||||||
|
|||||||
@@ -74,4 +74,13 @@ public class Gems {
|
|||||||
ASTRA_GEM,
|
ASTRA_GEM,
|
||||||
Upgrades.ASTRA_GEM_UPGRADE.get()
|
Upgrades.ASTRA_GEM_UPGRADE.get()
|
||||||
);
|
);
|
||||||
|
public static List<GemData> starts = Arrays.asList(
|
||||||
|
FIRE_GEM,
|
||||||
|
LIFE_GEM,
|
||||||
|
PUFF_GEM,
|
||||||
|
SPEED_GEM,
|
||||||
|
WEALTH_GEM,
|
||||||
|
STRENGTH_GEM,
|
||||||
|
ASTRA_GEM
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ public class Upgrades {
|
|||||||
Fireball shoot = eye.getWorld().spawn(eye,Fireball.class,(fireball)->{
|
Fireball shoot = eye.getWorld().spawn(eye,Fireball.class,(fireball)->{
|
||||||
});
|
});
|
||||||
shoot.setVelocity(eye.getDirection().multiply(0.5));
|
shoot.setVelocity(eye.getDirection().multiply(0.5));
|
||||||
shoot.setIsIncendiary(true);
|
shoot.setIsIncendiary(false);
|
||||||
shoot.setYield(5);
|
shoot.setYield(4);
|
||||||
|
shoot.getScoreboardTags().add("fire-fireball");
|
||||||
})
|
})
|
||||||
.setCooldown(1200)
|
.setCooldown(400)
|
||||||
.setDowngrade(Gems.FIRE_GEM)
|
.setDowngrade(Gems.FIRE_GEM)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -43,18 +44,24 @@ public class Upgrades {
|
|||||||
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40);
|
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(40);
|
||||||
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,400,10));
|
p.addPotionEffect(new PotionEffect(PotionEffectType.REGENERATION,400,10));
|
||||||
List<LivingEntity> list = p.getLocation().getNearbyLivingEntities(5,5,5).stream().toList();
|
List<LivingEntity> list = p.getLocation().getNearbyLivingEntities(5,5,5).stream().toList();
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
DisplayUtils.ring(p.getLocation().add(0,i/10D,0),0.5,Color.ORANGE,1);
|
||||||
|
}
|
||||||
for (LivingEntity entity : list) {
|
for (LivingEntity entity : list) {
|
||||||
if (entity.equals(p) || !(entity instanceof Player)) continue;
|
if (entity.equals(p) || !(entity instanceof Player)) continue;
|
||||||
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(12);
|
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(12);
|
||||||
SchedulerUtils.later(400,()->{
|
SchedulerUtils.later(400,()->{
|
||||||
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
entity.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||||
});
|
});
|
||||||
|
for (int i = 0; i < 20; i++) {
|
||||||
|
DisplayUtils.ring(entity.getLocation().add(0,i/10D,0),0.5,Color.RED,1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
SchedulerUtils.later(400,()->{
|
SchedulerUtils.later(400,()->{
|
||||||
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
p.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(20);
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.setCooldown(1200)
|
.setCooldown(400)
|
||||||
.setDowngrade(Gems.LIFE_GEM)
|
.setDowngrade(Gems.LIFE_GEM)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -74,7 +81,7 @@ public class Upgrades {
|
|||||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING,400,2));
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING,400,2));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setCooldown(1200)
|
.setCooldown(400)
|
||||||
.setDowngrade(Gems.PUFF_GEM)
|
.setDowngrade(Gems.PUFF_GEM)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -97,6 +104,7 @@ public class Upgrades {
|
|||||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,3));
|
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,100,3));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.setCooldown(400)
|
||||||
.setDowngrade(Gems.SPEED_GEM)
|
.setDowngrade(Gems.SPEED_GEM)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -115,7 +123,7 @@ public class Upgrades {
|
|||||||
p.getLocation().getWorld().spawn(p.getLocation(), Villager.class);
|
p.getLocation().getWorld().spawn(p.getLocation(), Villager.class);
|
||||||
})
|
})
|
||||||
.setDowngrade(Gems.WEALTH_GEM)
|
.setDowngrade(Gems.WEALTH_GEM)
|
||||||
.setCooldown(1200)
|
.setCooldown(400)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Supplier<GemData> STRENGTH_GEM_UPGRADE = () -> GemData.create(1501)
|
public static final Supplier<GemData> STRENGTH_GEM_UPGRADE = () -> GemData.create(1501)
|
||||||
@@ -137,7 +145,7 @@ public class Upgrades {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setDowngrade(Gems.STRENGTH_GEM)
|
.setDowngrade(Gems.STRENGTH_GEM)
|
||||||
.setCooldown(1200)
|
.setCooldown(400)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
public static final Supplier<GemData> ASTRA_GEM_UPGRADE = () -> GemData.create(1601)
|
public static final Supplier<GemData> ASTRA_GEM_UPGRADE = () -> GemData.create(1601)
|
||||||
@@ -155,6 +163,6 @@ public class Upgrades {
|
|||||||
GemUses.shootAstraTrident(p,10);
|
GemUses.shootAstraTrident(p,10);
|
||||||
})
|
})
|
||||||
.setDowngrade(Gems.ASTRA_GEM)
|
.setDowngrade(Gems.ASTRA_GEM)
|
||||||
.setCooldown(1200)
|
.setCooldown(400)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,13 +28,8 @@ public class DeathListener implements CustomListener {
|
|||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onRespawn(PlayerRespawnEvent e) {
|
private void onRespawn(PlayerRespawnEvent e) {
|
||||||
SchedulerUtils.later(500,()->{
|
SchedulerUtils.later(40,()->{
|
||||||
GemData downgrade = GemUtils.hasGem(e.getPlayer()).downgrade();
|
GemUtils.downgradeGem(e.getPlayer());
|
||||||
if (downgrade == null) {
|
|
||||||
Bukkit.broadcast(Component.text("Your gem could not be downgraded!"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
e.getPlayer().getInventory().setItemInOffHand(downgrade.item());
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,19 +4,93 @@ import io.github.itzispyder.pdk.events.CustomListener;
|
|||||||
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import io.papermc.paper.event.player.PlayerItemFrameChangeEvent;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
import org.bukkit.event.inventory.InventoryType;
|
||||||
|
import org.bukkit.event.player.PlayerItemConsumeEvent;
|
||||||
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import static io.github.thetrouper.sssbliss.data.Gems.GemItems.gems;
|
import static io.github.thetrouper.sssbliss.data.Gems.GemItems.gems;
|
||||||
|
|
||||||
public class GemMoveListener implements CustomListener {
|
public class GemMoveListener implements CustomListener {
|
||||||
|
@EventHandler
|
||||||
|
private void onItemFrame(PlayerItemFrameChangeEvent e) {
|
||||||
|
if (!GemUtils.isGem(e.getItemStack())) return;
|
||||||
|
if (e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) return;
|
||||||
|
e.setCancelled(true);
|
||||||
|
e.setItemStack(ItemBuilder.create()
|
||||||
|
.material(Material.TROPICAL_FISH)
|
||||||
|
.name(color("&6You are a clown!"))
|
||||||
|
.build());
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
private void onEat(PlayerItemConsumeEvent e) {
|
||||||
|
if (!GemUtils.isGem(e.getItem())) return;
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* @EventHandler
|
||||||
|
public void onSwapItems(PlayerSwapHandItemsEvent e) {
|
||||||
|
if (e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) return;
|
||||||
|
e.setCancelled(true);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
|
if (e.getClickedInventory() != null && e.getClickedInventory().getType() != InventoryType.PLAYER) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player p = (Player) e.getWhoClicked();
|
||||||
|
|
||||||
|
if (p.getGameMode() != GameMode.CREATIVE) {
|
||||||
|
p.sendMessage(color("&c&l--= START OF AN EVENT =--") );
|
||||||
|
p.sendMessage("SLOT: " + e.getSlot());
|
||||||
|
|
||||||
|
if (e.getClickedInventory().getItem(e.getSlot()) != null && e.getClickedInventory().getItem(e.getSlot()).isSimilar(p.getInventory().getItemInOffHand())) {
|
||||||
|
p.sendMessage("SLOT 2: " + e.getSlot());
|
||||||
|
e.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.sendMessage("OFF: " + p.getInventory().getItemInOffHand());
|
||||||
|
p.sendMessage(color("&6&l--= BEFORE TOOL CHECK 1 =--"));
|
||||||
|
|
||||||
|
if (p.getInventory().getItemInOffHand().getType() != Material.AIR) {
|
||||||
|
p.sendMessage("ITEM: " + e.getCurrentItem());
|
||||||
|
ItemStack offhandItem = p.getInventory().getItemInOffHand();
|
||||||
|
p.sendMessage("OFFHAND VAR: " + offhandItem);
|
||||||
|
ItemStack currentItem = e.getCurrentItem();
|
||||||
|
p.sendMessage("ITEM VAR: " + currentItem);
|
||||||
|
|
||||||
|
SchedulerUtils.later(1, () -> {
|
||||||
|
p.sendMessage("OFF 2: " + p.getInventory().getItemInOffHand());
|
||||||
|
p.sendMessage(color("&6&l--= BEFORE TOOL CHECK 2 =--"));
|
||||||
|
|
||||||
|
if (!p.getInventory().getItemInOffHand().equals(offhandItem)) {
|
||||||
|
p.sendMessage("SLOT 2: " + e.getSlot());
|
||||||
|
p.sendMessage("ITEM VAR 2: " + currentItem);
|
||||||
|
e.setCurrentItem(currentItem);
|
||||||
|
p.getInventory().setItemInOffHand(offhandItem);
|
||||||
|
p.sendMessage("SLOT 3: " + e.getSlot());
|
||||||
|
p.sendMessage("OFFHAND VAR 2: " + p.getInventory().getItemInOffHand());
|
||||||
|
p.sendMessage("OFF 3: " + p.getInventory().getItemInOffHand());
|
||||||
|
p.sendMessage(color("&c&l--= END OF EVENT =--"));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/*@EventHandler
|
||||||
public void onInventoryClick(InventoryClickEvent e) {
|
public void onInventoryClick(InventoryClickEvent e) {
|
||||||
Player p = (Player) e.getWhoClicked();
|
Player p = (Player) e.getWhoClicked();
|
||||||
ItemStack offhand = p.getInventory().getItemInOffHand();
|
ItemStack offhand = p.getInventory().getItemInOffHand();
|
||||||
@@ -59,5 +133,4 @@ public class GemMoveListener implements CustomListener {
|
|||||||
public void onSwap(PlayerSwapHandItemsEvent e) {
|
public void onSwap(PlayerSwapHandItemsEvent e) {
|
||||||
if (e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) return;
|
if (e.getPlayer().getGameMode().equals(GameMode.CREATIVE)) return;
|
||||||
e.setCancelled(true);
|
e.setCancelled(true);
|
||||||
}
|
}*/
|
||||||
}
|
|
||||||
@@ -6,12 +6,16 @@ import io.github.itzispyder.pdk.utils.misc.Cooldown;
|
|||||||
import io.github.itzispyder.pdk.utils.misc.Pair;
|
import io.github.itzispyder.pdk.utils.misc.Pair;
|
||||||
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.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.server.crafting.UpgradeItem;
|
||||||
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -21,52 +25,27 @@ public class GemUseListener implements CustomListener {
|
|||||||
|
|
||||||
Cooldown<Map<UUID,Integer>> gemCooldown = new Cooldown<>();
|
Cooldown<Map<UUID,Integer>> gemCooldown = new Cooldown<>();
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
private void onGemUse(PlayerInteractEvent e) {
|
private void onGemUse(PlayerSwapHandItemsEvent e) {
|
||||||
if (!e.getAction().isRightClick()) return;
|
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
UUID u = e.getPlayer().getUniqueId();
|
UUID u = e.getPlayer().getUniqueId();
|
||||||
GemData gem = GemUtils.hasGem(e.getPlayer());
|
GemData gem = GemUtils.hasGem(e.getPlayer());
|
||||||
|
if (p.getInventory().getItemInMainHand().isSimilar(UpgradeItem.UPGRADE_ITEM)) return;
|
||||||
p.sendMessage(Component.text(u.toString()));
|
|
||||||
if (gem == null) return;
|
if (gem == null) return;
|
||||||
p.sendMessage(Component.text(gem.dataID()));
|
if (!p.getInventory().getItemInMainHand().equals(gem.item()) && !p.getInventory().getItemInOffHand().equals(gem.item())) return;
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
Map<UUID,Integer> gemCool = new HashMap<>();
|
Map<UUID,Integer> gemCool = new HashMap<>();
|
||||||
gemCool.put(u,gem.dataID());
|
gemCool.put(u,gem.dataID());
|
||||||
/*p.sendMessage(Component.text(new GemEntry(u,gem.dataID()).equals(new GemEntry(u,gem.dataID()))));
|
if (gemCooldown.isOnCooldown(gemCool)) {
|
||||||
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(
|
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)
|
(gemCooldown.getCooldown(gemCool))/1000L)
|
||||||
)));
|
)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//gemCooldown.addCooldown(geme,gem.cooldown() * 50L);
|
|
||||||
gemCooldown.setCooldown(gemCool, gem.cooldown() * 50L);
|
gemCooldown.setCooldown(gemCool, gem.cooldown() * 50L);
|
||||||
try {
|
try {
|
||||||
gem.onRightClick().accept(e.getPlayer());
|
gem.onRightClick().accept(e.getPlayer());
|
||||||
} catch (Exception ignored) {}
|
} 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,20 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Randomizer;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
|
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
|
|
||||||
|
public class JoinListener implements CustomListener {
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onJoin(PlayerJoinEvent e) {
|
||||||
|
if (e.getPlayer().getScoreboardTags().contains("joined")) return;
|
||||||
|
e.getPlayer().getScoreboardTags().add("joined");
|
||||||
|
|
||||||
|
GemUtils.randomGem(e.getPlayer());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package io.github.thetrouper.sssbliss.events;
|
|||||||
|
|
||||||
import io.github.itzispyder.pdk.events.CustomListener;
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Fireball;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
@@ -19,7 +20,28 @@ public class ProjectileHitListener implements CustomListener {
|
|||||||
private void onAstraTridentHit(ProjectileHitEvent e) {
|
private void onAstraTridentHit(ProjectileHitEvent e) {
|
||||||
if (e.getHitEntity() != null && e.getEntity() instanceof Trident t && t.getScoreboardTags().contains("astra-trident")) {
|
if (e.getHitEntity() != null && e.getEntity() instanceof Trident t && t.getScoreboardTags().contains("astra-trident")) {
|
||||||
if (!(e.getHitEntity() instanceof LivingEntity victim)) return;
|
if (!(e.getHitEntity() instanceof LivingEntity victim)) return;
|
||||||
victim.damage(2,(Entity) e.getEntity().getShooter());
|
victim.damage(10,(Entity) e.getEntity().getShooter());
|
||||||
|
//victim.setHealth(victim.getHealth() - 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onFireballLand(ProjectileHitEvent e) {
|
||||||
|
if (e.getHitBlock() != null && e.getEntity() instanceof Fireball f && f.getScoreboardTags().contains("fire-fireball")) {
|
||||||
|
// e.setCancelled(true);
|
||||||
|
//e.getHitBlock().getWorld().createExplosion(e.getHitBlock().getLocation(),4,false,false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onFireballHit(ProjectileHitEvent e) {
|
||||||
|
if (e.getHitEntity() != null && e.getEntity() instanceof Fireball f && f.getScoreboardTags().contains("fire-fireball")) {
|
||||||
|
if (!(e.getHitEntity() instanceof LivingEntity victim)) return;
|
||||||
|
// e.setCancelled(true);
|
||||||
|
//victim.getWorld().createExplosion(victim.getLocation(),4,false,false);
|
||||||
|
victim.setHealth(victim.getHealth() - 10);
|
||||||
|
victim.damage(1,(Entity) e.getEntity().getShooter());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Cooldown;
|
||||||
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
|
import io.github.thetrouper.sssbliss.server.crafting.TradeItem;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.PlayerUtils;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Firework;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
|
|
||||||
|
public class TradeListener implements CustomListener {
|
||||||
|
|
||||||
|
Cooldown<Player> tradeCooldown = new Cooldown<>();
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
private void onTrade(PlayerInteractEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
|
||||||
|
if (!e.getAction().isRightClick()) return;
|
||||||
|
if (e.getItem() == null) return;
|
||||||
|
if (!p.getInventory().getItemInMainHand().isSimilar(TradeItem.TRADE_ITEM)) return;
|
||||||
|
|
||||||
|
if (tradeCooldown.isOnCooldown(p)) {
|
||||||
|
e.getPlayer().sendMessage(Component.text(color(SSSBliss.mainConfig.plugin.prefix + "&cYour on cooldown! &7You can use it again in &e%s&7 seconds!".formatted(
|
||||||
|
(tradeCooldown.getCooldown(p))/1000L)
|
||||||
|
)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
tradeCooldown.setCooldown(p, 5000);
|
||||||
|
|
||||||
|
PlayerUtils.subtractItems(p,TradeItem.TRADE_ITEM,1);
|
||||||
|
|
||||||
|
GemUtils.randomGem(p);
|
||||||
|
p.sendMessage(Component.text(SSSBliss.mainConfig.plugin.prefix + "You have traded your gem!"));
|
||||||
|
|
||||||
|
SoundPlayer swap = new SoundPlayer(p.getLocation(), Sound.BLOCK_BEACON_POWER_SELECT, 10,2F);
|
||||||
|
swap.playWithin(3);
|
||||||
|
|
||||||
|
Firework f = p.getWorld().spawn(p.getLocation(), Firework.class);
|
||||||
|
|
||||||
|
// Configure the Firework's meta
|
||||||
|
FireworkMeta fm = f.getFireworkMeta();
|
||||||
|
fm.addEffect(
|
||||||
|
FireworkEffect.builder()
|
||||||
|
.withColor(Color.RED)
|
||||||
|
.withColor(Color.WHITE)
|
||||||
|
.withColor(Color.ORANGE)
|
||||||
|
.with(FireworkEffect.Type.BURST)
|
||||||
|
.withTrail()
|
||||||
|
.withFlicker()
|
||||||
|
.build());
|
||||||
|
fm.setPower(1);
|
||||||
|
|
||||||
|
f.setFireworkMeta(fm);
|
||||||
|
SchedulerUtils.later(1,f::detonate);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,213 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.CustomItems;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.heal.InstantHeal;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.heal.MakeInvulnerable;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.kill.Lazer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.kill.OrbitalStrike;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.kill.ShootFireball;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.kill.Smite;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.stun.Drag;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.stun.Drain;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.stun.Launch;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.utility.stun.Stun;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import io.papermc.paper.event.entity.EntityMoveEvent;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
|
import org.bukkit.event.player.*;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class TrollListener implements CustomListener {
|
||||||
|
Drag drag = new Drag();
|
||||||
|
Stun stun = new Stun();
|
||||||
|
Launch launch = new Launch();
|
||||||
|
Drain drain = new Drain();
|
||||||
|
Smite smite = new Smite();
|
||||||
|
Lazer lazer = new Lazer();
|
||||||
|
OrbitalStrike orbitalStrike = new OrbitalStrike();
|
||||||
|
ShootFireball fireball = new ShootFireball();
|
||||||
|
InstantHeal heal = new InstantHeal();
|
||||||
|
MakeInvulnerable invul = new MakeInvulnerable();
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onHit(EntityDamageByEntityEvent e) {
|
||||||
|
if (e.getDamager() instanceof Player p) {
|
||||||
|
ItemStack i = p.getInventory().getItemInMainHand();
|
||||||
|
if (!p.isOp()) return;
|
||||||
|
if (i == null) return;
|
||||||
|
if (!i.isSimilar(CustomItems.ADMIN_UTILITY)) return;
|
||||||
|
|
||||||
|
stun.handleStun(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onSwap(PlayerSwapHandItemsEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
ItemStack m = p.getInventory().getItemInMainHand();
|
||||||
|
ItemStack o = p.getInventory().getItemInOffHand();
|
||||||
|
if (!p.isOp()) return;
|
||||||
|
|
||||||
|
SoundPlayer swap = new SoundPlayer(p.getLocation(), Sound.BLOCK_BEACON_POWER_SELECT,0.5F,2F);
|
||||||
|
|
||||||
|
if (m.isSimilar(CustomItems.ADMIN_UTILITY)) {
|
||||||
|
swap.playWithin(3);
|
||||||
|
e.setCancelled(true);
|
||||||
|
// If the main hand has item A, set offhand to air and main hand to item B
|
||||||
|
p.getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||||
|
p.getInventory().setItemInMainHand(new ItemStack(CustomItems.ADMIN_UTILITY_LETHAL));
|
||||||
|
p.sendMessage(Text.prefix("Set Phaser to kill"));
|
||||||
|
} else if (o.isSimilar(CustomItems.ADMIN_UTILITY)) {
|
||||||
|
swap.playWithin(3);
|
||||||
|
e.setCancelled(true);
|
||||||
|
// If the offhand has item A, set main hand to air and offhand to item B
|
||||||
|
p.getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||||
|
p.getInventory().setItemInMainHand(new ItemStack(CustomItems.ADMIN_UTILITY_LETHAL));
|
||||||
|
p.sendMessage(Text.prefix("Set Phaser to kill"));
|
||||||
|
} else if (m.isSimilar(CustomItems.ADMIN_UTILITY_LETHAL)) {
|
||||||
|
swap.playWithin(3);
|
||||||
|
e.setCancelled(true);
|
||||||
|
// If the main hand has item B, set offhand to air and main hand to item C
|
||||||
|
p.getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||||
|
p.getInventory().setItemInMainHand(new ItemStack(CustomItems.ADMIN_UTILITY_HEAL));
|
||||||
|
p.sendMessage(Text.prefix("Set Phaser to heal"));
|
||||||
|
} else if (o.isSimilar(CustomItems.ADMIN_UTILITY_LETHAL)) {
|
||||||
|
swap.playWithin(3);
|
||||||
|
e.setCancelled(true);
|
||||||
|
// If the offhand has item B, set main hand to air and offhand to item C
|
||||||
|
p.getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||||
|
p.getInventory().setItemInMainHand(new ItemStack(CustomItems.ADMIN_UTILITY_HEAL));
|
||||||
|
p.sendMessage(Text.prefix("Set Phaser to heal"));
|
||||||
|
} else if (m.isSimilar(CustomItems.ADMIN_UTILITY_HEAL)) {
|
||||||
|
swap.playWithin(3);
|
||||||
|
e.setCancelled(true);
|
||||||
|
// If the main hand has item C, set offhand to air and main hand to item A
|
||||||
|
p.getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||||
|
p.getInventory().setItemInMainHand(new ItemStack(CustomItems.ADMIN_UTILITY));
|
||||||
|
p.sendMessage(Text.prefix("Set Phaser to stun"));
|
||||||
|
} else if (o.isSimilar(CustomItems.ADMIN_UTILITY_HEAL)) {
|
||||||
|
swap.playWithin(3);
|
||||||
|
e.setCancelled(true);
|
||||||
|
// If the offhand has item C, set main hand to air and offhand to item A
|
||||||
|
p.getInventory().setItemInOffHand(new ItemStack(Material.AIR));
|
||||||
|
p.getInventory().setItemInMainHand(new ItemStack(CustomItems.ADMIN_UTILITY));
|
||||||
|
p.sendMessage(Text.prefix("Set Phaser to stun"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onClickHeal(PlayerInteractEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
ItemStack i = e.getItem();
|
||||||
|
Action a = e.getAction();
|
||||||
|
if (!p.isOp()) return;
|
||||||
|
if (i == null) return;
|
||||||
|
if (!i.isSimilar(CustomItems.ADMIN_UTILITY_HEAL)) return;
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
switch (a) {
|
||||||
|
case RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK -> {
|
||||||
|
if (!p.isSneaking()) {
|
||||||
|
heal.handleInstantHeal(p);
|
||||||
|
} else if (p.isSneaking()) {
|
||||||
|
invul.handleInvulnerable(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case LEFT_CLICK_AIR, LEFT_CLICK_BLOCK -> {
|
||||||
|
if (!p.isSneaking()) {
|
||||||
|
//fireball.handleFireball(p);
|
||||||
|
} else if (p.isSneaking()) {
|
||||||
|
//orbitalStrike.handleOrbitalStrike(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onClickKill(PlayerInteractEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
ItemStack i = e.getItem();
|
||||||
|
Action a = e.getAction();
|
||||||
|
if (!p.isOp()) return;
|
||||||
|
if (i == null) return;
|
||||||
|
if (!i.isSimilar(CustomItems.ADMIN_UTILITY_LETHAL)) return;
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
switch (a) {
|
||||||
|
case RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK -> {
|
||||||
|
if (!p.isSneaking()) {
|
||||||
|
lazer.handleLazer(p);
|
||||||
|
} else if (p.isSneaking()) {
|
||||||
|
smite.handleSmite(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case LEFT_CLICK_AIR, LEFT_CLICK_BLOCK -> {
|
||||||
|
if (!p.isSneaking()) {
|
||||||
|
fireball.handleFireball(p);
|
||||||
|
} else if (p.isSneaking()) {
|
||||||
|
orbitalStrike.handleOrbitalStrike(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onClickStun(PlayerInteractEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
ItemStack i = e.getItem();
|
||||||
|
Action a = e.getAction();
|
||||||
|
if (!p.isOp()) return;
|
||||||
|
if (i == null) return;
|
||||||
|
if (!i.isSimilar(CustomItems.ADMIN_UTILITY)) return;
|
||||||
|
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
switch (a) {
|
||||||
|
case RIGHT_CLICK_AIR, RIGHT_CLICK_BLOCK -> {
|
||||||
|
if (!p.isSneaking()) {
|
||||||
|
drag.handleDragPlayer(p);
|
||||||
|
} else if (p.isSneaking()) {
|
||||||
|
launch.handleLaunchPlayer(p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case LEFT_CLICK_AIR, LEFT_CLICK_BLOCK -> {
|
||||||
|
if (!p.isSneaking()) {
|
||||||
|
stun.handleStun(p);
|
||||||
|
} else if (p.isSneaking()) {
|
||||||
|
drain.handleDrain(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onMove(PlayerMoveEvent e) {
|
||||||
|
drag.handleMove(e);
|
||||||
|
}
|
||||||
|
@EventHandler
|
||||||
|
public void onEntity(EntityMoveEvent e) {
|
||||||
|
drag.handleEntityMove(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void onScroll(PlayerItemHeldEvent e) {
|
||||||
|
if (!e.getPlayer().isOp()) return;
|
||||||
|
drag.handleScroll(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,20 +1,71 @@
|
|||||||
package io.github.thetrouper.sssbliss.events;
|
package io.github.thetrouper.sssbliss.events;
|
||||||
|
|
||||||
import io.github.itzispyder.pdk.events.CustomListener;
|
import io.github.itzispyder.pdk.events.CustomListener;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Cooldown;
|
||||||
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
import io.github.thetrouper.sssbliss.server.crafting.UpgradeItem;
|
import io.github.thetrouper.sssbliss.server.crafting.UpgradeItem;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
import io.github.thetrouper.sssbliss.server.util.GemUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.PlayerUtils;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Color;
|
||||||
|
import org.bukkit.FireworkEffect;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.entity.Firework;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.inventory.meta.FireworkMeta;
|
||||||
|
|
||||||
public class UpgradeListener implements CustomListener {
|
public class UpgradeListener implements CustomListener {
|
||||||
|
|
||||||
@EventHandler
|
Cooldown<Player> upgradeCooldown = new Cooldown<>();
|
||||||
private void onUpgrade(PlayerInteractEvent e) {
|
|
||||||
if (!e.getAction().isRightClick() || !e.getItem().isSimilar(UpgradeItem.UPGRADE_ITEM)) return;
|
|
||||||
if (GemUtils.hasGem(e.getPlayer()).upgrade() == null) return;
|
|
||||||
Player p = e.getPlayer();
|
|
||||||
p.getInventory().removeItem(UpgradeItem.UPGRADE_ITEM);
|
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
private void onUpgrade(PlayerInteractEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
GemData has = GemUtils.hasGem(p);
|
||||||
|
|
||||||
|
if (!e.getAction().isRightClick()) return;
|
||||||
|
if (e.getItem() == null) return;
|
||||||
|
if (!p.getInventory().getItemInMainHand().isSimilar(UpgradeItem.UPGRADE_ITEM)) return;
|
||||||
|
if (has == null) return;
|
||||||
|
if (has.upgrade() == null) return;
|
||||||
|
|
||||||
|
if (upgradeCooldown.isOnCooldown(p)) {
|
||||||
|
e.getPlayer().sendMessage(Component.text(color(SSSBliss.mainConfig.plugin.prefix + "&cYour on cooldown! &7You can use it again in &e%s&7 seconds!".formatted(
|
||||||
|
(upgradeCooldown.getCooldown(p))/1000L)
|
||||||
|
)));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
upgradeCooldown.setCooldown(p, 5000);
|
||||||
|
|
||||||
|
PlayerUtils.subtractItems(p,UpgradeItem.UPGRADE_ITEM,1);
|
||||||
|
GemUtils.upgradeGem(p);
|
||||||
|
//p.sendMessage(Component.text(SSSBliss.mainConfig.plugin.prefix + "You have upgraded your gem!"));
|
||||||
|
|
||||||
|
SoundPlayer upgrade = new SoundPlayer(p.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 10,0.6F);
|
||||||
|
upgrade.playWithin(3);
|
||||||
|
|
||||||
|
Firework f = p.getWorld().spawn(p.getLocation(), Firework.class);
|
||||||
|
|
||||||
|
// Configure the Firework's meta
|
||||||
|
FireworkMeta fm = f.getFireworkMeta();
|
||||||
|
fm.addEffect(
|
||||||
|
FireworkEffect.builder()
|
||||||
|
.withColor(Color.BLUE)
|
||||||
|
.withColor(Color.AQUA)
|
||||||
|
.withColor(Color.TEAL)
|
||||||
|
.with(FireworkEffect.Type.BURST)
|
||||||
|
.withTrail()
|
||||||
|
.withFlicker()
|
||||||
|
.build());
|
||||||
|
fm.setPower(1);
|
||||||
|
|
||||||
|
f.setFireworkMeta(fm);
|
||||||
|
SchedulerUtils.later(1,f::detonate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.crafting;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.NamespacedKey;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.ShapedRecipe;
|
||||||
|
|
||||||
|
public class TradeItem {
|
||||||
|
|
||||||
|
public static final ItemStack TRADE_ITEM = ItemBuilder.create()
|
||||||
|
.material(Material.NAME_TAG)
|
||||||
|
.name(Global.instance.color("&eGem Trader"))
|
||||||
|
.lore(Global.instance.color("&7Right click to randomize your gem!"))
|
||||||
|
.enchant(Enchantment.LURE,1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static void addTradeRecipe() {
|
||||||
|
// Create a NamespacedKey for your recipe (replace "your_plugin_name" with your actual plugin name)
|
||||||
|
NamespacedKey key = new NamespacedKey(SSSBliss.getInstance(), "gem_trade_recipe");
|
||||||
|
|
||||||
|
// Create the recipe
|
||||||
|
ShapedRecipe recipe = new ShapedRecipe(key, TRADE_ITEM);
|
||||||
|
recipe.shape("ABC", "DEF", "GHI"); // Define the crafting grid
|
||||||
|
|
||||||
|
// Define the ingredients
|
||||||
|
recipe.setIngredient('A', Material.NETHERITE_INGOT);
|
||||||
|
recipe.setIngredient('B', Material.DIAMOND_BLOCK);
|
||||||
|
recipe.setIngredient('C', Material.NETHERITE_INGOT);
|
||||||
|
|
||||||
|
recipe.setIngredient('D', Material.DIAMOND_BLOCK);
|
||||||
|
recipe.setIngredient('E', Material.NETHER_STAR);
|
||||||
|
recipe.setIngredient('F', Material.DIAMOND_BLOCK);
|
||||||
|
|
||||||
|
recipe.setIngredient('G', Material.NETHERITE_INGOT);
|
||||||
|
recipe.setIngredient('H', Material.DIAMOND_BLOCK);
|
||||||
|
recipe.setIngredient('I', Material.NETHERITE_INGOT);
|
||||||
|
// Repeat for other letters in the grid
|
||||||
|
|
||||||
|
// Add the recipe to the server
|
||||||
|
SSSBliss.getInstance().getServer().addRecipe(recipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -21,7 +21,7 @@ public class UpgradeItem {
|
|||||||
.build();
|
.build();
|
||||||
public static void addUpgradeRecipe() {
|
public static void addUpgradeRecipe() {
|
||||||
// Create a NamespacedKey for your recipe (replace "your_plugin_name" with your actual plugin name)
|
// Create a NamespacedKey for your recipe (replace "your_plugin_name" with your actual plugin name)
|
||||||
NamespacedKey key = new NamespacedKey(SSSBliss.getInstance(), "custom_crafting_recipe");
|
NamespacedKey key = new NamespacedKey(SSSBliss.getInstance(), "gem_upgrade_recipe");
|
||||||
|
|
||||||
// Create the recipe
|
// Create the recipe
|
||||||
ShapedRecipe recipe = new ShapedRecipe(key, UPGRADE_ITEM);
|
ShapedRecipe recipe = new ShapedRecipe(key, UPGRADE_ITEM);
|
||||||
|
|||||||
@@ -0,0 +1,204 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.plugin.builders.ItemBuilder;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.enchantments.Enchantment;
|
||||||
|
import org.bukkit.inventory.ItemFactory;
|
||||||
|
import org.bukkit.inventory.ItemFlag;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
public class CustomItems {
|
||||||
|
public static ItemStack ADMIN_UTILITY = ItemBuilder.create()
|
||||||
|
.material(Material.BLAZE_ROD)
|
||||||
|
.name(Global.instance.color("&4-&c&l[&b&nAdministrative&r &3&nUtility&c&l]&4-"))
|
||||||
|
.lore(Global.instance.color("&b▪ &3Right-Click:&7 Drag"))
|
||||||
|
.lore(Global.instance.color("&b▪ &3Sneak Right-Click:&7 Launch"))
|
||||||
|
.lore(Global.instance.color("&b▪ &3Left-Click:&7 Stun"))
|
||||||
|
.lore(Global.instance.color("&b▪ &3Sneak Left-Click:&7 Drain"))
|
||||||
|
.lore(Global.instance.color("&b▪ &3Swap Hands:&7 Switch Phaser"))
|
||||||
|
.lore(Global.instance.color(" &7from stun to kill"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Right-Click:&7 Zap Player"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Left-Click:&7 Fire Beam"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Left-Click:&7 Ring of Fire"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Swap-Hands:&7 Fireball"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Swap-Hands:&7 Orbital Strike"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static ItemStack ADMIN_UTILITY_LETHAL = ItemBuilder.create()
|
||||||
|
.material(Material.BLAZE_ROD)
|
||||||
|
.name(Global.instance.color("&3-&b&l[&c&nAdministrative&r &4&nUtility&b&l]&3-"))
|
||||||
|
.lore(Global.instance.color("&c▪ &4Right-Click:&7 Death Ray"))
|
||||||
|
.lore(Global.instance.color("&c▪ &4Sneak Right-Click:&7 Smite"))
|
||||||
|
.lore(Global.instance.color("&c▪ &4Left-Click:&7 Fireball"))
|
||||||
|
.lore(Global.instance.color("&c▪ &4Sneak Left-Click:&7 Orbital Strike"))
|
||||||
|
.lore(Global.instance.color("&c▪ &4Swap Hands:&7 Switch Phaser"))
|
||||||
|
.lore(Global.instance.color(" &7from kill to heal"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Right-Click:&7 Zap Player"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Left-Click:&7 Fire Beam"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Left-Click:&7 Ring of Fire"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Swap-Hands:&7 Fireball"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Swap-Hands:&7 Orbital Strike"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack ADMIN_UTILITY_HEAL = ItemBuilder.create()
|
||||||
|
.material(Material.BLAZE_ROD)
|
||||||
|
.name(Global.instance.color("&3-&b&l[&a&nAdministrative&r &2&nUtility&b&l]&3-"))
|
||||||
|
.lore(Global.instance.color("&a▪ &2Right-Click:&7 Heal"))
|
||||||
|
.lore(Global.instance.color("&a▪ &2Sneak Right-Click:&7 Invulnerability"))
|
||||||
|
.lore(Global.instance.color("&a▪ &2Left-Click:&7 Regen Zone"))
|
||||||
|
.lore(Global.instance.color("&a▪ &2Sneak Left-Click:&7 Force Field"))
|
||||||
|
.lore(Global.instance.color("&a▪ &2Swap Hands:&7 Switch Phaser"))
|
||||||
|
.lore(Global.instance.color(" &7from heal to stun"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Right-Click:&7 Zap Player"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Left-Click:&7 Fire Beam"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Left-Click:&7 Ring of Fire"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Swap-Hands:&7 Fireball"))
|
||||||
|
//.lore(Global.instance.color("&b▪ &3Sneak Swap-Hands:&7 Orbital Strike"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public abstract class ItemPresets {
|
||||||
|
|
||||||
|
private static final ItemFactory factory = Bukkit.getItemFactory();
|
||||||
|
|
||||||
|
public static ItemStack SNAD = factory.createItemStack("sand{display:{Name:'{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Snad\"}],\"text\":\"\"}'}}");
|
||||||
|
|
||||||
|
public static ItemStack SNAD_COOKIE = factory.createItemStack("cookie{CustomModelData:1111,display:{Lore:['{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"gray\",\"text\":\"mmMmmM Extra Crunchy!\"}],\"text\":\"\"}'],Name:'{\"extra\":[{\"bold\":false,\"italic\":false,\"underlined\":false,\"strikethrough\":false,\"obfuscated\":false,\"color\":\"white\",\"text\":\"Snad Cookie\"}],\"text\":\"\"}'}}");
|
||||||
|
|
||||||
|
|
||||||
|
public static ItemStack NETSKY_BLADE = ItemBuilder.create()
|
||||||
|
.material(Material.NETHERITE_SWORD)
|
||||||
|
.name(Text.color("&7//&d&l&oNET&5&l&oSKY&7//"))
|
||||||
|
.lore(Text.color("&7- &dLeft: &5Fire Spell"))
|
||||||
|
.lore(Text.color("&7- &dRight: &5Fireball"))
|
||||||
|
.enchant(Enchantment.FIRE_ASPECT, 1)
|
||||||
|
.build();
|
||||||
|
public static ItemStack ADMIN_UTILITY = ItemBuilder.create()
|
||||||
|
.material(Material.BLAZE_ROD)
|
||||||
|
.name(Text.color("&4-&c&l[&b&nAdministrative &3&nUtility&c&l]&4-"))
|
||||||
|
.lore(Text.color("&b▪ &3Right-Click:&7 Drag Player"))
|
||||||
|
.lore(Text.color("&b▪ &3Sneak Right-Click:&7 Zap Player"))
|
||||||
|
.lore(Text.color("&b▪ &3Left-Click:&7 Fire Beam"))
|
||||||
|
.lore(Text.color("&b▪ &3Sneak Left-Click:&7 Ring of Fire"))
|
||||||
|
.lore(Text.color("&b▪ &3Swap-Hands:&7 Fireball"))
|
||||||
|
.lore(Text.color("&b▪ &3Sneak Swap-Hands:&7 Orbital Strike"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack VOID_CHARM = ItemBuilder.create()
|
||||||
|
.material(Material.BLACK_STAINED_GLASS)
|
||||||
|
.name(Text.color("&0&l-&8&l[&7Void Charm&8&l]&0&l-"))
|
||||||
|
.lore(Text.color("&7▪ &4Right-Click:&7 Take Entity"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack DEFENDER = ItemBuilder.create()
|
||||||
|
.material(Material.PRISMARINE_SHARD)
|
||||||
|
.name(Text.color("&1&l-&9&l[&bDefender&9&l]&1&l-"))
|
||||||
|
.lore(Text.color("&1▪ &9Right-Click:&7 Stun"))
|
||||||
|
.lore(Text.color("&1▪ &9Left-Click:&7 Shoot"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack LASER_POINTER = ItemBuilder.create()
|
||||||
|
.material(Material.LIME_CANDLE)
|
||||||
|
.name(Text.color("&2&l-&a&l[&bLaser Pointer&a&l]&2&l-"))
|
||||||
|
.lore(Text.color("&2▪ &aRight-Click:&7 Full Beam"))
|
||||||
|
.lore(Text.color("&2▪ &aLeft-Click:&7 Select Block"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack SHIELD_GEN = ItemBuilder.create()
|
||||||
|
.material(Material.BEACON)
|
||||||
|
.name(Text.color("&5&l-&d&l[&bShield Generator&d&l]&5&l-"))
|
||||||
|
.lore(Text.color("&1▪ &9/hat:&7 Personal Shield"))
|
||||||
|
.lore(Text.color("&1▪ &9Place:&7 Stationary Shield"))
|
||||||
|
.build();
|
||||||
|
public static ItemStack SNOWCHINEGUN = ItemBuilder.create()
|
||||||
|
.material(Material.IRON_HOE)
|
||||||
|
.name(Text.color("&f&l&nSNOWCHINEGUN"))
|
||||||
|
.lore(Text.color("&b▪ &fRight-Click:&7 BRRRRTTTTT"))
|
||||||
|
.lore(Text.color("&b▪ &fLeft-Click:&7 Burst"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack AK47 = ItemBuilder.create()
|
||||||
|
.material(Material.ECHO_SHARD)
|
||||||
|
.name(Text.color("&7&lAK&8-&647"))
|
||||||
|
.lore(Text.color("&6▪ &fRight-Click:&7 Full Auto"))
|
||||||
|
.lore(Text.color("&6▪ &fLeft-Click:&7 Single Shot"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.enchant(Enchantment.VANISHING_CURSE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.build();
|
||||||
|
public static ItemStack SPLEEFER = ItemBuilder.create()
|
||||||
|
.material(Material.NETHERITE_SHOVEL)
|
||||||
|
.name(Text.color("&2&lSpleefer"))
|
||||||
|
.lore(Text.color("&7For use at /warp spleef"))
|
||||||
|
.enchant(Enchantment.DIG_SPEED, 5)
|
||||||
|
.unbreakable(true)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.flag(ItemFlag.HIDE_UNBREAKABLE)
|
||||||
|
.build();
|
||||||
|
public static ItemStack POTATOCANNON = ItemBuilder.create()
|
||||||
|
.material(Material.GOLDEN_HOE)
|
||||||
|
.name(Text.color("&6&lPotato Cannon"))
|
||||||
|
.lore(Text.color("&e▪ &fLeft-Click:&7 Launch Potatoes"))
|
||||||
|
.lore(Text.color("&e▪ &fRight-Click:&7 Load Potato (Max 6)"))
|
||||||
|
.unbreakable(true)
|
||||||
|
.enchant(Enchantment.DIG_SPEED, 5)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS)
|
||||||
|
.flag(ItemFlag.HIDE_UNBREAKABLE)
|
||||||
|
.build();
|
||||||
|
public static ItemStack SPBRifle = ItemBuilder.create()
|
||||||
|
.material(Material.IRON_HORSE_ARMOR)
|
||||||
|
.name(Text.color("&f[SPB] &eRifle"))
|
||||||
|
.lore(Text.color("&e▪ &fRight-Click:&7 Shoot"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.build();
|
||||||
|
public static ItemStack PICKLER = ItemBuilder.create()
|
||||||
|
.material(Material.SEA_PICKLE)
|
||||||
|
.name(Text.color("&2&lPickler"))
|
||||||
|
.lore(Text.color("&2▪ &aRight-Click:&7 Pickle-ify Someone"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static ItemStack TAZER = ItemBuilder.create()
|
||||||
|
.material(Material.NETHERITE_AXE)
|
||||||
|
.name(Text.color("&7{&b&lTazer&7}"))
|
||||||
|
.unbreakable(true)
|
||||||
|
.enchant(Enchantment.LURE, 1)
|
||||||
|
.flag(ItemFlag.HIDE_ENCHANTS, ItemFlag.HIDE_ATTRIBUTES, ItemFlag.HIDE_UNBREAKABLE)
|
||||||
|
.customModelData(1111)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static ItemStack LAZER = ItemBuilder.create()
|
||||||
|
.material(Material.REDSTONE_TORCH)
|
||||||
|
.name("Lazer Pointer")
|
||||||
|
.lore(Text.color("&7- A funny gadget!"))
|
||||||
|
.customModelData(1111)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
public static ItemStack BLANK = ItemBuilder.create()
|
||||||
|
.material(Material.LIGHT_GRAY_STAINED_GLASS_PANE)
|
||||||
|
.name(" ")
|
||||||
|
.build();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.heal;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.DisplayUtils;
|
||||||
|
import org.bukkit.Particle;
|
||||||
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class InstantHeal {
|
||||||
|
|
||||||
|
public void handleInstantHeal(Player p) {
|
||||||
|
Entity targetEntity = p.getTargetEntity(119);
|
||||||
|
if (!(targetEntity instanceof LivingEntity target)) return;
|
||||||
|
target.registerAttribute(Attribute.GENERIC_MAX_HEALTH);
|
||||||
|
final double max = target.getAttribute(Attribute.GENERIC_MAX_HEALTH).getBaseValue();
|
||||||
|
target.setHealth(max);
|
||||||
|
SoundPlayer heal = new SoundPlayer(target.getLocation(),Sound.ENTITY_CAT_AMBIENT,0.8F,1.3F);
|
||||||
|
heal.playWithin(50);
|
||||||
|
heal.play(p);
|
||||||
|
DisplayUtils.helix(target.getLocation(),0.6,(helix)->{
|
||||||
|
target.getWorld().spawnParticle(Particle.VILLAGER_HAPPY,helix,1,0,0,0,0);
|
||||||
|
},0.02,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.heal;
|
||||||
|
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
public class MakeInvulnerable {
|
||||||
|
|
||||||
|
public static Set<UUID> invul = new HashSet<>();
|
||||||
|
|
||||||
|
public void handleInvulnerable(Player p) {
|
||||||
|
Entity targetEntity = p.getTargetEntity(119);
|
||||||
|
|
||||||
|
if (!(targetEntity instanceof LivingEntity target)) return;
|
||||||
|
|
||||||
|
if (invul.contains(target.getUniqueId())) {
|
||||||
|
invul.remove(target.getUniqueId());
|
||||||
|
if (target instanceof Player t) {
|
||||||
|
t.sendMessage(Text.prefix("You are no longer invulnerable!"));
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
invul.add(target.getUniqueId());
|
||||||
|
|
||||||
|
if (target instanceof Player t) {
|
||||||
|
t.sendMessage(Text.prefix("You are now invulnerable!"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void updateInvul() {
|
||||||
|
for (UUID uuid : invul) {
|
||||||
|
Entity targetEntity = Bukkit.getEntity(uuid);
|
||||||
|
if (!(targetEntity instanceof LivingEntity target) || targetEntity.isDead() || (targetEntity instanceof Player p && !p.isOnline())) {
|
||||||
|
invul.remove(uuid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
PotionEffect heal = new PotionEffect(PotionEffectType.HEAL,600,5,true,false,true);
|
||||||
|
PotionEffect res = new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE,20,7,true,false,true);
|
||||||
|
PotionEffect fire = new PotionEffect(PotionEffectType.FIRE_RESISTANCE,20,0,true,false,true);
|
||||||
|
heal.apply(target);
|
||||||
|
res.apply(target);
|
||||||
|
fire.apply(target);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.kill;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.CustomItems;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
public class Lazer {
|
||||||
|
|
||||||
|
public static Map<UUID,Boolean> isLazing = new HashMap<>();
|
||||||
|
|
||||||
|
public void handleLazer(Player p) {
|
||||||
|
UUID u = p.getUniqueId();
|
||||||
|
if (!isLazing.getOrDefault(u, false)) {
|
||||||
|
isLazing.put(u, true);
|
||||||
|
p.sendMessage(Text.prefix("IM FIRIN MAH LAZOR!"));
|
||||||
|
} else if (isLazing.get(u)) {
|
||||||
|
isLazing.put(u, false);
|
||||||
|
p.sendMessage(Text.prefix("Lazer Deactivated."));
|
||||||
|
}
|
||||||
|
|
||||||
|
BooleanSupplier lazing = () -> isLazing.getOrDefault(u, false) && p.getInventory().getItemInMainHand().equals(CustomItems.ADMIN_UTILITY_LETHAL);
|
||||||
|
|
||||||
|
SchedulerUtils.whileLoop(1, lazing, (loop) -> {
|
||||||
|
Location start = p.getEyeLocation();
|
||||||
|
Vector rot = p.getLocation().getDirection().normalize();
|
||||||
|
|
||||||
|
CustomDisplayRaytracer.trace(start, rot, 60, 0.5, (point) -> {
|
||||||
|
World w = point.getWorld();
|
||||||
|
if (w == null) return false;
|
||||||
|
List<LivingEntity> targets = new ArrayList<>(w.getNearbyLivingEntities(point.getLoc(), 0.3,0.3,0.3, entity -> {
|
||||||
|
return entity != p;
|
||||||
|
}));
|
||||||
|
|
||||||
|
for (LivingEntity living : targets) {
|
||||||
|
if (living.getHealth() < 1) {
|
||||||
|
living.setHealth(0);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
living.setHealth(living.getHealth() - 1);
|
||||||
|
}
|
||||||
|
Particle.DustOptions dust = new Particle.DustOptions(Color.fromRGB(0xFF00FF), 0.8F);
|
||||||
|
w.spawnParticle(Particle.REDSTONE, point.getLoc(), 1,0,0,0,0, dust);
|
||||||
|
|
||||||
|
SoundPlayer hiss = new SoundPlayer(point.getLoc(),Sound.BLOCK_FIRE_EXTINGUISH,0.3F,1F);
|
||||||
|
SoundPlayer damage = new SoundPlayer(point.getLoc(),Sound.BLOCK_SCULK_BREAK,0.3F,1F);
|
||||||
|
|
||||||
|
|
||||||
|
if (!point.getBlock().isPassable()) {
|
||||||
|
if (loop % 4 == 0) hiss.playWithin(30);
|
||||||
|
w.spawnParticle(Particle.LAVA, point.getLoc(), 1,0,0,0,0);
|
||||||
|
}
|
||||||
|
if (!targets.isEmpty()) {
|
||||||
|
if (loop % 4 == 0) damage.playWithin(30);
|
||||||
|
w.spawnParticle(Particle.LAVA, point.getLoc(), 1,0,0,0,0);
|
||||||
|
}
|
||||||
|
return !targets.isEmpty() || !point.getBlock().isPassable();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.kill;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Randomizer;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.BlockDisplayRaytracer;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.DisplayUtils;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class OrbitalStrike {
|
||||||
|
|
||||||
|
public void handleOrbitalStrike(Player p) {
|
||||||
|
Location target = p.getTargetBlock(null,119).getLocation();
|
||||||
|
SoundPlayer warning = new SoundPlayer(target,Sound.BLOCK_BEACON_POWER_SELECT, 100,0.5F);
|
||||||
|
warning.playWithin(100);
|
||||||
|
int y = (int) Math.round(target.y());
|
||||||
|
Randomizer rand = new Randomizer();
|
||||||
|
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(SSSBliss.getInstance(),()->{
|
||||||
|
try {
|
||||||
|
Location top = target.clone();
|
||||||
|
top.setY(256);
|
||||||
|
SchedulerUtils.later(0, () -> {
|
||||||
|
BlockDisplayRaytracer.trace(Material.REDSTONE_BLOCK,target,top,0.3D,60L);
|
||||||
|
BlockDisplayRaytracer.trace(Material.RED_STAINED_GLASS,target,top,0.6D,60L);
|
||||||
|
BlockDisplayRaytracer.trace(Material.RED_STAINED_GLASS,target,top,0.8D,60L);
|
||||||
|
for (int j = 320; j > y; j--) {
|
||||||
|
Location ring = target.clone();
|
||||||
|
ring.setY(j);
|
||||||
|
//ring.getWorld().spawnParticle(Particle.REDSTONE, ring, 1, 0, 0, 0, 0, dust);
|
||||||
|
if (j % 3 != 0) continue;
|
||||||
|
DisplayUtils.ring(ring, 3, Color.fromRGB(0xFF0000), 3);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Thread.sleep(3000);
|
||||||
|
for (int i = y + 10; i > -62; i--) {
|
||||||
|
target.setY(i);
|
||||||
|
SchedulerUtils.later(0,()->{
|
||||||
|
target.createExplosion(rand.getRandomFloat(7,9));
|
||||||
|
});
|
||||||
|
Thread.sleep(50);
|
||||||
|
}
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.kill;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Fireball;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class ShootFireball {
|
||||||
|
|
||||||
|
public void handleFireball(Player p) {
|
||||||
|
Location eye = p.getEyeLocation();
|
||||||
|
Fireball shoot = eye.getWorld().spawn(eye,Fireball.class,(fireball)->{
|
||||||
|
});
|
||||||
|
shoot.setVelocity(eye.getDirection().multiply(0.5));
|
||||||
|
shoot.setIsIncendiary(false);
|
||||||
|
shoot.setYield(7);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.kill;
|
||||||
|
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class Smite {
|
||||||
|
|
||||||
|
public void handleSmite(Player p) {
|
||||||
|
Entity smite = p.getTargetEntity(119);
|
||||||
|
if (smite instanceof Player v) {
|
||||||
|
v.sendMessage(Text.color("&b&lThou has been smitten!"));
|
||||||
|
v.getWorld().strikeLightning(v.getLocation());
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
p.getWorld().strikeLightning(p.getTargetBlock(null,119).getLocation());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.stun;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.fun.CustomItems;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.DisplayUtils;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import io.papermc.paper.event.entity.EntityMoveEvent;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
public class Drag {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static Map<UUID, UUID> dragMap = new HashMap<>();
|
||||||
|
public static Map<UUID, Double> dragLength = new HashMap<>();
|
||||||
|
|
||||||
|
public void handleScroll(PlayerItemHeldEvent e) {
|
||||||
|
Player p = e.getPlayer();
|
||||||
|
UUID id = p.getUniqueId();
|
||||||
|
|
||||||
|
if (!dragMap.containsKey(id)) return;
|
||||||
|
|
||||||
|
int prev = e.getPreviousSlot();
|
||||||
|
int curr = e.getNewSlot();
|
||||||
|
|
||||||
|
ItemStack pr = p.getInventory().getItem(prev);
|
||||||
|
ItemStack cu = p.getInventory().getItem(curr);
|
||||||
|
|
||||||
|
if (p.isSneaking()) return;
|
||||||
|
if (pr == null) return;
|
||||||
|
if (cu != null) return;
|
||||||
|
if (!pr.equals(CustomItems.ADMIN_UTILITY) && !cu.isEmpty()) return;
|
||||||
|
//p.sendMessage(cu + " " + pr);
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
if (!dragLength.containsKey(e.getPlayer().getUniqueId())) {
|
||||||
|
dragLength.put(e.getPlayer().getUniqueId(),5D);
|
||||||
|
}
|
||||||
|
|
||||||
|
SoundPlayer click = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_HAT, 1, 0.8F);
|
||||||
|
SoundPlayer clickIn = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.3F);
|
||||||
|
SoundPlayer clickOut = new SoundPlayer(p.getLocation(), Sound.BLOCK_NOTE_BLOCK_HAT, 1, 1.7F);
|
||||||
|
|
||||||
|
|
||||||
|
if (curr < prev) {
|
||||||
|
dragLength.put(id,dragLength.get(id) + 0.7);
|
||||||
|
clickOut.playWithin(2);
|
||||||
|
} else if (curr > prev) {
|
||||||
|
if (dragLength.get(id) < 1.4) {
|
||||||
|
dragLength.put(id,2D);
|
||||||
|
click.playWithin(2);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
clickIn.playWithin(2);
|
||||||
|
dragLength.put(id,dragLength.get(id) - 0.7);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleDragPlayer(Player p) {
|
||||||
|
Location loc = p.getEyeLocation();
|
||||||
|
Vector rot = loc.getDirection().normalize();
|
||||||
|
// p.sendMessage("Attempting Drag");
|
||||||
|
if (!dragMap.containsKey(p.getUniqueId())) {
|
||||||
|
CustomDisplayRaytracer.trace(p.getLocation(),rot,30,1, point -> {
|
||||||
|
//p.sendMessage("Tracing");
|
||||||
|
World w = point.getWorld();
|
||||||
|
List<Entity> targets = new ArrayList<>(w.getNearbyEntities(point.getLoc(), 1,1,1, entity -> {
|
||||||
|
return entity instanceof LivingEntity living && !living.isDead() && !living.equals(p);
|
||||||
|
}));
|
||||||
|
if (targets.isEmpty()) return false;
|
||||||
|
LivingEntity target = ((LivingEntity) targets.get(0));
|
||||||
|
// p.sendMessage("Found a target!");
|
||||||
|
/*if (target.getName().equals("obvWolf")) {
|
||||||
|
p.sendMessage(Text.prefix("§cYou are not allowed to drag: §a" + target.getName()));
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
SoundPlayer drag = new SoundPlayer(target.getLocation(), Sound.ENTITY_ITEM_PICKUP, 1, 0.5F);
|
||||||
|
drag.playWithin(30);
|
||||||
|
|
||||||
|
DisplayUtils.helix(target.getLocation(),0.6,(helix)->{
|
||||||
|
w.spawnParticle(Particle.SOUL_FIRE_FLAME,helix,1,0,0,0,0);
|
||||||
|
},0.02,2);
|
||||||
|
|
||||||
|
dragLength.put(p.getPlayer().getUniqueId(), p.getLocation().distance(target.getLocation()));
|
||||||
|
dragPlayer(p,target);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
undrag(p, Bukkit.getEntity(dragMap.get(p.getUniqueId())));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
public void undrag(Player d, Entity v) {
|
||||||
|
if (v instanceof Player pv) {
|
||||||
|
undragPlayer(d,pv);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
undragEntity(d,v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void undragPlayer(Player d, Player v) {
|
||||||
|
v.setAllowFlight(false);
|
||||||
|
v.setGlowing(false);
|
||||||
|
v.sendMessage(Text.prefix("You are no longer being dragged by:§e " + d.getName()));
|
||||||
|
d.sendMessage(Text.prefix("You are no longer dragging:§e " + v.getName()));
|
||||||
|
dragMap.remove(d.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void undragEntity(Player d, Entity v) {
|
||||||
|
Entity e = Bukkit.getEntity(v.getUniqueId());
|
||||||
|
if (e == null || e.isDead()) {
|
||||||
|
dragMap.remove(d.getUniqueId());
|
||||||
|
d.sendMessage(Text.prefix("You are no longer dragging:§e the entity"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e.setGlowing(false);
|
||||||
|
d.sendMessage(Text.prefix("You are no longer dragging:§e " + v.getName()));
|
||||||
|
dragMap.remove(d.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void dragPlayer(Player d, LivingEntity v) {
|
||||||
|
if (v instanceof Player pv) {
|
||||||
|
pv.setAllowFlight(true);
|
||||||
|
pv.sendMessage(Text.prefix("You are now being dragged by:§e " + d.getName()));
|
||||||
|
}
|
||||||
|
v.setGlowing(true);
|
||||||
|
d.sendMessage(Text.prefix("You are now dragging:§e " + v.getName()));
|
||||||
|
dragMap.put(d.getUniqueId(), v.getUniqueId());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleEntityMove(EntityMoveEvent e) {
|
||||||
|
if (!dragMap.containsValue(e.getEntity().getUniqueId())) return;
|
||||||
|
updateDrags();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleMove(PlayerMoveEvent e) {
|
||||||
|
if (!dragMap.containsValue(e.getPlayer().getUniqueId()) && !dragMap.containsKey(e.getPlayer().getUniqueId())) return;
|
||||||
|
updateDrags();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateDrags() {
|
||||||
|
dragMap.forEach((dragID, victimID) -> {
|
||||||
|
Player dragger = Bukkit.getPlayer(dragID);
|
||||||
|
Entity victimEntity = Bukkit.getEntity(victimID);
|
||||||
|
if (victimEntity == null || dragger == null) return;
|
||||||
|
if (!dragger.isOnline()) {
|
||||||
|
undrag(dragger,victimEntity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (victimEntity instanceof Player victim && !victim.isOnline()) {
|
||||||
|
undrag(dragger,victimEntity);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!dragLength.containsKey(dragID)) {
|
||||||
|
dragLength.put(dragID, victimEntity.getLocation().distance(dragger.getLocation()));
|
||||||
|
}
|
||||||
|
|
||||||
|
double leng = dragLength.get(dragID);
|
||||||
|
|
||||||
|
Location start = dragger.getEyeLocation();
|
||||||
|
Vector rot = dragger.getLocation().getDirection().normalize();
|
||||||
|
CustomDisplayRaytracer.Point destination = CustomDisplayRaytracer.trace(start, rot, leng, 1, point -> {
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
Location to = destination.getLoc();
|
||||||
|
to.setYaw(victimEntity.getYaw());
|
||||||
|
to.setPitch(victimEntity.getPitch());
|
||||||
|
to.setY(to.getY() - 1);
|
||||||
|
victimEntity.teleport(to);
|
||||||
|
|
||||||
|
DecimalFormat df = new DecimalFormat("###.##");
|
||||||
|
df.setRoundingMode(RoundingMode.FLOOR);
|
||||||
|
String length = df.format(leng);
|
||||||
|
if (leng > 30) length = "&c" + length;
|
||||||
|
|
||||||
|
dragger.sendActionBar(Component.text(Global.instance.color("&aYou &f⇄ &b" + victimEntity.getName() + "&f | &a" + length)));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.stun;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Randomizer;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
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.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Drain {
|
||||||
|
|
||||||
|
public void handleDrain(Player p) {
|
||||||
|
Location start = p.getEyeLocation();
|
||||||
|
Vector rot = p.getLocation().getDirection().normalize();
|
||||||
|
SoundPlayer drain = new SoundPlayer(start, Sound.BLOCK_BREWING_STAND_BREW, 0.3F, 0.9F);
|
||||||
|
drain.playWithin(20);
|
||||||
|
CustomDisplayRaytracer.trace(start, rot, 60, 0.5, (point) -> {
|
||||||
|
World w = point.getWorld();
|
||||||
|
if (w == null) return false;
|
||||||
|
List<LivingEntity> targets = new ArrayList<>(w.getNearbyLivingEntities(point.getLoc(), 0.5,0.5,0.5, entity -> {
|
||||||
|
return entity != p;
|
||||||
|
}));
|
||||||
|
|
||||||
|
for (LivingEntity living : targets) {
|
||||||
|
double health = living.getHealth();
|
||||||
|
if (living instanceof Player target) {
|
||||||
|
int hunger = target.getFoodLevel();
|
||||||
|
SchedulerUtils.loop(2,hunger,(rate)->{
|
||||||
|
target.setFoodLevel(target.getFoodLevel()-1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
int intValue = (int) Math.round(health);
|
||||||
|
SchedulerUtils.loop(2,intValue-1,rate->{
|
||||||
|
Randomizer rand = new Randomizer();
|
||||||
|
SoundPlayer sip = new SoundPlayer(start, Sound.ENTITY_GENERIC_DRINK, 0.3F, rand.getRandomFloat(0.7F,1.5F));
|
||||||
|
sip.playWithin(20);
|
||||||
|
living.setHealth(living.getHealth()-1);
|
||||||
|
DisplayUtils.ring(living.getLocation().clone().add(0,((health-1D)/10)-((rate/10D)),0),0.5,Color.RED,1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Particle.DustOptions dust = new Particle.DustOptions(Color.RED, 0.5F);
|
||||||
|
w.spawnParticle(Particle.REDSTONE, point.getLoc(), 1,0,0,0,0, dust);
|
||||||
|
return !targets.isEmpty();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.stun;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.util.Text;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class Launch {
|
||||||
|
Drag drag = new Drag();
|
||||||
|
|
||||||
|
public void dropLaunch(Player thrower, LivingEntity victim) {
|
||||||
|
if (Drag.dragMap.containsKey(thrower.getUniqueId())) {
|
||||||
|
drag.undrag(thrower,victim);
|
||||||
|
}
|
||||||
|
Location victimLocation = victim.getLocation();
|
||||||
|
Location throwerLocation = thrower.getLocation();
|
||||||
|
|
||||||
|
Vector launchDirection = victimLocation.toVector().subtract(throwerLocation.toVector()).normalize();
|
||||||
|
launchDirection.add(new Vector(0,0.1,0));
|
||||||
|
|
||||||
|
Vector launchVector = launchDirection.multiply(2);
|
||||||
|
victim.setVelocity(launchVector);
|
||||||
|
//victim.sendMessage(Text.prefix( "&a" + thrower.getName() + "&7 has launched you!"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void handleLaunchPlayer(Player p) {
|
||||||
|
SoundPlayer zap = new SoundPlayer(p.getLocation(), Sound.ENTITY_PLAYER_ATTACK_SWEEP, 0.5F, 0.1F);
|
||||||
|
zap.playWithin(20);
|
||||||
|
CustomDisplayRaytracer.trace(p.getEyeLocation(),p.getEyeLocation().getDirection().normalize(),30D,0.5,point -> {
|
||||||
|
World w = point.getWorld();
|
||||||
|
if (w == null) return false;
|
||||||
|
List<LivingEntity> targets = new ArrayList<>(w.getNearbyLivingEntities(point.getLoc(), 1,1,1, entity -> {
|
||||||
|
return !entity.getName().equals(p.getName());
|
||||||
|
}));
|
||||||
|
int targs = 0;
|
||||||
|
for (LivingEntity target : targets) {
|
||||||
|
dropLaunch(p,target);
|
||||||
|
targs++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Particle.DustOptions dust = new Particle.DustOptions(Color.WHITE, 2);
|
||||||
|
w.spawnParticle(Particle.SWEEP_ATTACK, point.getLoc(), 5, 0.2,0.2,0.2, 0);
|
||||||
|
w.spawnParticle(Particle.REDSTONE, point.getLoc(), 5,0.25,0.25,0.25,0.25, dust);
|
||||||
|
|
||||||
|
return targs > 0;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package io.github.thetrouper.sssbliss.server.fun.utility.stun;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.Global;
|
||||||
|
import io.github.itzispyder.pdk.utils.SchedulerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.ServerUtils;
|
||||||
|
import io.github.itzispyder.pdk.utils.raytracers.CustomDisplayRaytracer;
|
||||||
|
import io.github.thetrouper.sssbliss.server.sound.SoundPlayer;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.*;
|
||||||
|
import org.bukkit.attribute.Attribute;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
import org.bukkit.potion.PotionEffectType;
|
||||||
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
import java.util.function.BooleanSupplier;
|
||||||
|
|
||||||
|
public class Stun {
|
||||||
|
|
||||||
|
public static final int DEFAULT_NO_DAMAGE_TICKS = 9;
|
||||||
|
public static final int DEFAULT_MAX_NO_DAMAGE_TICKS = 10;
|
||||||
|
public static final int NO_DAMAGE_TICKS = 1;
|
||||||
|
public static final int MAX_NO_DAMAGE_TICKS = 2;
|
||||||
|
|
||||||
|
public void handleStun(Player p) {
|
||||||
|
Location start = p.getEyeLocation();
|
||||||
|
Vector rot = p.getLocation().getDirection().normalize();
|
||||||
|
SoundPlayer zap = new SoundPlayer(start, Sound.ENTITY_BEE_HURT, 0.3F, 1);
|
||||||
|
zap.playWithin(20);
|
||||||
|
CustomDisplayRaytracer.trace(start, rot, 60, 0.5, (point) -> {
|
||||||
|
World w = point.getWorld();
|
||||||
|
if (w == null) return false;
|
||||||
|
List<LivingEntity> targets = new ArrayList<>(w.getNearbyLivingEntities(point.getLoc(), 0.5,0.5,0.5, entity -> {
|
||||||
|
return entity != p;
|
||||||
|
}));
|
||||||
|
|
||||||
|
for (LivingEntity living : targets) {
|
||||||
|
|
||||||
|
double health = living.getHealth();
|
||||||
|
|
||||||
|
living.registerAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE);
|
||||||
|
//living.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(0.99D);
|
||||||
|
|
||||||
|
living.getScoreboardTags().remove("unstun");
|
||||||
|
SchedulerUtils.loop(1,60,(loop)->{
|
||||||
|
if (loop >= 59 || living.getScoreboardTags().contains("unstun")) {
|
||||||
|
//living.getAttribute(Attribute.GENERIC_KNOCKBACK_RESISTANCE).setBaseValue(0D);
|
||||||
|
living.setNoDamageTicks(DEFAULT_NO_DAMAGE_TICKS);
|
||||||
|
living.setMaximumNoDamageTicks(DEFAULT_MAX_NO_DAMAGE_TICKS);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
living.addPotionEffect(new PotionEffect(PotionEffectType.SLOW,2,30,true,false, false));
|
||||||
|
living.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_DIGGING,2,30,true,false, false));
|
||||||
|
living.addPotionEffect(new PotionEffect(PotionEffectType.JUMP,2,128,true,false, false));
|
||||||
|
|
||||||
|
living.damage(1);
|
||||||
|
living.setHealth(health);
|
||||||
|
living.setNoDamageTicks(NO_DAMAGE_TICKS);
|
||||||
|
living.setMaximumNoDamageTicks(MAX_NO_DAMAGE_TICKS);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Particle.DustOptions dust = new Particle.DustOptions(Color.AQUA, 1);
|
||||||
|
w.spawnParticle(Particle.END_ROD, point.getLoc(), 1, 0,0,0, 0);
|
||||||
|
w.spawnParticle(Particle.REDSTONE, point.getLoc(), 1,0,0,0,0, dust);
|
||||||
|
return !targets.isEmpty();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -12,6 +12,7 @@ public class GemPassiveEffects {
|
|||||||
ServerUtils.forEachPlayer(GemPassiveEffects::effectPlayer);
|
ServerUtils.forEachPlayer(GemPassiveEffects::effectPlayer);
|
||||||
}
|
}
|
||||||
public static void effectPlayer(Player p) {
|
public static void effectPlayer(Player p) {
|
||||||
|
if (!GemUtils.verifyGem(p)) return;
|
||||||
GemData has = GemUtils.hasGem(p);
|
GemData has = GemUtils.hasGem(p);
|
||||||
if (has == null) return;
|
if (has == null) return;
|
||||||
if (has.passive().isEmpty()) return;
|
if (has.passive().isEmpty()) return;
|
||||||
|
|||||||
@@ -18,78 +18,6 @@ public class FileUtils {
|
|||||||
folder.mkdirs();
|
folder.mkdirs();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static String createNBTLog(String contents) {
|
|
||||||
ServerUtils.sendDebugMessage("FileUtils: Creating NBT log");
|
|
||||||
String fileName = "nbt_log-" + Randomizer.generateID();
|
|
||||||
|
|
||||||
File dataFolder = SSSBliss.getInstance().getDataFolder();
|
|
||||||
|
|
||||||
File loggedNBTFolder = new File(dataFolder,"LoggedNBT");
|
|
||||||
if (!loggedNBTFolder.exists()) {
|
|
||||||
loggedNBTFolder.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(loggedNBTFolder, fileName + ".txt");
|
|
||||||
try {
|
|
||||||
if (!file.exists()) {
|
|
||||||
file.createNewFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
|
|
||||||
writer.append(contents);
|
|
||||||
writer.close();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createNBTLog(ItemStack i) {
|
|
||||||
ServerUtils.sendDebugMessage("FileUtils: Creating NBT log");
|
|
||||||
|
|
||||||
String item = i.getType().name().toLowerCase() + i.getItemMeta().getAsString();
|
|
||||||
|
|
||||||
String fileName = "nbt_log-" + Randomizer.generateID();
|
|
||||||
|
|
||||||
File dataFolder = SSSBliss.getInstance().getDataFolder();
|
|
||||||
|
|
||||||
File loggedNBTFolder = new File(dataFolder,"LoggedNBT");
|
|
||||||
if (!loggedNBTFolder.exists()) {
|
|
||||||
loggedNBTFolder.mkdirs();
|
|
||||||
}
|
|
||||||
|
|
||||||
File file = new File(loggedNBTFolder, fileName + ".txt");
|
|
||||||
try {
|
|
||||||
if (!file.exists()) {
|
|
||||||
file.createNewFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
|
|
||||||
writer.append(item);
|
|
||||||
writer.close();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String createCommandLog(String command) {
|
|
||||||
String fileName = "command_log-" + Randomizer.generateID();
|
|
||||||
File file = new File(SSSBliss.getInstance().getDataFolder() + "/LoggedCommands/" + fileName + ".txt");
|
|
||||||
try {
|
|
||||||
if (!file.exists()) {
|
|
||||||
file.createNewFile();
|
|
||||||
}
|
|
||||||
|
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file, true));
|
|
||||||
writer.append(command);
|
|
||||||
writer.close();
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,12 @@
|
|||||||
package io.github.thetrouper.sssbliss.server.util;
|
package io.github.thetrouper.sssbliss.server.util;
|
||||||
|
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.Randomizer;
|
||||||
|
import io.github.itzispyder.pdk.utils.misc.SoundPlayer;
|
||||||
|
import io.github.thetrouper.sssbliss.SSSBliss;
|
||||||
import io.github.thetrouper.sssbliss.data.GemData;
|
import io.github.thetrouper.sssbliss.data.GemData;
|
||||||
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
import io.github.thetrouper.sssbliss.data.Gems.Gems;
|
||||||
|
import net.kyori.adventure.text.Component;
|
||||||
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.Inventory;
|
import org.bukkit.inventory.Inventory;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@@ -9,14 +14,26 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class GemUtils {
|
public class GemUtils {
|
||||||
|
|
||||||
public static GemData hasGem(Player p) {
|
public static GemData hasGem(Player p) {
|
||||||
|
GemData off = isGem(p.getInventory().getItemInOffHand(),true);
|
||||||
|
if (off != null) return off;
|
||||||
|
for (ItemStack i : p.getInventory().getContents()) {
|
||||||
|
if (i == null) return null;
|
||||||
|
for (GemData gem : Gems.gems) {
|
||||||
|
if (i.hasItemMeta() && i.getItemMeta().hasCustomModelData() && i.getItemMeta().getCustomModelData() == gem.dataID()) {
|
||||||
|
return gem;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
public static GemData isGem(ItemStack i, boolean retern) {
|
||||||
for (GemData gem : Gems.gems) {
|
for (GemData gem : Gems.gems) {
|
||||||
if (p.getInventory().getItemInOffHand().hasItemMeta() && p.getInventory().getItemInOffHand().getItemMeta().hasCustomModelData() && p.getInventory().getItemInOffHand().getItemMeta().getCustomModelData() == gem.dataID()) {
|
if (i.isSimilar(gem.item())) {
|
||||||
return gem;
|
return gem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isGem(ItemStack i) {
|
public static boolean isGem(ItemStack i) {
|
||||||
for (GemData gem : Gems.gems) {
|
for (GemData gem : Gems.gems) {
|
||||||
if (i.isSimilar(gem.item())) {
|
if (i.isSimilar(gem.item())) {
|
||||||
@@ -34,4 +51,54 @@ public class GemUtils {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void upgradeGem(Player p) {
|
||||||
|
GemData upgrade = GemUtils.hasGem(p).upgrade();
|
||||||
|
//p.sendMessage("Detected your gem " + upgrade);
|
||||||
|
if (upgrade != null) {
|
||||||
|
p.sendMessage(Component.text(SSSBliss.mainConfig.plugin.prefix + "Your gem has been upgraded"));
|
||||||
|
p.getInventory().setItemInOffHand(upgrade.item());
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Component.text(SSSBliss.mainConfig.plugin.prefix + "Your gem is already upgraded"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void downgradeGem(Player p) {
|
||||||
|
GemData downgrade = GemUtils.hasGem(p).downgrade();
|
||||||
|
//p.sendMessage("Detected your gem " + downgrade);
|
||||||
|
if (downgrade != null) {
|
||||||
|
p.sendMessage(Component.text(SSSBliss.mainConfig.plugin.prefix + "Your gem has been downgraded"));
|
||||||
|
p.getInventory().setItemInOffHand(downgrade.item());
|
||||||
|
} else {
|
||||||
|
p.sendMessage(Component.text(SSSBliss.mainConfig.plugin.prefix + "Your gem is already downgraded"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void randomGem(Player p) {
|
||||||
|
io.github.itzispyder.pdk.utils.misc.Randomizer random = new Randomizer();
|
||||||
|
GemData starter = random.getRandomElement(Gems.starts);
|
||||||
|
|
||||||
|
p.getInventory().setItemInOffHand(starter.item());
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean verifyGem(Player p) {
|
||||||
|
int gems = 0;
|
||||||
|
for (ItemStack i : p.getInventory().getContents()) {
|
||||||
|
if (i == null) continue;
|
||||||
|
boolean isGem = isGem(i);
|
||||||
|
if (!isGem) continue;
|
||||||
|
gems++;
|
||||||
|
if (gems > 1) {
|
||||||
|
p.getInventory().removeItemAnySlot(i);
|
||||||
|
//p.getWorld().dropItem(p.getLocation(),i);
|
||||||
|
SoundPlayer dropSound = new SoundPlayer(p.getLocation(), Sound.ENTITY_ITEM_FRAME_REMOVE_ITEM,1000,1);
|
||||||
|
dropSound.playWithin(60);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (gems > 1) {
|
||||||
|
p.sendMessage(Text.prefix("You can only use 1 gem at a time. Your extra gem has been deleted."));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class PlayerUtils {
|
|||||||
* @return {@code true} if the specified amount of items was successfully removed,
|
* @return {@code true} if the specified amount of items was successfully removed,
|
||||||
* {@code false} if the player does not have enough items.
|
* {@code false} if the player does not have enough items.
|
||||||
*/
|
*/
|
||||||
public static boolean removeItems(Player player, ItemStack item, int amount) {
|
public static boolean subtractItems(Player player, ItemStack item, int amount) {
|
||||||
Inventory inventory = player.getInventory();
|
Inventory inventory = player.getInventory();
|
||||||
|
|
||||||
int totalAmountToRemove = amount;
|
int totalAmountToRemove = amount;
|
||||||
|
|||||||
@@ -1,78 +0,0 @@
|
|||||||
package io.github.thetrouper.sssbliss.server.util;
|
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Randomize items from a list
|
|
||||||
* @param <T> list of?
|
|
||||||
*/
|
|
||||||
public class Randomizer<T> {
|
|
||||||
public static long generateID() {
|
|
||||||
Date now = new Date();
|
|
||||||
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmssSSS");
|
|
||||||
String formattedDate = dateFormat.format(now);
|
|
||||||
long id = Long.parseLong(formattedDate);
|
|
||||||
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
private final List<T> array;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* From array list
|
|
||||||
* @param array list
|
|
||||||
*/
|
|
||||||
public Randomizer(List<T> array) {
|
|
||||||
this.array = array;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* From set
|
|
||||||
* @param array set
|
|
||||||
*/
|
|
||||||
public Randomizer(Set<T> array) {
|
|
||||||
this.array = new ArrayList<>(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* From array
|
|
||||||
* @param array array
|
|
||||||
*/
|
|
||||||
public Randomizer(T[] array) {
|
|
||||||
this.array = List.of(array);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Pick random from the array
|
|
||||||
* @return random of list of?
|
|
||||||
*/
|
|
||||||
public T pickRand() {
|
|
||||||
return array.get(rand(array.size() - 1));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a random integer from 1 to (max)
|
|
||||||
* @param max max value
|
|
||||||
* @return random
|
|
||||||
*/
|
|
||||||
public static int rand(int max) {
|
|
||||||
if (max <= 0) throw new IllegalArgumentException("max cannot be less than 1!");
|
|
||||||
return (int) Math.ceil(Math.random() * max);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Generates a random integer from (min) to (max)
|
|
||||||
* @param min min value
|
|
||||||
* @param max max value
|
|
||||||
* @return random
|
|
||||||
*/
|
|
||||||
public static int rand(int min, int max) {
|
|
||||||
if (max <= 0 || min <= 0) throw new IllegalArgumentException("max or min cannot be less than 1!");
|
|
||||||
if (max <= min) throw new IllegalArgumentException("max cannot be less than or equal to min!");
|
|
||||||
return min + (int) Math.floor(Math.random() * (max - min + 1));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -5,7 +5,11 @@ import io.github.thetrouper.sssbliss.cmds.SSSBlissCommand;
|
|||||||
import net.md_5.bungee.api.ChatMessageType;
|
import net.md_5.bungee.api.ChatMessageType;
|
||||||
import net.md_5.bungee.api.chat.TextComponent;
|
import net.md_5.bungee.api.chat.TextComponent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
|
|
||||||
@@ -102,4 +106,5 @@ public class ServerUtils {
|
|||||||
public static String[] unVanishedPlayers() {
|
public static String[] unVanishedPlayers() {
|
||||||
return io.github.itzispyder.pdk.utils.ServerUtils.players(ServerUtils::isVanished).stream().map(Player::getName).toArray(String[]::new);
|
return io.github.itzispyder.pdk.utils.ServerUtils.players(ServerUtils::isVanished).stream().map(Player::getName).toArray(String[]::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ commands:
|
|||||||
bliss:
|
bliss:
|
||||||
description: A command for testing.
|
description: A command for testing.
|
||||||
usage: /bliss
|
usage: /bliss
|
||||||
permission: bliss.info
|
permission: bliss.admin
|
||||||
permission-message: You do not have permission!
|
permission-message: You do not have permission!
|
||||||
sssblisscallback:
|
sssblisscallback:
|
||||||
description: Callback for chat click events
|
description: Callback for chat click events
|
||||||
|
|||||||
Reference in New Issue
Block a user