Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/main/java/catserver/api/annotation/Backported.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package catserver.api.annotation;

import java.lang.annotation.*;

/**
* Indicates that the annotated api method is backported from a newer version of Minecraft.
*/
@Documented
@Retention(RetentionPolicy.CLASS)
@Target({ElementType.METHOD, ElementType.TYPE})
public @interface Backported {
String from() default "";
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
package com.destroystokyo.paper.event.server;

import catserver.api.annotation.Backported;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

/**
* Called when the server has finished ticking the main loop
*/
@Backported(from = "1.13.2")
public class ServerTickEndEvent extends Event {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package com.destroystokyo.paper.event.server;

import catserver.api.annotation.Backported;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

@Backported(from = "1.13.2")
public class ServerTickStartEvent extends Event {

private static final HandlerList HANDLER_LIST = new HandlerList();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1543,6 +1543,13 @@ public org.bukkit.advancement.AdvancementProgress getAdvancementProgress(org.buk
return new CraftAdvancementProgress(craft, data, progress);
}

// CatRoom start - Backport APIs
@Override
public int getPing() {
return this.getHandle().ping;
}
// CatRoom end - Backport APIs

@Override
public String getLocale() {
return getHandle().language;
Expand Down
18 changes: 18 additions & 0 deletions src/main/java/org/bukkit/entity/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -1427,6 +1427,24 @@ public interface Player extends HumanEntity, Conversable, CommandSender, Offline
*/
public AdvancementProgress getAdvancementProgress(Advancement advancement);

// CatRoom start - Backport APIs
/**
* Gets the player's estimated ping in milliseconds.
*
* In Vanilla this value represents a weighted average of the response time
* to application layer ping packets sent. This value does not represent the
* network round trip time and as such may have less granularity and be
* impacted by other sources. For these reasons it <b>should not</b> be used
* for anti-cheat purposes. Its recommended use is only as a
* <b>qualitative</b> indicator of connection quality (Vanilla uses it for
* this purpose in the tab list).
*
* @return player ping
*/
@catserver.api.annotation.Backported(from = "1.17")
public int getPing();
// CatRoom end - Backport APIs

/**
* Gets the player's current locale.
*
Expand Down