mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
yet another command void fix
This commit is contained in:
parent
97caed9313
commit
d0b64c6438
@ -240,16 +240,7 @@ public class EventBlocker extends FreedomService
|
|||||||
@EventHandler(priority = EventPriority.NORMAL)
|
@EventHandler(priority = EventPriority.NORMAL)
|
||||||
public void onPlayerDeath(PlayerDeathEvent event)
|
public void onPlayerDeath(PlayerDeathEvent event)
|
||||||
{
|
{
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
FUtil.fixCommandVoid(event.getEntity());
|
||||||
{
|
|
||||||
for (Entity passengerEntity : p.getPassengers())
|
|
||||||
{
|
|
||||||
if (passengerEntity == event.getEntity())
|
|
||||||
{
|
|
||||||
p.removePassenger(passengerEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
event.setDeathMessage(event.getDeathMessage());
|
event.setDeathMessage(event.getDeathMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import java.util.TimerTask;
|
|||||||
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
import me.totalfreedom.totalfreedommod.playerverification.VPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -121,6 +122,11 @@ public class Command_ride extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (player.getWorld() != playerSender.getWorld())
|
||||||
|
{
|
||||||
|
player.teleport(new Location(player.getWorld(), 0, 256, 0));
|
||||||
|
}
|
||||||
|
|
||||||
player.addPassenger(playerSender);
|
player.addPassenger(playerSender);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -27,6 +27,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -473,4 +474,18 @@ public class FUtil
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void fixCommandVoid(Player player)
|
||||||
|
{
|
||||||
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
for (Entity passengerEntity : p.getPassengers())
|
||||||
|
{
|
||||||
|
if (passengerEntity == player)
|
||||||
|
{
|
||||||
|
p.removePassenger(passengerEntity);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@ import me.totalfreedom.totalfreedommod.FreedomService;
|
|||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -162,16 +163,7 @@ public class WorldManager extends FreedomService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
FUtil.fixCommandVoid(player);
|
||||||
{
|
|
||||||
for (Entity passengerEntity : p.getPassengers())
|
|
||||||
{
|
|
||||||
if (passengerEntity == player)
|
|
||||||
{
|
|
||||||
p.removePassenger(passengerEntity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (player.getWorld().getName().equalsIgnoreCase(targetWorld))
|
if (player.getWorld().getName().equalsIgnoreCase(targetWorld))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user