Skip to content

Commit

Permalink
Merge branch 'fix/docs-release-push'
Browse files Browse the repository at this point in the history
  • Loading branch information
AyhamAl-Ali committed Oct 12, 2023
2 parents 8c7fec0 + 55595eb commit a6c7f06
Show file tree
Hide file tree
Showing 16 changed files with 137 additions and 125 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/docs/generate-docs/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,15 @@ runs:
cd $SKRIPT_REPO_DIR
if [[ "${IS_RELEASE}" == "true" ]]; then
./gradlew genReleaseDocs releaseJavadoc
./gradlew genReleaseDocs javadoc
elif [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
./gradlew genNightlyDocs javadoc
else
./gradlew genNightlyDocs
fi
if [ -d "${DOCS_OUTPUT_DIR}" ]; then
if [[ "${GENERATE_JAVADOCS}" == "true" ]]; then
if [[ "${GENERATE_JAVADOCS}" == "true" ]] || [[ "${IS_RELEASE}" == "true" ]] ; then
mkdir -p "${SKRIPT_DOCS_OUTPUT_DIR}/javadocs" && cp -a "./build/docs/javadoc/." "$_"
fi
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/release-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ jobs:
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
skript_repo_dir: ${{ steps.configuration.outputs.SKRIPT_REPO_DIR }}
is_release: true
generate_javadocs: true
cleanup_pattern: "!(nightly|archives|templates)"
- name: Push release documentation
uses: ./skript/.github/workflows/docs/push-docs
with:
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
git_name: Release Docs Bot
git_email: [email protected]
Expand Down Expand Up @@ -68,9 +68,11 @@ jobs:
- name: Generate documentation
uses: ./skript/.github/workflows/docs/generate-docs
with:
docs_output_dir: ${{ steps.configuration.outputs.DOCS_OUTPUT_DIR }}
docs_repo_dir: ${{ steps.configuration.outputs.DOCS_REPO_DIR }}
skript_repo_dir: ${{ steps.configuration.outputs.SKRIPT_REPO_DIR }}
is_release: true
generate_javadocs: true
- name: Push archive documentation
uses: ./skript/.github/workflows/docs/push-docs
with:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,6 @@ gradle-app.setting
# TODO remove this in the future after some time since https://github.com/SkriptLang/Skript/pull/4979
# This ensures developers don't upload their old existing test_runners/ folder.
test_runners/

## Mac MetaData
**/.DS_Store
16 changes: 3 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ allprojects {
dependencies {
shadow group: 'io.papermc', name: 'paperlib', version: '1.0.8'
shadow group: 'org.bstats', name: 'bstats-bukkit', version: '3.0.2'
shadow group: 'net.kyori', name: 'adventure-text-serializer-bungeecord', version: '4.3.0'
shadow group: 'net.kyori', name: 'adventure-text-serializer-bungeecord', version: '4.3.1'

implementation group: 'io.papermc.paper', name: 'paper-api', version: '1.20.2-R0.1-SNAPSHOT'
implementation group: 'org.eclipse.jdt', name: 'org.eclipse.jdt.annotation', version: '2.2.700'
Expand Down Expand Up @@ -149,15 +149,6 @@ license {
exclude('**/*.json') // JSON files do not have headers
}

task releaseJavadoc(type: Javadoc) {
title = project.property('version')
source = sourceSets.main.allJava
classpath = configurations.compileClasspath
options.encoding = 'UTF-8'
// currently our javadoc has a lot of errors, so we need to suppress the linter
options.addStringOption('Xdoclint:none', '-quiet')
}

// Task to check that test scripts are named correctly
tasks.register('testNaming') {
doLast {
Expand Down Expand Up @@ -366,7 +357,7 @@ task nightlyResources(type: ProcessResources) {
'today' : '' + LocalTime.now(),
'release-flavor' : 'skriptlang-nightly', // SkriptLang build, automatically done by CI
'release-channel' : 'alpha', // No update checking, but these are VERY unstable
'release-updater' : 'ch.njol.skript.update.NoUpdateChecker', // No autoupdates for now
'release-updater' : 'ch.njol.skript.update.NoUpdateChecker', // No auto updates for now
'release-source' : '',
'release-download': 'null'
]
Expand All @@ -388,7 +379,7 @@ task nightlyRelease(type: ShadowJar) {
}

javadoc {
dependsOn nightlyResources
title = 'Skript ' + project.property('version')
source = sourceSets.main.allJava

exclude("ch/njol/skript/conditions/**")
Expand All @@ -407,4 +398,3 @@ javadoc {
// currently our javadoc has a lot of errors, so we need to suppress the linter
options.addStringOption('Xdoclint:none', '-quiet')
}

3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Ensure encoding is consistent across systems
org.gradle.jvmargs=-Dfile.encoding=UTF-8

groupid=ch.njol
name=skript
version=2.7.1
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ch/njol/skript/classes/data/BukkitClasses.java
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@ public String toVariableNameString(FireworkEffect effect) {
.user("(panda )?genes?")
.name("Gene")
.description("Represents a Panda's main or hidden gene. " +
"See <a href='https://minecraft.gamepedia.com/Panda#Genetics'>genetics</a> for more info.")
"See <a href='https://minecraft.wiki/w/Panda#Genetics'>genetics</a> for more info.")
.since("2.4")
.requiredPlugins("Minecraft 1.14 or newer"));
}
Expand Down Expand Up @@ -1486,7 +1486,7 @@ public String toVariableNameString(EnchantmentOffer eo) {
.user("attribute ?types?")
.name("Attribute Type")
.description("Represents the type of an attribute. Note that this type does not contain any numerical values."
+ "See <a href='https://minecraft.gamepedia.com/Attribute#Attributes'>attribute types</a> for more info.")
+ "See <a href='https://minecraft.wiki/w/Attribute#Attributes'>attribute types</a> for more info.")
.since("2.5"));

Classes.registerClass(new EnumClassInfo<>(Environment.class, "environment", "environments")
Expand Down
152 changes: 77 additions & 75 deletions src/main/java/ch/njol/skript/command/CommandHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Map.Entry;

import org.bukkit.command.CommandSender;
Expand All @@ -33,118 +34,119 @@
import ch.njol.skript.localization.Message;
import ch.njol.skript.util.SkriptColor;

/**
* @author Peter Güttinger
*/
public class CommandHelp {

private final static String DEFAULTENTRY = "description";

private final static ArgsMessage m_invalid_argument = new ArgsMessage("commands.invalid argument");
private final static Message m_usage = new Message("skript command.usage");


private final String actualCommand, actualNode, argsColor;
private String command;
private String langNode;
@Nullable
private Message description = null;
private final String argsColor;

@Nullable
private String langNode = null;

private final LinkedHashMap<String, Object> arguments = new LinkedHashMap<>();

private Message description;

private final Map<String, Object> arguments = new LinkedHashMap<>();

@Nullable
private Message wildcardArg = null;

public CommandHelp(final String command, final SkriptColor argsColor, final String langNode) {
this.command = command;
this.argsColor = "" + argsColor.getFormattedChat();
this.langNode = langNode;
description = new Message(langNode + "." + DEFAULTENTRY);
private ArgumentHolder wildcardArg = null;

public CommandHelp(String command, SkriptColor argsColor, String langNode) {
this(command, argsColor.getFormattedChat(), langNode, new Message(langNode + "." + DEFAULTENTRY));
}

public CommandHelp(final String command, final SkriptColor argsColor) {
this.command = command;
this.argsColor = "" + argsColor.getFormattedChat();

public CommandHelp(String command, SkriptColor argsColor) {
this(command, argsColor.getFormattedChat(), command, null);
}

public CommandHelp add(final String argument) {
if (langNode == null) {
if (argument.startsWith("<") && argument.endsWith(">")) {
final String carg = GRAY + "<" + argsColor + argument.substring(1, argument.length() - 1) + GRAY + ">";
arguments.put(carg, argument);
} else {
arguments.put(argument, null);
}
} else {
if (argument.startsWith("<") && argument.endsWith(">")) {
final String carg = GRAY + "<" + argsColor + argument.substring(1, argument.length() - 1) + GRAY + ">";
wildcardArg = new Message(langNode + "." + argument);
arguments.put(carg, wildcardArg);
} else {
arguments.put(argument, new Message(langNode + "." + argument));
}

private CommandHelp(String command, String argsColor, String node, @Nullable Message description) {
this.actualCommand = this.command = command;
this.actualNode = this.langNode = node;
this.argsColor = argsColor;
this.description = description;
}

public CommandHelp add(String argument) {
ArgumentHolder holder = new ArgumentHolder(argument);
if (argument.startsWith("<") && argument.endsWith(">")) {
argument = GRAY + "<" + argsColor + argument.substring(1, argument.length() - 1) + GRAY + ">";
wildcardArg = holder;
}
arguments.put(argument, holder);
return this;
}
public CommandHelp add(final CommandHelp help) {

public CommandHelp add(CommandHelp help) {
arguments.put(help.command, help);
help.onAdd(this);
return this;
}
protected void onAdd(final CommandHelp parent) {
langNode = parent.langNode + "." + command;

protected void onAdd(CommandHelp parent) {
langNode = parent.langNode + "." + actualNode;
description = new Message(langNode + "." + DEFAULTENTRY);
command = parent.command + " " + parent.argsColor + command;
for (final Entry<String, Object> e : arguments.entrySet()) {
if (e.getValue() instanceof CommandHelp) {
((CommandHelp) e.getValue()).onAdd(this);
} else {
if (e.getValue() != null) { // wildcard arg
wildcardArg = new Message(langNode + "." + e.getValue());
e.setValue(wildcardArg);
} else {
e.setValue(new Message(langNode + "." + e.getKey()));
}
command = parent.command + " " + parent.argsColor + actualCommand;
for (Entry<String, Object> entry : arguments.entrySet()) {
if (entry.getValue() instanceof CommandHelp) {
((CommandHelp) entry.getValue()).onAdd(this);
continue;
}
((ArgumentHolder) entry.getValue()).update();
}
}
public boolean test(final CommandSender sender, final String[] args) {

public boolean test(CommandSender sender, String[] args) {
return test(sender, args, 0);
}
private boolean test(final CommandSender sender, final String[] args, final int index) {

private boolean test(CommandSender sender, String[] args, int index) {
if (index >= args.length) {
showHelp(sender);
return false;
}
final Object help = arguments.get(args[index].toLowerCase(Locale.ENGLISH));
Object help = arguments.get(args[index].toLowerCase(Locale.ENGLISH));
if (help == null && wildcardArg == null) {
showHelp(sender, m_invalid_argument.toString(argsColor + args[index]));
return false;
}
if (help instanceof CommandHelp)
return ((CommandHelp) help).test(sender, args, index + 1);
return true;
return !(help instanceof CommandHelp) || ((CommandHelp) help).test(sender, args, index + 1);
}
public void showHelp(final CommandSender sender) {

public void showHelp(CommandSender sender) {
showHelp(sender, m_usage.toString());
}
private void showHelp(final CommandSender sender, final String pre) {

private void showHelp(CommandSender sender, String pre) {
Skript.message(sender, pre + " " + command + " " + argsColor + "...");
for (final Entry<String, Object> e : arguments.entrySet()) {
Skript.message(sender, " " + argsColor + e.getKey() + " " + GRAY + "-" + RESET + " " + e.getValue());
}
for (Entry<String, Object> entry : arguments.entrySet())
Skript.message(sender, " " + argsColor + entry.getKey() + " " + GRAY + "-" + RESET + " " + entry.getValue());
}

@Override
public String toString() {
return "" + description;
}


private class ArgumentHolder {

private final String argument;
private Message description;

private ArgumentHolder(String argument) {
this.argument = argument;
this.description = new Message(langNode + "." + argument);
}

private void update() {
description = new Message(langNode + "." + argument);
}

@Override
public String toString() {
return description.toString();
}

}

}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@Name("Is Slime Chunk")
@Description({"Tests whether a chunk is a so-called slime chunk.",
"Slimes can generally spawn in the swamp biome and in slime chunks.",
"For more info, see <a href='https://minecraft.gamepedia.com/Slime#.22Slime_chunks.22'>the Minecraft wiki</a>."})
"For more info, see <a href='https://minecraft.wiki/w/Slime#.22Slime_chunks.22'>the Minecraft wiki</a>."})
@Examples({"command /slimey:",
"\ttrigger:",
"\t\tif chunk at player is a slime chunk:",
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/ch/njol/skript/effects/EffExplosion.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* @author Peter Güttinger
*/
@Name("Explosion")
@Description({"Creates an explosion of a given force. The Minecraft Wiki has an <a href='https://www.minecraftwiki.net/wiki/Explosion'>article on explosions</a> " +
@Description({"Creates an explosion of a given force. The Minecraft Wiki has an <a href='https://www.minecraft.wiki/w/Explosion'>article on explosions</a> " +
"which lists the explosion forces of TNT, creepers, etc.",
"Hint: use a force of 0 to create a fake explosion that does no damage whatsoever, or use the explosion effect introduced in Skript 2.0.",
"Starting with Bukkit 1.4.5 and Skript 2.0 you can use safe explosions which will damage entities but won't destroy any blocks."})
Expand Down
24 changes: 17 additions & 7 deletions src/main/java/ch/njol/skript/effects/EffScriptFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

import java.io.File;
import java.io.IOException;
import java.util.Set;

@Name("Enable/Disable/Reload Script File")
@Description("Enables, disables, or reloads a script file.")
Expand Down Expand Up @@ -102,10 +103,8 @@ protected void execute(Event e) {
case RELOAD: {
if (ScriptLoader.getDisabledScriptsFilter().accept(scriptFile))
return;

Script script = ScriptLoader.getScript(scriptFile);
if (script != null)
ScriptLoader.unloadScript(script);

this.unloadScripts(scriptFile);

ScriptLoader.loadScripts(scriptFile, OpenCloseable.EMPTY);
break;
Expand All @@ -114,9 +113,7 @@ protected void execute(Event e) {
if (ScriptLoader.getDisabledScriptsFilter().accept(scriptFile))
return;

Script script = ScriptLoader.getScript(scriptFile);
if (script != null)
ScriptLoader.unloadScript(script);
this.unloadScripts(scriptFile);

try {
FileUtils.move(
Expand All @@ -135,6 +132,19 @@ protected void execute(Event e) {
assert false;
}
}

private void unloadScripts(File file) {
if (file.isDirectory()) {
Set<Script> scripts = ScriptLoader.getScripts(file);
if (scripts.isEmpty())
return;
ScriptLoader.unloadScripts(scripts);
} else {
Script script = ScriptLoader.getScript(file);
if (script != null)
ScriptLoader.unloadScript(script);
}
}

@Override
public String toString(@Nullable Event e, boolean debug) {
Expand Down
Loading

0 comments on commit a6c7f06

Please sign in to comment.