Skip to content
This repository was archived by the owner on Jun 26, 2026. It is now read-only.

Commit 03a34d8

Browse files
Initial commit
0 parents  commit 03a34d8

24 files changed

Lines changed: 1008 additions & 0 deletions

File tree

.classpath

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
<attribute name="test" value="true"/>
19+
</attributes>
20+
</classpathentry>
21+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
22+
<attributes>
23+
<attribute name="maven.pomderived" value="true"/>
24+
<attribute name="test" value="true"/>
25+
</attributes>
26+
</classpathentry>
27+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-11">
28+
<attributes>
29+
<attribute name="maven.pomderived" value="true"/>
30+
</attributes>
31+
</classpathentry>
32+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
33+
<attributes>
34+
<attribute name="maven.pomderived" value="true"/>
35+
</attributes>
36+
</classpathentry>
37+
<classpathentry kind="output" path="target/classes"/>
38+
</classpath>

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Auto detect text files and perform LF normalization
2+
* text=auto

.project

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>BrigadierProvider-Bungee</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.jdt.core.javanature</nature>
21+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
eclipse.preferences.version=1
2+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=11
3+
org.eclipse.jdt.core.compiler.compliance=11
4+
org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7+
org.eclipse.jdt.core.compiler.release=enabled
8+
org.eclipse.jdt.core.compiler.source=11
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
activeProfiles=
2+
eclipse.preferences.version=1
3+
resolveWorkspaceProjects=true
4+
version=1

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

dependency-reduced-pom.xml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>BrigadierProvider-Bungee</groupId>
5+
<artifactId>BrigadierProvider-Bungee</artifactId>
6+
<name>BrigadierProvider-Bungee</name>
7+
<version>1.0</version>
8+
<organization>
9+
<name>MagicSweet</name>
10+
</organization>
11+
<build>
12+
<resources>
13+
<resource>
14+
<filtering>true</filtering>
15+
<directory>src/main/resources</directory>
16+
</resource>
17+
</resources>
18+
<plugins>
19+
<plugin>
20+
<artifactId>maven-shade-plugin</artifactId>
21+
<version>3.2.4</version>
22+
<executions>
23+
<execution>
24+
<phase>package</phase>
25+
<goals>
26+
<goal>shade</goal>
27+
</goals>
28+
</execution>
29+
</executions>
30+
</plugin>
31+
<plugin>
32+
<artifactId>maven-compiler-plugin</artifactId>
33+
<version>3.8.1</version>
34+
<configuration>
35+
<release>11</release>
36+
</configuration>
37+
</plugin>
38+
</plugins>
39+
</build>
40+
<repositories>
41+
<repository>
42+
<id>minecraft-libraries</id>
43+
<name>Minecraft Libraries</name>
44+
<url>https://libraries.minecraft.net</url>
45+
</repository>
46+
<repository>
47+
<id>bungeecord-repo</id>
48+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
49+
</repository>
50+
</repositories>
51+
<dependencies>
52+
<dependency>
53+
<groupId>net.md-5</groupId>
54+
<artifactId>bungeecord-api</artifactId>
55+
<version>1.16-R0.4-SNAPSHOT</version>
56+
<scope>provided</scope>
57+
</dependency>
58+
</dependencies>
59+
</project>

