mirror of
https://github.com/amalthea-mc/ShopChest.git
synced 2024-12-23 09:31:46 +00:00
Now using reflection instead of different modules
This commit also fixes spawn eggs on 1.8.x
This commit is contained in:
parent
e8ab8e33c3
commit
57af99da1b
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
|
||||
</project>
|
@ -1,41 +0,0 @@
|
||||
package de.epiceric.shopchest.nms;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
|
||||
public interface IHologram {
|
||||
|
||||
/**
|
||||
* @return Location of the hologram
|
||||
*/
|
||||
Location getLocation();
|
||||
|
||||
/**
|
||||
* @param p Player to which the hologram should be shown
|
||||
*/
|
||||
void showPlayer(OfflinePlayer p);
|
||||
|
||||
|
||||
/**
|
||||
* @param p Player from which the hologram should be hidden
|
||||
*/
|
||||
void hidePlayer(OfflinePlayer p);
|
||||
|
||||
/**
|
||||
* @param p Player to check
|
||||
* @return Whether the hologram is visible to the player
|
||||
*/
|
||||
boolean isVisible(OfflinePlayer p);
|
||||
|
||||
/**
|
||||
* @return Whether the hologram exists and is not dead
|
||||
*/
|
||||
boolean exists();
|
||||
|
||||
/**
|
||||
* Removes the hologram. <br>
|
||||
* IHologram will be hidden from all players and will be killed
|
||||
*/
|
||||
void remove();
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
package de.epiceric.shopchest.nms;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public abstract class IJsonBuilder {
|
||||
|
||||
public abstract void sendJson(Player p);
|
||||
|
||||
private List<String> extras = new ArrayList<>();
|
||||
|
||||
public IJsonBuilder parse(String text, String hoverText, String downloadLink) {
|
||||
String regex = "[&<26>]{1}([a-fA-Fl-oL-O0-9]){1}";
|
||||
text = text.replaceAll(regex, "<EFBFBD>$1");
|
||||
if (!Pattern.compile(regex).matcher(text).find()) {
|
||||
withText(text).withHoverEvent(HoverAction.SHOW_TEXT, hoverText).withClickEvent(ClickAction.OPEN_URL, downloadLink);
|
||||
return this;
|
||||
}
|
||||
String[] words = text.split(regex);
|
||||
|
||||
int index = words[0].length();
|
||||
for (String word : words) {
|
||||
try {
|
||||
if (index != words[0].length())
|
||||
withText(word).withColor("<EFBFBD>" + text.charAt(index - 1)).withHoverEvent(HoverAction.SHOW_TEXT, hoverText).withClickEvent(ClickAction.OPEN_URL, downloadLink);
|
||||
} catch (Exception e) {}
|
||||
index += word.length() + 2;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private IJsonBuilder withText(String text) {
|
||||
extras.add("{\"text\":\"" + text + "\"}");
|
||||
return this;
|
||||
}
|
||||
|
||||
private IJsonBuilder withColor(ChatColor color) {
|
||||
String c = color.name().toLowerCase();
|
||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
||||
return this;
|
||||
}
|
||||
|
||||
private IJsonBuilder withColor(String color) {
|
||||
while (color.length() != 1) color = color.substring(1).trim();
|
||||
withColor(ChatColor.getByChar(color));
|
||||
return this;
|
||||
}
|
||||
|
||||
private IJsonBuilder withClickEvent(ClickAction action, String value) {
|
||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
||||
+ "\",\"value\":\"" + value + "\"}");
|
||||
return this;
|
||||
}
|
||||
|
||||
private IJsonBuilder withHoverEvent(HoverAction action, String value) {
|
||||
addSegment("\"hoverEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
||||
+ "\",\"value\":\"" + value + "\"}");
|
||||
return this;
|
||||
}
|
||||
|
||||
private void addSegment(String segment) {
|
||||
String lastText = extras.get(extras.size() - 1);
|
||||
lastText = lastText.substring(0, lastText.length() - 1)
|
||||
+ "," + segment + "}";
|
||||
extras.remove(extras.size() - 1);
|
||||
extras.add(lastText);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (extras.size() <= 1) return extras.size() == 0 ? "{\"text\":\"\"}" : extras.get(0);
|
||||
String text = extras.get(0).substring(0, extras.get(0).length() - 1) + ",\"extra\":[";
|
||||
extras.remove(0);
|
||||
for (String extra : extras)
|
||||
text = text + extra + ",";
|
||||
text = text.substring(0, text.length() - 1) + "]}";
|
||||
return text;
|
||||
}
|
||||
|
||||
private enum ClickAction {
|
||||
RUN_COMMAND, SUGGEST_COMMAND, OPEN_URL
|
||||
}
|
||||
|
||||
private enum HoverAction {
|
||||
SHOW_TEXT
|
||||
}
|
||||
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package de.epiceric.shopchest.nms;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public abstract class ISpawnEggMeta {
|
||||
|
||||
/**
|
||||
* @return The NBT Tag <i>EntityTag.id</i> of the Spawn Egg
|
||||
*/
|
||||
public abstract String getNBTEntityID();
|
||||
|
||||
/**
|
||||
* @param nbtEntityID EntityID returned by {@link #getNBTEntityID()}
|
||||
* @return The {@link EntityType} the Spawn Egg will spawn or <b>null</b> if <i>nbtEntityID</i> is null
|
||||
*/
|
||||
public EntityType getEntityTypeFromNBTEntityID(String nbtEntityID) {
|
||||
if (nbtEntityID == null) return null;
|
||||
|
||||
switch (nbtEntityID) {
|
||||
case "PigZombie":
|
||||
return EntityType.PIG_ZOMBIE;
|
||||
case "CaveSpider":
|
||||
return EntityType.CAVE_SPIDER;
|
||||
case "LavaSlime":
|
||||
return EntityType.MAGMA_CUBE;
|
||||
case "MushroomCow":
|
||||
return EntityType.MUSHROOM_COW;
|
||||
case "EntityHorse":
|
||||
return EntityType.HORSE;
|
||||
case "PolarBear":
|
||||
return EntityType.POLAR_BEAR;
|
||||
default:
|
||||
return EntityType.valueOf(nbtEntityID.toUpperCase());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-v1_10_R1</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.10-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_10_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import net.minecraft.server.v1_10_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram implements IHologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram(String[] text, Location location) {
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
create();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
|
||||
entity.setCustomName(text);
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setNoGravity(true);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_10_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_10_R1.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JsonBuilder extends IJsonBuilder {
|
||||
|
||||
public JsonBuilder(String text, String hoverText, String downloadLink) {
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJson(Player p) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_10_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public SpawnEggMeta(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getNBTEntityID() {
|
||||
net.minecraft.server.v1_10_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
NBTTagCompound tag = nmsStack.getTag();
|
||||
|
||||
return tag == null ? null : tag.getCompound("EntityTag").getString("id");
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-v1_8_R1</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram implements IHologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram(String[] text, Location location) {
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
create();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
|
||||
entity.setCustomName(text);
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import net.minecraft.server.v1_8_R1.ChatSerializer;
|
||||
import net.minecraft.server.v1_8_R1.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JsonBuilder extends IJsonBuilder {
|
||||
|
||||
public JsonBuilder(String text, String hoverText, String downloadLink) {
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJson(Player p) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public SpawnEggMeta(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getNBTEntityID() {
|
||||
net.minecraft.server.v1_8_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
NBTTagCompound tag = nmsStack.getTag();
|
||||
|
||||
return tag == null ? null : tag.getCompound("EntityTag").getString("id");
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-v1_8_R2</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.3-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R2;
|
||||
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import net.minecraft.server.v1_8_R2.EntityArmorStand;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram implements IHologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram(String[] text, Location location) {
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
create();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
|
||||
entity.setCustomName(text);
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R2;
|
||||
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_8_R2.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JsonBuilder extends IJsonBuilder {
|
||||
|
||||
public JsonBuilder(String text, String hoverText, String downloadLink) {
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJson(Player p) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R2;
|
||||
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import net.minecraft.server.v1_8_R2.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public SpawnEggMeta(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getNBTEntityID() {
|
||||
net.minecraft.server.v1_8_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
NBTTagCompound tag = nmsStack.getTag();
|
||||
|
||||
return tag == null ? null : tag.getCompound("EntityTag").getString("id");
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-v1_8_R3</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.8.8-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R3;
|
||||
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram implements IHologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram(String[] text, Location location) {
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
create();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
|
||||
entity.setCustomName(text);
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R3;
|
||||
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JsonBuilder extends IJsonBuilder {
|
||||
|
||||
public JsonBuilder(String text, String hoverText, String downloadLink) {
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJson(Player p) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_8_R3;
|
||||
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public SpawnEggMeta(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getNBTEntityID() {
|
||||
net.minecraft.server.v1_8_R3.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
NBTTagCompound tag = nmsStack.getTag();
|
||||
|
||||
return tag == null ? null : tag.getCompound("EntityTag").getString("id");
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-v1_9_R1</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.9.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_9_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import net.minecraft.server.v1_9_R1.EntityArmorStand;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram implements IHologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram(String[] text, Location location) {
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
create();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
|
||||
entity.setCustomName(text);
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_9_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import net.minecraft.server.v1_9_R1.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_9_R1.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JsonBuilder extends IJsonBuilder {
|
||||
|
||||
public JsonBuilder(String text, String hoverText, String downloadLink) {
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJson(Player p) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_9_R1;
|
||||
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public SpawnEggMeta(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getNBTEntityID() {
|
||||
net.minecraft.server.v1_9_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
NBTTagCompound tag = nmsStack.getTag();
|
||||
|
||||
return tag == null ? null : tag.getCompound("EntityTag").getString("id");
|
||||
}
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest_NMS-v1_9_R2</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
<artifactId>craftbukkit</artifactId>
|
||||
<version>1.9.4-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,87 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_9_R2;
|
||||
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import net.minecraft.server.v1_9_R2.EntityArmorStand;
|
||||
import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram implements IHologram {
|
||||
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<EntityArmorStand> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||
|
||||
public Hologram(String[] text, Location location) {
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
create();
|
||||
}
|
||||
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
public void showPlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armor);
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
public void hidePlayer(OfflinePlayer p) {
|
||||
for (Object o : entityList) {
|
||||
EntityArmorStand armor = (EntityArmorStand) o;
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(armor.getId());
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
public boolean isVisible(OfflinePlayer p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
EntityArmorStand entity = new EntityArmorStand(((CraftWorld) this.location.getWorld()).getHandle(), this.location.getX(), this.location.getY(), this.location.getZ());
|
||||
entity.setCustomName(text);
|
||||
entity.setCustomNameVisible(true);
|
||||
entity.setInvisible(true);
|
||||
entity.setGravity(false);
|
||||
entityList.add(entity);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
for (EntityArmorStand e : entityList) {
|
||||
e.die();
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_9_R2;
|
||||
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import net.minecraft.server.v1_9_R2.IChatBaseComponent.ChatSerializer;
|
||||
import net.minecraft.server.v1_9_R2.PacketPlayOutChat;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class JsonBuilder extends IJsonBuilder {
|
||||
|
||||
public JsonBuilder(String text, String hoverText, String downloadLink) {
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendJson(Player p) {
|
||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
package de.epiceric.shopchest.nms.v1_9_R2;
|
||||
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import net.minecraft.server.v1_9_R2.NBTTagCompound;
|
||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||
|
||||
private ItemStack stack;
|
||||
|
||||
public SpawnEggMeta(ItemStack stack) {
|
||||
this.stack = stack;
|
||||
}
|
||||
|
||||
public String getNBTEntityID() {
|
||||
net.minecraft.server.v1_9_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(stack);
|
||||
|
||||
NBTTagCompound tag = nmsStack.getTag();
|
||||
|
||||
return tag == null ? null : tag.getCompound("EntityTag").getString("id");
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<artifactId>ShopChest</artifactId>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.spigotmc</groupId>
|
||||
<artifactId>spigot-api</artifactId>
|
||||
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<groupId>commons-lang</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>json-simple</artifactId>
|
||||
<groupId>com.googlecode.json-simple</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>guava</artifactId>
|
||||
<groupId>com.google.guava</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>gson</artifactId>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>ebean</artifactId>
|
||||
<groupId>org.avaje</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>snakeyaml</artifactId>
|
||||
<groupId>org.yaml</groupId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<groupId>net.md-5</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.milkbowl.vault</groupId>
|
||||
<artifactId>VaultAPI</artifactId>
|
||||
<version>1.6</version>
|
||||
<scope>provided</scope>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>bukkit</artifactId>
|
||||
<groupId>org.bukkit</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>me.minebuilders</groupId>
|
||||
<artifactId>clearlag</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.griefcraft.lwc</groupId>
|
||||
<artifactId>lwc-entity-locking</artifactId>
|
||||
<version>1.7.3</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
@ -1,52 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<version>1.9.1</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>ShopChest</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-v1_8_R1</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-v1_8_R2</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-v1_8_R3</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-v1_9_R1</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-v1_9_R2</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest_NMS-v1_10_R1</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -1,62 +0,0 @@
|
||||
package de.epiceric.shopchest.listeners;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Regex;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public class NotifyUpdateOnJoinListener implements Listener {
|
||||
|
||||
private ShopChest plugin;
|
||||
private Permission perm;
|
||||
|
||||
public NotifyUpdateOnJoinListener(ShopChest plugin) {
|
||||
this.plugin = plugin;
|
||||
perm = plugin.getPermission();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||
|
||||
Player p = e.getPlayer();
|
||||
|
||||
if (plugin.isUpdateNeeded()) {
|
||||
if (p.isOp() || perm.has(p, "shopchest.notification.update")) {
|
||||
IJsonBuilder jb;
|
||||
|
||||
switch (Utils.getServerVersion()) {
|
||||
case "v1_8_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
break;
|
||||
case "v1_8_R2":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R2.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
break;
|
||||
case "v1_8_R3":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R3.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
break;
|
||||
case "v1_9_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_9_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
break;
|
||||
case "v1_9_R2":
|
||||
jb = new de.epiceric.shopchest.nms.v1_9_R2.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
break;
|
||||
case "v1_10_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_10_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
jb.sendJson(p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
41
pom.xml
41
pom.xml
@ -5,11 +5,12 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>de.epiceric</groupId>
|
||||
<artifactId>ShopChest-Root</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<artifactId>ShopChest</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>1.9.1</version>
|
||||
<name>ShopChest</name>
|
||||
<url>https://www.spigotmc.org/resources/shopchest.11431/</url>
|
||||
<description>Let your players create their own nice-looking shops to sell their stuff to other players!</description>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.7</maven.compiler.source>
|
||||
@ -18,17 +19,6 @@
|
||||
<github.global.server>github</github.global.server>
|
||||
</properties>
|
||||
|
||||
<modules>
|
||||
<module>ShopChest</module>
|
||||
<module>ShopChest NMS-Abstract</module>
|
||||
<module>ShopChest NMS-v1_8_R1</module>
|
||||
<module>ShopChest NMS-v1_8_R2</module>
|
||||
<module>ShopChest NMS-v1_8_R3</module>
|
||||
<module>ShopChest NMS-v1_9_R1</module>
|
||||
<module>ShopChest NMS-v1_9_R2</module>
|
||||
<module>ShopChest NMS-v1_10_R1</module>
|
||||
</modules>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
@ -89,37 +79,12 @@
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>2.4.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>aggregate</id>
|
||||
<goals>
|
||||
<goal>aggregate</goal>
|
||||
</goals>
|
||||
<phase>site</phase>
|
||||
<configuration>
|
||||
<doctitle>ShopChest ${project.version} API</doctitle>
|
||||
<windowtitle>ShopChest ${project.version} API</windowtitle>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>jar</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
|
@ -6,7 +6,7 @@ import de.epiceric.shopchest.event.ShopReloadEvent;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.listeners.*;
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||
import de.epiceric.shopchest.shop.Shop;
|
||||
import de.epiceric.shopchest.shop.Shop.ShopType;
|
||||
import de.epiceric.shopchest.sql.Database;
|
||||
@ -255,29 +255,7 @@ public class ShopChest extends JavaPlugin {
|
||||
|
||||
for (Player p : getServer().getOnlinePlayers()) {
|
||||
if (p.isOp() || perm.has(p, "shopchest.notification.update")) {
|
||||
IJsonBuilder jb;
|
||||
switch (Utils.getServerVersion()) {
|
||||
case "v1_8_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
break;
|
||||
case "v1_8_R2":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R2.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
break;
|
||||
case "v1_8_R3":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R3.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
break;
|
||||
case "v1_9_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_9_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
break;
|
||||
case "v1_9_R2":
|
||||
jb = new de.epiceric.shopchest.nms.v1_9_R2.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
break;
|
||||
case "v1_10_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_10_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
JsonBuilder jb = new JsonBuilder(ShopChest.this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), downloadLink);
|
||||
jb.sendJson(p);
|
||||
}
|
||||
}
|
@ -7,7 +7,7 @@ import de.epiceric.shopchest.event.ShopPreRemoveEvent;
|
||||
import de.epiceric.shopchest.event.ShopReloadEvent;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||
import de.epiceric.shopchest.shop.Shop;
|
||||
import de.epiceric.shopchest.shop.Shop.ShopType;
|
||||
import de.epiceric.shopchest.utils.ClickType;
|
||||
@ -15,7 +15,6 @@ import de.epiceric.shopchest.utils.ClickType.EnumClickType;
|
||||
import de.epiceric.shopchest.utils.ShopUtils;
|
||||
import de.epiceric.shopchest.utils.UpdateChecker;
|
||||
import de.epiceric.shopchest.utils.UpdateChecker.UpdateCheckerResult;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -195,29 +194,7 @@ class ShopCommand extends BukkitCommand {
|
||||
plugin.setDownloadLink(uc.getLink());
|
||||
plugin.setUpdateNeeded(true);
|
||||
|
||||
IJsonBuilder jb;
|
||||
switch (Utils.getServerVersion()) {
|
||||
case "v1_8_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
break;
|
||||
case "v1_8_R2":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R2.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
break;
|
||||
case "v1_8_R3":
|
||||
jb = new de.epiceric.shopchest.nms.v1_8_R3.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
break;
|
||||
case "v1_9_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_9_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
break;
|
||||
case "v1_9_R2":
|
||||
jb = new de.epiceric.shopchest.nms.v1_9_R2.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
break;
|
||||
case "v1_10_R1":
|
||||
jb = new de.epiceric.shopchest.nms.v1_10_R1.JsonBuilder(LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
}
|
||||
JsonBuilder jb = new JsonBuilder(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), uc.getLink());
|
||||
jb.sendJson(player);
|
||||
|
||||
} else if (result == UpdateCheckerResult.FALSE) {
|
@ -3,7 +3,7 @@ package de.epiceric.shopchest.language;
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.LanguageConfiguration;
|
||||
import de.epiceric.shopchest.config.Regex;
|
||||
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||
import de.epiceric.shopchest.nms.SpawnEggMeta;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -995,33 +995,7 @@ public class LanguageUtils {
|
||||
|
||||
for (ItemName itemName : itemNames) {
|
||||
if (itemName.getMaterial() == Material.MONSTER_EGG && material == Material.MONSTER_EGG) {
|
||||
ISpawnEggMeta spawnEggMeta;
|
||||
|
||||
switch (Utils.getServerVersion()) {
|
||||
case "v1_8_R1":
|
||||
spawnEggMeta = new de.epiceric.shopchest.nms.v1_8_R1.SpawnEggMeta(stack);
|
||||
break;
|
||||
case "v1_8_R2":
|
||||
spawnEggMeta = new de.epiceric.shopchest.nms.v1_8_R2.SpawnEggMeta(stack);
|
||||
break;
|
||||
case "v1_8_R3":
|
||||
spawnEggMeta = new de.epiceric.shopchest.nms.v1_8_R3.SpawnEggMeta(stack);
|
||||
break;
|
||||
case "v1_9_R1":
|
||||
spawnEggMeta = new de.epiceric.shopchest.nms.v1_9_R1.SpawnEggMeta(stack);
|
||||
break;
|
||||
case "v1_9_R2":
|
||||
spawnEggMeta = new de.epiceric.shopchest.nms.v1_9_R2.SpawnEggMeta(stack);
|
||||
break;
|
||||
case "v1_10_R1":
|
||||
spawnEggMeta = new de.epiceric.shopchest.nms.v1_10_R1.SpawnEggMeta(stack);
|
||||
break;
|
||||
default:
|
||||
return itemName.getLocalizedName();
|
||||
|
||||
}
|
||||
|
||||
EntityType spawnedType = spawnEggMeta.getEntityTypeFromNBTEntityID(spawnEggMeta.getNBTEntityID());
|
||||
EntityType spawnedType = SpawnEggMeta.getEntityTypeFromItemStack(plugin, stack);
|
||||
|
||||
for (EntityName entityName : entityNames) {
|
||||
if (entityName.getEntityType() == spawnedType) {
|
@ -0,0 +1,38 @@
|
||||
package de.epiceric.shopchest.listeners;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Regex;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.nms.JsonBuilder;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import net.milkbowl.vault.permission.Permission;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public class NotifyUpdateOnJoinListener implements Listener {
|
||||
|
||||
private ShopChest plugin;
|
||||
private Permission perm;
|
||||
|
||||
public NotifyUpdateOnJoinListener(ShopChest plugin) {
|
||||
this.plugin = plugin;
|
||||
perm = plugin.getPermission();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent e) {
|
||||
Player p = e.getPlayer();
|
||||
|
||||
if (plugin.isUpdateNeeded()) {
|
||||
if (p.isOp() || perm.has(p, "shopchest.notification.update")) {
|
||||
JsonBuilder jb = new JsonBuilder(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())), LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD), plugin.getDownloadLink());
|
||||
jb.sendJson(p);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
166
src/main/java/de/epiceric/shopchest/nms/Hologram.java
Normal file
166
src/main/java/de/epiceric/shopchest/nms/Hologram.java
Normal file
@ -0,0 +1,166 @@
|
||||
package de.epiceric.shopchest.nms;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class Hologram {
|
||||
|
||||
private Class<?> entityArmorStandClass;
|
||||
private boolean exists = false;
|
||||
private int count;
|
||||
private List<Object> entityList = new ArrayList<>();
|
||||
private String[] text;
|
||||
private Location location;
|
||||
private List<Player> visible = new ArrayList<>();
|
||||
private ShopChest plugin;
|
||||
|
||||
public Hologram(ShopChest plugin, String[] text, Location location) {
|
||||
this.plugin = plugin;
|
||||
this.text = text;
|
||||
this.location = location;
|
||||
|
||||
try {
|
||||
entityArmorStandClass = Class.forName("net.minecraft.server." + Utils.getServerVersion() + ".EntityArmorStand");
|
||||
} catch (ClassNotFoundException e) {
|
||||
plugin.debug("Could not find EntityArmorStand class");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
create();
|
||||
}
|
||||
|
||||
private void create() {
|
||||
for (String text : this.text) {
|
||||
try {
|
||||
Class<?> nmsWorldClass = Class.forName("net.minecraft.server." + Utils.getServerVersion() + ".World");
|
||||
|
||||
Object craftWorld = this.location.getWorld().getClass().cast(this.location.getWorld());
|
||||
Object nmsWorld = nmsWorldClass.cast(craftWorld.getClass().getMethod("getHandle").invoke(craftWorld));
|
||||
|
||||
Constructor entityArmorStandConstructor = entityArmorStandClass.getConstructor(nmsWorldClass, double.class, double.class, double.class);
|
||||
Object entityArmorStand = entityArmorStandConstructor.newInstance(nmsWorld, this.location.getX(), this.location.getY(), this.getLocation().getZ());
|
||||
|
||||
entityArmorStandClass.getMethod("setCustomName", String.class).invoke(entityArmorStand, text);
|
||||
entityArmorStandClass.getMethod("setCustomNameVisible", boolean.class).invoke(entityArmorStand, true);
|
||||
entityArmorStandClass.getMethod("setInvisible", boolean.class).invoke(entityArmorStand, true);
|
||||
|
||||
if (Utils.getMajorVersion() < 10) {
|
||||
entityArmorStandClass.getMethod("setGravity", boolean.class).invoke(entityArmorStand, false);
|
||||
} else {
|
||||
entityArmorStandClass.getMethod("setNoGravity", boolean.class).invoke(entityArmorStand, true);
|
||||
}
|
||||
|
||||
entityList.add(entityArmorStand);
|
||||
this.location.subtract(0, 0.25, 0);
|
||||
count++;
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException | InstantiationException e) {
|
||||
plugin.debug("Could not create Hologram with reflection");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < count; i++) {
|
||||
this.location.add(0, 0.25, 0);
|
||||
}
|
||||
|
||||
count = 0;
|
||||
exists = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Location of the hologram
|
||||
*/
|
||||
public Location getLocation() {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p Player to which the hologram should be shown
|
||||
*/
|
||||
public void showPlayer(Player p) {
|
||||
for (Object o : entityList) {
|
||||
try {
|
||||
Class<?> packetClass = Class.forName("net.minecraft.server." + Utils.getServerVersion() + ".PacketPlayOutSpawnEntityLiving");
|
||||
Class<?> entityLivingClass = Class.forName("net.minecraft.server." + Utils.getServerVersion() + ".EntityLiving");
|
||||
|
||||
Object entityLiving = entityLivingClass.cast(o);
|
||||
Object packet = packetClass.getConstructor(entityLivingClass).newInstance(entityLiving);
|
||||
|
||||
Utils.sendPacket(plugin, packet, p);
|
||||
} catch (NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException | ClassNotFoundException e) {
|
||||
plugin.debug("Could not show Hologram to player with reflection");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
visible.add(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p Player from which the hologram should be hidden
|
||||
*/
|
||||
public void hidePlayer(Player p) {
|
||||
for (Object o : entityList) {
|
||||
try {
|
||||
Class<?> packetClass = Class.forName("net.minecraft.server." + Utils.getServerVersion() + ".PacketPlayOutEntityDestroy");
|
||||
|
||||
int id = (int) entityArmorStandClass.getMethod("getId").invoke(o);
|
||||
|
||||
Object packet = packetClass.getConstructor(int[].class).newInstance((Object) new int[] {id});
|
||||
|
||||
Utils.sendPacket(plugin, packet, p);
|
||||
} catch (NoSuchMethodException | InstantiationException | InvocationTargetException | IllegalAccessException | ClassNotFoundException e) {
|
||||
plugin.debug("Could not hide Hologram from player with reflection");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
visible.remove(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param p Player to check
|
||||
* @return Whether the hologram is visible to the player
|
||||
*/
|
||||
public boolean isVisible(Player p) {
|
||||
return visible.contains(p);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Whether the hologram exists and is not dead
|
||||
*/
|
||||
public boolean exists() {
|
||||
return exists;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the hologram. <br>
|
||||
* IHologram will be hidden from all players and will be killed
|
||||
*/
|
||||
public void remove() {
|
||||
for (Object o : entityList) {
|
||||
try {
|
||||
o.getClass().getMethod("die").invoke(o);
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
plugin.debug("Could not remove Hologram with reflection");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
exists = false;
|
||||
}
|
||||
|
||||
}
|
117
src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java
Normal file
117
src/main/java/de/epiceric/shopchest/nms/JsonBuilder.java
Normal file
@ -0,0 +1,117 @@
|
||||
package de.epiceric.shopchest.nms;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class JsonBuilder {
|
||||
|
||||
private List<String> extras = new ArrayList<>();
|
||||
private ShopChest plugin;
|
||||
|
||||
public JsonBuilder(ShopChest plugin, String text, String hoverText, String downloadLink) {
|
||||
this.plugin = plugin;
|
||||
|
||||
parse(text, hoverText, downloadLink);
|
||||
}
|
||||
|
||||
private JsonBuilder parse(String text, String hoverText, String downloadLink) {
|
||||
String regex = "[&§]{1}([a-fA-Fl-oL-O0-9]){1}";
|
||||
text = text.replaceAll(regex, "§$1");
|
||||
if (!Pattern.compile(regex).matcher(text).find()) {
|
||||
withText(text).withHoverEvent(hoverText).withClickEvent(downloadLink);
|
||||
return this;
|
||||
}
|
||||
String[] words = text.split(regex);
|
||||
|
||||
int index = words[0].length();
|
||||
for (String word : words) {
|
||||
try {
|
||||
if (index != words[0].length())
|
||||
withText(word).withColor("§" + text.charAt(index - 1)).withHoverEvent(hoverText).withClickEvent(downloadLink);
|
||||
} catch (Exception e) {}
|
||||
index += word.length() + 2;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private JsonBuilder withText(String text) {
|
||||
extras.add("{\"text\":\"" + text + "\"}");
|
||||
return this;
|
||||
}
|
||||
|
||||
private JsonBuilder withColor(ChatColor color) {
|
||||
String c = color.name().toLowerCase();
|
||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
||||
return this;
|
||||
}
|
||||
|
||||
private JsonBuilder withColor(String color) {
|
||||
while (color.length() != 1) color = color.substring(1).trim();
|
||||
withColor(ChatColor.getByChar(color));
|
||||
return this;
|
||||
}
|
||||
|
||||
private JsonBuilder withClickEvent(String value) {
|
||||
addSegment("\"clickEvent\":{\"action\":\"open_url"
|
||||
+ "\",\"value\":\"" + value + "\"}");
|
||||
return this;
|
||||
}
|
||||
|
||||
private JsonBuilder withHoverEvent(String value) {
|
||||
addSegment("\"hoverEvent\":{\"action\":\"show_text"
|
||||
+ "\",\"value\":\"" + value + "\"}");
|
||||
return this;
|
||||
}
|
||||
|
||||
private void addSegment(String segment) {
|
||||
String lastText = extras.get(extras.size() - 1);
|
||||
lastText = lastText.substring(0, lastText.length() - 1)
|
||||
+ "," + segment + "}";
|
||||
extras.remove(extras.size() - 1);
|
||||
extras.add(lastText);
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
if (extras.size() <= 1) return extras.size() == 0 ? "{\"text\":\"\"}" : extras.get(0);
|
||||
String text = extras.get(0).substring(0, extras.get(0).length() - 1) + ",\"extra\":[";
|
||||
extras.remove(0);
|
||||
for (String extra : extras)
|
||||
text = text + extra + ",";
|
||||
text = text.substring(0, text.length() - 1) + "]}";
|
||||
return text;
|
||||
}
|
||||
|
||||
public void sendJson(Player p) {
|
||||
try {
|
||||
String version = Utils.getServerVersion();
|
||||
|
||||
Class<?> iChatBaseComponentClass = Class.forName("net.minecraft.server." + version + ".IChatBaseComponent");
|
||||
Class<?> packetPlayOutChatClass = Class.forName("net.minecraft.server." + version + ".PacketPlayOutChat");
|
||||
Class<?> chatSerializerClass;
|
||||
|
||||
if (version.equals("v1_8_R1")) {
|
||||
chatSerializerClass = Class.forName("net.minecraft.server." + version + ".ChatSerializer");
|
||||
} else {
|
||||
chatSerializerClass = Class.forName("net.minecraft.server." + version + ".IChatBaseComponent$ChatSerializer");
|
||||
}
|
||||
|
||||
Object iChatBaseComponent = chatSerializerClass.getMethod("a", String.class).invoke(null, toString());
|
||||
Object packetPlayOutChat = packetPlayOutChatClass.getConstructor(iChatBaseComponentClass).newInstance(iChatBaseComponent);
|
||||
|
||||
Utils.sendPacket(plugin, packetPlayOutChat, p);
|
||||
} catch (InstantiationException | InvocationTargetException |
|
||||
IllegalAccessException | NoSuchMethodException | ClassNotFoundException e) {
|
||||
plugin.debug("Failed to send packet with reflection");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
72
src/main/java/de/epiceric/shopchest/nms/SpawnEggMeta.java
Normal file
72
src/main/java/de/epiceric/shopchest/nms/SpawnEggMeta.java
Normal file
@ -0,0 +1,72 @@
|
||||
package de.epiceric.shopchest.nms;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
public class SpawnEggMeta {
|
||||
|
||||
private static String getNBTEntityID(ShopChest plugin, ItemStack stack) {
|
||||
try {
|
||||
Class<?> craftItemStackClass = Class.forName("org.bukkit.craftbukkit." + Utils.getServerVersion() + ".inventory.CraftItemStack");
|
||||
|
||||
Object nmsStack = craftItemStackClass.getMethod("asNMSCopy", ItemStack.class).invoke(null, stack);
|
||||
|
||||
Object nbtTagCompound = nmsStack.getClass().getMethod("getTag").invoke(nmsStack);
|
||||
if (nbtTagCompound == null) return null;
|
||||
|
||||
Object entityTagCompound = nbtTagCompound.getClass().getMethod("getCompound", String.class).invoke(nbtTagCompound, "EntityTag");
|
||||
if (entityTagCompound == null) return null;
|
||||
|
||||
Object id = entityTagCompound.getClass().getMethod("getString", String.class).invoke(entityTagCompound, "id");
|
||||
if (id instanceof String) return (String) id;
|
||||
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
|
||||
plugin.debug("Could not get NBTEntityID with reflection");
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param stack {@link ItemStack} (Spawn Egg) of which the Entity should be gotten
|
||||
* @return The {@link EntityType} the Spawn Egg will spawn or <b>null</b> if <i>nbtEntityID</i> is null
|
||||
*/
|
||||
public static EntityType getEntityTypeFromItemStack(ShopChest plugin, ItemStack stack) {
|
||||
if (Utils.getMajorVersion() == 8) {
|
||||
for (EntityType entityType : EntityType.values()) {
|
||||
if (entityType.getTypeId() == stack.getDurability()) {
|
||||
return entityType;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String nbtEntityID = getNBTEntityID(plugin, stack);
|
||||
|
||||
if (nbtEntityID == null) return null;
|
||||
|
||||
switch (nbtEntityID) {
|
||||
case "PigZombie":
|
||||
return EntityType.PIG_ZOMBIE;
|
||||
case "CaveSpider":
|
||||
return EntityType.CAVE_SPIDER;
|
||||
case "LavaSlime":
|
||||
return EntityType.MAGMA_CUBE;
|
||||
case "MushroomCow":
|
||||
return EntityType.MUSHROOM_COW;
|
||||
case "EntityHorse":
|
||||
return EntityType.HORSE;
|
||||
case "PolarBear":
|
||||
return EntityType.POLAR_BEAR;
|
||||
default:
|
||||
return EntityType.valueOf(nbtEntityID.toUpperCase());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -4,7 +4,7 @@ import de.epiceric.shopchest.ShopChest;
|
||||
import de.epiceric.shopchest.config.Regex;
|
||||
import de.epiceric.shopchest.language.LanguageUtils;
|
||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||
import de.epiceric.shopchest.nms.IHologram;
|
||||
import de.epiceric.shopchest.nms.Hologram;
|
||||
import de.epiceric.shopchest.utils.Utils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -31,7 +31,7 @@ public class Shop {
|
||||
private OfflinePlayer vendor;
|
||||
private ItemStack product;
|
||||
private Location location;
|
||||
private IHologram hologram;
|
||||
private Hologram hologram;
|
||||
private Item item;
|
||||
private double buyPrice;
|
||||
private double sellPrice;
|
||||
@ -210,27 +210,7 @@ public class Shop {
|
||||
else holoText[1] = LanguageUtils.getMessage(LocalizedMessage.Message.HOLOGRAM_BUY_SELL, new LocalizedMessage.ReplacedRegex(Regex.BUY_PRICE, String.valueOf(buyPrice)),
|
||||
new LocalizedMessage.ReplacedRegex(Regex.SELL_PRICE, String.valueOf(sellPrice)));
|
||||
|
||||
switch (Utils.getServerVersion()) {
|
||||
case "v1_8_R1":
|
||||
hologram = new de.epiceric.shopchest.nms.v1_8_R1.Hologram(holoText, holoLocation);
|
||||
break;
|
||||
case "v1_8_R2":
|
||||
hologram = new de.epiceric.shopchest.nms.v1_8_R2.Hologram(holoText, holoLocation);
|
||||
break;
|
||||
case "v1_8_R3":
|
||||
hologram = new de.epiceric.shopchest.nms.v1_8_R3.Hologram(holoText, holoLocation);
|
||||
break;
|
||||
case "v1_9_R1":
|
||||
hologram = new de.epiceric.shopchest.nms.v1_9_R1.Hologram(holoText, holoLocation);
|
||||
break;
|
||||
case "v1_9_R2":
|
||||
hologram = new de.epiceric.shopchest.nms.v1_9_R2.Hologram(holoText, holoLocation);
|
||||
break;
|
||||
case "v1_10_R1":
|
||||
hologram = new de.epiceric.shopchest.nms.v1_10_R1.Hologram(holoText, holoLocation);
|
||||
break;
|
||||
}
|
||||
|
||||
hologram = new Hologram(plugin, holoText, holoLocation);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,7 +265,7 @@ public class Shop {
|
||||
/**
|
||||
* @return Hologram of the shop
|
||||
*/
|
||||
public IHologram getHologram() {
|
||||
public Hologram getHologram() {
|
||||
return hologram;
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package de.epiceric.shopchest.utils;
|
||||
|
||||
import de.epiceric.shopchest.ShopChest;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import javax.xml.bind.DatatypeConverter;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@ -50,6 +53,29 @@ public class Utils {
|
||||
return amount;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a packet to a player
|
||||
* @param packet Packet to send
|
||||
* @param player Player to which the packet should be sent
|
||||
* @return {@code true} if the packet was sent, or {@code false} if an exception was thrown
|
||||
*/
|
||||
public static boolean sendPacket(ShopChest plugin, Object packet, Player player) {
|
||||
try {
|
||||
Class<?> packetClass = Class.forName("net.minecraft.server." + getServerVersion() + ".Packet");
|
||||
Object nmsPlayer = player.getClass().getMethod("getHandle").invoke(player);
|
||||
Object playerConnection = nmsPlayer.getClass().getField("playerConnection").get(nmsPlayer);
|
||||
|
||||
playerConnection.getClass().getMethod("sendPacket", packetClass).invoke(playerConnection, packet);
|
||||
|
||||
return true;
|
||||
} catch (ClassNotFoundException | NoSuchMethodException | NoSuchFieldException | IllegalAccessException | InvocationTargetException e) {
|
||||
plugin.debug("Failed to send packet " + packet.getClass().getName());
|
||||
plugin.debug(e);
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return The current server version with revision number (e.g. v1_9_R2, v1_10_R1)
|
||||
*/
|
Loading…
Reference in New Issue
Block a user