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); EventUtil.manager.doJoinTask(pp);
}, 20); }, 20);
if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.s()) && if (pp.hasPermission(Captions.PERMISSION_ADMIN_UPDATE_NOTIFICATION.s())
PlotSquared.get().getUpdateUtility() != null) { && PlotSquared.get().getUpdateUtility() != null) {
final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility(); final UpdateUtility updateUtility = PlotSquared.get().getUpdateUtility();
final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class); final BukkitMain bukkitMain = BukkitMain.getPlugin(BukkitMain.class);
updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(), ((updateDescription, throwable) -> { updateUtility.checkForUpdate(bukkitMain.getPluginVersionString(),
((updateDescription, throwable) -> {
if (throwable != null) { if (throwable != null) {
bukkitMain.getLogger().severe(String.format("Could not check for update. Reason: %s", bukkitMain.getLogger().severe(String
.format("Could not check for update. Reason: %s",
throwable.getMessage())); throwable.getMessage()));
} else { } else {
if (updateDescription != null) { if (updateDescription != null) {
new PlotMessage("-------- ").color("$2").text("PlotSquared Update Notification").color("$1").text(" --------").color("$2") new PlotMessage("-------- ").color("$2")
.send(pp); .text("PlotSquared Update Notification").color("$1")
new PlotMessage("There appears to be a PlotSquared update available!").color("$1").send(pp); .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," new PlotMessage(String.format("You are running version %s,"
+ " the newest available version is %s", bukkitMain.getPluginVersionString(), updateDescription.getVersion())).color("$1").send(pp); + " the newest available version is %s",
new PlotMessage("Update URL").color("$1").text(": ").color("$2").text(updateDescription.getUrl()).tooltip("Download update").send(pp); bukkitMain.getPluginVersionString(),
new PlotMessage("-------- ").color("$2").text("PlotSquared Update Notification").color("$1").text(" --------").color("$2") updateDescription.getVersion())).color("$1").send(pp);
new PlotMessage("Update URL").color("$1").text(": ").color("$2")
.text(updateDescription.getUrl()).tooltip("Download update")
.send(pp); .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; return;
} }
Entity victim = event.getEntity(); Entity victim = event.getEntity();
if (!entityDamage(damager, victim)) { if (!entityDamage(damager, victim, event.getCause())) {
if (event.isCancelled()) { if (event.isCancelled()) {
if (victim instanceof Ageable) { if (victim instanceof Ageable) {
Ageable ageable = (Ageable) victim; 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 dloc = BukkitUtil.getLocation(damager);
Location vloc = BukkitUtil.getLocation(victim); Location vloc = BukkitUtil.getLocation(victim);
PlotArea dArea = dloc.getPlotArea(); PlotArea dArea = dloc.getPlotArea();
PlotArea vArea = PlotArea vArea;
dArea != null && dArea.contains(vloc.getX(), vloc.getZ()) ? dArea : vloc.getPlotArea(); if (dArea != null && dArea.contains(vloc.getX(), vloc.getZ())) {
vArea = dArea;
} else {
vArea = vloc.getPlotArea();
}
if (dArea == null && vArea == null) { if (dArea == null && vArea == null) {
return true; return true;
} }
Plot dplot = dArea != null ? dArea.getPlot(dloc) : null; Plot dplot;
Plot vplot = vArea != null ? vArea.getPlot(vloc) : null; if (dArea != null) {
dplot = dArea.getPlot(dloc);
} else {
dplot = null;
}
Plot vplot;
if (vArea != null) {
vplot = vArea.getPlot(vloc);
} else {
vplot = null;
}
Plot plot; Plot plot;
String stub; String stub;
@ -2860,6 +2888,13 @@ import java.util.regex.Pattern;
.equals(dplot.guessOwner(), vplot.guessOwner()))) { .equals(dplot.guessOwner(), vplot.guessOwner()))) {
return vplot != null && Flags.PVE.isTrue(vplot); 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 return ((vplot != null && Flags.PVE.isTrue(vplot)) || !(damager instanceof Arrow
&& !(victim instanceof Creature))); && !(victim instanceof Creature)));
} }

View File

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