Merge pull request #576 from confuser/master

Fixed bukkit plot chat
This commit is contained in:
Jesse Boyd 2015-08-23 22:01:35 +10:00
commit dbdd207390
2 changed files with 17 additions and 4 deletions

View File

@ -610,10 +610,17 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
return;
}
final PlotWorld plotworld = PS.get().getPlotWorld(world);
final PlotPlayer plr = BukkitUtil.getPlayer(player);
if (!plotworld.PLOT_CHAT && (plr.getMeta("chat") == null || !(Boolean) plr.getMeta("chat"))) {
if (!plotworld.PLOT_CHAT) {
return;
}
final PlotPlayer plr = BukkitUtil.getPlayer(player);
if (!plr.getAttribute("chat")) {
return;
}
final Location loc = BukkitUtil.getLocation(player);
final Plot plot = MainUtil.getPlot(loc);
if (plot == null) {
@ -631,9 +638,10 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
recipients.add(p);
}
}
format = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", sender).replaceAll("%msg%", message);
format = format.replaceAll("%plot_id%", id.x + ";" + id.y).replaceAll("%sender%", "%s").replaceAll("%msg%", "%s");
format = ChatColor.translateAlternateColorCodes('&', format);
event.setFormat(format);
event.setMessage(message);
}
@EventHandler(priority = EventPriority.HIGHEST)

View File

@ -4,9 +4,14 @@ import java.util.Date;
import java.util.HashSet;
import java.util.UUID;
import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.player.gamemode.GameMode;
import org.spongepowered.api.entity.player.gamemode.GameModes;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.chat.ChatType;
import org.spongepowered.api.text.chat.ChatTypes;
import com.flowpowered.math.vector.Vector3d;
@ -100,7 +105,7 @@ public class SpongePlayer extends PlotPlayer {
@Override
public void sendMessage(String message) {
player.sendMessage(ChatTypes.CHAT, message);
player.sendMessage(ChatTypes.CHAT, Texts.of(message));
}
@Override