Auto formatting spacing
This commit is contained in:
parent
ce798fcefa
commit
91a492b87f
|
|
@ -34,7 +34,7 @@ import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class AFKDetector extends JavaPlugin implements Listener{
|
public class AFKDetector extends JavaPlugin implements Listener {
|
||||||
|
|
||||||
public static AFKDetector instance;
|
public static AFKDetector instance;
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ public class AFKDetector extends JavaPlugin implements Listener{
|
||||||
* Get the afk time for a player
|
* Get the afk time for a player
|
||||||
*/
|
*/
|
||||||
public int getAllowedAFKTime(Player player) {
|
public int getAllowedAFKTime(Player player) {
|
||||||
if(Config.SERVER_FULL) {
|
if (Config.SERVER_FULL) {
|
||||||
return Config.DEFAULT_AFK_TIME;
|
return Config.DEFAULT_AFK_TIME;
|
||||||
}
|
}
|
||||||
return PlayerAfkTime.get(player.getUniqueId());
|
return PlayerAfkTime.get(player.getUniqueId());
|
||||||
|
|
@ -129,7 +129,7 @@ public class AFKDetector extends JavaPlugin implements Listener{
|
||||||
UUID uuid = player.getUniqueId();
|
UUID uuid = player.getUniqueId();
|
||||||
PlayerAfkTime.put(uuid, getPlayerAFKTime(player));
|
PlayerAfkTime.put(uuid, getPlayerAFKTime(player));
|
||||||
players.put(uuid, new AFKPlayer(player, this));
|
players.put(uuid, new AFKPlayer(player, this));
|
||||||
if(Bukkit.getOnlinePlayers().size() >= Config.PLAYER_LIMIT && !Config.SERVER_FULL) {
|
if (Bukkit.getOnlinePlayers().size() >= Config.PLAYER_LIMIT && !Config.SERVER_FULL) {
|
||||||
fullOverride = true;
|
fullOverride = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -153,7 +153,7 @@ public class AFKDetector extends JavaPlugin implements Listener{
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
// Remove the players from the timer if they logout
|
// Remove the players from the timer if they logout
|
||||||
players.remove(player.getUniqueId());
|
players.remove(player.getUniqueId());
|
||||||
if(Bukkit.getOnlinePlayers().size() < Config.PLAYER_LIMIT && fullOverride){
|
if (Bukkit.getOnlinePlayers().size() < Config.PLAYER_LIMIT && fullOverride) {
|
||||||
fullOverride = false;
|
fullOverride = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +199,7 @@ public class AFKDetector extends JavaPlugin implements Listener{
|
||||||
public void loadConfig(CommandSender sender) {
|
public void loadConfig(CommandSender sender) {
|
||||||
Config.reload();
|
Config.reload();
|
||||||
MessagesConfig.reload();
|
MessagesConfig.reload();
|
||||||
if(sender != null) {
|
if (sender != null) {
|
||||||
sender.sendMessage("Configuration reloaded");
|
sender.sendMessage("Configuration reloaded");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,5 @@
|
||||||
package com.alttd.afkdectector;
|
package com.alttd.afkdectector;
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import com.alttd.afkdectector.afkplayer.AFKPlayer;
|
import com.alttd.afkdectector.afkplayer.AFKPlayer;
|
||||||
import com.alttd.afkdectector.config.Config;
|
import com.alttd.afkdectector.config.Config;
|
||||||
import com.alttd.afkdectector.config.Messages;
|
import com.alttd.afkdectector.config.Messages;
|
||||||
|
|
@ -17,6 +13,10 @@ import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
public class MessageTimer extends BukkitRunnable {
|
public class MessageTimer extends BukkitRunnable {
|
||||||
|
|
||||||
private final AFKDetector plugin;
|
private final AFKDetector plugin;
|
||||||
|
|
@ -48,12 +48,12 @@ public class MessageTimer extends BukkitRunnable {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
Player player = Bukkit.getPlayer(uuid);
|
Player player = Bukkit.getPlayer(uuid);
|
||||||
if(plugin.messageTimers.containsKey(uuid)) {
|
if (plugin.messageTimers.containsKey(uuid)) {
|
||||||
if (player == null || player.hasPermission("afkdetector.kickexempt")) {
|
if (player == null || player.hasPermission("afkdetector.kickexempt")) {
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(Config.COUNT_DOWN_ENABLED) {
|
if (Config.COUNT_DOWN_ENABLED) {
|
||||||
MiniMessage miniMessage = AFKDetector.miniMessage;
|
MiniMessage miniMessage = AFKDetector.miniMessage;
|
||||||
Title title = Title.title(miniMessage.deserialize(Messages.COUNT_DOWN_TITLE_1.getMessage()),
|
Title title = Title.title(miniMessage.deserialize(Messages.COUNT_DOWN_TITLE_1.getMessage()),
|
||||||
miniMessage.deserialize(Messages.COUNT_DOWN_TITLE_2.getMessage()));
|
miniMessage.deserialize(Messages.COUNT_DOWN_TITLE_2.getMessage()));
|
||||||
|
|
@ -64,7 +64,7 @@ public class MessageTimer extends BukkitRunnable {
|
||||||
repeats = repeats - 1;
|
repeats = repeats - 1;
|
||||||
|
|
||||||
if (repeats <= 0) {
|
if (repeats <= 0) {
|
||||||
if(player.isInsideVehicle()) {
|
if (player.isInsideVehicle()) {
|
||||||
player.leaveVehicle();
|
player.leaveVehicle();
|
||||||
}
|
}
|
||||||
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(), plugin.kickCommand.replace("%player%", player.getName()));
|
//Bukkit.dispatchCommand(Bukkit.getConsoleSender(), plugin.kickCommand.replace("%player%", player.getName()));
|
||||||
|
|
@ -80,8 +80,8 @@ public class MessageTimer extends BukkitRunnable {
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(player != null) {
|
if (player != null) {
|
||||||
if(!plugin.messageTimers.isEmpty()) {
|
if (!plugin.messageTimers.isEmpty()) {
|
||||||
plugin.messageTimers.remove(player.getUniqueId());
|
plugin.messageTimers.remove(player.getUniqueId());
|
||||||
}
|
}
|
||||||
cancel();
|
cancel();
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ public enum Messages {
|
||||||
TITLE("title-name", "<red>[<white>AFKDetector</white>]</red> "),
|
TITLE("title-name", "<red>[<white>AFKDetector</white>]</red> "),
|
||||||
COOL_DOWN("cooldown-message", "You need to wait <timeleft> seconds before using this command."),
|
COOL_DOWN("cooldown-message", "You need to wait <timeleft> seconds before using this command."),
|
||||||
INVALID_PLAYER("invalid-args", "<red>Invalid args!usage: -p:playername"),
|
INVALID_PLAYER("invalid-args", "<red>Invalid args!usage: -p:playername"),
|
||||||
INVALID_REASON("invalid-reason" , "<red>Invalid args! usage: -r:reason"),
|
INVALID_REASON("invalid-reason", "<red>Invalid args! usage: -r:reason"),
|
||||||
NOT_ONLINE("player-notonline", "<red>Invalid args! player not online"),
|
NOT_ONLINE("player-notonline", "<red>Invalid args! player not online"),
|
||||||
PLAYER_ONLY("player-only", "Teri have you ever seen an afk console?"),
|
PLAYER_ONLY("player-only", "Teri have you ever seen an afk console?"),
|
||||||
NO_PERMS("no-permissions", "<red>You don''t have permission for that!"),
|
NO_PERMS("no-permissions", "<red>You don''t have permission for that!"),
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@ public class MessagesConfig extends AbstractConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean DEBUG_MODE = false;
|
public static boolean DEBUG_MODE = false;
|
||||||
|
|
||||||
private static void settings() {
|
private static void settings() {
|
||||||
DEBUG_MODE = config.getBoolean("debug-mode", DEBUG_MODE);
|
DEBUG_MODE = config.getBoolean("debug-mode", DEBUG_MODE);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,18 +4,19 @@ import net.md_5.bungee.api.ChatColor;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public class Logger {
|
public class Logger {
|
||||||
|
|
||||||
public static void info(String str) {
|
public static void info(String str) {
|
||||||
log(Level.INFO,"&e" + str);
|
log(Level.INFO, "&e" + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void warn(String str) {
|
public static void warn(String str) {
|
||||||
log(Level.SEVERE,"&6" + str);
|
log(Level.SEVERE, "&6" + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void severe(String str) {
|
public static void severe(String str) {
|
||||||
log(Level.SEVERE,"&c" + str);
|
log(Level.SEVERE, "&c" + str);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void log(Level level, String str) {
|
public static void log(Level level, String str) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user