mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-13 04:36:44 +00:00
Merge branch 'master' into release
This commit is contained in:
commit
df3b9a7ef9
20 changed files with 72 additions and 37 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -29,4 +29,7 @@
|
|||
/Essentials/nbproject/private/
|
||||
/Essentials/dist/
|
||||
/Essentials/build/
|
||||
/YamlAnnotations/
|
||||
/YamlAnnotations/
|
||||
/EssentialsUpdate/nbproject/private/
|
||||
/EssentialsRelease/
|
||||
/EssentialsUpdate/
|
|
@ -612,14 +612,20 @@ public class Essentials extends JavaPlugin implements IEssentials
|
|||
}
|
||||
|
||||
@Override
|
||||
public int broadcastMessage(final String name, final String message)
|
||||
public int broadcastMessage(final IUser sender, final String message)
|
||||
{
|
||||
if (sender == null) {
|
||||
return getServer().broadcastMessage(message);
|
||||
}
|
||||
if (sender.isHidden()) {
|
||||
return 0;
|
||||
}
|
||||
final Player[] players = getServer().getOnlinePlayers();
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
final User user = getUser(player);
|
||||
if (!user.isIgnoredPlayer(name))
|
||||
if (!user.isIgnoredPlayer(sender.getName()))
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,10 @@ public class EssentialsPlayerListener extends PlayerListener
|
|||
return;
|
||||
}
|
||||
|
||||
user.updateActivity(true);
|
||||
Location afk = user.getAfkPosition();
|
||||
if (afk == null || !event.getTo().getWorld().equals(afk.getWorld()) || afk.distanceSquared(event.getTo()) > 9) {
|
||||
user.updateActivity(true);
|
||||
}
|
||||
|
||||
if (!ess.getSettings().getNetherPortalsEnabled())
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@ public interface IEssentials extends Plugin
|
|||
|
||||
World getWorld(String name);
|
||||
|
||||
int broadcastMessage(String name, String message);
|
||||
int broadcastMessage(IUser sender, String message);
|
||||
|
||||
ISettings getSettings();
|
||||
|
||||
|
|
|
@ -54,4 +54,6 @@ public interface IUser
|
|||
InetSocketAddress getAddress();
|
||||
|
||||
String getDisplayName();
|
||||
|
||||
boolean isHidden();
|
||||
}
|
||||
|
|
|
@ -483,7 +483,7 @@ public class Settings implements ISettings
|
|||
@Override
|
||||
public boolean isUpdateEnabled()
|
||||
{
|
||||
return config.getBoolean("update-check", true);
|
||||
return config.getBoolean("update-check", false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -21,12 +21,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||
private transient long lastActivity = System.currentTimeMillis();
|
||||
private boolean hidden = false;
|
||||
private transient boolean godStateBeforeAfk;
|
||||
private transient Location afkPosition;
|
||||
|
||||
User(final Player base, final IEssentials ess)
|
||||
{
|
||||
super(base, ess);
|
||||
teleport = new Teleport(this, ess);
|
||||
godStateBeforeAfk = isGodModeEnabled();
|
||||
afkPosition = getLocation();
|
||||
}
|
||||
|
||||
User update(final Player base)
|
||||
|
@ -355,6 +357,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||
{
|
||||
setGodModeEnabled(godStateBeforeAfk);
|
||||
}
|
||||
if (set && !isAfk()) {
|
||||
afkPosition = getLocation();
|
||||
}
|
||||
super.setAfk(set);
|
||||
}
|
||||
|
||||
|
@ -418,9 +423,9 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||
if (isAfk())
|
||||
{
|
||||
setAfk(false);
|
||||
if (broadcast)
|
||||
if (broadcast && !isHidden())
|
||||
{
|
||||
ess.broadcastMessage(getName(), Util.format("userIsNotAway", getDisplayName()));
|
||||
ess.broadcastMessage(this, Util.format("userIsNotAway", getDisplayName()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -431,7 +436,7 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||
{
|
||||
final long autoafkkick = ess.getSettings().getAutoAfkKick();
|
||||
if (autoafkkick > 0 && lastActivity + autoafkkick * 1000 < System.currentTimeMillis()
|
||||
&& !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
|
||||
&& !isHidden() && !isAuthorized("essentials.kick.exempt") && !isAuthorized("essentials.afk.kickexempt"))
|
||||
{
|
||||
final String kickReason = Util.format("autoAfkKickReason", autoafkkick / 60.0);
|
||||
kickPlayer(kickReason);
|
||||
|
@ -450,7 +455,14 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||
if (!isAfk() && autoafk > 0 && lastActivity + autoafk * 1000 < System.currentTimeMillis())
|
||||
{
|
||||
setAfk(true);
|
||||
ess.broadcastMessage(getName(), Util.format("userIsAway", getDisplayName()));
|
||||
if (!isHidden()) {
|
||||
ess.broadcastMessage(this, Util.format("userIsAway", getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Location getAfkPosition()
|
||||
{
|
||||
return afkPosition;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,13 +34,19 @@ public class Commandafk extends EssentialsCommand
|
|||
if (!user.toggleAfk())
|
||||
{
|
||||
//user.sendMessage(Util.i18n("markedAsNotAway"));
|
||||
ess.broadcastMessage(user.getName(), Util.format("userIsNotAway", user.getDisplayName()));
|
||||
if (!user.isHidden())
|
||||
{
|
||||
ess.broadcastMessage(user, Util.format("userIsNotAway", user.getDisplayName()));
|
||||
}
|
||||
user.updateActivity(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//user.sendMessage(Util.i18n("markedAsAway"));
|
||||
ess.broadcastMessage(user.getName(), Util.format("userIsAway", user.getDisplayName()));
|
||||
if (!user.isHidden())
|
||||
{
|
||||
ess.broadcastMessage(user, Util.format("userIsAway", user.getDisplayName()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,8 +17,8 @@ public class Commandantioch extends EssentialsCommand
|
|||
@Override
|
||||
public void run(final Server server, final User user, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
ess.broadcastMessage(user.getName(), "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
|
||||
ess.broadcastMessage(user.getName(), "who being naughty in My sight, shall snuff it.");
|
||||
ess.broadcastMessage(user, "...lobbest thou thy Holy Hand Grenade of Antioch towards thy foe,");
|
||||
ess.broadcastMessage(user, "who being naughty in My sight, shall snuff it.");
|
||||
|
||||
final Location loc = new TargetBlock(user).getTargetBlock().getLocation();
|
||||
loc.getWorld().spawn(loc, TNTPrimed.class);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package com.earth2me.essentials.commands;
|
||||
|
||||
import com.earth2me.essentials.Console;
|
||||
import com.earth2me.essentials.Util;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
@ -15,14 +14,14 @@ public class Commandbroadcast extends EssentialsCommand
|
|||
}
|
||||
|
||||
@Override
|
||||
public void run(Server server, CommandSender sender, String commandLabel, String[] args) throws Exception
|
||||
public void run(final Server server, final CommandSender sender, final String commandLabel, final String[] args) throws Exception
|
||||
{
|
||||
if (args.length < 1)
|
||||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
|
||||
ess.broadcastMessage(sender instanceof Player ? ((Player)sender).getName() : Console.NAME,
|
||||
ess.broadcastMessage(null,
|
||||
Util.format("broadcast", getFinalArg(args, 0)));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,12 +24,15 @@ public class Commandme extends EssentialsCommand
|
|||
{
|
||||
throw new NotEnoughArgumentsException();
|
||||
}
|
||||
StringBuilder message = new StringBuilder();
|
||||
final StringBuilder message = new StringBuilder();
|
||||
message.append("* ");
|
||||
message.append(user.getDisplayName());
|
||||
message.append(' ');
|
||||
for (int i = 0; i < args.length; i++)
|
||||
{
|
||||
message.append(args[i]);
|
||||
message.append(' ');
|
||||
}
|
||||
ess.broadcastMessage(user.getName(), "* " + user.getDisplayName() + " " + message);
|
||||
ess.broadcastMessage(user, message.toString());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,6 +39,9 @@ public class Commandsethome extends EssentialsCommand
|
|||
}
|
||||
|
||||
}
|
||||
else {
|
||||
throw new Exception(Util.format("maxHomes", 1));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -17,7 +17,7 @@ public class Commandsuicide extends EssentialsCommand
|
|||
{
|
||||
user.setHealth(0);
|
||||
user.sendMessage(Util.i18n("suicideMessage"));
|
||||
ess.broadcastMessage(user.getName(),
|
||||
ess.broadcastMessage(user,
|
||||
Util.format("suicideSuccess",user.getDisplayName()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public class Permissions2Handler implements IPermissionsHandler
|
|||
@Override
|
||||
public boolean hasPermission(final Player base, final String node)
|
||||
{
|
||||
return permissionHandler.permission(base.getWorld().getName(), base.getName(), node);
|
||||
return permissionHandler.permission(base, node);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -230,12 +230,6 @@ remove-god-on-disconnect: false
|
|||
# This only works if no other permission plugins are installed
|
||||
use-bukkit-permissions: false
|
||||
|
||||
# Check for updates
|
||||
# We do not recommend to disable this unless you are using CraftbukkitUpToDate or Bukget.
|
||||
# If you don't like the notices in game, remove the permission
|
||||
# essentials.admin.notices.update from your user.
|
||||
update-check: true
|
||||
|
||||
# Auto-AFK
|
||||
# After this timeout in seconds, the user will be set as afk.
|
||||
# Set to -1 for no timeout.
|
||||
|
|
|
@ -79,7 +79,7 @@ public class EssentialsSpawnPlayerListener extends PlayerListener
|
|||
|
||||
if (ess.getSettings().getAnnounceNewPlayers())
|
||||
{
|
||||
ess.broadcastMessage(user.getName(), ess.getSettings().getAnnounceNewPlayerFormat(user));
|
||||
ess.broadcastMessage(user, ess.getSettings().getAnnounceNewPlayerFormat(user));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue