Will armor protection enchantments stack in minecraft

The test

I hit my friend with different weapons, who is equipped with full diamond armor, but with different enchantment combinations. (e.g. Only Helmet is enchanted; Helmet and Chestplate; Only Leggings; etc.) I also wrote a tiny plugin that outputs the raw, adjusted damage received by a person and conducted multiple tests to determine the effects of enchantments on armor.

This is the plugin deployed on a Minecraft Java version server running on PaperSpigot 1.10.2 with API version 1.10.2.-R0.1-SNAPSHOT.

package com.fivefourdee.damagenotifier;

import org.bukkit.Bukkit;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.plugin.java.JavaPlugin;

public class DamageNotifier extends JavaPlugin implements Listener{
    @Override
    public void onEnable(){
        Bukkit.getPluginManager().registerEvents(this,this);
    }
    @EventHandler
    public void onEntityDamage(EntityDamageEvent event) {
        event.getEntity().sendMessage(event.getCause().toString()+" > "+event.getFinalDamage());
    }   
}

The results

A Diamond Sword is used for the tests below.

Test 1.0: Base damage test

Gear                                            Raw damage / damage compared to base

Helmet
Chestplate
Leggings
Boots                                                 1.8899998664855957  /  100.00%

Test 1.1: Multiple armor pieces owning the same Enchantment

Gear                                            Raw damage / damage compared to base

Protection IV Helmet
Chestplate
Leggings
Boots                                                 1.5875999927520752  /  84.000%

Protection IV Helmet
Protection IV Chestplate
Leggings
Boots                                                 1.2851998805999756  /  68.000%

Protection IV Helmet
Protection IV Chestplate
Protection IV Leggings
Boots                                                 0.9827998876571655  /  52.000%

Protection IV Helmet
Protection IV Chestplate
Protection IV Leggings
Protection IV Boots                                   0.6803998947143555  /  36.000%

Test 1.2: Same armor pieces owning different levels of same Enchantment

Gear                                            Raw damage / damage compared to base

Protection IV Helmet
Protection I Chestplate
Leggings
Boots                                                 1.5119999647140503  /  80.000%

Protection IV Helmet
Protection II Chestplate
Leggings
Boots                                                 1.4363999366760254  /  76.000%

Protection IV Helmet
Protection III Chestplate
Leggings
Boots                                                 1.3607999086360005  /  72.000%

A Bow with minimum pull before release is used for the tests below. Minimum pull is used due to fluctuation of data if maximum pull is used instead, as seen below:

enter image description here

Test 2.0: Base damage test

Gear                                            Raw damage / damage compared to base

Helmet
Chestplate
Leggings
Boots                                                 0.20999997854232788 /  100.00%

Test 2.1: Multiple armor pieces owning the same Enchantment

Gear                                            Raw damage / damage compared to base

Projectile Protection II Helmet
Chestplate
Leggings
Boots                                                 0.17639999091625214 /  84.000%

Projectile Protection II Helmet
Projectile Protection II Chestplate
Leggings
Boots                                                 0.1427999883890152  /  68.000%

Projectile Protection II Helmet
Projectile Protection II Chestplate
Projectile Protection II Leggings
Boots                                                 0.10919998586177826 /  52.000%

Projectile Protection II Helmet
Projectile Protection II Chestplate
Projectile Protection II Leggings
Projectile Protection II Boots                        0.07559999823570251 /  36.000%

Test 2.2: Same armor piece owning different levels of same Enchantment

Gear                                            Raw damage / damage compared to base

Protection II Helmet
Chestplate
Leggings
Boots                                                 0.1931999772787094  /  92.000%

Protection II Helmet
Projectile Protection I Chestplate
Leggings
Boots                                                 0.17639999091625214 /  84.000%

Protection II Helmet
Projectile Protection II Chestplate
Leggings
Boots                                                 0.15959997475147247 /  76.000%

The conclusion

In Java version, Protection Enchantments stack, and the mechanism is less complicated than you think. For each Protection Enchantment, the added damage reduction is linearly added to the total percentage (+4%). For each specific damage type Protection Enchantment, the added damage reduction is also linearly added to the total percentage (+8%).

Feel free to come up with more "what if" situations so I can directly test it and update the results here.