merged pokeballs into environmentex
Some checks failed
Gitea Actions Demo / Build-Gradle (push) Has been cancelled

This commit is contained in:
Your Name
2025-07-30 02:44:24 +02:00
parent 899d256773
commit ab1725edf9
29 changed files with 1268 additions and 3414 deletions

Binary file not shown.

View File

@@ -1,49 +0,0 @@
plugins {
`java-library`
id("io.papermc.paperweight.userdev") version "2.0.0-beta.14"
id("xyz.jpenilla.run-paper") version "2.3.1" // Adds runServer and runMojangMappedServer tasks for testing
}
group = "de.hessj.dailyquests"
version = "1.0-SNAPSHOT"
description = "dailyquests"
tasks.withType<Jar> {
destinationDirectory.set(file("../"))
}
dependencies {
implementation(files("../craftbukkit.jar"))
implementation(files("../helper-1.0-SNAPSHOT.jar"))
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
}
tasks {
// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(21)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"name" to project.name,
"version" to project.version,
"description" to project.description,
"apiVersion" to "1.21"
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
}

View File

@@ -1,5 +0,0 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
}
rootProject.name = "dailyquests"

View File

@@ -1,168 +0,0 @@
package de.hessj.dailyquests;
import de.hessj.helper.Helper;
import de.hessj.helper.Helper.Type;
import net.kyori.adventure.text.Component;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.*;
import org.bukkit.entity.Player;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.components.CustomModelDataComponent;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.scoreboard.Scoreboard;
import org.bukkit.scoreboard.ScoreboardManager;
import java.time.*;
import java.util.*;
import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;
public class App extends JavaPlugin {
public static App main;
public Helper helper = new Helper();
public static final String DIAMOND_DUST_KEY = "R3SDiamondDust";
public static final String DIAMOND_DUST_RECIPE_KEY = "R3S_SR_DIAMONDDUST";
public static final long TICKS_PER_SECOND = 20L;
public static final long SECONDS_PER_DAY = 86400L;
public ArrayList<ItemStack> rewardList = new ArrayList<>();
public ItemStack diamondDust;
public NamespacedKey nskdiamondDust;
public NamespacedKey nskDD;
@Override
public void onEnable() {
getLogger().info("Plugin enabled!");
main = this;
nskdiamondDust = new NamespacedKey(this, DIAMOND_DUST_KEY);
nskDD = new NamespacedKey(this, DIAMOND_DUST_RECIPE_KEY);
setupRewards();
DailyQuestsListeners.getTodaysQuest();
scheduleMidnightReset();
registerListenersAndCommands();
}
@Override
public void onDisable() {
getLogger().info("Plugin disabled!");
}
private void registerListenersAndCommands() {
PluginManager pM = Bukkit.getPluginManager();
pM.registerEvents(new DailyQuestsListeners(), this);
getCommand("quest").setExecutor(new DailyQuestsCommands());
}
private void scheduleMidnightReset() {
LocalDateTime now = LocalDateTime.now();
LocalDateTime nextMidnight = now.plusDays(1).withHour(0).withMinute(0).withSecond(0);
ZonedDateTime zdt = ZonedDateTime.of(nextMidnight, ZoneId.of("Europe/Berlin"));
Duration duration = Duration.between(now, zdt);
long secondsUntilMidnight = duration.getSeconds();
Bukkit.getScheduler().runTaskLater(this, this::startQuestResetScheduler, secondsUntilMidnight * TICKS_PER_SECOND);
}
private void startQuestResetScheduler() {
new BukkitRunnable() {
@Override
public void run() {
resetDailyQuestsForAllPlayers();
}
}.runTaskTimer(this, 0L, SECONDS_PER_DAY * TICKS_PER_SECOND);
}
private void resetDailyQuestsForAllPlayers() {
getConfig().set("players", null);
saveConfig();
for (Player player : Bukkit.getOnlinePlayers()) {
DailyQuestsListeners.getDailyQuests(player);
updatePlayerScoreboard(player);
player.sendMessage(helper.R3SMessage(Type.INFO, "[DailyQuests] Du hast eine neue Quest erhalten!"));
}
saveConfig();
}
private void updatePlayerScoreboard(Player player) {
Entry<Scoreboard, Boolean> entry = DailyQuestsCommands.boards.get(player.getName());
Scoreboard board = entry.getKey();
boolean isActive = entry.getValue();
ScoreboardManager manager = Bukkit.getScoreboardManager();
player.setScoreboard(manager.getNewScoreboard());
if (isActive) {
player.setScoreboard(board);
}
DailyQuestsCommands.boards.put(player.getName(), new SimpleEntry<>(board, isActive));
}
private void setupRewards() {
createDiamondDustItem();
registerDiamondDustRecipe();
initializeRewardList();
}
private void createDiamondDustItem() {
diamondDust = new ItemStack(Material.BARRIER);
ItemMeta meta = diamondDust.getItemMeta();
meta.setCustomModelData(1000010);
CustomModelDataComponent cmdc = meta.getCustomModelDataComponent();
cmdc.setStrings(Collections.singletonList("diamond_dust"));
meta.setCustomModelDataComponent(cmdc);
meta.displayName(Component.translatable(ChatColor.WHITE + "Diamant-Staub"));
meta.getPersistentDataContainer().set(nskdiamondDust, PersistentDataType.STRING, DIAMOND_DUST_KEY);
diamondDust.setItemMeta(meta);
}
private void registerDiamondDustRecipe() {
RecipeChoice choice = new RecipeChoice.ExactChoice(diamondDust);
ShapedRecipe recipe = new ShapedRecipe(nskDD, new ItemStack(Material.DIAMOND));
recipe.shape("** ", "** ", " ");
recipe.setIngredient('*', choice);
if (getServer().getRecipe(nskDD) == null) {
getServer().addRecipe(recipe);
}
}
private void initializeRewardList() {
rewardList.addAll(List.of(
new ItemStack(Material.EXPERIENCE_BOTTLE, 1),
new ItemStack(Material.APPLE, 10),
new ItemStack(Material.POTATO, 5),
new ItemStack(Material.CARROT, 5),
new ItemStack(Material.COOKED_BEEF, 10),
new ItemStack(Material.COOKED_CHICKEN, 10),
new ItemStack(Material.COOKED_COD, 10),
new ItemStack(Material.COOKED_MUTTON, 10),
new ItemStack(Material.COOKED_PORKCHOP, 10),
new ItemStack(Material.COOKED_RABBIT, 10),
new ItemStack(Material.COOKED_SALMON, 10),
new ItemStack(Material.IRON_INGOT, 5),
new ItemStack(Material.COPPER_INGOT, 5),
new ItemStack(Material.GOLD_NUGGET, 5),
new ItemStack(Material.FIREWORK_ROCKET, 5),
new ItemStack(Material.SADDLE, 1),
new ItemStack(Material.MELON_SEEDS, 5),
new ItemStack(Material.PUMPKIN_SEEDS, 5),
new ItemStack(Material.BEETROOT_SEEDS, 5),
new ItemStack(Material.DIAMOND, 1),
new ItemStack(Material.CAKE, 1),
new ItemStack(Material.ENDER_PEARL, 5)
));
}
}

