Probably done with DiscordConnectedPlayer

This commit is contained in:
Norbi Peti 2017-07-07 02:22:44 +02:00
parent c746543042
commit 2aca1551ef
6 changed files with 1079 additions and 1906 deletions

View file

@ -5,7 +5,9 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.UUID; import java.util.UUID;
import java.util.function.BiFunction;
import java.util.function.Consumer; import java.util.function.Consumer;
import java.util.function.Supplier;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -127,7 +129,8 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
} }
public static final HashMap<String, DiscordSender> UnconnectedSenders = new HashMap<>(); public static final HashMap<String, DiscordSender> UnconnectedSenders = new HashMap<>();
public static final HashMap<String, DiscordPlayerSender> ConnectedSenders = new HashMap<>(); public static final HashMap<String, DiscordConnectedPlayer> ConnectedSenders = new HashMap<>();
public static final HashMap<String, DiscordPlayerSender> OnlineSenders = new HashMap<>();
public static short ListC = 0; public static short ListC = 0;
public static void resetLastMessage() { public static void resetLastMessage() {
@ -216,21 +219,28 @@ public class MCChatListener implements Listener, IListener<MessageReceivedEvent>
} }
} }
private DiscordSenderBase getSender(IChannel channel, final IUser author, DiscordPlayer dp) { @SuppressWarnings("unchecked")
private <T extends DiscordSenderBase> DiscordSenderBase getSender(IChannel channel, final IUser author,
DiscordPlayer dp) {
final DiscordSenderBase dsender; final DiscordSenderBase dsender;
Player mcp = null; // Offline players can't really run commands, or can they? No, they can't, really. final Player mcp;
final String cid; final String cid;
if ((cid = dp.getConnectedID(TBMCPlayer.class)) != null // Connected? BiFunction<HashMap<String, T>, Supplier<T>, DiscordSenderBase> getsender = (senders, maker) -> {
&& (mcp = Bukkit.getPlayer(UUID.fromString(cid))) != null) { // Execute as ingame player if (!senders.containsKey(author.getStringID()))
if (!ConnectedSenders.containsKey(author.getStringID())) senders.put(author.getStringID(), maker.get());
ConnectedSenders.put(author.getStringID(), new DiscordPlayerSender(author, channel, mcp)); return senders.get(author.getStringID());
dsender = ConnectedSenders.get(author.getStringID()); };
} else { if ((cid = dp.getConnectedID(TBMCPlayer.class)) != null) { // Connected?
if ((mcp = Bukkit.getPlayer(UUID.fromString(cid))) != null) // Online? - Execute as ingame player
dsender = getsender.apply((HashMap<String, T>) OnlineSenders,
() -> (T) new DiscordPlayerSender(author, channel, mcp));
else // Offline
dsender = getsender.apply((HashMap<String, T>) ConnectedSenders,
() -> (T) new DiscordConnectedPlayer(author, channel, UUID.fromString(cid)));
} else { // Not connected
TBMCPlayer p = dp.getAs(TBMCPlayer.class); TBMCPlayer p = dp.getAs(TBMCPlayer.class);
if (!UnconnectedSenders.containsKey(author.getStringID())) dsender = getsender.apply((HashMap<String, T>) UnconnectedSenders,
UnconnectedSenders.put(author.getStringID(), () -> (T) new DiscordSender(author, channel, p == null ? null : p.PlayerName().get())); // Display the playername, if found
new DiscordSender(author, channel, p == null ? null : p.PlayerName().get())); // Display the playername, if found
dsender = UnconnectedSenders.get(author.getStringID());
} }
return dsender; return dsender;
} }

View file

