33import com .eternalcode .combat .config .implementation .PluginConfig ;
44import com .eternalcode .combat .WhitelistBlacklistMode ;
55import com .eternalcode .combat .fight .FightManager ;
6+ import com .eternalcode .combat .fight .event .FightUntagEvent ;
67import com .eternalcode .combat .notification .NotificationAnnouncer ;
78import org .bukkit .Material ;
9+ import org .bukkit .Server ;
810import org .bukkit .block .Block ;
911import org .bukkit .entity .Player ;
1012import org .bukkit .event .EventHandler ;
@@ -24,11 +26,13 @@ public class FightActionBlockerController implements Listener {
2426 private final FightManager fightManager ;
2527 private final NotificationAnnouncer announcer ;
2628 private final PluginConfig config ;
29+ private final Server server ;
2730
28- public FightActionBlockerController (FightManager fightManager , NotificationAnnouncer announcer , PluginConfig config ) {
31+ public FightActionBlockerController (FightManager fightManager , NotificationAnnouncer announcer , PluginConfig config , Server server ) {
2932 this .fightManager = fightManager ;
3033 this .announcer = announcer ;
3134 this .config = config ;
35+ this .server = server ;
3236 }
3337
3438 @ EventHandler
@@ -123,6 +127,22 @@ void onFly(PlayerToggleFlightEvent event) {
123127 }
124128 }
125129
130+ @ EventHandler
131+ void onUnTag (FightUntagEvent event ) {
132+ if (!this .config .settings .shouldPreventFlying ) {
133+ return ;
134+ }
135+
136+ UUID uniqueId = event .getPlayer ();
137+ Player player = this .server .getPlayer (uniqueId );
138+
139+ if (player == null ) {
140+ return ;
141+ }
142+
143+ player .setAllowFlight (true );
144+ }
145+
126146 @ EventHandler
127147 void onDamage (EntityDamageEvent event ) {
128148 if (!this .config .settings .shouldElytraDisableOnDamage ) {
0 commit comments