package roycurtis.signshopexport.json;

import com.google.gson.ExclusionStrategy;
import com.google.gson.FieldAttributes;

/** Exclusions class for blacklisting objects and fields in Gson */
public class Exclusions implements ExclusionStrategy
{
    @Override
    public boolean shouldSkipField(FieldAttributes f)
    {
        String name = f.getName();

        return
            // Ignore dynamic CraftBukkit handle field
            name.equalsIgnoreCase("handle")
            // Ignore book page contents
            || name.equalsIgnoreCase("pages")
            // Ignore unsupported tags
            || name.equalsIgnoreCase("unhandledTags")
            // Ignore redundant data object
            || name.equalsIgnoreCase("data")
            // Ignore hide flags
            || name.equalsIgnoreCase("hideFlag")
            // Ignore repair costs
            || name.equalsIgnoreCase("repairCost")
            // Ignore skull profiles
            || name.equalsIgnoreCase("profile")
            // Ignore shield patterns
            || name.equalsIgnoreCase("blockEntityTag")
            // Ignore 1.11 unbreakable tag
            || name.equalsIgnoreCase("unbreakable");
    }

    @Override
    public boolean shouldSkipClass(Class<?> clazz)
    {
        String name = clazz.getSimpleName();

        if ( name.equalsIgnoreCase("ItemStack") )
        if ( clazz.getTypeName().startsWith("net.minecraft.server") )
            return true;

        return name.equalsIgnoreCase("ChatComponentText");
    }
}
@@ -116,16 +116,42 @@
 butes;%0A%0A
+import java.util.Arrays;%0A%0A
 /** Excl
@@ -273,133 +273,74 @@
     
-@Override%0A    public boolean shouldSkipField(FieldAttributes f)%0A    %7B%0A        String name = f.getName();%0A%0A        return
+private static final String%5B%5D SKIPPED_FIELDS = new String%5B%5D
 %0A    
+%7B%0A
     
@@ -398,42 +398,16 @@
     
-    name.equalsIgnoreCase(
 %22handle%22
 )%0A  
@@ -402,22 +402,18 @@
 %22handle%22
-)%0A    
+,%0A
         
@@ -453,50 +453,17 @@
     
-    %7C%7C name.equalsIgnoreCase(
 %22pages%22
-)%0A    
+,%0A
     
@@ -505,37 +505,8 @@
     
-    %7C%7C name.equalsIgnoreCase(
 %22unh
@@ -516,22 +516,18 @@
 ledTags%22
-)%0A    
+,%0A
         
@@ -570,49 +570,16 @@
     
-    %7C%7C name.equalsIgnoreCase(%22data%22)%0A    
+%22data%22,%0A
     
@@ -615,37 +615,8 @@
     
-    %7C%7C name.equalsIgnoreCase(
 %22hid
@@ -621,17 +621,17 @@
 ideFlag%22
-)
+,
 %0A       
@@ -623,36 +623,32 @@
 eFlag%22,%0A        
-    
 // Ignore repair
@@ -666,37 +666,8 @@
     
-    %7C%7C name.equalsIgnoreCase(
 %22rep
@@ -674,28 +674,26 @@
 airCost%22
-)%0A  
+,%0A
         
   // Ign
@@ -676,34 +676,32 @@
 rCost%22,%0A        
-  
 // Ignore skull 
@@ -721,37 +721,8 @@
     
-    %7C%7C name.equalsIgnoreCase(
 %22pro
@@ -726,22 +726,18 @@
 profile%22
-)%0A    
+,%0A
         
@@ -774,37 +774,8 @@
     
-    %7C%7C name.equalsIgnoreCase(
 %22blo
@@ -786,22 +786,18 @@
 tityTag%22
-)%0A    
+,%0A
         
@@ -839,19 +839,178 @@
     
-    %7C%7C name
+%22unbreakable%22%0A    %7D;%0A%0A    @Override%0A    public boolean shouldSkipField(FieldAttributes f)%0A    %7B%0A        return Arrays.stream(SKIPPED_FIELDS)%0A            .anyMatch( s -%3E s
 .equ
@@ -1023,29 +1023,31 @@
 oreCase(
-%22unbreakable%22
+ f.getName() ) 
 );%0A    %7D
@@ -1165,16 +1165,84 @@
 ame();%0A%0A
+        // Skips vanilla ItemStacks, preferring Bukkit ones instead%0A
         
@@ -1379,16 +1379,54 @@
  true;%0A%0A
+        // Skip strings in books, etc%0A
         

Clean up skipped fields