pom.xml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<groupId>BrigadierProvider-Bungee</groupId>
5+
<artifactId>BrigadierProvider-Bungee</artifactId>
6+
<version>1.0</version>
7+
<name>BrigadierProvider-Bungee</name>
8+
<organization>
9+
<name>MagicSweet</name>
10+
</organization>
11+
<repositories>
12+
<repository>
13+
<id>minecraft-libraries</id>
14+
<name>Minecraft Libraries</name>
15+
<url>https://libraries.minecraft.net</url>
16+
</repository>
17+
<repository>
18+
<id>bungeecord-repo</id>
19+
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
20+
</repository>
21+
</repositories>
22+
<dependencies>
23+
<dependency>
24+
<groupId>com.mojang</groupId>
25+
<artifactId>brigadier</artifactId>
26+
<version>1.0.17</version>
27+
</dependency>
28+
<dependency>
29+
<groupId>net.md-5</groupId>
30+
<artifactId>bungeecord-api</artifactId>
31+
<version>1.16-R0.4-SNAPSHOT</version>
32+
<type>jar</type>
33+
<scope>provided</scope>
34+
</dependency>
35+
</dependencies>
36+
<build>
37+
<resources>
38+
<resource>
39+
<filtering>true</filtering>
40+
<directory>src/main/resources</directory>
41+
</resource>
42+
</resources>
43+
<plugins>
44+
<plugin>
45+
<groupId>org.apache.maven.plugins</groupId>
46+
<artifactId>maven-shade-plugin</artifactId>
47+
<version>3.2.4</version>
48+
<configuration />
49+
<executions>
50+
<execution>
51+
<phase>package</phase>
52+
<goals>
53+
<goal>shade</goal>
54+
</goals>
55+
</execution>
56+
</executions>
57+
</plugin>
58+
<plugin>
59+
<artifactId>maven-compiler-plugin</artifactId>
60+
<version>3.8.1</version>
61+
<configuration>
62+
<release>11</release>
63+
</configuration>
64+
</plugin>
65+
</plugins>
66+
</build>
67+
</project>
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
package com.magicsweet.BrigadierProviderBungee.Handler;
2+
3+
import java.util.Arrays;
4+
import java.util.concurrent.ExecutionException;
5+
import java.util.stream.Collectors;
6+
import java.util.stream.Stream;
7+
8+
import com.magicsweet.BrigadierProviderBungee.Main.Main;
9+
import com.mojang.brigadier.builder.LiteralArgumentBuilder;
10+
import com.mojang.brigadier.tree.CommandNode;
11+
12+
import net.md_5.bungee.api.CommandSender;
13+
import net.md_5.bungee.api.event.TabCompleteEvent;
14+
import net.md_5.bungee.api.plugin.Command;
15+
import net.md_5.bungee.api.plugin.Listener;
16+
import net.md_5.bungee.api.plugin.Plugin;
17+
import net.md_5.bungee.event.EventHandler;
18+
19+
public class BungeeCommand extends Command implements Listener {
20+
String command;
21+
String[] arguments;
22+
LamCommandExecutor executor;
23+
boolean force;
24+
25+
public BungeeCommand(String command, boolean force) {
26+
super(command);
27+
28+
this.force = force;
29+
30+
Plugin plugin = Main.plugin;
31+
32+
plugin.getProxy().getPluginManager().registerCommand(plugin, this);
33+
plugin.getProxy().getPluginManager().registerListener(plugin, this);
34+
Main.dispatcher.getRoot().addChild(LiteralArgumentBuilder.<CommandSender>literal(command).build());
35+
36+
this.command = command;
37+
}
38+
39+
public BungeeCommand withArguments(String... arguments) {
40+
this.arguments = arguments;
41+
42+
43+
for (int i = 0; i < arguments.length; i++) {
44+
CommandNode<CommandSender> node = Main.dispatcher.getRoot().getChild(command);
45+
for (int j = 0; j <= i; j++) {
46+
if (j != i) {
47+
node = node.getChild(arguments[j]);
48+
} else {
49+
node.addChild(LiteralArgumentBuilder.<CommandSender>literal(arguments[j]).build());
50+
}
51+
}
52+
}
53+
54+
return this;
55+
}
56+
57+
@EventHandler
58+
public void event(TabCompleteEvent event) throws InterruptedException, ExecutionException {
59+
60+
Main.dispatcher.getCompletionSuggestions(
61+
Main.dispatcher.parse(event.getCursor().replaceFirst("/", ""), null)).get()
62+
.getList().stream()
63+
.map(sugg -> sugg.getText())
64+
.collect(Collectors.toList()
65+
).forEach(string -> {
66+
event.getSuggestions().add(string);
67+
});
68+
}
69+
70+
public void executes(LamCommandExecutor consumer) {
71+
this.executor = consumer;
72+
}
73+
74+
@Override
75+
public void execute(CommandSender arg0, String[] args) {
76+
if (this.force) if (!Arrays.asList(args).equals(Arrays.asList(this.arguments))) return;
77+
78+
this.executor.run(arg0, args);
79+
80+
}
81+
82+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
package com.magicsweet.BrigadierProviderBungee.Handler;
2+
3+
import net.md_5.bungee.api.CommandSender;
4+
5+
@FunctionalInterface
6+
public interface LamCommandExecutor {
7+
public void run(CommandSender sender, String[] args);
8+
}

0 commit comments

Comments
 (0)