Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

EntityDamageEvent Issue?

Comments in 'Plugin Development' started by Legoboy0215, Oct 25, 2015.

  1. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    I have this code:
    PHP:
    public function onDamage(EntityDamageEvent $event){
            
    $player $event->getEntity();
            
    $map $player->getLevel()->getName();
            if(
    in_array($map$this->setting->get("pvp_disabled_worlds"))){
                
    $event->setCancelled();
            }
        }
    But if I PVP in a world that is not in the array, I STILL can not PVP. What is the reason?
  2. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    Are you sure that this code is cancelling it, not another plugin?
    And how did you define $this->setting?
  3. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    PHP:
    $this->setting = new Config(/*Blah Blah*/);
    Yes, this is the code.
  4. zombie_Power
    Offline

    zombie_Power Active Member

    Joined:
    Sep 7, 2015
    Posts:
    239
    Minecraft User:
    Zombie_Power
    are you trying to block pvping?
    Legoboy0215 likes this.
  5. Svile
    Offline

    Svile Active Member

    Joined:
    Mar 30, 2015
    Posts:
    239
    Minecraft User:
    svile
    how the config file is set ?
  6. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Maybe you have another plugin or PocketMine settings that disabled PvP?
    CraftYourBukkit likes this.
  7. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    You should also make everything strtolower() for no complications.
  8. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Hello! Everything is processed with strtolower already. Yes, I have PvP on. I only have one bad solution: setCancelled(false);
    The config file is an array.
  9. jojoe77777
    Offline

    jojoe77777 Notable Member Plugin Developer

    Joined:
    May 28, 2015
    Posts:
    653
    Plugins:
    1
    Minecraft User:
    jojoe77777
    You can't uncancel an event.
  10. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    In fact, that is the only solution until now that works.
  11. Primus
    Offline

    Primus Notable Member

    Joined:
    Apr 7, 2015
    Posts:
    1,470
    Minecraft User:
    PrimusLV
    It's called $force.
  12. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    You can.
    Then that means another plugin, or PocketMine itself, wants the plugin to be cancelled. Check your spawn protection, difficulty, PvP mode, etc. in server.properties.
  13. Legoboy0215
    Offline

    Legoboy0215 Notable Member

    Joined:
    Nov 1, 2014
    Posts:
    1,724
    Minecraft User:
    Legoboy0215
    Um.. PeacefulSpawn?

Share This Page

Advertisement