Updated to 2.0.5 (manual updates have been applied).

This commit is contained in:
CoderMarido 2018-08-26 12:10:48 +02:00
parent 122aecdc7e
commit 5f115ddd6c
14 changed files with 1015 additions and 1086 deletions

View File

@ -1,3 +1,6 @@
updater:
old-version: '&cYou are running an outdated version of Heads (%version%).'
new-version: '&cYou are running the latest version of Heads (%version%).'
currency:
zero: "Free"
non-zero: "%amount%"

View File

@ -46,6 +46,7 @@ import net.sothatsit.heads.util.Clock;
import net.sothatsit.heads.volatilecode.injection.ProtocolHackFixer;
import net.sothatsit.heads.volatilecode.reflection.Version;
import net.sothatsit.heads.volatilecode.reflection.craftbukkit.CommandMap;
import net.sothatsit.heads.volatilecode.reflection.craftbukkit.CraftMetaItem;
import net.sothatsit.heads.volatilecode.reflection.craftbukkit.CraftServer;
public class Heads extends JavaPlugin implements Listener {
@ -103,6 +104,8 @@ public class Heads extends JavaPlugin implements Listener {
Bukkit.getPluginManager().registerEvents(this, this);
CraftMetaItem.registerItems();
if (mainConfig.shouldCheckForUpdates()) {
checkForUpdates();
}
@ -126,6 +129,7 @@ public class Heads extends JavaPlugin implements Listener {
if (!UpdateChecker.isNewerVersion(latestVersion))
return;
// Learn how to use LangMessage - included next update.
warning("A newer version of Heads, Heads v" + latestVersion + ", is available for download");
warning("You are currently using Heads v" + currentVersion);
} catch (IOException e) {

View File

@ -4,4 +4,4 @@ public class Animations {
// TODO: Add animation heads with live (cached) texures in the next updates.
}
}

View File

@ -4,4 +4,4 @@ public class LiveData {
// TODO: Add animation heads with live (cached) texures in the next updates.
}
}

View File

@ -4,4 +4,4 @@ public class Monitor {
// TODO: Add animation heads with live (cached) texures in the next updates.
}
}

View File

@ -21,7 +21,6 @@ public class HeadsAPI {
private Head(CacheHead head) {
Checks.ensureNonNull(head, "head");
this.head = head;
}
@ -63,11 +62,9 @@ public class HeadsAPI {
private static List<Head> fromCacheHeads(List<CacheHead> heads) {
ImmutableList.Builder<Head> converted = ImmutableList.builder();
for (CacheHead head : heads) {
converted.add(Head.fromCacheHead(head));
}
return converted.build();
}
@ -75,17 +72,14 @@ public class HeadsAPI {
public static Head getHead(int id) {
CacheHead head = Heads.getCache().findHead(id);
if (head == null)
return null;
return new Head(head);
}
@Deprecated
public static List<Head> searchHeads(String query) {
List<CacheHead> search = Heads.getCache().searchHeads(query);
return Head.fromCacheHeads(search);
}
@ -101,13 +95,11 @@ public class HeadsAPI {
public static List<Head> getCategoryHeads(String category) {
List<CacheHead> categoryHeads = Heads.getCache().getCategoryHeads(category);
return Head.fromCacheHeads(categoryHeads);
}
public static List<Head> getAllHeads() {
List<CacheHead> heads = Heads.getCache().getHeads();
return Head.fromCacheHeads(heads);
}
@ -117,4 +109,4 @@ public class HeadsAPI {
});
}
}
}

View File

