mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-10-11 19:14:26 +00:00
cooldown ignore fix + essentials try/catch
This commit is contained in:
+4
-4
@@ -54,10 +54,10 @@ public class PortalsEvents implements Listener {
|
|||||||
|
|
||||||
if (ploc.getBlockX() <= Math.max(loc1.getBlockX(), loc2.getBlockX())
|
if (ploc.getBlockX() <= Math.max(loc1.getBlockX(), loc2.getBlockX())
|
||||||
&& ploc.getBlockX() >= Math.min(loc1.getBlockX(), loc2.getBlockX()))
|
&& ploc.getBlockX() >= Math.min(loc1.getBlockX(), loc2.getBlockX()))
|
||||||
if (ploc.getBlockZ() <= Math.max(loc1.getBlockZ(), loc2.getBlockZ())
|
if (ploc.getBlockZ() <= Math.max(loc1.getBlockZ(), loc2.getBlockZ())
|
||||||
&& ploc.getBlockZ() >= Math.min(loc1.getBlockZ(), loc2.getBlockZ()))
|
&& ploc.getBlockZ() >= Math.min(loc1.getBlockZ(), loc2.getBlockZ()))
|
||||||
if (ploc.getBlockY() <= Math.max(loc1.getBlockY(), loc2.getBlockY())
|
if (ploc.getBlockY() <= Math.max(loc1.getBlockY(), loc2.getBlockY())
|
||||||
&& ploc.getBlockY() >= Math.min(loc1.getBlockY(), loc2.getBlockY())) {
|
&& ploc.getBlockY() >= Math.min(loc1.getBlockY(), loc2.getBlockY())) {
|
||||||
playerPortaling.put(e.getPlayer(), portal);
|
playerPortaling.put(e.getPlayer(), portal);
|
||||||
World world = portal.getWorld() != null ? Bukkit.getWorld(portal.getWorld()) : null;
|
World world = portal.getWorld() != null ? Bukkit.getWorld(portal.getWorld()) : null;
|
||||||
HelperRTP.tp(e.getPlayer(), e.getPlayer(), world, null, RTP_TYPE.ADDON_PORTAL, ignoreCooldown, ignoreDelay);
|
HelperRTP.tp(e.getPlayer(), e.getPlayer(), world, null, RTP_TYPE.ADDON_PORTAL, ignoreCooldown, ignoreDelay);
|
||||||
|
|||||||
@@ -297,7 +297,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.essentialsx</groupId>
|
<groupId>net.essentialsx</groupId>
|
||||||
<artifactId>EssentialsX</artifactId>
|
<artifactId>EssentialsX</artifactId>
|
||||||
<version>2.19.7</version>
|
<version>2.20.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
|
|||||||
@@ -2,14 +2,18 @@ package me.SuperRonanCraft.BetterRTP.player.rtp;
|
|||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import me.RonanCraft.Pueblos.resources.tools.HelperEvent;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_FailedEvent;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_FindLocationEvent;
|
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_FindLocationEvent;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.customEvents.RTP_SettingUpEvent;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.helpers.HelperRTP_Check;
|
import me.SuperRonanCraft.BetterRTP.references.helpers.HelperRTP_Check;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueData;
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueData;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueHandler;
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.QueueHandler;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.RandomLocation;
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.RandomLocation;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.worlds.WorldPlayer;
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.worlds.WorldPlayer;
|
||||||
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.versions.FoliaHandler;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -111,6 +115,8 @@ public class RTPPlayer {
|
|||||||
settings.teleport.failedTeleport(p, sendi);
|
settings.teleport.failedTeleport(p, sendi);
|
||||||
getPl().getCooldowns().removeCooldown(p, worldPlayer.getWorld());
|
getPl().getCooldowns().removeCooldown(p, worldPlayer.getWorld());
|
||||||
getPl().getPInfo().getRtping().remove(p);
|
getPl().getPInfo().getRtping().remove(p);
|
||||||
|
//RTP Failed Event
|
||||||
|
Bukkit.getServer().getPluginManager().callEvent(new RTP_FailedEvent(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -17,7 +17,11 @@ public class RTP_PlayerInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RTP_PlayerInfo(boolean applyDelay, boolean applyCooldown) {
|
public RTP_PlayerInfo(boolean applyDelay, boolean applyCooldown) {
|
||||||
this(applyDelay, applyCooldown, true, true, true);
|
this(applyDelay, applyCooldown, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public RTP_PlayerInfo(boolean applyDelay, boolean applyCooldown, boolean checkCooldown) {
|
||||||
|
this(applyDelay, applyCooldown, checkCooldown, true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public RTP_PlayerInfo(boolean applyDelay,
|
public RTP_PlayerInfo(boolean applyDelay,
|
||||||
|
|||||||
+23
@@ -0,0 +1,23 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.references.customEvents;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPPlayer;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.references.rtpinfo.worlds.RTPWorld;
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.Cancellable;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
//Called when an rtp is finding a valid location
|
||||||
|
@Getter public class RTP_FailedEvent extends RTPEvent {
|
||||||
|
|
||||||
|
Player p;
|
||||||
|
RTPWorld world;
|
||||||
|
int attempts;
|
||||||
|
|
||||||
|
public RTP_FailedEvent(RTPPlayer rtpPlayer) {
|
||||||
|
this.p = rtpPlayer.getPlayer();
|
||||||
|
this.world = rtpPlayer.getWorldPlayer();
|
||||||
|
this.attempts = rtpPlayer.getAttempts();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,11 +9,17 @@ import org.bukkit.entity.Player;
|
|||||||
public class DepEssentials {
|
public class DepEssentials {
|
||||||
|
|
||||||
public static void setBackLocation(Player player, Location location) {
|
public static void setBackLocation(Player player, Location location) {
|
||||||
Essentials ess = (Essentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials");
|
try {
|
||||||
if (ess == null) return;
|
Essentials ess = (Essentials) Bukkit.getServer().getPluginManager().getPlugin("Essentials");
|
||||||
User user = ess.getUser(player.getUniqueId());
|
if (ess == null)
|
||||||
if (user == null) return;
|
return;
|
||||||
user.setLastLocation(location);
|
User user = ess.getUser(player.getUniqueId());
|
||||||
|
if (user == null)
|
||||||
|
return;
|
||||||
|
user.setLastLocation(location);
|
||||||
|
} catch (ClassCastException e) {
|
||||||
|
//Something wrong happened, idk why this would break...
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ public class HelperRTP {
|
|||||||
boolean ignoreCooldown,
|
boolean ignoreCooldown,
|
||||||
boolean ignoreDelay,
|
boolean ignoreDelay,
|
||||||
@Nullable WorldLocation location) {
|
@Nullable WorldLocation location) {
|
||||||
tp(player, sendi, world, biomes, rtpType, location, new RTP_PlayerInfo(!ignoreDelay, !ignoreCooldown));
|
tp(player, sendi, world, biomes, rtpType, location, new RTP_PlayerInfo(!ignoreDelay, true, !ignoreCooldown));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void tp(@NotNull Player player,
|
public static void tp(@NotNull Player player,
|
||||||
|
|||||||
Reference in New Issue
Block a user