mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Patch potential exploit relating to teleportation and acrobatics.
This commit is contained in:
parent
e0e574c19e
commit
8939fc09b3
@ -84,6 +84,7 @@ public class McMMOPlayer {
|
|||||||
|
|
||||||
private int recentlyHurt;
|
private int recentlyHurt;
|
||||||
private int respawnATS;
|
private int respawnATS;
|
||||||
|
private int teleportATS;
|
||||||
private int chimeraWingLastUse;
|
private int chimeraWingLastUse;
|
||||||
private Location teleportCommence;
|
private Location teleportCommence;
|
||||||
|
|
||||||
@ -343,6 +344,14 @@ public class McMMOPlayer {
|
|||||||
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getTeleportATS() {
|
||||||
|
return teleportATS;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void actualizeTeleportATS() {
|
||||||
|
teleportATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Repair Anvil Placement
|
* Repair Anvil Placement
|
||||||
*/
|
*/
|
||||||
|
@ -50,6 +50,7 @@ import com.gmail.nossr50.util.Misc;
|
|||||||
import com.gmail.nossr50.util.Permissions;
|
import com.gmail.nossr50.util.Permissions;
|
||||||
import com.gmail.nossr50.util.player.UserManager;
|
import com.gmail.nossr50.util.player.UserManager;
|
||||||
import com.gmail.nossr50.util.skills.CombatUtils;
|
import com.gmail.nossr50.util.skills.CombatUtils;
|
||||||
|
import com.gmail.nossr50.util.skills.SkillUtils;
|
||||||
|
|
||||||
public class EntityListener implements Listener {
|
public class EntityListener implements Listener {
|
||||||
private final mcMMO plugin;
|
private final mcMMO plugin;
|
||||||
@ -221,6 +222,10 @@ public class EntityListener implements Listener {
|
|||||||
|
|
||||||
switch (cause) {
|
switch (cause) {
|
||||||
case FALL:
|
case FALL:
|
||||||
|
if (SkillUtils.calculateTimeLeft((long) mcMMOPlayer.getTeleportATS() * Misc.TIME_CONVERSION_FACTOR, 5, player) > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
AcrobaticsManager acrobaticsManager = mcMMOPlayer.getAcrobaticsManager();
|
||||||
|
|
||||||
if (acrobaticsManager.canRoll()) {
|
if (acrobaticsManager.canRoll()) {
|
||||||
|
@ -24,6 +24,7 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
|||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
@ -66,6 +67,12 @@ public class PlayerListener implements Listener {
|
|||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
|
public void onPlayerTeleport(PlayerTeleportEvent event) {
|
||||||
|
UserManager.getPlayer(event.getPlayer()).actualizeTeleportATS();
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
|
||||||
public void onPlayerDeathLowest(PlayerDeathEvent event) {
|
public void onPlayerDeathLowest(PlayerDeathEvent event) {
|
||||||
String deathMessage = event.getDeathMessage();
|
String deathMessage = event.getDeathMessage();
|
||||||
|
Loading…
Reference in New Issue
Block a user