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;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean satisfied = requirement.isSatisfied(this, this);
|
boolean satisfied;
|
||||||
|
try {
|
||||||
|
satisfied = requirement.isSatisfied(this, this);
|
||||||
|
} catch (Exception e) {
|
||||||
|
satisfied = false;
|
||||||
|
}
|
||||||
data.updateTicks(false);
|
data.updateTicks(false);
|
||||||
data.data(satisfied);
|
data.data(satisfied);
|
||||||
if (!satisfied) {
|
if (!satisfied) {
|
||||||
@@ -456,7 +461,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
data = new TimeStampData<>(satisfied, currentTicks, true);
|
||||||
cachedRequirements.put(requirement.countId(), data);
|
cachedRequirements.put(requirement.countId(), data);
|
||||||
if (!satisfied) {
|
if (!satisfied) {
|
||||||
@@ -479,7 +489,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
boolean satisfied = requirement.isSatisfied(this, another);
|
boolean satisfied;
|
||||||
|
try {
|
||||||
|
satisfied = requirement.isSatisfied(this, another);
|
||||||
|
} catch (Exception e) {
|
||||||
|
satisfied = false;
|
||||||
|
}
|
||||||
data.updateTicks(false);
|
data.updateTicks(false);
|
||||||
data.data(satisfied);
|
data.data(satisfied);
|
||||||
if (!satisfied) {
|
if (!satisfied) {
|
||||||
@@ -487,7 +502,12 @@ public abstract class AbstractCNPlayer<P> implements CNPlayer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} 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);
|
data = new TimeStampData<>(satisfied, currentTicks, true);
|
||||||
innerMap.put(another, data);
|
innerMap.put(another, data);
|
||||||
if (!satisfied) {
|
if (!satisfied) {
|
||||||
|
|||||||
@@ -526,15 +526,32 @@ public class BukkitPlatform implements Platform {
|
|||||||
Placeholder placeholder;
|
Placeholder placeholder;
|
||||||
if (id.startsWith("%rel_")) {
|
if (id.startsWith("%rel_")) {
|
||||||
placeholder = plugin.getPlaceholderManager().registerRelationalPlaceholder(id,
|
placeholder = plugin.getPlaceholderManager().registerRelationalPlaceholder(id,
|
||||||
// viewer // owner
|
(p1, p2) -> {
|
||||||
(p1, p2) -> PlaceholderAPI.setRelationalPlaceholders((Player) p2.player(), (Player) p1.player(), id));
|
try {
|
||||||
|
return PlaceholderAPI.setRelationalPlaceholders((Player) p2.player(), (Player) p1.player(), id);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else if (id.startsWith("%shared_")) {
|
} else if (id.startsWith("%shared_")) {
|
||||||
String sub = "%" + id.substring("%shared_".length());
|
String sub = "%" + id.substring("%shared_".length());
|
||||||
placeholder =plugin.getPlaceholderManager().registerSharedPlaceholder(id,
|
placeholder =plugin.getPlaceholderManager().registerSharedPlaceholder(id,
|
||||||
() -> PlaceholderAPI.setPlaceholders(null, sub));
|
() -> {
|
||||||
|
try {
|
||||||
|
return PlaceholderAPI.setPlaceholders(null, sub);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return sub;
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
placeholder = plugin.getPlaceholderManager().registerPlayerPlaceholder(id,
|
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;
|
return placeholder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user