mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-10-26 05:50:41 +00:00
rtp player info
This commit is contained in:
1 parent
f7e6665c42
commit
919e458477
7 files changed
+87
-20
No files matched your search
@@ -109,7 +109,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP</artifactId>
|
<artifactId>BetterRTP</artifactId>
|
||||||
<version>3.6.8-3</version>
|
<version>LATEST</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- ProtocolLib -->
|
<!-- ProtocolLib -->
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
|||||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandType;
|
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandType;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
import me.SuperRonanCraft.BetterRTP.player.commands.Commands;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
|
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommandHelpable;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_PlayerInfo;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
import me.SuperRonanCraft.BetterRTP.player.commands.RTPCommand;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
||||||
@@ -32,7 +33,15 @@ public class CmdPlayer implements RTPCommand, RTPCommandHelpable {
|
|||||||
public void execute(CommandSender sendi, String label, String[] args) {
|
public void execute(CommandSender sendi, String label, String[] args) {
|
||||||
if (args.length == 2)
|
if (args.length == 2)
|
||||||
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline())
|
if (Bukkit.getPlayer(args[1]) != null && Bukkit.getPlayer(args[1]).isOnline())
|
||||||
HelperRTP.tp(Bukkit.getPlayer(args[1]), sendi, Bukkit.getPlayer(args[1]).getWorld(), null, RTP_TYPE.FORCED);
|
HelperRTP.tp(Bukkit.getPlayer(args[1]),
|
||||||
|
sendi,
|
||||||
|
Bukkit.getPlayer(args[1]).getWorld(),
|
||||||
|
null,
|
||||||
|
RTP_TYPE.FORCED,
|
||||||
|
false,
|
||||||
|
false,
|
||||||
|
null,
|
||||||
|
new RTP_PlayerInfo(false, false));
|
||||||
else if (Bukkit.getPlayer(args[1]) != null)
|
else if (Bukkit.getPlayer(args[1]) != null)
|
||||||
MessagesCore.NOTONLINE.send(sendi, args[1]);
|
MessagesCore.NOTONLINE.send(sendi, args[1]);
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -97,13 +97,13 @@ public class RTP {
|
|||||||
//Cooldown
|
//Cooldown
|
||||||
Player p = pWorld.getPlayer();
|
Player p = pWorld.getPlayer();
|
||||||
//p.sendMessage("Cooling down: " + cooldown);
|
//p.sendMessage("Cooling down: " + cooldown);
|
||||||
if (pWorld.isApplyCooldown())
|
if (pWorld.getPlayerInfo().isApplyCooldown())
|
||||||
getPl().getCooldowns().add(p, pWorld.getWorld());
|
getPl().getCooldowns().add(p, pWorld.getWorld());
|
||||||
getPl().getpInfo().getRtping().put(p, true); //Cache player so they cant run '/rtp' again while rtp'ing
|
getPl().getpInfo().getRtping().put(p, true); //Cache player so they cant run '/rtp' again while rtp'ing
|
||||||
//Setup player rtp methods
|
//Setup player rtp methods
|
||||||
RTPPlayer rtpPlayer = new RTPPlayer(p, this, pWorld, type);
|
RTPPlayer rtpPlayer = new RTPPlayer(p, this, pWorld, type);
|
||||||
// Delaying? Else, just go
|
// Delaying? Else, just go
|
||||||
if (getPl().getSettings().isDelayEnabled() && pWorld.isApplyDelay()) {
|
if (getPl().getSettings().isDelayEnabled() && pWorld.getPlayerInfo().isApplyDelay()) {
|
||||||
new RTPDelay(sendi, rtpPlayer, delayTime, cancelOnMove, cancelOnDamage);
|
new RTPDelay(sendi, rtpPlayer, delayTime, cancelOnMove, cancelOnDamage);
|
||||||
} else {
|
} else {
|
||||||
if (!teleport.beforeTeleportInstant(sendi, p))
|
if (!teleport.beforeTeleportInstant(sendi, p))
|
||||||
|
|||||||
@@ -17,11 +17,10 @@ public class RTPSetupInformation {
|
|||||||
@Getter @NonNull private final CommandSender sender;
|
@Getter @NonNull private final CommandSender sender;
|
||||||
@Getter @Nullable private final Player player;
|
@Getter @Nullable private final Player player;
|
||||||
@Getter private final boolean personalized;
|
@Getter private final boolean personalized;
|
||||||
@Getter private final boolean cooldown;
|
|
||||||
@Getter @Setter @Nullable private List<String> biomes;
|
@Getter @Setter @Nullable private List<String> biomes;
|
||||||
@Getter @Setter @Nullable private WorldLocation location;
|
@Getter @Setter @Nullable private WorldLocation location;
|
||||||
@Getter private final boolean delay;
|
|
||||||
@Getter @Nullable private final RTP_TYPE rtp_type;
|
@Getter @Nullable private final RTP_TYPE rtp_type;
|
||||||
|
@Getter private final RTP_PlayerInfo playerInfo;
|
||||||
|
|
||||||
public RTPSetupInformation(@Nullable World world,
|
public RTPSetupInformation(@Nullable World world,
|
||||||
@NonNull CommandSender sender,
|
@NonNull CommandSender sender,
|
||||||
@@ -50,18 +49,28 @@ public class RTPSetupInformation {
|
|||||||
@Nullable RTP_TYPE rtp_type,
|
@Nullable RTP_TYPE rtp_type,
|
||||||
@Nullable WorldLocation location,
|
@Nullable WorldLocation location,
|
||||||
boolean cooldown) {
|
boolean cooldown) {
|
||||||
|
this(world, sender, player, personalized, biomes, rtp_type, location, new RTP_PlayerInfo(delay, cooldown));
|
||||||
|
}
|
||||||
|
|
||||||
|
public RTPSetupInformation(@Nullable World world,
|
||||||
|
@NonNull CommandSender sender,
|
||||||
|
@Nullable Player player,
|
||||||
|
boolean personalized,
|
||||||
|
@Nullable List<String> biomes,
|
||||||
|
@Nullable RTP_TYPE rtp_type,
|
||||||
|
@Nullable WorldLocation location,
|
||||||
|
RTP_PlayerInfo playerInfo) {
|
||||||
this.world = world;
|
this.world = world;
|
||||||
this.sender = sender;
|
this.sender = sender;
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.personalized = personalized;
|
this.personalized = personalized;
|
||||||
this.biomes = biomes;
|
this.biomes = biomes;
|
||||||
this.delay = delay;
|
|
||||||
this.rtp_type = rtp_type;
|
this.rtp_type = rtp_type;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
if (this.world == null) {
|
if (this.world == null) {
|
||||||
if (player != null)
|
if (player != null)
|
||||||
this.world = player.getWorld();
|
this.world = player.getWorld();
|
||||||
}
|
}
|
||||||
this.cooldown = cooldown;
|
this.playerInfo = playerInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package me.SuperRonanCraft.BetterRTP.player.rtp;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
public class RTP_PlayerInfo {
|
||||||
|
|
||||||
|
@Getter @Setter boolean
|
||||||
|
applyDelay,
|
||||||
|
applyCooldown,
|
||||||
|
checkCooldown,
|
||||||
|
takeMoney,
|
||||||
|
takeHunger;
|
||||||
|
|
||||||
|
public RTP_PlayerInfo(boolean applyDelay, boolean applyCooldown) {
|
||||||
|
this.applyDelay = applyDelay;
|
||||||
|
this.applyCooldown = applyCooldown;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RTP_PlayerInfo(boolean applyDelay,
|
||||||
|
boolean applyCooldown,
|
||||||
|
boolean checkCooldown,
|
||||||
|
boolean takeMoney,
|
||||||
|
boolean takeHunger) {
|
||||||
|
this.applyDelay = applyDelay;
|
||||||
|
this.applyCooldown = applyCooldown;
|
||||||
|
this.checkCooldown = checkCooldown;
|
||||||
|
this.takeMoney = takeMoney;
|
||||||
|
this.takeHunger = takeHunger;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,10 +2,7 @@ package me.SuperRonanCraft.BetterRTP.references.helpers;
|
|||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.commands.types.CmdLocation;
|
import me.SuperRonanCraft.BetterRTP.player.commands.types.CmdLocation;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP;
|
import me.SuperRonanCraft.BetterRTP.player.rtp.*;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPSetupInformation;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_ERROR_REQUEST_REASON;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.PermissionCheck;
|
import me.SuperRonanCraft.BetterRTP.references.PermissionCheck;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
import me.SuperRonanCraft.BetterRTP.references.PermissionNode;
|
||||||
import me.SuperRonanCraft.BetterRTP.references.WarningHandler;
|
import me.SuperRonanCraft.BetterRTP.references.WarningHandler;
|
||||||
@@ -26,7 +23,7 @@ public class HelperRTP {
|
|||||||
|
|
||||||
//Teleported and Sender are the same
|
//Teleported and Sender are the same
|
||||||
public static void tp(Player player, World world, List<String> biomes, RTP_TYPE rtpType) {
|
public static void tp(Player player, World world, List<String> biomes, RTP_TYPE rtpType) {
|
||||||
tp(player, player, world, biomes, rtpType, false, false);
|
tp(player, player, world, biomes, rtpType);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Teleported and Sender MAY be different
|
//Teleported and Sender MAY be different
|
||||||
@@ -49,11 +46,32 @@ public class HelperRTP {
|
|||||||
player,
|
player,
|
||||||
true,
|
true,
|
||||||
biomes,
|
biomes,
|
||||||
!ignoreDelay && HelperRTP_Check.applyDelay(player, sendi),
|
|
||||||
rtpType,
|
rtpType,
|
||||||
location,
|
location,
|
||||||
!ignoreCooldown && HelperRTP_Check.applyCooldown(sendi, player)
|
new RTP_PlayerInfo(
|
||||||
|
!ignoreDelay && HelperRTP_Check.applyDelay(player, sendi),
|
||||||
|
!ignoreCooldown && HelperRTP_Check.applyCooldown(sendi, player))
|
||||||
);
|
);
|
||||||
|
tp(player, sendi, ignoreCooldown, ignoreDelay, setup_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void tp(@NotNull Player player, CommandSender sendi, @Nullable World world, List<String> biomes, RTP_TYPE rtpType,
|
||||||
|
boolean ignoreCooldown, boolean ignoreDelay, @Nullable WorldLocation location, RTP_PlayerInfo playerInfo) {
|
||||||
|
world = getActualWorld(player, world, location);
|
||||||
|
RTPSetupInformation setup_info = new RTPSetupInformation(
|
||||||
|
world,
|
||||||
|
sendi,
|
||||||
|
player,
|
||||||
|
true,
|
||||||
|
biomes,
|
||||||
|
rtpType,
|
||||||
|
location,
|
||||||
|
playerInfo
|
||||||
|
);
|
||||||
|
tp(player, sendi, ignoreCooldown, ignoreDelay, setup_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void tp(@NotNull Player player, CommandSender sendi, boolean ignoreCooldown, boolean ignoreDelay, RTPSetupInformation setup_info) {
|
||||||
//RTP request cancelled reason
|
//RTP request cancelled reason
|
||||||
WorldPlayer pWorld = getPlayerWorld(setup_info);
|
WorldPlayer pWorld = getPlayerWorld(setup_info);
|
||||||
RTP_ERROR_REQUEST_REASON cantReason = HelperRTP_Check.canRTP(player, sendi, pWorld, ignoreCooldown);
|
RTP_ERROR_REQUEST_REASON cantReason = HelperRTP_Check.canRTP(player, sendi, pWorld, ignoreCooldown);
|
||||||
|
|||||||
+4
-5
@@ -4,6 +4,7 @@ import lombok.Getter;
|
|||||||
import me.SuperRonanCraft.BetterRTP.player.commands.RTP_SETUP_TYPE;
|
import me.SuperRonanCraft.BetterRTP.player.commands.RTP_SETUP_TYPE;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPSetupInformation;
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTPSetupInformation;
|
||||||
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_PlayerInfo;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_SHAPE;
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_SHAPE;
|
||||||
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
import me.SuperRonanCraft.BetterRTP.player.rtp.RTP_TYPE;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@@ -22,7 +23,7 @@ public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
|||||||
private List<String> Biomes;
|
private List<String> Biomes;
|
||||||
@Getter private final Player player;
|
@Getter private final Player player;
|
||||||
@Getter private final CommandSender sendi;
|
@Getter private final CommandSender sendi;
|
||||||
@Getter private final boolean applyCooldown, applyDelay;
|
@Getter private final RTP_PlayerInfo playerInfo;
|
||||||
@Getter private final RTP_TYPE rtp_type;
|
@Getter private final RTP_TYPE rtp_type;
|
||||||
private final World world;
|
private final World world;
|
||||||
private WORLD_TYPE world_type;
|
private WORLD_TYPE world_type;
|
||||||
@@ -30,17 +31,15 @@ public class WorldPlayer implements RTPWorld, RTPWorld_Defaulted {
|
|||||||
private RTP_SHAPE shape;
|
private RTP_SHAPE shape;
|
||||||
public RTP_SETUP_TYPE setup_type = RTP_SETUP_TYPE.DEFAULT;
|
public RTP_SETUP_TYPE setup_type = RTP_SETUP_TYPE.DEFAULT;
|
||||||
public String setup_name;
|
public String setup_name;
|
||||||
//Economy
|
|
||||||
public boolean eco_money_taken = false;
|
|
||||||
@Getter private boolean setup = false;
|
@Getter private boolean setup = false;
|
||||||
|
|
||||||
public WorldPlayer(RTPSetupInformation setup_info) {
|
public WorldPlayer(RTPSetupInformation setup_info) {
|
||||||
this.sendi = setup_info.getSender();
|
this.sendi = setup_info.getSender();
|
||||||
this.player = setup_info.getPlayer();
|
this.player = setup_info.getPlayer();
|
||||||
this.world = setup_info.getWorld();
|
this.world = setup_info.getWorld();
|
||||||
this.applyCooldown = setup_info.isCooldown();
|
|
||||||
this.applyDelay = setup_info.isDelay();
|
|
||||||
this.rtp_type = setup_info.getRtp_type();
|
this.rtp_type = setup_info.getRtp_type();
|
||||||
|
this.playerInfo = setup_info.getPlayerInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setup(String setup_name, RTPWorld world, List<String> biomes) {
|
public void setup(String setup_name, RTPWorld world, List<String> biomes) {
|
||||||
|
|||||||
Reference in new issue
Block a user