@ -1,218 +1,223 @@
package net.sothatsit.heads.cache;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Base64;
import java.util.Collections;
import java.util.List;
import java.util.UUID;
import javax.annotation.Nonnull;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import net.sothatsit.heads.Heads;
import net.sothatsit.heads.config.lang.Lang;
import net.sothatsit.heads.config.lang.Placeholder;
import net.sothatsit.heads.util.Checks;
import net.sothatsit.heads.util.IOUtils;
import net.sothatsit.heads.volatilecode.ItemNBT;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.nio.charset.StandardCharsets;
import java.util.*;
public final class CacheHead implements Comparable<CacheHead> {
private int id;
private String name;
private final String category;
private final String texture;
private String textureURL;
private UUID uniqueId;
private final List<String> tags = new ArrayList<>();
private double cost;
private int id;
private String name;
private final String category;
private final String texture;
private String textureURL;
private UUID uniqueId;
private final List<String> tags = new ArrayList<>();
private double cost;
public CacheHead(String name, String category, String texture) {
this(-1, name, category, texture, Collections.emptyList(), -1d);
}
public CacheHead(String name, String category, String texture) {
this(-1, name, category, texture, Collections.emptyList(), -1d);
}
public CacheHead(String name, String category, String texture, String... tags) {
this(-1, name, category, texture, Arrays.asList(tags), -1d);
}
public CacheHead(String name, String category, String texture, String... tags) {
this(-1, name, category, texture, Arrays.asList(tags), -1d);
}
public CacheHead(int id, String name, String category, String texture, List<String> tags, double cost) {
Checks.ensureNonNull(name, "name");
Checks.ensureNonNull(category, "category");
Checks.ensureNonNull(texture, "texture");
Checks.ensureNonNull(tags, "tags");
public CacheHead(int id, String name, String category, String texture, List<String> tags, double cost) {
Checks.ensureNonNull(name, "name");
Checks.ensureNonNull(category, "category");
Checks.ensureNonNull(texture, "texture");
Checks.ensureNonNull(tags, "tags");
this.id = id;
this.name = name;
this.category = category;
this.texture = texture;
this.textureURL = null;
this.uniqueId = null;
this.tags.addAll(tags);
this.cost = cost;
}
this.id = id;
this.name = name;
this.category = category;
this.texture = texture;
this.textureURL = null;
this.uniqueId = null;
this.tags.addAll(tags);
this.cost = cost;
}
public CacheHead copyWithCategory(String category) {
return new CacheHead(id, name, category, texture, tags, cost);
}
public CacheHead copyWithCategory(String category) {
return new CacheHead(id, name, category, texture, tags, cost);
}
public int getId() {
return id;
}
public int getId() {
return id;
}
public String getName() {
return name;
}
public String getName() {
return name;
}
public String getCategory() {
return category;
}
public String getCategory() {
return category;
}
public String getPermission() {
return Heads.getCategoryPermission(category);
}
public String getPermission() {
return Heads.getCategoryPermission(category);
}
public String getTexture() {
return texture;
}
public String getTexture() {
return texture;
}
public String getTextureURL() {
if(textureURL == null) {
textureURL = extractTextureURL(texture);
}
public String getTextureURL() {
if (textureURL == null) {
textureURL = extractTextureURL(texture);
}
return textureURL;
}
return textureURL;
}
public List<String> getTags() {
return tags;
}
public List<String> getTags() {
return tags;
}
public boolean hasCost() {
return cost >= 0;
}
public boolean hasCost() {
return cost >= 0;
}
public double getCost() {
return (hasCost() ? cost : Heads.getMainConfig().getCategoryCost(category));
}
public double getCost() {
return (hasCost() ? cost : Heads.getMainConfig().getCategoryCost(category));
}
public double getRawCost() {
return cost;
}
public double getRawCost() {
return cost;
}
public UUID getUniqueId() {
if(uniqueId == null) {
uniqueId = UUID.nameUUIDFromBytes(getTextureURL().getBytes(StandardCharsets.UTF_8));
}
public UUID getUniqueId() {
if (uniqueId == null) {
uniqueId = UUID.nameUUIDFromBytes(getTextureURL().getBytes(StandardCharsets.UTF_8));
}
return uniqueId;
}
return uniqueId;
}
public Placeholder[] getPlaceholders(Player player) {
return new Placeholder[] {
new Placeholder("%name%", name),
new Placeholder("%cost%", Lang.Currency.format(player, getCost())),
new Placeholder("%category%", category),
new Placeholder("%id%", Integer.toString(id))
};
}
public Placeholder[] getPlaceholders(Player player) {
return new Placeholder[] { new Placeholder("%name%", name), new Placeholder("%cost%", Lang.Currency.format(player, getCost())), new Placeholder("%category%", category), new Placeholder("%id%", Integer.toString(id)) };
}
public ItemStack getItemStack() {
return ItemNBT.createHead(this, null);
}
public ItemStack getItemStack() {
return ItemNBT.createHead(this, null);
}
public ItemStack getItemStack(String name) {
return ItemNBT.createHead(this, name);
}
public ItemStack getItemStack(String name) {
return ItemNBT.createHead(this, name);
}
public ItemStack addTexture(ItemStack itemStack) {
return ItemNBT.applyHead(this, itemStack);
}
public ItemStack addTexture(ItemStack itemStack) {
return ItemNBT.applyHead(this, itemStack);
}
protected void setId(int id) {
this.id = id;
}
protected void setId(int id) {
this.id = id;
}
public void setName(String name) {
Checks.ensureNonNull(name, "name");
public void setName(String name) {
Checks.ensureNonNull(name, "name");
this.name = name;
}
this.name = name;
}
public void setTags(List<String> tags) {
Checks.ensureNonNull(tags, "tags");
public void setTags(List<String> tags) {
Checks.ensureNonNull(tags, "tags");
this.tags.clear();
this.tags.addAll(tags);
}
this.tags.clear();
this.tags.addAll(tags);
}
public void setCost(double cost) {
this.cost = cost;
}
public void setCost(double cost) {
this.cost = cost;
}
public void write(ObjectOutputStream stream) throws IOException {
stream.writeInt(id);
stream.writeUTF(name);
stream.writeUTF(category);
stream.writeUTF(texture);
IOUtils.writeStringList(stream, tags);
stream.writeDouble(cost);
}
public void write(ObjectOutputStream stream) throws IOException {
stream.writeInt(id);
stream.writeUTF(name);
stream.writeUTF(category);
stream.writeUTF(texture);
IOUtils.writeStringList(stream, tags);
stream.writeDouble(cost);
}
public static CacheHead read(ObjectInputStream stream) throws IOException {
int id = stream.readInt();
String name = stream.readUTF();
String category = stream.readUTF();
String texture = stream.readUTF();
List<String> tags = IOUtils.readStringList(stream);
double cost = stream.readDouble();
public static CacheHead read(ObjectInputStream stream) throws IOException {
int id = stream.readInt();
String name = stream.readUTF();
String category = stream.readUTF();
String texture = stream.readUTF();
List<String> tags = IOUtils.readStringList(stream);
double cost = stream.readDouble();
return new CacheHead(id, name, category, texture, tags, cost);
}
return new CacheHead(id, name, category, texture, tags, cost);
}
@Override
public int compareTo(@Nonnull CacheHead otherHead) {
String otherName = otherHead.getName();
@Override
public int compareTo(@Nonnull CacheHead otherHead) {
String otherName = otherHead.getName();
if(name.length() > 1 && otherName.length() <= 1)
return 1;
if (name.length() > 1 && otherName.length() <= 1)
return 1;
if(name.length() <= 1 && otherName.length() > 1)
return -1;
if (name.length() <= 1 && otherName.length() > 1)
return -1;
if(name.length() == 1 && otherName.length() == 1) {
List<String> otherTags = otherHead.getTags();
if (name.length() == 1 && otherName.length() == 1) {
List<String> otherTags = otherHead.getTags();
int length = Math.min(tags.size(), otherTags.size());
int length = Math.min(tags.size(), otherTags.size());
for(int index = 0; index < length; ++index) {
int compare = tags.get(index).compareTo(otherTags.get(index));
for (int index = 0; index < length; ++index) {
int compare = tags.get(index).compareTo(otherTags.get(index));
if(compare != 0)
return compare;
}
if (compare != 0)
return compare;
}
if(tags.size() > 0 && otherTags.size() == 0)
return -1;
if (tags.size() > 0 && otherTags.size() == 0)
return -1;
if(tags.size() == 0 && otherTags.size() > 0)
return 1;
}
if (tags.size() == 0 && otherTags.size() > 0)
return 1;
}
return name.compareTo(otherName);
}
return name.compareTo(otherName);
}
public static String extractTextureURL(String texture) {
try {
String decoded = new String(Base64.getDecoder().decode(texture));
JsonObject json = new JsonParser().parse(decoded).getAsJsonObject();
JsonObject textures = json.getAsJsonObject("textures");
JsonObject skin = textures.getAsJsonObject("SKIN");
return skin.get("url").getAsString();
} catch(Exception e) {
throw new RuntimeException("Unable to get the texture URL of texture " + texture, e);
}
}
public static String extractTextureURL(String texture) {
try {
String decoded = new String(Base64.getDecoder().decode(texture));
JsonObject json = new JsonParser().parse(decoded).getAsJsonObject();
JsonObject textures = json.getAsJsonObject("textures");
JsonObject skin = textures.getAsJsonObject("SKIN");
return skin.get("url").getAsString();
} catch (Exception e) {
throw new RuntimeException("Unable to get the texture URL of texture " + texture, e);
}
}
public static String hello = "%%__USER__%%";
}

