mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-03 02:33:43 +01:00 
			
		
		
		
	Merge branch 'breaking' of https://github.com/IntellectualSites/PlotSquared into breaking
This commit is contained in:
		@@ -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)));
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user