Added a fix for inventory not closing on /tp

This commit is contained in:
Acrobot 2013-02-07 14:17:03 +01:00
parent a8e8078348
commit 8d7389b7e0
2 changed files with 17 additions and 1 deletions

View File

@ -26,6 +26,7 @@ import com.Acrobot.ChestShop.Listeners.PreTransaction.*;
import com.Acrobot.ChestShop.Listeners.PreTransaction.ErrorMessageSender;
import com.Acrobot.ChestShop.Listeners.PreTransaction.PermissionChecker;
import com.Acrobot.ChestShop.Listeners.ShopRefundListener;
import com.Acrobot.ChestShop.Listeners.TeleportFixListener;
import com.Acrobot.ChestShop.Logging.FileFormatter;
import com.Acrobot.ChestShop.Metadata.ItemDatabase;
import com.Acrobot.ChestShop.Signs.RestrictedSign;
@ -180,6 +181,7 @@ public class ChestShop extends JavaPlugin {
registerEvent(new ShopRefundListener());
registerEvent(new ShortNameSaver());
registerEvent(new TeleportFixListener());
}
private void registerPreShopCreationEvents() {

View File

@ -1,7 +1,21 @@
package com.Acrobot.ChestShop.Listeners;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerTeleportEvent;
/**
* @author Acrobot
*/
public class TeleportFixListener {
public class TeleportFixListener implements Listener {
@EventHandler(priority = EventPriority.MONITOR)
public static void onTeleport(PlayerTeleportEvent event) {
if (event.isCancelled()) {
return;
}
event.getPlayer().closeInventory();
}
}