This commit is contained in:
Marco-Byte-1 2021-03-05 15:02:12 +05:30
parent c55694a229
commit 39f8c25db1
22 changed files with 402 additions and 427 deletions

View File

@ -41,7 +41,7 @@ processResources {
task copyJar(type: Copy) {
from jar
into "C:/Users/Valdemar/Desktop/mc/TestServer1.16.5/plugins"
into "E:\\Rishi\\Codes\\Java Projects\\Minecraft Plugins\\PaperMC\\1.16.4\\Server Testing\\plugins"
}
build.finalizedBy copyJar

View File

@ -1,47 +0,0 @@
/* */ 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
*/

View File

@ -1,57 +0,0 @@
/* */ 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
*/

View File

@ -1,44 +0,0 @@
/* */ 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
*/

View File

@ -1,35 +0,0 @@
/* */ 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
*/

View File

@ -1,127 +0,0 @@
/* */ 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
*/

View File

@ -1,92 +0,0 @@
/* */ 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
*/

View File

@ -0,0 +1,38 @@
package io.github.simplexdev.strike;
import io.github.simplexdev.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) {
this.plugin = plugin;
}
public static void loadInstances(ConfigUser... configUsers) {
StrikeCommand.configUsers = configUsers;
}
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (args[0].isEmpty() || args.length > 1) {
return true;
}
if ("reload".equals(args[0].toLowerCase())) {
this.plugin.reloadConfig();
Arrays.<ConfigUser>stream(configUsers).forEach(configUser -> configUser.refresh());
}
return true;
}
}

View File

@ -0,0 +1,38 @@
package io.github.simplexdev.strike;
import io.github.simplexdev.strike.api.ConfigUser;
import io.github.simplexdev.strike.api.Spawn;
import io.github.simplexdev.strike.listeners.*;
import org.bukkit.event.Listener;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
public final class StrikePlugin extends JavaPlugin {
@Override
public void onEnable() {
saveDefaultConfig();
Spawn.loadConfig(this);
Gun gun = new Gun(this);
Jumper jumper = new Jumper(this);
SpawnController spawnController = new SpawnController(this);
HealthPackage healthPackage = new HealthPackage(this);
getServer().getPluginManager().registerEvents(gun, this);
getServer().getPluginManager().registerEvents(jumper, this);
getServer().getPluginManager().registerEvents(spawnController, this);
getServer().getPluginManager().registerEvents(healthPackage, this);
getServer().getPluginManager().registerEvents(new Grenade(this), this);
getCommand("strike").setExecutor(new StrikeCommand(this));
StrikeCommand.loadInstances(gun, jumper, spawnController);
}
@Override
public void onDisable() {
}
}

View File

@ -1,4 +1,4 @@
package io.github.simplexdev.simplexcore.strike.api;
package io.github.simplexdev.strike.api;
import org.bukkit.event.Listener;

View File

@ -1,4 +1,4 @@
/* */ package io.github.simplexdev.simplexcore.strike.api;
/* */ package io.github.simplexdev.strike.api;
/* */
/* */ import org.bukkit.Location;
/* */ import org.bukkit.World;
@ -18,9 +18,9 @@
/* */
/* */ 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()));
/* 21 */ config.set("spawn.coords.x",spawn.getX());
/* 22 */ config.set("spawn.coords.y", spawn.getY());
/* 23 */ config.set("spawn.coords.z", spawn.getZ());
/* */
/* 25 */ Spawn.spawn = spawn;
/* */ }

View File

@ -0,0 +1,4 @@
package io.github.simplexdev.strike.api.utils;
public class InventoryEdit {
}

View File

@ -1,4 +1,4 @@
package io.github.simplexdev.simplexcore.strike.utils;
package io.github.simplexdev.strike.api.utils;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;

View File

@ -0,0 +1,36 @@
package io.github.simplexdev.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 {
private static final HandlerList handlers = new HandlerList();
private final Player killer;
private final Player dead;
public GrenadeKillEvent(Player killer, Player dead) {
this.killer = killer;
this.dead = dead;
}
public Player getKiller() {
return this.killer;
}
public Player getDead() {
return dead;
}
public HandlerList getHandlers() {
return handlers;
}
public static HandlerList getHandlerList() {
return handlers;
}
}

View File

@ -1,4 +1,4 @@
/* */ package io.github.simplexdev.simplexcore.strike.events;
/* */ package io.github.simplexdev.strike.events;
/* */
/* */ import org.bukkit.entity.LivingEntity;
/* */ import org.bukkit.entity.Player;

View File

