Skip to content
Open
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 codex-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>studio.magemonkey</groupId>
<artifactId>codex-parent</artifactId>
<version>1.1.1-R2.1-SNAPSHOT</version>
<version>1.1.1-R0.17-SNAPSHOT</version>
</parent>

<artifactId>codex-api</artifactId>
Expand Down Expand Up @@ -44,7 +44,7 @@
<dependency>
<groupId>com.nexomc</groupId>
<artifactId>nexo</artifactId>
<version>1.23</version>
<version>1.21.0</version>
<scope>provided</scope>
<exclusions>
<exclusion>
Expand Down
2 changes: 1 addition & 1 deletion codex-bungee/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>studio.magemonkey</groupId>
<artifactId>codex-parent</artifactId>
<version>1.1.1-R2.1-SNAPSHOT</version>
<version>1.1.1-R0.17-SNAPSHOT</version>
</parent>

<artifactId>codex-bungee</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
import net.minecraft.world.level.block.state.IBlockData;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.NamespacedKey;
import org.bukkit.Registry;
import org.bukkit.attribute.Attribute;
import org.bukkit.block.Block;
import org.bukkit.block.Skull;
Expand Down Expand Up @@ -57,7 +55,6 @@
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Base64;
import java.util.Locale;
import java.util.UUID;

public class NMSImpl implements NMS {
Expand Down Expand Up @@ -277,12 +274,6 @@ public void addSkullTexture(@NotNull ItemStack item, @NotNull String value, @Not
}
}

@NotNull
@Override
public Attribute getAttribute(String name) {
return Registry.ATTRIBUTE.getOrThrow(NamespacedKey.minecraft(name.toLowerCase(Locale.US)));
}

@Override
public Object getNMSCopy(@NotNull ItemStack item) {
return CraftItemStack.asNMSCopy(item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,9 +272,15 @@ public Objective registerNewObjective(Scoreboard scoreboard, Objective objective
@SuppressWarnings("deprecation")
public HoverEvent getHoverEvent(@NotNull ItemStack itemStack) {
String components = itemStack.getItemMeta() != null ? itemStack.getItemMeta().getAsString() : "{}";

// Fixing booleans
components = components.replaceAll(": ?0b", ": false")
.replaceAll(": ?1b", ": true")
.replaceAll(": ?(\\d+\\.\\d+)d", ": $1");
.replaceAll(": ?1b", ": true");

// Fixing numbers with f/d suffixes (e.g. "1.0f", "-2.5d")
// Removes quotes and suffix, leaves blank number (JSON)
components = components.replaceAll("\"((-?\\d+(?:\\.\\d+)?)[fd])\"", "$2");

return new HoverEvent(HoverEvent.Action.SHOW_ITEM,
new ComponentsShowItem(
itemStack.getType().getKey().toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class NMSImpl implements NMS {
public String getVersion() {
return "1.21.11";
}

@NotNull
@Override
public Object getConnection(Player player) {
Expand Down Expand Up @@ -272,10 +271,15 @@ public Objective registerNewObjective(Scoreboard scoreboard, Objective objective
@SuppressWarnings("deprecation")
public HoverEvent getHoverEvent(@NotNull ItemStack itemStack) {
String components = itemStack.getItemMeta() != null ? itemStack.getItemMeta().getAsString() : "{}";

// Fixing booleans
components = components.replaceAll(": ?0b", ": false")
.replaceAll(": ?1b", ": true")
.replaceAll(": ?(\\d+\\.\\d+)d", ": $1")
.replaceAll("\\b(\\d+\\.\\d+)f\\b", "$1");
.replaceAll(": ?1b", ": true");

// Fixing numbers with f/d suffixes (e.g. "1.0f", "-2.5d")
// Removes quotes and suffix, leaves blank number (JSON)
components = components.replaceAll("\"((-?\\d+(?:\\.\\d+)?)[fd])\"", "$2");

return new HoverEvent(HoverEvent.Action.SHOW_ITEM,
new ComponentsShowItem(
itemStack.getType().getKey().toString(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,12 +284,19 @@ public Objective registerNewObjective(Scoreboard scoreboard, Objective objective
}

@Override
@SuppressWarnings("deprecation")
public HoverEvent getHoverEvent(@NotNull ItemStack itemStack) {
//System.out.println("[DEBUG] getHoverEvent FIXED for 1.21.7");
String components = itemStack.getItemMeta() != null ? itemStack.getItemMeta().getAsString() : "{}";

// Fixing booleans
components = components.replaceAll(": ?0b", ": false")
.replaceAll(": ?1b", ": true")
.replaceAll(": ?(\\d+\\.\\d+)d", ": $1");
.replaceAll(": ?1b", ": true");

// Fixing numbers with f/d suffixes (with or without quotes)
components = components.replaceAll("(-?\\d+(?:\\.\\d+)?)[fd]", "$1");

//System.out.println("[DEBUG] After fix: " + components);

return new HoverEvent(HoverEvent.Action.SHOW_ITEM,
new ComponentsShowItem(
itemStack.getType().getKey().toString(),
Expand Down
3 changes: 2 additions & 1 deletion codex-nms/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<description>A collection of NMS libraries for Codex</description>

<modules>
<module>codex-nms-v1_16_5</module>

<module>codex-nms-v1_17_1</module>
<module>codex-nms-v1_18_2</module>
<module>codex-nms-v1_19_4</module>
Expand All @@ -43,6 +43,7 @@
<module>codex-nms-v1_21_7</module>
<module>codex-nms-v1_21_10</module>
<module>codex-nms-v1_21_11</module>

</modules>

<dependencies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public IUserManager(@NotNull P plugin) {

@Override
public void setup() {
this.activeUsers = new HashMap<>();
this.activeUsers = new ConcurrentHashMap<>();
this.toSave = ConcurrentHashMap.newKeySet();
this.isPassJoin = ConcurrentHashMap.newKeySet();
this.toCreate = ConcurrentHashMap.newKeySet();
Expand Down