View File

@@ -1,154 +0,0 @@
package de.hessj.dailyquests;
import java.util.*;
import java.util.AbstractMap.SimpleEntry;
import com.destroystokyo.paper.profile.PlayerProfile;
import com.destroystokyo.paper.profile.ProfileProperty;
import de.hessj.helper.Helper.Type;
import org.bukkit.*;
import org.bukkit.command.*;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.entity.Player;
import org.bukkit.inventory.*;
import org.bukkit.inventory.meta.SkullMeta;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.scoreboard.*;
import net.kyori.adventure.text.Component;
public class DailyQuestsCommands implements CommandExecutor {
public static Map<String, Entry<Scoreboard, Boolean>> boards = new HashMap<>();
public static NamespacedKey nsksurpriseBox;
public static ItemStack surpriseBox;
public static de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
public static void updateSB(Player p) {
boards.putIfAbsent(p.getName(), new SimpleEntry<>(Bukkit.getScoreboardManager().getNewScoreboard(), false));
Entry<Scoreboard, Boolean> actionMapEntry = boards.get(p.getName());
Scoreboard board = actionMapEntry.getKey();
Objective existing = board.getObjective(DisplaySlot.SIDEBAR);
if (existing != null) existing.unregister();
Objective o = board.registerNewObjective("dailyquests", ObjectiveCriteria.DUMMY, Component.text("Quest:"));
o.setDisplaySlot(DisplaySlot.SIDEBAR);
ConfigurationSection questsSection = App.main.getConfig().getConfigurationSection("players." + p.getUniqueId() + ".currentQuests");
if (questsSection == null) return;
for (String questKey : questsSection.getKeys(false)) {
if (questKey.equals("null")) continue;
String desc = formatQuestDescription(p.getUniqueId(), questKey);
if (desc.length() >= 39) desc = desc.substring(0, 39);
int currentCount = getConfigInt("players." + p.getUniqueId() + ".currentQuests." + questKey + ".currentcount");
if ("finished".equals(getConfigString("players." + p.getUniqueId() + ".currentQuests." + questKey + ".state"))) {
board.resetScores(desc);
o.getScore(ChatColor.STRIKETHROUGH + desc).setScore(currentCount);
} else {
o.getScore(desc).setScore(currentCount);
}
checkForCompletion(p);
}
boards.put(p.getName(), new SimpleEntry<>(board, actionMapEntry.getValue()));
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player player) {
updateSB(player);
Entry<Scoreboard, Boolean> entry = boards.get(player.getName());
boolean showing = entry.getValue();
player.setScoreboard(showing ? Bukkit.getScoreboardManager().getNewScoreboard() : entry.getKey());
boards.put(player.getName(), new SimpleEntry<>(entry.getKey(), !showing));
}
return true;
}
private static void checkForCompletion(Player p) {
UUID uuid = p.getUniqueId();
int completed = 0;
int total = 0;
for (String questID : App.main.getConfig().getConfigurationSection("quests").getKeys(false)) {
String path = "players." + uuid + ".currentQuests." + questID;
if (App.main.getConfig().contains(path)) {
if ("finished".equals(getConfigString(path + ".state"))) completed++;
total++;
}
}
if (completed == total && !"claimed".equals(getConfigString("players." + uuid + ".rewards"))) {
giveSurpriseBox(p);
App.main.getConfig().set("players." + uuid + ".rewards", "claimed");
App.main.saveConfig();
}
}
private static void giveSurpriseBox(Player p) {
surpriseBox = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) surpriseBox.getItemMeta();
meta.displayName(Component.text(ChatColor.WHITE + "Überraschungsbox"));
PlayerProfile profile = Bukkit.createProfile(UUID.randomUUID(), null);
profile.getProperties().add(new ProfileProperty("textures",
"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDQxZmJlYTljMmQxOTA0MGU1NjdmMzg3YWI0NmIyZjhhM2ExZGE4ZWVjOWQzOTllMmU0YWRjZjA1YWRhOGEyYSJ9fX0="));
meta.setPlayerProfile(profile);
nsksurpriseBox = new NamespacedKey(App.main, "R3SSurpriseBox");
meta.getPersistentDataContainer().set(nsksurpriseBox, PersistentDataType.STRING, "R3S_SurpriseBox");
meta.lore(List.of(Component.text("Quest Belohnung")));
surpriseBox.setItemMeta(meta);
boolean given = false, hasSpace = false;
for (ItemStack i : p.getInventory().getStorageContents()) {
if (i == null) {
hasSpace = true;
continue;
}
if (i.isSimilar(surpriseBox) && i.getAmount() < 64) {
i.setAmount(i.getAmount() + 1);
given = true;
break;
}
}
if (!given && hasSpace) {
p.getInventory().addItem(surpriseBox);
p.sendMessage(helper.R3SMessage(Type.SUCCESS, "[DailyQuests] Du hast 1x Überraschungsbox als Questbelohnung erhalten!"));
} else if (!given) {
p.sendMessage(helper.R3SMessage(Type.ERROR, "[DailyQuests] Dein Inventar ist voll, schaffe Platz und logge dich ein, um deine Questbelohnung zu erhalten!"));
}
}
private static String getConfigString(String path) {
Object value = App.main.getConfig().get(path);
return value != null ? value.toString() : "";
}
private static int getConfigInt(String path) {
return App.main.getConfig().getInt(path);
}
private static String formatQuestDescription(UUID playerId, String questKey) {
String base = getConfigString("quests." + questKey + ".description");
String count = getConfigString("players." + playerId + ".currentQuests." + questKey + ".countneeded");
String target = getConfigString("quests." + questKey + ".target");
String tool = getConfigString("quests." + questKey + ".tool").replace("Material.", "");
return base.replace("[x]", count).replace("[b]", target).replace("[t]", tool);
}
}

