Skip to content

Commit

Permalink
Merge branch 'PlayPro:master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
shotadft authored Dec 10, 2024
2 parents 966cbaf + b3db65d commit 6395438
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
13 changes: 10 additions & 3 deletions src/main/java/net/coreprotect/database/rollback/RollbackUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,17 @@ else if (mapData.get("modifiers") != null) {
List<Object> modifiers = (List<Object>) mapData.get("modifiers");

for (Object item : modifiers) {
Map<Attribute, Map<String, Object>> modifiersMap = (Map<Attribute, Map<String, Object>>) item;
for (Map.Entry<Attribute, Map<String, Object>> entry : modifiersMap.entrySet()) {
Map<Object, Map<String, Object>> modifiersMap = (Map<Object, Map<String, Object>>) item;
for (Map.Entry<Object, Map<String, Object>> entry : modifiersMap.entrySet()) {
try {
Attribute attribute = entry.getKey();
Attribute attribute = null;
if (entry.getKey() instanceof Attribute) {
attribute = (Attribute) entry.getKey();
}
else {
attribute = (Attribute) BukkitAdapter.ADAPTER.getRegistryValue((String) entry.getKey(), Attribute.class);
}

AttributeModifier modifier = AttributeModifier.deserialize(entry.getValue());
itemMeta.addAttributeModifier(attribute, modifier);
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/coreprotect/paper/Paper_v1_20.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public String getSkullOwner(Skull skull) {
if (skull.getPlayerProfile().getId() != null) {
owner = skull.getPlayerProfile().getId().toString();
}
else if (Config.getGlobal().MYSQL && owner.length() > 255) {
else if (Config.getGlobal().MYSQL && owner != null && owner.length() > 255) {
return owner.substring(0, 255);
}

Expand Down
3 changes: 3 additions & 0 deletions src/main/java/net/coreprotect/utility/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ public static CentralProcessor getProcessorInfo() {
if (System.getProperty("os.name").startsWith("Windows") && !System.getProperty("sun.arch.data.model").equals("64")) {
Class.forName("com.sun.jna.platform.win32.Win32Exception");
}
else if (System.getProperty("os.name").toLowerCase().contains("android") || System.getProperty("java.runtime.name").toLowerCase().contains("android")) {
return null;
}
Configurator.setLevel("oshi.hardware.common.AbstractCentralProcessor", Level.OFF);
SystemInfo systemInfo = new SystemInfo();
result = systemInfo.getHardware().getProcessor();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,12 +125,12 @@ public static List<List<Map<String, Object>>> serialize(ItemStack item, Material

if (itemMeta.hasAttributeModifiers()) {
for (Map.Entry<Attribute, AttributeModifier> entry : itemMeta.getAttributeModifiers().entries()) {
Map<Attribute, Map<String, Object>> attributeList = new HashMap<>();
Map<Object, Map<String, Object>> attributeList = new HashMap<>();
Attribute attribute = entry.getKey();
AttributeModifier modifier = entry.getValue();

itemMeta.removeAttributeModifier(attribute, modifier);
attributeList.put(attribute, modifier.serialize());
attributeList.put(BukkitAdapter.ADAPTER.getRegistryKey(attribute), modifier.serialize());
modifiers.add(attributeList);
}
}
Expand Down

0 comments on commit 6395438

Please sign in to comment.