mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 20:29:20 +00:00
Merge branch 'master' into release
This commit is contained in:
commit
aa3606007a
8 changed files with 58 additions and 5 deletions
|
@ -217,6 +217,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
pm.registerEvent(Type.PLAYER_INTERACT, jailPlayerListener, Priority.Low, this);
|
pm.registerEvent(Type.PLAYER_INTERACT, jailPlayerListener, Priority.Low, this);
|
||||||
pm.registerEvent(Type.PLAYER_RESPAWN, jailPlayerListener, Priority.High, this);
|
pm.registerEvent(Type.PLAYER_RESPAWN, jailPlayerListener, Priority.High, this);
|
||||||
pm.registerEvent(Type.PLAYER_TELEPORT, jailPlayerListener, Priority.High, this);
|
pm.registerEvent(Type.PLAYER_TELEPORT, jailPlayerListener, Priority.High, this);
|
||||||
|
pm.registerEvent(Type.PLAYER_JOIN, jailPlayerListener, Priority.High, this);
|
||||||
|
|
||||||
if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2)
|
if (settings.isNetherEnabled() && getServer().getWorlds().size() < 2)
|
||||||
{
|
{
|
||||||
|
@ -328,6 +329,7 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m = m.replace("{ONLINE}", Integer.toString(getServer().getOnlinePlayers().length - playerHidden));
|
m = m.replace("{ONLINE}", Integer.toString(getServer().getOnlinePlayers().length - playerHidden));
|
||||||
|
m = m.replace("{UNIQUE}", Integer.toString(users.size()));
|
||||||
|
|
||||||
if (m.matches(".*\\{PLAYERLIST\\}.*"))
|
if (m.matches(".*\\{PLAYERLIST\\}.*"))
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,6 +103,11 @@ public final class InventoryWorkaround
|
||||||
for (int i = 0; i < combined.length; i++)
|
for (int i = 0; i < combined.length; i++)
|
||||||
{
|
{
|
||||||
final ItemStack item = combined[i];
|
final ItemStack item = combined[i];
|
||||||
|
if (item == null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// Do we already have a stack of it?
|
// Do we already have a stack of it?
|
||||||
|
|
|
@ -42,7 +42,10 @@ public class Jail extends BlockListener implements IConf
|
||||||
|
|
||||||
public void sendToJail(User user, String jail) throws Exception
|
public void sendToJail(User user, String jail) throws Exception
|
||||||
{
|
{
|
||||||
user.getTeleport().now(getJail(jail));
|
if (!(user.getBase() instanceof OfflinePlayer))
|
||||||
|
{
|
||||||
|
user.getTeleport().now(getJail(jail));
|
||||||
|
}
|
||||||
user.setJail(jail);
|
user.setJail(jail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.earth2me.essentials;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import org.bukkit.event.player.PlayerInteractEvent;
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
|
import org.bukkit.event.player.PlayerJoinEvent;
|
||||||
import org.bukkit.event.player.PlayerListener;
|
import org.bukkit.event.player.PlayerListener;
|
||||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||||
import org.bukkit.event.player.PlayerTeleportEvent;
|
import org.bukkit.event.player.PlayerTeleportEvent;
|
||||||
|
@ -63,5 +64,21 @@ public class JailPlayerListener extends PlayerListener
|
||||||
user.sendMessage(Util.i18n("jailMessage"));
|
user.sendMessage(Util.i18n("jailMessage"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onPlayerJoin(final PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
User u = ess.getUser(event.getPlayer());
|
||||||
|
if (u.isJailed())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ess.getJail().sendToJail(u, u.getJail());
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
LOGGER.log(Level.WARNING, Util.i18n("returnPlayerToJailError"), ex);
|
||||||
|
}
|
||||||
|
u.sendMessage(Util.i18n("jailMessage"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,6 +15,7 @@ public class Commandsetjail extends EssentialsCommand
|
||||||
@Override
|
@Override
|
||||||
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
public void run(Server server, User user, String commandLabel, String[] args) throws Exception
|
||||||
{
|
{
|
||||||
|
|
||||||
if (args.length < 1)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.earth2me.essentials.commands;
|
package com.earth2me.essentials.commands;
|
||||||
|
|
||||||
|
import com.earth2me.essentials.OfflinePlayer;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import com.earth2me.essentials.User;
|
import com.earth2me.essentials.User;
|
||||||
|
@ -74,7 +75,10 @@ public class Commandtogglejail extends EssentialsCommand
|
||||||
p.setJailTimeout(0);
|
p.setJailTimeout(0);
|
||||||
p.sendMessage("§7You have been released");
|
p.sendMessage("§7You have been released");
|
||||||
p.setJail(null);
|
p.setJail(null);
|
||||||
p.getTeleport().back();
|
if (!(p.getBase() instanceof OfflinePlayer))
|
||||||
|
{
|
||||||
|
p.getTeleport().back();
|
||||||
|
}
|
||||||
sender.sendMessage("§7Player " + p.getName() + " unjailed.");
|
sender.sendMessage("§7Player " + p.getName() + " unjailed.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,13 +22,25 @@ public class Commandwhois extends EssentialsCommand
|
||||||
{
|
{
|
||||||
throw new NotEnoughArgumentsException();
|
throw new NotEnoughArgumentsException();
|
||||||
}
|
}
|
||||||
|
boolean showhidden = false;
|
||||||
|
if (sender instanceof Player)
|
||||||
|
{
|
||||||
|
if (ess.getUser(sender).isAuthorized("essentials.list.hidden"))
|
||||||
|
{
|
||||||
|
showhidden = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
showhidden = true;
|
||||||
|
}
|
||||||
String whois = args[0].toLowerCase();
|
String whois = args[0].toLowerCase();
|
||||||
charge(sender);
|
charge(sender);
|
||||||
int prefixLength = ChatColor.stripColor(ess.getSettings().getNicknamePrefix()).length();
|
int prefixLength = ChatColor.stripColor(ess.getSettings().getNicknamePrefix()).length();
|
||||||
for (Player p : server.getOnlinePlayers())
|
for (Player p : server.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
User u = ess.getUser(p);
|
User u = ess.getUser(p);
|
||||||
if (u.isHidden())
|
if (u.isHidden() && !showhidden)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,15 @@ public abstract class EssentialsCommand implements IEssentialsCommand
|
||||||
protected User getPlayer(Server server, String[] args, int pos, boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException
|
protected User getPlayer(Server server, String[] args, int pos, boolean getOffline) throws NoSuchFieldException, NotEnoughArgumentsException
|
||||||
{
|
{
|
||||||
if (args.length <= pos) throw new NotEnoughArgumentsException();
|
if (args.length <= pos) throw new NotEnoughArgumentsException();
|
||||||
|
User user = ess.getAllUsers().get(args[pos].toLowerCase());
|
||||||
|
if (user != null)
|
||||||
|
{
|
||||||
|
if(!getOffline && user.isHidden())
|
||||||
|
{
|
||||||
|
throw new NoSuchFieldException(Util.i18n("playerNotFound"));
|
||||||
|
}
|
||||||
|
return user;
|
||||||
|
}
|
||||||
List<Player> matches = server.matchPlayer(args[pos]);
|
List<Player> matches = server.matchPlayer(args[pos]);
|
||||||
|
|
||||||
if (matches.size() < 1)
|
if (matches.size() < 1)
|
||||||
|
|
Loading…
Reference in a new issue