View File

@@ -1,10 +0,0 @@
main: de.hessj.dailyquests.App
name: DailyQuestsPlugin
version: 0.1
api-version: 1.21
depend: [HelperPlugin]
commands:
quest:
description: Zeigt die heutigen Quests an
usage: /<command>

View File

@@ -1,2 +1,2 @@
Command: /opt/homebrew/Cellar/openjdk/23.0.2/libexec/openjdk.jdk/Contents/Home/bin/java -Xmx1G -classpath /Users/janik/.gradle/caches/modules-2/files-2.1/net.fabricmc/tiny-remapper/0.11.1/6c1f29838864ba8f495855edfc8ef17706fedb5d/tiny-remapper-0.11.1-fat.jar net.fabricmc.tinyremapper.Main /Users/janik/Desktop/MCPlugins/environmentex-1.0-SNAPSHOT.jar /Users/janik/Desktop/MCPlugins/environmentex/build/libs/environmentex-1.0-SNAPSHOT-reobf.jar /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/reobfMappings.tiny mojang spigot /Users/janik/Desktop/MCPlugins/environmentex/.gradle/caches/paperweight/taskCache/mappedServerJar.jar --threads=1
[INFO] Finished after 1133,52 ms.
[INFO] Finished after 1086,27 ms.

View File

