mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking
This commit is contained in:
commit
4c788cb51e
@ -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)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user