Start inv
This commit is contained in:
68
pom.xml
Normal file
68
pom.xml
Normal 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>de.marc.advancedKill</groupId>
|
||||
<artifactId>AdvancedKill</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>AdvancedKill</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.11-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -12,6 +12,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public final class AdvancedKill extends JavaPlugin {
|
||||
public static List<String> methods;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
@@ -21,6 +22,19 @@ public final class AdvancedKill extends JavaPlugin {
|
||||
getCommand("akill").setExecutor(this);
|
||||
getCommand("afilter").setExecutor(new AdvancedKillFilter(this));
|
||||
|
||||
List<String> methods = new ArrayList<>();
|
||||
|
||||
methods.add("lightning");
|
||||
methods.add("void");
|
||||
methods.add("zombie");
|
||||
methods.add("half");
|
||||
methods.add("anvil");
|
||||
methods.add("explosion");
|
||||
methods.add("fall");
|
||||
methods.add("lava");
|
||||
|
||||
this.methods = methods;
|
||||
|
||||
getLogger().info("AdvancedKill was loaded!");
|
||||
}
|
||||
|
||||
@@ -39,8 +53,7 @@ public final class AdvancedKill extends JavaPlugin {
|
||||
|
||||
//Check Args
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage("§aMethods:\nlightning\nanvil\nzombie\nvoid\nhalf\nexplosion\nfall\nlava");
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
if (args.length == 1) {
|
||||
|
||||
58
src/main/java/de/marc/advancedKill/AdvancedKillInv.java
Normal file
58
src/main/java/de/marc/advancedKill/AdvancedKillInv.java
Normal file
@@ -0,0 +1,58 @@
|
||||
package de.marc.advancedKill;
|
||||
|
||||
import net.kyori.adventure.text.event.ClickEvent;
|
||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
public class AdvancedKillInv {
|
||||
private CommandSender sender;
|
||||
private HashMap<String, Material> blocks;
|
||||
|
||||
public void init(CommandSender sender) {
|
||||
if (!(sender instanceof Player)) {
|
||||
sender.sendMessage("§cTo less args!");
|
||||
return;
|
||||
}
|
||||
|
||||
this.sender = sender;
|
||||
|
||||
HashMap<String, Material> blocks = new HashMap<>();
|
||||
blocks.put("ligthning", Material.LIGHTNING_ROD);
|
||||
blocks.put("half", Material.POTION);
|
||||
blocks.put("zombie", Material.DIAMOND_SWORD);
|
||||
blocks.put("void", Material.BEDROCK);
|
||||
blocks.put("anvil", Material.ANVIL);
|
||||
blocks.put("explosion", Material.TNT);
|
||||
blocks.put("fall", Material.RED_CARPET);
|
||||
blocks.put("lava", Material.LAVA);
|
||||
|
||||
this.blocks = blocks;
|
||||
|
||||
this.open1();
|
||||
}
|
||||
|
||||
public void open1() {
|
||||
Player player = (Player) sender;
|
||||
|
||||
Inventory inv = Bukkit.createInventory(null, 36, MiniMessage.miniMessage().deserialize("<dark_gray>Methods"));
|
||||
|
||||
|
||||
for (String method : AdvancedKill.methods) {
|
||||
ItemStack item = new ItemStack(this.blocks.get(method));
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
|
||||
meta.displayName(MiniMessage.miniMessage().deserialize("<grey>" + method));
|
||||
|
||||
item.setItemMeta(meta);
|
||||
inv.setItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user