mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
2.11.3 - Async Delays issue
Added the ability to disable delays in the config
This commit is contained in:
parent
060361c6e7
commit
b8930a510d
7
pom.xml
7
pom.xml
@ -6,7 +6,7 @@
|
||||
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>2.11.2</version>
|
||||
<version>2.11.3</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
@ -16,6 +16,7 @@
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<!-- Shade PaperLib into project -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
@ -24,7 +25,7 @@
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>me.SuperRonanCraft.BetterRTP.paperlib</shadedPattern> <!-- Replace this -->
|
||||
<shadedPattern>me.SuperRonanCraft.BetterRTP.paperlib</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
@ -37,8 +38,8 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Local Server Building -->
|
||||
<plugin>
|
||||
<!-- Local Server Building -->
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
|
@ -153,20 +153,25 @@ public class RTP {
|
||||
return;
|
||||
}
|
||||
// Delaying? Else, just go
|
||||
getPl().getCmd().rtping.put(p.getUniqueId(), true);
|
||||
if (delay) {
|
||||
getPl().getCmd().rtping.put(p.getUniqueId(), true); //Cache player so they cant run '/rtp' again while rtp'ing
|
||||
if (getPl().getSettings().delayEnabled && delay) {
|
||||
new Delay(sendi, pWorld, delayTime, cancelOnMove, cancelOnDamage);
|
||||
} else
|
||||
tp(sendi, pWorld);
|
||||
}
|
||||
|
||||
void tp(CommandSender sendi, PlayerWorld pWorld) {
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
Location loc = randomLoc(pWorld);
|
||||
if (loc != null)
|
||||
teleport.sendPlayer(sendi, pWorld.getPlayer(), loc, pWorld.getPrice(), pWorld.getAttempts());
|
||||
else
|
||||
metMax(sendi, pWorld.getPlayer(), pWorld.getPrice());
|
||||
}
|
||||
}.runTaskAsynchronously(getPl());
|
||||
}
|
||||
|
||||
// Compressed code for MaxAttempts being met
|
||||
private void metMax(CommandSender sendi, Player p, int price) {
|
||||
|
@ -126,17 +126,8 @@ public class Commands {
|
||||
if (sendi == player)
|
||||
delay = true;
|
||||
//pl.getRTP().start(player, sendi, world, biomes, delay);
|
||||
tpSync(player, sendi, world, biomes, delay);
|
||||
}
|
||||
}
|
||||
|
||||
private void tpSync(Player player, CommandSender sendi, String world, List<String> biomes, boolean delay) {
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
pl.getRTP().start(player, sendi, world, biomes, delay);
|
||||
}
|
||||
}.runTaskAsynchronously(pl);
|
||||
}
|
||||
|
||||
private boolean checkDelay(CommandSender sendi, Player player) {
|
||||
|
@ -5,17 +5,23 @@ import me.SuperRonanCraft.BetterRTP.references.file.FileBasics;
|
||||
|
||||
public class Settings {
|
||||
|
||||
public boolean debug = false;
|
||||
|
||||
public boolean debug;
|
||||
public boolean delayEnabled;
|
||||
//Dependencies
|
||||
private SoftDepends depends = new SoftDepends();
|
||||
|
||||
public void load() { //Load Settings
|
||||
depends.load();
|
||||
debug = Main.getInstance().getFiles().getType(FileBasics.FILETYPE.CONFIG).getBoolean("Settings.Debugger");
|
||||
FileBasics.FILETYPE config = getPl().getFiles().getType(FileBasics.FILETYPE.CONFIG);
|
||||
debug = config.getBoolean("Settings.Debugger");
|
||||
delayEnabled = config.getBoolean("Settings.Delay.Enabled");
|
||||
}
|
||||
|
||||
public SoftDepends getsDepends() {
|
||||
return depends;
|
||||
}
|
||||
|
||||
private Main getPl() {
|
||||
return Main.getInstance();
|
||||
}
|
||||
}
|
||||
|
@ -22,6 +22,7 @@ Settings:
|
||||
Time: 10
|
||||
## Time between command and actually rtp'ing, time is in SECONDS. Set to "0" to disable delay timer #
|
||||
Delay:
|
||||
Enabled: true
|
||||
Time: 5
|
||||
CancelOnMove: true
|
||||
DisableUpdater: false
|
||||
|
@ -1,5 +1,5 @@
|
||||
main: me.SuperRonanCraft.BetterRTP.Main
|
||||
version: '2.11.2'
|
||||
version: '2.11.3'
|
||||
name: BetterRTP
|
||||
author: SuperRonanCraft
|
||||
softdepend: [Vault, WorldGuard, GriefPrevention, Factions]
|
||||
|
Loading…
x
Reference in New Issue
Block a user