yet another command void fix

This commit is contained in:
Super_ 2019-12-13 22:17:34 -05:00
parent 97caed9313
commit d0b64c6438
4 changed files with 24 additions and 20 deletions

View File

@ -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());
} }
} }

View File

@ -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;

View File

@ -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);
}
}
}
}
} }

View File

@ -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))
{ {