mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2024-12-22 04:37:42 +01:00
Fixed issues on java 8
This commit is contained in:
parent
81efe1abcd
commit
0b57a2d47a
@ -12,26 +12,11 @@
|
||||
|
||||
<artifactId>MMOItems-API</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}-${project.version}</finalName>
|
||||
<defaultGoal>clean package install</defaultGoal>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
This flattens the pom.xml from the API module as well so that it can be uploaded
|
||||
|
@ -36,10 +36,10 @@ public class ItemSet {
|
||||
|
||||
for (int j = 2; j <= itemLimit; j++)
|
||||
if (config.getConfigurationSection("bonuses").contains(String.valueOf(j))) {
|
||||
final String bonusesKey = "bonuses.%d".formatted(j);
|
||||
final String bonusesKey = String.format("bonuses.%d", j);
|
||||
final SetBonuses bonuses = new SetBonuses();
|
||||
final ConfigurationSection bonusesSection = config.getConfigurationSection(bonusesKey);
|
||||
Validate.notNull(bonusesSection, "Item set '%s' is not a valid configuration section.".formatted(id));
|
||||
Validate.notNull(bonusesSection, String.format("Item set '%s' is not a valid configuration section.", id));
|
||||
|
||||
// Add permissions
|
||||
for (String perm : bonusesSection.getStringList("granted-permissions"))
|
||||
@ -52,8 +52,8 @@ public class ItemSet {
|
||||
|
||||
// ability
|
||||
if (key.startsWith("ability-")) {
|
||||
final ConfigurationSection section = config.getConfigurationSection("%s.%s".formatted(bonusesKey, key));
|
||||
Validate.notNull(section, "Ability '%s' is not a valid configuration section.".formatted(key));
|
||||
final ConfigurationSection section = config.getConfigurationSection(String.format("%s.%s", bonusesKey, key));
|
||||
Validate.notNull(section, String.format("Ability '%s' is not a valid configuration section.", key));
|
||||
bonuses.addAbility(new AbilityData(section));
|
||||
continue;
|
||||
}
|
||||
@ -61,26 +61,26 @@ public class ItemSet {
|
||||
// potion effect
|
||||
if (key.startsWith("potion-")) {
|
||||
PotionEffectType potionEffectType = PotionEffectType.getByName(format.substring("potion-".length()));
|
||||
Validate.notNull(potionEffectType, "Could not load potion effect type from '%s'".formatted(format));
|
||||
Validate.notNull(potionEffectType, String.format("Could not load potion effect type from '%s'", format));
|
||||
bonuses.addPotionEffect(new PotionEffect(potionEffectType, MMOUtils.getEffectDuration(potionEffectType),
|
||||
config.getInt("%s.%s".formatted(bonusesKey, key)) - 1, true, false));
|
||||
config.getInt(String.format("%s.%s", bonusesKey, key)) - 1, true, false));
|
||||
continue;
|
||||
}
|
||||
|
||||
// particle effect
|
||||
if (key.startsWith("particle-")) {
|
||||
final ConfigurationSection section = config.getConfigurationSection("bonuses.%d.%s".formatted(j, key));
|
||||
Validate.notNull(section, "Particle effect '%s' is not a valid configuration section.".formatted(key));
|
||||
final ConfigurationSection section = config.getConfigurationSection(String.format("bonuses.%d.%s", j, key));
|
||||
Validate.notNull(section, String.format("Particle effect '%s' is not a valid configuration section.", key));
|
||||
bonuses.addParticle(new ParticleData(section));
|
||||
continue;
|
||||
}
|
||||
|
||||
// stat
|
||||
ItemStat<?, ?> stat = MMOItems.plugin.getStats().get(format);
|
||||
Validate.notNull(stat, "Could not find stat called '%s'".formatted(format));
|
||||
bonuses.addStat(stat, config.getDouble("bonuses.%d.%s".formatted(j, key)));
|
||||
Validate.notNull(stat, String.format("Could not find stat called '%s'", format));
|
||||
bonuses.addStat(stat, config.getDouble(String.format("bonuses.%d.%s", j, key)));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
throw new IllegalArgumentException("Could not load set bonus '%s': %s".formatted(key, exception.getMessage()));
|
||||
throw new IllegalArgumentException(String.format("Could not load set bonus '%s': %s", key, exception.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5,8 +5,10 @@ import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
// TODO: 2/13/2021 Remove this eventually.
|
||||
@Deprecated
|
||||
public class NamedItemStack extends ItemStack {
|
||||
|
||||
@Deprecated
|
||||
public NamedItemStack(Material material, String name) {
|
||||
super(material);
|
||||
|
||||
|
@ -87,10 +87,10 @@ public class ItemBrowser extends PluginInventory {
|
||||
ItemStack item = currentType.getItem();
|
||||
item.setAmount(Math.max(1, Math.min(64, items)));
|
||||
ItemMeta meta = item.getItemMeta();
|
||||
AdventureUtils.setDisplayName(meta, "&a%s&8 (lick to browse)".formatted(currentType.getName()));
|
||||
AdventureUtils.setDisplayName(meta, String.format("&a%s&8 (lick to browse)", currentType.getName()));
|
||||
meta.addItemFlags(ItemFlag.values());
|
||||
List<String> lore = new ArrayList<>();
|
||||
lore.add("&7&oThere %s %s &7&oitem%s in that currentType.".formatted(items == 1 ? "is" : "are", items < 1 ? "&c&ono" : "&6&o%d".formatted(items), items == 1 ? "" : "s"));
|
||||
lore.add(String.format("&7&oThere %s %s &7&oitem%s in that currentType.", items == 1 ? "is" : "are", items < 1 ? "&c&ono" : "&6&o" + items, items == 1 ? "" : "s"));
|
||||
AdventureUtils.setLore(meta, lore);
|
||||
item.setItemMeta(meta);
|
||||
|
||||
|
@ -1,20 +1,19 @@
|
||||
package net.Indyuce.mmoitems.gui.edition;
|
||||
|
||||
import io.lumine.mythic.lib.api.util.AltChar;
|
||||
import io.lumine.mythic.lib.api.util.ItemFactory;
|
||||
import io.lumine.mythic.lib.version.VersionMaterial;
|
||||
import net.Indyuce.mmoitems.ItemStats;
|
||||
import net.Indyuce.mmoitems.MMOItems;
|
||||
import net.Indyuce.mmoitems.api.Type;
|
||||
import net.Indyuce.mmoitems.api.edition.StatEdition;
|
||||
import net.Indyuce.mmoitems.api.item.template.MMOItemTemplate;
|
||||
import net.Indyuce.mmoitems.api.item.util.NamedItemStack;
|
||||
import net.Indyuce.mmoitems.util.MMOUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryAction;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
@ -23,7 +22,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class UpgradingEdition extends EditionInventory {
|
||||
private static final ItemStack notAvailable = new NamedItemStack(VersionMaterial.RED_STAINED_GLASS_PANE.toMaterial(), "&cNot Available");
|
||||
private static final ItemStack notAvailable = ItemFactory.of(Material.RED_STAINED_GLASS_PANE).name("&cNot Available").build();
|
||||
|
||||
public UpgradingEdition(Player player, MMOItemTemplate template) {
|
||||
super(player, template);
|
||||
|
@ -25,10 +25,10 @@ public class SetManager implements Reloadable {
|
||||
try {
|
||||
final ConfigurationSection section = config.getConfig().getConfigurationSection(id);
|
||||
if (section == null)
|
||||
throw new IllegalStateException("Item set '%s' is not a valid configuration section.".formatted(id));
|
||||
throw new IllegalStateException(String.format("Item set '%s' is not a valid configuration section.", id));
|
||||
itemSets.put(id, new ItemSet(section));
|
||||
} catch (IllegalArgumentException exception) {
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, "Could not load item set '%s': %s".formatted(id, exception.getMessage()));
|
||||
MMOItems.plugin.getLogger().log(Level.WARNING, String.format("Could not load item set '%s': %s", id, exception.getMessage()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -57,7 +57,7 @@ public class ItemSetStat extends StringStat implements GemStoneStat {
|
||||
@Override
|
||||
public ArrayList<ItemTag> getAppliedNBT(@NotNull StringData data) {
|
||||
ItemSet set = MMOItems.plugin.getSets().get(data.toString());
|
||||
Validate.notNull(set, "Could not find item set with ID '%s'".formatted(data));
|
||||
Validate.notNull(set, String.format("Could not find item set with ID '%s'", data));
|
||||
|
||||
// Make Array
|
||||
ArrayList<ItemTag> ret = new ArrayList<>();
|
||||
@ -78,7 +78,7 @@ public class ItemSetStat extends StringStat implements GemStoneStat {
|
||||
@Override
|
||||
public void whenInput(@NotNull EditionInventory inv, @NotNull String message, Object... info) {
|
||||
ItemSet set = MMOItems.plugin.getSets().get(message);
|
||||
Validate.notNull(set, "Couldn't find the set named '%s'.".formatted(message));
|
||||
Validate.notNull(set, String.format("Couldn't find the set named '%s'.", message));
|
||||
super.whenInput(inv, message, info);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,6 @@ public class PluginUtils {
|
||||
if (Bukkit.getPluginManager().getPlugin(name) == null)
|
||||
return;
|
||||
callback.accept(null);
|
||||
MMOItems.plugin.getLogger().log(Level.INFO, "Hooked onto %s".formatted(name));
|
||||
MMOItems.plugin.getLogger().log(Level.INFO, String.format("Hooked onto %s", name));
|
||||
}
|
||||
}
|
||||
|
@ -12,11 +12,6 @@
|
||||
|
||||
<artifactId>MMOItems-Dist</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>16</maven.compiler.source>
|
||||
<maven.compiler.target>16</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<!-- Dependencies -->
|
||||
<dependencies>
|
||||
|
||||
|
70
pom.xml
70
pom.xml
@ -22,6 +22,41 @@
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<!-- Build -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
Clears all 'target' folders before building the plugin again.
|
||||
This prevents MythicLib from including old versions of previous
|
||||
classes when building the same version again
|
||||
-->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>auto-clean</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<!-- Repositories -->
|
||||
<repositories>
|
||||
<repository>
|
||||
@ -67,39 +102,4 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<!-- Build -->
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--
|
||||
Clears all 'target' folders before building the plugin again.
|
||||
This prevents MythicLib from including old versions of previous
|
||||
classes when building the same version again
|
||||
-->
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>3.1.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>auto-clean</id>
|
||||
<phase>initialize</phase>
|
||||
<goals>
|
||||
<goal>clean</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
Loading…
Reference in New Issue
Block a user