mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
2.1.210
This commit is contained in:
parent
fa33fa3d32
commit
0bf3f98d95
@ -1,7 +1,9 @@
|
||||
Version 2.1.210
|
||||
Fixed a memory leak involving mob metadata
|
||||
Fixed a potential null pointer exception in InventoryListener
|
||||
|
||||
NOTES:
|
||||
If you're having issues with "immortal players" this is a known plugin incompatibility between mcMMO and another plugin, I need more info on what plugins need to be present to cause it. Please post info to GitHub issues or tag me on discord.
|
||||
There was a big rewrite in this update relating to how various types of metadata were being tracked/stored/retrieved
|
||||
If you run into issues with this version of mcMMO, please post about it on GitHub
|
||||
|
||||
|
2
pom.xml
2
pom.xml
@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.gmail.nossr50.mcMMO</groupId>
|
||||
<artifactId>mcMMO</artifactId>
|
||||
<version>2.1.210-SNAPSHOT</version>
|
||||
<version>2.1.210</version>
|
||||
<name>mcMMO</name>
|
||||
<url>https://github.com/mcMMO-Dev/mcMMO</url>
|
||||
<scm>
|
||||
|
@ -35,7 +35,7 @@ public final class ExperienceAPI {
|
||||
* @param skillType A string that may or may not be a skill
|
||||
* @return true if this is a valid mcMMO skill
|
||||
*/
|
||||
public static boolean isValidSkillType(String skillType) {
|
||||
public static boolean isValidSkillType(@NotNull String skillType) {
|
||||
return mcMMO.p.getSkillTools().matchSkill(skillType) != null;
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,8 @@ import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
@ -24,7 +26,7 @@ public final class UserManager {
|
||||
*
|
||||
* @param mcMMOPlayer the player profile to start tracking
|
||||
*/
|
||||
public static void track(McMMOPlayer mcMMOPlayer) {
|
||||
public static void track(@NotNull McMMOPlayer mcMMOPlayer) {
|
||||
mcMMOPlayer.getPlayer().setMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA, new FixedMetadataValue(mcMMO.p, mcMMOPlayer));
|
||||
|
||||
if(playerDataSet == null)
|
||||
@ -43,8 +45,12 @@ public final class UserManager {
|
||||
*
|
||||
* @param player The Player object
|
||||
*/
|
||||
public static void remove(Player player) {
|
||||
public static void remove(@NotNull Player player) {
|
||||
McMMOPlayer mcMMOPlayer = getPlayer(player);
|
||||
|
||||
if(mcMMOPlayer == null)
|
||||
return;
|
||||
|
||||
mcMMOPlayer.cleanup();
|
||||
player.removeMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA, mcMMO.p);
|
||||
|
||||
@ -91,7 +97,7 @@ public final class UserManager {
|
||||
mcMMO.p.getLogger().info("Finished save operation for "+trackedSyncData.size()+" players!");
|
||||
}
|
||||
|
||||
public static Collection<McMMOPlayer> getPlayers() {
|
||||
public static @NotNull Collection<McMMOPlayer> getPlayers() {
|
||||
Collection<McMMOPlayer> playerCollection = new ArrayList<>();
|
||||
|
||||
for (Player player : mcMMO.p.getServer().getOnlinePlayers()) {
|
||||
@ -109,11 +115,11 @@ public final class UserManager {
|
||||
* @param playerName The name of the player whose McMMOPlayer to retrieve
|
||||
* @return the player's McMMOPlayer object
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(String playerName) {
|
||||
public static @Nullable McMMOPlayer getPlayer(String playerName) {
|
||||
return retrieveMcMMOPlayer(playerName, false);
|
||||
}
|
||||
|
||||
public static McMMOPlayer getOfflinePlayer(OfflinePlayer player) {
|
||||
public static @Nullable McMMOPlayer getOfflinePlayer(OfflinePlayer player) {
|
||||
if (player instanceof Player) {
|
||||
return getPlayer((Player) player);
|
||||
}
|
||||
@ -121,7 +127,7 @@ public final class UserManager {
|
||||
return retrieveMcMMOPlayer(player.getName(), true);
|
||||
}
|
||||
|
||||
public static McMMOPlayer getOfflinePlayer(String playerName) {
|
||||
public static @Nullable McMMOPlayer getOfflinePlayer(String playerName) {
|
||||
return retrieveMcMMOPlayer(playerName, true);
|
||||
}
|
||||
|
||||
@ -130,7 +136,7 @@ public final class UserManager {
|
||||
* @param player target player
|
||||
* @return McMMOPlayer object for this player, null if Player has not been loaded
|
||||
*/
|
||||
public static McMMOPlayer getPlayer(Player player) {
|
||||
public static @Nullable McMMOPlayer getPlayer(@Nullable Player player) {
|
||||
//Avoid Array Index out of bounds
|
||||
if(player != null && player.hasMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA))
|
||||
return (McMMOPlayer) player.getMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA).get(0).value();
|
||||
@ -138,7 +144,10 @@ public final class UserManager {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static McMMOPlayer retrieveMcMMOPlayer(String playerName, boolean offlineValid) {
|
||||
private static @Nullable McMMOPlayer retrieveMcMMOPlayer(@Nullable String playerName, boolean offlineValid) {
|
||||
if(playerName == null)
|
||||
return null;
|
||||
|
||||
Player player = mcMMO.p.getServer().getPlayerExact(playerName);
|
||||
|
||||
if (player == null) {
|
||||
@ -152,7 +161,7 @@ public final class UserManager {
|
||||
return getPlayer(player);
|
||||
}
|
||||
|
||||
public static boolean hasPlayerDataKey(Entity entity) {
|
||||
public static boolean hasPlayerDataKey(@Nullable Entity entity) {
|
||||
return entity != null && entity.hasMetadata(MetadataConstants.METADATA_KEY_PLAYER_DATA);
|
||||
}
|
||||
}
|
||||
|
@ -320,14 +320,13 @@ public final class CombatUtils {
|
||||
Entity painSource = event.getDamager();
|
||||
EntityType entityType = painSource.getType();
|
||||
|
||||
if (target instanceof Player) {
|
||||
if (target instanceof Player player) {
|
||||
if(ExperienceConfig.getInstance().isNPCInteractionPrevented()) {
|
||||
if (Misc.isNPCEntityExcludingVillagers(target)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Player player = (Player) target;
|
||||
if (!UserManager.hasPlayerDataKey(player)) {
|
||||
return;
|
||||
}
|
||||
@ -738,7 +737,7 @@ public final class CombatUtils {
|
||||
* @param target The defending entity
|
||||
* @param primarySkillType The skill being used
|
||||
*/
|
||||
public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType) {
|
||||
public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer, @NotNull LivingEntity target, @NotNull PrimarySkillType primarySkillType) {
|
||||
processCombatXP(mcMMOPlayer, target, primarySkillType, 1.0);
|
||||
}
|
||||
|
||||
@ -750,7 +749,7 @@ public final class CombatUtils {
|
||||
* @param primarySkillType The skill being used
|
||||
* @param multiplier final XP result will be multiplied by this
|
||||
*/
|
||||
public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer, LivingEntity target, PrimarySkillType primarySkillType, double multiplier) {
|
||||
public static void processCombatXP(@NotNull McMMOPlayer mcMMOPlayer, @NotNull LivingEntity target, @NotNull PrimarySkillType primarySkillType, double multiplier) {
|
||||
double baseXP = 0;
|
||||
XPGainReason xpGainReason;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user