View File

@ -1,43 +1,39 @@
package net.sothatsit.heads.cache.legacy;
import java.io.File;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import net.sothatsit.heads.cache.CacheFile;
import net.sothatsit.heads.cache.CacheHead;
import net.sothatsit.heads.config.DefaultsConfigFile;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.stream.Collectors;
public class CacheFileConverter {
public static CacheFile convertToCacheFile(String name, LegacyCacheConfig config) {
Set<String> addons = new HashSet<>(config.getAddons());
public static CacheFile convertToCacheFile(String name, LegacyCacheConfig config) {
Set<String> addons = new HashSet<>(config.getAddons());
addons.add("original");
List<CacheHead> heads = config.getHeads().stream().map(CacheFileConverter::convertToCacheHead).collect(Collectors.toList());
return new CacheFile(name, addons, heads);
}
addons.add("original");
public static CacheHead convertToCacheHead(LegacyCachedHead head) {
int id = head.getId();
String name = head.getName();
String texture = head.getTexture();
String category = head.getCategory();
List<String> tags = Arrays.asList(head.getTags());
double cost = head.getCost();
return new CacheHead(id, name, category, texture, tags, cost);
}
List<CacheHead> heads = config.getHeads().stream()
.map(CacheFileConverter::convertToCacheHead)
.collect(Collectors.toList());
public static void convertResource(String name, String resource, File file) throws IOException {
LegacyCacheConfig addon = new LegacyCacheConfig(new DefaultsConfigFile(resource));
convertToCacheFile(name, addon).write(file);
}
return new CacheFile(name, addons, heads);
}
public static CacheHead convertToCacheHead(LegacyCachedHead head) {
int id = head.getId();
String name = head.getName();
String texture = head.getTexture();
String category = head.getCategory();
List<String> tags = Arrays.asList(head.getTags());
double cost = head.getCost();
return new CacheHead(id, name, category, texture, tags, cost);
}
public static void convertResource(String name, String resource, File file) throws IOException {
LegacyCacheConfig addon = new LegacyCacheConfig(new DefaultsConfigFile(resource));
convertToCacheFile(name, addon).write(file);
}
}
}

