This commit is contained in:
Ajneb97 2022-06-21 10:56:17 -04:00
parent 1a2e7044fe
commit 405eb3e246
7 changed files with 114 additions and 21 deletions

View File

@ -1,5 +1,5 @@
main: mc.ajneb97.MineChess main: mc.ajneb97.MineChess
version: 1.13.1 version: 1.14.1
name: MineChess name: MineChess
api-version: 1.13 api-version: 1.13
softdepend: [Multiverse-Core,HolographicDisplays,PlaceholderAPI] softdepend: [Multiverse-Core,HolographicDisplays,PlaceholderAPI]

View File

@ -20,7 +20,8 @@ public class Tablero {
Material m = null; Material m = null;
if(color.equals("b")) { if(color.equals("b")) {
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
m = Material.valueOf("WHITE_WOOL"); m = Material.valueOf("WHITE_WOOL");
}else { }else {
m = Material.WOOL; m = Material.WOOL;
@ -37,7 +38,8 @@ public class Tablero {
l.clone().add(2,0,2).getBlock().setType(m); l.clone().add(2,0,2).getBlock().setType(m);
}else { }else {
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
m = Material.valueOf("GRAY_WOOL"); m = Material.valueOf("GRAY_WOOL");
l.getBlock().setType(m); l.getBlock().setType(m);
l.clone().add(1,0,0).getBlock().setType(m); l.clone().add(1,0,0).getBlock().setType(m);
@ -172,7 +174,7 @@ public class Tablero {
if(color.equals("b")) { if(color.equals("b")) {
Utilidades.setSkullBlock(l2, "eb1fc1a8-763e-442f-bf10-302b3beebb32", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTI2Yjc3MjMyOWNmMzJmODY0M2M0OTI4NjI2YjZhMzI1MjMzZmY2MWFhOWM3NzI1ODczYTRiZDY2ZGIzZDY5MiJ9fX0=", rot); Utilidades.setSkullBlock(l2, "eb1fc1a8-763e-442f-bf10-302b3beebb32", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTI2Yjc3MjMyOWNmMzJmODY0M2M0OTI4NjI2YjZhMzI1MjMzZmY2MWFhOWM3NzI1ODczYTRiZDY2ZGIzZDY5MiJ9fX0=", rot);
}else { }else {
Utilidades.setSkullBlock(l2, "c7b9f611-64c6-4e9c-ac97-8dedf8b97e17", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjZjNWVjYWM5NDJjNzdiOTVhYjQ2MjBkZjViODVlMzgwNjRjOTc0ZjljNWM1NzZiODQzNjIyODA2YTQ1NTcifX19", rot); Utilidades.setSkullBlock(l2, "c766a367-5d10-4b8f-a2fe-d3796bfbfcc1", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdmNTc2NmQyOTI4ZGMwZGYxYjM0MDRjM2JkMDczYzk0NzZkMjZjODA1NzNiMDMzMmU3Y2NlNzNkZjE1NDgyYSJ9fX0=", rot);
} }
}else if(tipo.equals("rey")) { }else if(tipo.equals("rey")) {
l.getBlock().setType(m); l.getBlock().setType(m);
@ -191,7 +193,7 @@ public class Tablero {
if(color.equals("b")) { if(color.equals("b")) {
Utilidades.setSkullBlock(l2, "eb1fc1a8-763e-442f-bf10-302b3beebb32", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTI2Yjc3MjMyOWNmMzJmODY0M2M0OTI4NjI2YjZhMzI1MjMzZmY2MWFhOWM3NzI1ODczYTRiZDY2ZGIzZDY5MiJ9fX0=", rot); Utilidades.setSkullBlock(l2, "eb1fc1a8-763e-442f-bf10-302b3beebb32", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTI2Yjc3MjMyOWNmMzJmODY0M2M0OTI4NjI2YjZhMzI1MjMzZmY2MWFhOWM3NzI1ODczYTRiZDY2ZGIzZDY5MiJ9fX0=", rot);
}else { }else {
Utilidades.setSkullBlock(l2, "c7b9f611-64c6-4e9c-ac97-8dedf8b97e17", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjZjNWVjYWM5NDJjNzdiOTVhYjQ2MjBkZjViODVlMzgwNjRjOTc0ZjljNWM1NzZiODQzNjIyODA2YTQ1NTcifX19", rot); Utilidades.setSkullBlock(l2, "c766a367-5d10-4b8f-a2fe-d3796bfbfcc1", "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZDdmNTc2NmQyOTI4ZGMwZGYxYjM0MDRjM2JkMDczYzk0NzZkMjZjODA1NzNiMDMzMmU3Y2NlNzNkZjE1NDgyYSJ9fX0=", rot);
} }
} }
} }

View File

@ -16,7 +16,8 @@ public class ActionBarAPI
public static void sendActionBar(Player player, String message) public static void sendActionBar(Player player, String message)
{ {
if(Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { if(Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
TextComponent text_component = new TextComponent(message); TextComponent text_component = new TextComponent(message);
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, text_component); player.spigot().sendMessage(ChatMessageType.ACTION_BAR, text_component);
return; return;

View File

@ -49,7 +49,8 @@ public class TitleAPI implements Listener {
public static void sendTitle(Player player, Integer fadeIn, Integer stay, Integer fadeOut, String title, String subtitle) { public static void sendTitle(Player player, Integer fadeIn, Integer stay, Integer fadeOut, String title, String subtitle) {
TitleSendEvent titleSendEvent = new TitleSendEvent(player, title, subtitle); TitleSendEvent titleSendEvent = new TitleSendEvent(player, title, subtitle);
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
if(title.isEmpty()) { if(title.isEmpty()) {
title = " "; title = " ";
} }

View File

@ -38,7 +38,8 @@ public class InventarioCoronacion implements Listener {
//Torre //Torre
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1); item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1);
}else { }else {
item = new ItemStack(Material.SKULL_ITEM,1,(short) 3); item = new ItemStack(Material.SKULL_ITEM,1,(short) 3);
@ -51,7 +52,8 @@ public class InventarioCoronacion implements Listener {
//Caballo //Caballo
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1); item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1);
}else { }else {
item = new ItemStack(Material.SKULL_ITEM,1,(short) 3); item = new ItemStack(Material.SKULL_ITEM,1,(short) 3);
@ -64,7 +66,8 @@ public class InventarioCoronacion implements Listener {
//Alfil //Alfil
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1); item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1);
}else { }else {
item = new ItemStack(Material.SKULL_ITEM,1,(short) 3); item = new ItemStack(Material.SKULL_ITEM,1,(short) 3);
@ -82,7 +85,8 @@ public class InventarioCoronacion implements Listener {
//Reina //Reina
if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15") if(Bukkit.getVersion().contains("1.13") || Bukkit.getVersion().contains("1.14") || Bukkit.getVersion().contains("1.15")
|| Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") || Bukkit.getVersion().contains("1.18")
|| Bukkit.getVersion().contains("1.19")) {
item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1); item = new ItemStack(Material.valueOf("PLAYER_HEAD"),1);
}else { }else {
item = new ItemStack(Material.SKULL_ITEM,1,(short) 3); item = new ItemStack(Material.SKULL_ITEM,1,(short) 3);

View File

@ -26,6 +26,7 @@ import mc.ajneb97.versiones.V1_16_R2;
import mc.ajneb97.versiones.V1_16_R3; import mc.ajneb97.versiones.V1_16_R3;
import mc.ajneb97.versiones.V1_17; import mc.ajneb97.versiones.V1_17;
import mc.ajneb97.versiones.V1_18; import mc.ajneb97.versiones.V1_18;
import mc.ajneb97.versiones.V1_19;
import mc.ajneb97.versiones.V1_8_R1; import mc.ajneb97.versiones.V1_8_R1;
import mc.ajneb97.versiones.V1_8_R2; import mc.ajneb97.versiones.V1_8_R2;
import mc.ajneb97.versiones.V1_8_R3; import mc.ajneb97.versiones.V1_8_R3;
@ -70,7 +71,7 @@ public class Utilidades {
} }
meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES,ItemFlag.HIDE_ENCHANTS,ItemFlag.HIDE_UNBREAKABLE,ItemFlag.HIDE_POTION_EFFECTS); meta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES,ItemFlag.HIDE_ENCHANTS,ItemFlag.HIDE_UNBREAKABLE,ItemFlag.HIDE_POTION_EFFECTS);
if(Bukkit.getVersion().contains("1.15") || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17") if(Bukkit.getVersion().contains("1.15") || Bukkit.getVersion().contains("1.16") || Bukkit.getVersion().contains("1.17")
|| Bukkit.getVersion().contains("1.18")) { || Bukkit.getVersion().contains("1.18") || Bukkit.getVersion().contains("1.19")) {
meta.setUnbreakable(true); meta.setUnbreakable(true);
}else { }else {
meta.spigot().setUnbreakable(true); //SOLO FUNCIONA CON SPIGOT meta.spigot().setUnbreakable(true); //SOLO FUNCIONA CON SPIGOT
@ -82,42 +83,46 @@ public class Utilidades {
public static void setSkullBlock(Location l, String id, String textura, int rot) { public static void setSkullBlock(Location l, String id, String textura, int rot) {
String packageName = Bukkit.getServer().getClass().getPackage().getName(); String packageName = Bukkit.getServer().getClass().getPackage().getName();
if(packageName.contains("1_19")){
V1_19 u = new V1_19();
u.setSkullBlock(l,id,textura,rot);
}else
if(packageName.contains("1_18")){ if(packageName.contains("1_18")){
V1_18 u = new V1_18(); V1_18 u = new V1_18();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_17")){ if(packageName.contains("1_17")){
V1_17 u = new V1_17(); V1_17 u = new V1_17();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_16_R3")){ if(packageName.contains("1_16_R3")){
V1_16_R3 u = new V1_16_R3(); V1_16_R3 u = new V1_16_R3();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_16_R2")){ if(packageName.contains("1_16_R2")){
V1_16_R2 u = new V1_16_R2(); V1_16_R2 u = new V1_16_R2();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_16_R1")){ if(packageName.contains("1_16_R1")){
V1_16 u = new V1_16(); V1_16 u = new V1_16();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_15_R1")){ if(packageName.contains("1_15_R1")){
V1_15 u = new V1_15(); V1_15 u = new V1_15();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_14_R1")){ if(packageName.contains("1_14_R1")){
V1_14 u = new V1_14(); V1_14 u = new V1_14();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_13_R2")){ if(packageName.contains("1_13_R2")){
V1_13_R2 u = new V1_13_R2(); V1_13_R2 u = new V1_13_R2();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_13_R1")){ if(packageName.contains("1_13_R1")){
V1_13 u = new V1_13(); V1_13 u = new V1_13();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
} }else
if(packageName.contains("1_12_R1")){ if(packageName.contains("1_12_R1")){
V1_12 u = new V1_12(); V1_12 u = new V1_12();
u.setSkullBlock(l,id,textura,rot); u.setSkullBlock(l,id,textura,rot);
@ -154,6 +159,10 @@ public class Utilidades {
public static void generarParticula(String particle, Location loc, float xOffset, float yOffset, float zOffset, float speed, int count, Player player) { public static void generarParticula(String particle, Location loc, float xOffset, float yOffset, float zOffset, float speed, int count, Player player) {
String packageName = Bukkit.getServer().getClass().getPackage().getName(); String packageName = Bukkit.getServer().getClass().getPackage().getName();
if(packageName.contains("1_19")){
V1_19 u = new V1_19();
u.generarParticula(particle, loc, xOffset, yOffset, zOffset, speed, count, player);
}
if(packageName.contains("1_18")){ if(packageName.contains("1_18")){
V1_18 u = new V1_18(); V1_18 u = new V1_18();
u.generarParticula(particle, loc, xOffset, yOffset, zOffset, speed, count, player); u.generarParticula(particle, loc, xOffset, yOffset, zOffset, speed, count, player);
@ -255,6 +264,11 @@ public class Utilidades {
public static ItemStack getCabeza(ItemStack item, String id,String textura){ public static ItemStack getCabeza(ItemStack item, String id,String textura){
String packageName = Bukkit.getServer().getClass().getPackage().getName(); String packageName = Bukkit.getServer().getClass().getPackage().getName();
if(packageName.contains("1_19")){
V1_19 u = new V1_19();
ItemStack stack = u.getCabeza(item,id,textura);
return stack;
}
if(packageName.contains("1_18")){ if(packageName.contains("1_18")){
V1_18 u = new V1_18(); V1_18 u = new V1_18();
ItemStack stack = u.getCabeza(item,id,textura); ItemStack stack = u.getCabeza(item,id,textura);

View File

@ -0,0 +1,71 @@
package mc.ajneb97.versiones;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Color;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Particle;
import org.bukkit.SkullType;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Skull;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
public class V1_19 {
public void generarParticula(String particle, Location loc, float xOffset, float yOffset, float zOffset, float speed, int count, Player player){
player.spawnParticle(Particle.valueOf(particle),loc,count,xOffset,yOffset,zOffset,speed);
}
@SuppressWarnings("deprecation")
public void setSkullBlock(Location locBloque,String id,String textura,int rot) {
locBloque.getBlock().setType(Material.valueOf("PLAYER_HEAD"));
Skull skullBlock = (Skull) locBloque.getBlock().getState();
//skullBlock.setSkullType(SkullType.PLAYER);
if(rot == 8) {
skullBlock.setRotation(BlockFace.NORTH);
}
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", textura));
try {
Field profileField = skullBlock.getClass().getDeclaredField("profile");
profileField.setAccessible(true);
profileField.set(skullBlock, profile);
}catch (NoSuchFieldException | IllegalAccessException e) { e.printStackTrace(); }
skullBlock.update();
}
public ItemStack getCabeza(ItemStack item, String id,String textura) {
if (textura.isEmpty()) return item;
SkullMeta skullMeta = (SkullMeta) item.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
profile.getProperties().put("textures", new Property("textures", textura));
try {
Method mtd = skullMeta.getClass().getDeclaredMethod("setProfile", GameProfile.class);
mtd.setAccessible(true);
mtd.invoke(skullMeta, profile);
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) {
ex.printStackTrace();
}
item.setItemMeta(skullMeta);
return item;
}
}