summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorementalo <suror@gmx.co.uk>2011-12-06 22:56:38 +0000
committerementalo <suror@gmx.co.uk>2011-12-06 22:56:38 +0000
commitb9077d91a57a47b0762681fde382e8a392c7bc46 (patch)
tree4faa95daebb01d9f1d67a1b9c0d897865de1e433
parentff13279e6c2e9fddf1da4320462c6be4db2580d6 (diff)
downloadEssentials-b9077d91a57a47b0762681fde382e8a392c7bc46.tar
Essentials-b9077d91a57a47b0762681fde382e8a392c7bc46.tar.gz
Essentials-b9077d91a57a47b0762681fde382e8a392c7bc46.tar.lz
Essentials-b9077d91a57a47b0762681fde382e8a392c7bc46.tar.xz
Essentials-b9077d91a57a47b0762681fde382e8a392c7bc46.zip
Adding ability to save /back location from teleport events outside essentilals
New config setting to turn this on "register-back-in-listener" Test #1200 CB#1560 / B#1055
-rw-r--r--Essentials/src/com/earth2me/essentials/Essentials.java3
-rw-r--r--Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/ISettings.java2
-rw-r--r--Essentials/src/com/earth2me/essentials/OfflinePlayer.java13
-rw-r--r--Essentials/src/com/earth2me/essentials/Settings.java6
-rw-r--r--Essentials/src/config.yml4
-rw-r--r--Essentials/test/com/earth2me/essentials/FakeServer.java6
-rw-r--r--lib/bukkit-1.0.0-R1-SNAPSHOT.jarbin4398306 -> 4402721 bytes
-rw-r--r--lib/craftbukkit-1.0.0-SNAPSHOT.jarbin9794342 -> 9803490 bytes
9 files changed, 43 insertions, 4 deletions
diff --git a/Essentials/src/com/earth2me/essentials/Essentials.java b/Essentials/src/com/earth2me/essentials/Essentials.java
index 376e0318c..8e5a2f588 100644
--- a/Essentials/src/com/earth2me/essentials/Essentials.java
+++ b/Essentials/src/com/earth2me/essentials/Essentials.java
@@ -56,13 +56,12 @@ import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitScheduler;
-import org.yaml.snakeyaml.Yaml;
import org.yaml.snakeyaml.error.YAMLException;
public class Essentials extends JavaPlugin implements IEssentials
{
- public static final int BUKKIT_VERSION = 1538;
+ public static final int BUKKIT_VERSION = 1560;
private static final Logger LOGGER = Logger.getLogger("Minecraft");
private transient ISettings settings;
private final transient TNTExplodeListener tntListener = new TNTExplodeListener(this);
diff --git a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
index a9e4bcac7..5525b2562 100644
--- a/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
+++ b/Essentials/src/com/earth2me/essentials/EssentialsPlayerListener.java
@@ -20,6 +20,8 @@ import org.bukkit.entity.Player;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerLoginEvent.Result;
import org.bukkit.event.player.*;
+import org.bukkit.event.player.PlayerTeleportEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
@@ -225,12 +227,19 @@ public class EssentialsPlayerListener extends PlayerListener
@Override
public void onPlayerTeleport(PlayerTeleportEvent event)
- {
+ {
if (event.isCancelled())
{
return;
}
- final User user = ess.getUser(event.getPlayer());
+
+ final User user = ess.getUser(event.getPlayer());
+ //There is TeleportCause.COMMMAND but plugins have to actively pass the cause in on their teleports.
+ if(event.getCause() == TeleportCause.PLUGIN && ess.getSettings().registerBackInListener())
+ {
+ user.setLastLocation();
+ }
+
if (ess.getSettings().changeDisplayName())
{
user.setDisplayNick();
diff --git a/Essentials/src/com/earth2me/essentials/ISettings.java b/Essentials/src/com/earth2me/essentials/ISettings.java
index de25c5c4f..97b0fad93 100644
--- a/Essentials/src/com/earth2me/essentials/ISettings.java
+++ b/Essentials/src/com/earth2me/essentials/ISettings.java
@@ -144,4 +144,6 @@ public interface ISettings extends IConf
boolean getRepairEnchanted();
boolean getIsWorldTeleportPermissions();
+
+ boolean registerBackInListener();
}
diff --git a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
index b554ec4fe..45359a837 100644
--- a/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
+++ b/Essentials/src/com/earth2me/essentials/OfflinePlayer.java
@@ -12,6 +12,7 @@ import org.bukkit.*;
import org.bukkit.block.Block;
import org.bukkit.entity.*;
import org.bukkit.event.entity.EntityDamageEvent;
+import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.map.MapView;
@@ -803,4 +804,16 @@ public class OfflinePlayer implements Player
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public boolean teleport(Location lctn, TeleportCause tc)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
+
+ @Override
+ public boolean teleport(Entity entity, TeleportCause tc)
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/Essentials/src/com/earth2me/essentials/Settings.java b/Essentials/src/com/earth2me/essentials/Settings.java
index b06677b44..efda428ef 100644
--- a/Essentials/src/com/earth2me/essentials/Settings.java
+++ b/Essentials/src/com/earth2me/essentials/Settings.java
@@ -566,4 +566,10 @@ public class Settings implements ISettings
{
return config.getBoolean("world-teleport-permissions", false);
}
+
+ @Override
+ public boolean registerBackInListener()
+ {
+ return config.getBoolean("register-back-in-listener", false);
+ }
}
diff --git a/Essentials/src/config.yml b/Essentials/src/config.yml
index a507959c5..3b7637fea 100644
--- a/Essentials/src/config.yml
+++ b/Essentials/src/config.yml
@@ -239,6 +239,10 @@ oversized-stacksize: 64
# essentials.repair.enchanted
repair-enchanted: true
+#Do you want essentials to keep track of previous location for /back in the teleport listener?
+#If you set this to true any plugin that uses teleport will have the previous location registered.
+register-back-in-listener: false
+
############################################################
# +------------------------------------------------------+ #
# | EssentialsHome | #
diff --git a/Essentials/test/com/earth2me/essentials/FakeServer.java b/Essentials/test/com/earth2me/essentials/FakeServer.java
index eb549ca37..d0fe51c9a 100644
--- a/Essentials/test/com/earth2me/essentials/FakeServer.java
+++ b/Essentials/test/com/earth2me/essentials/FakeServer.java
@@ -593,4 +593,10 @@ public class FakeServer implements Server
{
throw new UnsupportedOperationException("Not supported yet.");
}
+
+ @Override
+ public OfflinePlayer[] getOfflinePlayers()
+ {
+ throw new UnsupportedOperationException("Not supported yet.");
+ }
}
diff --git a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar
index 8959c5712..be0a1a49c 100644
--- a/lib/bukkit-1.0.0-R1-SNAPSHOT.jar
+++ b/lib/bukkit-1.0.0-R1-SNAPSHOT.jar
Binary files differ
diff --git a/lib/craftbukkit-1.0.0-SNAPSHOT.jar b/lib/craftbukkit-1.0.0-SNAPSHOT.jar
index a30a1eb2c..341b9750d 100644
--- a/lib/craftbukkit-1.0.0-SNAPSHOT.jar
+++ b/lib/craftbukkit-1.0.0-SNAPSHOT.jar
Binary files differ