mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-13 10:01:29 +01:00
Update for Spigot 1.9
This commit is contained in:
parent
e2bd187844
commit
2e9abd1a53
10
dependency-reduced-pom.xml
Executable file → Normal file
10
dependency-reduced-pom.xml
Executable file → Normal file
@ -126,7 +126,7 @@
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.8.8</version>
|
||||
<version>1.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@ -135,6 +135,12 @@
|
||||
<version>1.8.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-19</artifactId>
|
||||
<version>1.9</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-184</artifactId>
|
||||
@ -385,7 +391,7 @@
|
||||
<properties>
|
||||
<build.number>SNAPSHOT</build.number>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<bukkit.version>1.8.8</bukkit.version>
|
||||
<bukkit.version>1.9</bukkit.version>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
|
10
pom.xml
10
pom.xml
@ -6,7 +6,7 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<!-- Bukkit API Version, change if out dated -->
|
||||
<bukkit.version>1.8.8</bukkit.version>
|
||||
<bukkit.version>1.9</bukkit.version>
|
||||
<build.number>SNAPSHOT</build.number>
|
||||
</properties>
|
||||
|
||||
@ -85,6 +85,14 @@
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-19</artifactId>
|
||||
<version>1.9</version>
|
||||
<type>jar</type>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>spigot-184</artifactId>
|
||||
|
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2015 cnaude
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package com.cnaude.purpleirc.Utilities;
|
||||
|
||||
import com.comphenix.protocol.events.PacketContainer;
|
||||
import com.comphenix.protocol.wrappers.WrappedGameProfile;
|
||||
import com.google.common.base.Charsets;
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.server.v1_9_R1.EntityPlayer;
|
||||
import net.minecraft.server.v1_9_R1.MinecraftServer;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_9_R1.PlayerInteractManager;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Chris Naude
|
||||
*/
|
||||
public class NetPacket_19 {
|
||||
|
||||
public static PacketContainer add(String displayName) {
|
||||
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + displayName).getBytes(Charsets.UTF_8));
|
||||
EntityPlayer pl = new EntityPlayer(
|
||||
MinecraftServer.getServer(),
|
||||
MinecraftServer.getServer().getWorldServer(0),
|
||||
(GameProfile) (new WrappedGameProfile(uuid, displayName)).getHandle(),
|
||||
new PlayerInteractManager(MinecraftServer.getServer().getWorldServer(0))
|
||||
);
|
||||
PacketPlayOutPlayerInfo pi
|
||||
= new PacketPlayOutPlayerInfo(
|
||||
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, pl);
|
||||
return PacketContainer.fromPacket(pi);
|
||||
}
|
||||
|
||||
public static PacketContainer rem(String displayName) {
|
||||
UUID uuid = UUID.nameUUIDFromBytes(("OfflinePlayer:" + displayName).getBytes(Charsets.UTF_8));
|
||||
EntityPlayer pl = new EntityPlayer(
|
||||
MinecraftServer.getServer(),
|
||||
MinecraftServer.getServer().getWorldServer(0),
|
||||
(GameProfile) (new WrappedGameProfile(uuid, displayName)).getHandle(),
|
||||
new PlayerInteractManager(MinecraftServer.getServer().getWorldServer(0))
|
||||
);
|
||||
PacketPlayOutPlayerInfo pi
|
||||
= new PacketPlayOutPlayerInfo(
|
||||
PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, pl);
|
||||
return PacketContainer.fromPacket(pi);
|
||||
}
|
||||
|
||||
}
|
@ -129,7 +129,7 @@ public class NetPackets {
|
||||
if (add) {
|
||||
return NetPacket_183.add(displayName);
|
||||
} else {
|
||||
plugin.logDebug("T: Removing: " + name);
|
||||
plugin.logDebug("T183: Removing: " + name);
|
||||
return NetPacket_183.rem(displayName);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@ -144,12 +144,23 @@ public class NetPackets {
|
||||
if (add) {
|
||||
return NetPacket_184_185_186_187_188.add(displayName);
|
||||
} else {
|
||||
plugin.logDebug("T: Removing: " + name);
|
||||
plugin.logDebug("T184_188: Removing: " + name);
|
||||
return NetPacket_184_185_186_187_188.rem(displayName);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.logError("tabPacket: " + ex.getMessage());
|
||||
}
|
||||
} else if (version.contains("MC: 1.9")) {
|
||||
try {
|
||||
if (add) {
|
||||
return NetPacket_19.add(displayName);
|
||||
} else {
|
||||
plugin.logDebug("T19: Removing: " + name);
|
||||
return NetPacket_19.rem(displayName);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
plugin.logError("tabPacket: " + ex.getMessage());
|
||||
}
|
||||
} else {
|
||||
plugin.logDebug("tabPacket: deprecated ");
|
||||
playerListConstructor = protocolManager.createPacketConstructor(Packets.Server.PLAYER_INFO, "", false, (int) 0);
|
||||
|
Loading…
Reference in New Issue
Block a user