@ -0,0 +1,129 @@
package io.github.simplexdev.strike.listeners;
import io.github.simplexdev.strike.api.ConfigUser;
import io.github.simplexdev.strike.api.Spawn;
import io.github.simplexdev.strike.events.GrenadeKillEvent;
import org.bukkit.Bukkit;
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.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import java.util.*;
public class Grenade implements ConfigUser {
private static final List<Item> items = new ArrayList<>();
private static final Map<Player, List<Player>> map = new HashMap<>();
private final ItemStack grenadeItem;
private final JavaPlugin plugin;
private final int explosionTime;
public Grenade(JavaPlugin plugin) {
this.plugin = plugin;
this.grenadeItem = createItem();
this.explosionTime = plugin.getConfig().getInt("grenade.explosion-time", 1);
}
public ItemStack createItem() {
ItemStack stack = new ItemStack(Material.MAGMA_CREAM, 1);
ItemMeta meta = this.plugin.getServer().getItemFactory().getItemMeta(Material.MAGMA_CREAM);
meta.setDisplayName(ChatColor.RED + "Grenade");
stack.setItemMeta(meta);
this.plugin.getServer().getOnlinePlayers().forEach(player -> player.getInventory().addItem(new ItemStack[]{stack}));
return stack;
}
@EventHandler
private void throwGrenade(PlayerInteractEvent e) {
ItemStack itemStack = e.getItem();
final Player player = e.getPlayer();
if (!player.getWorld().equals(Spawn.getWorld()) || itemStack == null || !itemStack.isSimilar(this.grenadeItem) || e.getAction().toString().startsWith("LEFT")) {
return;
}
if (player.getGameMode() != GameMode.CREATIVE) {
if (itemStack.getAmount() == 1) {
itemStack = null;
} else {
itemStack.setAmount(itemStack.getAmount() - 1);
}
player.getInventory().setItemInMainHand(itemStack);
}
final Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.MAGMA_CREAM));
item.setVelocity(player.getEyeLocation().getDirection().multiply(0.75D));
(new BukkitRunnable() {
public void run() {
if (item != null) {
item.getLocation().createExplosion(4.0F, false, false);
Collection<LivingEntity> entities = item.getLocation().getNearbyLivingEntities(4.0D);
List<Player> players = new ArrayList<>();
entities.forEach(livingEntity -> {
if (livingEntity instanceof Player) {
players.add((Player) livingEntity);
}
});
Grenade.map.put(player, players);
Grenade.items.remove(item);
item.remove();
}
}
}).runTaskLater(this.plugin, (20 * this.explosionTime));
items.add(item);
}
@EventHandler
private void onPlayerDamage(EntityDamageEvent e) {
if (!e.getEntity().getWorld().equals(Spawn.getWorld()) || !(e.getEntity() instanceof Player))
return;
Player player = (Player) e.getEntity();
Player killer = null;
for (Map.Entry<Player, List<Player>> entry : map.entrySet()) {
if (entry.getValue().contains(player)) {
if (player.getHealth() <= e.getFinalDamage())
killer = entry.getKey();
entry.getValue().remove(player);
}
}
if (killer != null)
Bukkit.getPluginManager().callEvent(new GrenadeKillEvent(killer, player));
}
@EventHandler
private void cancelPickup(PlayerAttemptPickupItemEvent e) {
if (!items.contains(e.getItem()))
return;
e.setCancelled(true);
}
public void refresh() {
}
}

View File

