Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceNiklas committed Oct 12, 2022
1 parent fc7d9a8 commit 22bddca
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
12 changes: 9 additions & 3 deletions src/main/java/com/spaceniklas/villagerfixes/Listeners.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,18 @@ public void onPlayerJoinEvent(PlayerJoinEvent e){

@EventHandler
public void onEntityDamageByEntityEvent(EntityDamageByEntityEvent e){
if(Villagerfixes.config.getBoolean("make-invincible-players-damage-vincible-entities") && countdown.get(e.getDamager()) != null && countdown.get(e.getDamager()) && countdown.get(e.getEntity()) == null || Villagerfixes.config.getBoolean("make-invincible-players-damage-vincible-entities") && countdown.get(e.getDamager()) != null && countdown.get(e.getDamager()) && !countdown.get(e.getEntity())) {
if(!e.isCancelled()){
e.setCancelled(false);
}

}else
if(countdown.get(e.getDamager()) != null && countdown.get(e.getDamager())){
e.setCancelled(true);
e.getDamager().sendMessage(ChatColor.translateAlternateColorCodes('&', Villagerfixes.config.getString("still-invincible")));
}else
e.getDamager().sendMessage(ChatColor.translateAlternateColorCodes('&', Villagerfixes.config.getString("still-invincible-damager")));
}
if(countdown.get(e.getEntity()) != null && countdown.get(e.getEntity())){
e.getDamager().sendMessage(ChatColor.translateAlternateColorCodes('&', Villagerfixes.config.getString("still-invincible")));
e.getDamager().sendMessage(ChatColor.translateAlternateColorCodes('&', Villagerfixes.config.getString("still-invincible-victim")));
e.setCancelled(true);
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ command-name: 'invincibility' #The name of the command you have to execute to es

#LANGUAGE SETTINGS
#You can use colour codes by doing & and then a letter or number. Reference image: https://www.spigotmc.org/attachments/example2-png.402641/
still-invincible: '&cYou are still in invincibility! Do &l/invincibility &r&cto disable your invincibility!' #Message send when player takes/gives damage to another entity.
still-invincible-victim: '&cYou are still in invincibility! Do &l/invincibility &r&cto disable your invincibility!' #Message send when player takes/gives damage to another entity.
still-invincible-damager: '&cThe player you are hitting is still in invincibility!' #Message send when player takes/gives damage to another entity.
already-vincible: '&cYou are already able to damage/get damaged by other entities! If you believe that this is a bug please contact a server administrator!' #If a player runs e.g /invisibility but is already vincible.
command-message: '&aYou are now able to damage/get damaged by other entities!' #Message when a player gets rid of their invisibility by command.
command-message: '&aYou are now able to damage/get damaged by other entities!' #Message when a player gets rid of their invisibility by command.
make-invincible-players-damage-vincible-entities: false #Does what it says ;)
6 changes: 4 additions & 2 deletions target/classes/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ command-name: 'invincibility' #The name of the command you have to execute to es

#LANGUAGE SETTINGS
#You can use colour codes by doing & and then a letter or number. Reference image: https://www.spigotmc.org/attachments/example2-png.402641/
still-invincible: '&cYou are still in invincibility! Do &l/invincibility &r&cto disable your invincibility!' #Message send when player takes/gives damage to another entity.
still-invincible-victim: '&cYou are still in invincibility! Do &l/invincibility &r&cto disable your invincibility!' #Message send when player takes/gives damage to another entity.
still-invincible-damager: '&cThe player you are hitting is still in invincibility!' #Message send when player takes/gives damage to another entity.
already-vincible: '&cYou are already able to damage/get damaged by other entities! If you believe that this is a bug please contact a server administrator!' #If a player runs e.g /invisibility but is already vincible.
command-message: '&aYou are now able to damage/get damaged by other entities!' #Message when a player gets rid of their invisibility by command.
command-message: '&aYou are now able to damage/get damaged by other entities!' #Message when a player gets rid of their invisibility by command.
make-invincible-players-damage-vincible-entities: false #Does what it says ;)

0 comments on commit 22bddca

Please sign in to comment.