Skip to content

Commit

Permalink
Merge pull request #9 from v4Guard/develop
Browse files Browse the repository at this point in the history
v4Guard Plugin v1.1.1c
  • Loading branch information
samfces authored Aug 27, 2022
2 parents 421974f + 4ab8f7d commit 61815c4
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.v4guard</groupId>
<artifactId>v4guard-plugin</artifactId>
<version>1.1.1b</version>
<version>1.1.1c</version>
<packaging>jar</packaging>

<properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onPreLogin(String username, Object event) {
String address = e.getConnection().getAddress().getAddress().getHostAddress();
v4GuardBungee.getCoreInstance().getCheckManager().cleanupChecks(username);

final boolean wait = (boolean) v4GuardBungee.getCoreInstance().getBackendConnector().getSettings().get("waitResponse");
final boolean wait = (boolean) v4GuardBungee.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);
if (wait) {
e.registerIntent(v4GuardBungee.getV4Guard());
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/io/v4guard/plugin/bungee/v4GuardBungee.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ public class v4GuardBungee extends Plugin {
@Override
public void onEnable(){
this.getProxy().getConsole().sendMessage("§e[v4guard-plugin] (Bungee) Enabling...");
new Metrics(this, 16219);
try {
new Metrics(this, 16219);
} catch (Exception ex){
this.getProxy().getConsole().sendMessage("§e[v4guard-plugin] (Bungee) Failed to connect with bStats [WARN]");
}
try {
core = new v4GuardCore(v4GuardMode.BUNGEE);
core.getCheckManager().addProcessor(new BungeeCheckProcessor());
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/v4guard/plugin/core/v4GuardCore.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class v4GuardCore {
private BackendConnector backendConnector;
private CheckManager checkManager;

public static final String pluginVersion = "1.1.1b";
public static final String pluginVersion = "1.1.1c";

private boolean debug = false;
private v4GuardMode pluginMode = v4GuardMode.UNKNOWN;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void onPreLogin(String username, Object event) {
String address = e.getAddress().getHostAddress();
v4GuardSpigot.getCoreInstance().getCheckManager().cleanupChecks(username);

final boolean wait = (boolean) v4GuardSpigot.getCoreInstance().getBackendConnector().getSettings().get("waitResponse");
final boolean wait = (boolean) v4GuardSpigot.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);;
new CompletableNameCheckTask(e.getName()) {
@Override
public void complete(boolean nameIsValid) {
Expand Down Expand Up @@ -56,7 +56,7 @@ public void run() {
if (player == null) {
return;
}
Document kickMessages = (Document) v4GuardSpigot.getCoreInstance().getBackendConnector().getSettings().get("messages");
Document kickMessages = (Document) v4GuardSpigot.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);;
String message= StringUtils.buildMultilineString((List<String>) kickMessages.get("invalidUsername"));
message = StringUtils.replacePlaceholders(message, new Document("username", e.getName()));
player.kickPlayer(ChatColor.translateAlternateColorCodes('&', message));
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/io/v4guard/plugin/spigot/v4GuardSpigot.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ public void onEnable(){
this.getServer().getConsoleSender().sendMessage("§e[v4guard-plugin] (Spigot) Enabling...");
try {
new Metrics(this, 16218);
} catch (Exception ex){
this.getServer().getConsoleSender().sendMessage("§e[v4guard-plugin] (Spigot) Failed to connect with bStats [WARN]");
}
try {
core = new v4GuardCore(v4GuardMode.SPIGOT);
core.getCheckManager().addProcessor(new SpigotCheckProcessor());
} catch (Exception e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public void onPreLoginWithContinuation(Object event, Continuation continuation)
String address = e.getConnection().getRemoteAddress().getAddress().getHostAddress();
v4GuardVelocity.getCoreInstance().getCheckManager().cleanupChecks(e.getUsername());

final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().get("waitResponse");
final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);;
if (!wait) {
if(continuation != null) continuation.resume();
return;
Expand All @@ -41,7 +41,7 @@ public void onPreLogin(String username, Object event) {
String address = e.getConnection().getRemoteAddress().getAddress().getHostAddress();
v4GuardVelocity.getCoreInstance().getCheckManager().cleanupChecks(e.getUsername());

final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().get("waitResponse");
final boolean wait = (boolean) v4GuardVelocity.getCoreInstance().getBackendConnector().getSettings().getOrDefault("waitResponse", false);;
if(wait) return;
doChecks(e, null);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@ public v4GuardVelocity(ProxyServer server, Logger logger, Metrics.Factory metric
@Subscribe
public void onProxyInitialization(ProxyInitializeEvent event) {
server.getConsoleCommandSource().sendMessage(Component.text("§e[v4guard-plugin] (Velocity) Enabling..."));
metricsFactory.make(this, 16220);
try {
metricsFactory.make(this, 16220);
} catch (Exception ex) {
server.getConsoleCommandSource().sendMessage(Component.text("§e[v4guard-plugin] (Velocity) Failed to connect with bStats [WARN]"));
}
try {
core = new v4GuardCore(v4GuardMode.VELOCITY);
core.getCheckManager().addProcessor(new VelocityCheckProcessor());
Expand Down

0 comments on commit 61815c4

Please sign in to comment.