@ -0,0 +1,721 @@
package buttondevteam.discordplugin.playerfaker;
import java.net.InetSocketAddress;
import java.util.*;
import org.bukkit.*;
import org.bukkit.advancement.Advancement;
import org.bukkit.advancement.AdvancementProgress;
import org.bukkit.conversations.Conversation;
import org.bukkit.conversations.ConversationAbandonedEvent;
import org.bukkit.entity.*;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.map.MapView;
import org.bukkit.plugin.Plugin;
import org.bukkit.scoreboard.Scoreboard;
import buttondevteam.discordplugin.DiscordPlugin;
import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IUser;
public class DiscordFakePlayer extends DiscordHumanEntity implements Player {
protected DiscordFakePlayer(IUser user, IChannel channel, int entityId, UUID uuid) {
super(user, channel, entityId, uuid);
}
@Override
public String getName() {
return user.getName();
}
@Override
public EntityType getType() {
return EntityType.PLAYER;
}
@Override
public String getCustomName() {
return user.getName();
}
@Override
public void setCustomName(String name) {
}
@Override
public boolean isConversing() {
return false;
}
@Override
public void acceptConversationInput(String input) {
}
@Override
public boolean beginConversation(Conversation conversation) {
return false;
}
@Override
public void abandonConversation(Conversation conversation) {
}
@Override
public void abandonConversation(Conversation conversation, ConversationAbandonedEvent details) {
}
@Override
public boolean isOnline() {
return true;// Let's pretend
}
@Override
public boolean isBanned() {
return false;
}
@Override
public boolean isWhitelisted() {
return true;
}
@Override
public void setWhitelisted(boolean value) {
}
@Override
public Player getPlayer() {
return this;
}
@Override
public long getFirstPlayed() {
return 0;
}
@Override
public long getLastPlayed() {
return 0;
}
@Override
public boolean hasPlayedBefore() {
return false;
}
@Override
public Map<String, Object> serialize() {
return new HashMap<>();
}
@Override
public void sendPluginMessage(Plugin source, String channel, byte[] message) {
}
@Override
public Set<String> getListeningPluginChannels() {
return Collections.emptySet();
}
@Override
public String getDisplayName() {
return user.getNicknameForGuild(DiscordPlugin.mainServer);
}
@Override
public void setDisplayName(String name) {
}
@Override
public String getPlayerListName() {
return getName();
}
@Override
public void setPlayerListName(String name) {
}
@Override
public void setCompassTarget(Location loc) {
}
@Override
public Location getCompassTarget() {
return new Location(Bukkit.getWorlds().get(0), 0, 0, 0);
}
@Override
public InetSocketAddress getAddress() {
return null;
}
@Override
public void sendRawMessage(String message) {
sendMessage(message);
}
@Override
public void kickPlayer(String message) {
}
@Override
public void chat(String msg) {
Bukkit.getPluginManager()
.callEvent(new AsyncPlayerChatEvent(true, this, msg, new HashSet<>(Bukkit.getOnlinePlayers())));
}
@Override
public boolean performCommand(String command) {
return Bukkit.getServer().dispatchCommand(this, command);
}
@Override
public boolean isSneaking() {
return false;
}
@Override
public void setSneaking(boolean sneak) {
}
@Override
public boolean isSprinting() {
return false;
}
@Override
public void setSprinting(boolean sprinting) {
}
@Override
public void saveData() {
}
@Override
public void loadData() {
}
@Override
public void setSleepingIgnored(boolean isSleeping) {
}
@Override
public boolean isSleepingIgnored() {
return false;
}
@Override
public void playNote(Location loc, byte instrument, byte note) {
}
@Override
public void playNote(Location loc, Instrument instrument, Note note) {
}
@Override
public void playSound(Location location, Sound sound, float volume, float pitch) {
}
@Override
public void playSound(Location location, String sound, float volume, float pitch) {
}
@Override
public void playSound(Location location, Sound sound, SoundCategory category, float volume, float pitch) {
}
@Override
public void playSound(Location location, String sound, SoundCategory category, float volume, float pitch) {
}
@Override
public void stopSound(Sound sound) {
}
@Override
public void stopSound(String sound) {
}
@Override
public void stopSound(Sound sound, SoundCategory category) {
}
@Override
public void stopSound(String sound, SoundCategory category) {
}
@Override
public void playEffect(Location loc, Effect effect, int data) {
}
@Override
public <T> void playEffect(Location loc, Effect effect, T data) {
}
@Override
public void sendBlockChange(Location loc, Material material, byte data) {
}
@Override
public boolean sendChunkChange(Location loc, int sx, int sy, int sz, byte[] data) {
return false;
}
@Override
public void sendBlockChange(Location loc, int material, byte data) {
}
@Override
public void sendSignChange(Location loc, String[] lines) throws IllegalArgumentException {
}
@Override
public void sendMap(MapView map) {
}
@Override
public void updateInventory() {
}
@Override
public void awardAchievement(@SuppressWarnings("deprecation") Achievement achievement) {
}
@Override
public void removeAchievement(@SuppressWarnings("deprecation") Achievement achievement) {
}
@Override
public boolean hasAchievement(@SuppressWarnings("deprecation") Achievement achievement) {
return false;
}
@Override
public void incrementStatistic(Statistic statistic) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(Statistic statistic) throws IllegalArgumentException {
}
@Override
public void incrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(Statistic statistic, int amount) throws IllegalArgumentException {
}
@Override
public void setStatistic(Statistic statistic, int newValue) throws IllegalArgumentException {
}
@Override
public int getStatistic(Statistic statistic) throws IllegalArgumentException {
return 0;
}
@Override
public void incrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(Statistic statistic, Material material) throws IllegalArgumentException {
}
@Override
public int getStatistic(Statistic statistic, Material material) throws IllegalArgumentException {
return 0;
}
@Override
public void incrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(Statistic statistic, Material material, int amount) throws IllegalArgumentException {
}
@Override
public void setStatistic(Statistic statistic, Material material, int newValue) throws IllegalArgumentException {
}
@Override
public void incrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException {
}
@Override
public void decrementStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException {
}
@Override
public int getStatistic(Statistic statistic, EntityType entityType) throws IllegalArgumentException {
return 0;
}
@Override
public void incrementStatistic(Statistic statistic, EntityType entityType, int amount)
throws IllegalArgumentException {
}
@Override
public void decrementStatistic(Statistic statistic, EntityType entityType, int amount) {
}
@Override
public void setStatistic(Statistic statistic, EntityType entityType, int newValue) {
}
@Override
public void setPlayerTime(long time, boolean relative) {
}
@Override
public long getPlayerTime() {
return 0;
}
@Override
public long getPlayerTimeOffset() {
return 0;
}
@Override
public boolean isPlayerTimeRelative() {
return false;
}
@Override
public void resetPlayerTime() {
}
@Override
public void setPlayerWeather(WeatherType type) {
}
@Override
public WeatherType getPlayerWeather() {
return null;
}
@Override
public void resetPlayerWeather() {
}
@Override
public void giveExp(int amount) {
}
@Override
public void giveExpLevels(int amount) {
}
@Override
public float getExp() {
return 0;
}
@Override
public void setExp(float exp) {
}
@Override
public int getLevel() {
return 0;
}
@Override
public void setLevel(int level) {
}
@Override
public int getTotalExperience() {
return 0;
}
@Override
public void setTotalExperience(int exp) {
}
@Override
public float getExhaustion() {
return 0;
}
@Override
public void setExhaustion(float value) {
}
@Override
public float getSaturation() {
return 0;
}
@Override
public void setSaturation(float value) {
}
@Override
public int getFoodLevel() {
return 0;
}
@Override
public void setFoodLevel(int value) {
}
@Override
public Location getBedSpawnLocation() {
return null;
}
@Override
public void setBedSpawnLocation(Location location) {
}
@Override
public void setBedSpawnLocation(Location location, boolean force) {
}
@Override
public boolean getAllowFlight() {
return false;
}
@Override
public void setAllowFlight(boolean flight) {
}
@Override
public void hidePlayer(Player player) {
}
@Override
public void showPlayer(Player player) {
}
@Override
public boolean canSee(Player player) { // Nobody can see them
return false;
}
@Override
public boolean isFlying() {
return false;
}
@Override
public void setFlying(boolean value) {
}
@Override
public void setFlySpeed(float value) throws IllegalArgumentException {
}
@Override
public void setWalkSpeed(float value) throws IllegalArgumentException {
}
@Override
public float getFlySpeed() {
return 0;
}
@Override
public float getWalkSpeed() {
return 0;
}
@Override
public void setTexturePack(String url) {
}
@Override
public void setResourcePack(String url) {
}
@Override
public void setResourcePack(String url, byte[] hash) {
}
@Override
public Scoreboard getScoreboard() {
return null;
}
@Override
public void setScoreboard(Scoreboard scoreboard) throws IllegalArgumentException, IllegalStateException {
}
@Override
public boolean isHealthScaled() {
return false;
}
@Override
public void setHealthScaled(boolean scale) {
}
@Override
public void setHealthScale(double scale) throws IllegalArgumentException {
}
@Override
public double getHealthScale() {
return 1;
}
@Override
public Entity getSpectatorTarget() {
return null;
}
@Override
public void setSpectatorTarget(Entity entity) {
}
@Override
public void sendTitle(String title, String subtitle) {
}
@Override
public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut) {
}
@Override
public void resetTitle() {
}
@Override
public void spawnParticle(Particle particle, Location location, int count) {
}
@Override
public void spawnParticle(Particle particle, double x, double y, double z, int count) {
}
@Override
public <T> void spawnParticle(Particle particle, Location location, int count, T data) {
}
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, T data) {
}
@Override
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
double offsetZ) {
}
@Override
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
double offsetY, double offsetZ) {
}
@Override
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
double offsetZ, T data) {
}
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
double offsetY, double offsetZ, T data) {
}
@Override
public void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
double offsetZ, double extra) {
}
@Override
public void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
double offsetY, double offsetZ, double extra) {
}
@Override
public <T> void spawnParticle(Particle particle, Location location, int count, double offsetX, double offsetY,
double offsetZ, double extra, T data) {
}
@Override
public <T> void spawnParticle(Particle particle, double x, double y, double z, int count, double offsetX,
double offsetY, double offsetZ, double extra, T data) {
}
@Override
public AdvancementProgress getAdvancementProgress(Advancement advancement) { // TODO: Test
return null;
}
@Override
public String getLocale() {
return null;
}
@Override
public Player.Spigot spigot() {
return new Player.Spigot();
}
}

