Skip to content

Commit

Permalink
Merge pull request #20 from SawFowl/dev
Browse files Browse the repository at this point in the history
Update 2.8.0
  • Loading branch information
SawFowl authored May 25, 2022
2 parents 0ed6fe0 + 2756a7e commit 7ba2196
Show file tree
Hide file tree
Showing 19 changed files with 1,673 additions and 40 deletions.
58 changes: 32 additions & 26 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,49 +1,55 @@
plugins {
id("java")
id("java-library")
id("org.spongepowered.gradle.vanilla") version "0.2"
id("java")
id("java-library")
id("org.spongepowered.gradle.vanilla") version "0.2"
}

group = "sawfowl"
version = "${major}.${minor}.${patch}-${suffix}"

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
mavenCentral()
maven {
name = "Sponge"
url = "https://repo.spongepowered.org/maven"
mavenCentral()
maven {
name = "Sponge"
url = "https://repo.spongepowered.org/maven"
allowInsecureProtocol = true
}
maven {
name = 'Bukkit'
}
maven {
name = 'Bukkit'
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
maven {
name 'Sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}
maven {
name 'papermc'
url 'https://repo.papermc.io/repository/maven-public/'
}
maven {
name 'Sonatype'
url 'https://oss.sonatype.org/content/repositories/snapshots/'
}
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.encoding = 'UTF-8'
}

minecraft {
version("1.16.5")
version("1.16.5")

runs {
server()
client()
}
runs {
server()
client()
}
}

dependencies {
implementation "org.spongepowered:spongeapi:${spongeapi}"
implementation "org.bukkit:bukkit:1.14.4-R0.1-SNAPSHOT"
implementation "net.md-5:bungeecord-api:1.14-SNAPSHOT"
implementation "org.spongepowered:spongeapi:${spongeapi}"
implementation "org.bukkit:bukkit:1.14.4-R0.1-SNAPSHOT"
implementation "net.md-5:bungeecord-api:1.14-SNAPSHOT"
implementation 'com.velocitypowered:velocity-api:3.0.1'
annotationProcessor 'com.velocitypowered:velocity-api:3.0.1'
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Version
major=2
minor=7
minor=8
patch=0
suffix=RELEASE
## Dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
}
}
newArgs[2] = sb.toString();
if(args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("bungee")) {
if(args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("bungee") || args[1].equalsIgnoreCase("proxy")) {
makeData(newArgs, false, sender);
} else {
makeData(newArgs, true, sender);
Expand All @@ -73,7 +73,7 @@ private void makeData(String[] args, Boolean single, CommandSender sender) {
} else {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), plugin.getLocale().getString("SyncConsole", args[1]));
}
} else if(args[0].equalsIgnoreCase("bungee")) {
} else if(args[0].equalsIgnoreCase("bungee") || args[0].equalsIgnoreCase("proxy")) {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), plugin.getLocale().getString("SyncConsole", args[1]));
} else {
if(args[1].equalsIgnoreCase("all")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.spongepowered.api.Sponge;
import org.spongepowered.api.command.Command;
import org.spongepowered.api.command.CommandCause;
import org.spongepowered.api.command.CommandCompletion;
Expand Down Expand Up @@ -68,7 +67,7 @@ public CommandResult process(CommandCause cause, Mutable arguments) throws Comma
}
}
newArgs[2] = sb.toString();
if(args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("bungee")) {
if(args[1].equalsIgnoreCase("all") || args[1].equalsIgnoreCase("bungee") || args[1].equalsIgnoreCase("proxy")) {
makeData(newArgs, false, cause);
} else {
makeData(newArgs, true, cause);
Expand Down Expand Up @@ -123,7 +122,7 @@ private void makeData(String[] args, Boolean single, CommandCause cause) {
} else {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), serialize(plugin.getLocale().getString("SyncConsole", args[1])));
}
} else if(args[0].equalsIgnoreCase("bungee")) {
} else if(args[0].equalsIgnoreCase("bungee") || args[0].equalsIgnoreCase("proxy")) {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), serialize(plugin.getLocale().getString("SyncConsole", args[1])));
} else {
if(args[1].equalsIgnoreCase("all")) {
Expand Down
1 change: 0 additions & 1 deletion src/main/java/sawfowl/commandsyncserver/bungee/Locale.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Properties;
import java.util.logging.Level;

import net.md_5.bungee.api.ChatColor;

Expand Down
21 changes: 17 additions & 4 deletions src/main/java/sawfowl/commandsyncserver/bungee/SyncCommand.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
package sawfowl.commandsyncserver.bungee;

import net.md_5.bungee.api.CommandSender;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.chat.TextComponent;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.plugin.Command;

import java.util.Optional;

public class SyncCommand extends Command {

private final CSS plugin;
Expand All @@ -14,7 +18,6 @@ public SyncCommand(CSS css) {

@Override
public void execute(CommandSender sender, String[] args) {
plugin.getLoger().warn(args.length);
if(!sender.hasPermission("sync.use")) {
sender.sendMessage(new TextComponent(plugin.getLocale().getString("NoPerm")));
return;
Expand Down Expand Up @@ -78,14 +81,24 @@ private void makeData(String[] args, Boolean single, CommandSender sender) {
} else {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), plugin.getLocale().getString("SyncConsole", args[1]));
}
} else if(args[0].equalsIgnoreCase("bungee")) {
} else if(args[0].equalsIgnoreCase("bungee") || args[0].equalsIgnoreCase("proxy")) {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), plugin.getLocale().getString("SyncConsole", args[1]));
} else {
if(args[1].equalsIgnoreCase("all")) {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), plugin.getLocale().getString("SyncPlayerAll"));
String command = args[2].replaceAll("\\+", " ");
if(!command.startsWith("/")) command = "/" + command;
sender.sendMessage(new TextComponent(plugin.getLocale().getString("BungeeRanAll", command)));
for(ProxiedPlayer player : ProxyServer.getInstance().getPlayers()) player.chat(command);
} else {
message = plugin.getLocale().getString("SyncingCommand", args[2].replaceAll("\\+", " "), plugin.getLocale().getString("SyncPlayer", args[1]));
Optional<ProxiedPlayer> player = ProxyServer.getInstance().getPlayers().stream().filter(p -> (args[1].equals(p.getName()))).findFirst();
String command = args[2].replaceAll("\\+", " ");
if(!command.startsWith("/")) command = "/" + command;
if(player.isPresent()) {
player.get().chat(command);
sender.sendMessage(new TextComponent(plugin.getLocale().getString("BungeeRanPlayerSingle", command, args[1])));
}
}
return;
}
if(single) {
data = args[0].toLowerCase() + plugin.spacer + "single" + plugin.spacer + args[2] + plugin.spacer + args[1];
Expand Down
Loading

0 comments on commit 7ba2196

Please sign in to comment.