This commit is contained in:
2025-09-05 22:34:44 +02:00
commit cfa2364059
4 changed files with 754 additions and 0 deletions

113
.gitignore vendored Normal file
View File

@@ -0,0 +1,113 @@
# User-specific stuff
.idea/
*.iml
*.ipr
*.iws
# IntelliJ
out/
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two \r
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
.mvn/wrapper/maven-wrapper.jar
.flattened-pom.xml
# Common working directory
run/

68
pom.xml Normal file
View File

@@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.rattatwinko</groupId>
<artifactId>eiertoesitems</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<name>eiertoesitems</name>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<defaultGoal>clean package</defaultGoal>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.3</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
</build>
<repositories>
<repository>
<id>papermc-repo</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,556 @@
package org.rattatwinko.eiertoesitems;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Particle;
import org.bukkit.Sound;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageByEntityEvent;
import org.bukkit.event.entity.EntityPickupItemEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerSwapHandItemsEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemFlag;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.RayTraceResult;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import java.util.*;
public class Eiertoesitems extends JavaPlugin implements Listener {
private final Map<UUID, BukkitRunnable> playerEffectTasks = new HashMap<>();
private final Set<UUID> playersWithStickEffects = new HashSet<>();
private final Map<UUID, Long> leapCooldowns = new HashMap<>();
// Custom item key
private NamespacedKey customStickKey;
private static final double INSANE_REACH = 50.0; // Increased to 25 block reach
private static final long LEAP_COOLDOWN = 800; // Reduced to 0.8 seconds
@Override
public void onEnable() {
// Initialize key
customStickKey = new NamespacedKey(this, "op_stick");
// Register events
getServer().getPluginManager().registerEvents(this, this);
getLogger().info("EiertoesItems plugin enabled!");
}
@Override
public void onDisable() {
// Cancel all running tasks
playerEffectTasks.values().forEach(task -> {
if (task != null && !task.isCancelled()) {
task.cancel();
}
});
playerEffectTasks.clear();
playersWithStickEffects.clear();
leapCooldowns.clear();
getLogger().info("EiertoesItems plugin disabled!");
}
@Override
public boolean onCommand(@NotNull CommandSender sender, Command command, @NotNull String label, String @NotNull [] args) {
if (!command.getName().equalsIgnoreCase("eiertoesitems")) {
return false;
}
if (!sender.hasPermission("eiertoesitems.admin")) {
sender.sendMessage("§cYou don't have permission to use this command!");
return true;
}
if (args.length < 1) {
sender.sendMessage("§cUsage: /eiertoesitems stick [player]");
return true;
}
Player target;
if (args.length >= 2) {
target = Bukkit.getPlayer(args[1]);
if (target == null) {
sender.sendMessage("§cPlayer not found: " + args[1]);
return true;
}
} else if (sender instanceof Player) {
target = (Player) sender;
} else {
sender.sendMessage("§cYou must specify a player when using this command from console!");
return true;
}
String itemName = args[0].toLowerCase();
if (itemName.equals("stick")) {
ItemStack item = createOPStick();
if (target.getInventory().firstEmpty() != -1) {
target.getInventory().addItem(item);
sender.sendMessage("§aGave Sahur stick to " + target.getName());
} else {
sender.sendMessage("§c" + target.getName() + "'s inventory is full!");
}
} else {
sender.sendMessage("§cUnknown item: " + args[0]);
sender.sendMessage("§cAvailable items: stick");
return true;
}
return true;
}
private ItemStack createOPStick() {
ItemStack stick = new ItemStack(Material.STICK);
ItemMeta meta = stick.getItemMeta();
if (meta != null) {
// Set custom data to identify this item
meta.getPersistentDataContainer().set(customStickKey, PersistentDataType.BOOLEAN, true);
// Set name and lore
meta.setDisplayName("§6§lSahur");
// Add high-level enchantments (hidden)
meta.addEnchant(Enchantment.KNOCKBACK, 15, true);
// Hide all enchantments and other attributes
meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
// Add insane reach attribute (increased)
AttributeModifier reachModifier = new AttributeModifier(
UUID.randomUUID(),
"sahur_reach",
INSANE_REACH - 3.0, // Subtract 3 because default reach is ~3 blocks
AttributeModifier.Operation.ADD_NUMBER,
EquipmentSlot.HAND
);
meta.addAttributeModifier(Attribute.ENTITY_INTERACTION_RANGE, reachModifier);
meta.addAttributeModifier(Attribute.BLOCK_INTERACTION_RANGE, reachModifier);
stick.setItemMeta(meta);
}
return stick;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) return;
Player player = event.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
if (!isOPStick(item)) return;
if (!canPlayerHoldStick(player, item)) {
killPlayerForTouchingStick(player, item);
return;
}
if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK) {
event.setCancelled(true);
performLeap(player);
}
}
private void performLeap(Player player) {
UUID playerId = player.getUniqueId();
long currentTime = System.currentTimeMillis();
// Check cooldown
if (leapCooldowns.containsKey(playerId)) {
long timeSinceLastLeap = currentTime - leapCooldowns.get(playerId);
if (timeSinceLastLeap < LEAP_COOLDOWN) {
player.playSound(player.getLocation(), Sound.ENTITY_VILLAGER_NO, 1.0f, 1.5f);
return;
}
}
// Set cooldown
leapCooldowns.put(playerId, currentTime);
// Pre-leap effects
player.getWorld().spawnParticle(Particle.DRAGON_BREATH, player.getLocation(), 30, 1, 0.5, 1, 0.1);
player.getWorld().spawnParticle(Particle.ENCHANT, player.getLocation(), 50, 1.5, 1, 1.5, 1);
player.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, player.getLocation(), 20, 0.8, 0.8, 0.8, 0.3);
// Sound effects
player.playSound(player.getLocation(), Sound.ENTITY_ENDER_DRAGON_FLAP, 1.0f, 1.8f);
player.playSound(player.getLocation(), Sound.ENTITY_FIREWORK_ROCKET_LAUNCH, 1.0f, 1.2f);
player.playSound(player.getLocation(), Sound.ENTITY_LIGHTNING_BOLT_THUNDER, 0.5f, 2.0f);
// Calculate leap direction (forward and upward)
Vector direction = player.getLocation().getDirection().normalize();
Vector leap = direction.multiply(1.0); // Forward momentum
leap.setY(leap.getY() + 1.5); // Add upward momentum
// Apply the leap
player.setVelocity(leap);
// Apply improved falling protection
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW_FALLING, 160, 0, false, false, false)); // Extended to 8 seconds
player.addPotionEffect(new PotionEffect(PotionEffectType.RESISTANCE, 100, 2, false, false, false)); // Increased resistance level
player.addPotionEffect(new PotionEffect(PotionEffectType.FIRE_RESISTANCE, 100, 0, false, false, false)); // Fire protection
// Create a trail effect
new BukkitRunnable() {
int ticks = 0;
@Override
public void run() {
if (!player.isOnline() || ticks > 60) { // Extended trail time
cancel();
return;
}
// Check if player is close to ground (within 3 blocks) or has landed
if (player.isOnGround() || player.getLocation().getY() - player.getWorld().getHighestBlockYAt(player.getLocation()) <= 3) {
// Landing effects
if (player.isOnline()) {
player.getWorld().spawnParticle(Particle.EXPLOSION, player.getLocation(), 10, 2, 0.5, 2, 0);
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 20, 1.5, 0.5, 1.5, 0.2);
player.getWorld().spawnParticle(Particle.CRIT, player.getLocation(), 30, 1, 1, 1, 0.5);
player.playSound(player.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.8f, 1.5f);
player.playSound(player.getLocation(), Sound.BLOCK_ANVIL_LAND, 0.6f, 1.8f);
// Damage nearby entities on landing
for (Entity entity : player.getNearbyEntities(4, 3, 4)) {
if (entity instanceof LivingEntity && entity != player) {
LivingEntity living = (LivingEntity) entity;
living.damage(6.0, player);
// Knockback nearby entities
Vector knockback = living.getLocation().subtract(player.getLocation()).toVector().normalize().multiply(2.0);
knockback.setY(0.8);
living.setVelocity(knockback);
}
}
// Add extra fall damage protection for a few seconds after landing
player.addPotionEffect(new PotionEffect(PotionEffectType.RESISTANCE, 60, 1, false, false, false));
}
cancel();
return;
}
// Trail particles
player.getWorld().spawnParticle(Particle.ENCHANT, player.getLocation(), 8, 0.5, 0.5, 0.5, 0.5);
player.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, player.getLocation(), 3, 0.3, 0.3, 0.3, 0.1);
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation(), 2, 0.2, 0.2, 0.2, 0.02);
ticks++;
}
}.runTaskTimer(this, 5L, 2L);
}
@EventHandler
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
if (!(event.getDamager() instanceof Player)) {
return;
}
Player attacker = (Player) event.getDamager();
// Check if the attack was made with insane reach using raytrace
if (isHoldingOPStick(attacker)) {
double distance = attacker.getLocation().distance(event.getEntity().getLocation());
// If distance is greater than normal reach, it must be our insane reach
if (distance > 4.0 && distance <= INSANE_REACH) {
// Extra particles for long range hits
event.getEntity().getWorld().spawnParticle(Particle.SONIC_BOOM,
event.getEntity().getLocation().add(0, 1, 0), 5, 0.5, 0.5, 0.5, 0);
event.getEntity().getWorld().spawnParticle(Particle.FLASH,
event.getEntity().getLocation().add(0, 1, 0), 3, 0, 0, 0, 0);
// Connect attacker and victim with particle beam
createParticleBeam(attacker.getEyeLocation(), event.getEntity().getLocation().add(0, 1, 0));
attacker.playSound(attacker.getLocation(), Sound.ENTITY_LIGHTNING_BOLT_IMPACT, 1.0f, 2.0f);
}
}
ItemStack weapon = attacker.getInventory().getItemInMainHand();
// OP Stick hit effects
if (isOPStick(weapon)) {
// Increase damage for insane reach hits
double distance = attacker.getLocation().distance(event.getEntity().getLocation());
if (distance > 4.0) {
event.setDamage(event.getDamage() * 1.5); // 50% more damage for long range
}
// Give attacker extra heart (absorption) for 5 seconds
attacker.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 100, 0));
// Apply extra knockback and epic visual effects
if (event.getEntity() instanceof Player) {
Player victim = (Player) event.getEntity();
// Massive knockback
Vector knockback = victim.getLocation().subtract(attacker.getLocation()).toVector().normalize().multiply(3.0);
knockback.setY(1.0);
victim.setVelocity(knockback);
// Epic particle effects
victim.getWorld().spawnParticle(Particle.EXPLOSION, victim.getLocation().add(0, 1, 0), 8, 0.5, 0.5, 0.5, 0.1);
victim.getWorld().spawnParticle(Particle.SONIC_BOOM, victim.getLocation().add(0, 1, 0), 3, 0.3, 0.3, 0.3, 0);
victim.getWorld().spawnParticle(Particle.FLASH, victim.getLocation().add(0, 1, 0), 2, 0, 0, 0, 0);
victim.getWorld().spawnParticle(Particle.CRIT, victim.getLocation().add(0, 1, 0), 30, 1, 1, 1, 0.3);
victim.getWorld().spawnParticle(Particle.ENCHANT, victim.getLocation().add(0, 1, 0), 50, 1, 2, 1, 1);
// Attacker gets hearts particles
attacker.getWorld().spawnParticle(Particle.HEART, attacker.getLocation().add(0, 2, 0), 10, 0.5, 0.5, 0.5, 0.1);
attacker.getWorld().spawnParticle(Particle.TOTEM_OF_UNDYING, attacker.getLocation(), 20, 0.5, 1, 0.5, 0.3);
// Epic sound effects
attacker.playSound(attacker.getLocation(), Sound.ENTITY_LIGHTNING_BOLT_THUNDER, 0.8f, 1.2f);
attacker.playSound(attacker.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
attacker.playSound(attacker.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 1.0f, 0.8f);
victim.playSound(victim.getLocation(), Sound.ENTITY_ENDER_DRAGON_HURT, 1.0f, 1.5f);
victim.playSound(victim.getLocation(), Sound.ENTITY_PLAYER_HURT, 1.0f, 0.6f);
// Play sounds to nearby players within 15 blocks
for (Player nearbyPlayer : victim.getWorld().getPlayers()) {
if (nearbyPlayer.getLocation().distance(victim.getLocation()) <= 15) {
nearbyPlayer.playSound(victim.getLocation(), Sound.ENTITY_WITHER_SPAWN, 0.4f, 1.8f);
nearbyPlayer.playSound(victim.getLocation(), Sound.ITEM_TOTEM_USE, 0.6f, 1.5f);
}
}
} else {
// Hit non-player entity
attacker.getWorld().spawnParticle(Particle.EXPLOSION, event.getEntity().getLocation().add(0, 1, 0), 5, 0.3, 0.3, 0.3, 0.1);
attacker.getWorld().spawnParticle(Particle.HEART, attacker.getLocation().add(0, 2, 0), 5, 0.3, 0.3, 0.3, 0.1);
attacker.playSound(attacker.getLocation(), Sound.ENTITY_PLAYER_LEVELUP, 1.0f, 2.0f);
attacker.playSound(attacker.getLocation(), Sound.ENTITY_GENERIC_EXPLODE, 0.8f, 1.2f);
}
}
}
private void createParticleBeam(org.bukkit.Location start, org.bukkit.Location end) {
Vector direction = end.toVector().subtract(start.toVector());
double distance = direction.length();
direction.normalize();
for (double i = 0; i < distance; i += 0.3) {
org.bukkit.Location particleLocation = start.clone().add(direction.clone().multiply(i));
start.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, particleLocation, 1, 0.05, 0.05, 0.05, 0);
start.getWorld().spawnParticle(Particle.ENCHANT, particleLocation, 2, 0.1, 0.1, 0.1, 0.1);
}
}
private boolean isOPStick(ItemStack item) {
if (item == null || item.getType() != Material.STICK) {
return false;
}
ItemMeta meta = item.getItemMeta();
return meta != null && meta.getPersistentDataContainer().has(customStickKey, PersistentDataType.BOOLEAN);
}
private boolean isHoldingOPStick(Player player) {
ItemStack mainHand = player.getInventory().getItemInMainHand();
ItemStack offHand = player.getInventory().getItemInOffHand();
return isOPStick(mainHand) || isOPStick(offHand);
}
@EventHandler
public void onInventoryClick(InventoryClickEvent event) {
if (!(event.getWhoClicked() instanceof Player)) {
return;
}
Player player = (Player) event.getWhoClicked();
ItemStack clickedItem = event.getCurrentItem();
if (isOPStick(clickedItem) && !canPlayerHoldStick(player, clickedItem)) {
event.setCancelled(true);
killPlayerForTouchingStick(player, clickedItem);
}
}
@EventHandler
public void onEntityPickupItem(EntityPickupItemEvent event) {
if (!(event.getEntity() instanceof Player)) {
return;
}
Player player = (Player) event.getEntity();
ItemStack item = event.getItem().getItemStack();
if (isOPStick(item) && !canPlayerHoldStick(player, item)) {
event.setCancelled(true);
event.getItem().remove();
killPlayerForTouchingStick(player, item);
}
}
@EventHandler
public void onPlayerItemHeld(PlayerItemHeldEvent event) {
Player player = event.getPlayer();
Bukkit.getScheduler().runTaskLater(this, () -> checkAndUpdateEffects(player), 2L);
}
@EventHandler
public void onPlayerSwapHandItems(PlayerSwapHandItemsEvent event) {
Player player = event.getPlayer();
ItemStack mainHandItem = event.getMainHandItem();
ItemStack offHandItem = event.getOffHandItem();
if ((isOPStick(mainHandItem) || isOPStick(offHandItem)) && !canPlayerHoldStick(player, null)) {
event.setCancelled(true);
killPlayerForTouchingStick(player, isOPStick(mainHandItem) ? mainHandItem : offHandItem);
return;
}
Bukkit.getScheduler().runTaskLater(this, () -> checkAndUpdateEffects(player), 2L);
}
@EventHandler
public void onPlayerJoin(@NotNull PlayerJoinEvent event) {
Player player = event.getPlayer();
Bukkit.getScheduler().runTaskLater(this, () -> checkAndUpdateEffects(player), 5L);
}
@EventHandler
public void onPlayerQuit(PlayerQuitEvent event) {
UUID playerId = event.getPlayer().getUniqueId();
BukkitRunnable task = playerEffectTasks.remove(playerId);
if (task != null && !task.isCancelled()) {
task.cancel();
}
playersWithStickEffects.remove(playerId);
leapCooldowns.remove(playerId);
}
private void checkAndUpdateEffects(Player player) {
UUID playerId = player.getUniqueId();
BukkitRunnable existingTask = playerEffectTasks.get(playerId);
if (existingTask != null && !existingTask.isCancelled()) {
existingTask.cancel();
}
if (isHoldingOPStick(player)) {
startStickEffects(player);
} else {
removeCustomEffects(player);
}
}
private void startStickEffects(Player player) {
UUID playerId = player.getUniqueId();
removeCustomEffects(player);
BukkitRunnable task = new BukkitRunnable() {
@Override
public void run() {
if (!player.isOnline()) {
cancel();
playerEffectTasks.remove(playerId);
playersWithStickEffects.remove(playerId);
return;
}
if (!isHoldingOPStick(player)) {
removeCustomEffects(player);
cancel();
playerEffectTasks.remove(playerId);
playersWithStickEffects.remove(playerId);
return;
}
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 100, 2, false, false, false));
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP_BOOST, 100, 1, false, false, false));
player.getWorld().spawnParticle(Particle.ENCHANT, player.getLocation().add(0, 1, 0), 3, 0.5, 1, 0.5, 0.8);
player.getWorld().spawnParticle(Particle.CLOUD, player.getLocation().add(0, 0.5, 0), 2, 0.3, 0.2, 0.3, 0.02);
player.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, player.getLocation().add(0, 1, 0), 1, 0.2, 0.5, 0.2, 0.05);
playersWithStickEffects.add(playerId);
}
};
task.runTaskTimer(this, 0L, 20L);
playerEffectTasks.put(playerId, task);
}
private void removeCustomEffects(Player player) {
UUID playerId = player.getUniqueId();
if (playersWithStickEffects.contains(playerId)) {
if (player.hasPotionEffect(PotionEffectType.SPEED)) {
player.removePotionEffect(PotionEffectType.SPEED);
}
if (player.hasPotionEffect(PotionEffectType.JUMP_BOOST)) {
player.removePotionEffect(PotionEffectType.JUMP_BOOST);
}
playersWithStickEffects.remove(playerId);
}
}
private boolean canPlayerHoldStick(Player player, ItemStack stick) {
if (player.hasPermission("eiertoesitems.use") || player.hasPermission("eiertoesitems.admin")) {
return true;
}
if (player.isOp()) {
return true;
}
if (player.getGameMode() == org.bukkit.GameMode.CREATIVE && player.hasPermission("eiertoesitems.creative")) {
return true;
}
return false;
}
private void killPlayerForTouchingStick(Player player, ItemStack stick) {
player.getWorld().spawnParticle(Particle.SOUL_FIRE_FLAME, player.getLocation().add(0, 1, 0), 20, 0.5, 1, 0.5, 0.1);
player.getWorld().spawnParticle(Particle.SMOKE, player.getLocation().add(0, 1, 0), 30, 0.8, 1, 0.8, 0.1);
player.getWorld().spawnParticle(Particle.ELECTRIC_SPARK, player.getLocation().add(0, 1, 0), 15, 0.5, 1, 0.5, 0.2);
player.playSound(player.getLocation(), Sound.ENTITY_LIGHTNING_BOLT_THUNDER, 1.0f, 0.8f);
player.playSound(player.getLocation(), Sound.ENTITY_GHAST_SCREAM, 0.8f, 1.5f);
player.playSound(player.getLocation(), Sound.ENTITY_WITHER_SPAWN, 0.5f, 2.0f);
player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 1000, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.WEAKNESS, 200, 2));
player.addPotionEffect(new PotionEffect(PotionEffectType.SLOWNESS, 100, 1));
player.addPotionEffect(new PotionEffect(PotionEffectType.BLINDNESS, 40, 0));
Vector knockback = player.getLocation().getDirection().multiply(-1.5);
knockback.setY(0.5);
player.setVelocity(knockback);
player.damage(2.0);
}
}

View File

@@ -0,0 +1,17 @@
name: Eiertoesitems
version: 1.0.0
main: org.rattatwinko.eiertoesitems.Eiertoesitems
api-version: 1.21
author: rattatwinko
description: A plugin that adds custom OP items
commands:
eiertoesitems:
description: Get custom OP items
usage: /eti stick [player]
permission: eiertoesitems.admin
permissions:
eiertoesitems.admin:
description: Allows use of the eiertoesitems command
default: op