-
-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestion: a setting to automatically disable flight over PvP plots #7504
Comments
It may be possible to implement this feature almost for free as a side-effect of implementing TownyAdvanced/TownyFlight#87. |
There is apparently already a feature in TownyFlight that accomplishes compliance with the EULA, albeit differently than I proposed here. The setting is |
One thing that I noticed in testing, is that a flying player was able to hurt me in a PvP area while I was not flying. I would like to have two players test that on each other, since maybe me being an admin exempts me from certain logics. |
/*
* Listener to turn off flight if flying player enters PVP combat. Runs only if
* the config.yml's disable_Combat_Prevention is set to true.
*/
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
private void playerPVPEvent(TownyPlayerDamagePlayerEvent event) {
Player attackingPlayer = event.getAttackingPlayer();
Player defendingPlayer = event.getVictimPlayer();
if (!attackingPlayer.getAllowFlight())
return;
if (attackingPlayer.getGameMode().equals(GameMode.CREATIVE) || !defendingPlayer.canSee(attackingPlayer)) {
event.setCancelled(true);
return;
}
TownyFlightAPI.getInstance().removeFlight(attackingPlayer, false, true, "pvp");
event.setCancelled(true);
} It only takes into consideration the attackingPlayer abusing their flight. When the setting in the config is true, TownyFlight registers the PVPListener: if (Settings.disableCombatPrevention)
pm.registerEvents(new PlayerPVPListener(), this); The config name might be a bit dumb... |
Thanks for the info and clarifications! So it looks like if both players have flight enabled (even if the defending one is on the ground), then PvP can happen with flight enabled. If a player with flight enabled attacks a player without flight enabled, then the damage is cancelled; and if the victim can see the aggressor, then the aggressor's flight is disabled. I wonder if it might be better / conceptually simpler to do something like the below pseudocode?:
The tl;dr of this, is that PvP is disabled in creative, attackers cannot start PvP while flying, and flight is removed from all participants when PvP starts. This doesn't allow combat between flying individuals at all, even if they both have it. If some servers want in-flight combat, I guess there could be a config option to control that. But I think in general this operates more how people might expect it to? Idk. |
So I think the issue is that for attacking players, we dont test if they are flying, only whether they are allowed to fly, and because of this you're seeing issues when grounded players attack other players. Am I correct? |
No, we tested someone who was flying attacking a grounded player. The grounded player took damage. The current code does not account for flying, only for whether flight is enabled for the attacker and whether they are technically within view of the defender. This allows for the possibility of sneak attacks in which flight offers a competitive advantage. My proposed code prevents that by thoroughly ensuring that flighted PvP is prevented in all cases. |
The code that is used right now does remove their flight when the attacker isn't in creative or vanished from the defending player. |
Can I see your townyflight config? |
Sure! Sorry for the delay -- have been really busy, and wanted to test again with a user first. All of our version-controlled configs can be found on our GitHub. Here's a link to the file you asked for: https://github.com/SettleScape/server/blob/main/minecraft/plugins/TownyFlight/config.yml The most-recent test was with |
There has been a mis-communication. The canSee test is to handle when a player is Vanished from another player. Ie: an admin is vanished and accidentally hits a player. |
If you saw the attacker's flight being removed, that is only done while also setting the event to cancelled: TownyFlightAPI.getInstance().removeFlight(attackingPlayer, false, true, "pvp");
event.setCancelled(true); There is likely another plugin that is overriding the towny TownyPlayerDamagePlayerEvent or the underlying bukkit damage event. |
Interesting -- thanks. I'll look into that. |
In Minecraft's new EULA and MUG, no entitlements may be sold that provide any kind of competitive advantage. In most cases, that includes flight; however, in a situation where paid flight is only possible in towns and never in PvP areas, and where that flight offers no competitive advantage to players (merely a building convenience), then flight can still reasonably be sold under the terms of the EULA and MUG.
In order for us to return to our member perks as they were before the new EULA and MUG, we need the ability to make flight automatically disable over PvP plots. The paltry sum I get through subscriptions is being re-donated in part to you (and atm I take a large loss on the server as a whole). In-town flight and afking without kicking were the two main perks of membership, and I fear that membership may not be not sufficiently worthwhile without that flight perk.
This feature is also useful for servers that do not monetize flight, because even in those cases, it helps to preserve a fair and even playing field for participants in PvP.
TownyAdvanced/TownyFlight#86 will likely become even more important with this change.
The text was updated successfully, but these errors were encountered: