Compiles on java 8

This commit is contained in:
Indyuce 2022-12-22 23:06:38 +01:00
parent b53a21dbe5
commit 6650527584
5 changed files with 17 additions and 13 deletions

View File

@ -27,8 +27,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<source>16</source> <source>1.8</source>
<target>16</target> <target>1.8</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>

View File

@ -154,19 +154,21 @@ public class CraftingStationPreview extends PluginInventory {
NBTItem nbtItem = MythicLib.plugin.getVersion().getWrapper().getNBTItem(event.getCurrentItem()); NBTItem nbtItem = MythicLib.plugin.getVersion().getWrapper().getNBTItem(event.getCurrentItem());
switch (nbtItem.getString("ItemId")) { switch (nbtItem.getString("ItemId")) {
case "CONFIRM" -> { case "CONFIRM":
previous.processRecipe(recipe); previous.processRecipe(recipe);
previous.open(); previous.open();
} return;
case "PREVIOUS_PAGE" -> { case "PREVIOUS_PAGE":
page--; page--;
open(); open();
} return;
case "NEXT_PAGE" -> { case "NEXT_PAGE":
page++; page++;
open(); open();
} return;
case "BACK" -> previous.open(); case "BACK":
previous.open();
return;
} }
} }
} }

View File

@ -126,9 +126,10 @@ public class EntityManager implements Listener {
@EventHandler(ignoreCancelled = true) @EventHandler(ignoreCancelled = true)
public void onHitEffects(PlayerAttackEvent event) { public void onHitEffects(PlayerAttackEvent event) {
if (!(event.getAttack() instanceof ProjectileAttackMetadata projAttack)) if (!(event.getAttack() instanceof ProjectileAttackMetadata))
return; return;
final ProjectileAttackMetadata projAttack = (ProjectileAttackMetadata) event.getAttack();
final ProjectileData data = projectiles.get(projAttack.getProjectile().getEntityId()); final ProjectileData data = projectiles.get(projAttack.getProjectile().getEntityId());
if (data == null) if (data == null)
return; return;

View File

@ -38,7 +38,7 @@ public class RepairUtils {
final Player player = playerData.getPlayer(); final Player player = playerData.getPlayer();
if (target.getBoolean("Unbreakable") if (target.getBoolean("Unbreakable")
|| !target.getItem().hasItemMeta() || !target.getItem().hasItemMeta()
|| !(target.getItem().getItemMeta() instanceof Damageable meta) || !(target.getItem().getItemMeta() instanceof Damageable)
|| ((Damageable) target.getItem().getItemMeta()).getDamage() <= 0) || ((Damageable) target.getItem().getItemMeta()).getDamage() <= 0)
return false; return false;
@ -48,6 +48,7 @@ public class RepairUtils {
return false; return false;
repairAmount = called.getRepaired(); repairAmount = called.getRepaired();
final Damageable meta = (Damageable) target.getItem().getItemMeta();
meta.setDamage(Math.max(0, meta.getDamage() - repairAmount)); meta.setDamage(Math.max(0, meta.getDamage() - repairAmount));
target.getItem().setItemMeta(meta); target.getItem().setItemMeta(meta);
Message.REPAIRED_ITEM.format(ChatColor.YELLOW, Message.REPAIRED_ITEM.format(ChatColor.YELLOW,

View File

@ -62,8 +62,8 @@
<artifactId>maven-compiler-plugin</artifactId> <artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version> <version>3.8.1</version>
<configuration> <configuration>
<source>10</source> <source>1.8</source>
<target>10</target> <target>1.8</target>
<encoding>UTF-8</encoding> <encoding>UTF-8</encoding>
</configuration> </configuration>
</plugin> </plugin>