-
-
Notifications
You must be signed in to change notification settings - Fork 876
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
122 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/gmail/nossr50/protocollib/ProtocolHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//package com.gmail.nossr50.protocollib; | ||
// | ||
//import com.comphenix.protocol.PacketType; | ||
//import com.comphenix.protocol.ProtocolLibrary; | ||
//import com.comphenix.protocol.ProtocolManager; | ||
//import com.comphenix.protocol.events.ListenerPriority; | ||
//import com.comphenix.protocol.events.PacketAdapter; | ||
//import com.comphenix.protocol.events.PacketContainer; | ||
//import com.comphenix.protocol.events.PacketEvent; | ||
//import com.gmail.nossr50.mcMMO; | ||
//import org.bukkit.entity.Player; | ||
// | ||
//public class ProtocolHandler { | ||
// private final mcMMO pluginRef; | ||
// private final ProtocolManager protocolManager; | ||
// | ||
// public ProtocolHandler(mcMMO pluginRef) { | ||
// this.pluginRef = pluginRef; | ||
// this.protocolManager = ProtocolLibrary.getProtocolManager(); | ||
// // TODO: encapsulate this in a method | ||
// protocolManager.addPacketListener(new PacketAdapter(pluginRef, ListenerPriority.NORMAL, PacketType.Play.Server.WINDOW_DATA) { | ||
// @Override | ||
// public void onPacketSending(PacketEvent event) { | ||
// Player player = event.getPlayer(); | ||
// PacketContainer packet = event.getPacket(); | ||
// if (packet.getIntegers().read(0) == 400) { | ||
// event.setCancelled(true); | ||
// } | ||
// } | ||
// }); | ||
// } | ||
// public void sendPacketToPlayer(Player player) { | ||
// final PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.WINDOW_DATA); | ||
// protocolManager.sendServerPacket(player, packet); | ||
// } | ||
//} |
58 changes: 40 additions & 18 deletions
58
src/main/java/com/gmail/nossr50/protocollib/ProtocolLibManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,40 @@ | ||
package com.gmail.nossr50.protocollib; | ||
|
||
import com.gmail.nossr50.mcMMO; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
// TODO: Finish this class | ||
public class ProtocolLibManager { | ||
Plugin protocolLibPluginRef; | ||
mcMMO pluginRef; | ||
public ProtocolLibManager(mcMMO pluginRef) { | ||
this.pluginRef = pluginRef; | ||
} | ||
|
||
public boolean isProtocolLibPresent() { | ||
protocolLibPluginRef = pluginRef.getServer().getPluginManager().getPlugin("ProtocolLib"); | ||
return protocolLibPluginRef != null; | ||
} | ||
} | ||
//package com.gmail.nossr50.protocollib; | ||
// | ||
//import com.gmail.nossr50.mcMMO; | ||
//import org.bukkit.Bukkit; | ||
//import org.bukkit.entity.Player; | ||
//import org.bukkit.plugin.Plugin; | ||
// | ||
//public class ProtocolLibManager { | ||
// final Plugin protocolLibPluginRef; | ||
// final mcMMO pluginRef; | ||
// final ProtocolHandler protocolHandler; | ||
// | ||
// public ProtocolLibManager(mcMMO pluginRef) { | ||
// this.pluginRef = pluginRef; | ||
// | ||
// if (isProtocolLibPresent()) { | ||
// protocolLibPluginRef = pluginRef.getServer().getPluginManager().getPlugin("ProtocolLib"); | ||
// protocolHandler = new ProtocolHandler(pluginRef); | ||
// pluginRef.getLogger().info("ProtocolLib found, enabling ProtocolLib features."); | ||
// } else { | ||
// protocolLibPluginRef = null; | ||
// protocolHandler = null; | ||
// pluginRef.getLogger().info("No ProtocolLib found, some completely optional cosmetic features will not be enabled."); | ||
// } | ||
// } | ||
// | ||
// public boolean usingProtocolLib() { | ||
// return protocolLibPluginRef != null && protocolHandler != null; | ||
// } | ||
// | ||
// private boolean isProtocolLibPresent() { | ||
// return Bukkit.getServer().getPluginManager().getPlugin("ProtocolLib") != null; | ||
// } | ||
// | ||
// public void sendPacketToPlayer(Player player) { | ||
// if (usingProtocolLib()) { | ||
// protocolHandler.sendPacketToPlayer(player); | ||
// } | ||
// } | ||
//} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters