-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Full rewrite of the Stream Deck plugin
Note: Will likely wipe any settings setup already in the Stream Deck software
- Loading branch information
Showing
181 changed files
with
2,974 additions
and
4,529 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
effects.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/export/EffectExporter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package com.mosadie.effectmc.core.export; | ||
|
||
import com.google.gson.Gson; | ||
import com.google.gson.GsonBuilder; | ||
import com.mosadie.effectmc.core.EffectMCCore; | ||
import com.mosadie.effectmc.core.effect.internal.Effect; | ||
|
||
import java.io.File; | ||
import java.io.FileWriter; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public class EffectExporter { | ||
public static void main(String[] args) { | ||
System.out.println("Exporting effects..."); | ||
EffectMCCore core = new EffectMCCore(null, null, null); | ||
|
||
GsonBuilder builder = new GsonBuilder(); | ||
builder.setPrettyPrinting(); | ||
builder.registerTypeAdapter(Effect.class, new EffectSerializer()); | ||
Gson gson = builder.create(); | ||
|
||
String file = "effects.json"; | ||
|
||
if (args.length > 0) { | ||
file = args[0]; | ||
} | ||
|
||
File outputFile = new File(file); | ||
|
||
if (outputFile.exists()) { | ||
System.out.println("Output file already exists, overwriting..."); | ||
} | ||
|
||
|
||
try { | ||
FileWriter writer = new FileWriter(outputFile); | ||
writer.write(gson.toJson(core.getEffects().toArray(new Effect[0]))); | ||
writer.close(); | ||
System.out.println("Effects exported to " + outputFile.getAbsolutePath()); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
System.out.println("Failed to export effects: " + e.getMessage()); | ||
} | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/export/EffectListSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.mosadie.effectmc.core.export; | ||
|
||
import com.google.gson.*; | ||
import com.mosadie.effectmc.core.effect.internal.Effect; | ||
|
||
import java.lang.reflect.Type; | ||
import java.util.List; | ||
|
||
public class EffectListSerializer implements JsonSerializer<List<Effect>> { | ||
@Override | ||
public JsonElement serialize(List<Effect> src, Type typeOfSrc, JsonSerializationContext context) { | ||
JsonArray array = new JsonArray(); | ||
for (Effect effect : src) { | ||
array.add(context.serialize(effect)); | ||
} | ||
return array; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
MinecraftMod/core/src/main/java/com/mosadie/effectmc/core/export/EffectSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.mosadie.effectmc.core.export; | ||
|
||
import com.google.gson.*; | ||
import com.mosadie.effectmc.core.effect.internal.Effect; | ||
|
||
import java.lang.reflect.Type; | ||
|
||
public class EffectSerializer implements JsonSerializer<Effect> { | ||
|
||
@Override | ||
public JsonElement serialize(Effect src, Type typeOfSrc, JsonSerializationContext context) { | ||
JsonObject object = new JsonObject(); | ||
object.addProperty("id", src.getEffectId()); | ||
object.addProperty("name", src.getEffectName()); | ||
object.addProperty("tooltip", src.getEffectTooltip()); | ||
|
||
// Serialize the property manager as normal | ||
object.add("properties", context.serialize(src.getPropertyManager().getPropertiesList())); | ||
|
||
System.out.println("Effect serialized: " + src.getEffectName()); | ||
|
||
return object; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.