forked from DFScripting/DFScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
217 additions
and
35 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
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
55 changes: 55 additions & 0 deletions
55
src/main/java/io/github/techstreet/dfscript/script/ScriptComment.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,55 @@ | ||
package io.github.techstreet.dfscript.script; | ||
|
||
import com.google.gson.JsonElement; | ||
import com.google.gson.JsonObject; | ||
import com.google.gson.JsonSerializationContext; | ||
import com.google.gson.JsonSerializer; | ||
import io.github.techstreet.dfscript.event.system.Event; | ||
import io.github.techstreet.dfscript.script.action.ScriptActionType; | ||
import io.github.techstreet.dfscript.script.argument.ScriptArgument; | ||
import io.github.techstreet.dfscript.script.argument.ScriptConfigArgument; | ||
import io.github.techstreet.dfscript.script.execution.ScriptActionContext; | ||
import io.github.techstreet.dfscript.script.execution.ScriptContext; | ||
import io.github.techstreet.dfscript.script.execution.ScriptScopeVariables; | ||
import io.github.techstreet.dfscript.script.execution.ScriptTask; | ||
|
||
import java.lang.reflect.Type; | ||
import java.util.HashMap; | ||
import java.util.List; | ||
import java.util.Objects; | ||
import java.util.function.Consumer; | ||
|
||
public class ScriptComment implements ScriptPart { | ||
|
||
private String comment; | ||
|
||
public ScriptComment(String comment) { | ||
this.comment = comment; | ||
} | ||
|
||
public ScriptComment setComment(String comment) { | ||
this.comment = comment; | ||
|
||
return this; | ||
} | ||
|
||
public String getComment() { | ||
return comment; | ||
} | ||
|
||
@Override | ||
public ScriptGroup getGroup() { | ||
return ScriptGroup.COMMENT; | ||
} | ||
|
||
public static class Serializer implements JsonSerializer<ScriptComment> { | ||
|
||
@Override | ||
public JsonElement serialize(ScriptComment src, Type typeOfSrc, JsonSerializationContext context) { | ||
JsonObject obj = new JsonObject(); | ||
obj.addProperty("type", "comment"); | ||
obj.addProperty("comment", src.getComment()); | ||
return obj; | ||
} | ||
} | ||
} |
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 |
---|---|---|
|
@@ -6,5 +6,7 @@ public enum ScriptGroup { | |
ACTION, | ||
CONDITION, | ||
REPETITION, | ||
EVENT | ||
EVENT, | ||
|
||
COMMENT | ||
} |
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
Oops, something went wrong.