Skip to content

Commit bf989cf

Browse files
committed
Add creative setting, reformat name of config value
1 parent dfc825c commit bf989cf

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

eternalcombat-plugin/src/main/java/com/eternalcode/combat/config/implementation/PluginConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,13 @@ public static class Settings extends OkaeriConfig {
6868
"# Setting this to true - admins cannot be tagged and will not tag other players on hit",
6969
"# Setting this to false - admins can be tagged and can tag other players on hit"
7070
})
71-
public boolean excludeAdminFromCombat = false;
71+
public boolean excludeOpFromCombat = false;
72+
73+
@Comment({"# If you want to exclude players in creative mode from combat, ",
74+
"# Setting this to true - players in creative mode cannot be tagged and will not tag other players on hit",
75+
"# Setting this to false - players in creative mode can be tag others"
76+
})
77+
public boolean excludeCreativeFromCombat = false;
7278

7379
@Comment("# Command blocking mode, available modes: WHITELIST, BLACKLIST")
7480
public WhitelistBlacklistMode commandBlockingMode = WhitelistBlacklistMode.BLACKLIST;

eternalcombat-plugin/src/main/java/com/eternalcode/combat/fight/controller/FightTagController.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import com.eternalcode.combat.config.implementation.PluginConfig;
55
import com.eternalcode.combat.fight.FightManager;
66
import com.eternalcode.combat.fight.event.CauseOfTag;
7+
import org.bukkit.GameMode;
78
import org.bukkit.entity.EntityType;
89
import org.bukkit.entity.Player;
910
import org.bukkit.entity.Projectile;
@@ -54,11 +55,13 @@ void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
5455
UUID attackedUniqueId = attackedPlayerByPerson.getUniqueId();
5556
UUID attackerUniqueId = attacker.getUniqueId();
5657

57-
if (attacker.isOp() && this.config.settings.excludeAdminFromCombat) {
58+
if (attacker.isOp() && this.config.settings.excludeOpFromCombat ||
59+
attacker.getGameMode().equals(GameMode.CREATIVE) && this.config.settings.excludeCreativeFromCombat ) {
5860
return;
5961
}
6062

61-
if (attackedPlayerByPerson.isOp() && this.config.settings.excludeAdminFromCombat) {
63+
if (attackedPlayerByPerson.isOp() && this.config.settings.excludeOpFromCombat ||
64+
attackedPlayerByPerson.getGameMode().equals(GameMode.CREATIVE) && this.config.settings.excludeCreativeFromCombat) {
6265
return;
6366
}
6467

0 commit comments

Comments
 (0)