mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-01-31 14:49:35 +01:00
Re-added respawnATS
This commit is contained in:
parent
0034226fa7
commit
c382c95d24
@ -48,12 +48,13 @@ public class PlayerProfile {
|
||||
private boolean abilityuse = true;
|
||||
|
||||
/* Timestamps */
|
||||
private int xpGainATS = 0;
|
||||
private int recentlyHurt = 0;
|
||||
private int xpGainATS;
|
||||
private int recentlyHurt;
|
||||
private int respawnATS;
|
||||
|
||||
/* mySQL STUFF */
|
||||
private int lastlogin = 0;
|
||||
private int userid = 0;
|
||||
private int lastlogin;
|
||||
private int userid;
|
||||
|
||||
HashMap<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); //Skills and Levels
|
||||
HashMap<SkillType, Integer> skillsXp = new HashMap<SkillType, Integer>(); //Skills and XP
|
||||
@ -68,6 +69,7 @@ public class PlayerProfile {
|
||||
hud = SpoutConfig.getInstance().defaulthud;
|
||||
this.player = player;
|
||||
this.playerName = player.getName();
|
||||
lastlogin = ((Long) (System.currentTimeMillis() / 1000)).intValue();
|
||||
|
||||
party = PartyManager.getInstance().getPlayerParty(playerName);
|
||||
|
||||
@ -92,8 +94,6 @@ public class PlayerProfile {
|
||||
addPlayer();
|
||||
loaded = true;
|
||||
}
|
||||
|
||||
lastlogin = ((Long) (System.currentTimeMillis() / 1000)).intValue();
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
@ -913,6 +913,18 @@ public class PlayerProfile {
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Exploit Prevention
|
||||
*/
|
||||
|
||||
public int getRespawnATS() {
|
||||
return respawnATS;
|
||||
}
|
||||
|
||||
public void ActualizeRespawnATS() {
|
||||
respawnATS = (int) (System.currentTimeMillis() / 1000);
|
||||
}
|
||||
|
||||
/*
|
||||
* XP Functions
|
||||
*/
|
||||
|
@ -19,6 +19,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
@ -123,7 +124,7 @@ public class PlayerListener implements Listener {
|
||||
*/
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerLogin(PlayerLoginEvent event) {
|
||||
Users.addUser(event.getPlayer());
|
||||
Users.addUser(event.getPlayer()).ActualizeRespawnATS();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -192,8 +193,11 @@ public class PlayerListener implements Listener {
|
||||
if (XprateCommand.xpevent) {
|
||||
player.sendMessage(LocaleLoader.getString("XPRate.Event", new Object[] {Config.getInstance().xpGainMultiplier}));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
Users.getProfile(event.getPlayer()).ActualizeRespawnATS();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,7 +58,10 @@ public class AcrobaticsManager {
|
||||
if (Acrobatics.getRandom().nextInt(4000) <= eventHandler.skillModifier && !eventHandler.isFatal(eventHandler.modifiedDamage)) {
|
||||
eventHandler.modifyEventDamage();
|
||||
eventHandler.sendAbilityMessage();
|
||||
eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER);
|
||||
|
||||
if (System.currentTimeMillis() >= profile.getRespawnATS() + 5) {
|
||||
eventHandler.processXPGain(eventHandler.damage * Acrobatics.DODGE_XP_MODIFIER);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -462,7 +462,7 @@ public class Combat {
|
||||
|
||||
Player defender = (Player) target;
|
||||
|
||||
if (defender.getHealth() >= 1) {
|
||||
if (System.currentTimeMillis() >= Users.getProfile(defender).getRespawnATS() + 5) {
|
||||
baseXP = 20 * configInstance.getPlayerVersusPlayerXP();
|
||||
}
|
||||
}
|
||||
|
@ -40,8 +40,9 @@ public class Users {
|
||||
* Add a new user.
|
||||
*
|
||||
* @param player The player to create a user record for
|
||||
* @return the player's profile
|
||||
*/
|
||||
public static void addUser(Player player) {
|
||||
public static PlayerProfile addUser(Player player) {
|
||||
String playerName = player.getName();
|
||||
|
||||
for (Iterator<PlayerProfile> it = profiles.iterator() ; it.hasNext() ; ) {
|
||||
@ -50,12 +51,15 @@ public class Users {
|
||||
if (playerProfile.getPlayerName().equals(playerName)) {
|
||||
//The player object is different on each reconnection and must be updated
|
||||
playerProfile.setPlayer(player);
|
||||
return;
|
||||
return playerProfile;
|
||||
}
|
||||
}
|
||||
|
||||
//New player, or already removed from the list
|
||||
profiles.add(new PlayerProfile(player, true));
|
||||
PlayerProfile playerProfile = new PlayerProfile(player, true);
|
||||
|
||||
profiles.add(playerProfile);
|
||||
return playerProfile;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user