View File

@ -1,65 +1,69 @@
package net.sothatsit.heads.cache.legacy;
import net.sothatsit.heads.config.ConfigFile;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.bukkit.configuration.ConfigurationSection;
import java.util.*;
import net.sothatsit.heads.config.ConfigFile;
public class LegacyCacheConfig {
private final ConfigFile configFile;
private final ConfigFile configFile;
private List<LegacyCachedHead> heads = new ArrayList<>();
private Set<String> addons = new HashSet<>();
private List<LegacyCachedHead> heads = new ArrayList<>();
private Set<String> addons = new HashSet<>();
public LegacyCacheConfig(ConfigFile configFile) {
this.configFile = configFile;
public LegacyCacheConfig(ConfigFile configFile) {
this.configFile = configFile;
reload();
}
reload();
}
public Set<String> getAddons() {
return addons;
}
public Set<String> getAddons() {
return addons;
}
public List<LegacyCachedHead> getHeads() {
return Collections.unmodifiableList(heads);
}
public List<LegacyCachedHead> getHeads() {
return Collections.unmodifiableList(heads);
}
public void reload() {
this.configFile.copyDefaults();
this.configFile.reload();
public void reload() {
this.configFile.copyDefaults();
this.configFile.reload();
ConfigurationSection config = this.configFile.getConfig();
ConfigurationSection config = this.configFile.getConfig();
this.addons = new HashSet<>(config.getStringList("addons"));
this.addons = new HashSet<>(config.getStringList("addons"));
this.heads.clear();
this.heads.clear();
// Load all the heads from the legacy config file
int maxId = 0;
for (String key : config.getKeys(false)) {
if (!config.isConfigurationSection(key))
continue;
// Load all the heads from the legacy config file
int maxId = 0;
for (String key : config.getKeys(false)) {
if (!config.isConfigurationSection(key))
continue;
LegacyCachedHead head = new LegacyCachedHead();
LegacyCachedHead head = new LegacyCachedHead();
head.load(config.getConfigurationSection(key));
head.load(config.getConfigurationSection(key));
if(!head.isValid())
continue;
if (!head.isValid())
continue;
heads.add(head);
heads.add(head);
maxId = Math.max(maxId, head.getId());
}
maxId = Math.max(maxId, head.getId());
}
// Give IDs to heads that need them
for(LegacyCachedHead head : heads) {
if(!head.hasId()) {
head.setId(++maxId);
}
}
}
// Give IDs to heads that need them
for (LegacyCachedHead head : heads) {
if (!head.hasId()) {
head.setId(++maxId);
}
}
}
}

