Upload Plugin

This commit is contained in:
marc-go
2026-01-03 19:15:58 +01:00
commit dafa05a66b
10 changed files with 368 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
package de.marc.advancedKill;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import de.marc.advancedKill.commands.*;
import java.util.ArrayList;
import java.util.List;
public final class AdvancedKill extends JavaPlugin {
@Override
public void onEnable() {
// Plugin startup logic
getCommand("akill").setExecutor(this);
getLogger().info("AdvancedKill was loaded!");
}
@Override
public void onDisable() {
// Plugin shutdown logic
getLogger().info("AdvancedKill was disabled");
}
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
//Check Permission
if(!sender.hasPermission("akill.use")) {
sender.sendMessage("§cPermission denied!");
return true;
}
//Check Args
if (args.length == 0) {
sender.sendMessage("§aMethods:\nlightning\nanvil\nzombie\nvoid\nhalf\nexplosion\nfall\nlava");
return true;
}
if (args.length == 1) {
sender.sendMessage("§cNo player defined!");
return true;
}
//Define mode et player
String mode = args[0].toLowerCase();
Player target = Bukkit.getPlayer(args[1]);
if (target == null) {
sender.sendMessage("§cPlayer does not exists!");
return true;
}
//Filtering 470Hacker
//if (target.getName().equals("470Hacker")) {
// if (!sender.hasPermission("akill.admin")) {
// sender.sendMessage("§c470Hacker darf nicht gefoltert werden!");
// return true;
// }
//}
//Run Commands
switch (mode) {
case "lightning":
new LightningCmd(this).execute(sender, target);
break;
case "void":
new VoidCmd(this).execute(sender, target);
break;
case "zombie":
new ZombieCmd(this).execute(sender, target);
break;
case "half":
new HalfCmd(this).execute(sender, target);
break;
case "anvil":
new AnvilCmd(this).execute(sender, target);
break;
case "explosion":
new ExplosionCmd(this).execute(sender, target);
break;
case "fall":
new FallCmd(this).execute(sender, target);
break;
case "lava":
new LavaCmd(this).execute(sender, target);
break;
default:
sender.sendMessage("§cThis method does not exists.");
break;
}
return true;
}
//Completions
@Override
public @Nullable List<String> onTabComplete(@NotNull CommandSender sender,
@NotNull Command command,
@NotNull String alias,
String[] args) {
List<String> completions = new ArrayList<>();
if (sender.hasPermission("akill.use")) {
if (args.length == 1) {
completions.add("lightning");
completions.add("void");
completions.add("zombie");
completions.add("half");
completions.add("anvil");
completions.add("explosion");
completions.add("fall");
completions.add("lava");
}
if (args.length == 2) {
for (Player player : Bukkit.getOnlinePlayers()) {
completions.add(player.getName());
}
}
}
return completions;
}
}

View File

@@ -0,0 +1,28 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class AnvilCmd {
private final AdvancedKill plugin;
public AnvilCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
Location anvil_loc = new Location(
target.getWorld(),
target.getLocation().getX(),
target.getLocation().getY() + 2,
target.getLocation().getZ()
);
anvil_loc.getBlock().setType(Material.ANVIL);
sender.sendMessage("§aSuccess!");
}
}

View File

@@ -0,0 +1,23 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class ExplosionCmd {
private final AdvancedKill plugin;
public ExplosionCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
target.getWorld().createExplosion(
target.getLocation(),
6.0f,
false,
false
);
sender.sendMessage("§aSuccess!");
}
}

View File

@@ -0,0 +1,29 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class FallCmd {
private final AdvancedKill plugin;
public FallCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
Location fall_loc = new Location(
target.getLocation().getWorld(),
target.getLocation().getX(),
300,
target.getLocation().getZ()
);
target.teleport(fall_loc);
sender.sendMessage("§aSuccess!");
}
}

View File

@@ -0,0 +1,19 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class HalfCmd {
private final AdvancedKill plugin;
public HalfCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
target.setHealth(1.0);
sender.sendMessage("§aSuccess!");
}
}

View File

@@ -0,0 +1,39 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class LavaCmd {
private final AdvancedKill plugin;
public LavaCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
Location lava_loc = new Location(
target.getLocation().getWorld(),
target.getLocation().getX(),
target.getLocation().getY() - 1,
target.getLocation().getZ()
);
Block block = lava_loc.getBlock();
Material old_block = block.getType();
block.setType(Material.LAVA);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
block.setType(old_block);
}, 60L);
sender.sendMessage("§aSuccess!");
}
}

View File

@@ -0,0 +1,19 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class LightningCmd {
private final AdvancedKill plugin;
public LightningCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
target.getWorld().strikeLightning(target.getLocation());
sender.sendMessage("§aSuccess!");
}
}

View File

@@ -0,0 +1,26 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class VoidCmd {
private final AdvancedKill plugin;
public VoidCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
Location loc = new Location(
target.getWorld(),
0,
-100,
0
);
target.teleport(loc);
sender.sendMessage("§aErfolg!");
}
}

View File

@@ -0,0 +1,29 @@
package de.marc.advancedKill.commands;
import de.marc.advancedKill.AdvancedKill;
import org.bukkit.Material;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
public class ZombieCmd {
private final AdvancedKill plugin;
public ZombieCmd(AdvancedKill plugin) {
this.plugin = plugin;
}
public void execute(CommandSender sender, Player target) {
Zombie zombie = target.getWorld().spawn(
target.getLocation(),
Zombie.class
);
zombie.getEquipment().setItemInMainHand(
new ItemStack(Material.DIAMOND_SWORD)
);
sender.sendMessage("§aErfolg!");
}
}

View File

@@ -0,0 +1,17 @@
name: AdvancedKill
version: '1.0-SNAPSHOT'
main: de.marc.advancedKill.AdvancedKill
api-version: '1.21'
commands:
akill:
description: aKill Befehl
usage: /akill <mode> <player>
permissions:
akill.use:
description: Darf /akill benutzen
default: op
akill.admin:
description: Darf 470Hacker töten
default: op