mirror of
https://github.com/SunNetservers/MiniGames.git
synced 2025-02-22 10:39:34 +01:00
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:
parent
f09dcbe7ff
commit
430f340fd4
4
pom.xml
4
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>net.knarcraft</groupId>
|
||||
<artifactId>MiniGames</artifactId>
|
||||
<version>1.2</version>
|
||||
<version>1.3-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>MiniGames</name>
|
||||
@ -114,7 +114,7 @@
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.20.6-R0.1-SNAPSHOT</version>
|
||||
<version>1.21.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
@ -12,13 +12,15 @@ public interface ArenaGameMode {
|
||||
*
|
||||
* @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
|
||||
*
|
||||
* @return <p>All game-modes in this game-mode's class</p>
|
||||
*/
|
||||
@NotNull ArenaGameMode[] getValues();
|
||||
@NotNull
|
||||
ArenaGameMode[] getValues();
|
||||
|
||||
}
|
||||
|
@ -13,7 +13,8 @@ public interface ArenaSession {
|
||||
*
|
||||
* @return <p>The player's entry state</p>
|
||||
*/
|
||||
@NotNull PlayerEntryState getEntryState();
|
||||
@NotNull
|
||||
PlayerEntryState getEntryState();
|
||||
|
||||
/**
|
||||
* Triggers a win for the player playing in this session
|
||||
@ -38,14 +39,16 @@ public interface ArenaSession {
|
||||
*
|
||||
* @return <p>The session's arena</p>
|
||||
*/
|
||||
@NotNull Arena getArena();
|
||||
@NotNull
|
||||
Arena getArena();
|
||||
|
||||
/**
|
||||
* Gets the GUI with this arena's options
|
||||
*
|
||||
* @return <p>This arena's GUI</p>
|
||||
*/
|
||||
@NotNull ArenaGUI getGUI();
|
||||
@NotNull
|
||||
ArenaGUI getGUI();
|
||||
|
||||
/**
|
||||
* 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>
|
||||
*/
|
||||
@NotNull ArenaGameMode getGameMode();
|
||||
@NotNull
|
||||
ArenaGameMode getGameMode();
|
||||
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ public interface StorageKey {
|
||||
*
|
||||
* @return <p>The string key representation.</p>
|
||||
*/
|
||||
@NotNull String getKey();
|
||||
@NotNull
|
||||
String getKey();
|
||||
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package net.knarcraft.minigames.arena.reward;
|
||||
|
||||
import net.knarcraft.minigames.MiniGames;
|
||||
import net.knarcraft.minigames.config.MiniGameMessage;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -43,9 +44,10 @@ public class ItemReward implements Reward {
|
||||
|
||||
@Override
|
||||
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,
|
||||
new String[]{"{amount}", "{item}"}, new String[]{String.valueOf(item.getAmount()),
|
||||
item.getType().getKey().getKey().replace("_", " ")});
|
||||
new String[]{"{amount}", "{item}"}, new String[]{String.valueOf(item.getAmount()), name});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
@ -22,6 +22,7 @@ public interface Reward extends ConfigurationSerializable {
|
||||
*
|
||||
* @return <p>The message to display when this reward is granted</p>
|
||||
*/
|
||||
@NotNull String getGrantMessage();
|
||||
@NotNull
|
||||
String getGrantMessage();
|
||||
|
||||
}
|
||||
|
@ -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>
|
||||
*/
|
||||
private void applyFakeDamage(@NotNull Player player, double damage, @NotNull ArenaSession arenaSession) {
|
||||
if (player.getNoDamageTicks() > 0) {
|
||||
return;
|
||||
}
|
||||
double newHealth = player.getHealth() - damage;
|
||||
player.sendHurtAnimation(180);
|
||||
if (newHealth <= 0) {
|
||||
AttributeInstance health = player.getAttribute(Attribute.GENERIC_MAX_HEALTH);
|
||||
AttributeInstance health = player.getAttribute(Attribute.MAX_HEALTH);
|
||||
if (health != null) {
|
||||
player.setHealth(health.getValue());
|
||||
}
|
||||
|
@ -9,6 +9,7 @@ import net.knarcraft.minigames.arena.dropper.DropperArenaEditableProperty;
|
||||
import net.knarcraft.minigames.arena.parkour.ParkourArenaEditableProperty;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.NamespacedKey;
|
||||
import org.bukkit.Tag;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.permissions.Permission;
|
||||
@ -204,7 +205,10 @@ public final class TabCompleteHelper {
|
||||
List<String> suggestions = new ArrayList<>();
|
||||
for (Material material : Material.values()) {
|
||||
if (material.isBlock()) {
|
||||
suggestions.add(material.getKey().getKey());
|
||||
NamespacedKey key = material.getKeyOrNull();
|
||||
if (key != null) {
|
||||
suggestions.add(key.getKey());
|
||||
}
|
||||
}
|
||||
}
|
||||
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.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.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.WOODEN_BUTTONS, Tag.WOODEN_DOORS, Tag.WOODEN_FENCES, Tag.WOODEN_PRESSURE_PLATES, Tag.WOODEN_STAIRS,
|
||||
Tag.WOODEN_TRAPDOORS);
|
||||
|
@ -2,7 +2,7 @@ name: MiniGames
|
||||
prefix: MiniGames
|
||||
version: '${project.version}'
|
||||
main: net.knarcraft.minigames.MiniGames
|
||||
api-version: 1.19
|
||||
api-version: 1.21
|
||||
description: A plugin that adds various mini-games
|
||||
softdepend:
|
||||
- PlaceholderAPI
|
||||
|
Loading…
x
Reference in New Issue
Block a user