Updates to 1.21.4

Updates Spigot version
Updates API version
Fixes invulnerability ticks not working as intended
Removes missing material tag.
Fixes max health attribute.
This commit is contained in:
Kristian Knarvik 2025-02-21 18:11:06 +01:00
parent f09dcbe7ff
commit 430f340fd4
9 changed files with 33 additions and 16 deletions

View File

@ -6,7 +6,7 @@
<groupId>net.knarcraft</groupId> <groupId>net.knarcraft</groupId>
<artifactId>MiniGames</artifactId> <artifactId>MiniGames</artifactId>
<version>1.2</version> <version>1.3-SNAPSHOT</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>MiniGames</name> <name>MiniGames</name>
@ -114,7 +114,7 @@
<dependency> <dependency>
<groupId>org.spigotmc</groupId> <groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId> <artifactId>spigot-api</artifactId>
<version>1.20.6-R0.1-SNAPSHOT</version> <version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
<dependency> <dependency>

View File

@ -12,13 +12,15 @@ public interface ArenaGameMode {
* *
* @return <p>The name of this game-mode</p> * @return <p>The name of this game-mode</p>
*/ */
@NotNull String name(); @NotNull
String name();
/** /**
* Gets a set of all available arena game-modes in the type definition of this game-mode * Gets a set of all available arena game-modes in the type definition of this game-mode
* *
* @return <p>All game-modes in this game-mode's class</p> * @return <p>All game-modes in this game-mode's class</p>
*/ */
@NotNull ArenaGameMode[] getValues(); @NotNull
ArenaGameMode[] getValues();
} }

View File

@ -13,7 +13,8 @@ public interface ArenaSession {
* *
* @return <p>The player's entry state</p> * @return <p>The player's entry state</p>
*/ */
@NotNull PlayerEntryState getEntryState(); @NotNull
PlayerEntryState getEntryState();
/** /**
* Triggers a win for the player playing in this session * Triggers a win for the player playing in this session
@ -38,14 +39,16 @@ public interface ArenaSession {
* *
* @return <p>The session's arena</p> * @return <p>The session's arena</p>
*/ */
@NotNull Arena getArena(); @NotNull
Arena getArena();
/** /**
* Gets the GUI with this arena's options * Gets the GUI with this arena's options
* *
* @return <p>This arena's GUI</p> * @return <p>This arena's GUI</p>
*/ */
@NotNull ArenaGUI getGUI(); @NotNull
ArenaGUI getGUI();
/** /**
* Resets the session to allow a player to try again * Resets the session to allow a player to try again
@ -57,6 +60,7 @@ public interface ArenaSession {
* *
* @return <p>The game-mode the player is playing</p> * @return <p>The game-mode the player is playing</p>
*/ */
@NotNull ArenaGameMode getGameMode(); @NotNull
ArenaGameMode getGameMode();
} }

View File

@ -12,6 +12,7 @@ public interface StorageKey {
* *
* @return <p>The string key representation.</p> * @return <p>The string key representation.</p>
*/ */
@NotNull String getKey(); @NotNull
String getKey();
} }

View File

@ -2,6 +2,7 @@ package net.knarcraft.minigames.arena.reward;
import net.knarcraft.minigames.MiniGames; import net.knarcraft.minigames.MiniGames;
import net.knarcraft.minigames.config.MiniGameMessage; import net.knarcraft.minigames.config.MiniGameMessage;
import org.bukkit.NamespacedKey;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -43,9 +44,10 @@ public class ItemReward implements Reward {
@Override @Override
public @NotNull String getGrantMessage() { public @NotNull String getGrantMessage() {
NamespacedKey key = item.getType().getKeyOrNull();
String name = key == null ? "Unnamed item" : key.getKey().replace("_", " ");
return MiniGames.getInstance().getStringFormatter().replacePlaceholders(MiniGameMessage.SUCCESS_ITEM_REWARDED, return MiniGames.getInstance().getStringFormatter().replacePlaceholders(MiniGameMessage.SUCCESS_ITEM_REWARDED,
new String[]{"{amount}", "{item}"}, new String[]{String.valueOf(item.getAmount()), new String[]{"{amount}", "{item}"}, new String[]{String.valueOf(item.getAmount()), name});
item.getType().getKey().getKey().replace("_", " ")});
} }
@NotNull @NotNull

View File

@ -22,6 +22,7 @@ public interface Reward extends ConfigurationSerializable {
* *
* @return <p>The message to display when this reward is granted</p> * @return <p>The message to display when this reward is granted</p>
*/ */
@NotNull String getGrantMessage(); @NotNull
String getGrantMessage();
} }

View File

