How to use PlayerSpigotMock method of be.seeseemelk.mockbukkit.entity.PlayerMock class

Best MockBukkit code snippet using be.seeseemelk.mockbukkit.entity.PlayerMock.PlayerSpigotMock

Source:PlayerMock.java Github

copy

Full Screen

...112 private Location bedSpawnLocation;113 private ItemStack cursor = null;114 private long firstPlayed = 0;115 private long lastPlayed = 0;116 private final PlayerSpigotMock playerSpigotMock = new PlayerSpigotMock();117 private final List<AudioExperience> heardSounds = new LinkedList<>();118 private final Map<UUID, Set<Plugin>> hiddenPlayers = new HashMap<>();119 private final Set<UUID> hiddenPlayersDeprecated = new HashSet<>();120 private final StatisticsMock statistics = new StatisticsMock();121 public PlayerMock(ServerMock server, String name)122 {123 this(server, name, UUID.nameUUIDFromBytes(("OfflinePlayer:" + name).getBytes(StandardCharsets.UTF_8)));124 this.online = false;125 }126 public PlayerMock(ServerMock server, String name, UUID uuid)127 {128 super(server, uuid);129 setName(name);130 setDisplayName(name);131 this.online = true;132 if (Bukkit.getWorlds().isEmpty())133 {134 MockBukkit.getMock().addSimpleWorld("world");135 }136 setLocation(Bukkit.getWorlds().get(0).getSpawnLocation().clone());137 setCompassTarget(getLocation());138 closeInventory();139 }140 @Override141 public @NotNull EntityType getType()142 {143 return EntityType.PLAYER;144 }145 /**146 * Assert that the player is in a specific gamemode.147 *148 * @param expectedGamemode The gamemode the player should be in.149 */150 public void assertGameMode(GameMode expectedGamemode)151 {152 assertEquals(expectedGamemode, gamemode);153 }154 /**155 * Simulates the player damaging a block just like {@link #simulateBlockDamage(Block)}. However, if156 * {@code InstaBreak} is enabled, it will not automatically fire a {@link BlockBreakEvent}. It will also still fire157 * a {@link BlockDamageEvent} even if the player is not in survival mode.158 *159 * @param block The block to damage.160 * @return The event that has been fired.161 */162 protected BlockDamageEvent simulateBlockDamagePure(Block block)163 {164 BlockDamageEvent event = new BlockDamageEvent(this, block, getItemInHand(), false);165 Bukkit.getPluginManager().callEvent(event);166 return event;167 }168 /**169 * Simulates the player damaging a block. Note that this method does not anything unless the player is in survival170 * mode. If {@code InstaBreak} is set to true by an event handler, a {@link BlockBreakEvent} is immediately fired.171 * The result will then still be whether or not the {@link BlockDamageEvent} was cancelled or not, not the later172 * {@link BlockBreakEvent}.173 *174 * @param block The block to damage.175 * @return the event that was fired, {@code null} if the player was not in176 * survival gamemode.177 */178 public @Nullable BlockDamageEvent simulateBlockDamage(Block block)179 {180 if (gamemode == GameMode.SURVIVAL)181 {182 BlockDamageEvent event = simulateBlockDamagePure(block);183 if (event.getInstaBreak())184 {185 BlockBreakEvent breakEvent = new BlockBreakEvent(block, this);186 Bukkit.getPluginManager().callEvent(breakEvent);187 if (!breakEvent.isCancelled())188 block.setType(Material.AIR);189 }190 return event;191 }192 else193 {194 return null;195 }196 }197 /**198 * Simulates the player breaking a block. This method will not break the block if the player is in adventure or199 * spectator mode. If the player is in survival mode, the player will first damage the block.200 *201 * @param block The block to break.202 * @return The event that was fired, {@code null} if it wasn't or if the player was in adventure mode203 * or in spectator mode.204 */205 public @Nullable BlockBreakEvent simulateBlockBreak(Block block)206 {207 if ((gamemode == GameMode.SPECTATOR || gamemode == GameMode.ADVENTURE)208 || (gamemode == GameMode.SURVIVAL && simulateBlockDamagePure(block).isCancelled()))209 return null;210 BlockBreakEvent event = new BlockBreakEvent(block, this);211 Bukkit.getPluginManager().callEvent(event);212 if (!event.isCancelled())213 block.setType(Material.AIR);214 return event;215 }216 /**217 * Simulates the player placing a block. This method will not place the block if the player is in adventure or218 * spectator mode.219 *220 * @param material The material of the location to set to221 * @param location The location of the material to set to222 * @return The event that was fired. {@code null} if it wasn't or the player was in adventure223 * mode.224 */225 public @Nullable BlockPlaceEvent simulateBlockPlace(Material material, Location location)226 {227 if (gamemode == GameMode.ADVENTURE || gamemode == GameMode.SPECTATOR)228 return null;229 Block block = location.getBlock();230 BlockPlaceEvent event = new BlockPlaceEvent(block, null, null, null, this, true, null);231 Bukkit.getPluginManager().callEvent(event);232 if (!event.isCancelled())233 block.setType(material);234 return event;235 }236 /**237 * This method simulates the {@link Player} respawning and also calls a {@link PlayerRespawnEvent}. Should the238 * {@link Player} not be dead (when {@link #isDead()} returns false) then this will throw an239 * {@link UnsupportedOperationException}. Otherwise, the {@link Location} will be set to240 * {@link Player#getBedSpawnLocation()} or {@link World#getSpawnLocation()}. Lastly the health of this241 * {@link Player} will be restored and set to the max health.242 */243 public void respawn()244 {245 Location respawnLocation = getBedSpawnLocation();246 boolean isBedSpawn = respawnLocation != null;247 // TODO: Respawn Anchors are not yet supported.248 boolean isAnchorSpawn = false;249 if (!isBedSpawn)250 {251 respawnLocation = getLocation().getWorld().getSpawnLocation();252 }253 PlayerRespawnEvent event = new PlayerRespawnEvent(this, respawnLocation, isBedSpawn, isAnchorSpawn);254 Bukkit.getPluginManager().callEvent(event);255 // Reset location and health256 setHealth(getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());257 setLocation(event.getRespawnLocation().clone());258 alive = true;259 }260 /**261 * This method moves player instantly with respect to PlayerMoveEvent262 *263 * @param moveLocation Location to move player to264 * @return The event that is fired265 */266 public @NotNull PlayerMoveEvent simulatePlayerMove(@NotNull Location moveLocation)267 {268 PlayerMoveEvent event = new PlayerMoveEvent(this, this.getLocation(), moveLocation);269 this.setLocation(event.getTo());270 Bukkit.getPluginManager().callEvent(event);271 if (event.isCancelled())272 this.setLocation(event.getFrom());273 return event;274 }275 @Override276 public @NotNull PlayerInventory getInventory()277 {278 if (inventory == null)279 {280 inventory = (PlayerInventoryMock) Bukkit.createInventory(this, InventoryType.PLAYER);281 }282 return inventory;283 }284 @Override285 public @NotNull GameMode getGameMode()286 {287 return gamemode;288 }289 @Override290 public void setGameMode(@NotNull GameMode mode)291 {292 gamemode = mode;293 }294 @Override295 public boolean isWhitelisted()296 {297 return this.whitelisted;298 }299 @Override300 public void setWhitelisted(boolean value)301 {302 this.whitelisted = value;303 }304 @Override305 public Player getPlayer()306 {307 if (online)308 {309 return this;310 }311 return null;312 }313 @Override314 public boolean isOnline()315 {316 return this.online;317 }318 @Override319 public boolean isBanned()320 {321 return MockBukkit.getMock().getBanList(BanList.Type.NAME).isBanned(getName());322 }323 @Override324 public @NotNull InventoryView getOpenInventory()325 {326 return inventoryView;327 }328 @Override329 public void openInventory(@NotNull InventoryView inventory)330 {331 closeInventory();332 inventoryView = inventory;333 }334 @Override335 public InventoryView openInventory(@NotNull Inventory inventory)336 {337 closeInventory();338 inventoryView = new PlayerInventoryViewMock(this, inventory);339 return inventoryView;340 }341 @Override342 public void closeInventory()343 {344 if (inventoryView instanceof PlayerInventoryViewMock)345 {346 InventoryCloseEvent event = new InventoryCloseEvent(inventoryView);347 Bukkit.getPluginManager().callEvent(event);348 }349 // reset the cursor as it is a new InventoryView350 cursor = null;351 inventoryView = new SimpleInventoryViewMock(this, null, inventory, InventoryType.CRAFTING);352 }353 /**354 * This method is an assertion for the currently open {@link InventoryView} for this {@link Player}. The355 * {@link Predicate} refers to the top inventory, not the {@link PlayerInventory}. It uses the method356 * {@link InventoryView#getTopInventory()}.357 *358 * @param message The message to display upon failure359 * @param type The {@link InventoryType} you are expecting360 * @param predicate A custom {@link Predicate} to check the opened {@link Inventory}.361 */362 public void assertInventoryView(String message, InventoryType type, Predicate<Inventory> predicate)363 {364 InventoryView view = getOpenInventory();365 if (view.getType() == type && predicate.test(view.getTopInventory()))366 {367 return;368 }369 fail(message);370 }371 /**372 * This method is an assertion for the currently open {@link InventoryView} for this {@link Player}. The373 * {@link Predicate} refers to the top inventory, not the {@link PlayerInventory}. It uses the method374 * {@link InventoryView#getTopInventory()}.375 *376 * @param type The {@link InventoryType} you are expecting377 * @param predicate A custom {@link Predicate} to check the opened {@link Inventory}.378 */379 public void assertInventoryView(InventoryType type, Predicate<Inventory> predicate)380 {381 assertInventoryView("The InventoryView Assertion has failed", type, predicate);382 }383 /**384 * This method is an assertion for the currently open {@link InventoryView} for this {@link Player}.385 *386 * @param type The {@link InventoryType} you are expecting387 */388 public void assertInventoryView(InventoryType type)389 {390 assertInventoryView("The InventoryView Assertion has failed", type, inv -> true);391 }392 /**393 * This method is an assertion for the currently open {@link InventoryView} for this {@link Player}.394 *395 * @param message The message to display upon failure396 * @param type The {@link InventoryType} you are expecting397 */398 public void assertInventoryView(String message, InventoryType type)399 {400 assertInventoryView(message, type, inv -> true);401 }402 @Override403 public boolean performCommand(@NotNull String command)404 {405 return Bukkit.dispatchCommand(this, command);406 }407 @Override408 public @NotNull Inventory getEnderChest()409 {410 if (enderChest == null)411 {412 enderChest = new EnderChestInventoryMock(this);413 }414 return enderChest;415 }416 @Override417 public @NotNull MainHand getMainHand()418 {419 // TODO Auto-generated method stub420 throw new UnimplementedOperationException();421 }422 @Override423 public boolean setWindowProperty(@NotNull Property prop, int value)424 {425 // TODO Auto-generated method stub426 throw new UnimplementedOperationException();427 }428 @Override429 public InventoryView openWorkbench(Location location, boolean force)430 {431 // TODO Auto-generated method stub432 throw new UnimplementedOperationException();433 }434 @Override435 public InventoryView openEnchanting(Location location, boolean force)436 {437 // TODO Auto-generated method stub438 throw new UnimplementedOperationException();439 }440 @Override441 public InventoryView openMerchant(@NotNull Villager trader, boolean force)442 {443 return openMerchant((Merchant) trader, force);444 }445 @Override446 public InventoryView openMerchant(@NotNull Merchant merchant, boolean force)447 {448 // TODO Auto-generated method stub449 throw new UnimplementedOperationException();450 }451 @Override452 public @NotNull ItemStack getItemInHand()453 {454 return getInventory().getItemInMainHand();455 }456 @Override457 public void setItemInHand(ItemStack item)458 {459 getInventory().setItemInMainHand(item);460 }461 @Override462 public @NotNull ItemStack getItemOnCursor()463 {464 return cursor == null ? new ItemStack(Material.AIR, 0) : cursor.clone();465 }466 @Override467 public void setItemOnCursor(ItemStack item)468 {469 this.cursor = item == null ? null : item.clone();470 }471 @Override472 public boolean hasCooldown(@NotNull Material material)473 {474 // TODO Auto-generated method stub475 throw new UnimplementedOperationException();476 }477 @Override478 public int getCooldown(@NotNull Material material)479 {480 // TODO Auto-generated method stub481 throw new UnimplementedOperationException();482 }483 @Override484 public void setCooldown(@NotNull Material material, int ticks)485 {486 // TODO Auto-generated method stub487 throw new UnimplementedOperationException();488 }489 @Override490 public boolean isSleeping()491 {492 // TODO Auto-generated method stub493 throw new UnimplementedOperationException();494 }495 @Override496 public int getSleepTicks()497 {498 // TODO Auto-generated method stub499 throw new UnimplementedOperationException();500 }501 @Override502 public boolean isBlocking()503 {504 // TODO Auto-generated method stub505 throw new UnimplementedOperationException();506 }507 @Override508 public boolean isHandRaised()509 {510 // TODO Auto-generated method stub511 throw new UnimplementedOperationException();512 }513 @Override514 public int getExpToLevel()515 {516 // Formula from https://minecraft.gamepedia.com/Experience#Leveling_up517 if (this.expLevel >= 31)518 return (9 * this.expLevel) - 158;519 if (this.expLevel >= 16)520 return (5 * this.expLevel) - 38;521 return (2 * this.expLevel) + 7;522 }523 @Override524 public Entity getShoulderEntityLeft()525 {526 // TODO Auto-generated method stub527 throw new UnimplementedOperationException();528 }529 @Override530 public void setShoulderEntityLeft(Entity entity)531 {532 // TODO Auto-generated method stub533 throw new UnimplementedOperationException();534 }535 @Override536 public Entity getShoulderEntityRight()537 {538 // TODO Auto-generated method stub539 throw new UnimplementedOperationException();540 }541 @Override542 public void setShoulderEntityRight(Entity entity)543 {544 // TODO Auto-generated method stub545 throw new UnimplementedOperationException();546 }547 @Override548 public double getEyeHeight()549 {550 return getEyeHeight(false);551 }552 @Override553 public double getEyeHeight(boolean ignorePose)554 {555 if (isSneaking() && !ignorePose)556 return 1.54D;557 return 1.62D;558 }559 @Override560 public @NotNull List<Block> getLineOfSight(Set<Material> transparent, int maxDistance)561 {562 // TODO Auto-generated method stub563 throw new UnimplementedOperationException();564 }565 @Override566 public @NotNull Block getTargetBlock(Set<Material> transparent, int maxDistance)567 {568 // TODO Auto-generated method stub569 throw new UnimplementedOperationException();570 }571 @Override572 public @NotNull List<Block> getLastTwoTargetBlocks(Set<Material> transparent, int maxDistance)573 {574 // TODO Auto-generated method stub575 throw new UnimplementedOperationException();576 }577 @Override578 public int getMaximumNoDamageTicks()579 {580 // TODO Auto-generated method stub581 throw new UnimplementedOperationException();582 }583 @Override584 public void setMaximumNoDamageTicks(int ticks)585 {586 // TODO Auto-generated method stub587 throw new UnimplementedOperationException();588 }589 @Override590 public double getLastDamage()591 {592 // TODO Auto-generated method stub593 throw new UnimplementedOperationException();594 }595 @Override596 public void setLastDamage(double damage)597 {598 // TODO Auto-generated method stub599 throw new UnimplementedOperationException();600 }601 @Override602 public int getNoDamageTicks()603 {604 // TODO Auto-generated method stub605 throw new UnimplementedOperationException();606 }607 @Override608 public void setNoDamageTicks(int ticks)609 {610 // TODO Auto-generated method stub611 throw new UnimplementedOperationException();612 }613 @Override614 public Player getKiller()615 {616 // TODO Auto-generated method stub617 throw new UnimplementedOperationException();618 }619 @Override620 public boolean hasLineOfSight(@NotNull Entity other)621 {622 // TODO Auto-generated method stub623 throw new UnimplementedOperationException();624 }625 @Override626 public boolean getRemoveWhenFarAway()627 {628 // Players are never despawned until they log off629 return false;630 }631 @Override632 public void setRemoveWhenFarAway(boolean remove)633 {634 // Don't do anything635 }636 @Override637 public EntityEquipment getEquipment()638 {639 // TODO Auto-generated method stub640 throw new UnimplementedOperationException();641 }642 @Override643 public void setCanPickupItems(boolean pickup)644 {645 // TODO Auto-generated method stub646 throw new UnimplementedOperationException();647 }648 @Override649 public boolean getCanPickupItems()650 {651 // TODO Auto-generated method stub652 throw new UnimplementedOperationException();653 }654 @Override655 public boolean isLeashed()656 {657 // Players can not be leashed658 return false;659 }660 @Override661 public @NotNull Entity getLeashHolder()662 {663 throw new IllegalStateException("Players cannot be leashed");664 }665 @Override666 public boolean setLeashHolder(Entity holder)667 {668 // Players can not be leashed669 return false;670 }671 @Override672 public boolean isGliding()673 {674 // TODO Auto-generated method stub675 throw new UnimplementedOperationException();676 }677 @Override678 public void setGliding(boolean gliding)679 {680 // TODO Auto-generated method stub681 throw new UnimplementedOperationException();682 }683 @Override684 public void setAI(boolean ai)685 {686 // I am sorry Dave, I'm afraid I can't do that687 }688 @Override689 public boolean hasAI()690 {691 // The Player's intelligence is (probably) not artificial692 return false;693 }694 @Override695 public void setCollidable(boolean collidable)696 {697 // TODO Auto-generated method stub698 throw new UnimplementedOperationException();699 }700 @Override701 public boolean isCollidable()702 {703 // TODO Auto-generated method stub704 throw new UnimplementedOperationException();705 }706 @Override707 public boolean isConversing()708 {709 // TODO Auto-generated method stub710 throw new UnimplementedOperationException();711 }712 @Override713 public void acceptConversationInput(@NotNull String input)714 {715 // TODO Auto-generated method stub716 throw new UnimplementedOperationException();717 }718 @Override719 public boolean beginConversation(@NotNull Conversation conversation)720 {721 // TODO Auto-generated method stub722 throw new UnimplementedOperationException();723 }724 @Override725 public void abandonConversation(@NotNull Conversation conversation)726 {727 // TODO Auto-generated method stub728 throw new UnimplementedOperationException();729 }730 @Override731 public void abandonConversation(@NotNull Conversation conversation, @NotNull ConversationAbandonedEvent details)732 {733 // TODO Auto-generated method stub734 throw new UnimplementedOperationException();735 }736 @Override737 public long getFirstPlayed()738 {739 return firstPlayed;740 }741 @Override742 public long getLastPlayed()743 {744 return lastPlayed;745 }746 @Override747 public boolean hasPlayedBefore()748 {749 return firstPlayed > 0;750 }751 public void setLastPlayed(long time)752 {753 if (time > 0)754 {755 lastPlayed = time;756 // Set firstPlayed if this is the first time757 if (firstPlayed == 0)758 {759 firstPlayed = time;760 }761 }762 }763 @Override764 public @NotNull Map<String, Object> serialize()765 {766 // TODO Auto-generated method stub767 throw new UnimplementedOperationException();768 }769 @Override770 public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, byte[] message)771 {772 // TODO Auto-generated method stub773 throw new UnimplementedOperationException();774 }775 @Override776 public @NotNull Set<String> getListeningPluginChannels()777 {778 // TODO Auto-generated method stub779 throw new UnimplementedOperationException();780 }781 @Override782 public @NotNull String getDisplayName()783 {784 return displayName;785 }786 @Override787 public void setDisplayName(String name)788 {789 this.displayName = name;790 }791 @Override792 public @NotNull String getPlayerListName()793 {794 return this.playerListName == null ? getName() : this.playerListName;795 }796 @Override797 public void setPlayerListName(String name)798 {799 this.playerListName = name;800 }801 @Override802 public void setCompassTarget(@NotNull Location loc)803 {804 this.compassTarget = loc;805 }806 @NotNull807 @Override808 public Location getCompassTarget()809 {810 return this.compassTarget;811 }812 @Override813 public InetSocketAddress getAddress()814 {815 // TODO Auto-generated method stub816 throw new UnimplementedOperationException();817 }818 @Override819 public void sendRawMessage(@Nullable String message)820 {821 // TODO Auto-generated method stub822 throw new UnimplementedOperationException();823 }824 @Override825 public void sendRawMessage(@Nullable UUID sender, @NotNull String message)826 {827 // TODO Auto-generated method stub828 throw new UnimplementedOperationException();829 }830 @Override831 public void kickPlayer(String message)832 {833 // TODO Auto-generated method stub834 throw new UnimplementedOperationException();835 }836 @Override837 @SuppressWarnings("deprecation")838 public void chat(@NotNull String msg)839 {840 Set<Player> players = new HashSet<>(Bukkit.getOnlinePlayers());841 AsyncPlayerChatEvent asyncEvent = new AsyncPlayerChatEvent(true, this, msg, players);842 org.bukkit.event.player.PlayerChatEvent syncEvent = new org.bukkit.event.player.PlayerChatEvent(this, msg);843 ServerMock server = MockBukkit.getMock();844 server.getScheduler().executeAsyncEvent(asyncEvent);845 server.getPluginManager().callEvent(syncEvent);846 }847 @Override848 public boolean isSneaking()849 {850 return sneaking;851 }852 @Override853 public void setSneaking(boolean sneaking)854 {855 this.sneaking = sneaking;856 }857 public @NotNull PlayerToggleSneakEvent simulateSneak(boolean sneak)858 {859 PlayerToggleSneakEvent event = new PlayerToggleSneakEvent(this, sneak);860 Bukkit.getPluginManager().callEvent(event);861 if (!event.isCancelled())862 {863 this.sneaking = event.isSneaking();864 }865 return event;866 }867 @Override868 public boolean isSprinting()869 {870 return sprinting;871 }872 @Override873 public void setSprinting(boolean sprinting)874 {875 this.sprinting = sprinting;876 }877 public @NotNull PlayerToggleSprintEvent simulateSprint(boolean sprint)878 {879 PlayerToggleSprintEvent event = new PlayerToggleSprintEvent(this, sprint);880 Bukkit.getPluginManager().callEvent(event);881 if (!event.isCancelled())882 {883 this.sprinting = event.isSprinting();884 }885 return event;886 }887 @Override888 public void saveData()889 {890 // TODO Auto-generated method stub891 throw new UnimplementedOperationException();892 }893 @Override894 public void loadData()895 {896 // TODO Auto-generated method stub897 throw new UnimplementedOperationException();898 }899 @Override900 public void setSleepingIgnored(boolean isSleeping)901 {902 // TODO Auto-generated method stub903 throw new UnimplementedOperationException();904 }905 @Override906 public boolean isSleepingIgnored()907 {908 // TODO Auto-generated method stub909 throw new UnimplementedOperationException();910 }911 @Override912 @Deprecated913 public void playNote(@NotNull Location loc, byte instrument, byte note)914 {915 // TODO Auto-generated method stub916 throw new UnimplementedOperationException();917 }918 @Override919 public void playNote(@NotNull Location loc, @NotNull Instrument instrument, @NotNull Note note)920 {921 // TODO Auto-generated method stub922 throw new UnimplementedOperationException();923 }924 @Override925 public void playSound(@NotNull Location location, @NotNull String sound, float volume, float pitch)926 {927 heardSounds.add(new AudioExperience(sound, SoundCategory.MASTER, location, volume, pitch));928 }929 @Override930 public void playSound(@NotNull Location location, @NotNull Sound sound, float volume, float pitch)931 {932 playSound(location, sound, SoundCategory.MASTER, volume, pitch);933 }934 @Override935 public void playSound(@NotNull Location location, @NotNull String sound, @NotNull SoundCategory category, float volume, float pitch)936 {937 heardSounds.add(new AudioExperience(sound, category, location, volume, pitch));938 }939 @Override940 public void playSound(@NotNull Location location, @NotNull Sound sound, @NotNull SoundCategory category, float volume, float pitch)941 {942 heardSounds.add(new AudioExperience(sound, category, location, volume, pitch));943 }944 @Override945 public @NotNull List<AudioExperience> getHeardSounds()946 {947 return heardSounds;948 }949 @Override950 public void stopSound(@NotNull Sound sound)951 {952 stopSound(sound, SoundCategory.MASTER);953 }954 @Override955 public void stopSound(@NotNull String sound)956 {957 stopSound(sound, SoundCategory.MASTER);958 }959 @Override960 public void stopSound(@NotNull Sound sound, SoundCategory category)961 {962 // We will just pretend the Sound has stopped.963 }964 @Override965 public void stopSound(@NotNull String sound, SoundCategory category)966 {967 // We will just pretend the Sound has stopped.968 }969 @Override970 public void playEffect(@NotNull Location loc, @NotNull Effect effect, int data)971 {972 // TODO Auto-generated method stub973 throw new UnimplementedOperationException();974 }975 @Override976 public <T> void playEffect(@NotNull Location loc, @NotNull Effect effect, T data)977 {978 // TODO Auto-generated method stub979 throw new UnimplementedOperationException();980 }981 @Override982 public void sendBlockChange(@NotNull Location loc, @NotNull Material material, byte data)983 {984 // TODO Auto-generated method stub985 throw new UnimplementedOperationException();986 }987 @Override988 public boolean sendChunkChange(@NotNull Location loc, int sx, int sy, int sz, byte[] data)989 {990 // TODO Auto-generated method stub991 throw new UnimplementedOperationException();992 }993 @Override994 public void sendSignChange(@NotNull Location loc, String[] lines)995 {996 // TODO Auto-generated method stub997 throw new UnimplementedOperationException();998 }999 @Override1000 public void sendMap(@NotNull MapView map)1001 {1002 // TODO Auto-generated method stub1003 throw new UnimplementedOperationException();1004 }1005 @Override1006 public void updateInventory()1007 {1008 // TODO Auto-generated method stub1009 throw new UnimplementedOperationException();1010 }1011 @Override1012 public void incrementStatistic(@NotNull Statistic statistic)1013 {1014 statistics.incrementStatistic(statistic, 1);1015 }1016 @Override1017 public void decrementStatistic(@NotNull Statistic statistic)1018 {1019 statistics.decrementStatistic(statistic, 1);1020 }1021 @Override1022 public void incrementStatistic(@NotNull Statistic statistic, int amount)1023 {1024 statistics.incrementStatistic(statistic, amount);1025 }1026 @Override1027 public void decrementStatistic(@NotNull Statistic statistic, int amount)1028 {1029 statistics.decrementStatistic(statistic, amount);1030 }1031 @Override1032 public void setStatistic(@NotNull Statistic statistic, int newValue)1033 {1034 statistics.setStatistic(statistic, newValue);1035 }1036 @Override1037 public int getStatistic(@NotNull Statistic statistic)1038 {1039 return statistics.getStatistic(statistic);1040 }1041 @Override1042 public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material)1043 {1044 statistics.incrementStatistic(statistic, material, 1);1045 }1046 @Override1047 public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material)1048 {1049 statistics.decrementStatistic(statistic, material, 1);1050 }1051 @Override1052 public int getStatistic(@NotNull Statistic statistic, @NotNull Material material)1053 {1054 return statistics.getStatistic(statistic, material);1055 }1056 @Override1057 public void incrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)1058 {1059 statistics.incrementStatistic(statistic, material, amount);1060 }1061 @Override1062 public void decrementStatistic(@NotNull Statistic statistic, @NotNull Material material, int amount)1063 {1064 statistics.decrementStatistic(statistic, material, amount);1065 }1066 @Override1067 public void setStatistic(@NotNull Statistic statistic, @NotNull Material material, int newValue)1068 {1069 statistics.setStatistic(statistic, material, newValue);1070 }1071 @Override1072 public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType)1073 {1074 statistics.incrementStatistic(statistic, entityType, 1);1075 }1076 @Override1077 public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType)1078 {1079 statistics.decrementStatistic(statistic, entityType, 1);1080 }1081 @Override1082 public int getStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType)1083 {1084 return statistics.getStatistic(statistic, entityType);1085 }1086 @Override1087 public void incrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount)1088 {1089 statistics.incrementStatistic(statistic, entityType, amount);1090 }1091 @Override1092 public void decrementStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int amount)1093 {1094 statistics.decrementStatistic(statistic, entityType, amount);1095 }1096 @Override1097 public void setStatistic(@NotNull Statistic statistic, @NotNull EntityType entityType, int newValue)1098 {1099 statistics.setStatistic(statistic, entityType, newValue);1100 }1101 @Override1102 public void setPlayerTime(long time, boolean relative)1103 {1104 // TODO Auto-generated method stub1105 throw new UnimplementedOperationException();1106 }1107 @Override1108 public long getPlayerTime()1109 {1110 // TODO Auto-generated method stub1111 throw new UnimplementedOperationException();1112 }1113 @Override1114 public long getPlayerTimeOffset()1115 {1116 // TODO Auto-generated method stub1117 throw new UnimplementedOperationException();1118 }1119 @Override1120 public boolean isPlayerTimeRelative()1121 {1122 // TODO Auto-generated method stub1123 throw new UnimplementedOperationException();1124 }1125 @Override1126 public void resetPlayerTime()1127 {1128 // TODO Auto-generated method stub1129 throw new UnimplementedOperationException();1130 }1131 @Override1132 public void setPlayerWeather(@NotNull WeatherType type)1133 {1134 // TODO Auto-generated method stub1135 throw new UnimplementedOperationException();1136 }1137 @Override1138 public WeatherType getPlayerWeather()1139 {1140 // TODO Auto-generated method stub1141 throw new UnimplementedOperationException();1142 }1143 @Override1144 public void resetPlayerWeather()1145 {1146 // TODO Auto-generated method stub1147 throw new UnimplementedOperationException();1148 }1149 @Override1150 public void giveExp(int amount)1151 {1152 this.exp += (float) amount / (float) this.getExpToLevel();1153 setTotalExperience(this.expTotal + amount);1154 while (this.exp < 0.0F)1155 {1156 float total = this.exp * this.getExpToLevel();1157 boolean shouldContinue = this.expLevel > 0;1158 this.giveExpLevels(-1);1159 if (shouldContinue)1160 this.exp = 1.0F + (total / this.getExpToLevel());1161 }1162 while (this.exp >= 1.0F)1163 {1164 this.exp = (this.exp - 1.0F) * this.getExpToLevel();1165 this.giveExpLevels(1);1166 this.exp /= this.getExpToLevel();1167 }1168 }1169 @Override1170 public void giveExpLevels(int amount)1171 {1172 int oldLevel = this.expLevel;1173 this.expLevel += amount;1174 if (this.expLevel < 0)1175 {1176 this.expLevel = 0;1177 this.exp = 0.0F;1178 }1179 if (oldLevel != this.expLevel)1180 {1181 PlayerLevelChangeEvent event = new PlayerLevelChangeEvent(this, oldLevel, this.expLevel);1182 Bukkit.getPluginManager().callEvent(event);1183 }1184 }1185 @Override1186 public float getExp()1187 {1188 return exp;1189 }1190 @Override1191 public void setExp(float exp)1192 {1193 if (exp < 0.0 || exp > 1.0)1194 throw new IllegalArgumentException("Experience progress must be between 0.0 and 1.0");1195 this.exp = exp;1196 }1197 @Override1198 public int getLevel()1199 {1200 return expLevel;1201 }1202 @Override1203 public void setLevel(int level)1204 {1205 this.expLevel = level;1206 }1207 @Override1208 public int getTotalExperience()1209 {1210 return expTotal;1211 }1212 @Override1213 public void setTotalExperience(int exp)1214 {1215 this.expTotal = Math.max(0, exp);1216 }1217 @Override1218 public float getExhaustion()1219 {1220 // TODO Auto-generated method stub1221 throw new UnimplementedOperationException();1222 }1223 @Override1224 public void setExhaustion(float value)1225 {1226 // TODO Auto-generated method stub1227 throw new UnimplementedOperationException();1228 }1229 @Override1230 public float getSaturation()1231 {1232 return saturation;1233 }1234 @Override1235 public void setSaturation(float value)1236 {1237 // Saturation is constrained by the current food level1238 this.saturation = Math.min(getFoodLevel(), value);1239 }1240 @Override1241 public int getFoodLevel()1242 {1243 return foodLevel;1244 }1245 @Override1246 public void setFoodLevel(int foodLevel)1247 {1248 this.foodLevel = foodLevel;1249 }1250 @Nullable1251 @Override1252 public Location getBedSpawnLocation()1253 {1254 return bedSpawnLocation;1255 }1256 @Override1257 public void setBedSpawnLocation(@Nullable Location loc)1258 {1259 setBedSpawnLocation(loc, false);1260 }1261 @Override1262 public void setBedSpawnLocation(@Nullable Location loc, boolean force)1263 {1264 if (force || loc == null || loc.getBlock().getType().name().endsWith("_BED"))1265 {1266 this.bedSpawnLocation = loc;1267 }1268 }1269 @Override1270 public boolean getAllowFlight()1271 {1272 // TODO Auto-generated method stub1273 throw new UnimplementedOperationException();1274 }1275 @Override1276 public void setAllowFlight(boolean flight)1277 {1278 // TODO Auto-generated method stub1279 throw new UnimplementedOperationException();1280 }1281 @Override1282 @Deprecated1283 public void hidePlayer(@NotNull Player player)1284 {1285 hiddenPlayersDeprecated.add(player.getUniqueId());1286 }1287 @Override1288 public void hidePlayer(@NotNull Plugin plugin, @NotNull Player player)1289 {1290 hiddenPlayers.putIfAbsent(player.getUniqueId(), new HashSet<>());1291 Set<Plugin> blockingPlugins = hiddenPlayers.get(player.getUniqueId());1292 blockingPlugins.add(plugin);1293 }1294 @Override1295 @Deprecated1296 public void showPlayer(@NotNull Player player)1297 {1298 hiddenPlayersDeprecated.remove(player.getUniqueId());1299 }1300 @Override1301 public void showPlayer(@NotNull Plugin plugin, @NotNull Player player)1302 {1303 if (hiddenPlayers.containsKey(player.getUniqueId()))1304 {1305 Set<Plugin> blockingPlugins = hiddenPlayers.get(player.getUniqueId());1306 blockingPlugins.remove(plugin);1307 if (blockingPlugins.isEmpty())1308 hiddenPlayers.remove(player.getUniqueId());1309 }1310 }1311 @Override1312 public boolean canSee(@NotNull Player player)1313 {1314 return !hiddenPlayers.containsKey(player.getUniqueId()) &&1315 !hiddenPlayersDeprecated.contains(player.getUniqueId());1316 }1317 @Override1318 public boolean isFlying()1319 {1320 return flying;1321 }1322 @Override1323 public void setFlying(boolean value)1324 {1325 this.flying = value;1326 }1327 public @NotNull PlayerToggleFlightEvent simulateToggleFlight(boolean fly)1328 {1329 PlayerToggleFlightEvent event = new PlayerToggleFlightEvent(this, fly);1330 Bukkit.getPluginManager().callEvent(event);1331 if (!event.isCancelled())1332 {1333 this.flying = event.isFlying();1334 }1335 return event;1336 }1337 @Override1338 public void setFlySpeed(float value)1339 {1340 // TODO Auto-generated method stub1341 throw new UnimplementedOperationException();1342 }1343 @Override1344 public void setWalkSpeed(float value)1345 {1346 // TODO Auto-generated method stub1347 throw new UnimplementedOperationException();1348 }1349 @Override1350 public float getFlySpeed()1351 {1352 // TODO Auto-generated method stub1353 throw new UnimplementedOperationException();1354 }1355 @Override1356 public float getWalkSpeed()1357 {1358 // TODO Auto-generated method stub1359 throw new UnimplementedOperationException();1360 }1361 @Override1362 @Deprecated1363 public void setTexturePack(@NotNull String url)1364 {1365 // TODO Auto-generated method stub1366 throw new UnimplementedOperationException();1367 }1368 @Override1369 public void setResourcePack(@NotNull String url)1370 {1371 // TODO Auto-generated method stub1372 throw new UnimplementedOperationException();1373 }1374 @Override1375 public void setResourcePack(@NotNull String url, byte[] hash)1376 {1377 // TODO Auto-generated method stub1378 throw new UnimplementedOperationException();1379 }1380 @Override1381 public @NotNull Scoreboard getScoreboard()1382 {1383 // TODO Auto-generated method stub1384 throw new UnimplementedOperationException();1385 }1386 @Override1387 public void setScoreboard(@NotNull Scoreboard scoreboard)1388 {1389 // TODO Auto-generated method stub1390 throw new UnimplementedOperationException();1391 }1392 @Override1393 public void setHealth(double health)1394 {1395 if (health > 0)1396 {1397 this.health = Math.min(health, getMaxHealth());1398 return;1399 }1400 this.health = 0;1401 List<ItemStack> drops = new ArrayList<>();1402 drops.addAll(Arrays.asList(getInventory().getContents()));1403 PlayerDeathEvent event = new PlayerDeathEvent(this, drops, 0, getName() + " got killed");1404 Bukkit.getPluginManager().callEvent(event);1405 // Terminate any InventoryView and the cursor item1406 closeInventory();1407 // Clear the Inventory if keep-inventory is not enabled1408 if (!getWorld().getGameRuleValue(GameRule.KEEP_INVENTORY).booleanValue())1409 {1410 getInventory().clear();1411 // Should someone try to provoke a RespawnEvent, they will now find the Inventory to be empty1412 }1413 setLevel(0);1414 setExp(0);1415 setFoodLevel(0);1416 alive = false;1417 }1418 @Override1419 public boolean isHealthScaled()1420 {1421 // TODO Auto-generated method stub1422 throw new UnimplementedOperationException();1423 }1424 @Override1425 public void setHealthScaled(boolean scale)1426 {1427 // TODO Auto-generated method stub1428 throw new UnimplementedOperationException();1429 }1430 @Override1431 public void setHealthScale(double scale)1432 {1433 // TODO Auto-generated method stub1434 throw new UnimplementedOperationException();1435 }1436 @Override1437 public double getHealthScale()1438 {1439 // TODO Auto-generated method stub1440 throw new UnimplementedOperationException();1441 }1442 @Override1443 public Entity getSpectatorTarget()1444 {1445 // TODO Auto-generated method stub1446 throw new UnimplementedOperationException();1447 }1448 @Override1449 public void setSpectatorTarget(Entity entity)1450 {1451 // TODO Auto-generated method stub1452 throw new UnimplementedOperationException();1453 }1454 @Override1455 public void sendTitle(String title, String subtitle)1456 {1457 // TODO Auto-generated method stub1458 throw new UnimplementedOperationException();1459 }1460 @Override1461 public void sendTitle(String title, String subtitle, int fadeIn, int stay, int fadeOut)1462 {1463 // TODO Auto-generated method stub1464 throw new UnimplementedOperationException();1465 }1466 @Override1467 public void resetTitle()1468 {1469 // TODO Auto-generated method stub1470 throw new UnimplementedOperationException();1471 }1472 @Override1473 public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count)1474 {1475 // TODO Auto-generated method stub1476 throw new UnimplementedOperationException();1477 }1478 @Override1479 public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count)1480 {1481 // TODO Auto-generated method stub1482 throw new UnimplementedOperationException();1483 }1484 @Override1485 public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, T data)1486 {1487 // TODO Auto-generated method stub1488 throw new UnimplementedOperationException();1489 }1490 @Override1491 public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, T data)1492 {1493 // TODO Auto-generated method stub1494 throw new UnimplementedOperationException();1495 }1496 @Override1497 public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY,1498 double offsetZ)1499 {1500 // TODO Auto-generated method stub1501 throw new UnimplementedOperationException();1502 }1503 @Override1504 public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX,1505 double offsetY, double offsetZ)1506 {1507 // TODO Auto-generated method stub1508 throw new UnimplementedOperationException();1509 }1510 @Override1511 public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY,1512 double offsetZ, T data)1513 {1514 // TODO Auto-generated method stub1515 throw new UnimplementedOperationException();1516 }1517 @Override1518 public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX,1519 double offsetY, double offsetZ, T data)1520 {1521 // TODO Auto-generated method stub1522 throw new UnimplementedOperationException();1523 }1524 @Override1525 public void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY,1526 double offsetZ, double extra)1527 {1528 // TODO Auto-generated method stub1529 throw new UnimplementedOperationException();1530 }1531 @Override1532 public void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX,1533 double offsetY, double offsetZ, double extra)1534 {1535 // TODO Auto-generated method stub1536 throw new UnimplementedOperationException();1537 }1538 @Override1539 public <T> void spawnParticle(@NotNull Particle particle, @NotNull Location location, int count, double offsetX, double offsetY,1540 double offsetZ, double extra, T data)1541 {1542 // TODO Auto-generated method stub1543 throw new UnimplementedOperationException();1544 }1545 @Override1546 public <T> void spawnParticle(@NotNull Particle particle, double x, double y, double z, int count, double offsetX,1547 double offsetY, double offsetZ, double extra, T data)1548 {1549 // TODO Auto-generated method stub1550 throw new UnimplementedOperationException();1551 }1552 @Override1553 public @NotNull AdvancementProgress getAdvancementProgress(@NotNull Advancement advancement)1554 {1555 // TODO Auto-generated method stub1556 throw new UnimplementedOperationException();1557 }1558 @Override1559 public @NotNull String getLocale()1560 {1561 // TODO Auto-generated method stub1562 throw new UnimplementedOperationException();1563 }1564 @Override1565 public boolean isSwimming()1566 {1567 // TODO Auto-generated method stub1568 throw new UnimplementedOperationException();1569 }1570 @Override1571 public void setSwimming(boolean swimming)1572 {1573 // TODO Auto-generated method stub1574 throw new UnimplementedOperationException();1575 }1576 @Override1577 public boolean isRiptiding()1578 {1579 // TODO Auto-generated method stub1580 throw new UnimplementedOperationException();1581 }1582 @Override1583 public boolean isPersistent()1584 {1585 // TODO Auto-generated method stub1586 throw new UnimplementedOperationException();1587 }1588 @Override1589 public void setPersistent(boolean persistent)1590 {1591 // TODO Auto-generated method stub1592 throw new UnimplementedOperationException();1593 }1594 @Override1595 public String getPlayerListHeader()1596 {1597 // TODO Auto-generated method stub1598 throw new UnimplementedOperationException();1599 }1600 @Override1601 public String getPlayerListFooter()1602 {1603 // TODO Auto-generated method stub1604 throw new UnimplementedOperationException();1605 }1606 @Override1607 public void setPlayerListHeader(String header)1608 {1609 // TODO Auto-generated method stub1610 throw new UnimplementedOperationException();1611 }1612 @Override1613 public void setPlayerListFooter(String footer)1614 {1615 // TODO Auto-generated method stub1616 throw new UnimplementedOperationException();1617 }1618 @Override1619 public void setPlayerListHeaderFooter(String header, String footer)1620 {1621 // TODO Auto-generated method stub1622 throw new UnimplementedOperationException();1623 }1624 @Override1625 public void sendBlockChange(@NotNull Location loc, @NotNull BlockData block)1626 {1627 // TODO Auto-generated method stub1628 throw new UnimplementedOperationException();1629 }1630 @Override1631 public void updateCommands()1632 {1633 // TODO Auto-generated method stub1634 throw new UnimplementedOperationException();1635 }1636 @Override1637 public boolean discoverRecipe(@NotNull NamespacedKey recipe)1638 {1639 return discoverRecipes(Collections.singletonList(recipe)) != 0;1640 }1641 @Override1642 public int discoverRecipes(@NotNull Collection<NamespacedKey> recipes)1643 {1644 // TODO Auto-generated method stub1645 throw new UnimplementedOperationException();1646 }1647 @Override1648 public boolean undiscoverRecipe(@NotNull NamespacedKey recipe)1649 {1650 return undiscoverRecipes(Collections.singletonList(recipe)) != 0;1651 }1652 @Override1653 public int undiscoverRecipes(@NotNull Collection<NamespacedKey> recipes)1654 {1655 // TODO Auto-generated method stub1656 throw new UnimplementedOperationException();1657 }1658 @Override1659 public Block getTargetBlockExact(int maxDistance)1660 {1661 // TODO Auto-generated method stub1662 throw new UnimplementedOperationException();1663 }1664 @Override1665 public Block getTargetBlockExact(int maxDistance, @NotNull FluidCollisionMode fluidCollisionMode)1666 {1667 // TODO Auto-generated method stub1668 throw new UnimplementedOperationException();1669 }1670 @Override1671 public RayTraceResult rayTraceBlocks(double maxDistance)1672 {1673 // TODO Auto-generated method stub1674 throw new UnimplementedOperationException();1675 }1676 @Override1677 public RayTraceResult rayTraceBlocks(double maxDistance, @NotNull FluidCollisionMode fluidCollisionMode)1678 {1679 // TODO Auto-generated method stub1680 throw new UnimplementedOperationException();1681 }1682 @Override1683 public @NotNull BoundingBox getBoundingBox()1684 {1685 // TODO Auto-generated method stub1686 throw new UnimplementedOperationException();1687 }1688 @Override1689 public @NotNull BlockFace getFacing()1690 {1691 // TODO Auto-generated method stub1692 throw new UnimplementedOperationException();1693 }1694 @Override1695 public int getClientViewDistance()1696 {1697 // TODO Auto-generated method stub1698 throw new UnimplementedOperationException();1699 }1700 @Override1701 public boolean sleep(@NotNull Location location, boolean force)1702 {1703 // TODO Auto-generated method stub1704 throw new UnimplementedOperationException();1705 }1706 @Override1707 public void wakeup(boolean setSpawnLocation)1708 {1709 // TODO Auto-generated method stub1710 throw new UnimplementedOperationException();1711 }1712 @Override1713 public @NotNull Location getBedLocation()1714 {1715 // TODO Auto-generated method stub1716 throw new UnimplementedOperationException();1717 }1718 @Override1719 public <T> T getMemory(@NotNull MemoryKey<T> memoryKey)1720 {1721 // TODO Auto-generated method stub1722 throw new UnimplementedOperationException();1723 }1724 @Override1725 public <T> void setMemory(@NotNull MemoryKey<T> memoryKey, T memoryValue)1726 {1727 // TODO Auto-generated method stub1728 throw new UnimplementedOperationException();1729 }1730 @Override1731 public double getAbsorptionAmount()1732 {1733 // TODO Auto-generated method stub1734 throw new UnimplementedOperationException();1735 }1736 @Override1737 public void setAbsorptionAmount(double amount)1738 {1739 // TODO Auto-generated method stub1740 throw new UnimplementedOperationException();1741 }1742 @Override1743 public @NotNull Pose getPose()1744 {1745 // TODO Auto-generated method stub1746 throw new UnimplementedOperationException();1747 }1748 @Override1749 public void sendSignChange(@NotNull Location loc, String[] lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException1750 {1751 // TODO Auto-generated method stub1752 throw new UnimplementedOperationException();1753 }1754 @Override1755 public void openBook(@NotNull ItemStack book)1756 {1757 // TODO Auto-generated method stub1758 throw new UnimplementedOperationException();1759 }1760 @Override1761 public void attack(@NotNull Entity target)1762 {1763 // TODO Auto-generated method stub1764 throw new UnimplementedOperationException();1765 }1766 @Override1767 public void swingMainHand()1768 {1769 // TODO Auto-generated method stub1770 throw new UnimplementedOperationException();1771 }1772 @Override1773 public void swingOffHand()1774 {1775 // TODO Auto-generated method stub1776 throw new UnimplementedOperationException();1777 }1778 @Override1779 public void sendExperienceChange(float progress)1780 {1781 // TODO Auto-generated method stub1782 throw new UnimplementedOperationException();1783 }1784 @Override1785 public void sendExperienceChange(float progress, int level)1786 {1787 // TODO Auto-generated method stub1788 throw new UnimplementedOperationException();1789 }1790 @Override1791 public float getAttackCooldown()1792 {1793 // TODO Auto-generated method stub1794 throw new UnimplementedOperationException();1795 }1796 @Override1797 public boolean hasDiscoveredRecipe(@NotNull NamespacedKey recipe)1798 {1799 // TODO Auto-generated method stub1800 throw new UnimplementedOperationException();1801 }1802 @Override1803 public @NotNull Set<NamespacedKey> getDiscoveredRecipes()1804 {1805 // TODO Auto-generated method stub1806 throw new UnimplementedOperationException();1807 }1808 @Override1809 public boolean dropItem(boolean dropAll)1810 {1811 // TODO Auto-generated method stub1812 throw new UnimplementedOperationException();1813 }1814 @Override1815 public @NotNull Set<UUID> getCollidableExemptions()1816 {1817 // TODO Auto-generated method stub1818 throw new UnimplementedOperationException();1819 }1820 @Override1821 public void sendBlockDamage(@NotNull Location loc, float progress)1822 {1823 // TODO Auto-generated method stub1824 throw new UnimplementedOperationException();1825 }1826 @Override1827 public int getSaturatedRegenRate()1828 {1829 // TODO Auto-generated method stub1830 throw new UnimplementedOperationException();1831 }1832 @Override1833 public void setSaturatedRegenRate(int ticks)1834 {1835 // TODO Auto-generated method stub1836 throw new UnimplementedOperationException();1837 }1838 @Override1839 public int getUnsaturatedRegenRate()1840 {1841 // TODO Auto-generated method stub1842 throw new UnimplementedOperationException();1843 }1844 @Override1845 public void setUnsaturatedRegenRate(int ticks)1846 {1847 // TODO Auto-generated method stub1848 throw new UnimplementedOperationException();1849 }1850 @Override1851 public int getStarvationRate()1852 {1853 // TODO Auto-generated method stub1854 throw new UnimplementedOperationException();1855 }1856 @Override1857 public void setStarvationRate(int ticks)1858 {1859 // TODO Auto-generated method stub1860 throw new UnimplementedOperationException();1861 }1862 @Override1863 public int getPing()1864 {1865 /*1866 * This PlayerMock and the ServerMock exist within1867 * the same machine, therefore there would most1868 * likely be a ping of 0ms.1869 */1870 return 0;1871 }1872 @Override1873 public boolean teleport(@NotNull Location location, @NotNull PlayerTeleportEvent.TeleportCause cause)1874 {1875 Validate.notNull(location, "Location cannot be null");1876 Validate.notNull(cause, "Cause cannot be null");1877 PlayerTeleportEvent playerTeleportEvent = new PlayerTeleportEvent(this, getLocation(), location, cause);1878 Bukkit.getPluginManager().callEvent(playerTeleportEvent);1879 if (playerTeleportEvent.isCancelled())1880 {1881 return false;1882 }1883 return super.teleport(playerTeleportEvent.getTo(), cause);1884 }1885 @Override1886 public @NotNull PlayerSpigotMock spigot()1887 {1888 return playerSpigotMock;1889 }1890 public class PlayerSpigotMock extends Player.Spigot1891 {1892 @Override1893 public void sendMessage(@NotNull BaseComponent... components)1894 {1895 for (BaseComponent component : components)1896 {1897 sendMessage(component);1898 }1899 }1900 @Override1901 public void sendMessage(@NotNull ChatMessageType position, @NotNull BaseComponent... components)1902 {1903 for (BaseComponent component : components)1904 {...

Full Screen

Full Screen

PlayerSpigotMock

Using AI Code Generation

copy

Full Screen

1PlayerSpigotMock spigot = new PlayerSpigotMock();2when(player.spigot()).thenReturn(spigot);3PlayerSpigotMock spigot = new PlayerSpigotMock();4when(player.spigot()).thenReturn(spigot);5PlayerSpigotMock spigot = new PlayerSpigotMock();6when(player.spigot()).thenReturn(spigot);7PlayerSpigotMock spigot = new PlayerSpigotMock();8when(player.spigot()).thenReturn(spigot);9PlayerSpigotMock spigot = new PlayerSpigotMock();10when(player.spigot()).thenReturn(spigot);11PlayerSpigotMock spigot = new PlayerSpigotMock();12when(player.spigot()).thenReturn(spigot);13PlayerSpigotMock spigot = new PlayerSpigotMock();14when(player.spigot()).thenReturn(spigot);15PlayerSpigotMock spigot = new PlayerSpigotMock();16when(player.spigot()).thenReturn(spigot);17PlayerSpigotMock spigot = new PlayerSpigotMock();18when(player.spigot()).thenReturn(spigot);19PlayerSpigotMock spigot = new PlayerSpigotMock();20when(player.spigot()).thenReturn(spigot);

Full Screen

Full Screen

PlayerSpigotMock

Using AI Code Generation

copy

Full Screen

1player.setLocale(Locale.ENGLISH);2Locale locale = player.getLocale();3player.setLocale(Locale.ENGLISH);4Locale locale = player.getLocale();5player.setLocale(Locale.ENGLISH);6Locale locale = player.getLocale();7player.setLocale(Locale.ENGLISH);8Locale locale = player.getLocale();9player.setLocale(Locale.ENGLISH);10Locale locale = player.getLocale();11player.setLocale(Locale.ENGLISH);12Locale locale = player.getLocale();13player.setLocale(Locale.ENGLISH);

Full Screen

Full Screen

PlayerSpigotMock

Using AI Code Generation

copy

Full Screen

1import be.seeseemelk.mockbukkit.entity.PlayerMock;2import be.seeseemelk.mockbukkit.entity.PlayerSpigotMock;3PlayerMock player = server.addPlayer();4PlayerSpigotMock spigot = new PlayerSpigotMock();5player.setSpigot(spigot);6player.setSpigot(new PlayerSpigotMock());7player.setSpigot(new PlayerSpigotMock("en_US"));8spigot.setLocale("en_US");9spigot.getLocale();10player.getLocale();11player.getSpigot();12player.getHandle().spigot();13player.getHandle().getSpigot();14player.getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get();15player.getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getSpigot();16player.getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getHandle().getSpigot();17player.getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getHandle().spigot();18player.getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getHandle().spigot();19player.getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getHandle().playerConnection.networkManager.channel.attr(PlayerConnection.a).get().getHandle().getSpigot();20player.getHandle().playerConnection.networkManager.channel.attr

Full Screen

Full Screen

PlayerSpigotMock

Using AI Code Generation

copy

Full Screen

1PlayerSpigotMock spigot = player.spigot();2PlayerSpigotMock spigot = player.spigot();3PlayerSpigotMock spigot = player.spigot();4PlayerSpigotMock spigot = player.spigot();5PlayerSpigotMock spigot = player.spigot();6PlayerSpigotMock spigot = player.spigot();7PlayerSpigotMock spigot = player.spigot();8PlayerSpigotMock spigot = player.spigot();9PlayerSpigotMock spigot = player.spigot();10PlayerSpigotMock spigot = player.spigot();

Full Screen

Full Screen

PlayerSpigotMock

Using AI Code Generation

copy

Full Screen

1public void testPlayerMock() throws Exception {2 PlayerMock player = new PlayerMock(server, "Seeseemelk");3 assertTrue(player.isOnline());4 assertEquals("Seeseemelk", player.getName());5 assertEquals(UUID.fromString("6b1d6e07-9a9a-4b7f-8d49-6a1d6e079a9a"), player.getUniqueId());6}7public void testPlayerSpigotMock() throws Exception {8 PlayerSpigotMock player = new PlayerSpigotMock(server, "Seeseemelk");9 assertTrue(player.isOnline());10 assertEquals("Seeseemelk", player.getName());11 assertEquals(UUID.fromString("6b1d6e07-9a9a-4b7f-8d49-6a1d6e079a9a"), player.getUniqueId());12}13public void testPlayerMock() throws Exception {14 PlayerMock player = new PlayerMock(server, "Seeseemelk");15 assertTrue(player.isOnline());16 assertEquals("Seeseemelk", player.getName());17 assertEquals(UUID.fromString("6b1d6e07-9a9a-4b7f-8d49-6a1d6e079a9a"), player.getUniqueId());18}19public void testPlayerBukkitMock() throws Exception {20 PlayerBukkitMock player = new PlayerBukkitMock(server, "Seeseemelk");21 assertTrue(player.isOnline());22 assertEquals("Seeseemelk", player.getName());

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run MockBukkit automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Most used method in PlayerMock

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful