Add messages to config and permissions to plugin.yml
This commit is contained in:
parent
6b548bc8d6
commit
2d2681b9bc
|
|
@ -4,6 +4,7 @@ import java.util.UUID;
|
||||||
|
|
||||||
import com.alttd.afkdectector.afkplayer.AFKPlayer;
|
import com.alttd.afkdectector.afkplayer.AFKPlayer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
@ -55,7 +56,8 @@ public class AFKCheckTimer extends BukkitRunnable{
|
||||||
player.setSleepingIgnored(true);
|
player.setSleepingIgnored(true);
|
||||||
//player.setCanPickupItems(false);
|
//player.setCanPickupItems(false);
|
||||||
plugin.AFKPlayers.addEntry(player.getName());
|
plugin.AFKPlayers.addEntry(player.getName());
|
||||||
Bukkit.broadcast(player.getName() + " is now afk.", "afkdetector.notify");
|
Bukkit.broadcast(
|
||||||
|
ChatColor.translateAlternateColorCodes('&', Lang.AFKTOGGLEON.toString().replace("%player%", player.getName())), "afkdetector.notify");
|
||||||
}
|
}
|
||||||
if(System.currentTimeMillis() - standingTime > afkplayer.getafkTime() * 60 * 1000) {
|
if(System.currentTimeMillis() - standingTime > afkplayer.getafkTime() * 60 * 1000) {
|
||||||
MessageTimer currentTimer = plugin.messageTimers.get(uuid);
|
MessageTimer currentTimer = plugin.messageTimers.get(uuid);
|
||||||
|
|
|
||||||
|
|
@ -269,10 +269,6 @@ public class AFKDetector extends JavaPlugin implements Listener{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Audience getAudience() {
|
|
||||||
return audience;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* @EventHandler
|
/* @EventHandler
|
||||||
public void onPlayerMove(PlayerMoveEvent event) {
|
public void onPlayerMove(PlayerMoveEvent event) {
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@ public enum Lang {
|
||||||
AFK_LIST("afk-list", "There are %afkplayers% afk."),
|
AFK_LIST("afk-list", "There are %afkplayers% afk."),
|
||||||
AFK_PREFIX("afk-prefix", "[AFK]"),
|
AFK_PREFIX("afk-prefix", "[AFK]"),
|
||||||
AFKCHECKTITLE("afkcheck-title", "AFK CHECK"),
|
AFKCHECKTITLE("afkcheck-title", "AFK CHECK"),
|
||||||
|
AFKTOGGLEON("afk-toggle-on", "&b%player% is not afk."),
|
||||||
|
AFKTOGGLEOFF("afk-toggle-off", "&b%player% is no longer afk."),
|
||||||
AFKCHECKSUBTITLE("afkcheck-subtitle", "Please respond to the dm from staff!"),
|
AFKCHECKSUBTITLE("afkcheck-subtitle", "Please respond to the dm from staff!"),
|
||||||
AFKCHECKCMESSAGE("afkcheck-message", "Hey, since you're near a farm and not moving. I'm making sure you aren't afk. Please respond to me if you're not AFK.");
|
AFKCHECKCMESSAGE("afkcheck-message", "Hey, since you're near a farm and not moving. I'm making sure you aren't afk. Please respond to me if you're not AFK.");
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,9 +59,7 @@ public class MessageTimer extends BukkitRunnable {
|
||||||
} else {
|
} else {
|
||||||
if(player != null) {
|
if(player != null) {
|
||||||
if(!plugin.messageTimers.isEmpty()) {
|
if(!plugin.messageTimers.isEmpty()) {
|
||||||
if(plugin.messageTimers.containsKey(player.getUniqueId())) {
|
plugin.messageTimers.remove(player.getUniqueId());
|
||||||
plugin.messageTimers.remove(player.getUniqueId());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
cancel();
|
cancel();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,9 @@ package com.alttd.afkdectector.afkplayer;
|
||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import com.alttd.afkdectector.Lang;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
|
@ -67,7 +69,7 @@ public class AFKPlayer {
|
||||||
|
|
||||||
public void ResetAFK() {
|
public void ResetAFK() {
|
||||||
if(isafk) {
|
if(isafk) {
|
||||||
Bukkit.broadcast(playerName + " is no longer afk.", "afkdetector.notify");
|
Bukkit.broadcast(ChatColor.translateAlternateColorCodes('&', Lang.AFKTOGGLEOFF.toString().replace("%player%", playerName)), "afkdetector.notify");
|
||||||
}
|
}
|
||||||
standingTime = System.currentTimeMillis();
|
standingTime = System.currentTimeMillis();
|
||||||
playerToSphereCenter = Bukkit.getPlayer(getPlayerUuid()).getLocation();
|
playerToSphereCenter = Bukkit.getPlayer(getPlayerUuid()).getLocation();
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,8 @@ permissions:
|
||||||
children:
|
children:
|
||||||
afkdetector.bypass: true
|
afkdetector.bypass: true
|
||||||
afkdetector.afklist: true
|
afkdetector.afklist: true
|
||||||
|
afkdetector.afkcheck: true
|
||||||
|
afkdetector.notify: true
|
||||||
afkdetector.bypass:
|
afkdetector.bypass:
|
||||||
description: Bypass the AFKplugin.
|
description: Bypass the AFKplugin.
|
||||||
default: op
|
default: op
|
||||||
|
|
@ -36,7 +38,13 @@ permissions:
|
||||||
afkdetector.afktime:
|
afkdetector.afktime:
|
||||||
description: Master permission for custom times.
|
description: Master permission for custom times.
|
||||||
default: false
|
default: false
|
||||||
|
afkdetector.afkcheck:
|
||||||
|
description: Allows the usage of /afkcheck command.
|
||||||
|
default: false
|
||||||
afkdetector.afklist:
|
afkdetector.afklist:
|
||||||
description: Allows the usage of /afklist command.
|
description: Allows the usage of /afklist command.
|
||||||
default: false
|
default: false
|
||||||
|
afkdetector.notify:
|
||||||
|
description: Get output when a player goes afk.
|
||||||
|
default: false
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user