View File

@ -1,78 +1,76 @@
package net.sothatsit.heads.command;
import net.sothatsit.heads.Heads;
import net.sothatsit.heads.command.admin.*;
import net.sothatsit.heads.command.user.*;
import net.sothatsit.heads.config.MainConfig;
import net.sothatsit.heads.config.lang.Lang;
import net.sothatsit.heads.config.lang.LangMessage;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import net.sothatsit.heads.Heads;
import net.sothatsit.heads.command.admin.AddCommand;
import net.sothatsit.heads.command.admin.CategoryCostCommand;
import net.sothatsit.heads.command.admin.CostCommand;
import net.sothatsit.heads.command.admin.GiveCommand;
import net.sothatsit.heads.command.admin.HandCommand;
import net.sothatsit.heads.command.admin.IdCommand;
import net.sothatsit.heads.command.admin.ItemEcoCommand;
import net.sothatsit.heads.command.admin.ReloadCommand;
import net.sothatsit.heads.command.admin.RemoveCommand;
import net.sothatsit.heads.command.admin.RenameCommand;
import net.sothatsit.heads.command.user.GetCommand;
import net.sothatsit.heads.command.user.OpenMenuCommand;
import net.sothatsit.heads.command.user.RandomCommand;
import net.sothatsit.heads.command.user.SearchCommand;
import net.sothatsit.heads.config.MainConfig;
import net.sothatsit.heads.config.lang.Lang;
import net.sothatsit.heads.config.lang.LangMessage;
public class HeadsCommand implements CommandExecutor {
private static final OpenMenuCommand openMenu = new OpenMenuCommand();
private static final HelpCommand help = new HelpCommand();
private static final OpenMenuCommand openMenu = new OpenMenuCommand();
private static final HelpCommand help = new HelpCommand();
public static final AbstractCommand[] commands = {
new OpenMenuCommand(),
new SearchCommand(),
new GetCommand(),
new RandomCommand(),
public static final AbstractCommand[] commands = { new OpenMenuCommand(), new SearchCommand(), new GetCommand(), new RandomCommand(),
new AddCommand(),
new HandCommand(),
new RemoveCommand(),
new RenameCommand(),
new IdCommand(),
new GiveCommand(),
new CostCommand(),
new CategoryCostCommand(),
new ItemEcoCommand(),
new AddCommand(), new HandCommand(), new RemoveCommand(), new RenameCommand(), new IdCommand(), new GiveCommand(), new CostCommand(), new CategoryCostCommand(), new ItemEcoCommand(),
new ReloadCommand(),
new HelpCommand()
};
@Override
public boolean onCommand(CommandSender sender, Command bukkitCommand, String label, String[] args) {
if (args.length == 0) {
String permission = openMenu.getPermission();
new ReloadCommand(), new HelpCommand() };
if (permission != null && !sender.hasPermission(permission)) {
Lang.Command.Errors.noPermission().send(sender);
return true;
}
@Override
public boolean onCommand(CommandSender sender, Command bukkitCommand, String label, String[] args) {
if (args.length == 0) {
String permission = openMenu.getPermission();
return openMenu.onCommand(sender, bukkitCommand, label, args);
}
if (permission != null && !sender.hasPermission(permission)) {
Lang.Command.Errors.noPermission().send(sender);
return true;
}
String argument = args[0];
MainConfig config = Heads.getMainConfig();
return openMenu.onCommand(sender, bukkitCommand, label, args);
}
for(AbstractCommand command : commands) {
String commandLabel = command.getCommandLabel(config);
String argument = args[0];
MainConfig config = Heads.getMainConfig();
if(commandLabel == null || !argument.equalsIgnoreCase(commandLabel))
continue;
for (AbstractCommand command : commands) {
String commandLabel = command.getCommandLabel(config);
String permission = command.getPermission();
if (commandLabel == null || !argument.equalsIgnoreCase(commandLabel))
continue;
if (permission != null && !sender.hasPermission(permission)) {
Lang.Command.Errors.noPermission().send(sender);
return true;
}
String permission = command.getPermission();
return command.onCommand(sender, bukkitCommand, label, args);
}
if (permission != null && !sender.hasPermission(permission)) {
Lang.Command.Errors.noPermission().send(sender);
return true;
}
LangMessage unknownCommandMessage = Lang.Command.unknownCommand(argument);
return command.onCommand(sender, bukkitCommand, label, args);
}
LangMessage unknownCommandMessage = Lang.Command.unknownCommand(argument);
unknownCommandMessage.send(sender);
return help.onCommand(sender, new String[0], 10 - unknownCommandMessage.getLineCount());
}
unknownCommandMessage.send(sender);
return help.onCommand(sender, new String[0], 10 - unknownCommandMessage.getLineCount());
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,21 +1,9 @@
package net.sothatsit.heads.patches;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import net.sothatsit.heads.volatilecode.reflection.Version;
public class HeadPlace implements Listener {
// TODO: Patch the issue reported by BlackGamer000 on 1.8.
// register event
@EventHandler
public void onHeadPlace(BlockPlaceEvent event) {
if (Version.isBelow(Version.v1_8)) {
// Need to find a fix for the texures on 1.8
}
}
// Patch removed - issue was a client-side bug.
}

View File

@ -2,44 +2,46 @@ package net.sothatsit.heads.volatilecode.injection;
import java.util.concurrent.Executor;
import javax.annotation.Nonnull;
import net.sothatsit.heads.volatilecode.reflection.Version;
import net.sothatsit.heads.volatilecode.reflection.craftbukkit.CraftMetaSkullSub1;
import net.sothatsit.heads.volatilecode.reflection.nms.TileEntitySkull;
import javax.annotation.Nonnull;
public class ProtocolHackFixer {
public static void fix() {
if (Version.v1_8.higherThan(Version.getVersion())) {
injectTileEntitySkullExecutor();
}
}
private static void injectTileEntitySkullExecutor() {
TileEntitySkull.setExecutor(new InterceptExecutor(TileEntitySkull.getExecutor()));
}
private static class InterceptExecutor implements Executor {
private final Executor handle;
private InterceptExecutor(Executor handle) {
this.handle = handle;
}
@Override
public void execute(@Nonnull Runnable command) {
if (command.getClass().equals(CraftMetaSkullSub1.CraftMetaSkullSub1Class)) {
CraftMetaSkullSub1 skull = new CraftMetaSkullSub1(command);
if (skull.getMeta().getProfile().getName() == null)
return;
}
handle.execute(command);
}
}
public static String banana = "%%__USER__%%";
public static void fix() {
if (Version.v1_8.higherThan(Version.getVersion())) {
injectTileEntitySkullExecutor();
}
}
private static void injectTileEntitySkullExecutor() {
TileEntitySkull.setExecutor(new InterceptExecutor(TileEntitySkull.getExecutor()));
}
private static class InterceptExecutor implements Executor {
private final Executor handle;
private InterceptExecutor(Executor handle) {
this.handle = handle;
}
@Override
public void execute(@Nonnull Runnable command) {
if (command.getClass().equals(CraftMetaSkullSub1.CraftMetaSkullSub1Class)) {
CraftMetaSkullSub1 skull = new CraftMetaSkullSub1(command);
if (skull.getMeta().getProfile().getName() == null)
return;
}
handle.execute(command);
}
}
}

View File

@ -1,7 +1,7 @@
main: net.sothatsit.heads.Heads
author: Marido
name: Heads
version: 2.0.4
version: 2.0.5
api-version: 1.13
softdepend: [Vault, PlayerPoints, BlockStore]
loadbefore: [DeluxeMenus]