[REQUEST] Prevent all DMG at /fly

Discussion in 'Archived: Plugin Requests' started by Semirotta, Aug 3, 2013.

  1. Plugin category: Protection(?)

    Suggested name: FlyDMG

    What I want: I need an plugin which allows me to block ALL DMG (hitting with items or hands) while player is in /fly


    Ideas for commands: No commands needed for this plugin.

    Ideas for permissions: Players with node - fly.nodmg cannot deal any damage to entities (animals, monsters, players).

    When I'd like it by: Any time soon.
     
  2. Offline

    Trevor1134

    Semirotta This sounds easy, so do you want it so when they are flying then cant deal nor take any damage, or?
     
  3. when they are up in the air. Really annoying when people "abuse" mob spawners with /fly :D
    They are flying in the air hitting / killing mobs while mobs cannot fight back. I just want to remove all dmg from FLYING persons. DMG in creative already is prevented but normal /fly in survival still deals.
     
  4. Offline

    Trevor1134

    Semirotta I will look into this in a while(1 hour at least) so if anyone else wants to do it, by all means.
     
  5. Its already almost 1 am for me, got to go sleep since early wake up in the morning. Contact me via private message

    So far haven't heard anything from Trevor1134, if someone wants to do this and manages to do it before Trevor, pls? :D

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 3, 2016
  6. Offline

    timtower Administrator Administrator Moderator

  7. I didnt try to get his attention, like he said
    "...so if anyone else wants to do it, by all means."
     
  8. Offline

    SainttX

    Semirotta https://mega.co.nz/#!fRoymCKZ!OXxYi3mUMpzQMPgxEqcPkiqHaM4qdH14mLrHV0Qck18 should work.

    Permission is flydamage.bypass; users with the permission won't be affected by the plugin. The plugin will cancel the players hitting monsters and shooting arrows.

    src:
    Code:java
    1. package me.sainttx.flydamage;
    2.  
    3. import org.bukkit.entity.Player;
    4. import org.bukkit.event.EventHandler;
    5. import org.bukkit.event.Listener;
    6. import org.bukkit.event.entity.EntityDamageByEntityEvent;
    7. import org.bukkit.event.entity.EntityShootBowEvent;
    8. import org.bukkit.plugin.java.JavaPlugin;
    9.  
    10. public final class FlyDamage extends JavaPlugin implements Listener {
    11.  
    12. public void onEnable() {
    13. getServer().getPluginManager().registerEvents(this, this);
    14. }
    15.  
    16. @EventHandler
    17. public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
    18. if (e.getDamager() instanceof Player){
    19. Player p = (Player) e.getDamager();
    20. if ((p.isFlying()) && !(p.hasPermission("flydamage.bypass"))){
    21. e.setCancelled(true);
    22. }
    23. }
    24. }
    25.  
    26. @EventHandler
    27. public void onEntityShootBowEvent(EntityShootBowEvent b) {
    28. if (b.getEntity() instanceof Player){
    29. Player p = (Player) b.getEntity();
    30. if ((p.isFlying()) && !(p.hasPermission("flydamage.bypass"))){
    31. b.setCancelled(true);
    32. }
    33. }
    34. }
    35.  
    36. public void onDisable() {
    37. }
    38.  
    39. }
    40.  
     
  9. Thank you! I'll test it out asap
    SainttX
    EDIT:
    I assume OP can still kill while /fly ? because i tried testing it as OP , i did /fly and then spawned a pig, killed it with a diamond sword :)
    EDIT2:
    OP or not OP, i can kill monsters and animals while flying.?
    EDIT3:
    VIP+ just tested, they can still kill monsters and animals.
     
  10. Offline

    SainttX

    Semirotta Sorry. Only tested using no plugins. This *should* work: https://mega.co.nz/#!ScJlzYAA!IDHc01z8TRlhcz5_1BqDz3h4Zcl1DC62OpMGn5OWTPA

    src:
    Code:java
    1. package me.sainttx.flydamage;
    2.  
    3. import java.util.logging.Logger;
    4.  
    5. import net.milkbowl.vault.permission.Permission;
    6.  
    7. import org.bukkit.entity.Player;
    8. import org.bukkit.event.EventHandler;
    9. import org.bukkit.event.Listener;
    10. import org.bukkit.event.entity.EntityDamageByEntityEvent;
    11. import org.bukkit.event.entity.EntityShootBowEvent;
    12. import org.bukkit.plugin.RegisteredServiceProvider;
    13. import org.bukkit.plugin.java.JavaPlugin;
    14.  
    15. public final class FlyDamage extends JavaPlugin implements Listener {
    16.  
    17. private static final Logger log = Logger.getLogger("Minecraft");
    18. public static Permission perms = null;
    19.  
    20. @Override
    21. public void onDisable() {
    22. log.info(String.format("[%s] Disabled Version %s", getDescription().getName(), getDescription().getVersion()));
    23. }
    24.  
    25. public void onEnable() {
    26. getServer().getPluginManager().registerEvents(this, this);
    27. setupPermissions();
    28. }
    29.  
    30. private boolean setupPermissions() {
    31. RegisteredServiceProvider<Permission> rsp = getServer().getServicesManager().getRegistration(Permission.class);
    32. perms = rsp.getProvider();
    33. return perms != null;
    34. }
    35.  
    36. @EventHandler
    37. public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent e) {
    38. if (e.getDamager() instanceof Player){
    39. Player p = (Player) e.getDamager();
    40. if ((p.isFlying()) && !(perms.has(p, "flydamage.bypass"))){
    41. e.setCancelled(true);
    42. }
    43. }
    44. }
    45.  
    46. @EventHandler
    47. public void onEntityShootBowEvent(EntityShootBowEvent b) {
    48. if (b.getEntity() instanceof Player){
    49. Player p = (Player) b.getEntity();
    50. if ((p.isFlying()) && !(perms.has(p, "flydamage.bypass"))){
    51. b.setCancelled(true);
    52. }
    53. }
    54. }
    55.  
    56. }
    57.  
     
  11. SainttX This one worked! Thank you very much! It is perfect, just what i needed!
     
  12. SainttX
    Ok i don't know why but it has stopped working, people can still fly and hit mobs but flying and arrows shooting is not doing dmg.
    PLUGINS LIST:
    (35): WorldBorder, bPermissions, LinksOnSigns, PTweaks, WorldEdit, Vault, Backpack, TerrainControl, WorldGuard, SilkSpawners, MChat, Parkour, UnhealthyDeath, CoreProtect, LimitedCreative, Mob Healthbars, Lockette, ZavAutoMessager, ProtocolLib, FoundOres Revisited, RandomTP, MobName, MakeYourOwnCommands, HorseTools, Essentials, AncientGates, OtherDrops, EssentialsSpawn, FlyDamage, NoItem, Enjin Minecraft Plugin, EssentialsAntiBuild, MCBans, SemiRPG, BKCommonLib
     
  13. Offline

    tomy123456

    try

    http://dev.bukkit.org/bukkit-plugins/noflypvp/

    block:
    pvp: true # Block PVP While Flying
    potions: true # Block Potions While Flying
    bowfire: true # Block Shooting A Bow While Flying (Overrides Player/Mob Bow Damage)
    bowdamageplayer: true # Block Shooting A Player With A Bow While Flying
    bowdamagemob: false # Block Shooting A Mob With A Bow While Flying
    blockbreak: false # Block Breaking Blocks While Flying
    blockplace: false # Block Placing Blocks While Flying
    bucketempty: false # Block Emptying Buckets While Flying
    bucketfill: false # Block Filling Buckets While Flying
    pickupitem: false # Block Picking Up Items While Flying
    pvp:
    disableflyonhit: true # Turn Off Fly When Hit By A Player (Aka DiveBomb)
    fallminhealth: 1 # Minimum Health To Leave A Player Whose Fly Was Turned Off
    mobdisablefly: false # Mobs That Deal Damage To A Player Turn Off Their Fly
     
  14. Offline

    AndyMcB1

    SainttX qucik java question.

    Would would that return?
     
  15. Offline

    timtower Administrator Administrator Moderator

    AndyMcB1 The permissions system that vault is using
     
  16. I just would need to get the plugin fixed I dont really understand why it stopped working all of a sudden. Perhaps its the SemiRPG that causes it? Don't know. I don't want a new plugin which brings so much useless stuff...
     

Share This Page