mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-02-16 20:31:20 +01:00
added reflection for 1.8_R2
This commit is contained in:
parent
3c93be91e6
commit
4561c7faf0
@ -39,7 +39,7 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
this.setEnabled(false);
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
System.out.println("This version of craftbukkit is not yet supported, please notify the author and give them this version v:" + version);
|
||||
System.out.println("This version of craftbukkit is not yet supported, please notify the author and give version v:" + version);
|
||||
this.setEnabled(false);
|
||||
} catch (InstantiationException e) {
|
||||
e.printStackTrace();
|
||||
|
@ -103,12 +103,12 @@ public class Listeners implements Listener {
|
||||
if(PortalMessagesDisplay == 1 && warped){
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
|
||||
player.sendMessage("");
|
||||
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have warped to \u00A7e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ") + "\u00A7.");
|
||||
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been warped to \u00A7e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ") + "\u00A7.");
|
||||
player.sendMessage("");
|
||||
}
|
||||
else if(PortalMessagesDisplay == 2 && warped){
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
|
||||
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have warped to \u00A7e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ") + "\u00A7a.\"}", player);
|
||||
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have been warped to \u00A7e" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ") + "\u00A7a.\"}", player);
|
||||
/**plugin.nmsAccess.sendActionBarMessage("[{text:\"You have warped to \",color:green},{text:\"" + config.getConfig().getString(Portal.Portals[portalId].portalName + ".destination").replaceAll("_", " ")
|
||||
+ "\",color:yellow},{\"text\":\".\",color:green}]", player);*/
|
||||
}
|
||||
|
27
src/com/sekwah/advancedportals/compat/v1_8_R2.java
Normal file
27
src/com/sekwah/advancedportals/compat/v1_8_R2.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.sekwah.advancedportals.compat;
|
||||
|
||||
import net.minecraft.server.v1_8_R2.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class v1_8_R2 implements NMS {
|
||||
|
||||
@Override
|
||||
public void sendRawMessage(String rawMessage, Player player) {
|
||||
IChatBaseComponent comp = IChatBaseComponent.ChatSerializer.a(rawMessage);
|
||||
// "json message", position(0: chat (chat box), 1: system message (chat box), 2: above action bar)
|
||||
PacketPlayOutChat packet = new PacketPlayOutChat(comp, (byte) 1);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendActionBarMessage(String rawMessage, Player player) {
|
||||
IChatBaseComponent comp = IChatBaseComponent.ChatSerializer.a(rawMessage);
|
||||
// "json message", position(0: chat (chat box), 1: system message (chat box), 2: above action bar)
|
||||
PacketPlayOutChat packet = new PacketPlayOutChat(comp, (byte) 2);
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user