mirror of
https://github.com/kaboomserver/extras.git
synced 2025-08-06 20:43:01 +00:00
Skip API calls for offline players
This commit is contained in:
parent
00e7494dce
commit
95a3cbd175
1 changed files with 9 additions and 0 deletions
|
@ -1,7 +1,9 @@
|
||||||
package pw.kaboom.extras.modules.player;
|
package pw.kaboom.extras.modules.player;
|
||||||
|
|
||||||
|
import com.destroystokyo.paper.event.profile.PreLookupProfileEvent;
|
||||||
import com.destroystokyo.paper.profile.PlayerProfile;
|
import com.destroystokyo.paper.profile.PlayerProfile;
|
||||||
import com.destroystokyo.paper.profile.ProfileProperty;
|
import com.destroystokyo.paper.profile.ProfileProperty;
|
||||||
|
import com.google.common.base.Charsets;
|
||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.JsonParser;
|
import com.google.gson.JsonParser;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
@ -27,6 +29,7 @@ import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.net.URLConnection;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class PlayerConnection implements Listener {
|
public final class PlayerConnection implements Listener {
|
||||||
private PlayerProfile profile;
|
private PlayerProfile profile;
|
||||||
|
@ -85,6 +88,12 @@ public final class PlayerConnection implements Listener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
void onPlayerCommandSend2(final PreLookupProfileEvent event) {
|
||||||
|
UUID offlineUUID = UUID.nameUUIDFromBytes(("OfflinePlayer:" + event.getName()).getBytes(Charsets.UTF_8));
|
||||||
|
event.setUUID(offlineUUID);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
void onPlayerJoin(final PlayerJoinEvent event) {
|
void onPlayerJoin(final PlayerJoinEvent event) {
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue