Skip to content

Commit

Permalink
1.6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ancap-kun committed Feb 17, 2023
1 parent ac6f226 commit ea0ec08
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
package ru.ancap.framework.artifex.implementation.plugin;
package ru.ancap.framework.plugin.api.information;

import lombok.AllArgsConstructor;
import org.bukkit.plugin.java.JavaPlugin;
import ru.ancap.framework.communicate.Communicator;
import ru.ancap.framework.communicate.message.CallableMessage;
import ru.ancap.framework.communicate.message.Message;
import ru.ancap.framework.communicate.replacement.Placeholder;
import ru.ancap.framework.artifex.Artifex;
import ru.ancap.framework.command.api.commands.object.event.CommandDispatch;
import ru.ancap.framework.command.api.commands.object.executor.CommandOperator;
import ru.ancap.framework.language.additional.LAPIDomain;
import ru.ancap.framework.language.additional.LAPIMessage;
import ru.ancap.framework.plugin.api.common.CommonMessageDomains;

@AllArgsConstructor
public class AuthorsSupplier implements CommandOperator {
Expand All @@ -19,7 +18,7 @@ public class AuthorsSupplier implements CommandOperator {
private final String domain;

public AuthorsSupplier(JavaPlugin plugin) {
this(plugin, LAPIDomain.of(Artifex.class, "plugin-info"));
this(plugin, CommonMessageDomains.pluginInfo);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion Artifex/locale_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ru:
enter-language: "Команда §n/language§r§f предназначена для выбора серверного языка. Используйте её так: §n/language set <код языка>§r§f, где код языка может быть любым из стандарта ISO 639-1."
setup: "Твой язык изменён на русский."
plugin-info:
- "Artifex v%VERSION%."
- "%PLUGIN% v%VERSION%."
- "Авторы: %AUTHORS%. "
console:
notify:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import ru.ancap.framework.communicate.replacement.Placeholder;
import ru.ancap.framework.command.api.commands.CommandTarget;
import ru.ancap.framework.artifex.implementation.plugin.AuthorsSupplier;
import ru.ancap.framework.plugin.api.information.AuthorsSupplier;
import ru.ancap.framework.command.api.commands.operator.communicate.Reply;
import ru.ancap.framework.command.api.commands.operator.delegate.Delegate;
import ru.ancap.framework.command.api.commands.operator.delegate.subcommand.Raw;
Expand Down
2 changes: 1 addition & 1 deletion Artifex/src/main/resources/locale_0.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ ru:
enter-language: "Команда §n/language§r§f предназначена для выбора серверного языка. Используйте её так: §n/language set <код языка>§r§f, где код языка может быть любым из стандарта ISO 639-1."
setup: "Твой язык изменён на русский."
plugin-info:
- "Artifex v%VERSION%."
- "%PLUGIN% v%VERSION%."
- "Авторы: %AUTHORS%. "
console:
notify:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,10 @@ private static Map<Integer, ArgumentsShard> bindingsFor(List<Argument> arguments
int size = argument.extractor().size();
int endIndex = lastStartIndex + size;
ArgumentsShard shard = new ArgumentsShard(lastStartIndex, endIndex, argument);
for (int cursor = lastStartIndex; cursor < endIndex; cursor++) map.put(cursor, shard);
lastStartIndex = endIndex + 1;
for (int cursor = lastStartIndex; cursor < endIndex; cursor++) {
map.put(cursor, shard);
}
lastStartIndex = endIndex;
}
return map;
}
Expand All @@ -75,7 +77,10 @@ public void on(CommandDispatch dispatch) {

int argumentIndex = 0;

if (dispatch.command().arguments().size() < this.requiredLiterals) this.onNotEnough.accept(dispatch.source().sender(), this.requiredLiterals - dispatch.command().arguments().size());
if (dispatch.command().arguments().size() < this.requiredLiterals) {
this.onNotEnough.accept(dispatch.source().sender(), this.requiredLiterals - dispatch.command().arguments().size());
return;
}

while (!command.isRaw() && argumentIndex <= this.arguments.size() - 1) {
Argument argument = this.arguments.get(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,13 @@ public FileConfiguration prepare(InputStream base, @NotNull File target) {
FilenameUtils.getBaseName(target.getName())+"_"+System.currentTimeMillis()+".old"
), userData);
Set<String> userKeys = userData.getKeys(true);
userKeys.remove(this.versionFieldName);
for (String key : userKeys) {
if (key.equals(this.versionFieldName)) continue;
AncapDebug.debug("key", key);
Object value = userData.get(key);
String transferTarget = transferMap.getTarget(key);
if (transferTarget == null) transferTarget = key;
AncapDebug.debug("setting it to", transferMap);
finalConfig.set(transferTarget, value);
} break;
default: throw new IllegalStateException("Unexpected value: " + this.resolveStateFrom(base, target));
Expand Down

0 comments on commit ea0ec08

Please sign in to comment.