mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-30 01:39:51 +02:00
Prevent that hidden players broadcast afk messages
Prevent that moving players triggers unafk too early, they can now move within a radius of 3 blocks from the position where they went afk.
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.earth2me.essentials.xmpp;
|
||||
|
||||
import com.earth2me.essentials.IEssentials;
|
||||
import com.earth2me.essentials.IUser;
|
||||
import com.earth2me.essentials.Util;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
@@ -83,9 +84,10 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserByAddress(final String address)
|
||||
public IUser getUserByAddress(final String address)
|
||||
{
|
||||
return instance.users.getUserByAddress(address);
|
||||
String username = instance.users.getUserByAddress(address);
|
||||
return username == null ? null : ess.getUser(username);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -122,9 +124,9 @@ public class EssentialsXMPP extends JavaPlugin implements IEssentialsXMPP
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcastMessage(final String name, final String message)
|
||||
public void broadcastMessage(final IUser sender, final String message)
|
||||
{
|
||||
ess.broadcastMessage(name, message);
|
||||
ess.broadcastMessage(sender, message);
|
||||
try
|
||||
{
|
||||
for (String address : getSpyUsers())
|
||||
|
@@ -1,5 +1,6 @@
|
||||
package com.earth2me.essentials.xmpp;
|
||||
|
||||
import com.earth2me.essentials.IUser;
|
||||
import java.util.List;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
@@ -13,7 +14,7 @@ public interface IEssentialsXMPP extends Plugin
|
||||
|
||||
List<String> getSpyUsers();
|
||||
|
||||
String getUserByAddress(final String address);
|
||||
IUser getUserByAddress(final String address);
|
||||
|
||||
boolean sendMessage(final Player user, final String message);
|
||||
|
||||
@@ -23,5 +24,5 @@ public interface IEssentialsXMPP extends Plugin
|
||||
|
||||
boolean toggleSpy(final Player user);
|
||||
|
||||
void broadcastMessage(final String name, final String message);
|
||||
void broadcastMessage(final IUser sender, final String message);
|
||||
}
|
||||
|
@@ -47,7 +47,7 @@ public class UserManager implements IConf
|
||||
return username;
|
||||
}
|
||||
}
|
||||
return search;
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setAddress(final String username, final String address)
|
||||
|
@@ -3,6 +3,7 @@ package com.earth2me.essentials.xmpp;
|
||||
import com.earth2me.essentials.Console;
|
||||
import com.earth2me.essentials.EssentialsConf;
|
||||
import com.earth2me.essentials.IConf;
|
||||
import com.earth2me.essentials.IUser;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@@ -101,8 +102,8 @@ public class XMPPManager extends Handler implements MessageListener, ChatManager
|
||||
sendCommand(chat, message);
|
||||
break;
|
||||
default:
|
||||
final String name = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant()));
|
||||
parent.broadcastMessage(name, "="+name+": "+ message);
|
||||
final IUser sender = parent.getUserByAddress(StringUtils.parseBareAddress(chat.getParticipant()));
|
||||
parent.broadcastMessage(sender, "="+sender.getDisplayName()+": "+ message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user