mirror of
https://github.com/RonanPlugins/BetterRTP.git
synced 2026-11-28 08:44:07 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
76fc1ffe9b | ||
|
|
04309fba14 | ||
|
|
97ee43e434 | ||
|
|
6992e3a41a | ||
|
|
b69d4aa787 | ||
|
|
c7a1a4e069 | ||
|
|
1d4389188f | ||
|
|
ab9911605c | ||
|
|
6eca1c5c73 | ||
|
|
621f3a6876 | ||
|
|
bd45e4cb87 | ||
|
|
b878c992f9 | ||
|
|
aeeffc9e1b | ||
|
|
09ce7e79d2 | ||
|
|
e017aa83c6 | ||
|
|
ff79654444 | ||
|
|
c2a45e8b7b | ||
|
|
9f0801fda4 | ||
|
|
66fe5b9001 |
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
name: Release BetterRTP Maven version
|
name: Release BetterRTP Maven version
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [master]
|
branches: [online-editor]
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
@@ -10,7 +10,7 @@ concurrency:
|
|||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
if: github.ref == 'refs/heads/master'
|
if: github.ref == 'refs/heads/online-editor'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -18,6 +18,4 @@ jobs:
|
|||||||
run: cp settings.xml $HOME/.m2/settings.xml
|
run: cp settings.xml $HOME/.m2/settings.xml
|
||||||
|
|
||||||
- name: Build and test with Maven
|
- name: Build and test with Maven
|
||||||
run: |
|
run: mvn -B -pl :BetterRTP test
|
||||||
mvn -B -pl :BetterRTP verify
|
|
||||||
mvn -B -f tests/editor/pom.xml verify
|
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP</artifactId>
|
<artifactId>BetterRTP</artifactId>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<version>3.6.15</version>
|
<version>3.6.14</version>
|
||||||
|
|
||||||
<!-- Upload patches to https://repo.ronanplugins.com/#/ -->
|
<!-- Upload patches to https://repo.ronanplugins.com/#/ -->
|
||||||
|
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ public class BetterRTP extends JavaPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDisable() {
|
public void onDisable() {
|
||||||
RTP.getOperations().clear();
|
|
||||||
playerDataManager.clear();
|
playerDataManager.clear();
|
||||||
if (editorBridge != null) editorBridge.close();
|
if (editorBridge != null) editorBridge.close();
|
||||||
invs.closeAll();
|
invs.closeAll();
|
||||||
@@ -112,7 +111,6 @@ public class BetterRTP extends JavaPlugin {
|
|||||||
|
|
||||||
//(Re)Load all plugin systems/files/cache
|
//(Re)Load all plugin systems/files/cache
|
||||||
private void loadAll() {
|
private void loadAll() {
|
||||||
RTP.getOperations().clear();
|
|
||||||
foliaHandler.load();
|
foliaHandler.load();
|
||||||
playerDataManager.clear();
|
playerDataManager.clear();
|
||||||
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers())
|
for (org.bukkit.entity.Player player : Bukkit.getOnlinePlayers())
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ public class PlayerInfo {
|
|||||||
@Getter private final HashMap<Player, World> invWorld = new HashMap<>();
|
@Getter private final HashMap<Player, World> invWorld = new HashMap<>();
|
||||||
@Getter private final HashMap<Player, RTP_INV_SETTINGS> invNextInv = new HashMap<>();
|
@Getter private final HashMap<Player, RTP_INV_SETTINGS> invNextInv = new HashMap<>();
|
||||||
//private final HashMap<Player, CooldownData> cooldown = new HashMap<>();
|
//private final HashMap<Player, CooldownData> cooldown = new HashMap<>();
|
||||||
|
@Getter private final HashMap<Player, Boolean> rtping = new HashMap<>();
|
||||||
//private final HashMap<Player, List<Location>> previousLocations = new HashMap<>();
|
//private final HashMap<Player, List<Location>> previousLocations = new HashMap<>();
|
||||||
//private final HashMap<Player, RTP_TYPE> rtpType = new HashMap<>();
|
//private final HashMap<Player, RTP_TYPE> rtpType = new HashMap<>();
|
||||||
|
|
||||||
@@ -48,14 +48,14 @@ public class PlayerInfo {
|
|||||||
invWorld.clear();
|
invWorld.clear();
|
||||||
invNextInv.clear();
|
invNextInv.clear();
|
||||||
//cooldown.clear();
|
//cooldown.clear();
|
||||||
|
rtping.clear();
|
||||||
//previousLocations.clear();
|
//previousLocations.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void unload(Player p) {
|
private void unload(Player p) {
|
||||||
clearInvs(p);
|
clearInvs(p);
|
||||||
//cooldown.remove(p);
|
//cooldown.remove(p);
|
||||||
|
rtping.remove(p);
|
||||||
//previousLocations.remove(p);
|
//previousLocations.remove(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.events;
|
package me.SuperRonanCraft.BetterRTP.player.events;
|
||||||
|
|
||||||
import me.SuperRonanCraft.BetterRTP.references.player.HelperPlayer;
|
import me.SuperRonanCraft.BetterRTP.references.player.HelperPlayer;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.player.PlayerQuitEvent;
|
import org.bukkit.event.player.PlayerQuitEvent;
|
||||||
|
|
||||||
@@ -9,10 +8,6 @@ class Leave {
|
|||||||
|
|
||||||
static void event(PlayerQuitEvent e) {
|
static void event(PlayerQuitEvent e) {
|
||||||
Player p = e.getPlayer();
|
Player p = e.getPlayer();
|
||||||
try {
|
HelperPlayer.unload(p);
|
||||||
BetterRTP.getInstance().getRTP().getOperations().cancel(p.getUniqueId(), p);
|
|
||||||
} finally {
|
|
||||||
HelperPlayer.unload(p);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -22,7 +22,6 @@ import me.SuperRonanCraft.BetterRTP.references.rtpinfo.worlds.WorldPlayer;
|
|||||||
public class RTP {
|
public class RTP {
|
||||||
|
|
||||||
@Getter final RTPTeleport teleport = new RTPTeleport();
|
@Getter final RTPTeleport teleport = new RTPTeleport();
|
||||||
@Getter private final RTPOperationTracker operations = new RTPOperationTracker();
|
|
||||||
//Cache
|
//Cache
|
||||||
public final HashMap<String, String> overriden = new HashMap<>();
|
public final HashMap<String, String> overriden = new HashMap<>();
|
||||||
@Getter List<String> disabledWorlds, blockList;
|
@Getter List<String> disabledWorlds, blockList;
|
||||||
@@ -83,19 +82,16 @@ public class RTP {
|
|||||||
private void rtp(CommandSender sendi, WorldPlayer pWorld, RTP_TYPE type) {
|
private void rtp(CommandSender sendi, WorldPlayer pWorld, RTP_TYPE type) {
|
||||||
//Cooldown
|
//Cooldown
|
||||||
Player p = pWorld.getPlayer();
|
Player p = pWorld.getPlayer();
|
||||||
if (!p.isOnline()) return;
|
getPl().getPInfo().getRtping().put(p, true); //Cache player so they cant run '/rtp' again while rtp'ing
|
||||||
RTPOperationTracker.Operation operation = operations.start(p.getUniqueId(), p);
|
|
||||||
if (operation == null) return;
|
|
||||||
//Setup player rtp methods
|
//Setup player rtp methods
|
||||||
RTPPlayer rtpPlayer = new RTPPlayer(p, this, pWorld, type, operation);
|
RTPPlayer rtpPlayer = new RTPPlayer(p, this, pWorld, type);
|
||||||
rtpPlayer.runSafely(() -> {
|
// Delaying? Else, just go
|
||||||
if (pWorld.getPlayerInfo().applyDelay && HelperRTP_Check.applyDelay(p)) {
|
if (pWorld.getPlayerInfo().applyDelay && HelperRTP_Check.applyDelay(pWorld.getPlayer())) {
|
||||||
new RTPDelay(sendi, rtpPlayer, delayTime, cancelOnMove, cancelOnDamage);
|
new RTPDelay(sendi, rtpPlayer, delayTime, cancelOnMove, cancelOnDamage);
|
||||||
} else {
|
} else {
|
||||||
rtpPlayer.afterPreEvent(teleport.beforeTeleportInstant(sendi, p),
|
if (!teleport.beforeTeleportInstant(sendi, p))
|
||||||
() -> rtpPlayer.randomlyTeleport(sendi));
|
rtpPlayer.randomlyTeleport(sendi);
|
||||||
}
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private BetterRTP getPl() {
|
private BetterRTP getPl() {
|
||||||
|
|||||||
+14
-28
@@ -22,17 +22,15 @@ class RTPDelay implements Listener {
|
|||||||
this.cancelOnMove = cancelOnMove;
|
this.cancelOnMove = cancelOnMove;
|
||||||
this.cancelOnDamage = cancelOnDamage;
|
this.cancelOnDamage = cancelOnDamage;
|
||||||
this.rtp = rtp;
|
this.rtp = rtp;
|
||||||
rtp.getOperation().onFinish(this::dispose);
|
|
||||||
delay(sendi, delay);
|
delay(sendi, delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void delay(CommandSender sendi, int delay) {
|
private void delay(CommandSender sendi, int delay) {
|
||||||
rtp.afterPreEvent(getPl().getRTP().getTeleport().beforeTeleportDelay(rtp.getPlayer(), delay), () -> {
|
if (!getPl().getRTP().getTeleport().beforeTeleportDelay(rtp.getPlayer(), delay)) {
|
||||||
task = AsyncHandler.syncLater(run(sendi, this), delay * 20L);
|
task = AsyncHandler.syncLater(run(sendi, this), delay * 20L);
|
||||||
if (cancelOnMove || cancelOnDamage)
|
if (cancelOnMove || cancelOnDamage)
|
||||||
Bukkit.getPluginManager().registerEvents(this, BetterRTP.getInstance());
|
Bukkit.getPluginManager().registerEvents(this, BetterRTP.getInstance());
|
||||||
if (!rtp.isActive()) dispose();
|
}
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
@@ -59,35 +57,23 @@ class RTPDelay implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void dispose() {
|
|
||||||
dispose(task, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void dispose(WrappedTask task, Listener listener) {
|
|
||||||
try {
|
|
||||||
if (task != null) task.cancel();
|
|
||||||
} finally {
|
|
||||||
HandlerList.unregisterAll(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void cancel() {
|
private void cancel() {
|
||||||
rtp.runSafely(() -> {
|
if (task != null)
|
||||||
try {
|
task.cancel();
|
||||||
getPl().getRTP().getTeleport().cancelledTeleport(rtp.getPlayer());
|
HandlerList.unregisterAll(this);
|
||||||
getPl().getCooldowns().removeCooldown(rtp.getPlayer(), rtp.worldPlayer.getWorld());
|
getPl().getRTP().getTeleport().cancelledTeleport(rtp.getPlayer());
|
||||||
} finally {
|
//getPl().getEco().unCharge(rtp.getPlayer(), rtp.pWorld);
|
||||||
rtp.getOperation().finish();
|
getPl().getCooldowns().removeCooldown(rtp.getPlayer(), rtp.worldPlayer.getWorld());
|
||||||
}
|
getPl().getPInfo().getRtping().remove(rtp.getPlayer());
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new RTP_CancelledEvent(rtp.getPlayer()));
|
Bukkit.getServer().getPluginManager().callEvent(new RTP_CancelledEvent(rtp.getPlayer()));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Runnable run(final CommandSender sendi, final RTPDelay cls) {
|
private Runnable run(final CommandSender sendi, final RTPDelay cls) {
|
||||||
return () -> rtp.runSafely(() -> {
|
return () -> {
|
||||||
HandlerList.unregisterAll(cls);
|
HandlerList.unregisterAll(cls);
|
||||||
rtp.randomlyTeleport(sendi);
|
if (getPl().getPInfo().getRtping().containsKey(rtp.getPlayer()))
|
||||||
});
|
rtp.randomlyTeleport(sendi);
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private BetterRTP getPl() {
|
private BetterRTP getPl() {
|
||||||
|
|||||||
-95
@@ -1,95 +0,0 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.rtp;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
|
|
||||||
/** Owns active requests. Identity checks prevent old callbacks from ending a newer request. */
|
|
||||||
public final class RTPOperationTracker {
|
|
||||||
private final Map<UUID, Operation> active = new HashMap<>();
|
|
||||||
|
|
||||||
public synchronized Operation start(UUID uuid, Object session) {
|
|
||||||
if (active.containsKey(uuid)) return null;
|
|
||||||
Operation operation = new Operation(uuid, session);
|
|
||||||
active.put(uuid, operation);
|
|
||||||
return operation;
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized boolean contains(UUID uuid) { return active.containsKey(uuid); }
|
|
||||||
|
|
||||||
public void cancel(UUID uuid, Object session) {
|
|
||||||
Operation operation;
|
|
||||||
synchronized (this) { operation = active.get(uuid); }
|
|
||||||
if (operation != null && operation.session == session) operation.finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void clear() {
|
|
||||||
List<Operation> operations;
|
|
||||||
synchronized (this) {
|
|
||||||
operations = new ArrayList<>(active.values());
|
|
||||||
active.clear();
|
|
||||||
}
|
|
||||||
RuntimeException failure = null;
|
|
||||||
for (Operation operation : operations) {
|
|
||||||
try { operation.finish(); } catch (RuntimeException ex) { failure = ex; }
|
|
||||||
}
|
|
||||||
if (failure != null) throw failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
public final class Operation {
|
|
||||||
private final UUID uuid;
|
|
||||||
private final Object session;
|
|
||||||
private final List<Runnable> cleanup = new ArrayList<>();
|
|
||||||
private boolean finished;
|
|
||||||
|
|
||||||
private Operation(UUID uuid, Object session) { this.uuid = uuid; this.session = session; }
|
|
||||||
|
|
||||||
public boolean isActive() {
|
|
||||||
synchronized (RTPOperationTracker.this) { return active.get(uuid) == this; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onFinish(Runnable action) {
|
|
||||||
synchronized (this) {
|
|
||||||
if (!finished) { cleanup.add(action); return; }
|
|
||||||
}
|
|
||||||
action.run();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void finish() {
|
|
||||||
List<Runnable> actions;
|
|
||||||
synchronized (this) {
|
|
||||||
if (finished) return;
|
|
||||||
finished = true;
|
|
||||||
actions = new ArrayList<>(cleanup);
|
|
||||||
cleanup.clear();
|
|
||||||
}
|
|
||||||
synchronized (RTPOperationTracker.this) { active.remove(uuid, this); }
|
|
||||||
RuntimeException failure = null;
|
|
||||||
for (Runnable action : actions) {
|
|
||||||
try { action.run(); } catch (RuntimeException ex) { failure = ex; }
|
|
||||||
}
|
|
||||||
if (failure != null) throw failure;
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Terminal future: cleanup also runs when result handling throws. */
|
|
||||||
public void complete(CompletableFuture<Boolean> future, Runnable success, Runnable failure,
|
|
||||||
Consumer<Throwable> errors) {
|
|
||||||
future.whenComplete((result, error) -> {
|
|
||||||
try {
|
|
||||||
if (!isActive()) return;
|
|
||||||
if (error != null) errors.accept(error);
|
|
||||||
else if (Boolean.TRUE.equals(result)) success.run();
|
|
||||||
else failure.run();
|
|
||||||
} catch (Throwable ex) {
|
|
||||||
errors.accept(ex);
|
|
||||||
} finally {
|
|
||||||
finish();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+15
-47
@@ -23,56 +23,20 @@ import me.SuperRonanCraft.BetterRTP.versions.AsyncHandler;
|
|||||||
public class RTPPlayer {
|
public class RTPPlayer {
|
||||||
|
|
||||||
@Getter private final Player player;
|
@Getter private final Player player;
|
||||||
@Getter private final RTPOperationTracker.Operation operation;
|
|
||||||
private final RTP settings;
|
private final RTP settings;
|
||||||
@Getter WorldPlayer worldPlayer;
|
@Getter WorldPlayer worldPlayer;
|
||||||
@Getter RTP_TYPE type;
|
@Getter RTP_TYPE type;
|
||||||
@Getter int attempts;
|
@Getter int attempts;
|
||||||
//List<Location> attemptedLocations = new ArrayList<>();
|
//List<Location> attemptedLocations = new ArrayList<>();
|
||||||
|
|
||||||
RTPPlayer(Player player, RTP settings, WorldPlayer worldPlayer, RTP_TYPE type, RTPOperationTracker.Operation operation) {
|
RTPPlayer(Player player, RTP settings, WorldPlayer worldPlayer, RTP_TYPE type) {
|
||||||
this.operation = operation;
|
|
||||||
this.player = player;
|
this.player = player;
|
||||||
this.settings = settings;
|
this.settings = settings;
|
||||||
this.worldPlayer = worldPlayer;
|
this.worldPlayer = worldPlayer;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean isActive() {
|
|
||||||
if (!player.isOnline()) operation.finish();
|
|
||||||
return operation.isActive();
|
|
||||||
}
|
|
||||||
|
|
||||||
void logError(Throwable error) {
|
|
||||||
getPl().getLogger().log(java.util.logging.Level.WARNING, "RTP operation failed for " + player.getUniqueId(), error);
|
|
||||||
}
|
|
||||||
|
|
||||||
void runSafely(Runnable action) {
|
|
||||||
try {
|
|
||||||
if (isActive()) action.run();
|
|
||||||
} catch (Throwable error) {
|
|
||||||
try { operation.finish(); } finally { logError(error); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void afterPreEvent(boolean cancelled, Runnable continuation) {
|
|
||||||
if (cancelled) operation.finish();
|
|
||||||
else runSafely(continuation);
|
|
||||||
}
|
|
||||||
|
|
||||||
void awaitChunk(CompletableFuture<Chunk> chunk, Runnable continuation) {
|
|
||||||
chunk.whenComplete((result, error) -> runSafely(() -> {
|
|
||||||
if (error != null) {
|
|
||||||
try { operation.finish(); } finally { logError(error); }
|
|
||||||
} else continuation.run();
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
void randomlyTeleport(CommandSender sendi) {
|
void randomlyTeleport(CommandSender sendi) {
|
||||||
runSafely(() -> search(sendi));
|
|
||||||
}
|
|
||||||
|
|
||||||
private void search(CommandSender sendi) {
|
|
||||||
if (attempts >= settings.maxAttempts) //Cancel out, too many tries
|
if (attempts >= settings.maxAttempts) //Cancel out, too many tries
|
||||||
metMax(sendi, player);
|
metMax(sendi, player);
|
||||||
else { //Try again to find a safe location
|
else { //Try again to find a safe location
|
||||||
@@ -81,11 +45,11 @@ public class RTPPlayer {
|
|||||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||||
//Async Location finder
|
//Async Location finder
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
|
randomlyTeleport(sendi);
|
||||||
attempts++;
|
attempts++;
|
||||||
AsyncHandler.sync(() -> randomlyTeleport(sendi));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
AsyncHandler.async(() -> runSafely(() -> {
|
AsyncHandler.async(() -> {
|
||||||
Location loc;
|
Location loc;
|
||||||
if (event.getLocation() != null) // && WorldPlayer.checkIsValid(event.getLocation(), pWorld))
|
if (event.getLocation() != null) // && WorldPlayer.checkIsValid(event.getLocation(), pWorld))
|
||||||
loc = event.getLocation();
|
loc = event.getLocation();
|
||||||
@@ -99,21 +63,25 @@ public class RTPPlayer {
|
|||||||
}
|
}
|
||||||
attempts++; //Add an attempt
|
attempts++; //Add an attempt
|
||||||
//Load chunk and find out if safe location (asynchronously)
|
//Load chunk and find out if safe location (asynchronously)
|
||||||
AsyncHandler.sync(() -> runSafely(() -> {
|
AsyncHandler.sync(() -> {
|
||||||
try { //Prior to 1.12 this async chunk will NOT work
|
try { //Prior to 1.12 this async chunk will NOT work
|
||||||
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(loc);
|
CompletableFuture<Chunk> chunk = PaperLib.getChunkAtAsync(loc);
|
||||||
awaitChunk(chunk, () -> attempt(sendi, loc));
|
chunk.thenAccept(result -> {
|
||||||
|
//BetterRTP.debug("Checking location for " + p.getName());
|
||||||
|
attempt(sendi, loc);
|
||||||
|
});
|
||||||
} catch (IllegalStateException e) {
|
} catch (IllegalStateException e) {
|
||||||
//Legacy non-async support
|
//Legacy non-async support
|
||||||
attempt(sendi, loc);
|
attempt(sendi, loc);
|
||||||
|
} catch (Throwable ignored) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void attempt(CommandSender sendi, Location loc) {
|
private void attempt(CommandSender sendi, Location loc) {
|
||||||
if (!isActive()) return;
|
|
||||||
Location tpLoc;
|
Location tpLoc;
|
||||||
tpLoc = RandomLocation.getSafeLocation(worldPlayer.getWorldtype(), worldPlayer.getWorld(), loc, worldPlayer.getMinY(), worldPlayer.getMaxY(), worldPlayer.getBiomes());
|
tpLoc = RandomLocation.getSafeLocation(worldPlayer.getWorldtype(), worldPlayer.getWorld(), loc, worldPlayer.getMinY(), worldPlayer.getMaxY(), worldPlayer.getBiomes());
|
||||||
//attemptedLocations.add(loc);
|
//attemptedLocations.add(loc);
|
||||||
@@ -126,11 +94,11 @@ public class RTPPlayer {
|
|||||||
getPl().getCooldowns().add(player, worldPlayer.getWorld());
|
getPl().getCooldowns().add(player, worldPlayer.getWorld());
|
||||||
tpLoc.setYaw(player.getLocation().getYaw());
|
tpLoc.setYaw(player.getLocation().getYaw());
|
||||||
tpLoc.setPitch(player.getLocation().getPitch());
|
tpLoc.setPitch(player.getLocation().getPitch());
|
||||||
AsyncHandler.sync(() -> runSafely(() -> settings.teleport.sendPlayer(sendi, this, tpLoc)));
|
AsyncHandler.sync(() -> settings.teleport.sendPlayer(sendi, player, tpLoc, worldPlayer, attempts, type));
|
||||||
} else {
|
} else {
|
||||||
if (worldPlayer.getPlayerInfo().applyCooldown)
|
if (worldPlayer.getPlayerInfo().applyCooldown)
|
||||||
getPl().getCooldowns().removeCooldown(player, worldPlayer.getWorld());
|
getPl().getCooldowns().removeCooldown(player, worldPlayer.getWorld());
|
||||||
operation.finish();
|
getPl().getPInfo().getRtping().remove(player);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
randomlyTeleport(sendi);
|
randomlyTeleport(sendi);
|
||||||
@@ -142,7 +110,7 @@ public class RTPPlayer {
|
|||||||
private void metMax(CommandSender sendi, Player p) {
|
private void metMax(CommandSender sendi, Player p) {
|
||||||
settings.teleport.failedTeleport(p, sendi);
|
settings.teleport.failedTeleport(p, sendi);
|
||||||
getPl().getCooldowns().removeCooldown(p, worldPlayer.getWorld());
|
getPl().getCooldowns().removeCooldown(p, worldPlayer.getWorld());
|
||||||
operation.finish();
|
getPl().getPInfo().getRtping().remove(p);
|
||||||
//RTP Failed Event
|
//RTP Failed Event
|
||||||
Bukkit.getServer().getPluginManager().callEvent(new RTP_FailedEvent(this));
|
Bukkit.getServer().getPluginManager().callEvent(new RTP_FailedEvent(this));
|
||||||
}
|
}
|
||||||
|
|||||||
+31
-18
@@ -5,6 +5,7 @@ import java.util.Arrays;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
import io.papermc.lib.PaperLib;
|
import io.papermc.lib.PaperLib;
|
||||||
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
import me.SuperRonanCraft.BetterRTP.BetterRTP;
|
||||||
@@ -37,25 +38,37 @@ public class RTPTeleport {
|
|||||||
// CompletableFuture.allOf(asyncChunks.toArray(new CompletableFuture[] {})).cancel(true);
|
// CompletableFuture.allOf(asyncChunks.toArray(new CompletableFuture[] {})).cancel(true);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void sendPlayer(CommandSender sendi, RTPPlayer request, Location location) {
|
void sendPlayer(final CommandSender sendi, final Player p, final Location location, final WorldPlayer wPlayer,
|
||||||
Player p = request.getPlayer();
|
final int attempts, RTP_TYPE type) throws NullPointerException {
|
||||||
WorldPlayer wPlayer = request.getWorldPlayer();
|
|
||||||
int attempts = request.getAttempts();
|
|
||||||
RTP_TYPE type = request.getType();
|
|
||||||
Location oldLoc = p.getLocation();
|
Location oldLoc = p.getLocation();
|
||||||
loadingTeleport(p, sendi);
|
loadingTeleport(p, sendi); //Send loading message to player who requested
|
||||||
RTP_TeleportEvent event = new RTP_TeleportEvent(p, location, wPlayer.getWorldtype());
|
//List<CompletableFuture<Chunk>> asyncChunks = getChunks(location); //Get a list of chunks
|
||||||
getPl().getServer().getPluginManager().callEvent(event);
|
//playerLoads.put(p, asyncChunks);
|
||||||
if (!request.isActive()) return;
|
/*CompletableFuture.allOf(asyncChunks.toArray(new CompletableFuture[] {})).thenRun(() -> { //Async chunk load
|
||||||
Location loc = event.getLocation();
|
new BukkitRunnable() { //Run synchronously
|
||||||
request.getOperation().complete(PaperLib.teleportAsync(p, loc), () -> {
|
@Override
|
||||||
if (!request.isActive()) return;
|
public void run() {*/
|
||||||
afterTeleport(p, loc, wPlayer, attempts, oldLoc, type);
|
try {
|
||||||
if (sendi != p)
|
RTP_TeleportEvent event = new RTP_TeleportEvent(p, location, wPlayer.getWorldtype());
|
||||||
sendSuccessMsg(sendi, p.getName(), loc, wPlayer, false, attempts);
|
getPl().getServer().getPluginManager().callEvent(event);
|
||||||
if (type == RTP_TYPE.JOIN && getPl().getSettings().isRtpOnFirstJoin_SetAsRespawn())
|
Location loc = event.getLocation();
|
||||||
p.setBedSpawnLocation(loc, true);
|
PaperLib.teleportAsync(p, loc).thenRun(new BukkitRunnable() { //Async teleport
|
||||||
}, () -> failedTeleport(p, sendi), request::logError);
|
@Override
|
||||||
|
public void run() {
|
||||||
|
afterTeleport(p, loc, wPlayer, attempts, oldLoc, type);
|
||||||
|
if (sendi != p) //Tell player who requested that the player rtp'd
|
||||||
|
sendSuccessMsg(sendi, p.getName(), loc, wPlayer, false, attempts);
|
||||||
|
getPl().getPInfo().getRtping().remove(p); //No longer rtp'ing
|
||||||
|
//Save respawn location if first join
|
||||||
|
if (type == RTP_TYPE.JOIN) //RTP Type was Join
|
||||||
|
if (BetterRTP.getInstance().getSettings().isRtpOnFirstJoin_SetAsRespawn()) //Save as respawn is enabled
|
||||||
|
p.setBedSpawnLocation(loc, true); //True means to force a respawn even without a valid bed
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (Exception e) {
|
||||||
|
getPl().getPInfo().getRtping().remove(p); //No longer rtp'ing (errored)
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Effects
|
//Effects
|
||||||
|
|||||||
+1
-1
@@ -37,7 +37,7 @@ public class HelperRTP_Check {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isRTPing(Player player) {
|
private static boolean isRTPing(Player player) {
|
||||||
return getPl().getRTP().getOperations().contains(player.getUniqueId());
|
return getPl().getPInfo().getRtping().getOrDefault(player, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCoolingDown(Player player, WorldPlayer pWorld) {
|
public static boolean isCoolingDown(Player player, WorldPlayer pWorld) {
|
||||||
|
|||||||
-180
@@ -1,180 +0,0 @@
|
|||||||
package me.SuperRonanCraft.BetterRTP.player.rtp;
|
|
||||||
|
|
||||||
import org.bukkit.Chunk;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.junit.Test;
|
|
||||||
import java.lang.reflect.Proxy;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
|
||||||
import java.util.concurrent.atomic.AtomicInteger;
|
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
|
||||||
import static org.junit.Assert.*;
|
|
||||||
|
|
||||||
public class RTPOperationTest {
|
|
||||||
private final RTPOperationTracker tracker = new RTPOperationTracker();
|
|
||||||
private final UUID uuid = UUID.randomUUID();
|
|
||||||
private final Object session = new Object();
|
|
||||||
private final AtomicReference<Throwable> error = new AtomicReference<>();
|
|
||||||
|
|
||||||
private RTPOperationTracker.Operation start() { return tracker.start(uuid, session); }
|
|
||||||
private Runnable unexpected() { return () -> fail("Unexpected continuation"); }
|
|
||||||
|
|
||||||
private RTPPlayer request(RTPOperationTracker.Operation operation) {
|
|
||||||
Player player = (Player) Proxy.newProxyInstance(Player.class.getClassLoader(), new Class<?>[]{Player.class},
|
|
||||||
(proxy, method, args) -> {
|
|
||||||
if (method.getName().equals("isOnline")) return true;
|
|
||||||
if (method.getName().equals("getUniqueId")) return uuid;
|
|
||||||
throw new UnsupportedOperationException(method.getName());
|
|
||||||
});
|
|
||||||
return new RTPPlayer(player, null, null, RTP_TYPE.JOIN, operation) {
|
|
||||||
@Override void logError(Throwable failure) { error.set(failure); }
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void cancelledPreEventDoesNotStartInstantSearch() {
|
|
||||||
RTPOperationTracker.Operation operation = start();
|
|
||||||
request(operation).afterPreEvent(true, unexpected());
|
|
||||||
assertNull(error.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void cancelledPreEventDisposesDelayAndDoesNotSchedule() {
|
|
||||||
RTPOperationTracker.Operation operation = start();
|
|
||||||
AtomicInteger disposed = new AtomicInteger();
|
|
||||||
operation.onFinish(disposed::incrementAndGet);
|
|
||||||
request(operation).afterPreEvent(true, unexpected());
|
|
||||||
assertNull(error.get());
|
|
||||||
operation.finish();
|
|
||||||
assertEquals(1, disposed.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void exceptionalChunkFutureEndsOperation() {
|
|
||||||
RTPOperationTracker.Operation operation = start();
|
|
||||||
CompletableFuture<Chunk> future = new CompletableFuture<>();
|
|
||||||
request(operation).awaitChunk(future, unexpected());
|
|
||||||
RuntimeException failure = new RuntimeException("chunk load failed");
|
|
||||||
future.completeExceptionally(failure);
|
|
||||||
assertSame(failure, error.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void exceptionInChunkContinuationEndsOperation() {
|
|
||||||
RTPOperationTracker.Operation operation = start();
|
|
||||||
RuntimeException failure = new RuntimeException("location check failed");
|
|
||||||
request(operation).awaitChunk(CompletableFuture.completedFuture(null), () -> { throw failure; });
|
|
||||||
assertSame(failure, error.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void exceptionalTeleportFutureEndsOperation() {
|
|
||||||
RTPOperationTracker.Operation operation = start();
|
|
||||||
CompletableFuture<Boolean> future = new CompletableFuture<>();
|
|
||||||
operation.complete(future, unexpected(), unexpected(), error::set);
|
|
||||||
RuntimeException failure = new RuntimeException("teleport failed");
|
|
||||||
future.completeExceptionally(failure);
|
|
||||||
assertSame(failure, error.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void falseTeleportRunsFailureOnly() {
|
|
||||||
AtomicInteger failures = new AtomicInteger();
|
|
||||||
start().complete(CompletableFuture.completedFuture(false), unexpected(), failures::incrementAndGet, error::set);
|
|
||||||
assertEquals(1, failures.get());
|
|
||||||
assertNull(error.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void exceptionInPostTeleportEffectsStillCleansUp() {
|
|
||||||
RuntimeException failure = new RuntimeException("effect failed");
|
|
||||||
start().complete(CompletableFuture.completedFuture(true), () -> { throw failure; }, unexpected(), error::set);
|
|
||||||
assertSame(failure, error.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void successRunsOnceAndReleasesOperation() {
|
|
||||||
AtomicInteger successes = new AtomicInteger();
|
|
||||||
start().complete(CompletableFuture.completedFuture(true), successes::incrementAndGet, unexpected(), error::set);
|
|
||||||
assertEquals(1, successes.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void quitAndStaleCompletionCannotRemoveNewOperation() {
|
|
||||||
RTPOperationTracker.Operation old = start();
|
|
||||||
CompletableFuture<Boolean> future = new CompletableFuture<>();
|
|
||||||
old.complete(future, unexpected(), unexpected(), error::set);
|
|
||||||
tracker.cancel(uuid, session);
|
|
||||||
RTPOperationTracker.Operation current = tracker.start(uuid, new Object());
|
|
||||||
tracker.cancel(uuid, session);
|
|
||||||
future.complete(true);
|
|
||||||
old.finish();
|
|
||||||
assertTrue(current.isActive());
|
|
||||||
assertNull(error.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void reloadClearsAllAndRunsEachCleanupOnce() {
|
|
||||||
RTPOperationTracker.Operation first = start();
|
|
||||||
RTPOperationTracker.Operation second = tracker.start(UUID.randomUUID(), new Object());
|
|
||||||
AtomicInteger disposed = new AtomicInteger();
|
|
||||||
first.onFinish(disposed::incrementAndGet);
|
|
||||||
second.onFinish(disposed::incrementAndGet);
|
|
||||||
tracker.clear();
|
|
||||||
tracker.clear();
|
|
||||||
assertEquals(2, disposed.get());
|
|
||||||
assertFalse(first.isActive());
|
|
||||||
assertFalse(second.isActive());
|
|
||||||
first.onFinish(disposed::incrementAndGet);
|
|
||||||
assertEquals(3, disposed.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void cleanupFailureDoesNotRetainOtherOperations() {
|
|
||||||
RTPOperationTracker.Operation first = start();
|
|
||||||
RTPOperationTracker.Operation second = tracker.start(UUID.randomUUID(), new Object());
|
|
||||||
AtomicInteger disposed = new AtomicInteger();
|
|
||||||
first.onFinish(() -> { throw new IllegalStateException("task cancellation failed"); });
|
|
||||||
first.onFinish(disposed::incrementAndGet);
|
|
||||||
second.onFinish(disposed::incrementAndGet);
|
|
||||||
try { tracker.clear(); fail("Expected cleanup failure"); } catch (IllegalStateException expected) { }
|
|
||||||
assertEquals(2, disposed.get());
|
|
||||||
assertFalse(first.isActive());
|
|
||||||
assertFalse(second.isActive());
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test public void duplicateRequestCannotReplaceActiveRequest() {
|
|
||||||
RTPOperationTracker.Operation first = start();
|
|
||||||
assertNull(start());
|
|
||||||
assertTrue(first.isActive());
|
|
||||||
}
|
|
||||||
@Test public void lifecycleCleanupUnregistersListenerEvenWhenTaskCancelThrows() {
|
|
||||||
org.bukkit.event.HandlerList handlers = new org.bukkit.event.HandlerList();
|
|
||||||
org.bukkit.event.Listener listener = new org.bukkit.event.Listener() {};
|
|
||||||
org.bukkit.plugin.Plugin plugin = (org.bukkit.plugin.Plugin) Proxy.newProxyInstance(
|
|
||||||
org.bukkit.plugin.Plugin.class.getClassLoader(), new Class<?>[]{org.bukkit.plugin.Plugin.class},
|
|
||||||
(proxy, method, args) -> {
|
|
||||||
if (method.getName().equals("isEnabled")) return true;
|
|
||||||
throw new UnsupportedOperationException(method.getName());
|
|
||||||
});
|
|
||||||
handlers.register(new org.bukkit.plugin.RegisteredListener(listener, (target, event) -> {},
|
|
||||||
org.bukkit.event.EventPriority.NORMAL, plugin, false));
|
|
||||||
AtomicInteger cancelled = new AtomicInteger();
|
|
||||||
com.tcoded.folialib.wrapper.task.WrappedTask task = new com.tcoded.folialib.wrapper.task.WrappedTask() {
|
|
||||||
public void cancel() { cancelled.incrementAndGet(); throw new IllegalStateException("cancel failed"); }
|
|
||||||
public boolean isCancelled() { return cancelled.get() > 0; }
|
|
||||||
public org.bukkit.plugin.Plugin getOwningPlugin() { return plugin; }
|
|
||||||
public boolean isAsync() { return false; }
|
|
||||||
};
|
|
||||||
RTPOperationTracker.Operation operation = start();
|
|
||||||
operation.onFinish(() -> RTPDelay.dispose(task, listener));
|
|
||||||
try {
|
|
||||||
assertEquals(1, handlers.getRegisteredListeners().length);
|
|
||||||
try { tracker.clear(); fail("Expected task cancellation failure"); }
|
|
||||||
catch (IllegalStateException expected) { }
|
|
||||||
assertEquals(0, handlers.getRegisteredListeners().length);
|
|
||||||
assertEquals(1, cancelled.get());
|
|
||||||
assertFalse(tracker.contains(uuid));
|
|
||||||
} finally {
|
|
||||||
handlers.unregister(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -169,7 +169,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP</artifactId>
|
<artifactId>BetterRTP</artifactId>
|
||||||
<version>3.6.15</version>
|
<version>3.6.13</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- ProtocolLib -->
|
<!-- ProtocolLib -->
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ BetterRTP uses and is compiled with the following libraries:
|
|||||||
|
|
||||||
From this directory, run `mvn clean package` to build BetterRTP followed by BetterRTP Addons. Maven resolves Addons against the BetterRTP built in the same run; a separate `install` step is unnecessary.
|
From this directory, run `mvn clean package` to build BetterRTP followed by BetterRTP Addons. Maven resolves Addons against the BetterRTP built in the same run; a separate `install` step is unnecessary.
|
||||||
|
|
||||||
- BetterRTP JAR: `dist/BetterRTP-3.6.15.jar`
|
- BetterRTP JAR: `dist/BetterRTP-3.6.13.jar`
|
||||||
- Addons JAR: `dist/BetterRTPAddons-1.8.10.jar`
|
- Addons JAR: `dist/BetterRTPAddons-1.8.10.jar`
|
||||||
|
|
||||||
Both server-ready JARs are collected in `dist/`. `mvn clean` removes each selected plugin’s previous JARs from this folder; intermediate build files stay in `target/`. The `dev` profile still outputs directly to its configured server plugins folder.
|
Both server-ready JARs are collected in `dist/`. `mvn clean` removes each selected plugin’s previous JARs from this folder; intermediate build files stay in `target/`. The `dev` profile still outputs directly to its configured server plugins folder.
|
||||||
@@ -95,10 +95,10 @@ Use the website's schema-version database migrations before deploying these clie
|
|||||||
|
|
||||||
### Automatic Maven releases
|
### Automatic Maven releases
|
||||||
|
|
||||||
`.github/workflows/release.yml` runs on pushes to `master` (or manually from
|
`.github/workflows/release.yml` runs on pushes to `online-editor` (or manually from
|
||||||
that branch). It reads only the Core POM version, builds and verifies BetterRTP Core,
|
that branch). It reads only the Core POM version, builds and verifies BetterRTP Core,
|
||||||
runs the editor tests, and publishes a stable GitHub release with exactly one plugin
|
runs the editor tests, and publishes a stable GitHub release with exactly one plugin
|
||||||
JAR. For the current Core POM the title is `BetterRTP 3.6.15` and the tag is `v3.6.15`.
|
JAR. For the current Core POM the title is `BetterRTP 3.6.13` and the tag is `v3.6.13`.
|
||||||
This single-JAR release is compatible with the website's GitHub release importer.
|
This single-JAR release is compatible with the website's GitHub release importer.
|
||||||
|
|
||||||
Both Core and Addons editor-schema JSON files remain attached for the website editor.
|
Both Core and Addons editor-schema JSON files remain attached for the website editor.
|
||||||
|
|||||||
@@ -35,18 +35,6 @@ Validation: compiled the actual, unmodified PlayerDataManager and PlayerData sou
|
|||||||
|
|
||||||
Recommended correction: create session state explicitly on join; separate non-creating lookup from creation; invalidate the session on quit; carry a session token through callbacks. Save immutable UUID/count/timestamp snapshots captured before scheduling, without looking up PlayerData in the writer. Apply loaded results only if the original session is still current. An isOnline check alone still leaves check/remove/insert and reconnect races.
|
Recommended correction: create session state explicitly on join; separate non-creating lookup from creation; invalidate the session on quit; carry a session token through callbacks. Save immutable UUID/count/timestamp snapshots captured before scheduling, without looking up PlayerData in the writer. Apply loaded results only if the original session is still current. An isOnline check alone still leaves check/remove/insert and reconnect races.
|
||||||
|
|
||||||
## Implementation status: RTP operation cleanup
|
|
||||||
|
|
||||||
Finding 2 is addressed on `fix/rtp-operation-cleanup`, based on the deferred-lookup fix. The original findings below remain as historical evidence.
|
|
||||||
|
|
||||||
- Replaced the Player-keyed boolean map with a synchronized UUID-keyed operation registry. Each request has its own identity and session owner; duplicate starts are rejected, and stale completion/quit cannot remove a newer operation.
|
|
||||||
- Both pre-teleport cancellation modes end the operation. Chunk-load failures, synchronous work exceptions, unsuccessful teleport results, and exceptions in success effects also release it. Unexpected errors are logged.
|
|
||||||
- Quit, reload, and disable end active operations. Delay cleanup cancels its task and unregisters its listener, including when task cancellation throws. Cleanup is idempotent and clears resource callbacks.
|
|
||||||
- Deferred search/delay callbacks check whether their request remains active. Cancelled location-event retries increment attempts before scheduling another retry, avoiding recursive stack growth.
|
|
||||||
- Compatibility: the mutable `PlayerInfo.getRtping()` API was removed. Integrations checking activity should use `getRTP().getOperations().contains(player.getUniqueId())`; they must not independently mutate tracking state.
|
|
||||||
- Validation: `mvn -o -q -f BetterRTP-Core/pom.xml test` passed 19 tests (13 operation tests plus the existing 6 session tests). These exercise shared pre-event cancellation handling, actual chunk continuation handling, terminal future outcomes, cleanup after effect exceptions, stale completions, lifecycle cleanup, and Bukkit listener unregistration even when task cancellation fails. Full plugin event/scheduler integration on Paper/Folia has not been exercised.
|
|
||||||
- Limits: no timeout policy was added for a future that never completes while its player remains online. Logical cancellation does not guarantee cancellation of underlying chunk IO or an already-started teleport. Other menu, executor, and queue-generation findings remain separate work.
|
|
||||||
|
|
||||||
## 2. High: RTP operation map has permanent retention paths
|
## 2. High: RTP operation map has permanent retention paths
|
||||||
|
|
||||||
Evidence: `player/PlayerInfo.java:19,45-59`, `player/rtp/RTP.java:82-94`, `RTPDelay.java:31-36`, `RTPPlayer.java:64-76`, `RTPTeleport.java:55-71`, and `player/events/Leave.java:9-12`.
|
Evidence: `player/PlayerInfo.java:19,45-59`, `player/rtp/RTP.java:82-94`, `RTPDelay.java:31-36`, `RTPPlayer.java:64-76`, `RTPTeleport.java:55-71`, and `player/events/Leave.java:9-12`.
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>me.SuperRonanCraft</groupId>
|
<groupId>me.SuperRonanCraft</groupId>
|
||||||
<artifactId>BetterRTP-build</artifactId>
|
<artifactId>BetterRTP-build</artifactId>
|
||||||
<version>3.6.15</version>
|
<version>3.6.13</version>
|
||||||
<packaging>pom</packaging>
|
<packaging>pom</packaging>
|
||||||
<modules>
|
<modules>
|
||||||
<module>BetterRTP-Core</module>
|
<module>BetterRTP-Core</module>
|
||||||
|
|||||||
Reference in new issue
Block a user