a bunch of stuff im too lazy to go through (1.3.4)

This commit is contained in:
ajgeiss0702
2020-05-30 14:32:46 -07:00
parent bb565cad27
commit 34afd616b5
9 changed files with 99 additions and 9 deletions
@@ -0,0 +1,24 @@
package us.ajg0702.queue.spigot;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
public class Commands implements CommandExecutor {
Main pl;
public Commands(Main pl) {
this.pl = pl;
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if(!(sender instanceof Player)) return true;
Player player = (Player) sender;
if(args.length < 1) return false;
this.pl.sendMessage(player, "queue", args[0]);
return true;
}
}
@@ -6,6 +6,7 @@ import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageListener;
import com.google.common.io.ByteArrayDataInput;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import us.ajg0702.queue.spigot.utils.VersionSupport;
@@ -13,6 +14,10 @@ import us.ajg0702.queue.spigot.utils.VersionSupport;
public class Main extends JavaPlugin implements PluginMessageListener {
public void onEnable() {
getServer().getMessenger().registerIncomingPluginChannel(this, "ajqueue:tospigot", this);
getServer().getMessenger().registerOutgoingPluginChannel(this, "ajqueue:tobungee");
this.getCommand("move").setExecutor(new Commands(this));
getLogger().info("Spigot side enabled! v"+getDescription().getVersion());
}
@@ -33,6 +38,17 @@ public class Main extends JavaPlugin implements PluginMessageListener {
final String text = data.split(";time=")[0];
//getLogger().info("recieved actionbar for "+player.getName()+": "+text);
VersionSupport.sendActionBar(p, text);
return;
}
}
public void sendMessage(Player player, String subchannel, String data) {
//getLogger().info("Sending message. "+subchannel+" "+data);
ByteArrayDataOutput out = ByteStreams.newDataOutput();
out.writeUTF(subchannel);
out.writeUTF(data);
player.sendPluginMessage(this, "ajqueue:tobungee", out.toByteArray());
}
}