mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2025-08-17 17:15:47 +00:00
2.11.2 - Async Update
This commit is contained in:
parent
46800d4596
commit
76ab0f1630
52
pom.xml
52
pom.xml
@ -6,13 +6,50 @@
|
||||
|
||||
<groupId>me.SuperRonanCraft</groupId>
|
||||
<artifactId>BetterRTP</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<version>2.11.2</version>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
<configuration>
|
||||
<dependencyReducedPomLocation>${project.build.directory}/dependency-reduced-pom.xml</dependencyReducedPomLocation>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>io.papermc.lib</pattern>
|
||||
<shadedPattern>me.SuperRonanCraft.BetterRTP.paperlib</shadedPattern> <!-- Replace this -->
|
||||
</relocation>
|
||||
</relocations>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- Local Server Building -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<configuration>
|
||||
<outputDirectory>../../Java/plugins</outputDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
@ -26,12 +63,14 @@
|
||||
<id>sk89q-repo</id>
|
||||
<url>http://maven.sk89q.com/repo/</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>jitpack.io</id>
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>papermc</id>
|
||||
<url>https://papermc.io/repo/repository/maven-public/</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
<dependencies>
|
||||
<!--Spigot API-->
|
||||
@ -72,5 +111,12 @@
|
||||
<version>16.7.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!-- Paper Library for Async Chunk/Teleport -->
|
||||
<dependency>
|
||||
<groupId>io.papermc</groupId>
|
||||
<artifactId>paperlib</artifactId>
|
||||
<version>1.0.5</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -153,8 +153,8 @@ public class RTP {
|
||||
return;
|
||||
}
|
||||
// Delaying? Else, just go
|
||||
getPl().getCmd().rtping.put(p.getUniqueId(), true);
|
||||
if (delay) {
|
||||
getPl().getCmd().rtping.put(p.getUniqueId(), true);
|
||||
new Delay(sendi, pWorld, delayTime, cancelOnMove, cancelOnDamage);
|
||||
} else
|
||||
tp(sendi, pWorld);
|
||||
|
@ -1,16 +1,24 @@
|
||||
package me.SuperRonanCraft.BetterRTP.player;
|
||||
|
||||
import io.papermc.lib.PaperLib;
|
||||
import me.SuperRonanCraft.BetterRTP.Main;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
public class RTPTeleport {
|
||||
|
||||
void sendPlayer(final CommandSender sendi, final Player p, final Location loc, final int price,
|
||||
final int attempts) throws NullPointerException {
|
||||
getPl().getText().getSuccessLoading(sendi); //Send loading message
|
||||
loadChunks(loc); //Load chunks before teleporting
|
||||
new BukkitRunnable(){
|
||||
@Override
|
||||
public void run() {
|
||||
@ -21,17 +29,43 @@ public class RTPTeleport {
|
||||
if (getPl().getText().getTitleEnabled())
|
||||
titles(p, loc, attempts);
|
||||
try {
|
||||
//loc.getWorld().loadChunk(loc.getChunk());
|
||||
p.teleport(loc);
|
||||
//p.teleport(loc);
|
||||
PaperLib.teleportAsync(p, loc); //Async teleport
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (getPl().getText().getSoundsEnabled())
|
||||
sounds(p);
|
||||
}
|
||||
getPl().getCmd().rtping.put(p.getUniqueId(), false); //Dont let them rtp again until current is done!
|
||||
}
|
||||
}.runTask(getPl());
|
||||
}
|
||||
|
||||
private void loadChunks(Location loc) { //Async chunk loading
|
||||
List<CompletableFuture<Chunk>> asyncChunks = new ArrayList<>();
|
||||
for (int x = -5; x <= 5; x++) {
|
||||
for (int z = -5; z <= 5; z++) {
|
||||
Location locLoad = new Location(loc.getWorld(), loc.getX() + (x * 16), loc.getY(), loc.getZ() + (x * 16));
|
||||
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(locLoad, true);
|
||||
asyncChunks.add(chunk);
|
||||
}
|
||||
}
|
||||
while (!checkLoaded(asyncChunks)) {
|
||||
try {
|
||||
Thread.sleep(500); //Sleep and check again 0.5 seconds later
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkLoaded(List<CompletableFuture<Chunk>> asyncChunks) {
|
||||
for (CompletableFuture<Chunk> chunk : asyncChunks)
|
||||
if (!chunk.isDone())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
private void checkPH(CommandSender sendi, String player, Location loc, int price, boolean sameAsPlayer,
|
||||
int attempts) {
|
||||
String x = Integer.toString(loc.getBlockX());
|
||||
|
@ -140,17 +140,14 @@ public class Commands {
|
||||
}
|
||||
|
||||
private boolean checkDelay(CommandSender sendi, Player player) {
|
||||
//Bypassing/Forced?
|
||||
if (sendi != player || pl.getPerms().getBypassCooldown(player))
|
||||
return true;
|
||||
//Currently rtp'ing?
|
||||
else if (rtping.containsKey(player.getUniqueId()))
|
||||
if (rtping.containsKey(player.getUniqueId())) //Already rtp'ing
|
||||
if (rtping.get(player.getUniqueId())) {
|
||||
pl.getText().getAlready(player);
|
||||
return false;
|
||||
}
|
||||
//Cooling down?
|
||||
if (cooldownTimer) {
|
||||
else if (sendi != player || pl.getPerms().getBypassCooldown(player)) //Bypassing/Forced?
|
||||
return true;
|
||||
else if (cooldownTimer) { //Cooling down?
|
||||
Player p = (Player) sendi;
|
||||
if (cooldowns.containsKey(p.getUniqueId())) {
|
||||
long Left = ((cooldowns.get(p.getUniqueId()) / 1000) + cooldown) - (System.currentTimeMillis() / 1000);
|
||||
|
@ -35,6 +35,10 @@ public class Messages {
|
||||
("%z%", z).replaceAll("%world%", world).replaceAll("%attempts%", Integer.toString(attemtps)));
|
||||
}
|
||||
|
||||
public void getSuccessLoading(CommandSender sendi) {
|
||||
sms(sendi, getLang().getString(preM + "Success.Loading"));
|
||||
}
|
||||
|
||||
public void getFailedNotSafe(CommandSender sendi, int attempts) {
|
||||
sms(sendi, getLang().getString(preM + "Failed.NotSafe").replaceAll("%attempts%", Integer.toString(attempts)));
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ Messages:
|
||||
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
|
||||
Paid: '&a你花费了&c$%price%&7,被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!'
|
||||
Bypass: '&a你被传送到了&7 x=%x% y=%y% z=%z%。共尝试&f%attempts%&7次!'
|
||||
Loading: '&aSafe spot located! &7Loading chunks...'
|
||||
Failed:
|
||||
Price: '&c你的钱不够了,&7你至少要有$%price%&7才能随机传送!'
|
||||
NotSafe: '&c由于在%attempts%次尝试内未能找到安全的位置,&7你未被传送!'
|
||||
|
@ -3,6 +3,7 @@ Messages:
|
||||
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
|
||||
Paid: '&a您花費了&c$%price%&7,被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次!'
|
||||
Bypass: '&a您被傳送到了&7 x=%x% y=%y% z=%z%。一共嘗試&f%attempts%&7次!'
|
||||
Loading: '&aSafe spot located! &7Loading chunks...'
|
||||
Failed:
|
||||
Price: '&c您的資金不夠了!&7您需要有$%price%&7才能嘗試RTP!'
|
||||
NotSafe: '&c由於%attempts%次嘗試內未能找到適合的地方傳送,&7您未被傳送!'
|
||||
|
@ -3,6 +3,7 @@ Messages:
|
||||
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
|
||||
Paid: '&aYou have been tp''d to&7 x=%x% y=%y% z=%z% for &c$%price%&7 in &f%attempts% &7attempts!'
|
||||
Bypass: '&aYou have been tp''d to&7 x=%x% y=%y% z=%z% in &f%attempts% &7attempts'
|
||||
Loading: '&aSafe spot located! &7Loading chunks...'
|
||||
Failed:
|
||||
Price: '&cCould not rtp because of insufficent funds! &7You must have atleast $%price% &7to rtp!'
|
||||
NotSafe: '&cCould not find safe spot within %attempts% attempts! &7You were not RTP''d!'
|
||||
|
@ -4,6 +4,7 @@ Messages:
|
||||
Success:
|
||||
Paid: '&aTu a été téléporté à&7 x=%x% y=%y% z=%z% pour &c$%price%&7 en &f%attempts% &7tentatives!'
|
||||
Bypass: '&aTu a été téléporté à&7 x=%x% y=%y% z=%z% en &f%attempts% &7tentatives!'
|
||||
Loading: '&aSafe spot located! &7Loading chunks...'
|
||||
Failed:
|
||||
Price: '&cTu n''a pas pu être téléporté; Manque de fonds! &7Tu doit avoir au moins $%price% &7pour te téléporter!'
|
||||
NotSafe: '&cImpossible de trouver un endroit sûr en %attempts% tentatives! &7Tu n''a pas été téléporté!'
|
||||
@ -54,11 +55,11 @@ Help:
|
||||
Usage:
|
||||
Player: '&cUtilisation&7: /%command% player <joeur> [monde]'
|
||||
World: '&cUtilisation&7: /%command% world <monde>'
|
||||
Biome: '&cUtilisation&7: /%command% biome <biome1, biome2...>'
|
||||
|
||||
Sounds:
|
||||
Enabled: true
|
||||
## Plus de sons à https://www.spigotmc.org/wiki/cc-sounds-list/
|
||||
## Son à jouer lors de la téléportation avec délai ##
|
||||
## Plus de sons à https://www.spigotmc.org/wiki/cc-sounds-list/ ## Son à jouer lors de la téléportation avec délai ##
|
||||
Delay: 'entity_tnt_primed'
|
||||
##Son à jouer lorsque la téléportation à réussie ##
|
||||
Success: 'entity_generic_explode'
|
||||
Success: 'entity_generic_explode'
|
@ -3,6 +3,7 @@ Messages:
|
||||
Success:
|
||||
Paid: '&aあなたは&c$%price%&aで&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でTPされました!'
|
||||
Bypass: '&aあなたは&7x=%x% y=%y% z=%z% に&f%attempts%&7回の試行でTPされました!'
|
||||
Loading: '&aSafe spot located! &7Loading chunks...'
|
||||
Failed:
|
||||
Price: '&c資金が不十分のためRTPできませんでした! &7RTPには最低$%price%&7が必要です!'
|
||||
NotSafe: '&c%attempts%回の試行で安全な場所が見つかりませんでした! &7あなたははRTPされませんでした!'
|
||||
@ -14,6 +15,7 @@ Messages:
|
||||
NoPermission:
|
||||
Basic: '&cごめんなさい! &7このコマンドを使う権限がありません!'
|
||||
World: '&cごめんなさい! &7ワールド%world%ではrtpが許可されていません!'
|
||||
##
|
||||
DisabledWorld: '&cワールド%world%は無効です! &7RTPできませんでした!'
|
||||
Cooldown: '&cごめんなさい! &7あなたは&c%time%&7秒間RTPできません!'
|
||||
Invalid: '&c無効な引数。 ''/%command% help''を試してください。'
|
||||
@ -27,11 +29,15 @@ Messages:
|
||||
Titles:
|
||||
Enabled: true
|
||||
Delay:
|
||||
##
|
||||
SendChatMessage: true
|
||||
##
|
||||
Title: '&6BetterRTP by SRC'
|
||||
Subtitle: '&f%time%秒でテレポート!'
|
||||
Success:
|
||||
##
|
||||
SendChatMessage: true
|
||||
##
|
||||
Title: '&6BetterRTP by SRC &7(%attempts%)'
|
||||
Subtitle: '&fx=%x% y=%y% z=%z% にテレポート'
|
||||
|
||||
@ -40,8 +46,10 @@ Help:
|
||||
- '&e&m------&r &6&lBetterRTP &8| &7ヘルプ&e&m------'
|
||||
- ' &7- &e/%command% &7- あなたをランダムテレポートする!'
|
||||
- ' &7- &e/%command% help &7- ヘルプを見る'
|
||||
##
|
||||
Player: ' &7- &e/%command% player <player> [world] &7- 他のプレイヤーをランダムテレポート'
|
||||
World: ' &7- &e/%command% world <world> &7- 他のワールドにランダムテレポート'
|
||||
##
|
||||
Biome: ' &7- &e/%command% biome <biome1, biome2...> &7- Randomly teleport withing these biomes'
|
||||
Reload: ' &7- &e/%command% reload &7- プラグインをリロード'
|
||||
|
||||
@ -54,4 +62,4 @@ Sounds:
|
||||
Enabled: true
|
||||
## More sounds at https://www.spigotmc.org/wiki/cc-sounds-list/
|
||||
Delay: 'entity_tnt_primed'
|
||||
Success: 'entity_generic_explode'
|
||||
Success: 'entity_generic_explode'
|
@ -1,9 +1,9 @@
|
||||
Messages:
|
||||
Prefix: '&7[&6BetterRTP&7] '
|
||||
## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
|
||||
Success:
|
||||
Success: ## Placeholders! %x% %y% and %z% are the x, y, and z coordinates that the player is being teleported to! #
|
||||
Paid: '&aВас телепортировало на&7 x=%x% y=%y% z=%z% за &c$%price%&7, за &f%attempts% &7попыток!'
|
||||
Bypass: '&aВас телепортировало на&7 x=%x% y=%y% z=%z% за &f%attempts% &7попыток'
|
||||
Loading: '&aSafe spot located! &7Loading chunks...'
|
||||
Failed:
|
||||
Price: '&cУ вас недостаточно денег для телепортации! &7У вас должно быть хотябы $%price% &7для rtp!'
|
||||
NotSafe: '&cНе удалось найти безопасное место за %attempts% попыток! &7Вас не телепортировало!'
|
||||
|
@ -1,5 +1,5 @@
|
||||
main: me.SuperRonanCraft.BetterRTP.Main
|
||||
version: '2.11.1-BETA'
|
||||
version: '2.11.2'
|
||||
name: BetterRTP
|
||||
author: SuperRonanCraft
|
||||
softdepend: [Vault, WorldGuard, GriefPrevention, Factions]
|
||||
|
Loading…
x
Reference in New Issue
Block a user