Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependencies to 1.21.1 #1394

Merged
merged 2 commits into from
Sep 8, 2024
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
4 changes: 2 additions & 2 deletions platform/platform-modern/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper</artifactId>
<version>1.21-R0.1-SNAPSHOT</version>
<version>1.21.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import tc.oc.pgm.util.inventory.InventoryUtils;
import tc.oc.pgm.util.platform.Supports;

@Supports(value = PAPER, minVersion = "1.20.6")
@Supports(value = PAPER, minVersion = "1.21.1")
public class ModernInventoryUtil implements InventoryUtils.InventoryUtilsPlatform {

@Override
Expand Down Expand Up @@ -80,24 +80,26 @@ public EquipmentSlot getUsedHand(PlayerEvent event) {
}

@Override
public void setCanDestroy(ItemMeta itemMeta, Collection<Material> materials) {
// TODO: PLATFORM 1.20 no support for can place/destroy
@SuppressWarnings("removal")
public void setCanDestroy(ItemMeta itemMeta, Set<Material> materials) {
itemMeta.setCanDestroy(materials);
}

@Override
@SuppressWarnings("removal")
public Set<Material> getCanDestroy(ItemMeta itemMeta) {
// TODO: PLATFORM 1.20 no support for can place/destroy
return Collections.emptySet();
return itemMeta.getCanDestroy();
}

@Override
public void setCanPlaceOn(ItemMeta itemMeta, Collection<Material> materials) {
// TODO: PLATFORM 1.20 no support for can place/destroy
@SuppressWarnings("removal")
public void setCanPlaceOn(ItemMeta itemMeta, Set<Material> materials) {
itemMeta.setCanPlaceOn(materials);
}

@Override
@SuppressWarnings("removal")
public Set<Material> getCanPlaceOn(ItemMeta itemMeta) {
// TODO: PLATFORM 1.20 no support for can place/destroy
return Collections.emptySet();
return itemMeta.getCanPlaceOn();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public EquipmentSlot getUsedHand(PlayerEvent event) {
}

@Override
public void setCanDestroy(ItemMeta itemMeta, Collection<Material> materials) {
public void setCanDestroy(ItemMeta itemMeta, Set<Material> materials) {
itemMeta.setCanDestroy(materials);
}

Expand All @@ -83,7 +83,7 @@ public Set<Material> getCanDestroy(ItemMeta itemMeta) {
}

@Override
public void setCanPlaceOn(ItemMeta itemMeta, Collection<Material> materials) {
public void setCanPlaceOn(ItemMeta itemMeta, Set<Material> materials) {
itemMeta.setCanPlaceOn(materials);
}

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<dependency>
<groupId>dev.pgm.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.8_1.21-SNAPSHOT</version>
<version>1.8_1.21.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

Expand Down Expand Up @@ -164,7 +164,7 @@
<dependency>
<groupId>net.kyori</groupId>
<artifactId>adventure-platform-bukkit</artifactId>
<version>4.3.3</version>
<version>4.3.4</version>
<scope>compile</scope>
<!-- Exclude Spigot APIs since we already provide Bukkit -->
<exclusions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,29 +58,16 @@ public DefaultMapAdapter(Function<? super K, ? extends V> defaultProvider) {

@Override
public V get(Object key) {
V value = this.map.get(key);
if (value == null) {
value = this.defaultProvider.apply((K) key);
if (this.putDefault) this.map.put((K) key, value);
}
return value;
return this.putDefault ? getOrCreate((K) key) : getOrDefault((K) key);
}

public V getOrDefault(K key) {
V value = this.map.get(key);
if (value == null) {
value = this.defaultProvider.apply(key);
}
return value;
return value != null ? value : this.defaultProvider.apply((K) key);
}

public V getOrCreate(K key) {
V value = this.map.get(key);
if (value == null) {
value = this.defaultProvider.apply(key);
this.map.put(key, value);
}
return value;
return this.map.computeIfAbsent(key, this.defaultProvider);
}

public V getOrNull(K key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,6 @@ public static void consumeItem(PlayerEvent player) {
public interface InventoryUtilsPlatform {
Collection<PotionEffect> getPotionEffects(ItemStack item);

default boolean isUnbreakable(ItemStack item) {
return isUnbreakable(item.getItemMeta());
}

boolean isUnbreakable(ItemMeta item);

default void setUnbreakable(ItemStack item, boolean unbreakable) {
Expand All @@ -194,11 +190,11 @@ void applyAttributeModifiers(

EquipmentSlot getUsedHand(PlayerEvent event);

void setCanDestroy(ItemMeta itemMeta, Collection<Material> materials);
void setCanDestroy(ItemMeta itemMeta, Set<Material> materials);

Set<Material> getCanDestroy(ItemMeta itemMeta);

void setCanPlaceOn(ItemMeta itemMeta, Collection<Material> materials);
void setCanPlaceOn(ItemMeta itemMeta, Set<Material> materials);

Set<Material> getCanPlaceOn(ItemMeta itemMeta);
}
Expand Down
Loading