Fix kill messages inserting a space below them in chat.

This commit is contained in:
Ben 2016-05-01 23:03:18 +01:00
parent eae972a3e6
commit e139bea465
3 changed files with 26 additions and 14 deletions

View File

@ -28,6 +28,7 @@ import org.bukkit.util.BlockIterator;
import org.bukkit.util.Vector;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.events.PlayerMessageEvent;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PlayerConnection;
@ -276,7 +277,13 @@ public class UtilPlayer
if (wiki)
message = UtilWiki.link(message);
*/
PlayerMessageEvent event = UtilServer.CallEvent(new PlayerMessageEvent((Player) client, message));
if (event.isCancelled())
return;
((Player) client).sendMessage(message);
}

View File

@ -9,14 +9,11 @@ import java.util.Set;
import java.util.TimeZone;
import java.util.UUID;
import mineplex.core.recharge.Recharge;
import mineplex.game.clans.clans.ban.ClansBanManager;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
@ -47,6 +44,7 @@ import mineplex.core.blockrestore.BlockRestore;
import mineplex.core.chat.Chat;
import mineplex.core.common.Pair;
import mineplex.core.common.Rank;
import mineplex.core.common.events.PlayerMessageEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
@ -73,6 +71,7 @@ import mineplex.core.preferences.PreferencesManager;
import mineplex.core.projectile.ProjectileManager;
import mineplex.core.punish.Punish;
import mineplex.core.punish.PunishClient;
import mineplex.core.recharge.Recharge;
import mineplex.core.stats.StatsManager;
import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport;
@ -1305,17 +1304,23 @@ public class ClansManager extends MiniClientPlugin<ClientClan>implements IRelati
}
}
@EventHandler
public void message(PlayerMessageEvent event)
{
if(!_tutorial.inTutorial(event.getPlayer()))
{
return;
}
if (event.getMessage().startsWith(C.cBlue + "Death>"))
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.HIGH)
public void handleClansDeath(PlayerDeathEvent event)
{
event.setDeathMessage(null);
for(Player player : UtilServer.getPlayers())
{
if(!_tutorial.inTutorial(player))
player.sendMessage(event.getDeathMessage());
}
PlayerClan playerClan;
PlayerClan killerClan = null;

View File

@ -411,7 +411,7 @@ public class CombatManager extends MiniPlugin
}
}
@EventHandler(priority = EventPriority.LOWEST)
@EventHandler(priority = EventPriority.LOW)
public void HandleDeath(PlayerDeathEvent event)
{
event.setDeathMessage(null);
@ -485,7 +485,7 @@ public class CombatManager extends MiniPlugin
killPlayer += " + " + log.GetAssists();
String weapon = log.GetKiller().GetLastDamageSource();
UtilPlayer.message(
cur,
F.main("Death",