diff --git a/.idea/artifacts/i18n_velocity.xml b/.idea/artifacts/i18n_velocity.xml
new file mode 100644
index 0000000..4be077d
--- /dev/null
+++ b/.idea/artifacts/i18n_velocity.xml
@@ -0,0 +1,11 @@
+
+
+ $PROJECT_DIR$/../../TestServer/velocity/plugins
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
index 236e1da..525de7d 100644
--- a/.idea/compiler.xml
+++ b/.idea/compiler.xml
@@ -7,6 +7,7 @@
+
diff --git a/.idea/google-java-format.xml b/.idea/google-java-format.xml
new file mode 100644
index 0000000..2aa056d
--- /dev/null
+++ b/.idea/google-java-format.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 0bd25e4..77e1c6f 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -2,7 +2,7 @@
-
+
@@ -10,17 +10,13 @@
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
@@ -59,6 +55,7 @@
+
@@ -109,7 +106,7 @@
-
+
1621100170243
@@ -132,7 +129,14 @@
1632066998561
-
+
+ 1647187097560
+
+
+
+ 1647187097560
+
+
@@ -142,7 +146,8 @@
-
+
+
diff --git a/i18n-velocity/pom.xml b/i18n-velocity/pom.xml
new file mode 100644
index 0000000..6d550d0
--- /dev/null
+++ b/i18n-velocity/pom.xml
@@ -0,0 +1,40 @@
+
+
+
+ i18n
+ de.helixdevs
+ 1.0-SNAPSHOT
+
+ 4.0.0
+
+ i18n-velocity
+
+
+ 17
+ 17
+
+
+
+
+ papermc
+ https://papermc.io/repo/repository/maven-public/
+
+
+
+
+
+ de.helixdevs
+ i18n-adventure
+ 1.0-SNAPSHOT
+
+
+ com.velocitypowered
+ velocity-api
+ 3.1.2-SNAPSHOT
+ provided
+
+
+
+
\ No newline at end of file
diff --git a/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java b/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java
new file mode 100644
index 0000000..e6e3ed9
--- /dev/null
+++ b/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/I18nVelocityPlugin.java
@@ -0,0 +1,114 @@
+package de.helixdevs.i18n.velocity;
+
+import com.google.common.reflect.TypeToken;
+import com.google.inject.Inject;
+import com.velocitypowered.api.command.RawCommand;
+import com.velocitypowered.api.command.SimpleCommand;
+import com.velocitypowered.api.event.Subscribe;
+import com.velocitypowered.api.event.proxy.ProxyInitializeEvent;
+import com.velocitypowered.api.event.proxy.ProxyShutdownEvent;
+import com.velocitypowered.api.plugin.Plugin;
+import com.velocitypowered.api.plugin.annotation.DataDirectory;
+import com.velocitypowered.api.proxy.ProxyServer;
+import de.helixdevs.i18n.adventure.AdventureTranslationConsumer;
+import de.helixdevs.i18n.api.TranslationConsumer;
+import de.helixdevs.i18n.common.command.api.Command;
+import de.helixdevs.i18n.common.platform.I18nPlatform;
+import de.helixdevs.i18n.common.platform.I18nPlugin;
+import de.helixdevs.i18n.velocity.command.VelocitySender;
+import ninja.leaping.configurate.ConfigurationNode;
+import ninja.leaping.configurate.objectmapping.ObjectMappingException;
+import ninja.leaping.configurate.yaml.YAMLConfigurationLoader;
+import org.yaml.snakeyaml.DumperOptions;
+
+import java.io.IOException;
+import java.nio.file.Path;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Logger;
+
+@Plugin(
+ id = "i18n",
+ name = "I18n",
+ version = "1.0-SNAPSHOT",
+ description = "Velocity implementation of I18n",
+ authors = {"MCMDEV"}
+)
+public class I18nVelocityPlugin implements I18nPlugin {
+
+ private final ProxyServer proxyServer;
+ private final Logger logger;
+ private final Path dataDirectory;
+ private final I18nPlatform platform;
+
+ private ConfigurationNode configurationNode;
+
+ @Inject
+ public I18nVelocityPlugin(ProxyServer proxyServer, Logger logger, @DataDirectory Path dataDirectory) {
+ this.proxyServer = proxyServer;
+ this.logger = logger;
+ this.dataDirectory = dataDirectory;
+ this.platform = new I18nPlatform(this);
+ }
+
+ @Subscribe
+ private void onProxyInitialization(ProxyInitializeEvent event) throws IOException {
+ YAMLConfigurationLoader configurationLoader = YAMLConfigurationLoader.builder()
+ .setFlowStyle(DumperOptions.FlowStyle.FLOW)
+ .setIndent(2)
+ .setPath(dataDirectory.resolve("config.yml"))
+ .build();
+ this.configurationNode = configurationLoader.load();
+
+ platform.enable();
+ }
+
+ @Subscribe
+ private void onProxyShutdown(ProxyShutdownEvent event) {
+ platform.disable();
+ }
+
+ @Override
+ public String getConfigString(String key) {
+ return configurationNode.getNode(key).getString();
+ }
+
+ @Override
+ public List getConfigStringList(String key) {
+ try {
+ return configurationNode.getNode(key).getList(TypeToken.of(String.class));
+ } catch (ObjectMappingException e) {
+ e.printStackTrace();
+ }
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Set getConsumers() {
+ Set consumers = new HashSet<>();
+ consumers.add(new AdventureTranslationConsumer());
+ return consumers;
+ }
+
+ @Override
+ public Logger getLogger() {
+ return this.logger;
+ }
+
+ @Override
+ public void registerCommand(Command command) {
+ proxyServer.getCommandManager().register(command.getLabel(), new SimpleCommand() {
+ @Override
+ public void execute(Invocation invocation) {
+ command.execute(new VelocitySender(invocation.source()), invocation.arguments());
+ }
+
+ @Override
+ public boolean hasPermission(Invocation invocation) {
+ return invocation.source().hasPermission(command.getPermission());
+ }
+ });
+ }
+}
diff --git a/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java b/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java
new file mode 100644
index 0000000..f8bccff
--- /dev/null
+++ b/i18n-velocity/src/main/java/de/helixdevs/i18n/velocity/command/VelocitySender.java
@@ -0,0 +1,19 @@
+package de.helixdevs.i18n.velocity.command;
+
+import com.velocitypowered.api.command.CommandSource;
+import de.helixdevs.i18n.common.command.api.Sender;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+
+public class VelocitySender implements Sender {
+
+ private final CommandSource holder;
+
+ public VelocitySender(CommandSource holder) {
+ this.holder = holder;
+ }
+
+ @Override
+ public void sendMessage(String message) {
+ holder.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message));
+ }
+}
diff --git a/pom.xml b/pom.xml
index 4d40d48..0f67ed3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -13,6 +13,7 @@
i18n-paper
i18n-api
i18n-adventure
+ i18n-velocity