@ -62,10 +62,13 @@ public class DamageListener implements Listener {
* @param arenaSession <p>The arena session to trigger a loss for, if the player reaches 0 damage</p> * @param arenaSession <p>The arena session to trigger a loss for, if the player reaches 0 damage</p>
*/ */
private void applyFakeDamage(@NotNull Player player, double damage, @NotNull ArenaSession arenaSession) { private void applyFakeDamage(@NotNull Player player, double damage, @NotNull ArenaSession arenaSession) {
if (player.getNoDamageTicks() > 0) {
return;
}
double newHealth = player.getHealth() - damage; double newHealth = player.getHealth() - damage;
player.sendHurtAnimation(180); player.sendHurtAnimation(180);
if (newHealth <= 0) { if (newHealth <= 0) {
AttributeInstance health = player.getAttribute(Attribute.GENERIC_MAX_HEALTH); AttributeInstance health = player.getAttribute(Attribute.MAX_HEALTH);
if (health != null) { if (health != null) {
player.setHealth(health.getValue()); player.setHealth(health.getValue());
} }

View File

@ -9,6 +9,7 @@ import net.knarcraft.minigames.arena.dropper.DropperArenaEditableProperty;
import net.knarcraft.minigames.arena.parkour.ParkourArenaEditableProperty; import net.knarcraft.minigames.arena.parkour.ParkourArenaEditableProperty;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Tag; import org.bukkit.Tag;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.permissions.Permission; import org.bukkit.permissions.Permission;
@ -204,7 +205,10 @@ public final class TabCompleteHelper {
List<String> suggestions = new ArrayList<>(); List<String> suggestions = new ArrayList<>();
for (Material material : Material.values()) { for (Material material : Material.values()) {
if (material.isBlock()) { if (material.isBlock()) {
suggestions.add(material.getKey().getKey()); NamespacedKey key = material.getKeyOrNull();
if (key != null) {
suggestions.add(key.getKey());
}
} }
} }
for (Tag<Material> tag : getTags()) { for (Tag<Material> tag : getTags()) {
@ -383,7 +387,7 @@ public final class TabCompleteHelper {
Tag.LAPIS_ORES, Tag.LEAVES, Tag.LOGS, Tag.MANGROVE_LOGS, Tag.NYLIUM, Tag.OAK_LOGS, Tag.PLANKS, Tag.LAPIS_ORES, Tag.LEAVES, Tag.LOGS, Tag.MANGROVE_LOGS, Tag.NYLIUM, Tag.OAK_LOGS, Tag.PLANKS,
Tag.PORTALS, Tag.PRESSURE_PLATES, Tag.RAILS, Tag.REDSTONE_ORES, Tag.SAND, Tag.SAPLINGS, Tag.WART_BLOCKS, Tag.PORTALS, Tag.PRESSURE_PLATES, Tag.RAILS, Tag.REDSTONE_ORES, Tag.SAND, Tag.SAPLINGS, Tag.WART_BLOCKS,
Tag.SHULKER_BOXES, Tag.SIGNS, Tag.SLABS, Tag.SMALL_FLOWERS, Tag.SNOW, Tag.SPRUCE_LOGS, Tag.STAIRS, Tag.SHULKER_BOXES, Tag.SIGNS, Tag.SLABS, Tag.SMALL_FLOWERS, Tag.SNOW, Tag.SPRUCE_LOGS, Tag.STAIRS,
Tag.STANDING_SIGNS, Tag.STONE_BRICKS, Tag.STONE_BUTTONS, Tag.TALL_FLOWERS, Tag.TERRACOTTA, Tag.WOOL, Tag.STANDING_SIGNS, Tag.STONE_BRICKS, Tag.STONE_BUTTONS, Tag.TERRACOTTA, Tag.WOOL,
Tag.TRAPDOORS, Tag.WALL_CORALS, Tag.WALL_HANGING_SIGNS, Tag.WALL_SIGNS, Tag.WARPED_STEMS, Tag.TRAPDOORS, Tag.WALL_CORALS, Tag.WALL_HANGING_SIGNS, Tag.WALL_SIGNS, Tag.WARPED_STEMS,
Tag.WOODEN_BUTTONS, Tag.WOODEN_DOORS, Tag.WOODEN_FENCES, Tag.WOODEN_PRESSURE_PLATES, Tag.WOODEN_STAIRS, Tag.WOODEN_BUTTONS, Tag.WOODEN_DOORS, Tag.WOODEN_FENCES, Tag.WOODEN_PRESSURE_PLATES, Tag.WOODEN_STAIRS,
Tag.WOODEN_TRAPDOORS); Tag.WOODEN_TRAPDOORS);

View File

@ -2,7 +2,7 @@ name: MiniGames
prefix: MiniGames prefix: MiniGames
version: '${project.version}' version: '${project.version}'
main: net.knarcraft.minigames.MiniGames main: net.knarcraft.minigames.MiniGames
api-version: 1.19 api-version: 1.21
description: A plugin that adds various mini-games description: A plugin that adds various mini-games
softdepend: softdepend:
- PlaceholderAPI - PlaceholderAPI