mirror of
https://github.com/sekwah41/Advanced-Portals.git
synced 2025-02-16 20:31:20 +01:00
Added 1.9 support
This commit is contained in:
parent
b522b169b9
commit
bbd9984ac1
@ -65,11 +65,11 @@ public class AdvancedPortalsPlugin extends JavaPlugin {
|
||||
this.customPrefix = config.getConfig().getString("CustomPrefix");
|
||||
}
|
||||
|
||||
ConfigAccessor portalconfig = new ConfigAccessor(this, "Portals.yml");
|
||||
portalconfig.saveDefaultConfig();
|
||||
ConfigAccessor portalConfig = new ConfigAccessor(this, "Portals.yml");
|
||||
portalConfig.saveDefaultConfig();
|
||||
|
||||
ConfigAccessor destinationconfig = new ConfigAccessor(this, "Destinations.yml");
|
||||
destinationconfig.saveDefaultConfig();
|
||||
ConfigAccessor destinationConfig = new ConfigAccessor(this, "Destinations.yml");
|
||||
destinationConfig.saveDefaultConfig();
|
||||
|
||||
|
||||
// Loads the portal and destination editors
|
||||
|
@ -111,12 +111,12 @@ public class Listeners implements Listener {
|
||||
boolean warped = Portal.activate(player, portal);
|
||||
if(PortalMessagesDisplay == 1 && warped){
|
||||
player.sendMessage("");
|
||||
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been warped to \u00A7e" + Portal.getDestination(portal.portalName).replaceAll("_", " ") + "\u00A7.");
|
||||
player.sendMessage("\u00A7a[\u00A7eAdvancedPortals\u00A7a] You have been warped to \u00A7e" + portal.destiation.replaceAll("_", " ") + "\u00A7.");
|
||||
player.sendMessage("");
|
||||
}
|
||||
else if(PortalMessagesDisplay == 2 && warped){
|
||||
ConfigAccessor config = new ConfigAccessor(plugin, "Portals.yml");
|
||||
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have been warped to \u00A7e" + config.getConfig().getString(portal.portalName + ".destination").replaceAll("_", " ") + "\u00A7a.\"}", player);
|
||||
plugin.nmsAccess.sendActionBarMessage("{text:\"\u00A7aYou have been warped to \u00A7e" + portal.destiation.replaceAll("_", " ") + "\u00A7a.\"}", player);
|
||||
/**plugin.nmsAccess.sendActionBarMessage("[{text:\"You have warped to \",color:green},{text:\"" + config.getConfig().getString(portal.portalName + ".destination").replaceAll("_", " ")
|
||||
+ "\",color:yellow},{\"text\":\".\",color:green}]", player);*/
|
||||
}
|
||||
|
27
src/com/sekwah/advancedportals/compat/bukkit/v1_9_R1.java
Normal file
27
src/com/sekwah/advancedportals/compat/bukkit/v1_9_R1.java
Normal file
@ -0,0 +1,27 @@
|
||||
package com.sekwah.advancedportals.compat.bukkit;
|
||||
|
||||
import net.minecraft.server.v1_9_R1.IChatBaseComponent;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
||||
public class v1_9_R1 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