@@ -25,9 +25,7 @@ import org.bukkit.inventory.RecipeChoice.MaterialChoice;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.components.CustomModelDataComponent;
import org.bukkit.persistence.PersistentDataType;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.AbstractMap.SimpleEntry;
import java.util.ArrayList;
import java.util.Arrays;
@@ -59,6 +57,16 @@ public class App extends JavaPlugin {
public static final String DIAMOND_DUST_RECIPE_KEY = "R3S_SR_DIAMONDDUST";
public static final long TICKS_PER_SECOND = 20L;
public static final long SECONDS_PER_DAY = 86400L;
public NamespacedKey nskPokeball;
public NamespacedKey nskUsedPokeball;
public NamespacedKey nskEntityPokeball;
public NamespacedKey nskEntVariantPokeball;
public NamespacedKey nskEntStylePokeball;
public NamespacedKey nskAgePokeball;
public ItemStack newPokeball;
public ItemStack usedPokeball;
public HashMap<Player, Boolean> isThrownHM = new HashMap<>();
public ArrayList<ItemStack> rewardList = new ArrayList<>();
public ItemStack diamondDust;
@@ -113,7 +121,36 @@ public NamespacedKey nskHopper;
getServer().addRecipe(srHopper);
}
private ItemStack createPokeball() {
ItemStack ball = new ItemStack(Material.SNOWBALL);
ItemMeta meta = ball.getItemMeta();
meta.displayName(Component.translatable(ChatColor.WHITE + "Pokéball"));
meta.setCustomModelData(1000011);
CustomModelDataComponent cmd = meta.getCustomModelDataComponent();
if (cmd != null) {
cmd.setStrings(List.of("pokeball"));
meta.setCustomModelDataComponent(cmd);
}
meta.getPersistentDataContainer().set(nskPokeball, PersistentDataType.STRING, "R3S_Pokeball");
ball.setItemMeta(meta);
return ball;
}
private void registerPokeballRecipe(ItemStack item) {
ShapedRecipe recipe = new ShapedRecipe(nskPokeball, item);
recipe.shape("RRR", "SES", "WWW");
recipe.setIngredient('R', Material.RED_CONCRETE);
recipe.setIngredient('S', Material.BLACK_CONCRETE);
recipe.setIngredient('E', Material.IRON_NUGGET);
recipe.setIngredient('W', Material.WHITE_CONCRETE);
if (getServer().getRecipe(nskPokeball) == null) {
getServer().addRecipe(recipe);
}
}
@Override
public void onEnable() {
SquidPrevention.removeSquidReceipes();
@@ -131,6 +168,18 @@ public NamespacedKey nskHopper;
main = this;
nskPokeball = new NamespacedKey(this, "R3SPokeball");
nskUsedPokeball = new NamespacedKey(this, "R3SUsedPokeball");
nskEntityPokeball = new NamespacedKey(this, "R3SEntity");
nskEntVariantPokeball = new NamespacedKey(this, "R3SEntityVariant");
nskEntStylePokeball = new NamespacedKey(this, "R3SEntityStyle");
nskAgePokeball = new NamespacedKey(this, "R3SEntityAge");
newPokeball = createPokeball();
registerPokeballRecipe(newPokeball);
for (Player p : Bukkit.getOnlinePlayers()) {
isThrownHM.put(p, false);
}
DailyQuests.getTodaysQuest();
lockedChest = new ItemStack(Material.CHEST);
ItemMeta imlockedChest = lockedChest.getItemMeta();
@@ -535,6 +584,7 @@ public NamespacedKey nskHopper;
pM.registerEvents(new DeathLoc(), this);
pM.registerEvents(new BetterHoppers(), this);
pM.registerEvents(new DailyQuests(), this);
pM.registerEvents(new Pokeballs(), this);
getCommand("test").setExecutor(new EnvironmentExCommands());
getCommand("y").setExecutor(new EnvironmentExCommands());
getCommand("n").setExecutor(new EnvironmentExCommands());

View File

@@ -1,8 +1,7 @@
package de.hessj.pokeballs;
package de.hessj.environmentex;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.DyeColor;
import org.bukkit.Location;
import org.bukkit.Particle;
@@ -59,7 +58,7 @@ import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
import net.md_5.bungee.api.ChatColor;
public class PokeballsListeners implements Listener {
public class Pokeballs implements Listener {
public static de.hessj.helper.Helper helper = new de.hessj.helper.Helper();
@EventHandler

View File

@@ -1,2 +0,0 @@
#Sun Jul 20 15:58:39 CEST 2025
gradle.version=8.14.2

View File

@@ -1,49 +0,0 @@
plugins {
`java-library`
id("io.papermc.paperweight.userdev") version "2.0.0-beta.14"
id("xyz.jpenilla.run-paper") version "2.3.1" // Adds runServer and runMojangMappedServer tasks for testing
}
group = "de.hessj.pokeballs"
version = "1.0-SNAPSHOT"
description = "pokeballs"
tasks.withType<Jar> {
destinationDirectory.set(file("../"))
}
dependencies {
implementation(files("../craftbukkit.jar"))
implementation(files("../helper-1.0-SNAPSHOT.jar"))
paperweight.paperDevBundle("1.21.4-R0.1-SNAPSHOT")
}
tasks {
// Configure reobfJar to run when invoking the build task
assemble {
dependsOn(reobfJar)
}
compileJava {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
// Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable.
// See https://openjdk.java.net/jeps/247 for more information.
options.release.set(21)
}
javadoc {
options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything
}
processResources {
filteringCharset = Charsets.UTF_8.name() // We want UTF-8 for everything
val props = mapOf(
"name" to project.name,
"version" to project.version,
"description" to project.description,
"apiVersion" to "1.21"
)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
}

View File

@@ -1,5 +0,0 @@
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "0.9.0"
}
rootProject.name = "pokeballs"

View File

@@ -1,103 +0,0 @@
package de.hessj.pokeballs;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.inventory.meta.components.CustomModelDataComponent;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import net.kyori.adventure.text.Component;
import net.md_5.bungee.api.ChatColor;
public class App extends JavaPlugin {
public static App main;
public NamespacedKey nskPokeball = new NamespacedKey(this, "R3SPokeball");
public NamespacedKey nskUsedPokeball = new NamespacedKey(this, "R3SUsedPokeball");
public NamespacedKey nskEntityPokeball = new NamespacedKey(this, "R3SEntity");
public NamespacedKey nskEntVariantPokeball = new NamespacedKey(this, "R3SEntityVariant");
public NamespacedKey nskEntStylePokeball = new NamespacedKey(this, "R3SEntityStyle");
public NamespacedKey nskAgePokeball = new NamespacedKey(this, "R3SEntityAge");
public ItemStack newPokeball;
public ItemStack usedPokeball;
public HashMap<Player, Boolean> isThrownHM = new HashMap<Player, Boolean>();
@Override
public void onEnable() {
getLogger().info("Plugin enabled!");
main = this;
listenerRegistration();
for(Player p : Bukkit.getServer().getOnlinePlayers()){
isThrownHM.put(p, false);
}
}
@Override
public void onDisable() {
getLogger().info("Plugin disabled!");
}
private void listenerRegistration() {
PluginManager pM = Bukkit.getPluginManager();
newPokeball = new ItemStack(Material.SNOWBALL);
ItemMeta newPokeballMeta = newPokeball.getItemMeta();
newPokeballMeta.displayName(Component.translatable(ChatColor.WHITE + "Pokéball"));
newPokeballMeta.setCustomModelData(1000011);
CustomModelDataComponent cmdc4 = newPokeballMeta.getCustomModelDataComponent();
List<String> list4 = Arrays.asList("pokeball");
cmdc4.setStrings(list4);
newPokeballMeta.setCustomModelDataComponent(cmdc4);
newPokeballMeta.getPersistentDataContainer().set(nskPokeball, PersistentDataType.STRING, "R3S_Pokeball");
newPokeball.setItemMeta(newPokeballMeta);
ShapedRecipe pokeballRecipe = new ShapedRecipe(nskPokeball, newPokeball);
pokeballRecipe.shape("RRR", "SES", "WWW");
pokeballRecipe.setIngredient('R', Material.RED_CONCRETE);
pokeballRecipe.setIngredient('S', Material.BLACK_CONCRETE);
pokeballRecipe.setIngredient('E', Material.IRON_NUGGET);
pokeballRecipe.setIngredient('W', Material.WHITE_CONCRETE);
if (getServer().getRecipe(nskPokeball) == null) {
getServer().addRecipe(pokeballRecipe);
}
pM.registerEvents(new PokeballsListeners(), this);
getCommand("get").setExecutor(this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (sender instanceof Player) {
if(!((Player) sender).isOp()){
return true;
}
if(args != null && args.length > 0){
if (label.equalsIgnoreCase("get") && args[0].toString() != "" && args[0].toString().equals("pokeball") && args.length == 2 && StringUtils.isNumeric(args[1])) {
ItemStack is = newPokeball.clone();
is.setAmount(Integer.parseInt(args[1]));
((Player) sender).getInventory().addItem(is);
}
else if (label.equalsIgnoreCase("get") && args[0].toString() != "" && args[0].toString().equals("pokeball")) {
((Player) sender).getInventory().addItem(newPokeball);
}
}
}
return true;
}
}

View File

@@ -1,9 +0,0 @@
main: de.hessj.pokeballs.App
name: PokeballPlugin
version: 0.1
api-version: 1.21
depend: [HelperPlugin]
commands:
get:
description: Give player Pokeball
usage: /<command>

View File

@@ -3,13 +3,4 @@ curr_folder=$(pwd)
rm -rf *-SNAPSHOT.jar
cd helper && gradle wrapper && ./gradlew clean build && gradle build
cd $curr_folder
cd betterhoppers && gradle wrapper && ./gradlew clean build && gradle build
cd $curr_folder
cd chestex && gradle wrapper && ./gradlew clean build && gradle build
cd $curr_folder
cd dailyquests && gradle wrapper && ./gradlew clean build && gradle build
cd $curr_folder
cd environmentex && gradle wrapper && ./gradlew clean build && gradle build
cd $curr_folder
cd pokeballs && gradle wrapper && ./gradlew clean build && gradle build
cd $curr_folder