Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Misc changes.
Browse files Browse the repository at this point in the history
Former-commit-id: c500ceb
  • Loading branch information
PolskiStevek committed Mar 22, 2020
1 parent 2ad3aed commit 9f5954d
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/me/ishift/epicguard/bukkit/GuardBukkit.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void onEnable() {
}

Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new RefreshTask(), 1L, 20L);
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new AttackTask(), 1L, 400L);
Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(this, new AttackTask(), 1L, 900L);
Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(this, new UpdaterTask(), 80L, 5800L);
Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(this, new CounterTask(), 1L, 20L);
Bukkit.getServer().getScheduler().runTaskTimerAsynchronously(this, new NotificationTask(NotificationTask.Server.SPIGOT), 20L, 1L);
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/me/ishift/epicguard/bukkit/util/Notificator.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
package me.ishift.epicguard.bukkit.util;

import me.ishift.epicguard.api.bukkit.ActionBarAPI;
import me.ishift.epicguard.api.bukkit.TitleAPI;
import me.ishift.epicguard.bukkit.user.User;
import me.ishift.epicguard.bukkit.user.UserManager;
import org.bukkit.Bukkit;
Expand All @@ -44,4 +45,13 @@ public static void action(String text) {
}
});
}

public static void title(String title, String subtitle) {
Bukkit.getOnlinePlayers().forEach(player -> {
final User u = UserManager.getUser(player);
if (u != null && u.isNotifications() && player.hasPermission("epicguard.admin")) {
TitleAPI.send(player, title, subtitle, 0, 20, 0);
}
});
}
}
2 changes: 1 addition & 1 deletion src/main/java/me/ishift/epicguard/bungee/GuardBungee.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public void onEnable() {
this.getProxy().getPluginManager().registerListener(this, new PingListener());

this.getProxy().getScheduler().schedule(this, new CounterTask(), 1L, 1L, TimeUnit.SECONDS);
this.getProxy().getScheduler().schedule(this, new AttackTask(), 1L, 10L, TimeUnit.SECONDS);
this.getProxy().getScheduler().schedule(this, new AttackTask(), 1L, 30L, TimeUnit.SECONDS);
this.getProxy().getScheduler().schedule(this, new NotificationTask(NotificationTask.Server.BUNGEE), 1L, 100L, TimeUnit.MILLISECONDS);

this.getProxy().getPluginManager().registerCommand(this, new GuardCommand("guard"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,13 @@ public NotificationTask(Server server) {
@Override
public void run() {
final String message = Messages.prefix + "&cConnections per second: &6" + AttackSpeed.getConnectPerSecond();
final String title = "&c" + AttackSpeed.getTotalBots() + " blocked connections";
final String subtitle = "&7Server is under &aattack...";

if (this.server == Server.SPIGOT) {
Notificator.action(message);
Notificator.title(title, subtitle);
return;
}

if (this.server == Server.BUNGEE && GuardBungee.status) {
Expand All @@ -43,7 +47,7 @@ public void run() {
.forEach(player -> {
BungeeUtil.sendActionBar(player, message);
if (AttackSpeed.isUnderAttack()) {
BungeeUtil.sendTitle(player, "&c" + AttackSpeed.getTotalBots() + " blocked connections", "&7Server is under &aattack...");
BungeeUtil.sendTitle(player, title, subtitle);
}
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ updater: true

speed:
# How many connections per second should be made to activate additional checks.
connection: 5
connection: 4

# Block tab-complete packet using ProtocolLib.
# Useful when using a multi-version server, because 1.13+ players
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/config_bungee.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ console-filter:

speed:
# How many connections per second should be made to activate additional checks.
connection: 5
connection: 4

###############################
## Firewall ##
Expand Down

0 comments on commit 9f5954d

Please sign in to comment.