Fixes more warnings

This commit is contained in:
2023-06-23 21:51:30 +02:00
parent 9986e940c5
commit 75140cf97b
69 changed files with 142 additions and 175 deletions

View File

@@ -162,7 +162,7 @@ public class EngineCanCombatHappen extends Engine {
}
// ... PVP flag may cause a damage block ...
if (defenderPsFaction.getFlag(MFlag.getFlagPvp()) == false) {
if (!defenderPsFaction.getFlag(MFlag.getFlagPvp())) {
if (eattacker == null) {
// No attacker?
// Let's behave as if it were a player
@@ -198,7 +198,7 @@ public class EngineCanCombatHappen extends Engine {
// ... PVP flag may cause a damage block ...
// (just checking the defender as above isn't enough. What about the attacker? It could be in a no-pvp area)
// NOTE: This check is probably not that important, but we could keep it anyway.
if (attackerPsFaction.getFlag(MFlag.getFlagPvp()) == false) {
if (!attackerPsFaction.getFlag(MFlag.getFlagPvp())) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.PEACEFUL_LAND, event);
if (!ret && notify) {
uattacker.msg("<i>PVP is disabled in %s.", attackerPsFaction.describeTo(uattacker));
@@ -239,7 +239,7 @@ public class EngineCanCombatHappen extends Engine {
Rel relation = defendFaction.getRelationTo(attackFaction);
// Check the relation
if (relation.isFriend() && defenderPsFaction.getFlag(MFlag.getFlagFriendlyire()) == false) {
if (relation.isFriend() && !defenderPsFaction.getFlag(MFlag.getFlagFriendlyire())) {
ret = falseUnlessDisallowedPvpEventCancelled(attacker, defender, DisallowCause.FRIENDLYFIRE, event);
if (!ret && notify) {
uattacker.msg("<i>You can't hurt %s<i>.", relation.getDescPlayerMany());

View File

@@ -18,6 +18,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.plugin.EventExecutor;
import org.jetbrains.annotations.NotNull;
import java.util.Iterator;
import java.util.function.Predicate;
@@ -66,7 +67,7 @@ public class EngineChat extends Engine {
private static class SetFormatEventExecutor implements EventExecutor {
@Override
public void execute(Listener listener, Event event) throws EventException {
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!(event instanceof AsyncPlayerChatEvent)) {
return;
@@ -88,7 +89,7 @@ public class EngineChat extends Engine {
private static class ParseTagsEventExecutor implements EventExecutor {
@Override
public void execute(Listener listener, Event event) throws EventException {
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!(event instanceof AsyncPlayerChatEvent)) {
return;
@@ -117,7 +118,7 @@ public class EngineChat extends Engine {
private static class ParseRelcolorEventExecutor implements EventExecutor {
@Override
public void execute(Listener listener, Event event) throws EventException {
public void execute(@NotNull Listener listener, @NotNull Event event) throws EventException {
try {
if (!(event instanceof EventMassiveCorePlayerToRecipientChat)) {
return;

View File

@@ -123,9 +123,8 @@ public class EngineDenyTeleport extends Engine {
if (!mconf.allowEnderPearlInOtherTerritory && types.contains(TerritoryType.OTHER)) {
return Couple.valueOf(cause, TerritoryType.OTHER);
}
} else {
// Don't cancel other kinds of teleports
}
// Don't cancel other kinds of teleports
return null;
}

View File

@@ -112,7 +112,7 @@ public class EngineFly extends Engine {
if (event.getFlag() != MFlag.getFlagFly()) {
return;
}
if (event.isNewValue() == true) {
if (event.isNewValue()) {
return;
}