Second Smelt makes use of its own section in Bonus Drops in config.yml

Co-authored-by: t00thpick1 <t00thpick1dirko@gmail.com>
This commit is contained in:
nossr50
2020-07-13 12:31:30 -07:00
parent 7eae59a0b3
commit fdd951f1f1
176 changed files with 642 additions and 604 deletions

View File

@ -250,7 +250,7 @@ public final class BlockUtils {
* @return HashSet with the IDs of every transparent block
*/
public static HashSet<Material> getTransparentBlocks() {
HashSet<Material> transparentBlocks = new HashSet<Material>();
HashSet<Material> transparentBlocks = new HashSet<>();
for (Material material : Material.values()) {
if (material.isTransparent()) {

View File

@ -152,9 +152,10 @@ public final class ChimaeraWing {
ItemStack itemStack = new ItemStack(Config.getInstance().getChimaeraItem(), amount);
ItemMeta itemMeta = itemStack.getItemMeta();
//noinspection ConstantConditions
itemMeta.setDisplayName(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
List<String> itemLore = new ArrayList<String>();
List<String> itemLore = new ArrayList<>();
itemLore.add("mcMMO Item");
itemLore.add(LocaleLoader.getString("Item.ChimaeraWing.Lore"));
itemMeta.setLore(itemLore);

View File

@ -6,7 +6,7 @@ import java.util.HashMap;
public class EnchantmentUtils {
private static final HashMap<String, Enchantment> enchants = new HashMap<String, Enchantment>();
private static final HashMap<String, Enchantment> enchants = new HashMap<>();
static {
enchants.put("SHARPNESS", Enchantment.DAMAGE_ALL);

View File

@ -31,8 +31,8 @@ public final class HardcoreManager {
PlayerProfile playerProfile = UserManager.getPlayer(player).getProfile();
int totalLevelsLost = 0;
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
HashMap<String, Integer> levelChanged = new HashMap<>();
HashMap<String, Float> experienceChanged = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
if (!primarySkillType.getHardcoreStatLossEnabled()) {
@ -83,8 +83,8 @@ public final class HardcoreManager {
PlayerProfile victimProfile = UserManager.getPlayer(victim).getProfile();
int totalLevelsStolen = 0;
HashMap<String, Integer> levelChanged = new HashMap<String, Integer>();
HashMap<String, Float> experienceChanged = new HashMap<String, Float>();
HashMap<String, Integer> levelChanged = new HashMap<>();
HashMap<String, Float> experienceChanged = new HashMap<>();
for (PrimarySkillType primarySkillType : PrimarySkillType.NON_CHILD_SKILLS) {
if (!primarySkillType.getHardcoreVampirismEnabled()) {

View File

@ -96,9 +96,9 @@ public final class HolidayManager {
Statistic.PIG_ONE_CM);
static {
List<Color> colors = new ArrayList<Color>();
List<ChatColor> chatColors = new ArrayList<ChatColor>();
List<ChatColor> chatFormats = new ArrayList<ChatColor>();
List<Color> colors = new ArrayList<>();
List<ChatColor> chatColors = new ArrayList<>();
List<ChatColor> chatFormats = new ArrayList<>();
for (ChatColor color : ChatColor.values()) {
if (color.isColor()) {
@ -137,7 +137,7 @@ public final class HolidayManager {
}
}
hasCelebrated = new ArrayList<String>();
hasCelebrated = new ArrayList<>();
try {
hasCelebrated.clear();
@ -161,7 +161,7 @@ public final class HolidayManager {
private void cleanupFiles() {
File FlatFileDir = new File(mcMMO.getFlatFileDirectory());
File legacy = new File(FlatFileDir, "anniversary.yml");
List<File> toDelete = new ArrayList<File>();
List<File> toDelete = new ArrayList<>();
if (legacy.exists()) {
toDelete.add(legacy);

View File

@ -459,7 +459,12 @@ public final class ItemUtils {
}
ItemMeta itemMeta = item.getItemMeta();
return itemMeta.hasLore() && itemMeta.getLore().contains("mcMMO Item");
if(itemMeta == null)
return false;
return itemMeta.getLore() != null
&& itemMeta.getLore().contains("mcMMO Item");
}
public static boolean isChimaeraWing(ItemStack item) {
@ -468,6 +473,10 @@ public final class ItemUtils {
}
ItemMeta itemMeta = item.getItemMeta();
if(itemMeta == null)
return false;
return itemMeta.hasDisplayName() && itemMeta.getDisplayName().equals(ChatColor.GOLD + LocaleLoader.getString("Item.ChimaeraWing.Name"));
}
}

View File

@ -138,19 +138,19 @@ public final class MobHealthbarUtils {
int coloredDisplay = (int) Math.ceil(fullDisplay * (healthPercentage / 100.0D));
int grayDisplay = fullDisplay - coloredDisplay;
String healthbar = color + "";
StringBuilder healthbar = new StringBuilder(color + "");
for (int i = 0; i < coloredDisplay; i++) {
healthbar += symbol;
healthbar.append(symbol);
}
healthbar += ChatColor.GRAY;
healthbar.append(ChatColor.GRAY);
for (int i = 0; i < grayDisplay; i++) {
healthbar += symbol;
healthbar.append(symbol);
}
return healthbar;
return healthbar.toString();
}
/**

View File

@ -22,36 +22,36 @@ import java.util.HashMap;
import java.util.List;
public class ModManager {
private final List<Repairable> repairables = new ArrayList<Repairable>();
private final List<Repairable> repairables = new ArrayList<>();
// Armor Mods
private final List<Material> customBoots = new ArrayList<Material>();
private final List<Material> customChestplates = new ArrayList<Material>();
private final List<Material> customHelmets = new ArrayList<Material>();
private final List<Material> customLeggings = new ArrayList<Material>();
private final List<Material> customBoots = new ArrayList<>();
private final List<Material> customChestplates = new ArrayList<>();
private final List<Material> customHelmets = new ArrayList<>();
private final List<Material> customLeggings = new ArrayList<>();
// Block Mods
private final List<Material> customExcavationBlocks = new ArrayList<Material>();
private final List<Material> customHerbalismBlocks = new ArrayList<Material>();
private final List<Material> customMiningBlocks = new ArrayList<Material>();
private final List<Material> customOres = new ArrayList<Material>();
private final List<Material> customLogs = new ArrayList<Material>();
private final List<Material> customLeaves = new ArrayList<Material>();
private final List<Material> customAbilityBlocks = new ArrayList<Material>();
private final List<Material> customExcavationBlocks = new ArrayList<>();
private final List<Material> customHerbalismBlocks = new ArrayList<>();
private final List<Material> customMiningBlocks = new ArrayList<>();
private final List<Material> customOres = new ArrayList<>();
private final List<Material> customLogs = new ArrayList<>();
private final List<Material> customLeaves = new ArrayList<>();
private final List<Material> customAbilityBlocks = new ArrayList<>();
private final HashMap<Material, CustomBlock> customBlockMap = new HashMap<>();
// Entity Mods
private final HashMap<String, CustomEntity> customEntityClassMap = new HashMap<String, CustomEntity>();
private final HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<String, CustomEntity>();
private final HashMap<String, CustomEntity> customEntityClassMap = new HashMap<>();
private final HashMap<String, CustomEntity> customEntityTypeMap = new HashMap<>();
// Tool Mods
private final List<Material> customAxes = new ArrayList<Material>();
private final List<Material> customBows = new ArrayList<Material>();
private final List<Material> customHoes = new ArrayList<Material>();
private final List<Material> customPickaxes = new ArrayList<Material>();
private final List<Material> customShovels = new ArrayList<Material>();
private final List<Material> customSwords = new ArrayList<Material>();
private final HashMap<Material, CustomTool> customToolMap = new HashMap<Material, CustomTool>();
private final List<Material> customAxes = new ArrayList<>();
private final List<Material> customBows = new ArrayList<>();
private final List<Material> customHoes = new ArrayList<>();
private final List<Material> customPickaxes = new ArrayList<>();
private final List<Material> customShovels = new ArrayList<>();
private final List<Material> customSwords = new ArrayList<>();
private final HashMap<Material, CustomTool> customToolMap = new HashMap<>();
public void registerCustomArmor(CustomArmorConfig config) {
customBoots.addAll(config.customBoots);

View File

@ -10,8 +10,8 @@ public class BiomeAdapter {
static {
List<Biome> allBiomes = Arrays.asList(Biome.values());
List<Biome> waterBiomes = new ArrayList<Biome>();
List<Biome> iceBiomes = new ArrayList<Biome>();
List<Biome> waterBiomes = new ArrayList<>();
List<Biome> iceBiomes = new ArrayList<>();
for (Biome biome : allBiomes) {
if (isWater(biome.name()) && !isCold(biome.name())) {
waterBiomes.add(biome);

View File

@ -8,7 +8,7 @@ import java.io.*;
import java.util.HashMap;
public class HashChunkletManager implements ChunkletManager {
public HashMap<String, ChunkletStore> store = new HashMap<String, ChunkletStore>();
public HashMap<String, ChunkletStore> store = new HashMap<>();
@Override
public void loadChunklet(int cx, int cy, int cz, World world) {

View File

@ -11,57 +11,46 @@ import org.bukkit.block.Block;
public class NullChunkletManager implements ChunkletManager {
@Override
public void loadChunklet(int cx, int cy, int cz, World world) {
return;
}
@Override
public void unloadChunklet(int cx, int cy, int cz, World world) {
return;
}
@Override
public void loadChunk(int cx, int cz, World world) {
return;
}
@Override
public void unloadChunk(int cx, int cz, World world) {
return;
}
@Override
public void chunkLoaded(int cx, int cz, World world) {
return;
}
@Override
public void chunkUnloaded(int cx, int cz, World world) {
return;
}
@Override
public void saveWorld(World world) {
return;
}
@Override
public void unloadWorld(World world) {
return;
}
@Override
public void loadWorld(World world) {
return;
}
@Override
public void saveAll() {
return;
}
@Override
public void unloadAll() {
return;
}
@Override
@ -76,26 +65,21 @@ public class NullChunkletManager implements ChunkletManager {
@Override
public void setTrue(int x, int y, int z, World world) {
return;
}
@Override
public void setTrue(Block block) {
return;
}
@Override
public void setFalse(int x, int y, int z, World world) {
return;
}
@Override
public void setFalse(Block block) {
return;
}
@Override
public void cleanUp() {
return;
}
}

View File

@ -11,10 +11,10 @@ import java.io.*;
import java.util.*;
public class HashChunkManager implements ChunkManager {
private final HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>>();
public HashMap<String, ChunkStore> store = new HashMap<String, ChunkStore>();
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<BlockStoreConversionZDirectory>();
private final HashMap<UUID, Boolean> oldData = new HashMap<UUID, Boolean>();
private final HashMap<UUID, HashMap<Long, McMMOSimpleRegionFile>> regionFiles = new HashMap<>();
public HashMap<String, ChunkStore> store = new HashMap<>();
public ArrayList<BlockStoreConversionZDirectory> converters = new ArrayList<>();
private final HashMap<UUID, Boolean> oldData = new HashMap<>();
@Override
public synchronized void closeAll() {
@ -38,31 +38,19 @@ public class HashChunkManager implements ChunkManager {
if (in == null) {
return null;
}
ObjectInputStream objectStream = new ObjectInputStream(in);
try {
try (ObjectInputStream objectStream = new ObjectInputStream(in)) {
Object o = objectStream.readObject();
if (o instanceof ChunkStore) {
return (ChunkStore) o;
}
throw new RuntimeException("Wrong class type read for chunk meta data for " + x + ", " + z);
}
catch (IOException e) {
} catch (IOException | ClassNotFoundException e) {
e.printStackTrace();
// Assume the format changed
return null;
//throw new RuntimeException("Unable to process chunk meta data for " + x + ", " + z, e);
}
catch (ClassNotFoundException e) {
e.printStackTrace();
// Assume the format changed
//System.out.println("[SpoutPlugin] is Unable to find serialized class for " + x + ", " + z + ", " + e.getMessage());
return null;
//throw new RuntimeException("Unable to find serialized class for " + x + ", " + z, e);
}
finally {
objectStream.close();
}
}
@Override
@ -98,7 +86,7 @@ public class HashChunkManager implements ChunkManager {
UUID key = world.getUID();
HashMap<Long, McMMOSimpleRegionFile> worldRegions = regionFiles.computeIfAbsent(key, k -> new HashMap<Long, McMMOSimpleRegionFile>());
HashMap<Long, McMMOSimpleRegionFile> worldRegions = regionFiles.computeIfAbsent(key, k -> new HashMap<>());
int rx = x >> 5;
int rz = z >> 5;
@ -217,7 +205,7 @@ public class HashChunkManager implements ChunkManager {
closeAll();
String worldName = world.getName();
List<String> keys = new ArrayList<String>(store.keySet());
List<String> keys = new ArrayList<>(store.keySet());
for (String key : keys) {
String[] info = key.split(",");
if (worldName.equals(info[0])) {
@ -239,7 +227,7 @@ public class HashChunkManager implements ChunkManager {
String worldName = world.getName();
List<String> keys = new ArrayList<String>(store.keySet());
List<String> keys = new ArrayList<>(store.keySet());
for (String key : keys) {
String[] info = key.split(",");
if (worldName.equals(info[0])) {

View File

@ -29,7 +29,7 @@ public class McMMOSimpleRegionFile {
private final int[] dataStart = new int[1024];
private final int[] dataActualLength = new int[1024];
private final int[] dataLength = new int[1024];
private final ArrayList<Boolean> inuse = new ArrayList<Boolean>();
private final ArrayList<Boolean> inuse = new ArrayList<>();
private int segmentSize;
private int segmentMask;
private final int rx;

View File

@ -28,7 +28,6 @@ public class BlockStoreConversionMain implements Runnable {
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
return;
}
@Override
@ -87,6 +86,5 @@ public class BlockStoreConversionMain implements Runnable {
this.world = null;
this.scheduler = null;
this.converters = null;
return;
}
}

View File

@ -29,7 +29,6 @@ public class BlockStoreConversionXDirectory implements Runnable {
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
return;
}
@Override

View File

@ -42,7 +42,6 @@ public class BlockStoreConversionZDirectory implements Runnable {
}
this.taskID = this.scheduler.runTaskLater(mcMMO.p, this, 1).getTaskId();
return;
}
@Override

View File

@ -199,7 +199,7 @@ public final class CommandRegistrationManager {
}
private static void registerXprateCommand() {
List<String> aliasList = new ArrayList<String>();
List<String> aliasList = new ArrayList<>();
aliasList.add("mcxprate");
PluginCommand command = mcMMO.p.getCommand("xprate");

View File

@ -106,7 +106,7 @@ public final class CommandUtils {
}
public static boolean hasPlayerDataKey(CommandSender sender) {
if (sender == null || !(sender instanceof Player)) {
if (!(sender instanceof Player)) {
return false;
}
@ -221,7 +221,7 @@ public final class CommandUtils {
PlayerProfile profile = UserManager.getPlayer(inspect).getProfile();
List<String> displayData = new ArrayList<String>();
List<String> displayData = new ArrayList<>();
displayData.add(header);
for (PrimarySkillType skill : skillGroup) {
@ -239,7 +239,7 @@ public final class CommandUtils {
public static List<String> getOnlinePlayerNames(CommandSender sender) {
Player player = sender instanceof Player ? (Player) sender : null;
List<String> onlinePlayerNames = new ArrayList<String>();
List<String> onlinePlayerNames = new ArrayList<>();
for (Player onlinePlayer : mcMMO.p.getServer().getOnlinePlayers()) {
if (player != null && player.canSee(onlinePlayer)) {
@ -286,7 +286,7 @@ public final class CommandUtils {
* @return List of all possible names
*/
private static List<String> matchPlayer(String partialName) {
List<String> matchedPlayers = new ArrayList<String>();
List<String> matchedPlayers = new ArrayList<>();
for (OfflinePlayer offlinePlayer : mcMMO.p.getServer().getOfflinePlayers()) {
String playerName = offlinePlayer.getName();

View File

@ -28,6 +28,5 @@ public class DummyPlayerAttackCooldownExploitPreventionLayer extends PlayerAttac
@Override
public void resetAttackStrength(Player player) throws InvocationTargetException, IllegalAccessException {
//Do nothing
return;
}
}

View File

@ -116,9 +116,9 @@ public class FormulaManager {
* @return amount of experience needed to reach next level
*/
public int getXPtoNextLevel(int level, FormulaType formulaType) {
/**
* Retro mode XP requirements are the default requirements
* Standard mode XP requirements are multiplied by a factor of 10
/*
Retro mode XP requirements are the default requirements
Standard mode XP requirements are multiplied by a factor of 10
*/
//TODO: When the heck is Unknown used?

View File

@ -33,7 +33,7 @@ public final class UserManager {
}
public static void cleanupPlayer(McMMOPlayer mcMMOPlayer) {
if(playerDataSet != null && playerDataSet.contains(mcMMOPlayer))
if(playerDataSet != null)
playerDataSet.remove(mcMMOPlayer);
}
@ -47,7 +47,7 @@ public final class UserManager {
mcMMOPlayer.cleanup();
player.removeMetadata(mcMMO.playerDataKey, mcMMO.p);
if(playerDataSet != null && playerDataSet.contains(mcMMOPlayer)) {
if(playerDataSet != null) {
playerDataSet.remove(mcMMOPlayer); //Clear sync save tracking
}
}
@ -91,7 +91,7 @@ public final class UserManager {
}
public static Collection<McMMOPlayer> getPlayers() {
Collection<McMMOPlayer> playerCollection = new ArrayList<McMMOPlayer>();
Collection<McMMOPlayer> playerCollection = new ArrayList<>();
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
if (hasPlayerDataKey(player)) {

View File

@ -25,7 +25,7 @@ import java.util.*;
* Manages the Scoreboards used to display a variety of mcMMO related information to the player
*/
public class ScoreboardManager {
static final Map<String, ScoreboardWrapper> PLAYER_SCOREBOARDS = new HashMap<String, ScoreboardWrapper>();
static final Map<String, ScoreboardWrapper> PLAYER_SCOREBOARDS = new HashMap<>();
// do not localize; these are internal identifiers
static final String SIDEBAR_OBJECTIVE = "mcmmo_sidebar";
@ -130,7 +130,7 @@ public class ScoreboardManager {
abilityLabelsSkill = abilityLabelSkillBuilder.build();
}
private static final List<String> dirtyPowerLevels = new ArrayList<String>();
private static final List<String> dirtyPowerLevels = new ArrayList<>();
public enum SidebarType {
NONE,

View File

@ -235,8 +235,8 @@ public class ScoreboardWrapper {
if (oldBoard != null) {
if (player.getScoreboard() == scoreboard) {
/**
* Call the revert scoreboard custom event
/*
Call the revert scoreboard custom event
*/
McMMOScoreboardRevertEvent event = new McMMOScoreboardRevertEvent(oldBoard, player.getScoreboard(), player, ScoreboardEventReason.REVERTING_BOARD);
player.getServer().getPluginManager().callEvent(event);

View File

@ -866,7 +866,7 @@ public final class CombatUtils {
@Deprecated
public static double getFakeDamageFinalResult(Entity attacker, Entity target, double damage) {
return getFakeDamageFinalResult(attacker, target, DamageCause.ENTITY_ATTACK, new EnumMap<DamageModifier, Double>(ImmutableMap.of(DamageModifier.BASE, damage)));
return getFakeDamageFinalResult(attacker, target, DamageCause.ENTITY_ATTACK, new EnumMap<>(ImmutableMap.of(DamageModifier.BASE, damage)));
}
@Deprecated
@ -912,7 +912,7 @@ public final class CombatUtils {
}
private static Map<DamageModifier, Double> getModifiers(EntityDamageEvent event) {
Map<DamageModifier, Double> modifiers = new HashMap<DamageModifier, Double>();
Map<DamageModifier, Double> modifiers = new HashMap<>();
for (DamageModifier modifier : DamageModifier.values()) {
modifiers.put(modifier, event.getDamage(modifier));
}
@ -921,7 +921,7 @@ public final class CombatUtils {
}
private static Map<DamageModifier, Double> getScaledModifiers(double damage, Map<DamageModifier, Double> modifiers) {
Map<DamageModifier, Double> scaledModifiers = new HashMap<DamageModifier, Double>();
Map<DamageModifier, Double> scaledModifiers = new HashMap<>();
for (DamageModifier modifier : modifiers.keySet()) {
if (modifier == DamageModifier.BASE) {

View File

@ -85,19 +85,8 @@ public final class ParticleEffectUtils {
livingEntity.getWorld().playEffect(livingEntity.getEyeLocation(), Effect.MOBSPAWNER_FLAMES, 1);
}
public static void playAbilityEnabledEffect(Player player) {
if (!Config.getInstance().getAbilityActivationEffectEnabled()) {
return;
}
/* if (hasHeadRoom(player)) {
fireworkParticleShower(player, Color.GREEN);
}*/
}
public static void playAbilityDisabledEffect(Player player) {
if (!Config.getInstance().getAbilityDeactivationEffectEnabled()) {
return;
}
/*if (hasHeadRoom(player)) {

View File

@ -142,7 +142,7 @@ public class SkillUtils {
int efficiencyLevel = heldItem.getEnchantmentLevel(Enchantment.DIG_SPEED);
ItemMeta itemMeta = heldItem.getItemMeta();
List<String> itemLore = new ArrayList<String>();
List<String> itemLore = new ArrayList<>();
if (itemMeta.hasLore()) {
itemLore = itemMeta.getLore();