Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking

This commit is contained in:
Jesse Boyd 2019-04-13 12:23:24 +10:00
commit 1e78368115
No known key found for this signature in database
GPG key ID: 59F1DE6293AF6E1F
2 changed files with 55 additions and 20 deletions

View file

@ -632,24 +632,33 @@ import java.util.regex.Pattern;
EventUtil.manager.doJoinTask(pp);
}, 20);
if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.s()) &&
PlotSquared.get().getUpdateUtility() != null) {
final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class);
updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(), ((updateDescription, throwable) -> {
if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.s())
&& PlotSquared.get().getUpdateUtility() != null) {
final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class);
updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(),
((updateDescription, throwable) -> {
if (throwable != null) {
bukkitMain.getLogger().severe(String.format("Could not check for update. Reason: %s",
throwable.getMessage()));
bukkitMain.getLogger().severe(String
.format("Could not check for update. Reason: %s",
throwable.getMessage()));
} else {
if (updateDescription != null) {
new PlotMessage("-------- ").color("$2").text("PlotSquared Update Notification").color("$1").text(" --------").color("$2")
.send(pp);
new PlotMessage("There appears to be a PlotSquared update available!").color("$1").send(pp);
new PlotMessage("-------- ").color("$2")
.text("PlotSquared Update Notification").color("$1")
.text(" --------").color("$2").send(pp);
new PlotMessage("There appears to be a PlotSquared update available!")
.color("$1").send(pp);
new PlotMessage(String.format("You are running version %s,"
+ " the newest available version is %s", bukkitMain.getPluginVersionString(), updateDescription.getVersion())).color("$1").send(pp);
new PlotMessage("Update URL").color("$1").text(": ").color("$2").text(updateDescription.getUrl()).tooltip("Download update").send(pp);
new PlotMessage("-------- ").color("$2").text("PlotSquared Update Notification").color("$1").text(" --------").color("$2")
+ " the newest available version is %s",
bukkitMain.getPluginVersionString(),
updateDescription.getVersion())).color("$1").send(pp);
new PlotMessage("Update URL").color("$1").text(": ").color("$2")
.text(updateDescription.getUrl()).tooltip("Download update")
.send(pp);
new PlotMessage("-------- ").color("$2")
.text("PlotSquared Update Notification").color("$1")
.text(" --------").color("$2").send(pp);
}
}
}));
@ -2689,7 +2698,7 @@ import java.util.regex.Pattern;
return;
}
Entity victim = event.getEntity();
if (!entityDamage(damager, victim)) {
if (!entityDamage(damager, victim, event.getCause())) {
if (event.isCancelled()) {
if (victim instanceof Ageable) {
Ageable ageable = (Ageable) victim;
@ -2703,18 +2712,37 @@ import java.util.regex.Pattern;
}
}
public boolean entityDamage(Entity damager, Entity victim) {
private boolean entityDamage(Entity damager, Entity victim) {
return entityDamage(damager, victim, null);
}
private boolean entityDamage(Entity damager, Entity victim,
EntityDamageEvent.DamageCause cause) {
Location dloc = BukkitUtil.getLocation(damager);
Location vloc = BukkitUtil.getLocation(victim);
PlotArea dArea = dloc.getPlotArea();
PlotArea vArea =
dArea != null && dArea.contains(vloc.getX(), vloc.getZ()) ? dArea : vloc.getPlotArea();
PlotArea vArea;
if (dArea != null && dArea.contains(vloc.getX(), vloc.getZ())) {
vArea = dArea;
} else {
vArea = vloc.getPlotArea();
}
if (dArea == null && vArea == null) {
return true;
}
Plot dplot = dArea != null ? dArea.getPlot(dloc) : null;
Plot vplot = vArea != null ? vArea.getPlot(vloc) : null;
Plot dplot;
if (dArea != null) {
dplot = dArea.getPlot(dloc);
} else {
dplot = null;
}
Plot vplot;
if (vArea != null) {
vplot = vArea.getPlot(vloc);
} else {
vplot = null;
}
Plot plot;
String stub;
@ -2860,6 +2888,13 @@ import java.util.regex.Pattern;
.equals(dplot.guessOwner(), vplot.guessOwner()))) {
return vplot != null && Flags.PVE.isTrue(vplot);
}
//disable the firework damage. too much of a headache to support at the moment.
if (vplot != null) {
if (EntityDamageEvent.DamageCause.ENTITY_EXPLOSION == cause
&& damager.getType() == EntityType.FIREWORK) {
return false;
}
}
return ((vplot != null && Flags.PVE.isTrue(vplot)) || !(damager instanceof Arrow
&& !(victim instanceof Creature)));
}

View file

@ -32,7 +32,7 @@ ext {
date = git.head().getDate().format("yy.MM.dd")
revision = "-${git.head().abbreviatedId}"
parents = git.head().parentIds;
index = -2045; // Offset to match CI
index = -2039; // Offset to match CI
for (; parents != null && !parents.isEmpty(); index++) {
parents = git.getResolve().toCommit(parents.get(0)).getParentIds()
}