mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2024-07-02 18:53:43 +00:00
[trunk] new socialspy command. if toggled will show the output of /msg and /mail in the chat for the toggle persons. usage /socialspy to turn on, /socialspy again to turn off
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1338 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
21601e34d2
commit
d0dc96542b
|
@ -23,7 +23,7 @@ import org.bukkit.plugin.java.*;
|
||||||
public class Essentials extends JavaPlugin
|
public class Essentials extends JavaPlugin
|
||||||
{
|
{
|
||||||
public static final String AUTHORS = "Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo and ceulemans.";
|
public static final String AUTHORS = "Zenexer, ementalo, Aelux, Brettflan, KimKandor, snowleo and ceulemans.";
|
||||||
public static final int minBukkitBuildVersion = 733;
|
public static final int minBukkitBuildVersion = 740;
|
||||||
private static final Logger logger = Logger.getLogger("Minecraft");
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
private Settings settings;
|
private Settings settings;
|
||||||
private EssentialsPlayerListener playerListener;
|
private EssentialsPlayerListener playerListener;
|
||||||
|
@ -304,6 +304,22 @@ public class Essentials extends JavaPlugin
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
|
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if ("msg".equals(commandLabel.toLowerCase()) || "mail".equals(commandLabel.toLowerCase()) & sender instanceof Player)
|
||||||
|
{
|
||||||
|
StringBuilder str = new StringBuilder();
|
||||||
|
for (String a : args)
|
||||||
|
{
|
||||||
|
str.append(a + " ");
|
||||||
|
}
|
||||||
|
for (Player player : getServer().getOnlinePlayers())
|
||||||
|
{
|
||||||
|
if (getUser(player).isSocialSpyEnabled())
|
||||||
|
{
|
||||||
|
player.sendMessage(getUser(sender).getDisplayName() + " : " + str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
// Allow plugins to override the command via onCommand
|
// Allow plugins to override the command via onCommand
|
||||||
if (!getSettings().isCommandOverridden(command.getName()) && !commandLabel.startsWith("e"))
|
if (!getSettings().isCommandOverridden(command.getName()) && !commandLabel.startsWith("e"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -55,6 +55,7 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
lastLogout = _getLastLogout();
|
lastLogout = _getLastLogout();
|
||||||
afk = getAfk();
|
afk = getAfk();
|
||||||
geolocation = _getGeoLocation();
|
geolocation = _getGeoLocation();
|
||||||
|
isSocialSpyEnabled = _isSocialSpyEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
public double getMoney()
|
public double getMoney()
|
||||||
|
@ -391,6 +392,12 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
setTeleportEnabled(ret);
|
setTeleportEnabled(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
public boolean toggleSocialSpy()
|
||||||
|
{
|
||||||
|
boolean ret = !isSocialSpyEnabled();
|
||||||
|
setSocialSpyEnabled(ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
private List<String> ignoredPlayers;
|
private List<String> ignoredPlayers;
|
||||||
|
|
||||||
public List<String> getIgnoredPlayers()
|
public List<String> getIgnoredPlayers()
|
||||||
|
@ -670,4 +677,22 @@ public abstract class UserData extends PlayerExtension implements IConf
|
||||||
}
|
}
|
||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSocialSpyEnabled;
|
||||||
|
|
||||||
|
private boolean _isSocialSpyEnabled()
|
||||||
|
{
|
||||||
|
return config.getBoolean("socialspy", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isSocialSpyEnabled()
|
||||||
|
{
|
||||||
|
return isSocialSpyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocialSpyEnabled(Boolean status)
|
||||||
|
{
|
||||||
|
config.setProperty("socialspy", status);
|
||||||
|
config.save();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.commands.EssentialsCommand;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package com.earth2me.essentials.commands;
|
||||||
|
import com.earth2me.essentials.User;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
|
||||||
|
public class Commandsocialspy extends EssentialsCommand
|
||||||
|
{
|
||||||
|
public Commandsocialspy()
|
||||||
|
{
|
||||||
|
super("socialspy");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
|
{
|
||||||
|
|
||||||
|
charge(user);
|
||||||
|
user.sendMessage("§7SocialSpy " + (user.toggleSocialSpy() ? "enabled." : "disabled."));
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -226,6 +226,9 @@ commands:
|
||||||
description: Set the value of an item for sale, will add item if doesn't exist
|
description: Set the value of an item for sale, will add item if doesn't exist
|
||||||
usage: /<command> [itemname|id] [price]
|
usage: /<command> [itemname|id] [price]
|
||||||
aliases: [esetworth]
|
aliases: [esetworth]
|
||||||
|
socialspy:
|
||||||
|
description: Toggles if you can see /msg and /mail commands in chat.
|
||||||
|
usage: /<command>
|
||||||
spawnmob:
|
spawnmob:
|
||||||
description: Spawns a mob.
|
description: Spawns a mob.
|
||||||
usage: /<command> [mob]<:data><,mount<:data>> <amount>
|
usage: /<command> [mob]<:data><,mount<:data>> <amount>
|
||||||
|
|
Loading…
Reference in a new issue