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>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>

View File

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

View File

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

View File

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

View File

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