Cancel Damage by Player

Discussion in 'Plugin Development' started by VideoMrz, Sep 7, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    VideoMrz

    I am all new to this stuff, and I am attempting to make a team versus team plugin.

    Since I am not sure how to do some things, so I am also using other plugins out there so that all plugins can be used to create a team versus team server.

    The part I'm stuck on is that I want players that are on the same team to not be able to hit each other. When a player joins a team they are given a permission that will identify them as a red or blue player. I need it to be so that players who have a permission, for example, "team.red" to not be able to hit other players who have the same permission. How would I go about doing this?
     
  2. Offline

    Deleted user

    VideoMrz
    EntityDamageEvent
    Entity instanceof Player

    e.setCancelled(true);
     
  3. Offline

    VideoMrz

    JHG0 Yes, I had that before, but how would I do it so that if they had permission "team.red" they couldn't hit players with "team.red"?
     
  4. Offline

    Deleted user

    VideoMrz
    Well you dont want them to have permissions
    You want them to join a team
    I'd suggest having /red and /blue command
    Make a hashmap and put them on it when they type the command
    And then
    Code:java
    1. if(blueTeam.contains(player.getName()) && blueTeam.contains(attacker.getName())) ||(redTeam.contains(player.getName()) && redTeam.contains(attacker.getName())){
    2. e.setCancelled(true);
    3. } else {
    4. e.setCancelled(false);
    5. }
    6.  
     
  5. Offline

    VideoMrz

    JHG0 I get an error.

    It says "Syntax error on token "||", invalid OnlySynchronized"
     
Thread Status:
Not open for further replies.

Share This Page