Moar, fix API
This commit is contained in:
parent
0edb5458e5
commit
dfab659e53
165 changed files with 559 additions and 576 deletions
104
patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch
Normal file
104
patches/server/0172-Add-setPlayerProfile-API-for-Skulls.patch
Normal file
|
@ -0,0 +1,104 @@
|
|||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Fri, 19 Jan 2018 00:36:25 -0500
|
||||
Subject: [PATCH] Add setPlayerProfile API for Skulls
|
||||
|
||||
This allows you to create already filled textures on Skulls to avoid texture lookups
|
||||
which commonly cause rate limit issues with Mojang API
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
||||
index 5158ba8c1d03cc2ffbd576146c6f72377bf05233..060939a6720049a4fef345f228ce76517f7741a4 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java
|
||||
@@ -102,7 +102,22 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
|
||||
}
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
@Override
|
||||
+ public void setPlayerProfile(com.destroystokyo.paper.profile.PlayerProfile profile) {
|
||||
+ Preconditions.checkNotNull(profile, "profile");
|
||||
+ this.profile = com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile);
|
||||
+ }
|
||||
+
|
||||
+ @javax.annotation.Nullable
|
||||
+ @Override
|
||||
+ public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() {
|
||||
+ return profile != null ? com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitCopy(profile) : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
+ @Override
|
||||
+ @Deprecated // Paper
|
||||
public PlayerProfile getOwnerProfile() {
|
||||
if (!this.hasOwner()) {
|
||||
return null;
|
||||
@@ -112,11 +127,12 @@ public class CraftSkull extends CraftBlockEntityState<SkullBlockEntity> implemen
|
||||
}
|
||||
|
||||
@Override
|
||||
+ @Deprecated // Paper
|
||||
public void setOwnerProfile(PlayerProfile profile) {
|
||||
if (profile == null) {
|
||||
this.profile = null;
|
||||
} else {
|
||||
- this.profile = CraftPlayerProfile.validateSkullProfile(((CraftPlayerProfile) profile).buildGameProfile());
|
||||
+ this.profile = CraftPlayerProfile.validateSkullProfile(((com.destroystokyo.paper.profile.SharedPlayerProfile) profile).buildGameProfile()); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
index 70a683529534e1f82c35350accbfeeb5ae4ceb6b..2771dd62c04c8da890724fe03f836fdeba440c55 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java
|
||||
@@ -145,6 +145,19 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
return this.hasOwner() ? this.profile.getName() : null;
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ @Override
|
||||
+ public void setPlayerProfile(@org.jetbrains.annotations.Nullable com.destroystokyo.paper.profile.PlayerProfile profile) {
|
||||
+ setProfile((profile == null) ? null : com.destroystokyo.paper.profile.CraftPlayerProfile.asAuthlibCopy(profile));
|
||||
+ }
|
||||
+
|
||||
+ @org.jetbrains.annotations.Nullable
|
||||
+ @Override
|
||||
+ public com.destroystokyo.paper.profile.PlayerProfile getPlayerProfile() {
|
||||
+ return profile != null ? com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitCopy(profile) : null;
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public OfflinePlayer getOwningPlayer() {
|
||||
if (this.hasOwner()) {
|
||||
@@ -195,6 +208,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
}
|
||||
|
||||
@Override
|
||||
+ @Deprecated // Paper
|
||||
public PlayerProfile getOwnerProfile() {
|
||||
if (!this.hasOwner()) {
|
||||
return null;
|
||||
@@ -204,11 +218,12 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
}
|
||||
|
||||
@Override
|
||||
+ @Deprecated // Paper
|
||||
public void setOwnerProfile(PlayerProfile profile) {
|
||||
if (profile == null) {
|
||||
this.setProfile(null);
|
||||
} else {
|
||||
- this.setProfile(CraftPlayerProfile.validateSkullProfile(((CraftPlayerProfile) profile).buildGameProfile()));
|
||||
+ this.setProfile(CraftPlayerProfile.validateSkullProfile(((com.destroystokyo.paper.profile.SharedPlayerProfile) profile).buildGameProfile())); // Paper
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +260,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta {
|
||||
Builder<String, Object> serialize(Builder<String, Object> builder) {
|
||||
super.serialize(builder);
|
||||
if (this.profile != null) {
|
||||
- return builder.put(SKULL_OWNER.BUKKIT, new CraftPlayerProfile(this.profile));
|
||||
+ return builder.put(SKULL_OWNER.BUKKIT, new com.destroystokyo.paper.profile.CraftPlayerProfile(this.profile)); // Paper
|
||||
}
|
||||
return builder;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue