mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-07-31 19:45:26 +02:00
Fix compiler errors
This commit is contained in:
@@ -37,11 +37,12 @@ public final class BlockUtils {
|
||||
|
||||
/**
|
||||
* Marks a block to drop extra copies of items
|
||||
*
|
||||
* @param blockState target blockstate
|
||||
* @param amount amount of extra items to drop
|
||||
* @param amount amount of extra items to drop
|
||||
*/
|
||||
public static void markDropsAsBonus(BlockState blockState, int amount) {
|
||||
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(amount, mcMMO.p));
|
||||
blockState.setMetadata(MetadataConstants.BONUS_DROPS_METAKEY, new BonusDropMeta(amount, mcMMO.p));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -43,8 +43,7 @@ public class ExperienceManager {
|
||||
tamingExperienceMap = new HashMap<>();
|
||||
}
|
||||
|
||||
private void registerDefaultValues()
|
||||
{
|
||||
private void registerDefaultValues() {
|
||||
fillCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getCombatExperienceMap());
|
||||
registerSpecialCombatXPMultiplierMap(mcMMO.getConfigManager().getConfigExperience().getSpecialCombatExperienceMap());
|
||||
buildBlockXPMaps();
|
||||
@@ -55,28 +54,25 @@ public class ExperienceManager {
|
||||
* Fills the combat XP multiplier map with values from a platform generic map
|
||||
* Platform safe map, is just a map which uses strings to define target entities/etc
|
||||
* Platform safe maps are converted to ENUMs for the platform for convenience
|
||||
*
|
||||
* @param platformSafeMap the platform safe map
|
||||
*/
|
||||
public void fillCombatXPMultiplierMap(HashMap<String, Float> platformSafeMap) {
|
||||
mcMMO.p.getLogger().info("Registering combat XP values...");
|
||||
for(String entityString : platformSafeMap.keySet())
|
||||
{
|
||||
for (String entityString : platformSafeMap.keySet()) {
|
||||
//Iterate over all EntityType(s)
|
||||
for(EntityType type : EntityType.values())
|
||||
{
|
||||
for (EntityType type : EntityType.values()) {
|
||||
//Match ignoring case
|
||||
if(entityString.equalsIgnoreCase(entityString))
|
||||
{
|
||||
if (entityString.equalsIgnoreCase(entityString)) {
|
||||
//Check for duplicates and warn the admin
|
||||
if(combatXPMultiplierMap.containsKey(entityString))
|
||||
{
|
||||
mcMMO.p.getLogger().severe("Entity named "+entityString+" has multiple values in the combat experience config!");
|
||||
if (combatXPMultiplierMap.containsKey(entityString)) {
|
||||
mcMMO.p.getLogger().severe("Entity named " + entityString + " has multiple values in the combat experience config!");
|
||||
}
|
||||
//Match found
|
||||
combatXPMultiplierMap.put(type, platformSafeMap.get(entityString));
|
||||
} else {
|
||||
//Log an error so the admin can deal with figuring it out
|
||||
mcMMO.p.getLogger().severe("No entity could be matched for the combat experience config value named - "+entityString);
|
||||
mcMMO.p.getLogger().severe("No entity could be matched for the combat experience config value named - " + entityString);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,10 +80,10 @@ public class ExperienceManager {
|
||||
|
||||
/**
|
||||
* Registers the map values for special combat XP to the specified map
|
||||
*
|
||||
* @param map target map
|
||||
*/
|
||||
public void registerSpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Float> map)
|
||||
{
|
||||
public void registerSpecialCombatXPMultiplierMap(HashMap<SpecialXPKey, Float> map) {
|
||||
mcMMO.p.getLogger().info("Registering special combat XP values...");
|
||||
specialCombatXPMultiplierMap = map;
|
||||
}
|
||||
@@ -190,6 +186,7 @@ public class ExperienceManager {
|
||||
|
||||
/**
|
||||
* Set the mining block XP map to the provided one
|
||||
*
|
||||
* @param miningFullyQualifiedBlockXpMap the XP map to change to
|
||||
*/
|
||||
public void setMiningFullyQualifiedBlockXpMap(HashMap<String, Integer> miningFullyQualifiedBlockXpMap) {
|
||||
@@ -199,6 +196,7 @@ public class ExperienceManager {
|
||||
|
||||
/**
|
||||
* Set the mining block XP map to the provided one
|
||||
*
|
||||
* @param herbalismFullyQualifiedBlockXpMap the XP map to change to
|
||||
*/
|
||||
public void setHerbalismFullyQualifiedBlockXpMap(HashMap<String, Integer> herbalismFullyQualifiedBlockXpMap) {
|
||||
@@ -208,6 +206,7 @@ public class ExperienceManager {
|
||||
|
||||
/**
|
||||
* Set the mining block XP map to the provided one
|
||||
*
|
||||
* @param woodcuttingFullyQualifiedBlockXpMap the XP map to change to
|
||||
*/
|
||||
public void setWoodcuttingFullyQualifiedBlockXpMap(HashMap<String, Integer> woodcuttingFullyQualifiedBlockXpMap) {
|
||||
@@ -217,6 +216,7 @@ public class ExperienceManager {
|
||||
|
||||
/**
|
||||
* Set the mining block XP map to the provided one
|
||||
*
|
||||
* @param excavationFullyQualifiedBlockXpMap the XP map to change to
|
||||
*/
|
||||
public void setExcavationFullyQualifiedBlockXpMap(HashMap<String, Integer> excavationFullyQualifiedBlockXpMap) {
|
||||
@@ -372,31 +372,31 @@ public class ExperienceManager {
|
||||
|
||||
/**
|
||||
* Get the XP multiplier value for a special XP group
|
||||
*
|
||||
* @param specialXPKey target special XP group
|
||||
* @return XP multiplier for target special XP group
|
||||
*/
|
||||
public float getSpecialCombatXP(SpecialXPKey specialXPKey)
|
||||
{
|
||||
public float getSpecialCombatXP(SpecialXPKey specialXPKey) {
|
||||
return specialCombatXPMultiplierMap.get(specialXPKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the combat XP multiplier for this entity type
|
||||
*
|
||||
* @param entityType target entity type
|
||||
* @return the combat XP multiplier for this entity
|
||||
*/
|
||||
public float getCombatXPMultiplier(EntityType entityType)
|
||||
{
|
||||
public float getCombatXPMultiplier(EntityType entityType) {
|
||||
return combatXPMultiplierMap.get(entityType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true/false if a EntityType has a defined XP multiplier (from the config typically)
|
||||
*
|
||||
* @param entityType target entity type
|
||||
* @return true if entity type has XP
|
||||
*/
|
||||
public boolean hasCombatXP(EntityType entityType)
|
||||
{
|
||||
public boolean hasCombatXP(EntityType entityType) {
|
||||
return combatXPMultiplierMap.get(entityType) != null;
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
package com.gmail.nossr50.util.player;
|
||||
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
import com.gmail.nossr50.config.Config;
|
||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||
import com.gmail.nossr50.datatypes.notifications.SensitiveCommandType;
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
@@ -154,17 +153,16 @@ public class NotificationManager {
|
||||
/**
|
||||
* Sends a message to all admins with the admin notification formatting from the locale
|
||||
* Admins are currently players with either Operator status or Admin Chat permission
|
||||
*
|
||||
* @param msg message fetched from locale
|
||||
*/
|
||||
private static void sendAdminNotification(String msg) {
|
||||
//If its not enabled exit
|
||||
if(!mcMMO.getConfigManager().getConfigAdmin().isSendAdminNotifications())
|
||||
if (!mcMMO.getConfigManager().getConfigAdmin().isSendAdminNotifications())
|
||||
return;
|
||||
|
||||
for(Player player : Bukkit.getServer().getOnlinePlayers())
|
||||
{
|
||||
if(player.isOp() || Permissions.adminChat(player))
|
||||
{
|
||||
for (Player player : Bukkit.getServer().getOnlinePlayers()) {
|
||||
if (player.isOp() || Permissions.adminChat(player)) {
|
||||
player.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Others", msg));
|
||||
}
|
||||
}
|
||||
@@ -175,8 +173,9 @@ public class NotificationManager {
|
||||
|
||||
/**
|
||||
* Sends a confirmation message to the CommandSender who just executed an admin command
|
||||
*
|
||||
* @param commandSender target command sender
|
||||
* @param msg message fetched from locale
|
||||
* @param msg message fetched from locale
|
||||
*/
|
||||
private static void sendAdminCommandConfirmation(CommandSender commandSender, String msg) {
|
||||
commandSender.sendMessage(LocaleLoader.getString("Notifications.Admin.Format.Self", msg));
|
||||
@@ -184,7 +183,8 @@ public class NotificationManager {
|
||||
|
||||
/**
|
||||
* Convenience method to report info about a command sender using a sensitive command
|
||||
* @param commandSender the command user
|
||||
*
|
||||
* @param commandSender the command user
|
||||
* @param sensitiveCommandType type of command issued
|
||||
*/
|
||||
public static void processSensitiveCommandNotification(CommandSender commandSender, SensitiveCommandType sensitiveCommandType, String... args) {
|
||||
@@ -193,14 +193,12 @@ public class NotificationManager {
|
||||
*/
|
||||
String senderName = LocaleLoader.getString("Server.ConsoleName");
|
||||
|
||||
if(commandSender instanceof Player)
|
||||
{
|
||||
if (commandSender instanceof Player) {
|
||||
senderName = ((Player) commandSender).getDisplayName() + ChatColor.RESET + "-" + ((Player) commandSender).getUniqueId();
|
||||
}
|
||||
|
||||
//Send the notification
|
||||
switch(sensitiveCommandType)
|
||||
{
|
||||
switch (sensitiveCommandType) {
|
||||
case XPRATE_MODIFY:
|
||||
sendAdminNotification(LocaleLoader.getString("Notifications.Admin.XPRate.Start.Others", addItemToFirstPositionOfArray(senderName, args)));
|
||||
sendAdminCommandConfirmation(commandSender, LocaleLoader.getString("Notifications.Admin.XPRate.Start.Self", args));
|
||||
@@ -215,7 +213,8 @@ public class NotificationManager {
|
||||
/**
|
||||
* Takes an array and an object, makes a new array with object in the first position of the new array,
|
||||
* and the following elements in this new array being a copy of the existing array retaining their order
|
||||
* @param itemToAdd the string to put at the beginning of the new array
|
||||
*
|
||||
* @param itemToAdd the string to put at the beginning of the new array
|
||||
* @param existingArray the existing array to be copied to the new array at position [0]+1 relative to their original index
|
||||
* @return the new array combining itemToAdd at the start and existing array elements following while retaining their order
|
||||
*/
|
||||
|
@@ -352,17 +352,16 @@ public final class CombatUtils {
|
||||
|
||||
/**
|
||||
* This cleans up names from displaying in chat as hearts
|
||||
*
|
||||
* @param entity target entity
|
||||
*/
|
||||
public static void fixNames(LivingEntity entity)
|
||||
{
|
||||
public static void fixNames(LivingEntity entity) {
|
||||
List<MetadataValue> metadataValue = entity.getMetadata("mcMMO_oldName");
|
||||
|
||||
if(metadataValue.size() <= 0)
|
||||
if (metadataValue.size() <= 0)
|
||||
return;
|
||||
|
||||
if(metadataValue != null)
|
||||
{
|
||||
if (metadataValue != null) {
|
||||
OldName oldName = (OldName) metadataValue.get(0);
|
||||
entity.setCustomName(oldName.asString());
|
||||
entity.setCustomNameVisible(false);
|
||||
|
Reference in New Issue
Block a user