mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-22 18:09:06 +00:00
Fixed issue with premature return statement in unmute task
This commit is contained in:
parent
b2b1a0ec38
commit
c0847f6b87
@ -417,17 +417,18 @@ public class MineverseChat extends JavaPlugin implements PluginMessageListener {
|
||||
}
|
||||
}
|
||||
}, 0L, getConfig().getInt("saveinterval") * 1200); //one minute * save interval
|
||||
|
||||
scheduler.runTaskTimerAsynchronously(this, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (MineverseChatPlayer p : MineverseChat.onlinePlayers) {
|
||||
int time = (int) System.currentTimeMillis();
|
||||
int time = Format.currentTimeMillis();
|
||||
Iterator<String> iterator = p.getMutes().keySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
ChatChannel channel = ChatChannel.getChannel(iterator.next());
|
||||
int timemark = p.getMutes().get(channel.getName());
|
||||
if (timemark == 0) {
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
if (getConfig().getString("loglevel", "info").equals("debug")) {
|
||||
System.out.println(time + " " + timemark);
|
||||
|
@ -8,6 +8,7 @@ import mineverse.Aust1n46.chat.api.MineverseChatPlayer;
|
||||
import mineverse.Aust1n46.chat.channel.ChatChannel;
|
||||
import mineverse.Aust1n46.chat.command.MineverseCommand;
|
||||
import mineverse.Aust1n46.chat.localization.LocalizedMessage;
|
||||
import mineverse.Aust1n46.chat.utilities.Format;
|
||||
|
||||
public class Mute extends MineverseCommand {
|
||||
private static final int MILLISECONDS_PER_MINUTE = 60000;
|
||||
@ -73,7 +74,7 @@ public class Mute extends MineverseCommand {
|
||||
}
|
||||
if (channel.isMutable()) {
|
||||
try {
|
||||
int datetime = (int) System.currentTimeMillis();
|
||||
int datetime = Format.currentTimeMillis();
|
||||
int time = Integer.parseInt(args[2]);
|
||||
if (time > 0) {
|
||||
player.addMute(channel.getName(), datetime + (time * MILLISECONDS_PER_MINUTE));
|
||||
|
@ -213,7 +213,7 @@ public class ChatListener implements Listener {
|
||||
mcp.addListening(eventChannel.getName());
|
||||
if (mcp.isMuted(eventChannel.getName())) {
|
||||
if (mcp.getMutes().get(eventChannel.getName()).intValue() > 0) {
|
||||
int dateTimeMillis = (int) System.currentTimeMillis();
|
||||
int dateTimeMillis = Format.currentTimeMillis();
|
||||
String units = LocalizedMessage.UNITS_MINUTE_PLURAL.toString();
|
||||
int muteTimeMillis = mcp.getMutes().get(eventChannel.getName()).intValue();
|
||||
int remainingMuteTime = (muteTimeMillis - dateTimeMillis) / MILLISECONDS_PER_MINUTE;
|
||||
@ -256,7 +256,7 @@ public class ChatListener implements Listener {
|
||||
curColor = eventChannel.getChatColor();
|
||||
bungee = eventChannel.getBungee();
|
||||
|
||||
int dateTimeSeconds = (int) System.currentTimeMillis() / MILLISECONDS_PER_SECOND;
|
||||
int dateTimeSeconds = Format.currentTimeMillis() / MILLISECONDS_PER_SECOND;
|
||||
|
||||
if(eventChannel.hasCooldown()) {
|
||||
chCooldown = eventChannel.getCooldown();
|
||||
@ -292,7 +292,7 @@ public class ChatListener implements Listener {
|
||||
int spamtime = mcp.getSpam().get(eventChannel).get(1);
|
||||
int spamtimeconfig = plugin.getConfig().getConfigurationSection("antispam").getInt("spamnumber");
|
||||
int mutedForTime = plugin.getConfig().getConfigurationSection("antispam").getInt("mutetime", 0);
|
||||
int dateTime = (int) System.currentTimeMillis();
|
||||
int dateTime = Format.currentTimeMillis();
|
||||
if (dateTimeSeconds < spamtime
|
||||
+ plugin.getConfig().getConfigurationSection("antispam").getInt("spamtime")) {
|
||||
if (spamcount + 1 >= spamtimeconfig) {
|
||||
|
@ -540,4 +540,8 @@ public class Format {
|
||||
public static boolean underlineURLs() {
|
||||
return plugin.getConfig().getBoolean("underlineurls", true);
|
||||
}
|
||||
|
||||
public static int currentTimeMillis() {
|
||||
return (int) (System.currentTimeMillis() % Integer.MAX_VALUE);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user