New version dependent, ProtocolLib -> TinyProtocol, Sub 1.12 ErrorLogger #114
@ -19,7 +19,12 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.minecraft.server.v1_8_R3.ChatComponentText;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
|
||||
@ -28,4 +33,9 @@ public class BountifulWrapper8 implements BountifulWrapper.IBountifulWrapper {
|
||||
public void playPling(Player player) {
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) {
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(new PacketPlayOutChat(new ChatComponentText(BaseComponent.toLegacyText(msg)), (byte)type.ordinal()));
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -28,4 +30,9 @@ public class BountifulWrapper9 implements BountifulWrapper.IBountifulWrapper {
|
||||
public void playPling(Player player) {
|
||||
player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(Player player, ChatMessageType type, BaseComponent... msg) {
|
||||
player.spigot().sendMessage(type, msg);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
package de.steamwar.core;
|
||||
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class BountifulWrapper {
|
||||
@ -28,5 +30,7 @@ public class BountifulWrapper {
|
||||
|
||||
public interface IBountifulWrapper {
|
||||
void playPling(Player player);
|
||||
|
||||
void sendMessage(Player player, ChatMessageType type, BaseComponent... msg);
|
||||
}
|
||||
}
|
||||
|
@ -19,6 +19,7 @@
|
||||
|
||||
package de.steamwar.message;
|
||||
|
||||
import de.steamwar.core.BountifulWrapper;
|
||||
import de.steamwar.core.WorldOfColorWrapper;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
@ -108,10 +109,11 @@ public class Message {
|
||||
msg.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.fromLegacyText(onHover)));
|
||||
if(onClick != null)
|
||||
msg.setClickEvent(onClick);
|
||||
|
||||
if(sender instanceof Player)
|
||||
((Player)sender).spigot().sendMessage(type, msg);
|
||||
BountifulWrapper.impl.sendMessage((Player)sender, type, msg);
|
||||
else
|
||||
sender.spigot().sendMessage(msg);
|
||||
sender.sendMessage(msg.toPlainText());
|
||||
}
|
||||
|
||||
/* Send message to all players */
|
||||
|
In neuem Issue referenzieren
Einen Benutzer sperren