mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-19 15:09:23 +00:00
catch more errors
This commit is contained in:
@@ -448,7 +448,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
boolean satisfied = requirement.isSatisfied(this, this);
|
||||
boolean satisfied;
|
||||
try {
|
||||
satisfied = requirement.isSatisfied(this, this);
|
||||
} catch (Exception e) {
|
||||
satisfied = false;
|
||||
}
|
||||
data.updateTicks(false);
|
||||
data.data(satisfied);
|
||||
if (!satisfied) {
|
||||
@@ -456,7 +461,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean satisfied = requirement.isSatisfied(this, this);
|
||||
boolean satisfied;
|
||||
try {
|
||||
satisfied = requirement.isSatisfied(this, this);
|
||||
} catch (Exception e) {
|
||||
satisfied = false;
|
||||
}
|
||||
data = new TimeStampData<>(satisfied, currentTicks, true);
|
||||
cachedRequirements.put(requirement.countId(), data);
|
||||
if (!satisfied) {
|
||||
@@ -479,7 +489,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
boolean satisfied = requirement.isSatisfied(this, another);
|
||||
boolean satisfied;
|
||||
try {
|
||||
satisfied = requirement.isSatisfied(this, another);
|
||||
} catch (Exception e) {
|
||||
satisfied = false;
|
||||
}
|
||||
data.updateTicks(false);
|
||||
data.data(satisfied);
|
||||
if (!satisfied) {
|
||||
@@ -487,7 +502,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
boolean satisfied = requirement.isSatisfied(this, another);
|
||||
boolean satisfied;
|
||||
try {
|
||||
satisfied = requirement.isSatisfied(this, another);
|
||||
} catch (Exception e) {
|
||||
satisfied = false;
|
||||
}
|
||||
data = new TimeStampData<>(satisfied, currentTicks, true);
|
||||
innerMap.put(another, data);
|
||||
if (!satisfied) {
|
||||
|
||||
@@ -526,15 +526,32 @@ public class BukkitPlatform implements Platform {
|
||||
Placeholder placeholder;
|
||||
if (id.startsWith("%rel_")) {
|
||||
placeholder = plugin.getPlaceholderManager().registerRelationalPlaceholder(id,
|
||||
// viewer // owner
|
||||
(p1, p2) -> PlaceholderAPI.setRelationalPlaceholders((Player) p2.player(), (Player) p1.player(), id));
|
||||
(p1, p2) -> {
|
||||
try {
|
||||
return PlaceholderAPI.setRelationalPlaceholders((Player) p2.player(), (Player) p1.player(), id);
|
||||
} catch (Exception e) {
|
||||
return id;
|
||||
}
|
||||
});
|
||||
} else if (id.startsWith("%shared_")) {
|
||||
String sub = "%" + id.substring("%shared_".length());
|
||||
placeholder =plugin.getPlaceholderManager().registerSharedPlaceholder(id,
|
||||
() -> PlaceholderAPI.setPlaceholders(null, sub));
|
||||
() -> {
|
||||
try {
|
||||
return PlaceholderAPI.setPlaceholders(null, sub);
|
||||
} catch (Exception e) {
|
||||
return sub;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
placeholder = plugin.getPlaceholderManager().registerPlayerPlaceholder(id,
|
||||
(p) -> p == null ? PlaceholderAPI.setPlaceholders(null, id) : PlaceholderAPI.setPlaceholders((OfflinePlayer) p.player(), id));
|
||||
(p) -> {
|
||||
try {
|
||||
return p == null ? PlaceholderAPI.setPlaceholders(null, id) : PlaceholderAPI.setPlaceholders((OfflinePlayer) p.player(), id);
|
||||
} catch (Exception e) {
|
||||
return id;
|
||||
}
|
||||
});
|
||||
}
|
||||
return placeholder;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user