v4.5.1latestSmall patch - important!Apr 2, 2016 Small Patch - important ( Header and Footer - packet been not sent, and tablist been not cleared, when used other plugin )v4.5Packet Update - last update.Apr 1, 2016 Version: v4.5 Short: "Packet Update" update. Description: · upgrade of system Packet Listening · simple api for creating Packets · tiny optimization of TabAPI LAST UPDATE - CODEBETA v4.1Support for 1.8(>3) - 1.9 and Bug-Fix for PacketListener !Mar 11, 2016 Version: BETA v4.1 for MC 1.9 Short Description: Update to MC 1.9 Description: · support for 1.9 · new methods for TabAPI · update class "BestServerListPingEvent" · bug-fix for PacketListener TabAPI: · void setDefaultPreference(Class<? extends Plugin> plugin, Preference priority); //default priority for your plugin... · void refresh(Class<? extends Plugin> plugin, Player player, Preference priority, SettingAPI<TabModify> modify);//Priority will be LOW if not set default preference...BETA v4.0ASM-ReflectionsMar 10, 2016 Version: BETA v4.0 for MC 1.8.(>3) Short Description: New Reflections based on Bytecode Manipulation Description: · Better optimization (rewrite all the code on new system, reflections - more efficient) .SpoilerTarget">Spoiler: Look this Code (YAML): NEW REFLECTIONS : TEST1 : #First Creating Title Packet - Normal [Server thread/INFO] : 458915397 #Second Creating Title Packet - AsyncTask [Craft Scheduler Thread - 0/INFO] : 25438241 #Third Creating Title Packet - Command [Server thread/INFO] : 27994503 TEST2 : #First Creating Title Packet - Normal [Server thread/INFO] : 101707645 #Second Creating Title Packet - AsyncTask [Craft Scheduler Thread - 0/INFO] : 58172411 #Third Creating Title Packet - Command [Server thread/INFO] : 24472283 TEST3 : #First Creating Title Packet - Normal [Server thread/INFO] : 104070391 #Second Creating Title Packet - AsyncTask [Craft Scheduler Thread - 0/INFO] : 37432456 #Third Creating Title Packet - Command [Server thread/INFO] : 30545975 RESULTS: 1 : 458915397 - 25438241 - 27994503 2 : 101707645 - 58172411 - 24472283 3 : 104070391 - 37432456 - 30545975 REFLECTIONS : TEST1 : #First Creating Title Packet - Normal [Server thread/INFO] : 670477961 #Second Creating Title Packet - AsyncTask [Craft Scheduler Thread - 0/INFO] : 221593201 #Third Creating Title Packet - Command [Server thread/INFO] : 160271364 TEST2 : #First Creating Title Packet - Normal [Server thread/INFO] : 558329975 #Second Creating Title Packet - AsyncTask [Craft Scheduler Thread - 0/INFO] : 185080400 #Third Creating Title Packet - Command [Server thread/INFO] : 185709700 TEST3 : #First Creating Title Packet - Normal [Server thread/INFO] : 602342956 #Second Creating Title Packet - AsyncTask [Craft Scheduler Thread - 0/INFO] : 178402276 #Third Creating Title Packet - Command [Server thread/INFO] : 176101745 RESULTS: 1 : 670477961 - 221593201 - 160271364 2 : 558329975 - 185080400 - 185709700 3 : 602342956 - 178402276 - 176101745 FINAL RESULTS : 1 : 458915397 - 25438241 - 27994503 2 : 101707645 - 58172411 - 24472283 3 : 104070391 - 37432456 - 30545975 1 : 670477961 - 221593201 - 160271364 2 : 558329975 - 185080400 - 185709700 3 : 602342956 - 178402276 - 176101745 · New methods for TabAPI and TitleAPI · Correction of the code (TinyProtocol and Simple Listener Packet) · Addon "testmode". It has one objective, check the work "TabAPI" and "TitleAPI. (if throws errors, report to me, I will try to add support for your version of engine.) · No support for BarAPI (BarAPI will be delete - preparation to version 1.9. Spigot 1.9 has simple BarAPI) ! TabAPI: · Add method "hasAPI" (method isExist is @Deprecated) TabModify: · void setTexture(String texture); - global texture · void setSignal(int ping); - global ping · void set(int x, int y, String display, String texture); · void set(int x, int y, String display, String texture, int ping); · void set(int x, int y, String display, int ping); · void set(List<String> head, List<String> foot); · String getTexture(int x, int y); · int getSignal(int x, int y); · List<String> getHeader(); · List<String> getFooter(); · String getMessage(int x, int y); TitleAPI: · Add method "broadcast" (method publication is @Deprecated) · void subtitle(Player player, String subtitle) - inherits after last sent title e.g: TitleAPI.title(player, "Test", 0, 20*10, 0); TitleAPI.subtitle(player, "123"); //out.print: Test 123 new BukkitRunnable() { @Override public void run() { TitleAPI.subtitle(player, "321123"); } }.runTaskLaterAsynchronously(this, 20*5); //out.print: Test 3211233.9_R2BarAPI and simple listening packetsFeb 14, 2016 Generally: · addon BarAPI pre-realse but and last version · changes cosmetically (e.g com.gmail.zahusek.tinyprotocolapi.api.bar;) · added Simple Packet Listener based on Event Listener · and others... TabAPI: · new method "isExist(Player player)" TiitleAPI: · new method "clear(Player player)" Example creating custom PacketListener: Code (Java): package com.gmail.zahusek.test.listener ; import com.gmail.zahusek.tinyprotocolapi.packet.Packet ; import com.gmail.zahusek.tinyprotocolapi.packet.PacketEvent ; import com.gmail.zahusek.tinyprotocolapi.packet.PacketHandlerList ; import com.gmail.zahusek.tinyprotocolapi.packet.PacketType ; import com.google.common.base.Charsets ; import com.google.gson.Gson ; import com.google.gson.JsonArray ; import com.google.gson.JsonObject ; import com.google.gson.JsonParser ; import io.netty.buffer.ByteBuf ; import io.netty.buffer.ByteBufOutputStream ; import static io. netty. buffer. Unpooled. buffer ; import static io. netty. handler. codec. base64. Base64. encode ; import org.bukkit.entity.Player ; import org.json.simple.parser.ParseException ; import static javax. imageio. ImageIO. write ; import java.awt.image.BufferedImage ; import java.io.IOException ; import java.util.Collection ; import static java. util. UUID. randomUUID ;; @PacketType (packet = Packet. PacketStatusOutServerInfo ) public class BestServerListPingEvent extends PacketEvent { private static final PacketHandlerList handlers = new PacketHandlerList ( ) ; private static final String DEFID = randomUUID ( ). toString ( ) ; private static final Class <?> PINGCLASS = getMinecraftClass ( "ServerPing" ) ; private static final FieldAccessor <Gson > GSON = getField (getMinecraftClass ( "PacketStatusOutServerInfo" ), null, Gson. class, 0 ) ; private final JsonObject json ; public BestServerListPingEvent (Player player, Object packet ) throws ParseException { super (player, packet ) ; this. json = new JsonParser ( ). parse (GSON. get (packet ). toJson (packet ) ). getAsJsonObject ( ). getAsJsonObject ( "b" ) ; } public JsonArray sampleList (Collection <String > names ) { JsonArray array = new JsonArray ( ) ; for ( String player : names ) { JsonObject data = new JsonObject ( ) ; data. addProperty ( "name", player ) ; data. addProperty ( "id", DEFID ) ; array. add (data ) ; } return array ; } public JsonObject getDefaultJson ( ) { return json ; } public JsonObject getProtocolJson ( ) { return json. getAsJsonObject ( "version" ) ; } public JsonObject getSampleJson ( ) { return json. getAsJsonObject ( "players" ) ; } public void saveJson ( ) { setParameter ( 1, GSON. get (object ). fromJson (json, PINGCLASS ) ) ; } public String faviconSerializer ( BufferedImage image ) { if (image. getWidth ( ) != 64 || image. getHeight ( ) != 64 ) return json. get ( "favicon" ). getAsString ( ) ; ByteBuf buffer = buffer ( ) ; try { write (image, "PNG", new ByteBufOutputStream (buffer ) ) ; } catch ( IOException e ) { return json. get ( "favicon" ). getAsString ( ) ; } return "data:image/png;base64," + encode (buffer ). toString (Charsets. UTF_8 ) ; } @Override public PacketHandlerList getHandlers ( ) { return handlers ; } } Example registering custom PacketListener: Code (Java): package com.gmail.zahusek.test ; import org.bukkit.plugin.java.JavaPlugin ; import com.gmail.zahusek.test.listener.Status ; import com.gmail.zahusek.tinyprotocolapi.TinyProtocolAPI ; public class TestTPAPI extends JavaPlugin { @Override public void onEnable ( ) { TinyProtocolAPI. registerPackets ( new Status ( ), this ) ; } } Example uses custom PacketListener: Code (Java): package com.gmail.zahusek.test.listener ; import com.gmail.zahusek.tinyprotocolapi.packet.PacketHandler ; import com.gmail.zahusek.tinyprotocolapi.packet.PacketListener ; import com.google.gson.JsonObject ; import javax.imageio.ImageIO ; import org.apache.commons.lang.StringUtils ; import java.io.IOException ; import java.net.URL ; import java.util.stream.Collectors ; import java.util.stream.IntStream ; public class Status implements PacketListener { @PacketHandler public void status (BestServerListPingEvent e ) throws IOException { JsonObject deFault = e. getDefaultJson ( ) ; deFault. addProperty ( "description", " §6▓TinyProtocolAPI▓" + "\n" + "§9§k### §eVersion §5§n3.9§6 \"§5BarAPI§6\" §9§k###" ) ; deFault. addProperty ( "favicon", e. faviconSerializer ( ImageIO. read ( new URL ( "
"
)
)
)
)
;
JsonObject sample
= e.
getSampleJson
(
)
;
sample.
add
(
"sample", e.
sampleList
(IntStream.
range
(
0,
20
).
mapToObj
(
(i
)
->
{
if
(i
==
10
)
return
"§9TinyProtocolAPI - BetterServerListPingEvent"
;
else
return StringUtils.
join
(IntStream.
range
(
0,
80
).
mapToObj
(
(o
)
->
" "
).
toArray
(
)
)
;
}
).
collect
(Collectors.
toList
(
)
)
)
)
;
JsonObject protocol
= e.
getProtocolJson
(
)
;
protocol.
addProperty
(
"protocol",
-
1
)
;
int online
= sample.
get
(
"online"
).
getAsInt
(
), max
= sample.
get
(
"max"
).
getAsInt
(
)
;
protocol.
addProperty
(
"name",
"§eLeftMotD"
+ StringUtils.
join
(IntStream.
range
(
0,
72
).
mapToObj
(
(i
)
->
" "
).
toArray
(
)
)
+
"§7"
+ online
+
"§8/§7"
+ max
)
;
e.
saveJson
(
)
;
}
}pre-release 3.9Optimization, "StatusServerAPI", Correction.Jan 21, 2016 Generally: · Optimization of the code. · TinyProtocolAPI has been now better compiled (47kb). · Correction of TinyProtocol (core of plugin). and... class StatusServer ! .SpoilerTarget">Spoiler: Class; StatusServer Code (Text): package com.gmail.zahusek.test; import com.gmail.zahusek.tinyprotocolapi.abstracts.ChatSerializer; import com.gmail.zahusek.tinyprotocolapi.protocol.Packet; import com.gmail.zahusek.tinyprotocolapi.protocol.PacketEvent; import com.gmail.zahusek.tinyprotocolapi.protocol.PacketHandler; import com.gmail.zahusek.tinyprotocolapi.protocol.PacketHandler.PacketListener; import com.gmail.zahusek.tinyprotocolapi.utils.Reflection; import com.gmail.zahusek.tinyprotocolapi.utils.Reflection.FieldAccessor; import com.google.common.base.Charsets; import com.mojang.authlib.GameProfile; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufOutputStream; import io.netty.buffer.Unpooled; import io.netty.handler.codec.base64.Base64; import java.awt.image.BufferedImage; import java.io.IOException; import java.net.URL; import java.util.UUID; import javax.imageio.ImageIO; public class StatusServer implements PacketListener { private static final Class<Object> PINGCLASS = Reflection.getUntypedClass("{nms}.ServerPing"); private static final Class<Object> MOTDClASS = Reflection.getUntypedClass("{nms}.IChatBaseComponent"); private static final FieldAccessor<Object> MOTD = Reflection.getField(PINGCLASS, MOTDClASS, 0); private static final FieldAccessor<String> FAVICON = Reflection.getField(PINGCLASS, String.class, 0); private static final Class<Object> SAMPLECLASS = Reflection.getUntypedClass("{nms}.ServerPing$ServerPingPlayerSample"); private static final FieldAccessor<Object> SAMPLE = Reflection.getField(PINGCLASS, SAMPLECLASS, 0); private static final Class<Object> DATACLASS = Reflection.getUntypedClass("{nms}.ServerPing$ServerData"); private static final FieldAccessor<Object> DATA = Reflection.getField(PINGCLASS, DATACLASS, 0); private static final FieldAccessor<Integer> ONLINE = Reflection.getField(SAMPLECLASS, int.class, 0); private static final FieldAccessor<Integer> MAXONLINE = Reflection.getField(SAMPLECLASS, int.class, 1); private static final FieldAccessor<GameProfile[]> PLAYERS = Reflection.getField(SAMPLECLASS, GameProfile[].class, 0); private static final FieldAccessor<String> NAME = Reflection.getField(DATACLASS, String.class, 0); private static final FieldAccessor<Integer> VERSION = Reflection.getField(DATACLASS, int.class, 0); @PacketHandler(packet = Packet.PacketStatusOutServerInfo) public void status(PacketEvent e) throws IOException { FAVICON.set(e.getParameter(1), encode(ImageIO.read( new URL("
"))));
MOTD.set(e.getParameter(1), ChatSerializer.toIChat("§6ELDO"));
ONLINE.set(SAMPLE.get(e.getParameter(1)), -1);
MAXONLINE.set(SAMPLE.get(e.getParameter(1)), -1);
PLAYERS.set(SAMPLE.get(e.getParameter(1)), new GameProfile[] {
profile("§2Your custom"), profile("§5PLAYER LIST !"), profile("§bPlaaaaayyyyerrr"), profile("ELDOOOO")
});
NAME.set(DATA.get(e.getParameter(1)), "§e§lCustom protocol name");
VERSION.set(DATA.get(e.getParameter(1)), -1);
}
public GameProfile profile(String name)
{
return new GameProfile(UUID.randomUUID(), name);
}
public static String encode(BufferedImage image)
{
try {
ByteBuf buffer = Unpooled.buffer();
ImageIO.write(image, "PNG", new ByteBufOutputStream(buffer));
ByteBuf encodedBuffer = Base64.encode(buffer);
String encodedString = "data:image/png;base64," + encodedBuffer.toString(Charsets.UTF_8);
return encodedString;
}
catch(Exception e)
{
e.printStackTrace();
return null;
}
}
}
.SpoilerTarget">Spoiler: Class; Test
Code (Text):
package com.gmail.zahusek.test;
import com.gmail.zahusek.tinyprotocolapi.TinyProtocolAPI;
import com.gmail.zahusek.tinyprotocolapi.apis.TabAPI;
import com.gmail.zahusek.tinyprotocolapi.apis.TabHolder;
import com.gmail.zahusek.tinyprotocolapi.apis.TabPriority;
import com.gmail.zahusek.tinyprotocolapi.apis.TitleAPI;
import java.util.Arrays;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
public class Test extends JavaPlugin
{
@Override
public void onEnable()
{
TinyProtocolAPI.getTinyProtocol().registerPacket(new StatusServer(), this);
}
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
{
Player player = (Player) sender;
TabAPI.refresh(Test.class, player, TabPriority.NORMAL, (TabHolder holder) ->
{
holder.setHeader(Arrays.asList("Header"));
holder.setFooter(Arrays.asList("Footer"));
holder.setSignal(0, 0, 9999);
holder.setSignal(3, 10, 9999);
holder.setMessage(1, 5, "ELO!");
holder.setTexture(2, 5, "Notch");
});
TitleAPI.publication(player, "test", "test", 10, 20, 10);
return false;
}
}3.8Optimization and renovation.Jan 19, 2016 Generally: · Optimization. · Correction. · Updated Protocol Manager - TinyProtocol. TabAPI: · + Priority. · + Plugin. · + and more. · ! Changed names and parameters of methods. TitleAPI: · ! Changed names of methods.3.7.9Bug-Fix - texture.Jan 10, 2016 Last update v3.7. Tested. Code (Text): package com.gmail.zahusek.test; import java.util.Arrays; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import com.gmail.zahusek.tinyprotocolapi.apis.TabAPI; public class Test extends JavaPlugin { @Override public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { Player player = (Player) sender; for(int x = 0; x < 4; x++) for(int y = 0; y < 20; y++) TabAPI.setMessage(player, x, y, "x:" + x + "y:" + y); TabAPI.setTexture(player, 0, 0, "Notch"); TabAPI.setTexture(player, 3, 19, "Notch"); TabAPI.refresh(player); TabAPI.setHeader(player, Arrays.asList("1")); TabAPI.setFooter(player, Arrays.asList("2")); TabAPI.setSignal(player, 3, 19, 9999); TabAPI.refresh(player); return false; } }3.7.8Bug-Fix, changes and security.Jan 8, 2016 - Bug-Fix: Location of slots - Thanks you again, @AugusteRodin . - Added security ( if java's version isn't1.7 and engine's version isn't
1.8.4 =
disable). - Changed some names of methods ! (all methods included in classes TabAPI - com.gmail.zahusek.tinyprotocolapi.apis.TabAPI;, TitleAPI - com.gmail.zahusek.tinyprotocolapi.apis.TitleAPI;)3.7.2Bug-Fix for OfflineMode.Jan 7, 2016 Bug-Fix: Throwing errors for console, when used is method "setSkin" on offline-mode. Thanks, @AugusteRodin .3.7TitleAPIJan 3, 2016 Support for: - Title - Subtitle - Action-bar - new methods for HnF (separate header and footer, e.g setHeader(List<String> header); ) Correction, optimization and Changes: - some path (!) import com.gmail.tinyprotoclolapi.apis.TabAPI; - ChatSerializer - optimization3.6.2HnFJan 1, 2016 · Simple method multiple-lines for Header and Footer. · Tiny correction the code.3.6Pre-releaseDec 30, 2015 - "Little" corrections the code ;v. - +Possibility change skin (!) ONLY online-mode: true . As before without addon - ProtocolLib3.2.1Jul 20, 2015
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta