mirror of
https://github.com/SimplexDevelopment/StrikePlugin.git
synced 2024-12-22 00:47:38 +00:00
uh
This commit is contained in:
parent
4ec12f7807
commit
5a7fef77a4
@ -0,0 +1,47 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike;
|
||||
/* */
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
|
||||
/* */ import java.util.Arrays;
|
||||
/* */ import org.bukkit.command.Command;
|
||||
/* */ import org.bukkit.command.CommandExecutor;
|
||||
/* */ import org.bukkit.command.CommandSender;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class StrikeCommand
|
||||
/* */ implements CommandExecutor
|
||||
/* */ {
|
||||
/* */ private static ConfigUser[] configUsers;
|
||||
/* */ private final JavaPlugin plugin;
|
||||
/* */
|
||||
/* */ public StrikeCommand(JavaPlugin plugin) {
|
||||
/* 18 */ this.plugin = plugin;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static void loadInstances(ConfigUser... configUsers) {
|
||||
/* 22 */ StrikeCommand.configUsers = configUsers;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
|
||||
/* 28 */ if (args[0].isEmpty() || args.length > 1) {
|
||||
/* 29 */ return true;
|
||||
/* */ }
|
||||
/* 31 */ switch (args[0].toLowerCase()) {
|
||||
/* */ case "reload":
|
||||
/* 33 */ this.plugin.reloadConfig();
|
||||
/* 34 */ Arrays.<ConfigUser>stream(configUsers).forEach(configUser -> configUser.refresh());
|
||||
/* */ break;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* 39 */ return true;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\StrikeCommand.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,57 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike;
|
||||
/* */
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.listeners.Grenade;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.listeners.Gun;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.listeners.Jumper;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.listeners.SpawnController;
|
||||
/* */ import org.bukkit.event.Listener;
|
||||
/* */ import org.bukkit.plugin.Plugin;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public final class StrikePlugin
|
||||
/* */ extends JavaPlugin
|
||||
/* */ {
|
||||
/* */ public void onEnable() {
|
||||
/* 32 */ saveDefaultConfig();
|
||||
/* 33 */ Spawn.loadConfig(this);
|
||||
/* */
|
||||
/* 35 */ Gun gun = new Gun(this);
|
||||
/* 36 */ Jumper jumper = new Jumper(this);
|
||||
/* 37 */ SpawnController spawnController = new SpawnController(this);
|
||||
/* */
|
||||
/* 39 */ getServer().getPluginManager().registerEvents((Listener)gun, (Plugin)this);
|
||||
/* 40 */ getServer().getPluginManager().registerEvents((Listener)jumper, (Plugin)this);
|
||||
/* */
|
||||
/* 42 */ getServer().getPluginManager().registerEvents((Listener)new Grenade(this), (Plugin)this);
|
||||
/* 43 */ getServer().getPluginManager().registerEvents((Listener)spawnController, (Plugin)this);
|
||||
/* */
|
||||
/* 45 */ getCommand("strike").setExecutor(new StrikeCommand(this));
|
||||
/* */
|
||||
/* 47 */ StrikeCommand.loadInstances(new ConfigUser[] { (ConfigUser)gun, (ConfigUser)jumper, (ConfigUser)spawnController });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public void onDisable() {}
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\StrikePlugin.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,13 @@
|
||||
package io.github.simplexdev.simplexcore.strike.api;
|
||||
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
public interface ConfigUser extends Listener {
|
||||
void refresh();
|
||||
}
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\api\ConfigUser.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,46 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.api;
|
||||
/* */
|
||||
/* */ import org.bukkit.Location;
|
||||
/* */ import org.bukkit.World;
|
||||
/* */ import org.bukkit.configuration.file.FileConfiguration;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */
|
||||
/* */ public class Spawn {
|
||||
/* 9 */ private static World world = null;
|
||||
/* 10 */ private static Location spawn = null;
|
||||
/* */
|
||||
/* */ public static void loadConfig(JavaPlugin plugin) {
|
||||
/* 13 */ FileConfiguration config = plugin.getConfig();
|
||||
/* */
|
||||
/* 15 */ world = plugin.getServer().getWorld(config.getString("spawn.world"));
|
||||
/* 16 */ spawn = new Location(world, config.getInt("spawn.location.x"), config.getInt("spawn.location.y"), config.getInt("spawn.location.z"));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static void setSpawn(Location spawn, JavaPlugin plugin) {
|
||||
/* 20 */ FileConfiguration config = plugin.getConfig();
|
||||
/* 21 */ config.set("spawn.coords.x", Double.valueOf(spawn.getX()));
|
||||
/* 22 */ config.set("spawn.coords.y", Double.valueOf(spawn.getY()));
|
||||
/* 23 */ config.set("spawn.coords.z", Double.valueOf(spawn.getZ()));
|
||||
/* */
|
||||
/* 25 */ Spawn.spawn = spawn;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static void setWorld(World world, JavaPlugin plugin) {
|
||||
/* 29 */ plugin.getConfig().set("spawn.world", world.getName());
|
||||
/* 30 */ Spawn.world = world;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static World getWorld() {
|
||||
/* 34 */ return world;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public static Location getSpawn() {
|
||||
/* 38 */ return spawn;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\api\Spawn.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,44 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.events;
|
||||
/* */
|
||||
/* */ import java.util.List;
|
||||
/* */ import org.bukkit.entity.LivingEntity;
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.Event;
|
||||
/* */ import org.bukkit.event.HandlerList;
|
||||
/* */
|
||||
/* */ public class GrenadeKillEvent
|
||||
/* */ extends Event
|
||||
/* */ {
|
||||
/* 12 */ private static final HandlerList handlers = new HandlerList();
|
||||
/* */ private final Player killer;
|
||||
/* */ private final List<LivingEntity> deadList;
|
||||
/* */
|
||||
/* */ public GrenadeKillEvent(Player killer, List<LivingEntity> deadList) {
|
||||
/* 17 */ this.killer = killer;
|
||||
/* 18 */ this.deadList = deadList;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public Player getKiller() {
|
||||
/* 22 */ return this.killer;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public List<LivingEntity> getDeadList() {
|
||||
/* 26 */ return this.deadList;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public HandlerList getHandlers() {
|
||||
/* 31 */ return handlers;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static HandlerList getHandlerList() {
|
||||
/* 36 */ return handlers;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\events\GrenadeKillEvent.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,42 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.events;
|
||||
/* */
|
||||
/* */ import org.bukkit.entity.LivingEntity;
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.Event;
|
||||
/* */ import org.bukkit.event.HandlerList;
|
||||
/* */
|
||||
/* */ public class GunKillEvent
|
||||
/* */ extends Event {
|
||||
/* 10 */ private static final HandlerList handlers = new HandlerList();
|
||||
/* */ private final Player killer;
|
||||
/* */ private final LivingEntity dead;
|
||||
/* */
|
||||
/* */ public GunKillEvent(Player killer, LivingEntity dead) {
|
||||
/* 15 */ this.killer = killer;
|
||||
/* 16 */ this.dead = dead;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public Player getKiller() {
|
||||
/* 20 */ return this.killer;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public LivingEntity getDead() {
|
||||
/* 24 */ return this.dead;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public HandlerList getHandlers() {
|
||||
/* 29 */ return handlers;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static HandlerList getHandlerList() {
|
||||
/* 34 */ return handlers;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\events\GunKillEvent.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,35 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.events;
|
||||
/* */
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.Event;
|
||||
/* */ import org.bukkit.event.HandlerList;
|
||||
/* */
|
||||
/* */ public class UseHealthPackageEvent
|
||||
/* */ extends Event {
|
||||
/* 9 */ private static final HandlerList handlers = new HandlerList();
|
||||
/* */ private final Player player;
|
||||
/* */
|
||||
/* */ public UseHealthPackageEvent(Player player) {
|
||||
/* 13 */ this.player = player;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public Player getPlayer() {
|
||||
/* 17 */ return this.player;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public HandlerList getHandlers() {
|
||||
/* 22 */ return handlers;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static HandlerList getHandlerList() {
|
||||
/* 27 */ return handlers;
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\events\UseHealthPackageEvent.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,127 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
|
||||
/* */
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
|
||||
/* */ import java.util.ArrayList;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.HashMap;
|
||||
/* */ import java.util.List;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import org.bukkit.ChatColor;
|
||||
/* */ import org.bukkit.GameMode;
|
||||
/* */ import org.bukkit.Material;
|
||||
/* */ import org.bukkit.entity.Item;
|
||||
/* */ import org.bukkit.entity.LivingEntity;
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.EventHandler;
|
||||
/* */ import org.bukkit.event.entity.EntityDamageEvent;
|
||||
/* */ import org.bukkit.event.player.PlayerAttemptPickupItemEvent;
|
||||
/* */ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
/* */ import org.bukkit.inventory.ItemStack;
|
||||
/* */ import org.bukkit.inventory.meta.ItemMeta;
|
||||
/* */ import org.bukkit.plugin.Plugin;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */ import org.bukkit.scheduler.BukkitRunnable;
|
||||
/* */
|
||||
/* */ public class Grenade
|
||||
/* */ implements ConfigUser {
|
||||
/* 28 */ private static List<Item> items = new ArrayList<>();
|
||||
/* 29 */ private static Map<Player, List<Player>> map = new HashMap<>();
|
||||
/* */ private final ItemStack grenadeItem;
|
||||
/* */ private final JavaPlugin plugin;
|
||||
/* */ private int explosionTime;
|
||||
/* */
|
||||
/* */ public Grenade(JavaPlugin plugin) {
|
||||
/* 35 */ this.plugin = plugin;
|
||||
/* 36 */ this.grenadeItem = createItem();
|
||||
/* 37 */ this.explosionTime = plugin.getConfig().getInt("grenade.explosion-time", 1);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public ItemStack createItem() {
|
||||
/* 42 */ ItemStack stack = new ItemStack(Material.MAGMA_CREAM, 1);
|
||||
/* 43 */ ItemMeta meta = this.plugin.getServer().getItemFactory().getItemMeta(Material.MAGMA_CREAM);
|
||||
/* */
|
||||
/* 45 */ meta.setDisplayName(ChatColor.RED + "Grenade");
|
||||
/* */
|
||||
/* 47 */ stack.setItemMeta(meta);
|
||||
/* */
|
||||
/* 49 */ this.plugin.getServer().getOnlinePlayers().forEach(player -> player.getInventory().addItem(new ItemStack[] { stack }));
|
||||
/* */
|
||||
/* 51 */ return stack;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void throwGrenade(PlayerInteractEvent e) {
|
||||
/* 58 */ ItemStack itemStack = e.getItem();
|
||||
/* 59 */ final Player player = e.getPlayer();
|
||||
/* */
|
||||
/* 61 */ if (!player.getWorld().equals(Spawn.getWorld()) || itemStack == null || !itemStack.isSimilar(this.grenadeItem) || e.getAction().toString().startsWith("LEFT")) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 64 */ if (player.getGameMode() != GameMode.CREATIVE) {
|
||||
/* 65 */ if (itemStack.getAmount() == 1) {
|
||||
/* 66 */ itemStack = null;
|
||||
/* */ } else {
|
||||
/* 68 */ itemStack.setAmount(itemStack.getAmount() - 1);
|
||||
/* */ }
|
||||
/* 70 */ player.getInventory().setItemInMainHand(itemStack);
|
||||
/* */ }
|
||||
/* */
|
||||
/* 73 */ final Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.MAGMA_CREAM));
|
||||
/* 74 */ item.setVelocity(player.getEyeLocation().getDirection().multiply(0.75D));
|
||||
/* */
|
||||
/* 76 */ (new BukkitRunnable()
|
||||
/* */ {
|
||||
/* */ public void run() {
|
||||
/* 79 */ if (item != null) {
|
||||
/* 80 */ item.getLocation().createExplosion(4.0F, false, false);
|
||||
/* 81 */ Collection<LivingEntity> entities = item.getLocation().getNearbyLivingEntities(4.0D);
|
||||
/* */
|
||||
/* 83 */ List<Player> players = new ArrayList<>();
|
||||
/* */
|
||||
/* 85 */ entities.forEach(livingEntity -> {
|
||||
/* */ if (livingEntity instanceof Player) {
|
||||
/* */ players.add((Player)livingEntity);
|
||||
/* */ }
|
||||
/* */ });
|
||||
/* 90 */ Grenade.map.put(player, players);
|
||||
/* */
|
||||
/* 92 */ Grenade.items.remove(item);
|
||||
/* 93 */ item.remove();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 96 */ }).runTaskLater((Plugin)this.plugin, (20 * this.explosionTime));
|
||||
/* */
|
||||
/* 98 */ items.add(item);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void onPlayerDamage(EntityDamageEvent e) {
|
||||
/* 104 */ if (!e.getEntity().getWorld().equals(Spawn.getWorld()) || !(e.getEntity() instanceof Player)) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* */
|
||||
/* 108 */ Player player = (Player)e.getEntity();
|
||||
/* */
|
||||
/* 110 */ map.values().forEach(players -> System.out.println(players));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void cancelPickup(PlayerAttemptPickupItemEvent e) {
|
||||
/* 115 */ if (!items.contains(e.getItem()))
|
||||
/* */ return;
|
||||
/* 117 */ e.setCancelled(true);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public void refresh() {}
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\Grenade.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,183 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
|
||||
/* */ import java.util.Collection;
|
||||
/* */ import java.util.HashMap;
|
||||
/* */ import org.bukkit.ChatColor;
|
||||
/* */ import org.bukkit.Location;
|
||||
/* */ 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.event.Event;
|
||||
/* */ import org.bukkit.event.EventHandler;
|
||||
/* */ import org.bukkit.event.block.Action;
|
||||
/* */ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
/* */ import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
/* */ import org.bukkit.inventory.ItemStack;
|
||||
/* */ import org.bukkit.inventory.meta.ItemMeta;
|
||||
/* */ import org.bukkit.plugin.Plugin;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */ import org.bukkit.scheduler.BukkitRunnable;
|
||||
/* */
|
||||
/* */ public final class Gun implements ConfigUser {
|
||||
/* 24 */ private static final HashMap<ItemStack, Integer> ammoMap = new HashMap<>();
|
||||
/* */
|
||||
/* */ private final ItemStack gunItemStack;
|
||||
/* */
|
||||
/* */ private final JavaPlugin plugin;
|
||||
/* */
|
||||
/* */ private int maxAmmo;
|
||||
/* */
|
||||
/* */ private int maxDistance;
|
||||
/* */
|
||||
/* */
|
||||
/* */ public Gun(JavaPlugin plugin) {
|
||||
/* 36 */ this.plugin = plugin;
|
||||
/* 37 */ this.gunItemStack = createItem();
|
||||
/* 38 */ this.maxAmmo = plugin.getConfig().getInt("gun.ammo");
|
||||
/* 39 */ this.maxDistance = plugin.getConfig().getInt("gun.range");
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public ItemStack createItem() {
|
||||
/* 43 */ ItemStack stack = new ItemStack(Material.IRON_HORSE_ARMOR, 1);
|
||||
/* 44 */ ItemMeta meta = this.plugin.getServer().getItemFactory().getItemMeta(Material.IRON_HORSE_ARMOR);
|
||||
/* */
|
||||
/* 46 */ meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("gun.name")));
|
||||
/* */
|
||||
/* 48 */ stack.setItemMeta(meta);
|
||||
/* */
|
||||
/* 50 */ this.plugin.getServer().getOnlinePlayers().forEach(player -> player.getInventory().addItem(new ItemStack[] { stack }));
|
||||
/* */
|
||||
/* 52 */ return stack;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void activeActionBar(PlayerItemHeldEvent e) {
|
||||
/* 75 */ final Player player = e.getPlayer();
|
||||
/* */
|
||||
/* 77 */ if (!player.getWorld().equals(Spawn.getWorld()) || player.getInventory().getItem(e.getNewSlot()) == null || !player.getInventory().getItem(e.getNewSlot()).equals(this.gunItemStack)) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 80 */ (new BukkitRunnable()
|
||||
/* */ {
|
||||
/* */ public void run() {
|
||||
/* 83 */ ItemStack mainHandItem = player.getInventory().getItemInMainHand();
|
||||
/* 84 */ if (!mainHandItem.isSimilar(Gun.this.gunItemStack)) {
|
||||
/* 85 */ cancel();
|
||||
/* */
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 89 */ String ammoText = (Gun.ammoMap.containsKey(mainHandItem) ? ((Integer)Gun.ammoMap.get(mainHandItem)).intValue() : Gun.this.maxAmmo) + " | " + Gun.this.maxAmmo;
|
||||
/* */
|
||||
/* 91 */ player.sendActionBar(ammoText);
|
||||
/* */ }
|
||||
/* 94 */ }).runTaskTimer((Plugin)this.plugin, 0L, 7L);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void onRightClick(PlayerInteractEvent e) {
|
||||
/* 101 */ final ItemStack itemStack = e.getItem();
|
||||
/* 102 */ Player player = e.getPlayer();
|
||||
/* 103 */ Action action = e.getAction();
|
||||
/* */
|
||||
/* 105 */ if (!player.getWorld().equals(Spawn.getWorld()) || itemStack == null || !itemStack.equals(this.gunItemStack) || !action.toString().startsWith("RIGHT_CLICK")) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 108 */ int ammo = this.maxAmmo;
|
||||
/* */
|
||||
/* 110 */ if (!ammoMap.containsKey(itemStack)) {
|
||||
/* 111 */ ammoMap.put(itemStack, Integer.valueOf(this.maxAmmo - 1));
|
||||
/* */ } else {
|
||||
/* */
|
||||
/* 114 */ ammo = ((Integer)ammoMap.get(itemStack)).intValue();
|
||||
/* */
|
||||
/* 116 */ if (ammo == 1)
|
||||
/* */ {
|
||||
/* 118 */ (new BukkitRunnable()
|
||||
/* */ {
|
||||
/* */ public void run() {
|
||||
/* 121 */ Gun.ammoMap.replace(itemStack, Integer.valueOf(Gun.this.maxAmmo));
|
||||
/* */ }
|
||||
/* 123 */ }).runTaskLater((Plugin)this.plugin, 20L * this.plugin.getConfig().getInt("gun.reload-time"));
|
||||
/* */ }
|
||||
/* */
|
||||
/* 126 */ if (((Integer)ammoMap.get(itemStack)).intValue() != 0) {
|
||||
/* 127 */ ammoMap.replace(itemStack, Integer.valueOf(ammo - 1));
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* 130 */ if (ammo <= 0) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 133 */ player.sendMessage(String.valueOf(ammo));
|
||||
/* */
|
||||
/* 135 */ spawnParticle(player, player.getEyeLocation().clone(), 0.0D);
|
||||
/* 136 */ Entity entity = player.getTargetEntity(this.maxDistance);
|
||||
/* */
|
||||
/* 138 */ if (!(entity instanceof LivingEntity)) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 141 */ LivingEntity livingEntity = (LivingEntity)entity;
|
||||
/* 142 */ double currentHealth = livingEntity.getHealth();
|
||||
/* 143 */ double damageHealth = this.plugin.getConfig().getInt("gun.damage");
|
||||
/* */
|
||||
/* 145 */ if (currentHealth <= damageHealth) {
|
||||
/* 146 */ Bukkit.getServer().getPluginManager().callEvent((Event)new GunKillEvent(player, livingEntity));
|
||||
/* */ }
|
||||
/* 148 */ livingEntity.damage(damageHealth);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void spawnParticle(Player player, Location location, double distance) {
|
||||
/* 154 */ World world = location.getWorld();
|
||||
/* */
|
||||
/* 156 */ location.add(location.getDirection().multiply(0.1D));
|
||||
/* 157 */ world.spawnParticle(Particle.CRIT, location, 1, 0.0D, 0.0D, 0.0D, 0.001D);
|
||||
/* */
|
||||
/* 159 */ distance += 0.1D;
|
||||
/* */
|
||||
/* 161 */ if (location.getBlock().getType() != Material.AIR || distance > this.maxDistance) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 164 */ Collection<LivingEntity> entities = location.getNearbyLivingEntities(0.1D);
|
||||
/* */
|
||||
/* 166 */ if (!entities.isEmpty() && entities.size() == 1 && !entities.contains(player)) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 169 */ spawnParticle(player, location, distance);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void refresh() {
|
||||
/* 175 */ this.maxAmmo = this.plugin.getConfig().getInt("gun.ammo");
|
||||
/* 176 */ this.maxDistance = this.plugin.getConfig().getInt("gun.range");
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\Gun.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,92 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
|
||||
/* */
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.events.GunKillEvent;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.utils.SkullCreator;
|
||||
/* */ import org.bukkit.ChatColor;
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.EventHandler;
|
||||
/* */ import org.bukkit.event.block.Action;
|
||||
/* */ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
/* */ import org.bukkit.event.player.PlayerInteractEvent;
|
||||
/* */ import org.bukkit.inventory.ItemStack;
|
||||
/* */ import org.bukkit.inventory.meta.ItemMeta;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */
|
||||
/* */ public class HealthPackage
|
||||
/* */ implements ConfigUser
|
||||
/* */ {
|
||||
/* */ private final ItemStack healthPackage;
|
||||
/* */ private final JavaPlugin plugin;
|
||||
/* */ private String usedMessage;
|
||||
/* */ private int regainHealth;
|
||||
/* */
|
||||
/* */ public HealthPackage(JavaPlugin plugin) {
|
||||
/* 26 */ this.plugin = plugin;
|
||||
/* 27 */ this.usedMessage = plugin.getConfig().getString("health-package.restore-health-message", "You have restored your health");
|
||||
/* 28 */ this.regainHealth = plugin.getConfig().getInt("health-package.restore-health");
|
||||
/* 29 */ this.healthPackage = createHealthPackage();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ public void onInteract(PlayerInteractEvent e) {
|
||||
/* 34 */ Player player = e.getPlayer();
|
||||
/* 35 */ ItemStack item = player.getInventory().getItemInMainHand();
|
||||
/* */
|
||||
/* 37 */ if (!player.getWorld().equals(Spawn.getWorld())) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 40 */ if (player.getInventory().getItemInMainHand().isSimilar(this.healthPackage)) {
|
||||
/* 41 */ if (e.getAction().equals(Action.LEFT_CLICK_BLOCK) || e.getAction().equals(Action.LEFT_CLICK_AIR)) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 44 */ player.setHealth(this.regainHealth);
|
||||
/* 45 */ player.sendMessage(ChatColor.translateAlternateColorCodes('&', "usedMessage"));
|
||||
/* */
|
||||
/* 47 */ if (item.getAmount() == 1) {
|
||||
/* 48 */ player.getInventory().setItemInMainHand(null);
|
||||
/* */ } else {
|
||||
/* */
|
||||
/* 51 */ item.setAmount(item.getAmount() - 1);
|
||||
/* */ }
|
||||
/* 53 */ e.setCancelled(true);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ public ItemStack createHealthPackage() {
|
||||
/* 57 */ String base64 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGExNTU4YTgzZjQwMjZkYjIzMmY4MGJjOTYxNWNjM2JhNDE1ZGM0MDk0MGE1YTEzYWUyYThjOTBiMTVjM2MzZSJ9fX0=";
|
||||
/* */
|
||||
/* 59 */ ItemStack healthPackage = SkullCreator.itemFromBase64(base64);
|
||||
/* 60 */ ItemMeta meta = healthPackage.getItemMeta();
|
||||
/* 61 */ meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("health-package.name")));
|
||||
/* 62 */ healthPackage.setItemMeta(meta);
|
||||
/* */
|
||||
/* 64 */ return healthPackage;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ public void onDeath(PlayerDeathEvent e) {
|
||||
/* 69 */ Player player = e.getEntity();
|
||||
/* */
|
||||
/* 71 */ if (!player.getWorld().equals(Spawn.getWorld())) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 74 */ if (player.getWorld().equals(Spawn.getWorld())) {
|
||||
/* 75 */ player.getKiller().getInventory().addItem(new ItemStack[] { this.healthPackage });
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void onDeath(GunKillEvent e) {
|
||||
/* 81 */ if (e.getDead() instanceof Player)
|
||||
/* 82 */ e.getKiller().getInventory().addItem(new ItemStack[] { this.healthPackage });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ public void refresh() {}
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\HealthPackage.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,80 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
|
||||
/* */
|
||||
/* */ import com.destroystokyo.paper.event.player.PlayerJumpEvent;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
|
||||
/* */ import java.util.HashMap;
|
||||
/* */ import java.util.Map;
|
||||
/* */ import java.util.UUID;
|
||||
/* */ import org.bukkit.ChatColor;
|
||||
/* */ import org.bukkit.GameMode;
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.EventHandler;
|
||||
/* */ import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||
/* */ import org.bukkit.plugin.Plugin;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */ import org.bukkit.scheduler.BukkitRunnable;
|
||||
/* */
|
||||
/* */ public final class Jumper
|
||||
/* */ implements ConfigUser
|
||||
/* */ {
|
||||
/* 20 */ private static final Map<UUID, Long> playersOnCoolDown = new HashMap<>();
|
||||
/* */ private final JavaPlugin plugin;
|
||||
/* */ private Integer coolDownTime;
|
||||
/* */
|
||||
/* */ public Jumper(JavaPlugin plugin) {
|
||||
/* 25 */ this.plugin = plugin;
|
||||
/* 26 */ this.coolDownTime = Integer.valueOf(plugin.getConfig().getInt("double-jump.cooldown"));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void onPlayerJump(PlayerJumpEvent e) {
|
||||
/* 33 */ Player player = e.getPlayer();
|
||||
/* 34 */ GameMode mode = player.getGameMode();
|
||||
/* */
|
||||
/* 36 */ if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 39 */ if (playersOnCoolDown.containsKey(player.getUniqueId())) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 42 */ player.setAllowFlight(true);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void onFlightAccessChange(PlayerToggleFlightEvent e) {
|
||||
/* 48 */ final Player player = e.getPlayer();
|
||||
/* 49 */ GameMode mode = player.getGameMode();
|
||||
/* */
|
||||
/* 51 */ if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) {
|
||||
/* */ return;
|
||||
/* */ }
|
||||
/* 54 */ e.setCancelled(true);
|
||||
/* 55 */ player.setAllowFlight(false);
|
||||
/* */
|
||||
/* 57 */ player.setVelocity(player.getLocation().getDirection().multiply(0.5D).setY(0.5D));
|
||||
/* */
|
||||
/* 59 */ playersOnCoolDown.put(player.getPlayer().getUniqueId(), Long.valueOf((this.coolDownTime.intValue() * 1000) + System.currentTimeMillis()));
|
||||
/* */
|
||||
/* 61 */ (new BukkitRunnable()
|
||||
/* */ {
|
||||
/* */ public void run() {
|
||||
/* 64 */ Jumper.playersOnCoolDown.remove(player.getPlayer().getUniqueId());
|
||||
/* 65 */ player.sendMessage(ChatColor.translateAlternateColorCodes('&', Jumper.this.plugin.getConfig().getString("double-jump.cooldown-finish-message")));
|
||||
/* */ }
|
||||
/* 67 */ }).runTaskLater((Plugin)this.plugin, 20L * this.coolDownTime.intValue());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void refresh() {
|
||||
/* 72 */ this.coolDownTime = Integer.valueOf(this.plugin.getConfig().getInt("double-jump.cooldown"));
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\Jumper.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,57 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
|
||||
/* */
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
|
||||
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
|
||||
/* */ import org.bukkit.Material;
|
||||
/* */ import org.bukkit.entity.Player;
|
||||
/* */ import org.bukkit.event.EventHandler;
|
||||
/* */ import org.bukkit.event.EventPriority;
|
||||
/* */ import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
/* */ import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
/* */ import org.bukkit.inventory.ItemStack;
|
||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class SpawnController
|
||||
/* */ implements ConfigUser
|
||||
/* */ {
|
||||
/* */ private final JavaPlugin plugin;
|
||||
/* */
|
||||
/* */ public SpawnController(JavaPlugin plugin) {
|
||||
/* 21 */ this.plugin = plugin;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @EventHandler
|
||||
/* */ private void onDeath(PlayerDeathEvent e) {
|
||||
/* 26 */ Player player = e.getEntity();
|
||||
/* */
|
||||
/* 28 */ if (player.getWorld().equals(Spawn.getWorld()))
|
||||
/* 29 */ player.getInventory().clear();
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ @EventHandler(priority = EventPriority.HIGH)
|
||||
/* */ private void onRespawn(PlayerRespawnEvent e) {
|
||||
/* 34 */ if (e.getPlayer().getWorld().equals(Spawn.getWorld())) {
|
||||
/* 35 */ e.setRespawnLocation(Spawn.getSpawn());
|
||||
/* 36 */ giveItems(e.getPlayer());
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private void giveItems(Player player) {
|
||||
/* 42 */ player.getInventory().addItem(new ItemStack[] { (new Gun(this.plugin)).createItem() });
|
||||
/* 43 */ player.getInventory().addItem(new ItemStack[] { (new Grenade(this.plugin)).createItem() });
|
||||
/* 44 */ player.getInventory().addItem(new ItemStack[] { new ItemStack(Material.WOODEN_SWORD) });
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ public void refresh() {
|
||||
/* 49 */ Spawn.loadConfig(this.plugin);
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strike\listeners\SpawnController.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
@ -0,0 +1,320 @@
|
||||
/* */ package io.github.simplexdev.simplexcore.strike.utils;
|
||||
/* */
|
||||
/* */ import com.mojang.authlib.GameProfile;
|
||||
/* */ import com.mojang.authlib.properties.Property;
|
||||
/* */ import java.lang.reflect.Field;
|
||||
/* */ import java.lang.reflect.Method;
|
||||
/* */ import java.net.URI;
|
||||
/* */ import java.net.URISyntaxException;
|
||||
/* */ import java.util.Base64;
|
||||
/* */ import java.util.UUID;
|
||||
/* */ import org.bukkit.Bukkit;
|
||||
/* */ import org.bukkit.Material;
|
||||
/* */ import org.bukkit.SkullType;
|
||||
/* */ import org.bukkit.block.Block;
|
||||
/* */ import org.bukkit.block.Skull;
|
||||
/* */ import org.bukkit.inventory.ItemStack;
|
||||
/* */ import org.bukkit.inventory.meta.ItemMeta;
|
||||
/* */ import org.bukkit.inventory.meta.SkullMeta;
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public class SkullCreator
|
||||
/* */ {
|
||||
/* */ private static boolean warningPosted = false;
|
||||
/* */ private static Field blockProfileField;
|
||||
/* */ private static Method metaSetProfileMethod;
|
||||
/* */ private static Field metaProfileField;
|
||||
/* */
|
||||
/* */ public static ItemStack createSkull() {
|
||||
/* 36 */ checkLegacy();
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 39 */ return new ItemStack(Material.valueOf("PLAYER_HEAD"));
|
||||
/* 40 */ } catch (IllegalArgumentException e) {
|
||||
/* 41 */ return new ItemStack(Material.valueOf("SKULL_ITEM"), 1, (short)3);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemFromName(String name) {
|
||||
/* 53 */ return itemWithName(createSkull(), name);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemFromUuid(UUID id) {
|
||||
/* 63 */ return itemWithUuid(createSkull(), id);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemFromUrl(String url) {
|
||||
/* 73 */ return itemWithUrl(createSkull(), url);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemFromBase64(String base64) {
|
||||
/* 83 */ return itemWithBase64(createSkull(), base64);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @Deprecated
|
||||
/* */ public static ItemStack itemWithName(ItemStack item, String name) {
|
||||
/* 96 */ notNull(item, "item");
|
||||
/* 97 */ notNull(name, "name");
|
||||
/* */
|
||||
/* 99 */ SkullMeta meta = (SkullMeta)item.getItemMeta();
|
||||
/* 100 */ meta.setOwner(name);
|
||||
/* 101 */ item.setItemMeta((ItemMeta)meta);
|
||||
/* */
|
||||
/* 103 */ return item;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemWithUuid(ItemStack item, UUID id) {
|
||||
/* 114 */ notNull(item, "item");
|
||||
/* 115 */ notNull(id, "id");
|
||||
/* */
|
||||
/* 117 */ SkullMeta meta = (SkullMeta)item.getItemMeta();
|
||||
/* 118 */ meta.setOwner(Bukkit.getOfflinePlayer(id).getName());
|
||||
/* 119 */ item.setItemMeta((ItemMeta)meta);
|
||||
/* */
|
||||
/* 121 */ return item;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemWithUrl(ItemStack item, String url) {
|
||||
/* 132 */ notNull(item, "item");
|
||||
/* 133 */ notNull(url, "url");
|
||||
/* */
|
||||
/* 135 */ return itemWithBase64(item, urlToBase64(url));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static ItemStack itemWithBase64(ItemStack item, String base64) {
|
||||
/* 146 */ notNull(item, "item");
|
||||
/* 147 */ notNull(base64, "base64");
|
||||
/* */
|
||||
/* 149 */ if (!(item.getItemMeta() instanceof SkullMeta)) {
|
||||
/* 150 */ return null;
|
||||
/* */ }
|
||||
/* 152 */ SkullMeta meta = (SkullMeta)item.getItemMeta();
|
||||
/* 153 */ mutateItemMeta(meta, base64);
|
||||
/* 154 */ item.setItemMeta((ItemMeta)meta);
|
||||
/* */
|
||||
/* 156 */ return item;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ @Deprecated
|
||||
/* */ public static void blockWithName(Block block, String name) {
|
||||
/* 168 */ notNull(block, "block");
|
||||
/* 169 */ notNull(name, "name");
|
||||
/* */
|
||||
/* 171 */ Skull state = (Skull)block.getState();
|
||||
/* 172 */ state.setOwner(name);
|
||||
/* 173 */ state.update(false, false);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void blockWithUuid(Block block, UUID id) {
|
||||
/* 183 */ notNull(block, "block");
|
||||
/* 184 */ notNull(id, "id");
|
||||
/* */
|
||||
/* 186 */ setToSkull(block);
|
||||
/* 187 */ Skull state = (Skull)block.getState();
|
||||
/* 188 */ state.setOwner(Bukkit.getOfflinePlayer(id).getName());
|
||||
/* 189 */ state.update(false, false);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void blockWithUrl(Block block, String url) {
|
||||
/* 199 */ notNull(block, "block");
|
||||
/* 200 */ notNull(url, "url");
|
||||
/* */
|
||||
/* 202 */ blockWithBase64(block, urlToBase64(url));
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ public static void blockWithBase64(Block block, String base64) {
|
||||
/* 212 */ notNull(block, "block");
|
||||
/* 213 */ notNull(base64, "base64");
|
||||
/* */
|
||||
/* 215 */ setToSkull(block);
|
||||
/* 216 */ Skull state = (Skull)block.getState();
|
||||
/* 217 */ mutateBlockState(state, base64);
|
||||
/* 218 */ state.update(false, false);
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static void setToSkull(Block block) {
|
||||
/* 222 */ checkLegacy();
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 225 */ block.setType(Material.valueOf("PLAYER_HEAD"), false);
|
||||
/* 226 */ } catch (IllegalArgumentException e) {
|
||||
/* 227 */ block.setType(Material.valueOf("SKULL"), false);
|
||||
/* 228 */ Skull state = (Skull)block.getState();
|
||||
/* 229 */ state.setSkullType(SkullType.PLAYER);
|
||||
/* 230 */ state.update(false, false);
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static void notNull(Object o, String name) {
|
||||
/* 235 */ if (o == null) {
|
||||
/* 236 */ throw new NullPointerException(name + " should not be null!");
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static String urlToBase64(String url) {
|
||||
/* */ URI actualUrl;
|
||||
/* */ try {
|
||||
/* 244 */ actualUrl = new URI(url);
|
||||
/* 245 */ } catch (URISyntaxException e) {
|
||||
/* 246 */ throw new RuntimeException(e);
|
||||
/* */ }
|
||||
/* 248 */ String toEncode = "{\"textures\":{\"SKIN\":{\"url\":\"" + actualUrl.toString() + "\"}}}";
|
||||
/* 249 */ return Base64.getEncoder().encodeToString(toEncode.getBytes());
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static GameProfile makeProfile(String b64) {
|
||||
/* 256 */ UUID id = new UUID(b64.substring(b64.length() - 20).hashCode(), b64.substring(b64.length() - 10).hashCode());
|
||||
/* */
|
||||
/* 258 */ GameProfile profile = new GameProfile(id, "aaaaa");
|
||||
/* 259 */ profile.getProperties().put("textures", new Property("textures", b64));
|
||||
/* 260 */ return profile;
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static void mutateBlockState(Skull block, String b64) {
|
||||
/* */ try {
|
||||
/* 265 */ if (blockProfileField == null) {
|
||||
/* 266 */ blockProfileField = block.getClass().getDeclaredField("profile");
|
||||
/* 267 */ blockProfileField.setAccessible(true);
|
||||
/* */ }
|
||||
/* 269 */ blockProfileField.set(block, makeProfile(b64));
|
||||
/* 270 */ } catch (NoSuchFieldException|IllegalAccessException e) {
|
||||
/* 271 */ e.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */ private static void mutateItemMeta(SkullMeta meta, String b64) {
|
||||
/* */ try {
|
||||
/* 277 */ if (metaSetProfileMethod == null) {
|
||||
/* 278 */ metaSetProfileMethod = meta.getClass().getDeclaredMethod("setProfile", new Class[] { GameProfile.class });
|
||||
/* 279 */ metaSetProfileMethod.setAccessible(true);
|
||||
/* */ }
|
||||
/* 281 */ metaSetProfileMethod.invoke(meta, new Object[] { makeProfile(b64) });
|
||||
/* 282 */ } catch (NoSuchMethodException|IllegalAccessException|java.lang.reflect.InvocationTargetException ex) {
|
||||
/* */
|
||||
/* */
|
||||
/* */ try {
|
||||
/* 286 */ if (metaProfileField == null) {
|
||||
/* 287 */ metaProfileField = meta.getClass().getDeclaredField("profile");
|
||||
/* 288 */ metaProfileField.setAccessible(true);
|
||||
/* */ }
|
||||
/* 290 */ metaProfileField.set(meta, makeProfile(b64));
|
||||
/* */ }
|
||||
/* 292 */ catch (NoSuchFieldException|IllegalAccessException ex2) {
|
||||
/* 293 */ ex2.printStackTrace();
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */ }
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* */ private static void checkLegacy() {
|
||||
/* */ try {
|
||||
/* 305 */ Material.class.getDeclaredField("PLAYER_HEAD");
|
||||
/* 306 */ Material.valueOf("SKULL");
|
||||
/* */
|
||||
/* 308 */ if (!warningPosted) {
|
||||
/* 309 */ Bukkit.getLogger().warning("SKULLCREATOR API - Using the legacy bukkit API with 1.13+ bukkit versions is not supported!");
|
||||
/* 310 */ warningPosted = true;
|
||||
/* */ }
|
||||
/* 312 */ } catch (NoSuchFieldException|IllegalArgumentException noSuchFieldException) {}
|
||||
/* */ }
|
||||
/* */ }
|
||||
|
||||
|
||||
/* Location: E:\Rishi\Codes\Java Projects\Minecraft Plugins\PaperMC\1.16.4\Server Testing\plugins\strike-1.0-SNAPSHOT.jar!\io\github\simplexdev\simplexcore\strik\\utils\SkullCreator.class
|
||||
* Java compiler version: 8 (52.0)
|
||||
* JD-Core Version: 1.1.3
|
||||
*/
|
27
Plugin/src/main/resources/config.yml
Normal file
27
Plugin/src/main/resources/config.yml
Normal file
@ -0,0 +1,27 @@
|
||||
double-jump:
|
||||
cooldown: 10 #Time in Seconds
|
||||
cooldown-finish-message: "Done"
|
||||
|
||||
gun:
|
||||
ammo: 30
|
||||
name: "Gun" #Gun Name
|
||||
damage: 3 #Damage Per Shoot
|
||||
reload-time: 2 #Time in Seconds
|
||||
range: 30 #Blocks the bullet can travel (must be below 120)
|
||||
|
||||
grenade:
|
||||
name: "Grenade" #Name of the Grenade
|
||||
explosion-time: 1 #Time in seconds
|
||||
|
||||
health-package:
|
||||
name: "&cHealth Package"
|
||||
restore-health: 20
|
||||
restore-health-message: "You have restored your health"
|
||||
|
||||
spawn:
|
||||
respawn-message: "you respawned" #respawn message
|
||||
world: "world" #the world name
|
||||
coords: #x,y,z coordinates of the spawn
|
||||
x: 0
|
||||
y: 0
|
||||
z: 0
|
10
Plugin/src/main/resources/plugin.yml
Normal file
10
Plugin/src/main/resources/plugin.yml
Normal file
@ -0,0 +1,10 @@
|
||||
name: Strike
|
||||
version: 1.0
|
||||
main: io.github.simplexdev.simplexcore.strike.StrikePlugin
|
||||
api-version: 1.16
|
||||
authors: [ SimplexDev ]
|
||||
description: FFA Minigame Plugin, U have a get a gun, grenade and a heal package, that you use to be the last man standing in the minigame
|
||||
commands:
|
||||
strike:
|
||||
usage: <command>
|
||||
description: null
|
Loading…
Reference in New Issue
Block a user