mirror of
https://github.com/Flowsqy/ShopChest.git
synced 2024-11-25 00:55:12 +01:00
Converted ShopChest to Maven Project
This commit is contained in:
parent
dae00a2013
commit
54a1b637c6
11
.gitignore
vendored
11
.gitignore
vendored
@ -1,7 +1,16 @@
|
|||||||
/bin/
|
/bin/
|
||||||
/out/
|
/out/
|
||||||
|
/target/
|
||||||
|
/ShopChest/target/
|
||||||
|
/ShopChest NMS-Abstract/target/
|
||||||
|
/ShopChest NMS-v1_8_R1/target/
|
||||||
|
/ShopChest NMS-v1_8_R2/target/
|
||||||
|
/ShopChest NMS-v1_8_R3/target/
|
||||||
|
/ShopChest NMS-v1_9_R1/target/
|
||||||
|
/ShopChest NMS-v1_9_R2/target/
|
||||||
|
/ShopChest NMS-v1_10_R1/target/
|
||||||
/.idea/
|
/.idea/
|
||||||
/.settings/
|
/.settings/
|
||||||
.classpath
|
.classpath
|
||||||
.project
|
.project
|
||||||
ShopChest.iml
|
*.iml
|
14
ShopChest NMS-Abstract/pom.xml
Normal file
14
ShopChest NMS-Abstract/pom.xml
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?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.8.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ShopChest_NMS-Abstract</artifactId>
|
||||||
|
|
||||||
|
</project>
|
@ -1,10 +1,9 @@
|
|||||||
package de.epiceric.shopchest.interfaces;
|
package de.epiceric.shopchest.nms;
|
||||||
|
|
||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
|
|
||||||
public interface Hologram {
|
public interface IHologram {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Location of the hologram
|
* @return Location of the hologram
|
||||||
@ -35,7 +34,7 @@ public interface Hologram {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the hologram. <br>
|
* Removes the hologram. <br>
|
||||||
* Hologram will be hidden from all players and will be killed
|
* IHologram will be hidden from all players and will be killed
|
||||||
*/
|
*/
|
||||||
void remove();
|
void remove();
|
||||||
|
|
@ -1,39 +1,26 @@
|
|||||||
package de.epiceric.shopchest.interfaces.jsonbuilder;
|
package de.epiceric.shopchest.nms;
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
import net.minecraft.server.v1_8_R1.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_8_R1.PacketPlayOutChat;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
public abstract class IJsonBuilder {
|
||||||
|
|
||||||
public class JsonBuilder_1_8_R1 implements JsonBuilder {
|
public abstract void sendJson(Player p);
|
||||||
|
|
||||||
/* JsonBuilder by FisheyLP */
|
|
||||||
|
|
||||||
private List<String> extras = new ArrayList<String>();
|
private List<String> extras = new ArrayList<>();
|
||||||
private ShopChest plugin;
|
|
||||||
|
|
||||||
public JsonBuilder_1_8_R1(ShopChest plugin, String... text) {
|
public IJsonBuilder parse(String text, String hoverText, String downloadLink) {
|
||||||
this.plugin = plugin;
|
|
||||||
for (String extra : text)
|
|
||||||
parse(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R1 parse(String text) {
|
|
||||||
String regex = "[&<26>]{1}([a-fA-Fl-oL-O0-9]){1}";
|
String regex = "[&<26>]{1}([a-fA-Fl-oL-O0-9]){1}";
|
||||||
text = text.replaceAll(regex, "<EFBFBD>$1");
|
text = text.replaceAll(regex, "<EFBFBD>$1");
|
||||||
if (!Pattern.compile(regex).matcher(text).find()) {
|
if (!Pattern.compile(regex).matcher(text).find()) {
|
||||||
withText(text).withHoverEvent(HoverAction.SHOW_TEXT, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
withText(text).withHoverEvent(HoverAction.SHOW_TEXT, hoverText).withClickEvent(ClickAction.OPEN_URL, downloadLink);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
String[] words = text.split(regex);
|
String[] words = text.split(regex);
|
||||||
@ -42,43 +29,37 @@ public class JsonBuilder_1_8_R1 implements JsonBuilder {
|
|||||||
for (String word : words) {
|
for (String word : words) {
|
||||||
try {
|
try {
|
||||||
if (index != words[0].length())
|
if (index != words[0].length())
|
||||||
withText(word).withColor("<EFBFBD>" + text.charAt(index - 1)).withHoverEvent(HoverAction.SHOW_TEXT, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
withText(word).withColor("<EFBFBD>" + text.charAt(index - 1)).withHoverEvent(HoverAction.SHOW_TEXT, hoverText).withClickEvent(ClickAction.OPEN_URL, downloadLink);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {}
|
||||||
}
|
|
||||||
index += word.length() + 2;
|
index += word.length() + 2;
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private IJsonBuilder withText(String text) {
|
||||||
public JsonBuilder_1_8_R1 withText(String text) {
|
|
||||||
extras.add("{\"text\":\"" + text + "\"}");
|
extras.add("{\"text\":\"" + text + "\"}");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private IJsonBuilder withColor(ChatColor color) {
|
||||||
public JsonBuilder_1_8_R1 withColor(ChatColor color) {
|
|
||||||
String c = color.name().toLowerCase();
|
String c = color.name().toLowerCase();
|
||||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private IJsonBuilder withColor(String color) {
|
||||||
public JsonBuilder_1_8_R1 withColor(String color) {
|
|
||||||
while (color.length() != 1) color = color.substring(1).trim();
|
while (color.length() != 1) color = color.substring(1).trim();
|
||||||
withColor(ChatColor.getByChar(color));
|
withColor(ChatColor.getByChar(color));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private IJsonBuilder withClickEvent(ClickAction action, String value) {
|
||||||
public JsonBuilder_1_8_R1 withClickEvent(ClickAction action, String value) {
|
|
||||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
+ "\",\"value\":\"" + value + "\"}");
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private IJsonBuilder withHoverEvent(HoverAction action, String value) {
|
||||||
public JsonBuilder_1_8_R1 withHoverEvent(HoverAction action, String value) {
|
|
||||||
addSegment("\"hoverEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
addSegment("\"hoverEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
+ "\",\"value\":\"" + value + "\"}");
|
||||||
return this;
|
return this;
|
||||||
@ -92,23 +73,22 @@ public class JsonBuilder_1_8_R1 implements JsonBuilder {
|
|||||||
extras.add(lastText);
|
extras.add(lastText);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
if (extras.size() <= 1) return extras.size() == 0 ? "{\"text\":\"\"}" : extras.get(0);
|
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\":[";
|
String text = extras.get(0).substring(0, extras.get(0).length() - 1) + ",\"extra\":[";
|
||||||
extras.remove(0);
|
extras.remove(0);
|
||||||
;
|
|
||||||
for (String extra : extras)
|
for (String extra : extras)
|
||||||
text = text + extra + ",";
|
text = text + extra + ",";
|
||||||
text = text.substring(0, text.length() - 1) + "]}";
|
text = text.substring(0, text.length() - 1) + "]}";
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private enum ClickAction {
|
||||||
public void sendJson(Player p) {
|
RUN_COMMAND, SUGGEST_COMMAND, OPEN_URL
|
||||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
private enum HoverAction {
|
||||||
|
SHOW_TEXT
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,8 +1,8 @@
|
|||||||
package de.epiceric.shopchest.interfaces;
|
package de.epiceric.shopchest.nms;
|
||||||
|
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
|
|
||||||
public abstract class SpawnEggMeta {
|
public abstract class ISpawnEggMeta {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return The NBT Tag <i>EntityTag.id</i> of the Spawn Egg
|
* @return The NBT Tag <i>EntityTag.id</i> of the Spawn Egg
|
29
ShopChest NMS-v1_10_R1/pom.xml
Normal file
29
ShopChest NMS-v1_10_R1/pom.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?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.8.0</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>1.8.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -1,7 +1,9 @@
|
|||||||
package de.epiceric.shopchest.interfaces.hologram;
|
package de.epiceric.shopchest.nms.v1_10_R1;
|
||||||
|
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import net.minecraft.server.v1_10_R1.*;
|
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.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
import org.bukkit.craftbukkit.v1_10_R1.CraftWorld;
|
||||||
@ -10,7 +12,7 @@ import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram_1_10_R1 implements Hologram {
|
public class Hologram implements IHologram {
|
||||||
|
|
||||||
private boolean exists = false;
|
private boolean exists = false;
|
||||||
private int count;
|
private int count;
|
||||||
@ -19,7 +21,7 @@ public class Hologram_1_10_R1 implements Hologram {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||||
|
|
||||||
public Hologram_1_10_R1(String[] text, Location location) {
|
public Hologram(String[] text, Location location) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
create();
|
create();
|
@ -0,0 +1,20 @@
|
|||||||
|
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,16 +1,15 @@
|
|||||||
package de.epiceric.shopchest.interfaces.spawneggmeta;
|
package de.epiceric.shopchest.nms.v1_10_R1;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
|
||||||
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
import net.minecraft.server.v1_10_R1.NBTTagCompound;
|
||||||
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_10_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class SpawnEggMeta_1_10_R1 extends SpawnEggMeta {
|
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public SpawnEggMeta_1_10_R1(ItemStack stack) {
|
public SpawnEggMeta(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
29
ShopChest NMS-v1_8_R1/pom.xml
Normal file
29
ShopChest NMS-v1_8_R1/pom.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?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.8.0</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>1.8.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -1,6 +1,6 @@
|
|||||||
package de.epiceric.shopchest.interfaces.hologram;
|
package de.epiceric.shopchest.nms.v1_8_R1;
|
||||||
|
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
import net.minecraft.server.v1_8_R1.EntityArmorStand;
|
||||||
import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R1.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_8_R1.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R1.PacketPlayOutSpawnEntityLiving;
|
||||||
@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.v1_8_R1.entity.CraftPlayer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram_1_8_R1 implements Hologram {
|
public class Hologram implements IHologram {
|
||||||
|
|
||||||
private boolean exists = false;
|
private boolean exists = false;
|
||||||
private int count;
|
private int count;
|
||||||
@ -21,7 +21,7 @@ public class Hologram_1_8_R1 implements Hologram {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||||
|
|
||||||
public Hologram_1_8_R1(String[] text, Location location) {
|
public Hologram(String[] text, Location location) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
create();
|
create();
|
@ -0,0 +1,20 @@
|
|||||||
|
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,16 +1,15 @@
|
|||||||
package de.epiceric.shopchest.interfaces.spawneggmeta;
|
package de.epiceric.shopchest.nms.v1_8_R1;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
|
||||||
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
import net.minecraft.server.v1_8_R1.NBTTagCompound;
|
||||||
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class SpawnEggMeta_1_8_R1 extends SpawnEggMeta {
|
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public SpawnEggMeta_1_8_R1(ItemStack stack) {
|
public SpawnEggMeta(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
30
ShopChest NMS-v1_8_R2/pom.xml
Normal file
30
ShopChest NMS-v1_8_R2/pom.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?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.8.0</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>1.8.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
@ -1,6 +1,6 @@
|
|||||||
package de.epiceric.shopchest.interfaces.hologram;
|
package de.epiceric.shopchest.nms.v1_8_R2;
|
||||||
|
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import net.minecraft.server.v1_8_R2.EntityArmorStand;
|
import net.minecraft.server.v1_8_R2.EntityArmorStand;
|
||||||
import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntityLiving;
|
||||||
@ -10,10 +10,9 @@ import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram_1_8_R2 implements Hologram {
|
public class Hologram implements IHologram {
|
||||||
|
|
||||||
private boolean exists = false;
|
private boolean exists = false;
|
||||||
private int count;
|
private int count;
|
||||||
@ -22,7 +21,7 @@ public class Hologram_1_8_R2 implements Hologram {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||||
|
|
||||||
public Hologram_1_8_R2(String[] text, Location location) {
|
public Hologram(String[] text, Location location) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
create();
|
create();
|
@ -0,0 +1,20 @@
|
|||||||
|
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,16 +1,15 @@
|
|||||||
package de.epiceric.shopchest.interfaces.spawneggmeta;
|
package de.epiceric.shopchest.nms.v1_8_R2;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
|
||||||
import net.minecraft.server.v1_8_R2.NBTTagCompound;
|
import net.minecraft.server.v1_8_R2.NBTTagCompound;
|
||||||
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class SpawnEggMeta_1_8_R2 extends SpawnEggMeta {
|
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public SpawnEggMeta_1_8_R2(ItemStack stack) {
|
public SpawnEggMeta(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
30
ShopChest NMS-v1_8_R3/pom.xml
Normal file
30
ShopChest NMS-v1_8_R3/pom.xml
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?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.8.0</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>1.8.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -1,6 +1,6 @@
|
|||||||
package de.epiceric.shopchest.interfaces.hologram;
|
package de.epiceric.shopchest.nms.v1_8_R3;
|
||||||
|
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
import net.minecraft.server.v1_8_R3.EntityArmorStand;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||||
@ -10,10 +10,9 @@ import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram_1_8_R3 implements Hologram {
|
public class Hologram implements IHologram {
|
||||||
|
|
||||||
private boolean exists = false;
|
private boolean exists = false;
|
||||||
private int count;
|
private int count;
|
||||||
@ -22,7 +21,7 @@ public class Hologram_1_8_R3 implements Hologram {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||||
|
|
||||||
public Hologram_1_8_R3(String[] text, Location location) {
|
public Hologram(String[] text, Location location) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
create();
|
create();
|
@ -0,0 +1,20 @@
|
|||||||
|
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,16 +1,15 @@
|
|||||||
package de.epiceric.shopchest.interfaces.spawneggmeta;
|
package de.epiceric.shopchest.nms.v1_8_R3;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
|
||||||
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
import net.minecraft.server.v1_8_R3.NBTTagCompound;
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class SpawnEggMeta_1_8_R3 extends SpawnEggMeta {
|
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public SpawnEggMeta_1_8_R3(ItemStack stack) {
|
public SpawnEggMeta(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
29
ShopChest NMS-v1_9_R1/pom.xml
Normal file
29
ShopChest NMS-v1_9_R1/pom.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?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.8.0</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>1.8.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -1,6 +1,6 @@
|
|||||||
package de.epiceric.shopchest.interfaces.hologram;
|
package de.epiceric.shopchest.nms.v1_9_R1;
|
||||||
|
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import net.minecraft.server.v1_9_R1.EntityArmorStand;
|
import net.minecraft.server.v1_9_R1.EntityArmorStand;
|
||||||
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_9_R1.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_9_R1.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_9_R1.PacketPlayOutSpawnEntityLiving;
|
||||||
@ -10,10 +10,9 @@ import org.bukkit.craftbukkit.v1_9_R1.CraftWorld;
|
|||||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram_1_9_R1 implements Hologram {
|
public class Hologram implements IHologram {
|
||||||
|
|
||||||
private boolean exists = false;
|
private boolean exists = false;
|
||||||
private int count;
|
private int count;
|
||||||
@ -22,7 +21,7 @@ public class Hologram_1_9_R1 implements Hologram {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||||
|
|
||||||
public Hologram_1_9_R1(String[] text, Location location) {
|
public Hologram(String[] text, Location location) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
create();
|
create();
|
@ -0,0 +1,20 @@
|
|||||||
|
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,16 +1,15 @@
|
|||||||
package de.epiceric.shopchest.interfaces.spawneggmeta;
|
package de.epiceric.shopchest.nms.v1_9_R1;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
|
||||||
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
import net.minecraft.server.v1_9_R1.NBTTagCompound;
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_9_R1.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class SpawnEggMeta_1_9_R1 extends SpawnEggMeta {
|
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public SpawnEggMeta_1_9_R1(ItemStack stack) {
|
public SpawnEggMeta(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
29
ShopChest NMS-v1_9_R2/pom.xml
Normal file
29
ShopChest NMS-v1_9_R2/pom.xml
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
<?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.8.0</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>1.8.0</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -1,6 +1,6 @@
|
|||||||
package de.epiceric.shopchest.interfaces.hologram;
|
package de.epiceric.shopchest.nms.v1_9_R2;
|
||||||
|
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import net.minecraft.server.v1_9_R2.EntityArmorStand;
|
import net.minecraft.server.v1_9_R2.EntityArmorStand;
|
||||||
import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy;
|
import net.minecraft.server.v1_9_R2.PacketPlayOutEntityDestroy;
|
||||||
import net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving;
|
import net.minecraft.server.v1_9_R2.PacketPlayOutSpawnEntityLiving;
|
||||||
@ -12,7 +12,7 @@ import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
public class Hologram_1_9_R2 implements Hologram {
|
public class Hologram implements IHologram {
|
||||||
|
|
||||||
private boolean exists = false;
|
private boolean exists = false;
|
||||||
private int count;
|
private int count;
|
||||||
@ -21,7 +21,7 @@ public class Hologram_1_9_R2 implements Hologram {
|
|||||||
private Location location;
|
private Location location;
|
||||||
private List<OfflinePlayer> visible = new ArrayList<>();
|
private List<OfflinePlayer> visible = new ArrayList<>();
|
||||||
|
|
||||||
public Hologram_1_9_R2(String[] text, Location location) {
|
public Hologram(String[] text, Location location) {
|
||||||
this.text = text;
|
this.text = text;
|
||||||
this.location = location;
|
this.location = location;
|
||||||
create();
|
create();
|
@ -0,0 +1,20 @@
|
|||||||
|
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,16 +1,15 @@
|
|||||||
package de.epiceric.shopchest.interfaces.spawneggmeta;
|
package de.epiceric.shopchest.nms.v1_9_R2;
|
||||||
|
|
||||||
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
|
||||||
import net.minecraft.server.v1_9_R2.NBTTagCompound;
|
import net.minecraft.server.v1_9_R2.NBTTagCompound;
|
||||||
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_9_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
public class SpawnEggMeta_1_9_R2 extends SpawnEggMeta {
|
public class SpawnEggMeta extends ISpawnEggMeta {
|
||||||
|
|
||||||
private ItemStack stack;
|
private ItemStack stack;
|
||||||
|
|
||||||
public SpawnEggMeta_1_9_R2(ItemStack stack) {
|
public SpawnEggMeta(ItemStack stack) {
|
||||||
this.stack = stack;
|
this.stack = stack;
|
||||||
}
|
}
|
||||||
|
|
111
ShopChest/dependency-reduced-pom.xml
Normal file
111
ShopChest/dependency-reduced-pom.xml
Normal file
@ -0,0 +1,111 @@
|
|||||||
|
<?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.8.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>ShopChest</artifactId>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>craftbukkit</artifactId>
|
||||||
|
<version>1.10-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<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>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</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>
|
||||||
|
</exclusions>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
|
<artifactId>VaultAPI</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yi.acru.bukkit</groupId>
|
||||||
|
<artifactId>lockette</artifactId>
|
||||||
|
<version>1.8.36</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</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>
|
||||||
|
|
59
ShopChest/pom.xml
Normal file
59
ShopChest/pom.xml
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
<?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.8.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ShopChest</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>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest_NMS-v1_8_R1</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest_NMS-v1_8_R2</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest_NMS-v1_8_R3</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest_NMS-v1_9_R1</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest_NMS-v1_9_R2</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest_NMS-v1_10_R1</artifactId>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
@ -2,10 +2,9 @@ package de.epiceric.shopchest;
|
|||||||
|
|
||||||
import de.epiceric.shopchest.config.Config;
|
import de.epiceric.shopchest.config.Config;
|
||||||
import de.epiceric.shopchest.config.Regex;
|
import de.epiceric.shopchest.config.Regex;
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.interfaces.jsonbuilder.*;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
import de.epiceric.shopchest.language.LanguageUtils;
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||||
|
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||||
import de.epiceric.shopchest.shop.Shop.ShopType;
|
import de.epiceric.shopchest.shop.Shop.ShopType;
|
||||||
import de.epiceric.shopchest.utils.ClickType;
|
import de.epiceric.shopchest.utils.ClickType;
|
||||||
import de.epiceric.shopchest.utils.ClickType.EnumClickType;
|
import de.epiceric.shopchest.utils.ClickType.EnumClickType;
|
||||||
@ -152,25 +151,25 @@ public class Commands extends BukkitCommand {
|
|||||||
plugin.setDownloadLink(uc.getLink());
|
plugin.setDownloadLink(uc.getLink());
|
||||||
plugin.setUpdateNeeded(true);
|
plugin.setUpdateNeeded(true);
|
||||||
|
|
||||||
JsonBuilder jb;
|
IJsonBuilder jb;
|
||||||
switch (Utils.getServerVersion()) {
|
switch (Utils.getServerVersion()) {
|
||||||
case "v1_8_R1":
|
case "v1_8_R1":
|
||||||
jb = new JsonBuilder_1_8_R1(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())));
|
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;
|
break;
|
||||||
case "v1_8_R2":
|
case "v1_8_R2":
|
||||||
jb = new JsonBuilder_1_8_R2(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())));
|
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;
|
break;
|
||||||
case "v1_8_R3":
|
case "v1_8_R3":
|
||||||
jb = new JsonBuilder_1_8_R3(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())));
|
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;
|
break;
|
||||||
case "v1_9_R1":
|
case "v1_9_R1":
|
||||||
jb = new JsonBuilder_1_9_R1(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())));
|
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;
|
break;
|
||||||
case "v1_9_R2":
|
case "v1_9_R2":
|
||||||
jb = new JsonBuilder_1_9_R2(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())));
|
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;
|
break;
|
||||||
case "v1_10_R1":
|
case "v1_10_R1":
|
||||||
jb = new JsonBuilder_1_10_R1(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, uc.getVersion())));
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
@ -3,11 +3,10 @@ package de.epiceric.shopchest;
|
|||||||
import de.epiceric.shopchest.config.Config;
|
import de.epiceric.shopchest.config.Config;
|
||||||
import de.epiceric.shopchest.config.LanguageConfiguration;
|
import de.epiceric.shopchest.config.LanguageConfiguration;
|
||||||
import de.epiceric.shopchest.config.Regex;
|
import de.epiceric.shopchest.config.Regex;
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.interfaces.jsonbuilder.*;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
import de.epiceric.shopchest.language.LanguageUtils;
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||||
import de.epiceric.shopchest.listeners.*;
|
import de.epiceric.shopchest.listeners.*;
|
||||||
|
import de.epiceric.shopchest.nms.IJsonBuilder;
|
||||||
import de.epiceric.shopchest.shop.Shop;
|
import de.epiceric.shopchest.shop.Shop;
|
||||||
import de.epiceric.shopchest.shop.Shop.ShopType;
|
import de.epiceric.shopchest.shop.Shop.ShopType;
|
||||||
import de.epiceric.shopchest.sql.Database;
|
import de.epiceric.shopchest.sql.Database;
|
||||||
@ -274,25 +273,25 @@ public class ShopChest extends JavaPlugin {
|
|||||||
|
|
||||||
for (Player p : getServer().getOnlinePlayers()) {
|
for (Player p : getServer().getOnlinePlayers()) {
|
||||||
if (p.isOp() || perm.has(p, "shopchest.notification.update")) {
|
if (p.isOp() || perm.has(p, "shopchest.notification.update")) {
|
||||||
JsonBuilder jb;
|
IJsonBuilder jb;
|
||||||
switch (Utils.getServerVersion()) {
|
switch (Utils.getServerVersion()) {
|
||||||
case "v1_8_R1":
|
case "v1_8_R1":
|
||||||
jb = new JsonBuilder_1_8_R1(this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)));
|
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;
|
break;
|
||||||
case "v1_8_R2":
|
case "v1_8_R2":
|
||||||
jb = new JsonBuilder_1_8_R2(this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)));
|
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;
|
break;
|
||||||
case "v1_8_R3":
|
case "v1_8_R3":
|
||||||
jb = new JsonBuilder_1_8_R3(this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)));
|
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;
|
break;
|
||||||
case "v1_9_R1":
|
case "v1_9_R1":
|
||||||
jb = new JsonBuilder_1_9_R1(this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)));
|
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;
|
break;
|
||||||
case "v1_9_R2":
|
case "v1_9_R2":
|
||||||
jb = new JsonBuilder_1_9_R2(this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)));
|
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;
|
break;
|
||||||
case "v1_10_R1":
|
case "v1_10_R1":
|
||||||
jb = new JsonBuilder_1_10_R1(this, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, latestVersion)));
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
@ -3,8 +3,7 @@ package de.epiceric.shopchest.language;
|
|||||||
import de.epiceric.shopchest.ShopChest;
|
import de.epiceric.shopchest.ShopChest;
|
||||||
import de.epiceric.shopchest.config.LanguageConfiguration;
|
import de.epiceric.shopchest.config.LanguageConfiguration;
|
||||||
import de.epiceric.shopchest.config.Regex;
|
import de.epiceric.shopchest.config.Regex;
|
||||||
import de.epiceric.shopchest.interfaces.SpawnEggMeta;
|
import de.epiceric.shopchest.nms.ISpawnEggMeta;
|
||||||
import de.epiceric.shopchest.interfaces.spawneggmeta.*;
|
|
||||||
import de.epiceric.shopchest.utils.Utils;
|
import de.epiceric.shopchest.utils.Utils;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
@ -960,26 +959,26 @@ public class LanguageUtils {
|
|||||||
|
|
||||||
for (ItemName itemName : itemNames) {
|
for (ItemName itemName : itemNames) {
|
||||||
if (itemName.getMaterial() == Material.MONSTER_EGG && material == Material.MONSTER_EGG) {
|
if (itemName.getMaterial() == Material.MONSTER_EGG && material == Material.MONSTER_EGG) {
|
||||||
SpawnEggMeta spawnEggMeta;
|
ISpawnEggMeta spawnEggMeta;
|
||||||
|
|
||||||
switch (Utils.getServerVersion()) {
|
switch (Utils.getServerVersion()) {
|
||||||
case "v1_8_R1":
|
case "v1_8_R1":
|
||||||
spawnEggMeta = new SpawnEggMeta_1_8_R1(stack);
|
spawnEggMeta = new de.epiceric.shopchest.nms.v1_8_R1.SpawnEggMeta(stack);
|
||||||
break;
|
break;
|
||||||
case "v1_8_R2":
|
case "v1_8_R2":
|
||||||
spawnEggMeta = new SpawnEggMeta_1_8_R2(stack);
|
spawnEggMeta = new de.epiceric.shopchest.nms.v1_8_R2.SpawnEggMeta(stack);
|
||||||
break;
|
break;
|
||||||
case "v1_8_R3":
|
case "v1_8_R3":
|
||||||
spawnEggMeta = new SpawnEggMeta_1_8_R3(stack);
|
spawnEggMeta = new de.epiceric.shopchest.nms.v1_8_R3.SpawnEggMeta(stack);
|
||||||
break;
|
break;
|
||||||
case "v1_9_R1":
|
case "v1_9_R1":
|
||||||
spawnEggMeta = new SpawnEggMeta_1_9_R1(stack);
|
spawnEggMeta = new de.epiceric.shopchest.nms.v1_9_R1.SpawnEggMeta(stack);
|
||||||
break;
|
break;
|
||||||
case "v1_9_R2":
|
case "v1_9_R2":
|
||||||
spawnEggMeta = new SpawnEggMeta_1_9_R2(stack);
|
spawnEggMeta = new de.epiceric.shopchest.nms.v1_9_R2.SpawnEggMeta(stack);
|
||||||
break;
|
break;
|
||||||
case "v1_10_R1":
|
case "v1_10_R1":
|
||||||
spawnEggMeta = new SpawnEggMeta_1_10_R1(stack);
|
spawnEggMeta = new de.epiceric.shopchest.nms.v1_10_R1.SpawnEggMeta(stack);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return itemName.getLocalizedName();
|
return itemName.getLocalizedName();
|
@ -0,0 +1,70 @@
|
|||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perm.has(p, "shopchest.broadcast")) {
|
||||||
|
if (plugin.getBroadcast() != null) {
|
||||||
|
for (String message : plugin.getBroadcast()) {
|
||||||
|
p.sendMessage(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,10 +2,9 @@ package de.epiceric.shopchest.shop;
|
|||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
import de.epiceric.shopchest.ShopChest;
|
||||||
import de.epiceric.shopchest.config.Regex;
|
import de.epiceric.shopchest.config.Regex;
|
||||||
import de.epiceric.shopchest.interfaces.Hologram;
|
|
||||||
import de.epiceric.shopchest.interfaces.hologram.*;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
import de.epiceric.shopchest.language.LanguageUtils;
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
import de.epiceric.shopchest.language.LocalizedMessage;
|
||||||
|
import de.epiceric.shopchest.nms.IHologram;
|
||||||
import de.epiceric.shopchest.utils.Utils;
|
import de.epiceric.shopchest.utils.Utils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -31,7 +30,7 @@ public class Shop {
|
|||||||
private OfflinePlayer vendor;
|
private OfflinePlayer vendor;
|
||||||
private ItemStack product;
|
private ItemStack product;
|
||||||
private Location location;
|
private Location location;
|
||||||
private Hologram hologram;
|
private IHologram hologram;
|
||||||
private Item item;
|
private Item item;
|
||||||
private double buyPrice;
|
private double buyPrice;
|
||||||
private double sellPrice;
|
private double sellPrice;
|
||||||
@ -179,22 +178,22 @@ public class Shop {
|
|||||||
|
|
||||||
switch (Utils.getServerVersion()) {
|
switch (Utils.getServerVersion()) {
|
||||||
case "v1_8_R1":
|
case "v1_8_R1":
|
||||||
hologram = new Hologram_1_8_R1(holoText, holoLocation);
|
hologram = new de.epiceric.shopchest.nms.v1_8_R1.Hologram(holoText, holoLocation);
|
||||||
break;
|
break;
|
||||||
case "v1_8_R2":
|
case "v1_8_R2":
|
||||||
hologram = new Hologram_1_8_R2(holoText, holoLocation);
|
hologram = new de.epiceric.shopchest.nms.v1_8_R2.Hologram(holoText, holoLocation);
|
||||||
break;
|
break;
|
||||||
case "v1_8_R3":
|
case "v1_8_R3":
|
||||||
hologram = new Hologram_1_8_R3(holoText, holoLocation);
|
hologram = new de.epiceric.shopchest.nms.v1_8_R3.Hologram(holoText, holoLocation);
|
||||||
break;
|
break;
|
||||||
case "v1_9_R1":
|
case "v1_9_R1":
|
||||||
hologram = new Hologram_1_9_R1(holoText, holoLocation);
|
hologram = new de.epiceric.shopchest.nms.v1_9_R1.Hologram(holoText, holoLocation);
|
||||||
break;
|
break;
|
||||||
case "v1_9_R2":
|
case "v1_9_R2":
|
||||||
hologram = new Hologram_1_9_R2(holoText, holoLocation);
|
hologram = new de.epiceric.shopchest.nms.v1_9_R2.Hologram(holoText, holoLocation);
|
||||||
break;
|
break;
|
||||||
case "v1_10_R1":
|
case "v1_10_R1":
|
||||||
hologram = new Hologram_1_10_R1(holoText, holoLocation);
|
hologram = new de.epiceric.shopchest.nms.v1_10_R1.Hologram(holoText, holoLocation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,9 +249,9 @@ public class Shop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Hologram of the shop
|
* @return IHologram of the shop
|
||||||
*/
|
*/
|
||||||
public Hologram getHologram() {
|
public IHologram getHologram() {
|
||||||
return hologram;
|
return hologram;
|
||||||
}
|
}
|
||||||
|
|
@ -372,7 +372,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
|
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
|
||||||
*
|
*
|
||||||
* @throws java.io.IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void enable() throws IOException {
|
public void enable() throws IOException {
|
||||||
// This has to be synchronized or it can collide with the check in the task.
|
// This has to be synchronized or it can collide with the check in the task.
|
||||||
@ -393,7 +393,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
||||||
*
|
*
|
||||||
* @throws java.io.IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
public void disable() throws IOException {
|
public void disable() throws IOException {
|
||||||
// This has to be synchronized or it can collide with the check in the task.
|
// This has to be synchronized or it can collide with the check in the task.
|
||||||
@ -677,7 +677,7 @@ public class Metrics {
|
|||||||
/**
|
/**
|
||||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||||
*
|
*
|
||||||
* @return an unmodifiable {@link java.util.Set} of the plotter objects
|
* @return an unmodifiable {@link Set} of the plotter objects
|
||||||
*/
|
*/
|
||||||
public Set<Plotter> getPlotters() {
|
public Set<Plotter> getPlotters() {
|
||||||
return Collections.unmodifiableSet(plotters);
|
return Collections.unmodifiableSet(plotters);
|
@ -1,7 +1,7 @@
|
|||||||
# Do not change anything in here unless you know what you're doing!
|
# Do not change anything in here unless you know what you're doing!
|
||||||
|
|
||||||
name: ShopChest
|
name: ShopChest
|
||||||
main: de.epiceric.shopchest.ShopChest
|
main: de.epiceric.ShopChest
|
||||||
version: 1.8.0
|
version: 1.8.0
|
||||||
author: EpicEric
|
author: EpicEric
|
||||||
website: https://www.spigotmc.org/resources/shopchest.11431/
|
website: https://www.spigotmc.org/resources/shopchest.11431/
|
103
pom.xml
Normal file
103
pom.xml
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
<?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">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>de.epiceric</groupId>
|
||||||
|
<artifactId>ShopChest-Root</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<version>1.8.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.7</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.7</maven.compiler.target>
|
||||||
|
</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>
|
||||||
|
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||||
|
</repository>
|
||||||
|
<repository>
|
||||||
|
<id>shopchest-repo</id>
|
||||||
|
<url>https://epicericee.github.io/ShopChest/maven/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.spigotmc</groupId>
|
||||||
|
<artifactId>spigot-api</artifactId>
|
||||||
|
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bukkit</groupId>
|
||||||
|
<artifactId>bukkit</artifactId>
|
||||||
|
<version>1.10.2-R0.1-SNAPSHOT</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.milkbowl.vault</groupId>
|
||||||
|
<artifactId>VaultAPI</artifactId>
|
||||||
|
<version>1.5</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.yi.acru.bukkit</groupId>
|
||||||
|
<artifactId>lockette</artifactId>
|
||||||
|
<version>1.8.36</version>
|
||||||
|
<scope>provided</scope>
|
||||||
|
</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>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>src/main/resources</directory>
|
||||||
|
<targetPath>.</targetPath>
|
||||||
|
</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>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
</project>
|
@ -1,32 +0,0 @@
|
|||||||
package de.epiceric.shopchest.interfaces;
|
|
||||||
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public interface JsonBuilder {
|
|
||||||
|
|
||||||
JsonBuilder parse(String text);
|
|
||||||
|
|
||||||
JsonBuilder withText(String text);
|
|
||||||
|
|
||||||
JsonBuilder withColor(ChatColor color);
|
|
||||||
|
|
||||||
JsonBuilder withColor(String color);
|
|
||||||
|
|
||||||
JsonBuilder withClickEvent(ClickAction action, String value);
|
|
||||||
|
|
||||||
JsonBuilder withHoverEvent(HoverAction action, String value);
|
|
||||||
|
|
||||||
String toString();
|
|
||||||
|
|
||||||
void sendJson(Player p);
|
|
||||||
|
|
||||||
enum ClickAction {
|
|
||||||
RUN_COMMAND, SUGGEST_COMMAND, OPEN_URL
|
|
||||||
}
|
|
||||||
|
|
||||||
enum HoverAction {
|
|
||||||
SHOW_TEXT
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,113 +0,0 @@
|
|||||||
package de.epiceric.shopchest.interfaces.jsonbuilder;
|
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
import net.minecraft.server.v1_10_R1.IChatBaseComponent.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_10_R1.PacketPlayOutChat;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
public class JsonBuilder_1_10_R1 implements JsonBuilder {
|
|
||||||
|
|
||||||
/* JsonBuilder by FisheyLP */
|
|
||||||
|
|
||||||
private List<String> extras = new ArrayList<String>();
|
|
||||||
private ShopChest plugin;
|
|
||||||
|
|
||||||
public JsonBuilder_1_10_R1(ShopChest plugin, String... text) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
for (String extra : text)
|
|
||||||
parse(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_10_R1 parse(String text) {
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
index += word.length() + 2;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_10_R1 withText(String text) {
|
|
||||||
extras.add("{\"text\":\"" + text + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_10_R1 withColor(ChatColor color) {
|
|
||||||
String c = color.name().toLowerCase();
|
|
||||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_10_R1 withColor(String color) {
|
|
||||||
while (color.length() != 1) color = color.substring(1).trim();
|
|
||||||
withColor(ChatColor.getByChar(color));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_10_R1 withClickEvent(ClickAction action, String value) {
|
|
||||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_10_R1 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendJson(Player p) {
|
|
||||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package de.epiceric.shopchest.interfaces.jsonbuilder;
|
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
import net.minecraft.server.v1_8_R2.IChatBaseComponent.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_8_R2.PacketPlayOutChat;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
public class JsonBuilder_1_8_R2 implements JsonBuilder {
|
|
||||||
|
|
||||||
/* JsonBuilder by FisheyLP */
|
|
||||||
|
|
||||||
private List<String> extras = new ArrayList<String>();
|
|
||||||
private ShopChest plugin;
|
|
||||||
|
|
||||||
public JsonBuilder_1_8_R2(ShopChest plugin, String... text) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
for (String extra : text)
|
|
||||||
parse(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R2 parse(String text) {
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
index += word.length() + 2;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R2 withText(String text) {
|
|
||||||
extras.add("{\"text\":\"" + text + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R2 withColor(ChatColor color) {
|
|
||||||
String c = color.name().toLowerCase();
|
|
||||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R2 withColor(String color) {
|
|
||||||
while (color.length() != 1) color = color.substring(1).trim();
|
|
||||||
withColor(ChatColor.getByChar(color));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R2 withClickEvent(ClickAction action, String value) {
|
|
||||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R2 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendJson(Player p) {
|
|
||||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package de.epiceric.shopchest.interfaces.jsonbuilder;
|
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
import net.minecraft.server.v1_8_R3.IChatBaseComponent.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_8_R3.PacketPlayOutChat;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
public class JsonBuilder_1_8_R3 implements JsonBuilder {
|
|
||||||
|
|
||||||
/* JsonBuilder by FisheyLP */
|
|
||||||
|
|
||||||
private List<String> extras = new ArrayList<String>();
|
|
||||||
private ShopChest plugin;
|
|
||||||
|
|
||||||
public JsonBuilder_1_8_R3(ShopChest plugin, String... text) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
for (String extra : text)
|
|
||||||
parse(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R3 parse(String text) {
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
index += word.length() + 2;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R3 withText(String text) {
|
|
||||||
extras.add("{\"text\":\"" + text + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R3 withColor(ChatColor color) {
|
|
||||||
String c = color.name().toLowerCase();
|
|
||||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R3 withColor(String color) {
|
|
||||||
while (color.length() != 1) color = color.substring(1).trim();
|
|
||||||
withColor(ChatColor.getByChar(color));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R3 withClickEvent(ClickAction action, String value) {
|
|
||||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_8_R3 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendJson(Player p) {
|
|
||||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package de.epiceric.shopchest.interfaces.jsonbuilder;
|
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
import net.minecraft.server.v1_9_R1.IChatBaseComponent.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_9_R1.PacketPlayOutChat;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
public class JsonBuilder_1_9_R1 implements JsonBuilder {
|
|
||||||
|
|
||||||
/* JsonBuilder by FisheyLP */
|
|
||||||
|
|
||||||
private List<String> extras = new ArrayList<String>();
|
|
||||||
private ShopChest plugin;
|
|
||||||
|
|
||||||
public JsonBuilder_1_9_R1(ShopChest plugin, String... text) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
for (String extra : text)
|
|
||||||
parse(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R1 parse(String text) {
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
index += word.length() + 2;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R1 withText(String text) {
|
|
||||||
extras.add("{\"text\":\"" + text + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R1 withColor(ChatColor color) {
|
|
||||||
String c = color.name().toLowerCase();
|
|
||||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R1 withColor(String color) {
|
|
||||||
while (color.length() != 1) color = color.substring(1).trim();
|
|
||||||
withColor(ChatColor.getByChar(color));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R1 withClickEvent(ClickAction action, String value) {
|
|
||||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R1 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendJson(Player p) {
|
|
||||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,114 +0,0 @@
|
|||||||
package de.epiceric.shopchest.interfaces.jsonbuilder;
|
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
import net.minecraft.server.v1_9_R2.IChatBaseComponent.ChatSerializer;
|
|
||||||
import net.minecraft.server.v1_9_R2.PacketPlayOutChat;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftPlayer;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
|
|
||||||
public class JsonBuilder_1_9_R2 implements JsonBuilder {
|
|
||||||
|
|
||||||
/* JsonBuilder by FisheyLP */
|
|
||||||
|
|
||||||
private List<String> extras = new ArrayList<String>();
|
|
||||||
private ShopChest plugin;
|
|
||||||
|
|
||||||
public JsonBuilder_1_9_R2(ShopChest plugin, String... text) {
|
|
||||||
this.plugin = plugin;
|
|
||||||
for (String extra : text)
|
|
||||||
parse(extra);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R2 parse(String text) {
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
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, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_CLICK_TO_DOWNLOAD)).withClickEvent(ClickAction.OPEN_URL, plugin.getDownloadLink());
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
index += word.length() + 2;
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R2 withText(String text) {
|
|
||||||
extras.add("{\"text\":\"" + text + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R2 withColor(ChatColor color) {
|
|
||||||
String c = color.name().toLowerCase();
|
|
||||||
addSegment(color.isColor() ? "\"color\":\"" + c + "\"" : "\"" + c + "\"" + ":true");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R2 withColor(String color) {
|
|
||||||
while (color.length() != 1) color = color.substring(1).trim();
|
|
||||||
withColor(ChatColor.getByChar(color));
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R2 withClickEvent(ClickAction action, String value) {
|
|
||||||
addSegment("\"clickEvent\":{\"action\":\"" + action.toString().toLowerCase()
|
|
||||||
+ "\",\"value\":\"" + value + "\"}");
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public JsonBuilder_1_9_R2 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void sendJson(Player p) {
|
|
||||||
((CraftPlayer) p).getHandle().playerConnection.sendPacket(
|
|
||||||
new PacketPlayOutChat(ChatSerializer.a(toString())));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,71 +0,0 @@
|
|||||||
package de.epiceric.shopchest.listeners;
|
|
||||||
|
|
||||||
import de.epiceric.shopchest.ShopChest;
|
|
||||||
import de.epiceric.shopchest.config.Regex;
|
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
|
||||||
import de.epiceric.shopchest.interfaces.jsonbuilder.*;
|
|
||||||
import de.epiceric.shopchest.language.LanguageUtils;
|
|
||||||
import de.epiceric.shopchest.language.LocalizedMessage;
|
|
||||||
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;
|
|
||||||
|
|
||||||
switch (Utils.getServerVersion()) {
|
|
||||||
case "v1_8_R1":
|
|
||||||
jb = new JsonBuilder_1_8_R1(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())));
|
|
||||||
break;
|
|
||||||
case "v1_8_R2":
|
|
||||||
jb = new JsonBuilder_1_8_R2(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())));
|
|
||||||
break;
|
|
||||||
case "v1_8_R3":
|
|
||||||
jb = new JsonBuilder_1_8_R3(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())));
|
|
||||||
break;
|
|
||||||
case "v1_9_R1":
|
|
||||||
jb = new JsonBuilder_1_9_R1(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())));
|
|
||||||
break;
|
|
||||||
case "v1_9_R2":
|
|
||||||
jb = new JsonBuilder_1_9_R2(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())));
|
|
||||||
break;
|
|
||||||
case "v1_10_R1":
|
|
||||||
jb = new JsonBuilder_1_10_R1(plugin, LanguageUtils.getMessage(LocalizedMessage.Message.UPDATE_AVAILABLE, new LocalizedMessage.ReplacedRegex(Regex.VERSION, plugin.getLatestVersion())));
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
jb.sendJson(p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (perm.has(p, "shopchest.broadcast")) {
|
|
||||||
if (plugin.getBroadcast() != null) {
|
|
||||||
for (String message : plugin.getBroadcast()) {
|
|
||||||
p.sendMessage(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user