Added author and copyright notice.

This commit is contained in:
JitseB 2018-04-13 18:23:46 +02:00
parent 9fd1347e2f
commit 732a0dd763
56 changed files with 401 additions and 6 deletions

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib;
import net.jitse.npclib.api.NPC;
@ -13,6 +17,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.lang.reflect.InvocationTargetException;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPCLib {
private final JavaPlugin plugin;

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib;
import net.jitse.npclib.api.NPC;
@ -5,6 +9,9 @@ import net.jitse.npclib.api.NPC;
import java.util.HashSet;
import java.util.Set;
/**
* @author Jitse Boonstra
*/
public class NPCManager {
private static Set<NPC> npcs = new HashSet<>();

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.api;
import com.mojang.authlib.GameProfile;
@ -13,13 +17,17 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.*;
/**
* @author Jitse Boonstra
*/
public abstract class NPC {
protected final UUID uuid = UUID.randomUUID();
protected final String name = uuid.toString().replace("-", "").substring(0, 10);
protected final int entityId = (int) Math.ceil(Math.random() * 100000) + 100000;
protected final Set<UUID> shown = new HashSet<>();
protected final Set<UUID> autoHidden = new HashSet<>();
private final Set<UUID> shown = new HashSet<>();
private final Set<UUID> autoHidden = new HashSet<>();
protected final double autoHideDistance;
protected final Skin skin;

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.events;
import net.jitse.npclib.api.NPC;
@ -7,6 +11,9 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* @author Jitse Boonstra
*/
public class NPCDestroyEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.events;
import net.jitse.npclib.api.NPC;
@ -6,6 +10,9 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* @author Jitse Boonstra
*/
public class NPCInteractEvent extends Event {
private static final HandlerList handlers = new HandlerList();

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.events;
import net.jitse.npclib.api.NPC;
@ -7,6 +11,9 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
/**
* @author Jitse Boonstra
*/
public class NPCSpawnEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();

View File

@ -1,5 +1,12 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.events.click;
/**
* @author Jitse Boonstra
*/
public enum ClickType {
LEFT_CLICK, RIGHT_CLICK

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.listeners;
import com.comphenix.tinyprotocol.Reflection;
@ -15,6 +19,9 @@ import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketListener {
// Classes:

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.listeners;
import net.jitse.npclib.NPCManager;
@ -8,6 +12,9 @@ import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerKickEvent;
import org.bukkit.event.player.PlayerQuitEvent;
/**
* @author Jitse Boonstra
*/
public class PlayerLeaveListener implements Listener {
@EventHandler

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.listeners;
import net.jitse.npclib.NPCManager;
@ -8,6 +12,9 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
/**
* @author Jitse Boonstra
*/
public class PlayerMoveListener implements Listener {
@EventHandler

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.holograms;
import com.comphenix.tinyprotocol.Reflection;
@ -9,6 +13,9 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* @author Jitse Boonstra
*/
public class Hologram {
private final double delta = 0.3;

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_10_r1;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_10_R1 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_10_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_10_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -6,6 +10,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_10_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -8,6 +12,9 @@ import net.minecraft.server.v1_10_R1.PacketPlayOutPlayerInfo;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
private final Class<?> packetPlayOutPlayerInfoClazz = Reflection.getMinecraftClass("PacketPlayOutPlayerInfo");

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_10_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_10_R1.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_11_r1;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_11_R1 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_11_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_11_R1.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_11_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -6,6 +10,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_11_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -8,6 +12,9 @@ import net.minecraft.server.v1_11_R1.PacketPlayOutPlayerInfo;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
private final Class<?> packetPlayOutPlayerInfoClazz = Reflection.getMinecraftClass("PacketPlayOutPlayerInfo");

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_11_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_11_R1.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_12_r1;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_12_R1 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_12_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_12_R1.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_12_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -6,6 +10,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_12_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -8,6 +12,9 @@ import net.minecraft.server.v1_12_R1.PacketPlayOutPlayerInfo;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
private final Class<?> packetPlayOutPlayerInfoClazz = Reflection.getMinecraftClass("PacketPlayOutPlayerInfo");

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_12_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_12_R1.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r1;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_8_R1 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_8_R1.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -7,6 +11,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -6,6 +10,9 @@ import net.minecraft.server.v1_8_R1.*;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
public PacketPlayOutPlayerInfo create(EnumPlayerInfoAction action, GameProfile gameProfile, String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_8_R1.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r2;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_8_R2 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_8_R2.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -7,6 +11,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,11 +1,20 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
import com.mojang.authlib.GameProfile;
import net.minecraft.server.v1_8_R2.*;
import net.minecraft.server.v1_8_R2.IChatBaseComponent;
import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerInfo;
import net.minecraft.server.v1_8_R2.WorldSettings;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
public PacketPlayOutPlayerInfo create(PacketPlayOutPlayerInfo.EnumPlayerInfoAction action, GameProfile gameProfile, String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_8_R2.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r3;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_8_R3 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r3.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r3.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -7,6 +11,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r3.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -8,6 +12,9 @@ import net.minecraft.server.v1_8_R3.WorldSettings;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
public PacketPlayOutPlayerInfo create(PacketPlayOutPlayerInfo.EnumPlayerInfoAction action, GameProfile gameProfile, String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_8_r3.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r1;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_9_R1 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -6,6 +10,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -8,6 +12,9 @@ import net.minecraft.server.v1_9_R1.WorldSettings;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
public PacketPlayOutPlayerInfo create(PacketPlayOutPlayerInfo.EnumPlayerInfoAction action, GameProfile gameProfile, String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r1.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_9_R1.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r2;
import net.jitse.npclib.api.NPC;
@ -16,6 +20,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class NPC_V1_9_R2 extends NPC {
private Hologram hologram;

View File

@ -1,9 +1,16 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
import net.minecraft.server.v1_9_R2.PacketPlayOutEntityHeadRotation;
import org.bukkit.Location;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutEntityHeadRotationWrapper {
public PacketPlayOutEntityHeadRotation create(Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -6,6 +10,9 @@ import org.bukkit.Location;
import java.util.UUID;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutNamedEntitySpawnWrapper {
public PacketPlayOutNamedEntitySpawn create(UUID uuid, Location location, int entityId) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -8,6 +12,9 @@ import net.minecraft.server.v1_9_R2.WorldSettings;
import java.util.List;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutPlayerInfoWrapper {
private final Class<?> packetPlayOutPlayerInfoClazz = Reflection.getMinecraftClass("PacketPlayOutPlayerInfo");

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.nms.v1_9_r2.packets;
import com.comphenix.tinyprotocol.Reflection;
@ -5,6 +9,9 @@ import net.minecraft.server.v1_9_R2.PacketPlayOutScoreboardTeam;
import java.util.Collection;
/**
* @author Jitse Boonstra
*/
public class PacketPlayOutScoreboardTeamWrapper {
public PacketPlayOutScoreboardTeam createRegisterTeam(String name) {

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.plugin;
import net.jitse.npclib.NPCLib;
@ -13,6 +17,9 @@ import org.bukkit.plugin.java.JavaPlugin;
import java.util.Arrays;
/**
* @author Jitse Boonstra
*/
public class NPCLibPlugin extends JavaPlugin implements Listener {
private NPCLib npcLib;

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.plugin.listeners;
import net.jitse.npclib.events.NPCDestroyEvent;
@ -7,6 +11,9 @@ import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
/**
* @author Jitse Boonstra
*/
public class NPCListener implements Listener {
@EventHandler

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.skin;
import com.google.gson.JsonObject;
@ -10,6 +14,9 @@ import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
/**
* @author Jitse Boonstra
*/
public class MineSkinFetcher {
private static final String MINESKIN_API = "https://api.mineskin.org/get/id/";
@ -17,7 +24,7 @@ public class MineSkinFetcher {
public static void fetchSkinFromIdAsync(int id, Callback callback) {
new Thread(() -> {
try {
StringBuffer stringBuffer = new StringBuffer();
StringBuilder builder = new StringBuilder();
HttpURLConnection httpURLConnection = (HttpURLConnection) new URL(MINESKIN_API + id).openConnection();
httpURLConnection.setRequestMethod("GET");
httpURLConnection.setDoOutput(true);
@ -26,13 +33,13 @@ public class MineSkinFetcher {
Scanner scanner = new Scanner(httpURLConnection.getInputStream());
while (scanner.hasNextLine()) {
stringBuffer.append(scanner.nextLine());
builder.append(scanner.nextLine());
}
scanner.close();
httpURLConnection.disconnect();
JsonObject jsonObject = (JsonObject) new JsonParser().parse(stringBuffer.toString());
JsonObject jsonObject = (JsonObject) new JsonParser().parse(builder.toString());
JsonObject textures = jsonObject.get("data").getAsJsonObject().get("texture").getAsJsonObject();
String value = textures.get("value").getAsString();
String signature = textures.get("signature").getAsString();

View File

@ -1,5 +1,12 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.skin;
/**
* @author Jitse Boonstra
*/
public class Skin {
private final String value, signature;

View File

@ -1,3 +1,7 @@
/*
* Copyright (c) Jitse Boonstra 2018 All rights reserved.
*/
package net.jitse.npclib.version;
import net.jitse.npclib.api.NPC;
@ -14,6 +18,9 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.Optional;
/**
* @author Jitse Boonstra
*/
public enum Version {
V1_8_R1("v1_8_R1", NPC_V1_8_R1.class),