mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-11-03 01:19:58 +01:00
Merge branch 'master' of github.com:essentials/Essentials
This commit is contained in:
commit
b3847270fa
@ -232,8 +232,11 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
pm.registerEvents(worldListener, this);
|
||||
|
||||
//TODO: Check if this should be here, and not above before reload()
|
||||
if (settings.isJailsEnabled())
|
||||
{
|
||||
jails = new Jails(this);
|
||||
confList.add(jails);
|
||||
}
|
||||
|
||||
pm.registerEvents(tntListener, this);
|
||||
|
||||
@ -428,10 +431,17 @@ public class Essentials extends JavaPlugin implements IEssentials
|
||||
}
|
||||
|
||||
@Override
|
||||
public IJails getJails()
|
||||
public IJails getJails() throws UnsupportedOperationException
|
||||
{
|
||||
if (jails == null)
|
||||
{
|
||||
throw new UnsupportedOperationException("Jails are not enabled in your configuration");
|
||||
}
|
||||
else
|
||||
{
|
||||
return jails;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Warps getWarps()
|
||||
|
@ -31,13 +31,11 @@ import org.bukkit.inventory.ItemStack;
|
||||
public class EssentialsPlayerListener implements Listener
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger("Minecraft");
|
||||
private final transient Server server;
|
||||
private final transient IEssentials ess;
|
||||
|
||||
public EssentialsPlayerListener(final IEssentials parent)
|
||||
{
|
||||
this.ess = parent;
|
||||
this.server = parent.getServer();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.NORMAL)
|
||||
@ -218,7 +216,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
return;
|
||||
}
|
||||
|
||||
User user = ess.getUser(event.getPlayer());
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isNPC())
|
||||
{
|
||||
user.setNPC(false);
|
||||
@ -247,8 +245,8 @@ public class EssentialsPlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
|
||||
public void onPlayerTeleport(final PlayerTeleportEvent event)
|
||||
{
|
||||
boolean backListener = ess.getSettings().registerBackInListener();
|
||||
boolean teleportInvulnerability = ess.getSettings().isTeleportInvulnerability();
|
||||
final boolean backListener = ess.getSettings().registerBackInListener();
|
||||
final boolean teleportInvulnerability = ess.getSettings().isTeleportInvulnerability();
|
||||
if (backListener || teleportInvulnerability)
|
||||
{
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
@ -324,15 +322,12 @@ public class EssentialsPlayerListener implements Listener
|
||||
final String newWorld = event.getPlayer().getLocation().getWorld().getName();
|
||||
user.setDisplayNick();
|
||||
updateCompass(user);
|
||||
if (ess.getSettings().getNoGodWorlds().contains(newWorld))
|
||||
{
|
||||
if (user.isGodModeEnabledRaw())
|
||||
if (ess.getSettings().getNoGodWorlds().contains(newWorld) && user.isGodModeEnabledRaw())
|
||||
{
|
||||
user.sendMessage(_("noGodWorldWarning"));
|
||||
}
|
||||
}
|
||||
|
||||
if(!event.getPlayer().getWorld().getName().equals(newWorld))
|
||||
if (!event.getPlayer().getWorld().getName().equals(newWorld))
|
||||
{
|
||||
user.sendMessage(_("currentWorld", newWorld));
|
||||
}
|
||||
@ -344,11 +339,7 @@ public class EssentialsPlayerListener implements Listener
|
||||
switch (event.getAction())
|
||||
{
|
||||
case RIGHT_CLICK_BLOCK:
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (event.getClickedBlock().getTypeId() == Material.BED_BLOCK.getId() && ess.getSettings().getUpdateBedAtDaytime())
|
||||
if (!event.isCancelled() && event.getClickedBlock().getTypeId() == Material.BED_BLOCK.getId() && ess.getSettings().getUpdateBedAtDaytime())
|
||||
{
|
||||
event.getPlayer().setBedSpawnLocation(event.getClickedBlock().getLocation());
|
||||
}
|
||||
@ -409,16 +400,14 @@ public class EssentialsPlayerListener implements Listener
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = true)
|
||||
public void onPlayerPickupItem(final PlayerPickupItemEvent event)
|
||||
{
|
||||
if (!ess.getSettings().getDisableItemPickupWhileAfk())
|
||||
if (ess.getSettings().getDisableItemPickupWhileAfk())
|
||||
{
|
||||
return;
|
||||
}
|
||||
final User user = ess.getUser(event.getPlayer());
|
||||
if (user.isAfk())
|
||||
if (ess.getUser(event.getPlayer()).isAfk())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void onInventoryClickEvent(final InventoryClickEvent event)
|
||||
|
@ -37,7 +37,7 @@ public interface IEssentials extends Plugin
|
||||
|
||||
BukkitScheduler getScheduler();
|
||||
|
||||
IJails getJails();
|
||||
IJails getJails() throws UnsupportedOperationException;
|
||||
|
||||
Warps getWarps();
|
||||
|
||||
|
@ -173,4 +173,6 @@ public interface ISettings extends IConf
|
||||
long getTeleportInvulnerability();
|
||||
|
||||
boolean isTeleportInvulnerability();
|
||||
|
||||
boolean isJailsEnabled();
|
||||
}
|
||||
|
@ -780,4 +780,10 @@ public class Settings implements ISettings
|
||||
{
|
||||
return teleportInvulnerability;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isJailsEnabled()
|
||||
{
|
||||
return config.getBoolean("enable-jails", true);
|
||||
}
|
||||
}
|
||||
|
@ -171,6 +171,9 @@ public class MetricsStarter implements Runnable
|
||||
|
||||
metrics.start();
|
||||
|
||||
}
|
||||
catch (UnsupportedOperationException ex)
|
||||
{
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -44,6 +44,9 @@ change-displayname: true
|
||||
# Don't forget to remove the # infront of the line
|
||||
#add-prefix-suffix: false
|
||||
|
||||
# Whether or not jails are activated
|
||||
enable-jails: true
|
||||
|
||||
# The delay, in seconds, required between /home, /tp, etc.
|
||||
teleport-cooldown: 0
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user