mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Move Fall data to AcrobaticsManager
This commit is contained in:
parent
8b0a580505
commit
00cc5f0845
@ -9,6 +9,7 @@ Key:
|
|||||||
|
|
||||||
Version 2.1.40
|
Version 2.1.40
|
||||||
(API) mcMMO will now return null in all cases for UserManager.getPlayerProfile() if they have not been loaded yet
|
(API) mcMMO will now return null in all cases for UserManager.getPlayerProfile() if they have not been loaded yet
|
||||||
|
(API) Roll stores exploit data in AcrobaticsManager now
|
||||||
Added new locale string "Profile.Loading.FailureNotice"
|
Added new locale string "Profile.Loading.FailureNotice"
|
||||||
Added new locale string "Profile.Loading.FailurePlayer"
|
Added new locale string "Profile.Loading.FailurePlayer"
|
||||||
mcMMO no longer gives up forever if a player profile fails to load and the player is still online
|
mcMMO no longer gives up forever if a player profile fails to load and the player is still online
|
||||||
|
@ -2,7 +2,6 @@ package com.gmail.nossr50.chat;
|
|||||||
|
|
||||||
import com.gmail.nossr50.datatypes.party.Party;
|
import com.gmail.nossr50.datatypes.party.Party;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
import com.gmail.nossr50.datatypes.player.PlayerProfile;
|
|
||||||
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
import com.gmail.nossr50.events.chat.McMMOChatEvent;
|
||||||
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
import com.gmail.nossr50.events.chat.McMMOPartyChatEvent;
|
||||||
import com.gmail.nossr50.locale.LocaleLoader;
|
import com.gmail.nossr50.locale.LocaleLoader;
|
||||||
|
@ -13,7 +13,6 @@ import com.gmail.nossr50.runnables.player.PlayerProfileSaveTask;
|
|||||||
import com.gmail.nossr50.skills.child.FamilyTree;
|
import com.gmail.nossr50.skills.child.FamilyTree;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package com.gmail.nossr50.datatypes.skills.subskills.acrobatics;
|
package com.gmail.nossr50.datatypes.skills.subskills.acrobatics;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
import com.gmail.nossr50.datatypes.LimitedSizeList;
|
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -34,14 +32,11 @@ import org.bukkit.event.EventPriority;
|
|||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
|
|
||||||
public class Roll extends AcrobaticsSubSkill {
|
public class Roll extends AcrobaticsSubSkill {
|
||||||
protected HashMap<Player, LimitedSizeList> fallLocationMap;
|
|
||||||
|
|
||||||
public Roll() {
|
public Roll() {
|
||||||
super("Roll", EventPriority.HIGHEST, SubSkillType.ACROBATICS_ROLL);
|
super("Roll", EventPriority.HIGHEST, SubSkillType.ACROBATICS_ROLL);
|
||||||
fallLocationMap = new HashMap<>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -280,25 +275,11 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(fallLocationMap.get(player) == null)
|
|
||||||
fallLocationMap.put(player, new LimitedSizeList(50));
|
|
||||||
|
|
||||||
LimitedSizeList fallLocations = fallLocationMap.get(player);
|
if(UserManager.getPlayer(player).getAcrobaticsManager().hasFallenInLocationBefore(getBlockLocation(player)))
|
||||||
|
|
||||||
if(fallLocations.contains(getBlockLocation(player)))
|
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false; //NOT EXPLOITING
|
return false; //NOT EXPLOITING
|
||||||
/*
|
|
||||||
Location fallLocation = player.getLocation();
|
|
||||||
int maxTries = Config.getInstance().getAcrobaticsAFKMaxTries();
|
|
||||||
|
|
||||||
boolean sameLocation = (lastFallLocation != null && Misc.isNear(lastFallLocation, fallLocation, 2));
|
|
||||||
|
|
||||||
fallTries = sameLocation ? Math.min(fallTries + 1, maxTries) : Math.max(fallTries - 1, 0);
|
|
||||||
lastFallLocation = fallLocation;
|
|
||||||
|
|
||||||
return fallTries + 1 > maxTries;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private float calculateRollXP(Player player, double damage, boolean isRoll) {
|
private float calculateRollXP(Player player, double damage, boolean isRoll) {
|
||||||
@ -426,13 +407,7 @@ public class Roll extends AcrobaticsSubSkill {
|
|||||||
|
|
||||||
public void addFallLocation(Player player)
|
public void addFallLocation(Player player)
|
||||||
{
|
{
|
||||||
if(fallLocationMap.get(player) == null)
|
UserManager.getPlayer(player).getAcrobaticsManager().addLocationToFallMap(getBlockLocation(player));
|
||||||
fallLocationMap.put(player, new LimitedSizeList(50));
|
|
||||||
|
|
||||||
LimitedSizeList fallLocations = fallLocationMap.get(player);
|
|
||||||
|
|
||||||
Location loc = getBlockLocation(player);
|
|
||||||
fallLocations.add(loc);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Location getBlockLocation(Player player)
|
public Location getBlockLocation(Player player)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.gmail.nossr50.skills.acrobatics;
|
package com.gmail.nossr50.skills.acrobatics;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
import com.gmail.nossr50.config.experience.ExperienceConfig;
|
||||||
|
import com.gmail.nossr50.datatypes.LimitedSizeList;
|
||||||
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
import com.gmail.nossr50.datatypes.experience.XPGainReason;
|
||||||
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
import com.gmail.nossr50.datatypes.interactions.NotificationType;
|
||||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||||
@ -15,6 +16,7 @@ import com.gmail.nossr50.util.skills.ParticleEffectUtils;
|
|||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import com.gmail.nossr50.util.skills.SkillActivationType;
|
import com.gmail.nossr50.util.skills.SkillActivationType;
|
||||||
import com.gmail.nossr50.util.skills.SkillUtils;
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LightningStrike;
|
import org.bukkit.entity.LightningStrike;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -23,11 +25,23 @@ public class AcrobaticsManager extends SkillManager {
|
|||||||
|
|
||||||
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
|
public AcrobaticsManager(McMMOPlayer mcMMOPlayer) {
|
||||||
super(mcMMOPlayer, PrimarySkillType.ACROBATICS);
|
super(mcMMOPlayer, PrimarySkillType.ACROBATICS);
|
||||||
|
fallLocationMap = new LimitedSizeList(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
private long rollXPCooldown = 0;
|
private long rollXPCooldown = 0;
|
||||||
private long rollXPInterval = (1000 * 10); //1 Minute
|
private long rollXPInterval = (1000 * 10); //1 Minute
|
||||||
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
|
private long rollXPIntervalLengthen = (1000 * 10); //10 Seconds
|
||||||
|
private LimitedSizeList fallLocationMap;
|
||||||
|
|
||||||
|
public boolean hasFallenInLocationBefore(Location location)
|
||||||
|
{
|
||||||
|
return fallLocationMap.contains(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addLocationToFallMap(Location location)
|
||||||
|
{
|
||||||
|
fallLocationMap.add(location);
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canGainRollXP()
|
public boolean canGainRollXP()
|
||||||
{
|
{
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
package com.gmail.nossr50.skills.mining;
|
package com.gmail.nossr50.skills.mining;
|
||||||
|
|
||||||
import com.gmail.nossr50.config.AdvancedConfig;
|
import com.gmail.nossr50.config.AdvancedConfig;
|
||||||
import com.gmail.nossr50.config.Config;
|
|
||||||
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
import com.gmail.nossr50.datatypes.skills.SubSkillType;
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.RankUtils;
|
import com.gmail.nossr50.util.skills.RankUtils;
|
||||||
import org.bukkit.Material;
|
|
||||||
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;
|
||||||
|
Loading…
Reference in New Issue
Block a user