mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
economy charged after safe spot located
This commit is contained in:
parent
169b3940e4
commit
54482d897f
2
pom.xml
2
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>2.14.1</version>
|
||||
<version>2.14.2</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
|
@ -139,20 +139,19 @@ public class Commands {
|
||||
|
||||
private boolean checkDelay(CommandSender sendi, Player player) {
|
||||
if (rtping.containsKey(player.getUniqueId()) && rtping.get(player.getUniqueId())) {
|
||||
pl.getText().getAlready(player);
|
||||
pl.getText().getAlready(sendi);
|
||||
return false;
|
||||
} else if (sendi != player || pl.getPerms().getBypassCooldown(player)) { //Bypassing/Forced?
|
||||
return true;
|
||||
} else if (cooldowns.enabled) { //Cooling down?
|
||||
Player p = (Player) sendi;
|
||||
UUID id = p.getUniqueId();
|
||||
UUID id = player.getUniqueId();
|
||||
if (cooldowns.exists(id)) {
|
||||
if (cooldowns.locked(id)) { //Infinite cooldown (locked)
|
||||
pl.getText().getNoPermission(sendi);
|
||||
return false;
|
||||
} else { //Normal cooldown
|
||||
long Left = cooldowns.timeLeft(id);
|
||||
if (pl.getSettings().delayEnabled && !pl.getPerms().getBypassDelay(p))
|
||||
if (pl.getSettings().delayEnabled && !pl.getPerms().getBypassDelay(sendi))
|
||||
Left = Left + delayTimer;
|
||||
if (Left > 0) {
|
||||
//Still cooling down
|
||||
|
@ -59,7 +59,7 @@ class RTPDelay implements Listener {
|
||||
if (!Bukkit.getScheduler().isCurrentlyRunning(run)) {
|
||||
HandlerList.unregisterAll(this);
|
||||
getPl().getRTP().getTeleport().cancelledTeleport(rtp.getPlayer());
|
||||
getPl().getEco().unCharge(rtp.getPlayer(), rtp.pWorld);
|
||||
//getPl().getEco().unCharge(rtp.getPlayer(), rtp.pWorld);
|
||||
getPl().getCmd().cooldowns.remove(rtp.getPlayer().getUniqueId());
|
||||
getPl().getCmd().rtping.put(rtp.getPlayer().getUniqueId(), false);
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ public class RTPPlayer {
|
||||
Location loc = pWorld.generateRandomXZ(settings.defaultWorld); //randomLoc(pWorld);
|
||||
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(pWorld.getWorld(), loc.getBlockX(), loc.getBlockZ());
|
||||
chunk.thenAccept(result -> {
|
||||
Main.debug("Checking location for " + p.getName());
|
||||
Location tpLoc;
|
||||
float yaw = p.getLocation().getYaw();
|
||||
float pitch = p.getLocation().getPitch();
|
||||
@ -47,10 +48,11 @@ public class RTPPlayer {
|
||||
tpLoc = getLocAtNormal(loc.getBlockX(), loc.getBlockZ(), pWorld.getWorld(), yaw, pitch, pWorld);
|
||||
}
|
||||
//Valid location?
|
||||
if (tpLoc != null && checkDepends(tpLoc))
|
||||
if (getPl().getEco().charge(p, pWorld))
|
||||
if (tpLoc != null && checkDepends(tpLoc)) {
|
||||
if (getPl().getEco().charge(p, pWorld)) {
|
||||
settings.teleport.sendPlayer(sendi, p, tpLoc, pWorld.getPrice(), pWorld.getAttempts());
|
||||
else
|
||||
}
|
||||
} else
|
||||
randomlyTeleport(sendi);
|
||||
});
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class DepEconomy {
|
||||
Player player = pWorld.getPlayer();
|
||||
//Hunger Stuff
|
||||
if (hunger != 0
|
||||
&& sendi == player
|
||||
&& !Main.getInstance().getPerms().getBypassHunger(sendi)
|
||||
&& (player.getGameMode() == GameMode.SURVIVAL || player.getGameMode() == GameMode.ADVENTURE)) {
|
||||
boolean has_hunger = player.getFoodLevel() > hunger;
|
||||
if (!has_hunger) {
|
||||
@ -69,9 +69,10 @@ public class DepEconomy {
|
||||
if (e != null && pWorld.getPrice() != 0 && !Main.getInstance().getPerms().getBypassEconomy(sendi)) {
|
||||
try {
|
||||
boolean passed_economy = e.getBalance(player) >= pWorld.getPrice();
|
||||
if (!passed_economy)
|
||||
if (!passed_economy) {
|
||||
Main.getInstance().getText().getFailedPrice(sendi, pWorld.getPrice());
|
||||
return passed_economy;
|
||||
return false;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
main: me.SuperRonanCraft.BetterRTP.Main
|
||||
version: '2.14.1'
|
||||
version: '2.14.2'
|
||||
name: BetterRTP
|
||||
author: SuperRonanCraft
|
||||
softdepend: [Vault, WorldGuard, GriefPrevention, Towny, Factions, RedProtect]
|
||||
@ -46,6 +46,8 @@ permissions:
|
||||
description: Bypass delays
|
||||
betterrtp.bypass.economy:
|
||||
description: Bypass economy
|
||||
betterrtp.bypass.hunger:
|
||||
description: Bypass hunger
|
||||
betterrtp.reload:
|
||||
description: Reload the config
|
||||
default: op
|
||||
|
Loading…
x
Reference in New Issue
Block a user