mirror of
https://github.com/songoda/EpicHeads.git
synced 2025-02-02 20:51:22 +01:00
Updated to 2.0.3 (some manual patches).
This commit is contained in:
parent
1caf138d56
commit
02be1447fc
@ -8,8 +8,8 @@ Quality, performance, and support are my priorities for this resource. Purchase
|
|||||||
Here is an example with built-in methods for developers that want to use the developers API to code other resources.
|
Here is an example with built-in methods for developers that want to use the developers API to code other resources.
|
||||||
```ruby
|
```ruby
|
||||||
# Check if Heads is installed and enabled.
|
# Check if Heads is installed and enabled.
|
||||||
if(Bukkit.getPluginManager().getPlugin("Heads") != null) {
|
if (HeadsAPI.isEnabled()) {
|
||||||
Bukkit.broadcastMessage("Hooray!");
|
Hooray();
|
||||||
}
|
}
|
||||||
|
|
||||||
# How you would get the heads in any way.
|
# How you would get the heads in any way.
|
||||||
|
@ -45,15 +45,17 @@ public class HeadNamer implements Listener {
|
|||||||
return Heads.getMainConfig().shouldUseBlockStore() && Heads.isBlockStoreAvailable();
|
return Heads.getMainConfig().shouldUseBlockStore() && Heads.isBlockStoreAvailable();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private boolean isHeadsHead(ItemStack item) {
|
private boolean isHeadsHead(ItemStack item) {
|
||||||
if (!Items.isSkull(item))
|
if (!Items.isSkull(item))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
SkullMeta meta = (SkullMeta) item.getItemMeta();
|
||||||
|
// This needs to be kept too since it will not work on 1.8 if changed.
|
||||||
return meta.hasOwner() && meta.getOwner().equals("SpigotHeadPlugin");
|
return meta.hasOwner() && meta.getOwner().equals("SpigotHeadPlugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
private boolean isHeadsHead(Block block) {
|
private boolean isHeadsHead(Block block) {
|
||||||
BlockState state = block.getState();
|
BlockState state = block.getState();
|
||||||
if (!(state instanceof Skull))
|
if (!(state instanceof Skull))
|
||||||
@ -61,6 +63,7 @@ public class HeadNamer implements Listener {
|
|||||||
|
|
||||||
Skull skull = (Skull) state;
|
Skull skull = (Skull) state;
|
||||||
|
|
||||||
|
// This needs to be kept too since it will not work on 1.8 if changed.
|
||||||
return skull.getOwner() != null && skull.getOwner().equals("SpigotHeadPlugin");
|
return skull.getOwner() != null && skull.getOwner().equals("SpigotHeadPlugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,10 +45,12 @@ public class LegacyIDs {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public static LegacyIDs create() {
|
public static LegacyIDs create() {
|
||||||
Map<Integer, String> idToType = new HashMap<>();
|
Map<Integer, String> idToType = new HashMap<>();
|
||||||
|
|
||||||
for (Material type : Material.values()) {
|
for (Material type : Material.values()) {
|
||||||
|
// This need to be kept for the legacy IDS for 1.13.
|
||||||
idToType.put(type.getId(), type.name());
|
idToType.put(type.getId(), type.name());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,28 @@
|
|||||||
package net.sothatsit.heads;
|
package net.sothatsit.heads;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
public class LiveHead {
|
public class LiveHead {
|
||||||
|
|
||||||
// TODO: Add animation heads with live (cached) texures in the next updates.
|
private int frames;
|
||||||
|
private List<Heads> fases;
|
||||||
|
private Location location;
|
||||||
|
|
||||||
|
public LiveHead(int frames, List<Heads> fases, Location location /*.more.*/) {
|
||||||
|
// Safety first, experimental features should not crash servers.
|
||||||
|
if (frames > 60)
|
||||||
|
frames = 60;
|
||||||
|
this.frames = frames;
|
||||||
|
this.fases = fases;
|
||||||
|
this.location = location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void renderTexure() {
|
||||||
|
int interval = frames / 20;
|
||||||
|
// Render (but I am too tired for now).
|
||||||
|
// TODO: External classes from the animation packages.
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,16 +1,18 @@
|
|||||||
package net.sothatsit.heads.api;
|
package net.sothatsit.heads.api;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
|
||||||
import net.sothatsit.heads.Heads;
|
|
||||||
import net.sothatsit.heads.cache.CacheHead;
|
|
||||||
import net.sothatsit.heads.util.Checks;
|
|
||||||
import net.sothatsit.heads.volatilecode.TextureGetter;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
|
||||||
|
import com.google.common.collect.ImmutableList;
|
||||||
|
|
||||||
|
import net.sothatsit.heads.Heads;
|
||||||
|
import net.sothatsit.heads.cache.CacheHead;
|
||||||
|
import net.sothatsit.heads.util.Checks;
|
||||||
|
import net.sothatsit.heads.volatilecode.TextureGetter;
|
||||||
|
|
||||||
public class HeadsAPI {
|
public class HeadsAPI {
|
||||||
|
|
||||||
public static class Head {
|
public static class Head {
|
||||||
@ -23,6 +25,10 @@ public class HeadsAPI {
|
|||||||
this.head = head;
|
this.head = head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return Heads.getInstance() != null;
|
||||||
|
}
|
||||||
|
|
||||||
public int getId() {
|
public int getId() {
|
||||||
return head.getId();
|
return head.getId();
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
package net.sothatsit.heads.command.admin;
|
package net.sothatsit.heads.command.admin;
|
||||||
|
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
import net.sothatsit.heads.Heads;
|
import net.sothatsit.heads.Heads;
|
||||||
import net.sothatsit.heads.cache.CacheHead;
|
import net.sothatsit.heads.cache.CacheHead;
|
||||||
import net.sothatsit.heads.command.AbstractCommand;
|
import net.sothatsit.heads.command.AbstractCommand;
|
||||||
@ -10,13 +16,6 @@ import net.sothatsit.heads.volatilecode.Items;
|
|||||||
import net.sothatsit.heads.volatilecode.TextureGetter;
|
import net.sothatsit.heads.volatilecode.TextureGetter;
|
||||||
import net.sothatsit.heads.volatilecode.reflection.Version;
|
import net.sothatsit.heads.volatilecode.reflection.Version;
|
||||||
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
|
||||||
|
|
||||||
public class HandCommand extends AbstractCommand {
|
public class HandCommand extends AbstractCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -81,6 +80,7 @@ public class HandCommand extends AbstractCommand {
|
|||||||
|
|
||||||
SkullMeta meta = (SkullMeta) hand.getItemMeta();
|
SkullMeta meta = (SkullMeta) hand.getItemMeta();
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
final String owner = meta.getOwner();
|
final String owner = meta.getOwner();
|
||||||
|
|
||||||
if (owner == null || owner.isEmpty()) {
|
if (owner == null || owner.isEmpty()) {
|
||||||
|
@ -2,6 +2,13 @@ package net.sothatsit.heads.command.user;
|
|||||||
|
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.inventory.ItemStack;
|
||||||
|
import org.bukkit.inventory.meta.SkullMeta;
|
||||||
|
|
||||||
import net.sothatsit.heads.cache.CacheHead;
|
import net.sothatsit.heads.cache.CacheHead;
|
||||||
import net.sothatsit.heads.command.AbstractCommand;
|
import net.sothatsit.heads.command.AbstractCommand;
|
||||||
import net.sothatsit.heads.config.MainConfig;
|
import net.sothatsit.heads.config.MainConfig;
|
||||||
@ -10,14 +17,6 @@ import net.sothatsit.heads.volatilecode.Items;
|
|||||||
import net.sothatsit.heads.volatilecode.TextureGetter;
|
import net.sothatsit.heads.volatilecode.TextureGetter;
|
||||||
import net.sothatsit.heads.volatilecode.reflection.Version;
|
import net.sothatsit.heads.volatilecode.reflection.Version;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
|
||||||
import org.bukkit.Material;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.inventory.ItemStack;
|
|
||||||
import org.bukkit.inventory.meta.SkullMeta;
|
|
||||||
|
|
||||||
public class GetCommand extends AbstractCommand {
|
public class GetCommand extends AbstractCommand {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -35,6 +34,7 @@ public class GetCommand extends AbstractCommand {
|
|||||||
return Lang.Command.Get.help();
|
return Lang.Command.Get.help();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
public boolean onCommand(final CommandSender sender, final Command command, final String label, final String[] args) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package net.sothatsit.heads.config.menu;
|
package net.sothatsit.heads.config.menu;
|
||||||
|
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import net.sothatsit.heads.Heads;
|
import net.sothatsit.heads.Heads;
|
||||||
import net.sothatsit.heads.config.ConfigFile;
|
import net.sothatsit.heads.config.ConfigFile;
|
||||||
import net.sothatsit.heads.config.FileConfigFile;
|
|
||||||
import net.sothatsit.heads.menu.CacheHeadsMenu;
|
import net.sothatsit.heads.menu.CacheHeadsMenu;
|
||||||
import net.sothatsit.heads.menu.CategoriesMenu;
|
import net.sothatsit.heads.menu.CategoriesMenu;
|
||||||
import net.sothatsit.heads.menu.HeadsMenu;
|
import net.sothatsit.heads.menu.HeadsMenu;
|
||||||
import net.sothatsit.heads.menu.ui.item.Item;
|
|
||||||
import net.sothatsit.heads.menu.ui.element.Scrollbar;
|
|
||||||
import net.sothatsit.heads.menu.ui.element.PagedBox;
|
import net.sothatsit.heads.menu.ui.element.PagedBox;
|
||||||
|
import net.sothatsit.heads.menu.ui.element.Scrollbar;
|
||||||
|
import net.sothatsit.heads.menu.ui.item.Item;
|
||||||
import net.sothatsit.heads.util.Checks;
|
import net.sothatsit.heads.util.Checks;
|
||||||
|
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
|
||||||
|
|
||||||
public class MenuConfig {
|
public class MenuConfig {
|
||||||
|
|
||||||
private final ConfigFile config;
|
private final ConfigFile config;
|
||||||
|
@ -1,17 +1,14 @@
|
|||||||
package net.sothatsit.heads.config.oldmenu;
|
package net.sothatsit.heads.config.oldmenu;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
import net.sothatsit.heads.Heads;
|
import net.sothatsit.heads.Heads;
|
||||||
import net.sothatsit.heads.config.ConfigFile;
|
import net.sothatsit.heads.config.ConfigFile;
|
||||||
|
|
||||||
import net.sothatsit.heads.util.Clock;
|
import net.sothatsit.heads.util.Clock;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
|
||||||
|
|
||||||
public class MenuConfig {
|
public class MenuConfig {
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ import net.sothatsit.heads.util.Stringify;
|
|||||||
import net.sothatsit.heads.volatilecode.ItemNBT;
|
import net.sothatsit.heads.volatilecode.ItemNBT;
|
||||||
import net.sothatsit.heads.volatilecode.reflection.Version;
|
import net.sothatsit.heads.volatilecode.reflection.Version;
|
||||||
|
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
public final class Item {
|
public final class Item {
|
||||||
|
|
||||||
private final Material type;
|
private final Material type;
|
||||||
@ -205,6 +206,7 @@ public final class Item {
|
|||||||
return new Item(type, 1, data, null, null, false);
|
return new Item(type, 1, data, null, null, false);
|
||||||
}
|
}
|
||||||
return new Item(type, 1, (short) 0, null, null, false);
|
return new Item(type, 1, (short) 0, null, null, false);
|
||||||
|
// TODO: Needs manual testing on 1.13.
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item create(ItemStack itemStack) {
|
public static Item create(ItemStack itemStack) {
|
||||||
@ -361,6 +363,7 @@ public final class Item {
|
|||||||
return Material.matchMaterial(typeName, true);
|
return Material.matchMaterial(typeName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Need to be kept, will look for an alternative in the future.
|
||||||
public static Material fromLegacyType(Material legacyType, byte data) {
|
public static Material fromLegacyType(Material legacyType, byte data) {
|
||||||
return Bukkit.getUnsafe().fromLegacy(new MaterialData(legacyType, data));
|
return Bukkit.getUnsafe().fromLegacy(new MaterialData(legacyType, data));
|
||||||
}
|
}
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
package net.sothatsit.heads.oldmenu.mode;
|
package net.sothatsit.heads.oldmenu.mode;
|
||||||
|
|
||||||
import net.sothatsit.heads.Heads;
|
|
||||||
import net.sothatsit.heads.config.oldmenu.Menus;
|
|
||||||
import net.sothatsit.heads.cache.CacheHead;
|
|
||||||
import net.sothatsit.heads.config.oldmenu.Menu;
|
|
||||||
import net.sothatsit.heads.config.lang.Lang;
|
|
||||||
import net.sothatsit.heads.economy.Economy;
|
|
||||||
import net.sothatsit.heads.oldmenu.ConfirmMenu;
|
|
||||||
import net.sothatsit.heads.oldmenu.HeadMenu;
|
|
||||||
import net.sothatsit.heads.oldmenu.InventoryType;
|
|
||||||
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
|
||||||
|
import net.sothatsit.heads.Heads;
|
||||||
|
import net.sothatsit.heads.cache.CacheHead;
|
||||||
|
import net.sothatsit.heads.config.lang.Lang;
|
||||||
|
import net.sothatsit.heads.config.oldmenu.Menu;
|
||||||
|
import net.sothatsit.heads.config.oldmenu.Menus;
|
||||||
|
import net.sothatsit.heads.oldmenu.ConfirmMenu;
|
||||||
|
import net.sothatsit.heads.oldmenu.HeadMenu;
|
||||||
|
import net.sothatsit.heads.oldmenu.InventoryType;
|
||||||
|
|
||||||
public class GetMode extends BaseMode {
|
public class GetMode extends BaseMode {
|
||||||
|
|
||||||
public GetMode(Player player) {
|
public GetMode(Player player) {
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
package net.sothatsit.heads.oldmenu.mode;
|
package net.sothatsit.heads.oldmenu.mode;
|
||||||
|
|
||||||
import net.sothatsit.heads.Heads;
|
import java.util.List;
|
||||||
import net.sothatsit.heads.config.oldmenu.Menus;
|
|
||||||
import net.sothatsit.heads.cache.CacheHead;
|
|
||||||
import net.sothatsit.heads.config.oldmenu.Menu;
|
|
||||||
import net.sothatsit.heads.config.lang.Lang;
|
|
||||||
import net.sothatsit.heads.economy.Economy;
|
|
||||||
import net.sothatsit.heads.oldmenu.ConfirmMenu;
|
|
||||||
import net.sothatsit.heads.oldmenu.HeadMenu;
|
|
||||||
import net.sothatsit.heads.oldmenu.InventoryType;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||||
|
|
||||||
import java.util.List;
|
import net.sothatsit.heads.Heads;
|
||||||
|
import net.sothatsit.heads.cache.CacheHead;
|
||||||
|
import net.sothatsit.heads.config.lang.Lang;
|
||||||
|
import net.sothatsit.heads.config.oldmenu.Menu;
|
||||||
|
import net.sothatsit.heads.config.oldmenu.Menus;
|
||||||
|
import net.sothatsit.heads.oldmenu.ConfirmMenu;
|
||||||
|
import net.sothatsit.heads.oldmenu.HeadMenu;
|
||||||
|
import net.sothatsit.heads.oldmenu.InventoryType;
|
||||||
|
|
||||||
public class SearchMode extends BaseMode {
|
public class SearchMode extends BaseMode {
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
main: net.sothatsit.heads.Heads
|
main: net.sothatsit.heads.Heads
|
||||||
author: Marido
|
author: Marido
|
||||||
name: Heads
|
name: Heads
|
||||||
version: 2.0.2
|
version: 2.0.3
|
||||||
api-version: 1.13
|
api-version: 1.13
|
||||||
softdepend: [Vault, PlayerPoints, BlockStore]
|
softdepend: [Vault, PlayerPoints, BlockStore]
|
||||||
loadbefore: [DeluxeMenus]
|
loadbefore: [DeluxeMenus]
|
||||||
|
Loading…
Reference in New Issue
Block a user