@ -1,11 +1,13 @@
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
/* */ package io.github.simplexdev.strike.listeners;
/* */ import io.github.simplexdev.strike.api.ConfigUser;
import io.github.simplexdev.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 io.github.simplexdev.strike.events.GunKillEvent;
import org.bukkit.*;
/* */
/* */
/* */
/* */ import org.bukkit.entity.Entity;
/* */ import org.bukkit.entity.LivingEntity;
/* */ import org.bukkit.entity.Player;
@ -20,7 +22,7 @@
/* */ import org.bukkit.plugin.java.JavaPlugin;
/* */ import org.bukkit.scheduler.BukkitRunnable;
/* */
/* */ public final class Gun implements ConfigUser {
/* */ public class Gun implements ConfigUser {
/* 24 */ private static final HashMap<ItemStack, Integer> ammoMap = new HashMap<>();
/* */
/* */ private final ItemStack gunItemStack;

View File

@ -0,0 +1,98 @@
package io.github.simplexdev.strike.listeners;
import io.github.simplexdev.strike.api.ConfigUser;
import io.github.simplexdev.strike.api.Spawn;
import io.github.simplexdev.strike.events.GrenadeKillEvent;
import io.github.simplexdev.strike.events.GunKillEvent;
import io.github.simplexdev.strike.api.utils.SkullCreator;
import org.bukkit.ChatColor;
import org.bukkit.Material;
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 JavaPlugin plugin;
private ItemStack healthPackage;
private String usedMessage;
private int regainHealth;
public HealthPackage(JavaPlugin plugin) {
this.plugin = plugin;
refresh();
}
@EventHandler
public void onInteract(PlayerInteractEvent e) {
Player player = e.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
if (!player.getWorld().equals(Spawn.getWorld())) {
return;
}
if (player.getInventory().getItemInMainHand().isSimilar(this.healthPackage)) {
if (e.getAction().equals(Action.LEFT_CLICK_BLOCK) || e.getAction().equals(Action.LEFT_CLICK_AIR)) {
return;
}
player.setHealth(this.regainHealth);
player.sendMessage(ChatColor.translateAlternateColorCodes('&', usedMessage));
if (item.getAmount() == 1) {
player.getInventory().setItemInMainHand(null);
} else {
item.setAmount(item.getAmount() - 1);
}
e.setCancelled(true);
}
}
public ItemStack createHealthPackage() {
String base64 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGExNTU4YTgzZjQwMjZkYjIzMmY4MGJjOTYxNWNjM2JhNDE1ZGM0MDk0MGE1YTEzYWUyYThjOTBiMTVjM2MzZSJ9fX0=";
ItemStack healthPackage = SkullCreator.itemFromBase64(base64);
ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(Material.PLAYER_HEAD);
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("health-package.name")));
healthPackage.setItemMeta(meta);
return healthPackage;
}
@EventHandler
public void onDeath(PlayerDeathEvent e) {
Player player = e.getEntity();
if (player.getWorld().equals(Spawn.getWorld())) {
if (player.getKiller() != null)
player.getKiller().getInventory().addItem(new ItemStack[]{this.healthPackage});
e.getDrops().clear();
}
}
@EventHandler
private void onDeath(GunKillEvent e) {
if (e.getDead() instanceof Player)
e.getKiller().getInventory().addItem(new ItemStack[]{this.healthPackage});
}
@EventHandler
private void onDeath(GrenadeKillEvent e) {
e.getKiller().getInventory().addItem(this.healthPackage);
}
public void refresh() {
this.usedMessage = plugin.getConfig().getString("health-package.restore-health-message", "You have restored your health");
this.regainHealth = plugin.getConfig().getInt("health-package.restore-health");
this.healthPackage = createHealthPackage();
}
}

View File

@ -1,11 +1,12 @@
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
/* */ package io.github.simplexdev.strike.listeners;
/* */
/* */ import com.destroystokyo.paper.event.player.PlayerJumpEvent;
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
/* */ import io.github.simplexdev.strike.api.ConfigUser;
/* */ import java.util.HashMap;
/* */ import java.util.Map;
/* */ import java.util.UUID;
/* */ import org.bukkit.ChatColor;
/* */
import org.bukkit.ChatColor;
/* */ import org.bukkit.GameMode;
/* */ import org.bukkit.entity.Player;
/* */ import org.bukkit.event.EventHandler;
@ -14,8 +15,7 @@
/* */ import org.bukkit.plugin.java.JavaPlugin;
/* */ import org.bukkit.scheduler.BukkitRunnable;
/* */
/* */ public final class Jumper
/* */ implements ConfigUser
/* */ public class Jumper implements ConfigUser
/* */ {
/* 20 */ private static final Map<UUID, Long> playersOnCoolDown = new HashMap<>();
/* */ private final JavaPlugin plugin;

View File

@ -1,8 +1,9 @@
/* */ package io.github.simplexdev.simplexcore.strike.listeners;
/* */ package io.github.simplexdev.strike.listeners;
/* */
/* */ import io.github.simplexdev.simplexcore.strike.api.ConfigUser;
/* */ import io.github.simplexdev.simplexcore.strike.api.Spawn;
/* */ import org.bukkit.Material;
/* */ import io.github.simplexdev.strike.api.ConfigUser;
/* */ import io.github.simplexdev.strike.api.Spawn;
/* */
import org.bukkit.Material;
/* */ import org.bukkit.entity.Player;
/* */ import org.bukkit.event.EventHandler;
/* */ import org.bukkit.event.EventPriority;

View 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

View File

@ -1,4 +1,8 @@
name: Strike
version: @version@
main: io.github.simpledev.strike.Strike
main: io.github.simplexdev.strike.StrikePlugin
api-version: 1.16
commands:
strike:
usage: <command>
description: ok