Bungee cmd support

This commit is contained in:
XAP3Y 2024-12-23 18:08:36 +01:00
parent ccd1161793
commit cf1e1c7f6c
4 changed files with 62 additions and 1 deletions

View File

@ -0,0 +1,30 @@
name: Build CitizensCMD plugin
run-name: Build CitizensCMD plugin
on: [push]
jobs:
Build-latest-jar:
runs-on: ubuntu-latest
steps:
- name: Build | Prepare packages
run: |
apt update; apt-get install software-properties-common -y
wget -O- https://apt.corretto.aws/corretto.key | apt-key add -
add-apt-repository 'deb https://apt.corretto.aws stable main'
apt-get update; apt-get install -y maven java-21-amazon-corretto-jdk
- name: Setup git
run: |
git config --global user.name "Radim Lipovčan"
git config --global user.email "radim@lipovcan.cz"
- name: Check out repository code
uses: actions/checkout@v4
- name: Build | Maven clean build
run: |
mvn clean install && ls -lah && ls */ -lah && ls */* -lah&& ls */*/* -lah
- name: Push | Create release
uses: https://git.lipovcan.cz/Upstream/gitea-release-action.git@v1
with:
files: |-
target/CitizensCMD-2.7.2.jar
- name: Push | Old FTP way to gitea.lipovcan.cz:8081
run: |
curl --insecure --user username:mypass -T ./target/CitizensCMD-2.7.2.jar ftp://192.168.10.133:/

14
CitizensCMD.iml Normal file
View File

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
<platformType>ADVENTURE</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
</module>

View File

@ -104,6 +104,8 @@ public final class CitizensCMD extends JavaPlugin {
audiences = BukkitAudiences.create(this); audiences = BukkitAudiences.create(this);
final Audience console = audiences.console(); final Audience console = audiences.console();
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "my:psb");
// Enabling lets go! // Enabling lets go!
console.sendMessage(TAG.append(LEGACY.deserialize("&3Citizens&cCMD &8&o" + getDescription().getVersion()))); console.sendMessage(TAG.append(LEGACY.deserialize("&3Citizens&cCMD &8&o" + getDescription().getVersion())));
console.sendMessage(TAG.append(LEGACY.deserialize("&8by &3Mateus Moreira &c@LichtHund &8& Maintained by &3HexedHero"))); console.sendMessage(TAG.append(LEGACY.deserialize("&8by &3Mateus Moreira &c@LichtHund &8& Maintained by &3HexedHero")));
@ -206,7 +208,7 @@ public final class CitizensCMD extends JavaPlugin {
* Registers all the commands to be used * Registers all the commands to be used
*/ */
private void registerCommands() { private void registerCommands() {
commandManager.registerSuggestion(SuggestionKey.of("permissions"), (sender, context) -> Arrays.asList("console", "player", "permission", "server", "message", "sound")); commandManager.registerSuggestion(SuggestionKey.of("permissions"), (sender, context) -> Arrays.asList("console", "player", "permission", "server", "message", "sound", "bungee"));
commandManager.registerSuggestion(SuggestionKey.of("type"), (sender, context) -> Arrays.asList("cmd", "perm")); commandManager.registerSuggestion(SuggestionKey.of("type"), (sender, context) -> Arrays.asList("cmd", "perm"));
commandManager.registerSuggestion(SuggestionKey.of("click"), (sender, context) -> Arrays.asList("left", "right")); commandManager.registerSuggestion(SuggestionKey.of("click"), (sender, context) -> Arrays.asList("left", "right"));
commandManager.registerSuggestion(SuggestionKey.of("set"), (sender, context) -> Arrays.asList("set", "remove")); commandManager.registerSuggestion(SuggestionKey.of("set"), (sender, context) -> Arrays.asList("set", "remove"));

View File

@ -30,7 +30,10 @@ import java.util.Map;
import java.util.regex.Matcher; import java.util.regex.Matcher;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -287,6 +290,18 @@ public class NPCClickListener implements Listener {
getScheduler().runTaskLater(plugin, () -> Util.changeServer(plugin, player, commands.get(finalI)), (int) delay * 20L); getScheduler().runTaskLater(plugin, () -> Util.changeServer(plugin, player, commands.get(finalI)), (int) delay * 20L);
break; break;
case "bungee":
ByteArrayDataOutput out = ByteStreams.newDataOutput();
try {
out.writeUTF(player.getName());
out.writeUTF(commands.get(finalI));
} catch(Exception ex) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cSomething wrong happened..."));
}
player.sendPluginMessage(plugin, "my:psb", out.toByteArray());
//getScheduler().runTaskLater(plugin, () -> Util.changeServer(plugin, player, commands.get(finalI)), (int) delay * 20L);
break;
case "message": case "message":
getScheduler().runTaskLater(plugin, () -> { getScheduler().runTaskLater(plugin, () -> {
final String finalMessage = commands.get(finalI) final String finalMessage = commands.get(finalI)