mirror of
https://github.com/SimplexDevelopment/StrikePlugin.git
synced 2024-12-23 01:17:36 +00:00
Fixes
This commit is contained in:
parent
c8e83cae42
commit
51770dee82
@ -3,8 +3,10 @@ package io.github.simplexdev.strike;
|
|||||||
import io.github.simplexdev.strike.api.ConfigUser;
|
import io.github.simplexdev.strike.api.ConfigUser;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import io.github.simplexdev.strike.api.Spawn;
|
||||||
import io.github.simplexdev.strike.api.utils.InventoryEditConfigManager;
|
import io.github.simplexdev.strike.api.utils.InventoryEditConfigManager;
|
||||||
import io.github.simplexdev.strike.listeners.InventoryEditGUI;
|
import io.github.simplexdev.strike.listeners.InventoryEditGUI;
|
||||||
|
import io.github.simplexdev.strike.listeners.SpawnController;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -45,6 +47,11 @@ public class StrikeCommand implements CommandExecutor {
|
|||||||
player.getInventory().setContents(new InventoryEditConfigManager(plugin).getInventory(player));
|
player.getInventory().setContents(new InventoryEditConfigManager(plugin).getInventory(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else if ("set-spawn".equalsIgnoreCase(args[0]) && sender instanceof Player) {
|
||||||
|
Player player = ((Player) sender);
|
||||||
|
new SpawnController(plugin).setSpawn(player.getLocation());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,15 @@
|
|||||||
package io.github.simplexdev.strike;
|
package io.github.simplexdev.strike;
|
||||||
|
|
||||||
import io.github.simplexdev.strike.api.Spawn;
|
import io.github.simplexdev.strike.api.Spawn;
|
||||||
import io.github.simplexdev.strike.api.utils.InventoryEditConfigManager;
|
|
||||||
import io.github.simplexdev.strike.listeners.*;
|
import io.github.simplexdev.strike.listeners.*;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
|
||||||
public final class StrikePlugin extends JavaPlugin {
|
public final class StrikePlugin extends JavaPlugin {
|
||||||
//TODO
|
//TODO
|
||||||
// Full Ammo after dead
|
|
||||||
// Fall Damage Disable
|
// Fall Damage Disable
|
||||||
// Health Pack head not working
|
// Bullet through Grass, Glass, Fence, Gates, Bars
|
||||||
// Bullet through Grass
|
|
||||||
// Ammo CHat Remove
|
|
||||||
// NPC Edit
|
// NPC Edit
|
||||||
// SetSpawn
|
|
||||||
// LaunchPad
|
// LaunchPad
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -5,9 +5,3 @@ import org.bukkit.event.Listener;
|
|||||||
public interface ConfigUser extends Listener {
|
public interface ConfigUser extends Listener {
|
||||||
void refresh();
|
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
|
|
||||||
*/
|
|
@ -1,46 +1,53 @@
|
|||||||
/* */ package io.github.simplexdev.strike.api;
|
package io.github.simplexdev.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",spawn.getX());
|
|
||||||
/* 22 */ config.set("spawn.coords.y", spawn.getY());
|
|
||||||
/* 23 */ config.set("spawn.coords.z", 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;
|
|
||||||
/* */ }
|
|
||||||
/* */ }
|
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
/* 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
|
import java.io.File;
|
||||||
* Java compiler version: 8 (52.0)
|
import java.io.IOException;
|
||||||
* JD-Core Version: 1.1.3
|
|
||||||
*/
|
public class Spawn {
|
||||||
|
private static World world = null;
|
||||||
|
private static Location spawn = null;
|
||||||
|
|
||||||
|
public static void loadConfig(JavaPlugin plugin) {
|
||||||
|
FileConfiguration config = plugin.getConfig();
|
||||||
|
|
||||||
|
world = plugin.getServer().getWorld(config.getString("spawn.world"));
|
||||||
|
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) {
|
||||||
|
FileConfiguration config = plugin.getConfig();
|
||||||
|
config.set("spawn.coords.x", spawn.getX());
|
||||||
|
config.set("spawn.coords.y", spawn.getY());
|
||||||
|
config.set("spawn.coords.z", spawn.getZ());
|
||||||
|
try {
|
||||||
|
config.save(new File(config.getCurrentPath()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
Spawn.spawn = spawn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void setWorld(World world, JavaPlugin plugin) {
|
||||||
|
plugin.getConfig().set("spawn.world", world.getName());
|
||||||
|
try {
|
||||||
|
plugin.getConfig().save(new File(plugin.getConfig().getCurrentPath()));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Spawn.world = world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static World getWorld() {
|
||||||
|
return world;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Location getSpawn() {
|
||||||
|
return spawn;
|
||||||
|
}
|
||||||
|
}
|
@ -1,7 +0,0 @@
|
|||||||
package io.github.simplexdev.strike.api.utils;
|
|
||||||
|
|
||||||
public class InstanceStorage {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -5,7 +5,6 @@ import io.github.simplexdev.strike.listeners.Gun;
|
|||||||
import io.github.simplexdev.strike.listeners.HealthPackage;
|
import io.github.simplexdev.strike.listeners.HealthPackage;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.MemorySection;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -14,7 +13,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public class InventoryEditConfigManager {
|
public class InventoryEditConfigManager {
|
||||||
@ -106,6 +104,8 @@ public class InventoryEditConfigManager {
|
|||||||
return i;
|
return i;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,31 +1,25 @@
|
|||||||
package io.github.simplexdev.strike.api.utils;
|
package io.github.simplexdev.strike.api.utils;
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
import com.mojang.authlib.properties.Property;
|
import com.mojang.authlib.properties.Property;
|
||||||
import java.lang.reflect.Field;
|
import org.bukkit.Bukkit;
|
||||||
import java.lang.reflect.Method;
|
import org.bukkit.Material;
|
||||||
import java.net.URI;
|
import org.bukkit.SkullType;
|
||||||
import java.net.URISyntaxException;
|
import org.bukkit.block.Block;
|
||||||
import java.util.Base64;
|
import org.bukkit.block.Skull;
|
||||||
import java.util.UUID;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
import org.bukkit.SkullType;
|
|
||||||
import org.bukkit.block.Block;
|
import java.lang.reflect.Field;
|
||||||
import org.bukkit.block.Skull;
|
import java.lang.reflect.Method;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import java.net.URI;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import java.net.URISyntaxException;
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
import java.util.Base64;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
|
||||||
|
public class SkullCreator {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public class SkullCreator {
|
|
||||||
private static boolean warningPosted = false;
|
private static boolean warningPosted = false;
|
||||||
private static Field blockProfileField;
|
private static Field blockProfileField;
|
||||||
private static Method metaSetProfileMethod;
|
private static Method metaSetProfileMethod;
|
||||||
@ -237,4 +231,4 @@
|
|||||||
} catch (NoSuchFieldException | IllegalArgumentException noSuchFieldException) {
|
} catch (NoSuchFieldException | IllegalArgumentException noSuchFieldException) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,13 +1,10 @@
|
|||||||
package io.github.simplexdev.strike.events;
|
package io.github.simplexdev.strike.events;
|
||||||
|
|
||||||
import java.util.List;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.event.HandlerList;
|
||||||
import org.bukkit.event.Event;
|
|
||||||
import org.bukkit.event.HandlerList;
|
|
||||||
|
|
||||||
public class GrenadeKillEvent
|
public class GrenadeKillEvent extends Event {
|
||||||
extends Event {
|
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Player killer;
|
private final Player killer;
|
||||||
private final Player dead;
|
private final Player dead;
|
||||||
@ -33,4 +30,4 @@
|
|||||||
public static HandlerList getHandlerList() {
|
public static HandlerList getHandlerList() {
|
||||||
return handlers;
|
return handlers;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,42 +1,36 @@
|
|||||||
/* */ package io.github.simplexdev.strike.events;
|
package io.github.simplexdev.strike.events;
|
||||||
/* */
|
|
||||||
/* */ import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
/* */ import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
/* */ import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
/* */ import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
/* */
|
|
||||||
/* */ public class GunKillEvent
|
public class GunKillEvent extends Event {
|
||||||
/* */ extends Event {
|
private static final HandlerList handlers = new HandlerList();
|
||||||
/* 10 */ private static final HandlerList handlers = new HandlerList();
|
private final Player killer;
|
||||||
/* */ private final Player killer;
|
private final LivingEntity dead;
|
||||||
/* */ private final LivingEntity dead;
|
|
||||||
/* */
|
public GunKillEvent(Player killer, LivingEntity dead) {
|
||||||
/* */ public GunKillEvent(Player killer, LivingEntity dead) {
|
this.killer = killer;
|
||||||
/* 15 */ this.killer = killer;
|
this.dead = dead;
|
||||||
/* 16 */ this.dead = dead;
|
}
|
||||||
/* */ }
|
|
||||||
/* */
|
public Player getKiller() {
|
||||||
/* */ public Player getKiller() {
|
return this.killer;
|
||||||
/* 20 */ return this.killer;
|
}
|
||||||
/* */ }
|
|
||||||
/* */
|
public LivingEntity getDead() {
|
||||||
/* */ public LivingEntity getDead() {
|
return this.dead;
|
||||||
/* 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
|
public HandlerList getHandlers() {
|
||||||
* Java compiler version: 8 (52.0)
|
return handlers;
|
||||||
* JD-Core Version: 1.1.3
|
}
|
||||||
*/
|
|
||||||
|
|
||||||
|
public static HandlerList getHandlerList() {
|
||||||
|
return handlers;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.event.Event;
|
import org.bukkit.event.Event;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.block.Action;
|
import org.bukkit.event.block.Action;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -18,11 +19,14 @@ import org.bukkit.plugin.Plugin;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class Gun implements ConfigUser {
|
public class Gun implements ConfigUser {
|
||||||
private static final HashMap<ItemStack, Integer> ammoMap = new HashMap<>();
|
private static final HashMap<Player, Integer> ammoMap = new HashMap<>();
|
||||||
|
private static final List<Material> passThroughBlocks = setPassThroughBlocks();
|
||||||
|
|
||||||
private final ItemStack gunItemStack;
|
private final ItemStack gunItemStack;
|
||||||
|
|
||||||
@ -32,6 +36,38 @@ public class Gun implements ConfigUser {
|
|||||||
|
|
||||||
private int maxDistance;
|
private int maxDistance;
|
||||||
|
|
||||||
|
private static List<Material> setPassThroughBlocks() {
|
||||||
|
ArrayList<Material> blocks = new ArrayList<>();
|
||||||
|
blocks.add(Material.TALL_GRASS);
|
||||||
|
blocks.add(Material.IRON_BARS);
|
||||||
|
blocks.add(Material.ACACIA_FENCE);
|
||||||
|
blocks.add(Material.BIRCH_FENCE);
|
||||||
|
blocks.add(Material.CRIMSON_FENCE);
|
||||||
|
blocks.add(Material.JUNGLE_FENCE);
|
||||||
|
blocks.add(Material.OAK_FENCE);
|
||||||
|
blocks.add(Material.SPRUCE_FENCE);
|
||||||
|
blocks.add(Material.WARPED_FENCE);
|
||||||
|
blocks.add(Material.DARK_OAK_FENCE);
|
||||||
|
blocks.add(Material.NETHER_BRICK_FENCE);
|
||||||
|
blocks.add(Material.WALL_TORCH);
|
||||||
|
blocks.add(Material.TORCH);
|
||||||
|
blocks.add(Material.REDSTONE_TORCH);
|
||||||
|
blocks.add(Material.REDSTONE_WALL_TORCH);
|
||||||
|
blocks.add(Material.SOUL_TORCH);
|
||||||
|
blocks.add(Material.ACACIA_FENCE_GATE);
|
||||||
|
blocks.add(Material.BIRCH_FENCE_GATE);
|
||||||
|
blocks.add(Material.CRIMSON_FENCE_GATE);
|
||||||
|
blocks.add(Material.JUNGLE_FENCE_GATE);
|
||||||
|
blocks.add(Material.OAK_FENCE_GATE);
|
||||||
|
blocks.add(Material.SPRUCE_FENCE_GATE);
|
||||||
|
blocks.add(Material.WARPED_FENCE_GATE);
|
||||||
|
blocks.add(Material.DARK_OAK_FENCE_GATE);
|
||||||
|
blocks.add(Material.WATER);
|
||||||
|
blocks.add(Material.LAVA);
|
||||||
|
|
||||||
|
return blocks;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Gun(JavaPlugin plugin) {
|
public Gun(JavaPlugin plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
@ -76,6 +112,12 @@ public class Gun implements ConfigUser {
|
|||||||
}).runTaskTimer((Plugin) this.plugin, 0L, 7L);
|
}).runTaskTimer((Plugin) this.plugin, 0L, 7L);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onDeath(PlayerDeathEvent e) {
|
||||||
|
if (ammoMap.containsKey(e.getEntity()))
|
||||||
|
ammoMap.replace(e.getEntity(), maxAmmo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
private void onRightClick(PlayerInteractEvent e) {
|
private void onRightClick(PlayerInteractEvent e) {
|
||||||
@ -89,7 +131,7 @@ public class Gun implements ConfigUser {
|
|||||||
int ammo = this.maxAmmo;
|
int ammo = this.maxAmmo;
|
||||||
|
|
||||||
if (!ammoMap.containsKey(itemStack)) {
|
if (!ammoMap.containsKey(itemStack)) {
|
||||||
ammoMap.put(itemStack, Integer.valueOf(this.maxAmmo - 1));
|
ammoMap.put(player, Integer.valueOf(this.maxAmmo - 1));
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
ammo = ((Integer) ammoMap.get(itemStack)).intValue();
|
ammo = ((Integer) ammoMap.get(itemStack)).intValue();
|
||||||
@ -97,22 +139,20 @@ public class Gun implements ConfigUser {
|
|||||||
if (ammo == 1) {
|
if (ammo == 1) {
|
||||||
(new BukkitRunnable() {
|
(new BukkitRunnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
Gun.ammoMap.replace(itemStack, Integer.valueOf(Gun.this.maxAmmo));
|
Gun.ammoMap.replace(player, Integer.valueOf(Gun.this.maxAmmo));
|
||||||
}
|
}
|
||||||
}).runTaskLater((Plugin) this.plugin, 20L * this.plugin.getConfig().getInt("gun.reload-time"));
|
}).runTaskLater((Plugin) this.plugin, 20L * this.plugin.getConfig().getInt("gun.reload-time"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (((Integer) ammoMap.get(itemStack)).intValue() != 0) {
|
if (((Integer) ammoMap.get(itemStack)).intValue() != 0) {
|
||||||
ammoMap.replace(itemStack, Integer.valueOf(ammo - 1));
|
ammoMap.replace(player, Integer.valueOf(ammo - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ammo <= 0) {
|
if (ammo <= 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
player.sendMessage(String.valueOf(ammo));
|
|
||||||
|
|
||||||
spawnParticle(player, player.getEyeLocation().clone(), 0.0D);
|
Entity entity = getEntity(player, player.getEyeLocation().clone(), 0.0D);
|
||||||
Entity entity = player.getTargetEntity(this.maxDistance);
|
|
||||||
|
|
||||||
if (!(entity instanceof LivingEntity)) {
|
if (!(entity instanceof LivingEntity)) {
|
||||||
return;
|
return;
|
||||||
@ -128,7 +168,7 @@ public class Gun implements ConfigUser {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void spawnParticle(Player player, Location location, double distance) {
|
private Entity getEntity(Player player, Location location, double distance) {
|
||||||
World world = location.getWorld();
|
World world = location.getWorld();
|
||||||
|
|
||||||
location.add(location.getDirection().multiply(0.1D));
|
location.add(location.getDirection().multiply(0.1D));
|
||||||
@ -136,15 +176,17 @@ public class Gun implements ConfigUser {
|
|||||||
|
|
||||||
distance += 0.1D;
|
distance += 0.1D;
|
||||||
|
|
||||||
if (location.getBlock().getType() != Material.AIR || distance > this.maxDistance) {
|
if (!passThroughBlocks.contains(location.getBlock().getType()) || distance > this.maxDistance) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
Collection<LivingEntity> entities = location.getNearbyLivingEntities(0.1D);
|
Collection<LivingEntity> entities = location.getNearbyLivingEntities(0.1D);
|
||||||
|
|
||||||
if (!entities.isEmpty() && entities.size() == 1 && !entities.contains(player)) {
|
if (!entities.isEmpty() && entities.size() == 1 && !entities.contains(player)) {
|
||||||
return;
|
return entities.iterator().next();
|
||||||
}
|
}
|
||||||
spawnParticle(player, location, distance);
|
Entity entity = getEntity(player, location, distance);
|
||||||
|
|
||||||
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -16,8 +16,7 @@
|
|||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
public class HealthPackage
|
public class HealthPackage implements ConfigUser {
|
||||||
implements ConfigUser {
|
|
||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
private ItemStack healthPackage;
|
private ItemStack healthPackage;
|
||||||
private String usedMessage;
|
private String usedMessage;
|
||||||
@ -56,7 +55,7 @@
|
|||||||
public ItemStack createItem() {
|
public ItemStack createItem() {
|
||||||
String base64 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGExNTU4YTgzZjQwMjZkYjIzMmY4MGJjOTYxNWNjM2JhNDE1ZGM0MDk0MGE1YTEzYWUyYThjOTBiMTVjM2MzZSJ9fX0=";
|
String base64 = "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGExNTU4YTgzZjQwMjZkYjIzMmY4MGJjOTYxNWNjM2JhNDE1ZGM0MDk0MGE1YTEzYWUyYThjOTBiMTVjM2MzZSJ9fX0=";
|
||||||
|
|
||||||
ItemStack healthPackage = SkullCreator.itemFromBase64(base64);
|
ItemStack healthPackage = SkullCreator.itemWithUrl(SkullCreator.createSkull(), base64);
|
||||||
ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(Material.PLAYER_HEAD);
|
ItemMeta meta = plugin.getServer().getItemFactory().getItemMeta(Material.PLAYER_HEAD);
|
||||||
|
|
||||||
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("health-package.name")));
|
meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', this.plugin.getConfig().getString("health-package.name")));
|
||||||
|
@ -1,80 +1,75 @@
|
|||||||
/* */ package io.github.simplexdev.strike.listeners;
|
package io.github.simplexdev.strike.listeners;
|
||||||
/* */
|
|
||||||
/* */ import com.destroystokyo.paper.event.player.PlayerJumpEvent;
|
import com.destroystokyo.paper.event.player.PlayerJumpEvent;
|
||||||
/* */ import io.github.simplexdev.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.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.player.PlayerToggleFlightEvent;
|
import org.bukkit.event.player.PlayerMoveEvent;
|
||||||
/* */ import org.bukkit.plugin.Plugin;
|
import org.bukkit.event.player.PlayerToggleFlightEvent;
|
||||||
/* */ import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
/* */ import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
/* */
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
/* */ public class Jumper implements ConfigUser
|
|
||||||
/* */ {
|
import java.util.HashMap;
|
||||||
/* 20 */ private static final Map<UUID, Long> playersOnCoolDown = new HashMap<>();
|
import java.util.Map;
|
||||||
/* */ private final JavaPlugin plugin;
|
import java.util.UUID;
|
||||||
/* */ private Integer coolDownTime;
|
|
||||||
/* */
|
public class Jumper implements ConfigUser {
|
||||||
/* */ public Jumper(JavaPlugin plugin) {
|
private static final Map<UUID, Long> playersOnCoolDown = new HashMap<>();
|
||||||
/* 25 */ this.plugin = plugin;
|
private final JavaPlugin plugin;
|
||||||
/* 26 */ this.coolDownTime = Integer.valueOf(plugin.getConfig().getInt("double-jump.cooldown"));
|
private Integer coolDownTime;
|
||||||
/* */ }
|
|
||||||
/* */
|
public Jumper(JavaPlugin plugin) {
|
||||||
/* */
|
this.plugin = plugin;
|
||||||
/* */
|
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
|
@EventHandler
|
||||||
* Java compiler version: 8 (52.0)
|
private void onPlayerMove(PlayerMoveEvent e) {
|
||||||
* JD-Core Version: 1.1.3
|
Player player = e.getPlayer();
|
||||||
*/
|
GameMode mode = player.getGameMode();
|
||||||
|
|
||||||
|
if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.setAllowFlight(true);
|
||||||
|
|
||||||
|
if (playersOnCoolDown.containsKey(player.getUniqueId())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
private void onFlightAccessChange(PlayerToggleFlightEvent e) {
|
||||||
|
final Player player = e.getPlayer();
|
||||||
|
GameMode mode = player.getGameMode();
|
||||||
|
|
||||||
|
if (mode == GameMode.CREATIVE || mode == GameMode.SPECTATOR) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
player.setAllowFlight(false);
|
||||||
|
e.setCancelled(true);
|
||||||
|
|
||||||
|
player.setVelocity(player.getLocation().getDirection().multiply(0.5D).setY(0.5D));
|
||||||
|
|
||||||
|
playersOnCoolDown.put(player.getPlayer().getUniqueId(), Long.valueOf((this.coolDownTime.intValue() * 1000) + System.currentTimeMillis()));
|
||||||
|
|
||||||
|
(new BukkitRunnable() {
|
||||||
|
public void run() {
|
||||||
|
Jumper.playersOnCoolDown.remove(player.getPlayer().getUniqueId());
|
||||||
|
player.sendMessage(ChatColor.translateAlternateColorCodes('&', Jumper.this.plugin.getConfig().getString("double-jump.cooldown-finish-message")));
|
||||||
|
}
|
||||||
|
}).runTaskLater((Plugin) this.plugin, 20L * this.coolDownTime.intValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public void refresh() {
|
||||||
|
this.coolDownTime = Integer.valueOf(this.plugin.getConfig().getInt("double-jump.cooldown"));
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,7 @@ package io.github.simplexdev.strike.listeners;
|
|||||||
import io.github.simplexdev.strike.api.ConfigUser;
|
import io.github.simplexdev.strike.api.ConfigUser;
|
||||||
import io.github.simplexdev.strike.api.Spawn;
|
import io.github.simplexdev.strike.api.Spawn;
|
||||||
import io.github.simplexdev.strike.api.utils.InventoryEditConfigManager;
|
import io.github.simplexdev.strike.api.utils.InventoryEditConfigManager;
|
||||||
|
import org.bukkit.Location;
|
||||||
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.EventPriority;
|
||||||
@ -11,8 +12,7 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
|
||||||
|
|
||||||
public class SpawnController
|
public class SpawnController implements ConfigUser {
|
||||||
implements ConfigUser {
|
|
||||||
private final JavaPlugin plugin;
|
private final JavaPlugin plugin;
|
||||||
|
|
||||||
public SpawnController(JavaPlugin plugin) {
|
public SpawnController(JavaPlugin plugin) {
|
||||||
@ -35,6 +35,11 @@ public class SpawnController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setSpawn(Location location) {
|
||||||
|
Spawn.setSpawn(location, plugin);
|
||||||
|
Spawn.setWorld(location.getWorld(), plugin);
|
||||||
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
Spawn.loadConfig(this.plugin);
|
Spawn.loadConfig(this.plugin);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user