From d14172203c324d0df2360d442500a0ede9c93ef9 Mon Sep 17 00:00:00 2001 From: Shevchik Date: Wed, 11 Dec 2013 15:15:00 +0400 Subject: [PATCH] Remove sit stop location correction --- src/com/cnaude/chairs/Chairs.java | 51 ------------------------ src/com/cnaude/chairs/EventListener.java | 8 +--- 2 files changed, 1 insertion(+), 58 deletions(-) diff --git a/src/com/cnaude/chairs/Chairs.java b/src/com/cnaude/chairs/Chairs.java index 3eb77e7..3a7dc4d 100644 --- a/src/com/cnaude/chairs/Chairs.java +++ b/src/com/cnaude/chairs/Chairs.java @@ -1,7 +1,6 @@ package com.cnaude.chairs; import java.io.File; -import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -13,10 +12,7 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; -import org.bukkit.World; import org.bukkit.block.Block; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.HandlerList; @@ -68,21 +64,6 @@ public class Chairs extends JavaPlugin { } protocolManager = ProtocolLibrary.getProtocolManager(); new PacketListener(protocolManager, this); - for (final Player player : Bukkit.getOnlinePlayers()) - { - final Location loc = getPlayerSitstoploc(player.getName()); - if (loc != null) - { - Bukkit.getScheduler().scheduleSyncDelayedTask(this, new Runnable() - { - public void run() - { - player.teleport(loc); - player.setSneaking(false); - } - },1); - } - } } @Override @@ -90,7 +71,6 @@ public class Chairs extends JavaPlugin { protocolManager.getAsynchronousManager().unregisterAsyncHandlers(this); protocolManager = null; for (String pName : new HashSet(sit.keySet())) { - savePlayerSitstoploc(pName); ejectPlayerOnDisable(Bukkit.getPlayerExact(pName)); } if (ignoreList != null) { @@ -185,37 +165,6 @@ public class Chairs extends JavaPlugin { } } - - protected void savePlayerSitstoploc(String player) - { - FileConfiguration plconfig = new YamlConfiguration(); - Location sitstop = sitstopteleportloc.get(player); - plconfig.set(player+".world", sitstop.getWorld().getName()); - plconfig.set(player+".xyz", sitstop.toVector()); - plconfig.set(player+".pitch", sitstop.getPitch()); - plconfig.set(player+".yaw", sitstop.getYaw()); - try { - plconfig.save(new File(getDataFolder(),"playersdata"+File.separator+player+".yml")); - } catch (IOException e) { - } - } - protected Location getPlayerSitstoploc(String player) - { - File plfile = new File(getDataFolder(),"playersdata"+File.separator+player+".yml"); - if (plfile.exists()) - { - FileConfiguration plconfig = YamlConfiguration.loadConfiguration(plfile); - World world = Bukkit.getWorld(plconfig.getString(player+".world")); - Vector xyz = plconfig.getVector(player+".xyz"); - Location sitstop = new Location(world,xyz.getX(),xyz.getY(),xyz.getZ()); - sitstop.setPitch((float) plconfig.getDouble(player+".pitch")); - sitstop.setYaw((float) plconfig.getDouble(player+".yaw")); - plfile.delete(); - return sitstop; - } - return null; - } - public void loadConfig() { autoRotate = getConfig().getBoolean("auto-rotate"); signCheck = getConfig().getBoolean("sign-check"); diff --git a/src/com/cnaude/chairs/EventListener.java b/src/com/cnaude/chairs/EventListener.java index 1c39105..521d692 100644 --- a/src/com/cnaude/chairs/EventListener.java +++ b/src/com/cnaude/chairs/EventListener.java @@ -34,12 +34,7 @@ public class EventListener implements Listener { @EventHandler(priority=EventPriority.LOWEST,ignoreCancelled=true) public void onJoin(PlayerJoinEvent e) { - Player player = e.getPlayer(); - Location loc = plugin.getPlayerSitstoploc(player.getName()); - if (loc != null) - { - player.teleport(loc); - } + } @EventHandler(priority=EventPriority.LOWEST) @@ -48,7 +43,6 @@ public class EventListener implements Listener { Player player = event.getPlayer(); if (plugin.sit.containsKey(player.getName())) { - plugin.savePlayerSitstoploc(player.getName()); plugin.unSitPlayer(player,true); } }