mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
mcMMO will no longer use the DamageModifier API (potentially fix immortal player bug)
This commit is contained in:
parent
8066f7f7f2
commit
5ab55c1653
@ -23,8 +23,7 @@ public class SamePartyPredicate<T extends CommandSender> implements Predicate<T>
|
|||||||
if(t instanceof ConsoleCommandSender) {
|
if(t instanceof ConsoleCommandSender) {
|
||||||
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
|
return false; //Party audiences are special, we exclude console from them to avoid double messaging since we send a more verbose version to consoles
|
||||||
} else {
|
} else {
|
||||||
if(t instanceof Player) {
|
if(t instanceof Player player) {
|
||||||
Player player = (Player) t;
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
if(mcMMOPlayer != null) {
|
if(mcMMOPlayer != null) {
|
||||||
return mcMMOPlayer.getParty() == party;
|
return mcMMOPlayer.getParty() == party;
|
||||||
|
@ -27,12 +27,11 @@ public class MmoInfoCommand implements TabExecutor {
|
|||||||
/*
|
/*
|
||||||
* Only allow players to use this command
|
* Only allow players to use this command
|
||||||
*/
|
*/
|
||||||
if(commandSender instanceof Player)
|
if(commandSender instanceof Player player)
|
||||||
{
|
{
|
||||||
if(args.length < 1)
|
if(args.length < 1)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Player player = (Player) commandSender;
|
|
||||||
if(Permissions.mmoinfo(player))
|
if(Permissions.mmoinfo(player))
|
||||||
{
|
{
|
||||||
if(args == null || args[0] == null)
|
if(args == null || args[0] == null)
|
||||||
|
@ -25,7 +25,7 @@ import java.util.logging.Logger;
|
|||||||
public final class FlatFileDatabaseManager implements DatabaseManager {
|
public final class FlatFileDatabaseManager implements DatabaseManager {
|
||||||
public static final String IGNORED = "IGNORED";
|
public static final String IGNORED = "IGNORED";
|
||||||
public static final String LEGACY_INVALID_OLD_USERNAME = "_INVALID_OLD_USERNAME_'";
|
public static final String LEGACY_INVALID_OLD_USERNAME = "_INVALID_OLD_USERNAME_'";
|
||||||
private final @NotNull EnumMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new EnumMap<PrimarySkillType, List<PlayerStat>>(PrimarySkillType.class);
|
private final @NotNull EnumMap<PrimarySkillType, List<PlayerStat>> playerStatHash = new EnumMap<>(PrimarySkillType.class);
|
||||||
private final @NotNull List<PlayerStat> powerLevels = new ArrayList<>();
|
private final @NotNull List<PlayerStat> powerLevels = new ArrayList<>();
|
||||||
private long lastUpdate = 0;
|
private long lastUpdate = 0;
|
||||||
private final @NotNull String usersFilePath;
|
private final @NotNull String usersFilePath;
|
||||||
|
@ -1122,8 +1122,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
||||||
Map<PrimarySkillType, Integer> skills = new EnumMap<PrimarySkillType, Integer>(PrimarySkillType.class); // Skill & Level
|
Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
||||||
Map<PrimarySkillType, Float> skillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class); // Skill & XP
|
Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
||||||
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
Map<SuperAbilityType, Integer> skillsDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
Map<UniqueDataType, Integer> uniqueData = new EnumMap<>(UniqueDataType.class); //Chimaera wing cooldown and other misc info
|
||||||
MobHealthbarType mobHealthbarType;
|
MobHealthbarType mobHealthbarType;
|
||||||
|
@ -29,8 +29,7 @@ public class FlatFileDataUtil {
|
|||||||
/*
|
/*
|
||||||
* First fix the bad data values if they exist
|
* First fix the bad data values if they exist
|
||||||
*/
|
*/
|
||||||
if(dataContainer instanceof BadCategorizedFlatFileData) {
|
if(dataContainer instanceof BadCategorizedFlatFileData badData) {
|
||||||
BadCategorizedFlatFileData badData = (BadCategorizedFlatFileData) dataContainer;
|
|
||||||
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
splitData = repairBadData(dataContainer.getSplitData(), badData.getBadDataIndexes());
|
||||||
} else {
|
} else {
|
||||||
splitData = dataContainer.getSplitData();
|
splitData = dataContainer.getSplitData();
|
||||||
|
@ -37,8 +37,7 @@ public class LevelUpBroadcastPredicate<T extends CommandSender> implements Predi
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t instanceof Player) {
|
if(t instanceof Player listeningPlayer) {
|
||||||
Player listeningPlayer = (Player) t;
|
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
if(mcMMO.p.getGeneralConfig().isLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
|
@ -37,8 +37,7 @@ public class PowerLevelUpBroadcastPredicate<T extends CommandSender> implements
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(t instanceof Player) {
|
if(t instanceof Player listeningPlayer) {
|
||||||
Player listeningPlayer = (Player) t;
|
|
||||||
|
|
||||||
//Party Member Check
|
//Party Member Check
|
||||||
if(mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
if(mcMMO.p.getGeneralConfig().isPowerLevelUpBroadcastsPartyMembersOnly()) {
|
||||||
|
@ -5,7 +5,7 @@ public class McMMOUrl {
|
|||||||
public static final String urlDiscord = "https://discord.gg/bJ7pFS9";
|
public static final String urlDiscord = "https://discord.gg/bJ7pFS9";
|
||||||
public static final String urlPatreon = "https://www.patreon.com/nossr50";
|
public static final String urlPatreon = "https://www.patreon.com/nossr50";
|
||||||
public static final String urlWiki = "https://www.mcmmo.org/wiki/";
|
public static final String urlWiki = "https://www.mcmmo.org/wiki/";
|
||||||
public static final String urlSpigot = "http://spigot.mcmmo.org";
|
public static final String urlSpigot = "https://spigot.mcmmo.org";
|
||||||
public static final String urlTranslate = "https://translate.mcmmo.org/";
|
public static final String urlTranslate = "https://translate.mcmmo.org/";
|
||||||
|
|
||||||
public static String getUrl(McMMOWebLinks webLinks)
|
public static String getUrl(McMMOWebLinks webLinks)
|
||||||
|
@ -403,12 +403,10 @@ public class Party {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(obj instanceof Party)) {
|
if (!(obj instanceof Party other)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Party other = (Party) obj;
|
|
||||||
|
|
||||||
if ((this.getName() == null) || (other.getName() == null)) {
|
if ((this.getName() == null) || (other.getName() == null)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -79,7 +79,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
private final Player player;
|
private final Player player;
|
||||||
private final PlayerProfile profile;
|
private final PlayerProfile profile;
|
||||||
|
|
||||||
private final Map<PrimarySkillType, SkillManager> skillManagers = new EnumMap<PrimarySkillType, SkillManager>(PrimarySkillType.class);
|
private final Map<PrimarySkillType, SkillManager> skillManagers = new EnumMap<>(PrimarySkillType.class);
|
||||||
private final ExperienceBarManager experienceBarManager;
|
private final ExperienceBarManager experienceBarManager;
|
||||||
|
|
||||||
private Party party;
|
private Party party;
|
||||||
@ -98,10 +98,10 @@ public class McMMOPlayer implements Identified {
|
|||||||
|
|
||||||
private ChatChannel chatChannel;
|
private ChatChannel chatChannel;
|
||||||
|
|
||||||
private final Map<SuperAbilityType, Boolean> abilityMode = new EnumMap<SuperAbilityType, Boolean>(SuperAbilityType.class);
|
private final Map<SuperAbilityType, Boolean> abilityMode = new EnumMap<>(SuperAbilityType.class);
|
||||||
private final Map<SuperAbilityType, Boolean> abilityInformed = new EnumMap<SuperAbilityType, Boolean>(SuperAbilityType.class);
|
private final Map<SuperAbilityType, Boolean> abilityInformed = new EnumMap<>(SuperAbilityType.class);
|
||||||
|
|
||||||
private final Map<ToolType, Boolean> toolMode = new EnumMap<ToolType, Boolean>(ToolType.class);
|
private final Map<ToolType, Boolean> toolMode = new EnumMap<>(ToolType.class);
|
||||||
|
|
||||||
private int recentlyHurt;
|
private int recentlyHurt;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
@ -943,7 +943,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
SkillUtils.removeAbilityBuff(player.getInventory().getItemInMainHand());
|
SkillUtils.removeAbilityBuff(player.getInventory().getItemInMainHand());
|
||||||
|
|
||||||
// Enable the ability
|
// Enable the ability
|
||||||
profile.setAbilityDATS(superAbilityType, System.currentTimeMillis() + (ticks * Misc.TIME_CONVERSION_FACTOR));
|
profile.setAbilityDATS(superAbilityType, System.currentTimeMillis() + ((long) ticks * Misc.TIME_CONVERSION_FACTOR));
|
||||||
setAbilityMode(superAbilityType, true);
|
setAbilityMode(superAbilityType, true);
|
||||||
|
|
||||||
if (superAbilityType == SuperAbilityType.SUPER_BREAKER || superAbilityType == SuperAbilityType.GIGA_DRILL_BREAKER) {
|
if (superAbilityType == SuperAbilityType.SUPER_BREAKER || superAbilityType == SuperAbilityType.GIGA_DRILL_BREAKER) {
|
||||||
@ -951,7 +951,7 @@ public class McMMOPlayer implements Identified {
|
|||||||
}
|
}
|
||||||
|
|
||||||
setToolPreparationMode(tool, false);
|
setToolPreparationMode(tool, false);
|
||||||
new AbilityDisableTask(this, superAbilityType).runTaskLater(mcMMO.p, ticks * Misc.TICK_CONVERSION_FACTOR);
|
new AbilityDisableTask(this, superAbilityType).runTaskLater(mcMMO.p, (long) ticks * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
public void processAbilityActivation(@NotNull PrimarySkillType primarySkillType) {
|
||||||
|
@ -14,10 +14,7 @@ import com.google.common.collect.ImmutableMap;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
import java.util.*;
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.DelayQueue;
|
import java.util.concurrent.DelayQueue;
|
||||||
|
|
||||||
public class PlayerProfile {
|
public class PlayerProfile {
|
||||||
@ -35,12 +32,12 @@ public class PlayerProfile {
|
|||||||
/* Skill Data */
|
/* Skill Data */
|
||||||
private final Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
private final Map<PrimarySkillType, Integer> skills = new EnumMap<>(PrimarySkillType.class); // Skill & Level
|
||||||
private final Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
private final Map<PrimarySkillType, Float> skillsXp = new EnumMap<>(PrimarySkillType.class); // Skill & XP
|
||||||
private final Map<SuperAbilityType, Integer> abilityDATS = new EnumMap<SuperAbilityType, Integer>(SuperAbilityType.class); // Ability & Cooldown
|
private final Map<SuperAbilityType, Integer> abilityDATS = new EnumMap<>(SuperAbilityType.class); // Ability & Cooldown
|
||||||
private final Map<UniqueDataType, Integer> uniquePlayerData = new EnumMap<UniqueDataType, Integer>(UniqueDataType.class); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
private final Map<UniqueDataType, Integer> uniquePlayerData = new EnumMap<>(UniqueDataType.class); //Misc data that doesn't fit into other categories (chimaera wing, etc..)
|
||||||
|
|
||||||
// Store previous XP gains for diminished returns
|
// Store previous XP gains for diminished returns
|
||||||
private final DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
|
private final DelayQueue<SkillXpGain> gainedSkillsXp = new DelayQueue<>();
|
||||||
private final Map<PrimarySkillType, Float> rollingSkillsXp = new EnumMap<PrimarySkillType, Float>(PrimarySkillType.class);
|
private final Map<PrimarySkillType, Float> rollingSkillsXp = new EnumMap<>(PrimarySkillType.class);
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PlayerProfile(String playerName) {
|
public PlayerProfile(String playerName) {
|
||||||
@ -160,14 +157,10 @@ public class PlayerProfile {
|
|||||||
/**
|
/**
|
||||||
* Get this users last login, will return current java.lang.System#currentTimeMillis() if it doesn't exist
|
* Get this users last login, will return current java.lang.System#currentTimeMillis() if it doesn't exist
|
||||||
* @return the last login
|
* @return the last login
|
||||||
* @deprecated This is only function for FlatFileDB atm and its only here for unit testing right now
|
* @deprecated This is only function for FlatFileDB atm, and it's only here for unit testing right now
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
|
||||||
public @NotNull Long getLastLogin() {
|
public @NotNull Long getLastLogin() {
|
||||||
if(lastLogin == null)
|
return Objects.requireNonNullElse(lastLogin, -1L);
|
||||||
return -1L;
|
|
||||||
else
|
|
||||||
return lastLogin;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateLastLogin() {
|
public void updateLastLogin() {
|
||||||
|
@ -1,35 +1,14 @@
|
|||||||
package com.gmail.nossr50.events.fake;
|
package com.gmail.nossr50.events.fake;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when mcMMO applies damage from an entity due to special abilities.
|
* Called when mcMMO applies damage from an entity due to special abilities.
|
||||||
*/
|
*/
|
||||||
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent implements FakeEvent {
|
public class FakeEntityDamageByEntityEvent extends EntityDamageByEntityEvent implements FakeEvent {
|
||||||
|
|
||||||
public FakeEntityDamageByEntityEvent(@NotNull Entity damager, @NotNull Entity damagee, @NotNull DamageCause cause, @NotNull final Map<DamageModifier, Double> modifiers) {
|
|
||||||
super(damager, damagee, cause, modifiers, getFunctionModifiers(modifiers));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public FakeEntityDamageByEntityEvent(@NotNull Entity damager, @NotNull Entity damagee, @NotNull DamageCause cause, double damage) {
|
public FakeEntityDamageByEntityEvent(@NotNull Entity damager, @NotNull Entity damagee, @NotNull DamageCause cause, double damage) {
|
||||||
super(damager, damagee, cause, damage);
|
super(damager, damagee, cause, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
|
||||||
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(@NotNull Map<DamageModifier, Double> modifiers) {
|
|
||||||
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
|
|
||||||
|
|
||||||
for (DamageModifier modifier : modifiers.keySet()) {
|
|
||||||
modifierFunctions.put(modifier, (o -> -0.0));
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifierFunctions;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,35 +1,14 @@
|
|||||||
package com.gmail.nossr50.events.fake;
|
package com.gmail.nossr50.events.fake;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.base.Functions;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called when mcMMO applies damage due to special abilities.
|
* Called when mcMMO applies damage due to special abilities.
|
||||||
*/
|
*/
|
||||||
public class FakeEntityDamageEvent extends EntityDamageEvent implements FakeEvent {
|
public class FakeEntityDamageEvent extends EntityDamageEvent implements FakeEvent {
|
||||||
|
|
||||||
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, final Map<DamageModifier, Double> modifiers) {
|
|
||||||
super(damagee, cause, modifiers, getFunctionModifiers(modifiers));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) {
|
public FakeEntityDamageEvent(Entity damagee, DamageCause cause, double damage) {
|
||||||
super(damagee, cause, damage);
|
super(damagee, cause, damage);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static EnumMap<DamageModifier, Function<? super Double, Double>> getFunctionModifiers(Map<DamageModifier, Double> modifiers) {
|
|
||||||
EnumMap<DamageModifier, Function<? super Double, Double>> modifierFunctions = new EnumMap<>(DamageModifier.class);
|
|
||||||
Function<? super Double, Double> ZERO = Functions.constant(-0.0);
|
|
||||||
|
|
||||||
for (DamageModifier modifier : modifiers.keySet()) {
|
|
||||||
modifierFunctions.put(modifier, ZERO);
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifierFunctions;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,15 @@
|
|||||||
package com.gmail.nossr50.events.skills.rupture;
|
package com.gmail.nossr50.events.skills.rupture;
|
||||||
|
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
|
|
||||||
public class McMMOEntityDamageByRuptureEvent extends EntityDamageByEntityEvent {
|
public class McMMOEntityDamageByRuptureEvent extends EntityDamageByEntityEvent {
|
||||||
private final McMMOPlayer mcMMODamager;
|
private final McMMOPlayer mcMMODamager;
|
||||||
|
|
||||||
public McMMOEntityDamageByRuptureEvent(@NotNull McMMOPlayer damager, @NotNull Entity damagee, double damage) {
|
public McMMOEntityDamageByRuptureEvent(@NotNull McMMOPlayer damager, @NotNull Entity damagee, double damage) {
|
||||||
super(damager.getPlayer(), damagee, DamageCause.CUSTOM, new EnumMap<>(ImmutableMap.of(DamageModifier.BASE, damage)), new EnumMap<>(ImmutableMap.of(DamageModifier.BASE, (o -> -0.0))));
|
super(damager.getPlayer(), damagee, DamageCause.CUSTOM, damage);
|
||||||
this.mcMMODamager = damager;
|
this.mcMMODamager = damager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,9 +696,8 @@ public class BlockListener implements Listener {
|
|||||||
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
|
player.sendMessage("[mcMMO DEBUG] World Guard xp flag is not permitted for this player in this region");
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blockState instanceof Furnace)
|
if(blockState instanceof Furnace furnace)
|
||||||
{
|
{
|
||||||
Furnace furnace = (Furnace) blockState;
|
|
||||||
if(mcMMO.getSmeltingTracker().isFurnaceOwned(furnace))
|
if(mcMMO.getSmeltingTracker().isFurnaceOwned(furnace))
|
||||||
{
|
{
|
||||||
player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
|
player.sendMessage("[mcMMO DEBUG] This furnace has a registered owner");
|
||||||
|
@ -92,14 +92,12 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR)
|
||||||
public void onEntityTransform(EntityTransformEvent event) {
|
public void onEntityTransform(EntityTransformEvent event) {
|
||||||
if(event.getEntity() instanceof LivingEntity) {
|
if(event.getEntity() instanceof LivingEntity livingEntity) {
|
||||||
LivingEntity livingEntity = (LivingEntity) event.getEntity();
|
|
||||||
|
|
||||||
//Transfer metadata keys from mob-spawned mobs to new mobs
|
//Transfer metadata keys from mob-spawned mobs to new mobs
|
||||||
if(mobMetadataService.hasMobFlags(livingEntity)) {
|
if(mobMetadataService.hasMobFlags(livingEntity)) {
|
||||||
for(Entity entity : event.getTransformedEntities()) {
|
for(Entity entity : event.getTransformedEntities()) {
|
||||||
if(entity instanceof LivingEntity) {
|
if(entity instanceof LivingEntity transformedEntity) {
|
||||||
LivingEntity transformedEntity = (LivingEntity) entity;
|
|
||||||
mobMetadataService.addMobFlags(livingEntity, transformedEntity);
|
mobMetadataService.addMobFlags(livingEntity, transformedEntity);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,8 +119,7 @@ public class EntityListener implements Listener {
|
|||||||
//Prevent entities from giving XP if they target endermite
|
//Prevent entities from giving XP if they target endermite
|
||||||
if(event.getTarget() instanceof Endermite)
|
if(event.getTarget() instanceof Endermite)
|
||||||
{
|
{
|
||||||
if(event.getEntity() instanceof Enderman) {
|
if(event.getEntity() instanceof Enderman enderman) {
|
||||||
Enderman enderman = (Enderman) event.getEntity();
|
|
||||||
|
|
||||||
if(!mobMetadataService.hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
|
if(!mobMetadataService.hasMobFlag(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman)) {
|
||||||
mobMetadataService.flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
|
mobMetadataService.flagMetadata(MobMetaFlagType.EXPLOITED_ENDERMEN, enderman);
|
||||||
@ -137,9 +134,8 @@ public class EntityListener implements Listener {
|
|||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player)
|
if(event.getEntity() instanceof Player player)
|
||||||
{
|
{
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||||
@ -175,9 +171,8 @@ public class EntityListener implements Listener {
|
|||||||
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
if(WorldBlacklist.isWorldBlacklisted(event.getEntity().getWorld()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(event.getEntity().getShooter() instanceof Player)
|
if(event.getEntity().getShooter() instanceof Player player)
|
||||||
{
|
{
|
||||||
Player player = (Player) event.getEntity().getShooter();
|
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
if(WorldGuardUtils.isWorldGuardLoaded()) {
|
||||||
@ -267,19 +262,15 @@ public class EntityListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
public void onEntityCombustByEntityEvent(EntityCombustByEntityEvent event) {
|
||||||
//Prevent players from setting fire to each other if they are in the same party
|
//Prevent players from setting fire to each other if they are in the same party
|
||||||
if(event.getEntity() instanceof Player) {
|
if(event.getEntity() instanceof Player defender) {
|
||||||
Player defender = (Player) event.getEntity();
|
|
||||||
|
|
||||||
if(event.getCombuster() instanceof Projectile) {
|
if(event.getCombuster() instanceof Projectile projectile) {
|
||||||
Projectile projectile = (Projectile) event.getCombuster();
|
if(projectile.getShooter() instanceof Player attacker) {
|
||||||
if(projectile.getShooter() instanceof Player) {
|
|
||||||
Player attacker = (Player) projectile.getShooter();
|
|
||||||
if(checkParties(event, defender, attacker)) {
|
if(checkParties(event, defender, attacker)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if(event.getCombuster() instanceof Player) {
|
} else if(event.getCombuster() instanceof Player attacker) {
|
||||||
Player attacker = (Player) event.getCombuster();
|
|
||||||
if(checkParties(event, defender, attacker)) {
|
if(checkParties(event, defender, attacker)) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
@ -311,9 +302,7 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if(attacker instanceof Projectile) {
|
} else if(attacker instanceof Projectile projectile) {
|
||||||
|
|
||||||
Projectile projectile = (Projectile) attacker;
|
|
||||||
|
|
||||||
if(projectile.getShooter() instanceof Player) {
|
if(projectile.getShooter() instanceof Player) {
|
||||||
if(!WorldGuardManager.getInstance().hasMainFlag((Player) projectile.getShooter())) {
|
if(!WorldGuardManager.getInstance().hasMainFlag((Player) projectile.getShooter())) {
|
||||||
@ -342,12 +331,10 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(defender)) || !defender.isValid() || !(defender instanceof LivingEntity)) {
|
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(defender)) || !defender.isValid() || !(defender instanceof LivingEntity target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity target = (LivingEntity) defender;
|
|
||||||
|
|
||||||
if (CombatUtils.isInvincible(target, damage)) {
|
if (CombatUtils.isInvincible(target, damage)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -374,14 +361,12 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Friendly fire checks
|
//Friendly fire checks
|
||||||
if (defender instanceof Player) {
|
if (defender instanceof Player defendingPlayer) {
|
||||||
Player defendingPlayer = (Player) defender;
|
|
||||||
Player attackingPlayer;
|
Player attackingPlayer;
|
||||||
|
|
||||||
//If the attacker is a Player or a projectile belonging to a player
|
//If the attacker is a Player or a projectile belonging to a player
|
||||||
if(attacker instanceof Projectile || attacker instanceof Player) {
|
if(attacker instanceof Projectile || attacker instanceof Player) {
|
||||||
if(attacker instanceof Projectile) {
|
if(attacker instanceof Projectile projectile) {
|
||||||
Projectile projectile = (Projectile) attacker;
|
|
||||||
if(((Projectile) attacker).getShooter() instanceof Player) {
|
if(((Projectile) attacker).getShooter() instanceof Player) {
|
||||||
attackingPlayer = (Player) projectile.getShooter();
|
attackingPlayer = (Player) projectile.getShooter();
|
||||||
|
|
||||||
@ -443,8 +428,7 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = false)
|
||||||
public void onEntityDamageMonitor(EntityDamageByEntityEvent entityDamageEvent) {
|
public void onEntityDamageMonitor(EntityDamageByEntityEvent entityDamageEvent) {
|
||||||
if(entityDamageEvent.getEntity() instanceof LivingEntity) {
|
if(entityDamageEvent.getEntity() instanceof LivingEntity livingEntity) {
|
||||||
LivingEntity livingEntity = (LivingEntity) entityDamageEvent.getEntity();
|
|
||||||
|
|
||||||
if(entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) {
|
if(entityDamageEvent.getFinalDamage() >= livingEntity.getHealth()) {
|
||||||
//This sets entity names back to whatever they are supposed to be
|
//This sets entity names back to whatever they are supposed to be
|
||||||
@ -564,9 +548,8 @@ public class EntityListener implements Listener {
|
|||||||
event.getEntity().removeMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE, mcMMO.p);
|
event.getEntity().removeMetadata(MetadataConstants.METADATA_KEY_EXPLOSION_FROM_RUPTURE, mcMMO.p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player)
|
if(event.getEntity() instanceof Player player)
|
||||||
{
|
{
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
@ -605,12 +588,10 @@ public class EntityListener implements Listener {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity)) || !entity.isValid() || !(entity instanceof LivingEntity)) {
|
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity)) || !entity.isValid() || !(entity instanceof LivingEntity livingEntity)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
|
||||||
|
|
||||||
if (CombatUtils.isInvincible(livingEntity, damage)) {
|
if (CombatUtils.isInvincible(livingEntity, damage)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -642,13 +623,11 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (livingEntity instanceof Tameable) {
|
else if (livingEntity instanceof Tameable pet) {
|
||||||
Tameable pet = (Tameable) livingEntity;
|
|
||||||
AnimalTamer owner = pet.getOwner();
|
AnimalTamer owner = pet.getOwner();
|
||||||
|
|
||||||
if(owner instanceof Player)
|
if(owner instanceof Player player)
|
||||||
{
|
{
|
||||||
Player player = (Player) owner;
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
@ -821,8 +800,7 @@ public class EntityListener implements Listener {
|
|||||||
father.setLoveModeTicks(0);
|
father.setLoveModeTicks(0);
|
||||||
|
|
||||||
//Inform the player
|
//Inform the player
|
||||||
if(event.getBreeder() instanceof Player) {
|
if(event.getBreeder() instanceof Player player) {
|
||||||
Player player = (Player) event.getBreeder();
|
|
||||||
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.BreedingDisallowed");
|
NotificationManager.sendPlayerInformationChatOnly(player, "Taming.Summon.COTW.BreedingDisallowed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -936,12 +914,10 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
|
|
||||||
if (!(entity instanceof Player)) {
|
if (!(entity instanceof Player player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) entity;
|
|
||||||
|
|
||||||
//Profile not loaded
|
//Profile not loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if(UserManager.getPlayer(player) == null)
|
||||||
{
|
{
|
||||||
@ -1108,12 +1084,10 @@ public class EntityListener implements Listener {
|
|||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
Entity target = event.getTarget();
|
Entity target = event.getTarget();
|
||||||
|
|
||||||
if (!(entity instanceof Tameable) || !(target instanceof Player)) {
|
if (!(entity instanceof Tameable tameable) || !(target instanceof Player player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) target;
|
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||||
{
|
{
|
||||||
@ -1121,8 +1095,6 @@ public class EntityListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tameable tameable = (Tameable) entity;
|
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) {
|
if (!UserManager.hasPlayerDataKey(player) || !CombatUtils.isFriendlyPet(player, tameable)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -105,8 +105,7 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(blockState instanceof Furnace) {
|
if(blockState instanceof Furnace furnace) {
|
||||||
Furnace furnace = (Furnace) blockState;
|
|
||||||
OfflinePlayer offlinePlayer = mcMMO.getSmeltingTracker().getFurnaceOwner(furnace);
|
OfflinePlayer offlinePlayer = mcMMO.getSmeltingTracker().getFurnaceOwner(furnace);
|
||||||
|
|
||||||
if(offlinePlayer != null) {
|
if(offlinePlayer != null) {
|
||||||
@ -191,7 +190,7 @@ public class InventoryListener implements Listener {
|
|||||||
|
|
||||||
InventoryHolder holder = inventory.getHolder();
|
InventoryHolder holder = inventory.getHolder();
|
||||||
|
|
||||||
if (!(holder instanceof BrewingStand)) {
|
if (!(holder instanceof BrewingStand stand)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -208,7 +207,6 @@ public class InventoryListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
BrewingStand stand = (BrewingStand) holder;
|
|
||||||
ItemStack clicked = event.getCurrentItem();
|
ItemStack clicked = event.getCurrentItem();
|
||||||
ItemStack cursor = event.getCursor();
|
ItemStack cursor = event.getCursor();
|
||||||
|
|
||||||
|
@ -119,9 +119,8 @@ public class PlayerListener implements Listener {
|
|||||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||||
public void onEntityDamageByEntityHighest(EntityDamageByEntityEvent event) {
|
public void onEntityDamageByEntityHighest(EntityDamageByEntityEvent event) {
|
||||||
// we only care about players as this is for fixing player death messages
|
// we only care about players as this is for fixing player death messages
|
||||||
if (!(event.getEntity() instanceof Player))
|
if (!(event.getEntity() instanceof Player player))
|
||||||
return;
|
return;
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
|
|
||||||
// get the attacker
|
// get the attacker
|
||||||
LivingEntity attacker;
|
LivingEntity attacker;
|
||||||
@ -413,9 +412,8 @@ public class PlayerListener implements Listener {
|
|||||||
{
|
{
|
||||||
event.setExpToDrop(0);
|
event.setExpToDrop(0);
|
||||||
|
|
||||||
if(caught instanceof Item)
|
if(caught instanceof Item caughtItem)
|
||||||
{
|
{
|
||||||
Item caughtItem = (Item) caught;
|
|
||||||
caughtItem.remove();
|
caughtItem.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -489,9 +487,8 @@ public class PlayerListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(event.getEntity() instanceof Player)
|
if(event.getEntity() instanceof Player player)
|
||||||
{
|
{
|
||||||
Player player = (Player) event.getEntity();
|
|
||||||
|
|
||||||
/* WORLD GUARD MAIN FLAG CHECK */
|
/* WORLD GUARD MAIN FLAG CHECK */
|
||||||
if(WorldGuardUtils.isWorldGuardLoaded())
|
if(WorldGuardUtils.isWorldGuardLoaded())
|
||||||
@ -1013,8 +1010,7 @@ public class PlayerListener implements Listener {
|
|||||||
* We can check for an instance instead of EntityType here, so we are
|
* We can check for an instance instead of EntityType here, so we are
|
||||||
* ready for the infamous "Glow Item Frame" in 1.17 too!
|
* ready for the infamous "Glow Item Frame" in 1.17 too!
|
||||||
*/
|
*/
|
||||||
if (event.getRightClicked() instanceof ItemFrame) {
|
if (event.getRightClicked() instanceof ItemFrame frame) {
|
||||||
ItemFrame frame = (ItemFrame) event.getRightClicked();
|
|
||||||
|
|
||||||
// Check for existing items (ignore rotations)
|
// Check for existing items (ignore rotations)
|
||||||
if (frame.getItem().getType() != Material.AIR) {
|
if (frame.getItem().getType() != Material.AIR) {
|
||||||
|
@ -256,45 +256,49 @@ public final class LocaleLoader {
|
|||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static String getExamples() {
|
private static String getExamples() {
|
||||||
return "This.Is.An.Example.Put.Locale.Keys.Here.One=&aExample text using hex color codes\n" +
|
return """
|
||||||
"This.Is.An.Example.Put.Locale.Keys.Here.Two=[[DARK_AQUA]]Example text using our own color codes\n" +
|
This.Is.An.Example.Put.Locale.Keys.Here.One=&aExample text using hex color codes
|
||||||
"This.Is.An.Example.Put.Locale.Keys.Here.Three=Example text with no colors\n";
|
This.Is.An.Example.Put.Locale.Keys.Here.Two=[[DARK_AQUA]]Example text using our own color codes
|
||||||
|
This.Is.An.Example.Put.Locale.Keys.Here.Three=Example text with no colors
|
||||||
|
""";
|
||||||
}
|
}
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
private static String getLocaleHelpTextWithoutExamples() {
|
private static String getLocaleHelpTextWithoutExamples() {
|
||||||
String localeExplanation =
|
String localeExplanation =
|
||||||
"# -- Are you looking to change the language of mcMMO but without editing it yourself? --\n" +
|
"""
|
||||||
"\n" +
|
# -- Are you looking to change the language of mcMMO but without editing it yourself? --
|
||||||
"# mcMMO has quite a few built in translations, you can choose which translation by editing config.yml with the appropriate locale code. The setting is `General.Locale` in config.yml\n" +
|
|
||||||
"# Odds are, if you speak a popular language on earth we already have a translation for it.\n" +
|
# mcMMO has quite a few built in translations, you can choose which translation by editing config.yml with the appropriate locale code. The setting is `General.Locale` in config.yml
|
||||||
"# However our translations are done by the community, and update infrequently. (Please help us out <3)\n" +
|
# Odds are, if you speak a popular language on earth we already have a translation for it.
|
||||||
"# We would love more people to help update our locales, submit any updated translation file to our GitHub or email it to me at business@neetgames.com\n" +
|
# However our translations are done by the community, and update infrequently. (Please help us out <3)
|
||||||
"# For a list of built in translations, view this link: https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/resources/locale\n" +
|
# We would love more people to help update our locales, submit any updated translation file to our GitHub or email it to me at business@neetgames.com
|
||||||
"\n" +
|
# For a list of built in translations, view this link: https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/resources/locale
|
||||||
"\n" +
|
|
||||||
"# -- Using a built in translation -- \n" +
|
|
||||||
"# Assuming you read the above section, edit config.yml's General.Locale from en_US to the locale code that we support (see the above link), then reboot your server\n" +
|
# -- Using a built in translation --\s
|
||||||
"\n" +
|
# Assuming you read the above section, edit config.yml's General.Locale from en_US to the locale code that we support (see the above link), then reboot your server
|
||||||
"\n" +
|
|
||||||
"# -- Do you want to change the text in mcMMO? Including adding colors? ( Locale Override ) -- \n" +
|
|
||||||
"# First, a brief explanation.\n" +
|
# -- Do you want to change the text in mcMMO? Including adding colors? ( Locale Override ) --\s
|
||||||
"# Locales are the language files used by mcMMO, they also contain color codes and most of the styling used by mcMMO.\n" +
|
# First, a brief explanation.
|
||||||
"# You can customize a locale outside of the JAR in version 2.1.51 and up.\n" +
|
# Locales are the language files used by mcMMO, they also contain color codes and most of the styling used by mcMMO.
|
||||||
"#\n" +
|
# You can customize a locale outside of the JAR in version 2.1.51 and up.
|
||||||
"# Locales can be overridden by editing this file\n" +
|
#
|
||||||
"# You can find the up to date current locale files here https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/resources/locale\n" +
|
# Locales can be overridden by editing this file
|
||||||
"# The master file is en_US, if a translation is missing entries (as they often are) it will pull from the en_US file https://github.com/mcMMO-Dev/mcMMO/blob/master/src/main/resources/locale/locale_en_US.properties\n" +
|
# You can find the up to date current locale files here https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/resources/locale
|
||||||
"#\n" +
|
# The master file is en_US, if a translation is missing entries (as they often are) it will pull from the en_US file https://github.com/mcMMO-Dev/mcMMO/blob/master/src/main/resources/locale/locale_en_US.properties
|
||||||
"# To override a locale, add entries to this file and copy ** only ** the strings you want to replace, otherwise you will not see any updated strings when mcMMO updates and will have to manually change them and read patch notes carefully.\n" +
|
#
|
||||||
"# If you wish to replace every line in some way, feel free to copy the entire contents of this file, just be advised that you will need to be on top of locale updates in mcMMO and follow our changelog closely.\n" +
|
# To override a locale, add entries to this file and copy ** only ** the strings you want to replace, otherwise you will not see any updated strings when mcMMO updates and will have to manually change them and read patch notes carefully.
|
||||||
"\n" +
|
# If you wish to replace every line in some way, feel free to copy the entire contents of this file, just be advised that you will need to be on top of locale updates in mcMMO and follow our changelog closely.
|
||||||
"\n" +
|
|
||||||
"# WARNING: Locales only support ASCII and UTF16 characters at the moment, so you'll need to run special characters through a UTF16 converter (google it) to get them to work. This will be fixed in the future!\n" +
|
|
||||||
"# FIND KEYS HERE: On our github repo (en_US is our master file and has ALL the keys) -> https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/resources/locale\n" +
|
# WARNING: Locales only support ASCII and UTF16 characters at the moment, so you'll need to run special characters through a UTF16 converter (google it) to get them to work. This will be fixed in the future!
|
||||||
"# WARNING: Some keys in our master file are unused, make gratuitous use of Ctrl+F\n" +
|
# FIND KEYS HERE: On our github repo (en_US is our master file and has ALL the keys) -> https://github.com/mcMMO-Dev/mcMMO/tree/master/src/main/resources/locale
|
||||||
"# HOW TO APPLY: You can either restart the server for these changes to take effect or run /mcreloadlocale.\n" +
|
# WARNING: Some keys in our master file are unused, make gratuitous use of Ctrl+F
|
||||||
"# -- Add Keys Below --\n";
|
# HOW TO APPLY: You can either restart the server for these changes to take effect or run /mcreloadlocale.
|
||||||
|
# -- Add Keys Below --
|
||||||
|
""";
|
||||||
return localeExplanation;
|
return localeExplanation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,15 +381,10 @@ public class mcMMO extends JavaPlugin {
|
|||||||
// Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
// Remove other tasks BEFORE starting the Backup, or we just cancel it straight away.
|
||||||
try {
|
try {
|
||||||
ZipLibrary.mcMMOBackup();
|
ZipLibrary.mcMMOBackup();
|
||||||
}
|
} catch(NoClassDefFoundError e) {
|
||||||
catch (IOException e) {
|
|
||||||
getLogger().severe(e.toString());
|
|
||||||
}
|
|
||||||
catch(NoClassDefFoundError e) {
|
|
||||||
getLogger().severe("Backup class not found!");
|
getLogger().severe("Backup class not found!");
|
||||||
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
|
getLogger().info("Please do not replace the mcMMO jar while the server is running.");
|
||||||
}
|
} catch (Throwable e) {
|
||||||
catch (Throwable e) {
|
|
||||||
getLogger().severe(e.toString());
|
getLogger().severe(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -73,7 +73,7 @@ public class PlayerProfileLoadingTask extends BukkitRunnable {
|
|||||||
// Increment attempt counter and try
|
// Increment attempt counter and try
|
||||||
attempt++;
|
attempt++;
|
||||||
|
|
||||||
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100)));
|
new PlayerProfileLoadingTask(player, attempt).runTaskLaterAsynchronously(mcMMO.p, (100 + (attempt * 100L)));
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ApplySuccessfulProfile extends BukkitRunnable {
|
private class ApplySuccessfulProfile extends BukkitRunnable {
|
||||||
|
@ -63,7 +63,7 @@ public class AbilityDisableTask extends BukkitRunnable {
|
|||||||
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff());
|
||||||
}
|
}
|
||||||
if(!mcMMO.isServerShutdownExecuted()) {
|
if(!mcMMO.isServerShutdownExecuted()) {
|
||||||
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, (long) PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,8 +35,7 @@ public class DelayedCropReplant extends BukkitRunnable {
|
|||||||
public DelayedCropReplant(BlockBreakEvent blockBreakEvent, BlockState cropState, int desiredCropAge, boolean wasImmaturePlant) {
|
public DelayedCropReplant(BlockBreakEvent blockBreakEvent, BlockState cropState, int desiredCropAge, boolean wasImmaturePlant) {
|
||||||
BlockData cropData = cropState.getBlockData();
|
BlockData cropData = cropState.getBlockData();
|
||||||
|
|
||||||
if(cropData instanceof Directional) {
|
if(cropData instanceof Directional cropDir) {
|
||||||
Directional cropDir = (Directional) cropData;
|
|
||||||
cropFace = cropDir.getFacing();
|
cropFace = cropDir.getFacing();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,8 +102,7 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (SkillUtils.cooldownExpired(mmoPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
if (SkillUtils.cooldownExpired(mmoPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
||||||
if(attacker instanceof Mob) {
|
if(attacker instanceof Mob mob) {
|
||||||
Mob mob = (Mob) attacker;
|
|
||||||
//Check to see how many dodge XP rewards this mob has handed out
|
//Check to see how many dodge XP rewards this mob has handed out
|
||||||
if(mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER) && ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented()) {
|
if(mob.hasMetadata(MetadataConstants.METADATA_KEY_DODGE_TRACKER) && ExperienceConfig.getInstance().isAcrobaticsExploitingPrevented()) {
|
||||||
//If Dodge XP has been handed out 5 times then consider it being exploited
|
//If Dodge XP has been handed out 5 times then consider it being exploited
|
||||||
|
@ -15,12 +15,9 @@ import com.gmail.nossr50.util.random.RandomChanceUtil;
|
|||||||
import com.gmail.nossr50.util.skills.*;
|
import com.gmail.nossr50.util.skills.*;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class AxesManager extends SkillManager {
|
public class AxesManager extends SkillManager {
|
||||||
public AxesManager(McMMOPlayer mcMMOPlayer) {
|
public AxesManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, PrimarySkillType.AXES);
|
super(mcMMOPlayer, PrimarySkillType.AXES);
|
||||||
@ -93,8 +90,7 @@ public class AxesManager extends SkillManager {
|
|||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CriticalHit");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CriticalHit");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player defender) {
|
||||||
Player defender = (Player) target;
|
|
||||||
|
|
||||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck");
|
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.CritStruck");
|
||||||
@ -150,8 +146,7 @@ public class AxesManager extends SkillManager {
|
|||||||
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Proc");
|
NotificationManager.sendPlayerInformation(player, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Proc");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player defender) {
|
||||||
Player defender = (Player) target;
|
|
||||||
|
|
||||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck");
|
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Axes.Combat.GI.Struck");
|
||||||
@ -163,11 +158,10 @@ public class AxesManager extends SkillManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the effects of the Skull Splitter ability
|
* Handle the effects of the Skull Splitter ability
|
||||||
*
|
|
||||||
* @param target The {@link LivingEntity} being affected by the ability
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public void skullSplitterCheck(@NotNull LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
|
public void skullSplitterCheck(@NotNull LivingEntity target, double damage) {
|
||||||
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, modifiers, skill);
|
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Axes.skullSplitterModifier, skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,11 +88,9 @@ public class HerbalismManager extends SkillManager {
|
|||||||
mmoPlayer.getPlayer().sendMessage("Processing sweet berry bush rewards");
|
mmoPlayer.getPlayer().sendMessage("Processing sweet berry bush rewards");
|
||||||
}
|
}
|
||||||
//Check the age
|
//Check the age
|
||||||
if(blockState.getBlockData() instanceof Ageable) {
|
if(blockState.getBlockData() instanceof Ageable ageable) {
|
||||||
int rewardByAge = 0;
|
int rewardByAge = 0;
|
||||||
|
|
||||||
Ageable ageable = (Ageable) blockState.getBlockData();
|
|
||||||
|
|
||||||
if(ageable.getAge() == 2) {
|
if(ageable.getAge() == 2) {
|
||||||
rewardByAge = 1; //Normal XP
|
rewardByAge = 1; //Normal XP
|
||||||
} else if(ageable.getAge() == 3) {
|
} else if(ageable.getAge() == 3) {
|
||||||
@ -134,8 +132,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
BlockState blockState = block.getState();
|
BlockState blockState = block.getState();
|
||||||
|
|
||||||
if(blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) {
|
if(blockState.getType().toString().equalsIgnoreCase("sweet_berry_bush")) {
|
||||||
if(blockState.getBlockData() instanceof Ageable) {
|
if(blockState.getBlockData() instanceof Ageable ageable) {
|
||||||
Ageable ageable = (Ageable) blockState.getBlockData();
|
|
||||||
|
|
||||||
if(ageable.getAge() <= 1) {
|
if(ageable.getAge() <= 1) {
|
||||||
applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF);
|
applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF);
|
||||||
@ -351,8 +348,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Not all things that are natural should give double drops, make sure its fully mature as well
|
//Not all things that are natural should give double drops, make sure its fully mature as well
|
||||||
if(plantData instanceof Ageable) {
|
if(plantData instanceof Ageable ageable) {
|
||||||
Ageable ageable = (Ageable) plantData;
|
|
||||||
|
|
||||||
if(isAgeableMature(ageable) || isBizarreAgeable(plantData)) {
|
if(isAgeableMature(ageable) || isBizarreAgeable(plantData)) {
|
||||||
if(checkDoubleDrop(brokenPlantState)) {
|
if(checkDoubleDrop(brokenPlantState)) {
|
||||||
@ -447,8 +443,7 @@ public class HerbalismManager extends SkillManager {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
//Calculate XP
|
//Calculate XP
|
||||||
if(plantData instanceof Ageable) {
|
if(plantData instanceof Ageable plantAgeable) {
|
||||||
Ageable plantAgeable = (Ageable) plantData;
|
|
||||||
|
|
||||||
if(isAgeableMature(plantAgeable) || isBizarreAgeable(plantData)) {
|
if(isAgeableMature(plantAgeable) || isBizarreAgeable(plantData)) {
|
||||||
xpToReward += ExperienceConfig.getInstance().getXp(PrimarySkillType.HERBALISM, brokenBlockNewState.getType());
|
xpToReward += ExperienceConfig.getInstance().getXp(PrimarySkillType.HERBALISM, brokenBlockNewState.getType());
|
||||||
@ -764,12 +759,10 @@ public class HerbalismManager extends SkillManager {
|
|||||||
|
|
||||||
BlockData blockData = blockState.getBlockData();
|
BlockData blockData = blockState.getBlockData();
|
||||||
|
|
||||||
if (!(blockData instanceof Ageable)) {
|
if (!(blockData instanceof Ageable ageable)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Ageable ageable = (Ageable) blockData;
|
|
||||||
|
|
||||||
//If the ageable is NOT mature and the player is NOT using a hoe, abort
|
//If the ageable is NOT mature and the player is NOT using a hoe, abort
|
||||||
|
|
||||||
Player player = getPlayer();
|
Player player = getPlayer();
|
||||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.util.skills.RankUtils;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
|
||||||
|
|
||||||
public class BlastMining {
|
public class BlastMining {
|
||||||
// The order of the values is extremely important, a few methods depend on it to work properly
|
// The order of the values is extremely important, a few methods depend on it to work properly
|
||||||
@ -114,7 +113,7 @@ public class BlastMining {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
event.setDamage(DamageModifier.BASE, miningManager.processDemolitionsExpertise(event.getDamage()));
|
event.setDamage(miningManager.processDemolitionsExpertise(event.getDamage()));
|
||||||
|
|
||||||
if (event.getFinalDamage() == 0) {
|
if (event.getFinalDamage() == 0) {
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
@ -130,7 +130,7 @@ public class MiningManager extends SkillManager {
|
|||||||
|
|
||||||
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
|
mmoPlayer.setAbilityDATS(SuperAbilityType.BLAST_MINING, System.currentTimeMillis());
|
||||||
mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
|
mmoPlayer.setAbilityInformed(SuperAbilityType.BLAST_MINING, false);
|
||||||
new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(mcMMO.p, SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
new AbilityCooldownTask(mmoPlayer, SuperAbilityType.BLAST_MINING).runTaskLater(mcMMO.p, (long) SuperAbilityType.BLAST_MINING.getCooldown() * Misc.TICK_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,12 +21,9 @@ import com.gmail.nossr50.util.skills.SkillActivationType;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public class SwordsManager extends SkillManager {
|
public class SwordsManager extends SkillManager {
|
||||||
public SwordsManager(McMMOPlayer mcMMOPlayer) {
|
public SwordsManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, PrimarySkillType.SWORDS);
|
super(mcMMOPlayer, PrimarySkillType.SWORDS);
|
||||||
@ -81,8 +78,7 @@ public class SwordsManager extends SkillManager {
|
|||||||
|
|
||||||
if (RandomChanceUtil.rollDice(mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(getRuptureRank()), 100)) {
|
if (RandomChanceUtil.rollDice(mcMMO.p.getAdvancedConfig().getRuptureChanceToApplyOnHit(getRuptureRank()), 100)) {
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player defender) {
|
||||||
Player defender = (Player) target;
|
|
||||||
|
|
||||||
//Don't start or add to a bleed if they are blocking
|
//Don't start or add to a bleed if they are blocking
|
||||||
if(defender.isBlocking())
|
if(defender.isBlocking())
|
||||||
@ -158,11 +154,10 @@ public class SwordsManager extends SkillManager {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle the effects of the Serrated Strikes ability
|
* Handle the effects of the Serrated Strikes ability
|
||||||
*
|
|
||||||
* @param target The {@link LivingEntity} being affected by the ability
|
* @param target The {@link LivingEntity} being affected by the ability
|
||||||
* @param damage The amount of damage initially dealt by the event
|
* @param damage The amount of damage initially dealt by the event
|
||||||
*/
|
*/
|
||||||
public void serratedStrikes(@NotNull LivingEntity target, double damage, Map<DamageModifier, Double> modifiers) {
|
public void serratedStrikes(@NotNull LivingEntity target, double damage) {
|
||||||
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, modifiers, skill);
|
CombatUtils.applyAbilityAoE(getPlayer(), target, damage / Swords.serratedStrikesModifier, skill);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -240,8 +240,7 @@ public class TamingManager extends SkillManager {
|
|||||||
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));
|
message = message.concat(LocaleLoader.getString("Combat.BeastLoreHealth", target.getHealth(), target.getMaxHealth()));
|
||||||
|
|
||||||
// Bred mules & donkeys can actually have horse-like stats, but llamas cannot.
|
// Bred mules & donkeys can actually have horse-like stats, but llamas cannot.
|
||||||
if (beast instanceof AbstractHorse && !(beast instanceof Llama)) {
|
if (beast instanceof AbstractHorse horseLikeCreature && !(beast instanceof Llama)) {
|
||||||
AbstractHorse horseLikeCreature = (AbstractHorse) beast;
|
|
||||||
AttributeInstance jumpAttribute = horseLikeCreature.getAttribute(Attribute.HORSE_JUMP_STRENGTH);
|
AttributeInstance jumpAttribute = horseLikeCreature.getAttribute(Attribute.HORSE_JUMP_STRENGTH);
|
||||||
|
|
||||||
if(jumpAttribute != null) {
|
if(jumpAttribute != null) {
|
||||||
@ -277,8 +276,7 @@ public class TamingManager extends SkillManager {
|
|||||||
ParticleEffectUtils.playGreaterImpactEffect(target);
|
ParticleEffectUtils.playGreaterImpactEffect(target);
|
||||||
target.setVelocity(wolf.getLocation().getDirection().normalize().multiply(1.5D));
|
target.setVelocity(wolf.getLocation().getDirection().normalize().multiply(1.5D));
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player defender) {
|
||||||
Player defender = (Player) target;
|
|
||||||
|
|
||||||
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
if (NotificationManager.doesPlayerUseNotifications(defender)) {
|
||||||
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage");
|
NotificationManager.sendPlayerInformation(defender, NotificationType.SUBSKILL_MESSAGE, "Taming.SubSkill.Pummel.TargetMessage");
|
||||||
@ -287,9 +285,8 @@ public class TamingManager extends SkillManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void attackTarget(LivingEntity target) {
|
public void attackTarget(LivingEntity target) {
|
||||||
if(target instanceof Tameable)
|
if(target instanceof Tameable tameable)
|
||||||
{
|
{
|
||||||
Tameable tameable = (Tameable) target;
|
|
||||||
if(tameable.getOwner() == getPlayer())
|
if(tameable.getOwner() == getPlayer())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -290,8 +290,7 @@ public final class BlockUtils {
|
|||||||
if (data.getMaterial() == Material.CACTUS || data.getMaterial() == Material.SUGAR_CANE) {
|
if (data.getMaterial() == Material.CACTUS || data.getMaterial() == Material.SUGAR_CANE) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (data instanceof Ageable) {
|
if (data instanceof Ageable ageable) {
|
||||||
Ageable ageable = (Ageable) data;
|
|
||||||
return ageable.getAge() == ageable.getMaximumAge();
|
return ageable.getAge() == ageable.getMaximumAge();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -130,12 +130,10 @@ public final class EventUtils {
|
|||||||
if(Misc.isNPCEntityExcludingVillagers(entity))
|
if(Misc.isNPCEntityExcludingVillagers(entity))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!entity.isValid() || !(entity instanceof LivingEntity)) {
|
if (!entity.isValid() || !(entity instanceof LivingEntity livingEntity)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
|
||||||
|
|
||||||
if (CombatUtils.isInvincible(livingEntity, damage)) {
|
if (CombatUtils.isInvincible(livingEntity, damage)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ public final class MobHealthbarUtils {
|
|||||||
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
target.setMetadata(MetadataConstants.METADATA_KEY_NAME_VISIBILITY, new FixedMetadataValue(mcMMO.p, false));
|
||||||
}
|
}
|
||||||
|
|
||||||
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
new MobHealthDisplayUpdaterTask(target).runTaskLater(mcMMO.p, (long) displayTime * Misc.TICK_CONVERSION_FACTOR); // Clear health display after 3 seconds
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ public class TransientEntityTracker {
|
|||||||
* @param playerUUID player to register
|
* @param playerUUID player to register
|
||||||
*/
|
*/
|
||||||
private synchronized void registerPlayer(@NotNull UUID playerUUID) {
|
private synchronized void registerPlayer(@NotNull UUID playerUUID) {
|
||||||
getPerPlayerTransientEntityMap().put(playerUUID, new HashMap<CallOfTheWildType, HashSet<TrackedTamingEntity>>());
|
getPerPlayerTransientEntityMap().put(playerUUID, new HashMap<>());
|
||||||
|
|
||||||
for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) {
|
for(CallOfTheWildType callOfTheWildType : CallOfTheWildType.values()) {
|
||||||
getPerPlayerTransientEntityMap().get(playerUUID).put(callOfTheWildType, new HashSet<>());
|
getPerPlayerTransientEntityMap().get(playerUUID).put(callOfTheWildType, new HashSet<>());
|
||||||
|
@ -132,7 +132,7 @@ public class McMMOSimpleRegionFile {
|
|||||||
int oldSegmentIndex = chunkSegmentIndex[index]; // Get current segment index
|
int oldSegmentIndex = chunkSegmentIndex[index]; // Get current segment index
|
||||||
markChunkSegments(index, false); // Clear our old segments
|
markChunkSegments(index, false); // Clear our old segments
|
||||||
int newSegmentIndex = findContiguousSegments(oldSegmentIndex, size); // Find contiguous segments to save to
|
int newSegmentIndex = findContiguousSegments(oldSegmentIndex, size); // Find contiguous segments to save to
|
||||||
file.seek(newSegmentIndex << segmentExponent); // Seek to file location
|
file.seek((long) newSegmentIndex << segmentExponent); // Seek to file location
|
||||||
file.write(buffer, 0, size); // Write data
|
file.write(buffer, 0, size); // Write data
|
||||||
// update in memory info
|
// update in memory info
|
||||||
chunkSegmentIndex[index] = newSegmentIndex;
|
chunkSegmentIndex[index] = newSegmentIndex;
|
||||||
@ -141,9 +141,9 @@ public class McMMOSimpleRegionFile {
|
|||||||
// Mark segments in use
|
// Mark segments in use
|
||||||
markChunkSegments(index, true);
|
markChunkSegments(index, true);
|
||||||
// Update header info
|
// Update header info
|
||||||
file.seek(SEEK_CHUNK_SEGMENT_INDICES + (4 * index));
|
file.seek(SEEK_CHUNK_SEGMENT_INDICES + (4L * index));
|
||||||
file.writeInt(chunkSegmentIndex[index]);
|
file.writeInt(chunkSegmentIndex[index]);
|
||||||
file.seek(SEEK_CHUNK_BYTE_LENGTHS + (4 * index));
|
file.seek(SEEK_CHUNK_BYTE_LENGTHS + (4L * index));
|
||||||
file.writeInt(chunkNumBytes[index]);
|
file.writeInt(chunkNumBytes[index]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,7 +157,7 @@ public class McMMOSimpleRegionFile {
|
|||||||
|
|
||||||
byte[] data = new byte[byteLength];
|
byte[] data = new byte[byteLength];
|
||||||
|
|
||||||
file.seek(chunkSegmentIndex[index] << segmentExponent); // Seek to file location
|
file.seek((long) chunkSegmentIndex[index] << segmentExponent); // Seek to file location
|
||||||
file.readFully(data); // Read in the data
|
file.readFully(data); // Read in the data
|
||||||
return new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data)));
|
return new DataInputStream(new InflaterInputStream(new ByteArrayInputStream(data)));
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ public class ExperienceBarManager {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
|
ExperienceBarHideTask experienceBarHideTask = new ExperienceBarHideTask(this, mcMMOPlayer, primarySkillType);
|
||||||
experienceBarHideTask.runTaskLater(plugin, 20* delaySeconds);
|
experienceBarHideTask.runTaskLater(plugin, 20L * delaySeconds);
|
||||||
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
experienceBarHideTaskHashMap.put(primarySkillType, experienceBarHideTask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,11 +32,7 @@ public abstract class MajorMinorPatchVersion implements Versioned {
|
|||||||
this.majorVersion = majorVersion;
|
this.majorVersion = majorVersion;
|
||||||
this.minorVersion = minorVersion;
|
this.minorVersion = minorVersion;
|
||||||
|
|
||||||
if(patchVersion == null) {
|
this.patchVersion = Objects.requireNonNullElseGet(patchVersion, () -> new SimpleNumericVersion(0));
|
||||||
this.patchVersion = new SimpleNumericVersion(0);
|
|
||||||
} else {
|
|
||||||
this.patchVersion = patchVersion;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MajorMinorPatchVersion(int majorVerNumber, int minorVerNumber, int patchVerNumber) {
|
public MajorMinorPatchVersion(int majorVerNumber, int minorVerNumber, int patchVerNumber) {
|
||||||
|
@ -8,7 +8,6 @@ import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
|||||||
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
|
||||||
import com.gmail.nossr50.events.fake.FakeEntityDamageEvent;
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.metadata.MobMetaFlagType;
|
import com.gmail.nossr50.metadata.MobMetaFlagType;
|
||||||
import com.gmail.nossr50.metadata.MobMetadataService;
|
import com.gmail.nossr50.metadata.MobMetadataService;
|
||||||
@ -23,7 +22,6 @@ import com.gmail.nossr50.skills.unarmed.UnarmedManager;
|
|||||||
import com.gmail.nossr50.util.*;
|
import com.gmail.nossr50.util.*;
|
||||||
import com.gmail.nossr50.util.player.NotificationManager;
|
import com.gmail.nossr50.util.player.NotificationManager;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.google.common.collect.ImmutableMap;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -33,7 +31,6 @@ import org.bukkit.entity.*;
|
|||||||
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent.DamageModifier;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
import org.bukkit.potion.PotionEffectType;
|
||||||
@ -41,10 +38,7 @@ import org.bukkit.projectiles.ProjectileSource;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.EnumMap;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
public final class CombatUtils {
|
public final class CombatUtils {
|
||||||
|
|
||||||
@ -56,14 +50,10 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
//Likely.. because who knows what plugins are throwing around
|
//Likely.. because who knows what plugins are throwing around
|
||||||
public static boolean isDamageLikelyFromNormalCombat(@NotNull DamageCause damageCause) {
|
public static boolean isDamageLikelyFromNormalCombat(@NotNull DamageCause damageCause) {
|
||||||
switch (damageCause) {
|
return switch (damageCause) {
|
||||||
case ENTITY_ATTACK:
|
case ENTITY_ATTACK, ENTITY_SWEEP_ATTACK, PROJECTILE -> true;
|
||||||
case ENTITY_SWEEP_ATTACK:
|
default -> false;
|
||||||
case PROJECTILE:
|
};
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean hasWeakenedDamage(@NotNull LivingEntity livingEntity) {
|
public static boolean hasWeakenedDamage(@NotNull LivingEntity livingEntity) {
|
||||||
@ -83,10 +73,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
SwordsManager swordsManager = mcMMOPlayer.getSwordsManager();
|
||||||
double initialDamage = event.getDamage();
|
double boostedDamage = event.getDamage();
|
||||||
double finalDamage = initialDamage;
|
|
||||||
|
|
||||||
Map<DamageModifier, Double> modifiers = getModifiers(event);
|
|
||||||
|
|
||||||
if (swordsManager.canActivateAbility()) {
|
if (swordsManager.canActivateAbility()) {
|
||||||
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.SWORDS);
|
mcMMOPlayer.checkAbilityActivation(PrimarySkillType.SWORDS);
|
||||||
@ -99,19 +86,19 @@ public final class CombatUtils {
|
|||||||
//Add Stab Damage
|
//Add Stab Damage
|
||||||
if(swordsManager.canUseStab())
|
if(swordsManager.canUseStab())
|
||||||
{
|
{
|
||||||
finalDamage+=(swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
boostedDamage += (swordsManager.getStabDamage() * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (swordsManager.canUseSerratedStrike()) {
|
if (swordsManager.canUseSerratedStrike()) {
|
||||||
swordsManager.serratedStrikes(target, initialDamage, modifiers);
|
swordsManager.serratedStrikes(target, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))
|
if(canUseLimitBreak(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK))
|
||||||
{
|
{
|
||||||
finalDamage+=(getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
boostedDamage += (getLimitBreakDamage(player, target, SubSkillType.SWORDS_SWORDS_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
event.setDamage(boostedDamage);
|
||||||
processCombatXP(mcMMOPlayer, target, PrimarySkillType.SWORDS);
|
processCombatXP(mcMMOPlayer, target, PrimarySkillType.SWORDS);
|
||||||
|
|
||||||
printFinalDamageDebug(player, event, mcMMOPlayer);
|
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||||
@ -134,9 +121,7 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double initialDamage = event.getDamage();
|
double boostedDamage = event.getDamage();
|
||||||
double finalDamage = initialDamage;
|
|
||||||
Map<DamageModifier, Double> modifiers = getModifiers(event);
|
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
@ -152,30 +137,30 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (axesManager.canUseAxeMastery()) {
|
if (axesManager.canUseAxeMastery()) {
|
||||||
finalDamage+=axesManager.axeMastery();
|
boostedDamage+=axesManager.axeMastery();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axesManager.canImpact(target)) {
|
if (axesManager.canImpact(target)) {
|
||||||
axesManager.impactCheck(target);
|
axesManager.impactCheck(target);
|
||||||
}
|
}
|
||||||
else if (axesManager.canGreaterImpact(target)) {
|
else if (axesManager.canGreaterImpact(target)) {
|
||||||
finalDamage+=axesManager.greaterImpact(target);
|
boostedDamage+=axesManager.greaterImpact(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axesManager.canUseSkullSplitter(target)) {
|
if (axesManager.canUseSkullSplitter(target)) {
|
||||||
axesManager.skullSplitterCheck(target, initialDamage, modifiers);
|
axesManager.skullSplitterCheck(target, event.getDamage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (axesManager.canCriticalHit(target)) {
|
if (axesManager.canCriticalHit(target)) {
|
||||||
finalDamage+=(axesManager.criticalHit(target, finalDamage) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(axesManager.criticalHit(target, boostedDamage) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK))
|
if(canUseLimitBreak(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK))
|
||||||
{
|
{
|
||||||
finalDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.AXES_AXES_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
event.setDamage(boostedDamage);
|
||||||
processCombatXP(mcMMOPlayer, target, PrimarySkillType.AXES);
|
processCombatXP(mcMMOPlayer, target, PrimarySkillType.AXES);
|
||||||
|
|
||||||
printFinalDamageDebug(player, event, mcMMOPlayer);
|
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||||
@ -186,8 +171,7 @@ public final class CombatUtils {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double initialDamage = event.getDamage();
|
double boostedDamage = event.getDamage();
|
||||||
double finalDamage = initialDamage;
|
|
||||||
|
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
@ -203,11 +187,11 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (unarmedManager.canUseSteelArm()) {
|
if (unarmedManager.canUseSteelArm()) {
|
||||||
finalDamage+=(unarmedManager.calculateSteelArmStyleDamage() * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(unarmedManager.calculateSteelArmStyleDamage() * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unarmedManager.canUseBerserk()) {
|
if (unarmedManager.canUseBerserk()) {
|
||||||
finalDamage+=(unarmedManager.berserkDamage(finalDamage) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(unarmedManager.berserkDamage(boostedDamage) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (unarmedManager.canDisarm(target)) {
|
if (unarmedManager.canDisarm(target)) {
|
||||||
@ -216,10 +200,10 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
if(canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
if(canUseLimitBreak(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK))
|
||||||
{
|
{
|
||||||
finalDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
boostedDamage+=(getLimitBreakDamage(player, target, SubSkillType.UNARMED_UNARMED_LIMIT_BREAK) * mcMMOPlayer.getAttackStrength());
|
||||||
}
|
}
|
||||||
|
|
||||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
event.setDamage(boostedDamage);
|
||||||
processCombatXP(mcMMOPlayer, target, PrimarySkillType.UNARMED);
|
processCombatXP(mcMMOPlayer, target, PrimarySkillType.UNARMED);
|
||||||
|
|
||||||
printFinalDamageDebug(player, event, mcMMOPlayer);
|
printFinalDamageDebug(player, event, mcMMOPlayer);
|
||||||
@ -227,7 +211,7 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
private static void processTamingCombat(@NotNull LivingEntity target, @Nullable Player master, @NotNull Wolf wolf, @NotNull EntityDamageByEntityEvent event) {
|
private static void processTamingCombat(@NotNull LivingEntity target, @Nullable Player master, @NotNull Wolf wolf, @NotNull EntityDamageByEntityEvent event) {
|
||||||
double initialDamage = event.getDamage();
|
double initialDamage = event.getDamage();
|
||||||
double finalDamage = initialDamage;
|
double boostedDamage = initialDamage;
|
||||||
|
|
||||||
if(master != null && master.isOnline() && master.isValid()) {
|
if(master != null && master.isOnline() && master.isValid()) {
|
||||||
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
McMMOPlayer mcMMOPlayer = UserManager.getPlayer(master);
|
||||||
@ -246,14 +230,14 @@ public final class CombatUtils {
|
|||||||
tamingManager.pummel(target, wolf);
|
tamingManager.pummel(target, wolf);
|
||||||
|
|
||||||
if (tamingManager.canUseSharpenedClaws()) {
|
if (tamingManager.canUseSharpenedClaws()) {
|
||||||
finalDamage+=tamingManager.sharpenedClaws();
|
boostedDamage+=tamingManager.sharpenedClaws();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tamingManager.canUseGore()) {
|
if (tamingManager.canUseGore()) {
|
||||||
finalDamage+=tamingManager.gore(target, initialDamage);
|
boostedDamage+=tamingManager.gore(target, initialDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
event.setDamage(boostedDamage);
|
||||||
processCombatXP(mcMMOPlayer, target, PrimarySkillType.TAMING, 3);
|
processCombatXP(mcMMOPlayer, target, PrimarySkillType.TAMING, 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -272,15 +256,15 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
ArcheryManager archeryManager = mcMMOPlayer.getArcheryManager();
|
||||||
|
|
||||||
double finalDamage = event.getDamage();
|
double boostedDamage = event.getDamage();
|
||||||
|
|
||||||
if (archeryManager.canSkillShot()) {
|
if (archeryManager.canSkillShot()) {
|
||||||
//Not Additive
|
//Not Additive
|
||||||
finalDamage = archeryManager.skillShot(initialDamage);
|
boostedDamage = archeryManager.skillShot(initialDamage);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (archeryManager.canDaze(target)) {
|
if (archeryManager.canDaze(target)) {
|
||||||
finalDamage+=archeryManager.daze((Player) target); //the cast is checked by the if condition
|
boostedDamage+=archeryManager.daze((Player) target); //the cast is checked by the if condition
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW) && archeryManager.canRetrieveArrows()) {
|
if (!arrow.hasMetadata(MetadataConstants.METADATA_KEY_INF_ARROW) && archeryManager.canRetrieveArrows()) {
|
||||||
@ -289,7 +273,7 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
if(canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))
|
if(canUseLimitBreak(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK))
|
||||||
{
|
{
|
||||||
finalDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK);
|
boostedDamage+=getLimitBreakDamage(player, target, SubSkillType.ARCHERY_ARCHERY_LIMIT_BREAK);
|
||||||
}
|
}
|
||||||
|
|
||||||
double distanceMultiplier = archeryManager.distanceXpBonusMultiplier(target, arrow);
|
double distanceMultiplier = archeryManager.distanceXpBonusMultiplier(target, arrow);
|
||||||
@ -298,15 +282,14 @@ public final class CombatUtils {
|
|||||||
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
if(arrow.hasMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE))
|
||||||
forceMultiplier = arrow.getMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE).get(0).asDouble();
|
forceMultiplier = arrow.getMetadata(MetadataConstants.METADATA_KEY_BOW_FORCE).get(0).asDouble();
|
||||||
|
|
||||||
applyScaledModifiers(initialDamage, finalDamage, event);
|
event.setDamage(boostedDamage);
|
||||||
|
|
||||||
processCombatXP(mcMMOPlayer, target, PrimarySkillType.ARCHERY, forceMultiplier * distanceMultiplier);
|
processCombatXP(mcMMOPlayer, target, PrimarySkillType.ARCHERY, forceMultiplier * distanceMultiplier);
|
||||||
|
|
||||||
printFinalDamageDebug(player, event, mcMMOPlayer,
|
printFinalDamageDebug(player, event, mcMMOPlayer,
|
||||||
"Distance Multiplier: "+distanceMultiplier,
|
"Distance Multiplier: "+distanceMultiplier,
|
||||||
"Force Multiplier: "+forceMultiplier,
|
"Force Multiplier: "+forceMultiplier,
|
||||||
"Initial Damage: "+initialDamage,
|
"Initial Damage: "+initialDamage,
|
||||||
"Final Damage: "+finalDamage);
|
"Final Damage: "+boostedDamage);
|
||||||
//Clean data
|
//Clean data
|
||||||
cleanupArrowMetadata(arrow);
|
cleanupArrowMetadata(arrow);
|
||||||
}
|
}
|
||||||
@ -351,8 +334,7 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (painSourceRoot instanceof Player && entityType == EntityType.PLAYER) {
|
if (painSourceRoot instanceof Player player && entityType == EntityType.PLAYER) {
|
||||||
Player player = (Player) painSourceRoot;
|
|
||||||
|
|
||||||
if (!UserManager.hasPlayerDataKey(player)) {
|
if (!UserManager.hasPlayerDataKey(player)) {
|
||||||
return;
|
return;
|
||||||
@ -410,8 +392,7 @@ public final class CombatUtils {
|
|||||||
Wolf wolf = (Wolf) painSource;
|
Wolf wolf = (Wolf) painSource;
|
||||||
AnimalTamer tamer = wolf.getOwner();
|
AnimalTamer tamer = wolf.getOwner();
|
||||||
|
|
||||||
if (tamer instanceof Player && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TAMING, target)) {
|
if (tamer instanceof Player master && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.TAMING, target)) {
|
||||||
Player master = (Player) tamer;
|
|
||||||
|
|
||||||
if (!Misc.isNPCEntityExcludingVillagers(master) && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(master, PrimarySkillType.TAMING)) {
|
if (!Misc.isNPCEntityExcludingVillagers(master) && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(master, PrimarySkillType.TAMING)) {
|
||||||
processTamingCombat(target, master, wolf, event);
|
processTamingCombat(target, master, wolf, event);
|
||||||
@ -422,8 +403,7 @@ public final class CombatUtils {
|
|||||||
Projectile arrow = (Projectile) painSource;
|
Projectile arrow = (Projectile) painSource;
|
||||||
ProjectileSource projectileSource = arrow.getShooter();
|
ProjectileSource projectileSource = arrow.getShooter();
|
||||||
|
|
||||||
if (projectileSource instanceof Player && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.ARCHERY, target)) {
|
if (projectileSource instanceof Player player && mcMMO.p.getSkillTools().canCombatSkillsTrigger(PrimarySkillType.ARCHERY, target)) {
|
||||||
Player player = (Player) projectileSource;
|
|
||||||
|
|
||||||
if (!Misc.isNPCEntityExcludingVillagers(player) && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.ARCHERY)) {
|
if (!Misc.isNPCEntityExcludingVillagers(player) && mcMMO.p.getSkillTools().doesPlayerHaveSkillPermission(player, PrimarySkillType.ARCHERY)) {
|
||||||
processArcheryCombat(target, player, event, arrow);
|
processArcheryCombat(target, player, event, arrow);
|
||||||
@ -472,8 +452,7 @@ public final class CombatUtils {
|
|||||||
* @return the RAW damage bonus from Limit Break which is applied before reductions
|
* @return the RAW damage bonus from Limit Break which is applied before reductions
|
||||||
*/
|
*/
|
||||||
public static int getLimitBreakDamage(@NotNull Player attacker, @NotNull LivingEntity defender, @NotNull SubSkillType subSkillType) {
|
public static int getLimitBreakDamage(@NotNull Player attacker, @NotNull LivingEntity defender, @NotNull SubSkillType subSkillType) {
|
||||||
if(defender instanceof Player) {
|
if(defender instanceof Player playerDefender) {
|
||||||
Player playerDefender = (Player) defender;
|
|
||||||
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, getArmorQualityLevel(playerDefender));
|
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, getArmorQualityLevel(playerDefender));
|
||||||
} else {
|
} else {
|
||||||
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, 1000);
|
return getLimitBreakDamageAgainstQuality(attacker, subSkillType, 1000);
|
||||||
@ -683,13 +662,12 @@ public final class CombatUtils {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply Area-of-Effect ability actions.
|
* Apply Area-of-Effect ability actions.
|
||||||
*
|
|
||||||
* @param attacker The attacking player
|
* @param attacker The attacking player
|
||||||
* @param target The defending entity
|
* @param target The defending entity
|
||||||
* @param damage The initial damage amount
|
* @param damage The initial damage amount
|
||||||
* @param type The type of skill being used
|
* @param type The type of skill being used
|
||||||
*/
|
*/
|
||||||
public static void applyAbilityAoE(@NotNull Player attacker, @NotNull LivingEntity target, double damage, Map<DamageModifier, Double> modifiers, @NotNull PrimarySkillType type) {
|
public static void applyAbilityAoE(@NotNull Player attacker, @NotNull LivingEntity target, double damage, @NotNull PrimarySkillType type) {
|
||||||
int numberOfTargets = getTier(attacker.getInventory().getItemInMainHand()); // The higher the weapon tier, the more targets you hit
|
int numberOfTargets = getTier(attacker.getInventory().getItemInMainHand()); // The higher the weapon tier, the more targets you hit
|
||||||
double damageAmount = Math.max(damage, 1);
|
double damageAmount = Math.max(damage, 1);
|
||||||
|
|
||||||
@ -698,11 +676,11 @@ public final class CombatUtils {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity)) || !(entity instanceof LivingEntity) || !shouldBeAffected(attacker, entity)) {
|
if ((ExperienceConfig.getInstance().isNPCInteractionPrevented() && Misc.isNPCEntityExcludingVillagers(entity))
|
||||||
|
|| !(entity instanceof LivingEntity livingEntity) || !shouldBeAffected(attacker, entity)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LivingEntity livingEntity = (LivingEntity) entity;
|
|
||||||
EventUtils.callFakeArmSwingEvent(attacker);
|
EventUtils.callFakeArmSwingEvent(attacker);
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@ -711,7 +689,12 @@ public final class CombatUtils {
|
|||||||
NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
NotificationManager.sendPlayerInformation((Player)entity, NotificationType.SUBSKILL_MESSAGE, "Swords.Combat.SS.Struck");
|
||||||
}
|
}
|
||||||
|
|
||||||
UserManager.getPlayer(attacker).getSwordsManager().processRupture(livingEntity);
|
McMMOPlayer mmoAttacker = UserManager.getPlayer(attacker);
|
||||||
|
|
||||||
|
if(mmoAttacker != null) {
|
||||||
|
mmoAttacker.getSwordsManager().processRupture(livingEntity);
|
||||||
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AXES:
|
case AXES:
|
||||||
@ -753,13 +736,12 @@ public final class CombatUtils {
|
|||||||
double baseXP = 0;
|
double baseXP = 0;
|
||||||
XPGainReason xpGainReason;
|
XPGainReason xpGainReason;
|
||||||
|
|
||||||
if (target instanceof Player) {
|
if (target instanceof Player defender) {
|
||||||
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
|
if (!ExperienceConfig.getInstance().getExperienceGainsPlayerVersusPlayerEnabled() || PartyManager.inSameParty(mcMMOPlayer.getPlayer(), (Player) target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xpGainReason = XPGainReason.PVP;
|
xpGainReason = XPGainReason.PVP;
|
||||||
Player defender = (Player) target;
|
|
||||||
|
|
||||||
if (defender.isOnline() && SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
if (defender.isOnline() && SkillUtils.cooldownExpired(mcMMOPlayer.getRespawnATS(), Misc.PLAYER_RESPAWN_COOLDOWN_SECONDS)) {
|
||||||
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
|
baseXP = 20 * ExperienceConfig.getInstance().getPlayerVersusPlayerXP();
|
||||||
@ -833,9 +815,7 @@ public final class CombatUtils {
|
|||||||
* @return true if the Entity should be damaged, false otherwise.
|
* @return true if the Entity should be damaged, false otherwise.
|
||||||
*/
|
*/
|
||||||
private static boolean shouldBeAffected(@NotNull Player player, @NotNull Entity entity) {
|
private static boolean shouldBeAffected(@NotNull Player player, @NotNull Entity entity) {
|
||||||
if (entity instanceof Player) {
|
if (entity instanceof Player defender) {
|
||||||
Player defender = (Player) entity;
|
|
||||||
|
|
||||||
//TODO: NPC Interaction?
|
//TODO: NPC Interaction?
|
||||||
if(UserManager.getPlayer(defender) == null)
|
if(UserManager.getPlayer(defender) == null)
|
||||||
return true;
|
return true;
|
||||||
@ -854,16 +834,8 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Spectators should not be affected
|
// Spectators should not be affected
|
||||||
if (defender.getGameMode() == GameMode.SPECTATOR) {
|
return defender.getGameMode() != GameMode.SPECTATOR;
|
||||||
return false;
|
} else if (entity instanceof Tameable tameableEntity) {
|
||||||
}
|
|
||||||
|
|
||||||
// It may seem a bit redundant but we need a check here to prevent bleed from being applied in applyAbilityAoE()
|
|
||||||
return getFakeDamageFinalResult(player, entity, 1.0) != 0;
|
|
||||||
}
|
|
||||||
else if (entity instanceof Tameable) {
|
|
||||||
Tameable tameableEntity = (Tameable) entity;
|
|
||||||
|
|
||||||
if (isFriendlyPet(player, tameableEntity)) {
|
if (isFriendlyPet(player, tameableEntity)) {
|
||||||
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party
|
// isFriendlyPet ensures that the Tameable is: Tamed, owned by a player, and the owner is in the same party
|
||||||
// So we can make some assumptions here, about our casting and our check
|
// So we can make some assumptions here, about our casting and our check
|
||||||
@ -901,8 +873,7 @@ public final class CombatUtils {
|
|||||||
if (pet.isTamed()) {
|
if (pet.isTamed()) {
|
||||||
AnimalTamer tamer = pet.getOwner();
|
AnimalTamer tamer = pet.getOwner();
|
||||||
|
|
||||||
if (tamer instanceof Player) {
|
if (tamer instanceof Player owner) {
|
||||||
Player owner = (Player) tamer;
|
|
||||||
|
|
||||||
return (owner == attacker || PartyManager.inSameParty(attacker, owner) || PartyManager.areAllies(attacker, owner));
|
return (owner == attacker || PartyManager.inSameParty(attacker, owner) || PartyManager.areAllies(attacker, owner));
|
||||||
}
|
}
|
||||||
@ -911,99 +882,13 @@ public final class CombatUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static double getFakeDamageFinalResult(@Nullable Entity attacker, @NotNull Entity target, double damage) {
|
|
||||||
return getFakeDamageFinalResult(attacker, target, DamageCause.ENTITY_ATTACK, new EnumMap<>(ImmutableMap.of(DamageModifier.BASE, damage)));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Deprecated
|
|
||||||
public static double getFakeDamageFinalResult(@Nullable Entity attacker, @NotNull Entity target, @NotNull DamageCause damageCause, double damage) {
|
|
||||||
EntityDamageEvent damageEvent = sendEntityDamageEvent(attacker, target, damageCause, damage);
|
|
||||||
|
|
||||||
if (damageEvent.isCancelled()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return damageEvent.getFinalDamage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean canDamage(@NotNull Entity attacker, @NotNull Entity target, @NotNull DamageCause damageCause, double damage) {
|
public static boolean canDamage(@NotNull Entity attacker, @NotNull Entity target, @NotNull DamageCause damageCause, double damage) {
|
||||||
EntityDamageEvent damageEvent = sendEntityDamageEvent(attacker, target, damageCause, damage);
|
EntityDamageEvent damageEvent = new FakeEntityDamageByEntityEvent(attacker, target, damageCause, damage);
|
||||||
|
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
|
||||||
|
|
||||||
return !damageEvent.isCancelled();
|
return !damageEvent.isCancelled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @NotNull EntityDamageEvent sendEntityDamageEvent(@Nullable Entity attacker, @NotNull Entity target, @NotNull DamageCause damageCause, double damage) {
|
|
||||||
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, damageCause, damage) : new FakeEntityDamageByEntityEvent(attacker, target, damageCause, damage);
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
|
|
||||||
return damageEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getFakeDamageFinalResult(@Nullable Entity attacker, @NotNull Entity target, @NotNull Map<DamageModifier, Double> modifiers) {
|
|
||||||
return getFakeDamageFinalResult(attacker, target, DamageCause.ENTITY_ATTACK, modifiers);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getFakeDamageFinalResult(@Nullable Entity attacker, @NotNull Entity target, double damage, @NotNull Map<DamageModifier, Double> modifiers) {
|
|
||||||
return getFakeDamageFinalResult(attacker, target, DamageCause.ENTITY_ATTACK, getScaledModifiers(damage, modifiers));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static double getFakeDamageFinalResult(@Nullable Entity attacker, @NotNull Entity target, @NotNull DamageCause cause, @NotNull Map<DamageModifier, Double> modifiers) {
|
|
||||||
EntityDamageEvent damageEvent = attacker == null ? new FakeEntityDamageEvent(target, cause, modifiers) : new FakeEntityDamageByEntityEvent(attacker, target, cause, modifiers);
|
|
||||||
mcMMO.p.getServer().getPluginManager().callEvent(damageEvent);
|
|
||||||
|
|
||||||
if (damageEvent.isCancelled()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return damageEvent.getFinalDamage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static @NotNull Map<DamageModifier, Double> getModifiers(@NotNull EntityDamageEvent event) {
|
|
||||||
Map<DamageModifier, Double> modifiers = new HashMap<>();
|
|
||||||
for (DamageModifier modifier : DamageModifier.values()) {
|
|
||||||
modifiers.put(modifier, event.getDamage(modifier));
|
|
||||||
}
|
|
||||||
|
|
||||||
return modifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static @NotNull Map<DamageModifier, Double> getScaledModifiers(double damage, @NotNull Map<DamageModifier, Double> modifiers) {
|
|
||||||
Map<DamageModifier, Double> scaledModifiers = new HashMap<>();
|
|
||||||
|
|
||||||
for (DamageModifier modifier : modifiers.keySet()) {
|
|
||||||
if (modifier == DamageModifier.BASE) {
|
|
||||||
scaledModifiers.put(modifier, damage);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
scaledModifiers.put(modifier, damage * modifiers.get(modifier));
|
|
||||||
}
|
|
||||||
|
|
||||||
return scaledModifiers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static @NotNull EntityDamageByEntityEvent applyScaledModifiers(double initialDamage, double finalDamage, @NotNull EntityDamageByEntityEvent event) {
|
|
||||||
// No additional damage
|
|
||||||
if (initialDamage == finalDamage) {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (DamageModifier modifier : DamageModifier.values()) {
|
|
||||||
if (!event.isApplicable(modifier)) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (modifier == DamageModifier.BASE) {
|
|
||||||
event.setDamage(modifier, finalDamage);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
event.setDamage(modifier, finalDamage / initialDamage * event.getDamage(modifier));
|
|
||||||
}
|
|
||||||
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the upgrade tier of the item in hand.
|
* Get the upgrade tier of the item in hand.
|
||||||
*
|
*
|
||||||
@ -1038,12 +923,10 @@ public final class CombatUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void handleHealthbars(@NotNull Entity attacker, @NotNull LivingEntity target, double damage, @NotNull mcMMO plugin) {
|
public static void handleHealthbars(@NotNull Entity attacker, @NotNull LivingEntity target, double damage, @NotNull mcMMO plugin) {
|
||||||
if (!(attacker instanceof Player)) {
|
if (!(attacker instanceof Player player)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player player = (Player) attacker;
|
|
||||||
|
|
||||||
if (Misc.isNPCEntityExcludingVillagers(player) || Misc.isNPCEntityExcludingVillagers(target)) {
|
if (Misc.isNPCEntityExcludingVillagers(player) || Misc.isNPCEntityExcludingVillagers(target)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1089,6 +972,6 @@ public final class CombatUtils {
|
|||||||
* @param entity the projectile
|
* @param entity the projectile
|
||||||
*/
|
*/
|
||||||
public static void delayArrowMetaCleanup(@NotNull Projectile entity) {
|
public static void delayArrowMetaCleanup(@NotNull Projectile entity) {
|
||||||
Bukkit.getServer().getScheduler().runTaskLater(mcMMO.p, () -> { cleanupArrowMetadata(entity);}, 20*60);
|
Bukkit.getServer().getScheduler().runTaskLater(mcMMO.p, () -> cleanupArrowMetadata(entity), 20*60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ public class RankUtils {
|
|||||||
{
|
{
|
||||||
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
SkillUnlockNotificationTask skillUnlockNotificationTask = new SkillUnlockNotificationTask(mcMMOPlayer, subSkillType, newLevel);
|
||||||
|
|
||||||
skillUnlockNotificationTask.runTaskLater(plugin, (count * 100));
|
skillUnlockNotificationTask.runTaskLater(plugin, (count * 100L));
|
||||||
|
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class SkillTools {
|
|||||||
/*
|
/*
|
||||||
* Setup subskill -> parent relationship map
|
* Setup subskill -> parent relationship map
|
||||||
*/
|
*/
|
||||||
EnumMap<SubSkillType, PrimarySkillType> tempSubParentMap = new EnumMap<SubSkillType, PrimarySkillType>(SubSkillType.class);
|
EnumMap<SubSkillType, PrimarySkillType> tempSubParentMap = new EnumMap<>(SubSkillType.class);
|
||||||
|
|
||||||
//Super hacky and disgusting
|
//Super hacky and disgusting
|
||||||
for(PrimarySkillType primarySkillType1 : PrimarySkillType.values()) {
|
for(PrimarySkillType primarySkillType1 : PrimarySkillType.values()) {
|
||||||
@ -78,7 +78,7 @@ public class SkillTools {
|
|||||||
* Setup primary -> (collection) subskill map
|
* Setup primary -> (collection) subskill map
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EnumMap<PrimarySkillType, Set<SubSkillType>> tempPrimaryChildMap = new EnumMap<PrimarySkillType, Set<SubSkillType>>(PrimarySkillType.class);
|
EnumMap<PrimarySkillType, Set<SubSkillType>> tempPrimaryChildMap = new EnumMap<>(PrimarySkillType.class);
|
||||||
|
|
||||||
//Init the empty Hash Sets
|
//Init the empty Hash Sets
|
||||||
for(PrimarySkillType primarySkillType1 : PrimarySkillType.values()) {
|
for(PrimarySkillType primarySkillType1 : PrimarySkillType.values()) {
|
||||||
@ -98,7 +98,7 @@ public class SkillTools {
|
|||||||
/*
|
/*
|
||||||
* Setup primary -> tooltype map
|
* Setup primary -> tooltype map
|
||||||
*/
|
*/
|
||||||
EnumMap<PrimarySkillType, ToolType> tempToolMap = new EnumMap<PrimarySkillType, ToolType>(PrimarySkillType.class);
|
EnumMap<PrimarySkillType, ToolType> tempToolMap = new EnumMap<>(PrimarySkillType.class);
|
||||||
|
|
||||||
tempToolMap.put(PrimarySkillType.AXES, ToolType.AXE);
|
tempToolMap.put(PrimarySkillType.AXES, ToolType.AXE);
|
||||||
tempToolMap.put(PrimarySkillType.WOODCUTTING, ToolType.AXE);
|
tempToolMap.put(PrimarySkillType.WOODCUTTING, ToolType.AXE);
|
||||||
@ -115,8 +115,8 @@ public class SkillTools {
|
|||||||
* Setup primary -> ability map
|
* Setup primary -> ability map
|
||||||
*/
|
*/
|
||||||
|
|
||||||
EnumMap<SuperAbilityType, PrimarySkillType> tempAbilityParentRelationshipMap = new EnumMap<SuperAbilityType, PrimarySkillType>(SuperAbilityType.class);
|
EnumMap<SuperAbilityType, PrimarySkillType> tempAbilityParentRelationshipMap = new EnumMap<>(SuperAbilityType.class);
|
||||||
EnumMap<PrimarySkillType, SuperAbilityType> tempMainActivatedAbilityChildMap = new EnumMap<PrimarySkillType, SuperAbilityType>(PrimarySkillType.class);
|
EnumMap<PrimarySkillType, SuperAbilityType> tempMainActivatedAbilityChildMap = new EnumMap<>(PrimarySkillType.class);
|
||||||
|
|
||||||
for(SuperAbilityType superAbilityType : SuperAbilityType.values()) {
|
for(SuperAbilityType superAbilityType : SuperAbilityType.values()) {
|
||||||
try {
|
try {
|
||||||
|
@ -109,8 +109,7 @@ public class StringUtils {
|
|||||||
case CARROTS:
|
case CARROTS:
|
||||||
case POTATOES:
|
case POTATOES:
|
||||||
case NETHER_WART: {
|
case NETHER_WART: {
|
||||||
if (data instanceof Ageable) {
|
if (data instanceof Ageable ageData) {
|
||||||
Ageable ageData = (Ageable) data;
|
|
||||||
if (ageData.getAge() == ageData.getMaximumAge()) {
|
if (ageData.getAge() == ageData.getMaximumAge()) {
|
||||||
return getPrettyItemString(data.getMaterial()).replace(" ", "_") + "_Ripe";
|
return getPrettyItemString(data.getMaterial()).replace(" ", "_") + "_Ripe";
|
||||||
}
|
}
|
||||||
|
@ -91,8 +91,8 @@ class MinecraftGameVersionTest {
|
|||||||
|
|
||||||
try (MockedStatic<Bukkit> bukkit = Mockito.mockStatic(Bukkit.class)) {
|
try (MockedStatic<Bukkit> bukkit = Mockito.mockStatic(Bukkit.class)) {
|
||||||
// Inject our own Bukkit versions
|
// Inject our own Bukkit versions
|
||||||
bukkit.when(() -> Bukkit.getVersion()).thenReturn(serverSoftwareVersion);
|
bukkit.when(Bukkit::getVersion).thenReturn(serverSoftwareVersion);
|
||||||
bukkit.when(() -> Bukkit.getBukkitVersion()).thenReturn(gameVersion);
|
bukkit.when(Bukkit::getBukkitVersion).thenReturn(gameVersion);
|
||||||
|
|
||||||
PlatformManager manager = new PlatformManager();
|
PlatformManager manager = new PlatformManager();
|
||||||
Platform platform = manager.getPlatform();
|
Platform platform = manager.getPlatform();
|
||||||
|
Loading…
Reference in New Issue
Block a user