View file

@ -6,16 +6,10 @@ import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
import org.bukkit.entity.Villager; import org.bukkit.entity.Villager;
import org.bukkit.inventory.Inventory; import org.bukkit.inventory.*;
import org.bukkit.inventory.InventoryView;
import org.bukkit.inventory.InventoryView.Property; import org.bukkit.inventory.InventoryView.Property;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MainHand;
import org.bukkit.inventory.Merchant;
import org.bukkit.inventory.PlayerInventory;
import sx.blah.discord.handle.obj.IChannel; import sx.blah.discord.handle.obj.IChannel;
import sx.blah.discord.handle.obj.IUser; import sx.blah.discord.handle.obj.IUser;
@ -25,15 +19,18 @@ public abstract class DiscordHumanEntity extends DiscordLivingEntity implements
super(user, channel, entityId, uuid); super(user, channel, entityId, uuid);
} }
private PlayerInventory inv = new DiscordPlayerInventory(this);
@Override @Override
public PlayerInventory getInventory() { // TODO public PlayerInventory getInventory() {
return null; return inv;
} }
private Inventory enderchest = new DiscordInventory(this);
@Override @Override
public Inventory getEnderChest() { public Inventory getEnderChest() {
// TODO Auto-generated method stub return enderchest;
return null;
} }
@Override @Override
@ -47,159 +44,125 @@ public abstract class DiscordHumanEntity extends DiscordLivingEntity implements
} }
@Override @Override
public InventoryView getOpenInventory() { public InventoryView getOpenInventory() { // TODO: Test
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public InventoryView openInventory(Inventory inventory) { public InventoryView openInventory(Inventory inventory) {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public InventoryView openWorkbench(Location location, boolean force) { public InventoryView openWorkbench(Location location, boolean force) {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public InventoryView openEnchanting(Location location, boolean force) { public InventoryView openEnchanting(Location location, boolean force) {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void openInventory(InventoryView inventory) { public void openInventory(InventoryView inventory) {
// TODO Auto-generated method stub
} }
@Override @Override
public InventoryView openMerchant(Villager trader, boolean force) { public InventoryView openMerchant(Villager trader, boolean force) {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public InventoryView openMerchant(Merchant merchant, boolean force) { public InventoryView openMerchant(Merchant merchant, boolean force) {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void closeInventory() { public void closeInventory() {
// TODO Auto-generated method stub
} }
@Override @Override
public ItemStack getItemInHand() { public ItemStack getItemInHand() { // TODO: Test all ItemStack methods
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setItemInHand(ItemStack item) { public void setItemInHand(ItemStack item) {
// TODO Auto-generated method stub
} }
@Override @Override
public ItemStack getItemOnCursor() { public ItemStack getItemOnCursor() {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setItemOnCursor(ItemStack item) { public void setItemOnCursor(ItemStack item) {
// TODO Auto-generated method stub
} }
@Override @Override
public boolean hasCooldown(Material material) { public boolean hasCooldown(Material material) {
// TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public int getCooldown(Material material) { public int getCooldown(Material material) {
// TODO Auto-generated method stub
return 0; return 0;
} }
@Override @Override
public void setCooldown(Material material, int ticks) { public void setCooldown(Material material, int ticks) {
// TODO Auto-generated method stub
} }
@Override @Override
public boolean isSleeping() { public boolean isSleeping() {
// TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public int getSleepTicks() { public int getSleepTicks() {
// TODO Auto-generated method stub
return 0; return 0;
} }
@Override @Override
public GameMode getGameMode() { public GameMode getGameMode() {
// TODO Auto-generated method stub return GameMode.SPECTATOR;
return null;
} }
@Override @Override
public void setGameMode(GameMode mode) { public void setGameMode(GameMode mode) {
// TODO Auto-generated method stub
} }
@Override @Override
public boolean isBlocking() { public boolean isBlocking() {
// TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public boolean isHandRaised() { public boolean isHandRaised() {
// TODO Auto-generated method stub
return false; return false;
} }
@Override @Override
public int getExpToLevel() { public int getExpToLevel() {
// TODO Auto-generated method stub
return 0; return 0;
} }
@Override @Override
public Entity getShoulderEntityLeft() { public Entity getShoulderEntityLeft() {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setShoulderEntityLeft(Entity entity) { public void setShoulderEntityLeft(Entity entity) {
// TODO Auto-generated method stub
} }
@Override @Override
public Entity getShoulderEntityRight() { public Entity getShoulderEntityRight() {
// TODO Auto-generated method stub
return null; return null;
} }
@Override @Override
public void setShoulderEntityRight(Entity entity) { public void setShoulderEntityRight(Entity entity) {
// TODO Auto-generated method stub
} }
} }

View file

@ -0,0 +1,212 @@
package buttondevteam.discordplugin.playerfaker;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.HumanEntity;
import org.bukkit.event.inventory.InventoryType;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.ItemStack;
public class DiscordInventory implements Inventory {
public DiscordInventory(DiscordHumanEntity holder) {
this.holder = holder;
}
@Override
public int getSize() {
return 0;
}
@Override
public int getMaxStackSize() {
return 0;
}
@Override
public void setMaxStackSize(int size) {
}
@Override
public String getName() {
return "Player inventory";
}
@Override
public ItemStack getItem(int index) {
return null;
}
@Override
public HashMap<Integer, ItemStack> addItem(ItemStack... items) throws IllegalArgumentException { // Can't add anything
return new HashMap<>(
IntStream.range(0, items.length).mapToObj(i -> i).collect(Collectors.toMap(i -> i, i -> items[i])));
}
@Override
public HashMap<Integer, ItemStack> removeItem(ItemStack... items) throws IllegalArgumentException {
return new HashMap<>(
IntStream.range(0, items.length).mapToObj(i -> i).collect(Collectors.toMap(i -> i, i -> items[i])));
}
@Override
public ItemStack[] getContents() {
return new ItemStack[0];
}
@Override
public void setContents(ItemStack[] items) throws IllegalArgumentException {
if (items.length > 0)
throw new IllegalArgumentException("This inventory does not support items");
}
@Override
public ItemStack[] getStorageContents() {
return new ItemStack[0];
}
@Override
public void setStorageContents(ItemStack[] items) throws IllegalArgumentException {
if (items.length > 0)
throw new IllegalArgumentException("This inventory does not support items");
}
@Override
public boolean contains(int materialId) {
return false;
}
@Override
public boolean contains(Material material) throws IllegalArgumentException {
return false;
}
@Override
public boolean contains(ItemStack item) {
return false;
}
@Override
public boolean contains(int materialId, int amount) {
return false;
}
@Override
public boolean contains(Material material, int amount) throws IllegalArgumentException {
return false;
}
@Override
public boolean contains(ItemStack item, int amount) {
return false;
}
@Override
public boolean containsAtLeast(ItemStack item, int amount) {
return false;
}
@Override
public HashMap<Integer, ? extends ItemStack> all(int materialId) {
return new HashMap<>();
}
@Override
public HashMap<Integer, ? extends ItemStack> all(Material material) throws IllegalArgumentException {
return new HashMap<>();
}
@Override
public HashMap<Integer, ? extends ItemStack> all(ItemStack item) {
return new HashMap<>();
}
@Override
public int first(int materialId) {
return -1;
}
@Override
public int first(Material material) throws IllegalArgumentException {
return -1;
}
@Override
public int first(ItemStack item) {
return -1;
}
@Override
public int firstEmpty() {
return -1;
}
@Override
public void remove(int materialId) {
}
@Override
public void remove(Material material) throws IllegalArgumentException {
}
@Override
public void remove(ItemStack item) {
}
@Override
public void clear(int index) {
}
@Override
public void clear() {
}
@Override
public List<HumanEntity> getViewers() {
return new ArrayList<>(0);
}
@Override
public String getTitle() {
return "Player inventory";
}
@Override
public InventoryType getType() {
return InventoryType.PLAYER;
}
private ListIterator<ItemStack> iterator = new ArrayList<ItemStack>(0).listIterator();
@Override
public ListIterator<ItemStack> iterator() {
return iterator;
}
@Override
public ListIterator<ItemStack> iterator(int index) {
return iterator;
}
@Override
public Location getLocation() {
return holder.getLocation();
}
@Override
public void setItem(int index, ItemStack item) {
}
private HumanEntity holder;
@Override
public HumanEntity getHolder() {
return holder;
}
}

View file

@ -0,0 +1,105 @@
package buttondevteam.discordplugin.playerfaker;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
public class DiscordPlayerInventory extends DiscordInventory implements PlayerInventory {
public DiscordPlayerInventory(DiscordHumanEntity holder) {
super(holder);
}
@Override
public ItemStack[] getArmorContents() {
return new ItemStack[0];
}
@Override
public ItemStack[] getExtraContents() {
return new ItemStack[0];
}
@Override
public ItemStack getHelmet() {
return null;
}
@Override
public ItemStack getChestplate() {
return null;
}
@Override
public ItemStack getLeggings() {
return null;
}
@Override
public ItemStack getBoots() {
return null;
}
@Override
public void setArmorContents(ItemStack[] items) {
}
@Override
public void setExtraContents(ItemStack[] items) {
}
@Override
public void setHelmet(ItemStack helmet) {
}
@Override
public void setChestplate(ItemStack chestplate) {
}
@Override
public void setLeggings(ItemStack leggings) {
}
@Override
public void setBoots(ItemStack boots) {
}
@Override
public ItemStack getItemInMainHand() {
return null;
}
@Override
public void setItemInMainHand(ItemStack item) {
}
@Override
public ItemStack getItemInOffHand() {
return null;
}
@Override
public void setItemInOffHand(ItemStack item) {
}
@Override
public ItemStack getItemInHand() {
return null;
}
@Override
public void setItemInHand(ItemStack stack) {
}
@Override
public int getHeldItemSlot() {
return 0;
}
@Override
public void setHeldItemSlot(int slot) {
}
@Override
public int clear(int id, int data) {
return 0;
}
}