How to use hide method of be.seeseemelk.mockbukkit.boss.BossBarMock class

Best MockBukkit code snippet using be.seeseemelk.mockbukkit.boss.BossBarMock.hide

Source:ServerMock.java Github

copy

Full Screen

1package be.seeseemelk.mockbukkit;2import be.seeseemelk.mockbukkit.block.data.BlockDataMock;3import be.seeseemelk.mockbukkit.boss.BossBarMock;4import be.seeseemelk.mockbukkit.boss.KeyedBossBarMock;5import be.seeseemelk.mockbukkit.command.CommandResult;6import be.seeseemelk.mockbukkit.command.ConsoleCommandSenderMock;7import be.seeseemelk.mockbukkit.command.MessageTarget;8import be.seeseemelk.mockbukkit.command.MockCommandMap;9import be.seeseemelk.mockbukkit.enchantments.EnchantmentsMock;10import be.seeseemelk.mockbukkit.entity.EntityMock;11import be.seeseemelk.mockbukkit.entity.PlayerMock;12import be.seeseemelk.mockbukkit.entity.PlayerMockFactory;13import be.seeseemelk.mockbukkit.help.HelpMapMock;14import be.seeseemelk.mockbukkit.inventory.BarrelInventoryMock;15import be.seeseemelk.mockbukkit.inventory.ChestInventoryMock;16import be.seeseemelk.mockbukkit.inventory.DispenserInventoryMock;17import be.seeseemelk.mockbukkit.inventory.DropperInventoryMock;18import be.seeseemelk.mockbukkit.inventory.EnderChestInventoryMock;19import be.seeseemelk.mockbukkit.inventory.HopperInventoryMock;20import be.seeseemelk.mockbukkit.inventory.InventoryMock;21import be.seeseemelk.mockbukkit.inventory.ItemFactoryMock;22import be.seeseemelk.mockbukkit.inventory.LecternInventoryMock;23import be.seeseemelk.mockbukkit.inventory.PlayerInventoryMock;24import be.seeseemelk.mockbukkit.inventory.ShulkerBoxInventoryMock;25import be.seeseemelk.mockbukkit.inventory.meta.ItemMetaMock;26import be.seeseemelk.mockbukkit.plugin.PluginManagerMock;27import be.seeseemelk.mockbukkit.potion.MockPotionEffectType;28import be.seeseemelk.mockbukkit.scheduler.BukkitSchedulerMock;29import be.seeseemelk.mockbukkit.scoreboard.ScoreboardManagerMock;30import be.seeseemelk.mockbukkit.services.ServicesManagerMock;31import be.seeseemelk.mockbukkit.tags.TagRegistry;32import be.seeseemelk.mockbukkit.tags.TagWrapperMock;33import be.seeseemelk.mockbukkit.tags.TagsMock;34import com.destroystokyo.paper.entity.ai.MobGoals;35import io.papermc.paper.datapack.DatapackManager;36import net.kyori.adventure.audience.Audience;37import net.kyori.adventure.text.Component;38import net.md_5.bungee.api.chat.BaseComponent;39import org.apache.commons.lang.Validate;40import org.bukkit.BanEntry;41import org.bukkit.BanList;42import org.bukkit.BanList.Type;43import org.bukkit.Bukkit;44import org.bukkit.Color;45import org.bukkit.GameMode;46import org.bukkit.Keyed;47import org.bukkit.Location;48import org.bukkit.Material;49import org.bukkit.NamespacedKey;50import org.bukkit.OfflinePlayer;51import org.bukkit.Server;52import org.bukkit.StructureType;53import org.bukkit.Tag;54import org.bukkit.Warning.WarningState;55import org.bukkit.World;56import org.bukkit.WorldBorder;57import org.bukkit.WorldCreator;58import org.bukkit.advancement.Advancement;59import org.bukkit.block.data.BlockData;60import org.bukkit.boss.BarColor;61import org.bukkit.boss.BarFlag;62import org.bukkit.boss.BarStyle;63import org.bukkit.boss.BossBar;64import org.bukkit.boss.KeyedBossBar;65import org.bukkit.command.Command;66import org.bukkit.command.CommandSender;67import org.bukkit.command.ConsoleCommandSender;68import org.bukkit.command.PluginCommand;69import org.bukkit.configuration.file.YamlConfiguration;70import org.bukkit.configuration.serialization.ConfigurationSerialization;71import org.bukkit.entity.Entity;72import org.bukkit.entity.HumanEntity;73import org.bukkit.entity.Player;74import org.bukkit.entity.SpawnCategory;75import org.bukkit.event.inventory.InventoryType;76import org.bukkit.event.player.PlayerJoinEvent;77import org.bukkit.generator.ChunkGenerator.ChunkData;78import org.bukkit.inventory.Inventory;79import org.bukkit.inventory.InventoryHolder;80import org.bukkit.inventory.ItemFactory;81import org.bukkit.inventory.ItemStack;82import org.bukkit.inventory.Merchant;83import org.bukkit.inventory.Recipe;84import org.bukkit.loot.LootTable;85import org.bukkit.map.MapView;86import org.bukkit.plugin.Plugin;87import org.bukkit.plugin.messaging.Messenger;88import org.bukkit.plugin.messaging.StandardMessenger;89import org.bukkit.potion.PotionBrewer;90import org.bukkit.potion.PotionEffectType;91import org.bukkit.profile.PlayerProfile;92import org.bukkit.structure.StructureManager;93import org.bukkit.util.CachedServerIcon;94import org.jetbrains.annotations.NotNull;95import org.jetbrains.annotations.Nullable;96import java.awt.image.BufferedImage;97import java.io.File;98import java.io.IOException;99import java.io.InputStream;100import java.util.ArrayList;101import java.util.Arrays;102import java.util.Collection;103import java.util.Collections;104import java.util.HashMap;105import java.util.HashSet;106import java.util.Iterator;107import java.util.LinkedList;108import java.util.List;109import java.util.Locale;110import java.util.Map;111import java.util.Set;112import java.util.UUID;113import java.util.function.Consumer;114import java.util.logging.Level;115import java.util.logging.LogManager;116import java.util.logging.Logger;117import java.util.stream.Collectors;118public class ServerMock extends Server.Spigot implements Server119{120 private static final String BUKKIT_VERSION = "1.18.2";121 private static final String JOIN_MESSAGE = "%s has joined the server.";122 private static final String MOTD = "A Minecraft Server";123 private final Logger logger = Logger.getLogger("ServerMock");124 private final Thread mainThread = Thread.currentThread();125 private final MockUnsafeValues unsafe = new MockUnsafeValues();126 private final Map<String, TagRegistry> materialTags = new HashMap<>();127 private final Set<EntityMock> entities = new HashSet<>();128 private final List<World> worlds = new ArrayList<>();129 private final List<Recipe> recipes = new LinkedList<>();130 private final Map<NamespacedKey, KeyedBossBarMock> bossBars = new HashMap<>();131 private final ItemFactory factory = new ItemFactoryMock();132 private final PlayerMockFactory playerFactory = new PlayerMockFactory(this);133 private final PluginManagerMock pluginManager = new PluginManagerMock(this);134 private final ScoreboardManagerMock scoreboardManager = new ScoreboardManagerMock();135 private final BukkitSchedulerMock scheduler = new BukkitSchedulerMock();136 private final ServicesManagerMock servicesManager = new ServicesManagerMock();137 private final MockPlayerList playerList = new MockPlayerList();138 private final MockCommandMap commandMap = new MockCommandMap(this);139 private final HelpMapMock helpMap = new HelpMapMock();140 private final StandardMessenger messenger = new StandardMessenger();141 private GameMode defaultGameMode = GameMode.SURVIVAL;142 private ConsoleCommandSender consoleSender;143 private int spawnRadius = 16;144 private WarningState warningState = WarningState.DEFAULT;145 public ServerMock()146 {147 ServerMock.registerSerializables();148 // Register default Minecraft Potion Effect Types149 createPotionEffectTypes();150 TagsMock.loadDefaultTags(this, true);151 EnchantmentsMock.registerDefaultEnchantments();152 try153 {154 InputStream stream = ClassLoader.getSystemResourceAsStream("logger.properties");155 LogManager.getLogManager().readConfiguration(stream);156 }157 catch (IOException e)158 {159 logger.warning("Could not load file logger.properties");160 }161 logger.setLevel(Level.ALL);162 }163 /**164 * Checks if we are on the main thread. The main thread is the thread used to create this instance of the mock165 * server.166 *167 * @return {@code true} if we are on the main thread, {@code false} if we are running on a different thread.168 */169 public boolean isOnMainThread()170 {171 return mainThread.equals(Thread.currentThread());172 }173 /**174 * Checks if we are running a method on the main thread. If not, a `ThreadAccessException` is thrown.175 */176 public void assertMainThread()177 {178 if (!isOnMainThread())179 {180 throw new ThreadAccessException("The Bukkit API was accessed from asynchronous code.");181 }182 }183 /**184 * Registers an entity so that the server can track it more easily. Should only be used internally.185 *186 * @param entity The entity to register187 */188 public void registerEntity(@NotNull EntityMock entity)189 {190 assertMainThread();191 entities.add(entity);192 }193 /**194 * Returns a set of entities that exist on the server instance.195 *196 * @return A set of entities that exist on this server instance.197 */198 @NotNull199 public Set<EntityMock> getEntities()200 {201 return Collections.unmodifiableSet(entities);202 }203 /**204 * Add a specific player to the set.205 *206 * @param player The player to add.207 */208 public void addPlayer(PlayerMock player)209 {210 assertMainThread();211 playerList.addPlayer(player);212 PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(player,213 String.format(JOIN_MESSAGE, player.getDisplayName()));214 Bukkit.getPluginManager().callEvent(playerJoinEvent);215 player.setLastPlayed(getCurrentServerTime());216 registerEntity(player);217 }218 /**219 * Creates a random player and adds it.220 *221 * @return The player that was added.222 */223 public PlayerMock addPlayer()224 {225 assertMainThread();226 PlayerMock player = playerFactory.createRandomPlayer();227 addPlayer(player);228 return player;229 }230 /**231 * Creates a player with a given name and adds it.232 *233 * @param name The name to give to the player.234 * @return The added player.235 */236 public PlayerMock addPlayer(String name)237 {238 assertMainThread();239 PlayerMock player = new PlayerMock(this, name);240 addPlayer(player);241 return player;242 }243 /**244 * Set the numbers of mock players that are on this server. Note that it will remove all players that are already on245 * this server.246 *247 * @param num The number of players that are on this server.248 */249 public void setPlayers(int num)250 {251 assertMainThread();252 playerList.clearOnlinePlayers();253 for (int i = 0; i < num; i++)254 addPlayer();255 }256 /**257 * Set the numbers of mock offline players that are on this server. Note that even players that are online are also258 * considered offline player because an {@link OfflinePlayer} really just refers to anyone that has at some point in259 * time played on the server.260 *261 * @param num The number of players that are on this server.262 */263 public void setOfflinePlayers(int num)264 {265 assertMainThread();266 playerList.clearOfflinePlayers();267 for (PlayerMock player : getOnlinePlayers())268 {269 playerList.addPlayer(player);270 }271 for (int i = 0; i < num; i++)272 {273 OfflinePlayer player = playerFactory.createRandomOfflinePlayer();274 playerList.addOfflinePlayer(player);275 }276 }277 /**278 * Get a specific mock player. A player's number will never change between invocations of {@link #setPlayers(int)}.279 *280 * @param num The number of the player to retrieve.281 * @return The chosen player.282 */283 public PlayerMock getPlayer(int num)284 {285 return playerList.getPlayer(num);286 }287 @Override288 public @Nullable UUID getPlayerUniqueId(@NotNull String playerName)289 {290 return playerList.getPlayer(playerName).getUniqueId();291 }292 /**293 * Adds a very simple super flat world with a given name.294 *295 * @param name The name to give to the world.296 * @return The {@link WorldMock} that has been created.297 */298 public WorldMock addSimpleWorld(String name)299 {300 assertMainThread();301 WorldMock world = new WorldMock();302 world.setName(name);303 worlds.add(world);304 return world;305 }306 /**307 * Adds the given mocked world to this server.308 *309 * @param world The world to add.310 */311 public void addWorld(WorldMock world)312 {313 assertMainThread();314 worlds.add(world);315 }316 /**317 * Executes a command as the console.318 *319 * @param command The command to execute.320 * @param args The arguments to pass to the commands.321 * @return The value returned by {@link Command#execute}.322 */323 public CommandResult executeConsole(Command command, String... args)324 {325 assertMainThread();326 return execute(command, getConsoleSender(), args);327 }328 /**329 * Executes a command as the console.330 *331 * @param command The command to execute.332 * @param args The arguments to pass to the commands.333 * @return The value returned by {@link Command#execute}.334 */335 public CommandResult executeConsole(String command, String... args)336 {337 assertMainThread();338 return executeConsole(getCommandMap().getCommand(command), args);339 }340 /**341 * Executes a command as a player.342 *343 * @param command The command to execute.344 * @param args The arguments to pass to the commands.345 * @return The value returned by {@link Command#execute}.346 */347 public CommandResult executePlayer(Command command, String... args)348 {349 assertMainThread();350 if (playerList.isSomeoneOnline())351 return execute(command, getPlayer(0), args);352 else353 throw new IllegalStateException("Need at least one player to run the command");354 }355 /**356 * Executes a command as a player.357 *358 * @param command The command to execute.359 * @param args The arguments to pass to the commands.360 * @return The value returned by {@link Command#execute}.361 */362 public CommandResult executePlayer(String command, String... args)363 {364 assertMainThread();365 return executePlayer(getCommandMap().getCommand(command), args);366 }367 /**368 * Executes a command.369 *370 * @param command The command to execute.371 * @param sender The person that executed the command.372 * @param args The arguments to pass to the commands.373 * @return The value returned by {@link Command#execute}.374 */375 public CommandResult execute(Command command, CommandSender sender, String... args)376 {377 assertMainThread();378 if (!(sender instanceof MessageTarget))379 {380 throw new IllegalArgumentException("Only a MessageTarget can be the sender of the command");381 }382 boolean status = command.execute(sender, command.getName(), args);383 return new CommandResult(status, (MessageTarget) sender);384 }385 /**386 * Executes a command.387 *388 * @param command The command to execute.389 * @param sender The person that executed the command.390 * @param args The arguments to pass to the commands.391 * @return The value returned by {@link Command#execute}.392 */393 public CommandResult execute(String command, CommandSender sender, String... args)394 {395 assertMainThread();396 return execute(getCommandMap().getCommand(command), sender, args);397 }398 @Override399 public String getName()400 {401 return "ServerMock";402 }403 @Override404 public String getVersion()405 {406 return String.format("MockBukkit (MC: %s)", BUKKIT_VERSION);407 }408 @Override409 public String getBukkitVersion()410 {411 return BUKKIT_VERSION;412 }413 @Override414 public @NotNull String getMinecraftVersion()415 {416 throw new UnimplementedOperationException();417 }418 @Override419 public Collection<? extends PlayerMock> getOnlinePlayers()420 {421 return playerList.getOnlinePlayers();422 }423 @Override424 public OfflinePlayer[] getOfflinePlayers()425 {426 return playerList.getOfflinePlayers();427 }428 @Override429 public @Nullable OfflinePlayer getOfflinePlayerIfCached(@NotNull String name)430 {431 //TODO Auto-generated method stub432 throw new UnimplementedOperationException();433 }434 @Override435 public Player getPlayer(String name)436 {437 return playerList.getPlayer(name);438 }439 @Override440 public Player getPlayerExact(String name)441 {442 return playerList.getPlayerExact(name);443 }444 @Override445 public List<Player> matchPlayer(String name)446 {447 return playerList.matchPlayer(name);448 }449 @Override450 public Player getPlayer(UUID id)451 {452 return playerList.getPlayer(id);453 }454 @Override455 public PluginManagerMock getPluginManager()456 {457 return pluginManager;458 }459 @NotNull460 public MockCommandMap getCommandMap()461 {462 return commandMap;463 }464 @Override465 public PluginCommand getPluginCommand(String name)466 {467 assertMainThread();468 Command command = getCommandMap().getCommand(name);469 return command instanceof PluginCommand ? (PluginCommand) command : null;470 }471 @Override472 public Logger getLogger()473 {474 return logger;475 }476 @Override477 public ConsoleCommandSender getConsoleSender()478 {479 if (consoleSender == null)480 {481 consoleSender = new ConsoleCommandSenderMock();482 }483 return consoleSender;484 }485 @Override486 public @NotNull CommandSender createCommandSender(@NotNull Consumer<? super Component> feedback)487 {488 //TODO Auto-generated method stub489 throw new UnimplementedOperationException();490 }491 @NotNull492 @Deprecated493 public InventoryMock createInventory(InventoryHolder owner, InventoryType type, String title, int size)494 {495 assertMainThread();496 if (!type.isCreatable())497 {498 throw new IllegalArgumentException("Inventory Type is not creatable!");499 }500 switch (type)501 {502 case CHEST:503 return new ChestInventoryMock(owner, size > 0 ? size : 9 * 3);504 case DISPENSER:505 return new DispenserInventoryMock(owner);506 case DROPPER:507 return new DropperInventoryMock(owner);508 case PLAYER:509 if (owner instanceof HumanEntity)510 {511 return new PlayerInventoryMock((HumanEntity) owner);512 }513 else514 {515 throw new IllegalArgumentException("Cannot create a Player Inventory for: " + owner);516 }517 case ENDER_CHEST:518 return new EnderChestInventoryMock(owner);519 case HOPPER:520 return new HopperInventoryMock(owner);521 case SHULKER_BOX:522 return new ShulkerBoxInventoryMock(owner);523 case BARREL:524 return new BarrelInventoryMock(owner);525 case LECTERN:526 return new LecternInventoryMock(owner);527 case GRINDSTONE:528 // TODO: This Inventory Type needs to be implemented529 case STONECUTTER:530 // TODO: This Inventory Type needs to be implemented531 case CARTOGRAPHY:532 // TODO: This Inventory Type needs to be implemented533 case SMOKER:534 // TODO: This Inventory Type needs to be implemented535 case LOOM:536 // TODO: This Inventory Type needs to be implemented537 case BLAST_FURNACE:538 // TODO: This Inventory Type needs to be implemented539 case ANVIL:540 // TODO: This Inventory Type needs to be implemented541 case SMITHING:542 // TODO: This Inventory Type needs to be implemented543 case BEACON:544 // TODO: This Inventory Type needs to be implemented545 case FURNACE:546 // TODO: This Inventory Type needs to be implemented547 case WORKBENCH:548 // TODO: This Inventory Type needs to be implemented549 case ENCHANTING:550 // TODO: This Inventory Type needs to be implemented551 case BREWING:552 // TODO: This Inventory Type needs to be implemented553 case CRAFTING:554 // TODO: This Inventory Type needs to be implemented555 case CREATIVE:556 // TODO: This Inventory Type needs to be implemented557 case MERCHANT:558 // TODO: This Inventory Type needs to be implemented559 default:560 throw new UnimplementedOperationException("Inventory type not yet supported");561 }562 }563 @Override564 public InventoryMock createInventory(InventoryHolder owner, InventoryType type)565 {566 return createInventory(owner, type, "Inventory");567 }568 @Override569 public @NotNull Inventory createInventory(@Nullable InventoryHolder owner, @NotNull InventoryType type, @NotNull Component title)570 {571 //TODO Auto-generated method stub572 throw new UnimplementedOperationException();573 }574 @Override575 @Deprecated576 public InventoryMock createInventory(InventoryHolder owner, InventoryType type, String title)577 {578 return createInventory(owner, type, title, -1);579 }580 @Override581 public InventoryMock createInventory(InventoryHolder owner, int size)582 {583 return createInventory(owner, size, "Inventory");584 }585 @Override586 public @NotNull Inventory createInventory(@Nullable InventoryHolder owner, int size, @NotNull Component title) throws IllegalArgumentException587 {588 //TODO Auto-generated method stub589 throw new UnimplementedOperationException();590 }591 @Override592 @Deprecated593 public InventoryMock createInventory(InventoryHolder owner, int size, String title)594 {595 return createInventory(owner, InventoryType.CHEST, title, size);596 }597 @Override598 public Merchant createMerchant(@Nullable Component title)599 {600 //TODO Auto-generated method stub601 throw new UnimplementedOperationException();602 }603 @Override604 public ItemFactory getItemFactory()605 {606 return factory;607 }608 @Override609 public List<World> getWorlds()610 {611 return new ArrayList<>(worlds);612 }613 @Override614 public World getWorld(String name)615 {616 return worlds.stream().filter(world -> world.getName().equals(name)).findAny().orElse(null);617 }618 @Override619 public World getWorld(UUID uid)620 {621 return worlds.stream().filter(world -> world.getUID().equals(uid)).findAny().orElse(null);622 }623 @Override624 public @Nullable World getWorld(@NotNull NamespacedKey worldKey)625 {626 // TODO Auto-generated method stub627 throw new UnimplementedOperationException();628 }629 @NotNull630 @Override631 public WorldBorder createWorldBorder()632 {633 // TODO Auto-generated method stub634 throw new UnimplementedOperationException();635 }636 @Override637 public BukkitSchedulerMock getScheduler()638 {639 return scheduler;640 }641 @Override642 public int getMaxPlayers()643 {644 return playerList.getMaxPlayers();645 }646 @Override647 public void setMaxPlayers(int maxPlayers)648 {649 playerList.setMaxPlayers(maxPlayers);650 }651 @Override652 public Set<String> getIPBans()653 {654 return this.playerList.getIPBans().getBanEntries().stream().map(BanEntry::getTarget)655 .collect(Collectors.toSet());656 }657 @Override658 public void banIP(String address)659 {660 assertMainThread();661 this.playerList.getIPBans().addBan(address, null, null, null);662 }663 @Override664 public void unbanIP(String address)665 {666 assertMainThread();667 this.playerList.getIPBans().pardon(address);668 }669 @Override670 public BanList getBanList(Type type)671 {672 switch (type)673 {674 case IP:675 return playerList.getIPBans();676 case NAME:677 default:678 return playerList.getProfileBans();679 }680 }681 @Override682 public Set<OfflinePlayer> getOperators()683 {684 return playerList.getOperators();685 }686 @Override687 public GameMode getDefaultGameMode()688 {689 return this.defaultGameMode;690 }691 @Override692 public void setDefaultGameMode(GameMode mode)693 {694 assertMainThread();695 this.defaultGameMode = mode;696 }697 @Override698 @Deprecated699 public int broadcastMessage(String message)700 {701 Collection<? extends PlayerMock> players = getOnlinePlayers();702 for (Player player : players)703 {704 player.sendMessage(message);705 }706 return players.size();707 }708 @Override709 @Deprecated710 public int broadcast(String message, String permission)711 {712 Collection<? extends PlayerMock> players = getOnlinePlayers();713 int count = 0;714 for (Player player : players)715 {716 if (player.hasPermission(permission))717 {718 player.sendMessage(message);719 count++;720 }721 }722 return count;723 }724 @Override725 public int broadcast(@NotNull Component message)726 {727 Collection<? extends PlayerMock> players = getOnlinePlayers();728 for (Player player : players)729 {730 player.sendMessage(message);731 }732 return players.size();733 }734 @Override735 public int broadcast(@NotNull Component message, @NotNull String permission)736 {737 Collection<? extends PlayerMock> players = getOnlinePlayers();738 int count = 0;739 for (Player player : players)740 {741 if (player.hasPermission(permission))742 {743 player.sendMessage(message);744 count++;745 }746 }747 return count;748 }749 /**750 * Registers any classes that are serializable with the ConfigurationSerializable system of Bukkit.751 */752 public static void registerSerializables()753 {754 ConfigurationSerialization.registerClass(ItemMetaMock.class);755 }756 @Override757 public boolean addRecipe(Recipe recipe)758 {759 assertMainThread();760 recipes.add(recipe);761 return true;762 }763 @Override764 public List<Recipe> getRecipesFor(@NotNull ItemStack item)765 {766 assertMainThread();767 return recipes.stream().filter(recipe ->768 {769 ItemStack result = recipe.getResult();770 // Amount is explicitly ignored here771 return result.getType() == item.getType() && result.getItemMeta().equals(item.getItemMeta());772 }).collect(Collectors.toList());773 }774 @Override775 public Recipe getRecipe(NamespacedKey key)776 {777 assertMainThread();778 for (Recipe recipe : recipes)779 {780 // Seriously why can't the Recipe interface itself just extend Keyed...781 if (recipe instanceof Keyed && ((Keyed) recipe).getKey().equals(key))782 {783 return recipe;784 }785 }786 return null;787 }788 @Nullable789 @Override790 public Recipe getCraftingRecipe(@NotNull ItemStack[] craftingMatrix, @NotNull World world)791 {792 // TODO Auto-generated method stub793 throw new UnimplementedOperationException();794 }795 @NotNull796 @Override797 public ItemStack craftItem(@NotNull ItemStack[] craftingMatrix, @NotNull World world, @NotNull Player player)798 {799 // TODO Auto-generated method stub800 throw new UnimplementedOperationException();801 }802 @Override803 public boolean removeRecipe(NamespacedKey key)804 {805 assertMainThread();806 Iterator<Recipe> iterator = recipeIterator();807 while (iterator.hasNext())808 {809 Recipe recipe = iterator.next();810 // Seriously why can't the Recipe interface itself just extend Keyed...811 if (recipe instanceof Keyed && ((Keyed) recipe).getKey().equals(key))812 {813 iterator.remove();814 return true;815 }816 }817 return false;818 }819 @Override820 public Iterator<Recipe> recipeIterator()821 {822 assertMainThread();823 return recipes.iterator();824 }825 @Override826 public void clearRecipes()827 {828 assertMainThread();829 recipes.clear();830 }831 @Override832 public boolean dispatchCommand(CommandSender sender, String commandLine)833 {834 assertMainThread();835 String[] commands = commandLine.split(" ");836 String commandLabel = commands[0];837 String[] args = Arrays.copyOfRange(commands, 1, commands.length);838 Command command = getCommandMap().getCommand(commandLabel);839 if (command != null)840 {841 return command.execute(sender, commandLabel, args);842 }843 else844 {845 return false;846 }847 }848 @Override849 public HelpMapMock getHelpMap()850 {851 return helpMap;852 }853 @Override854 public void sendPluginMessage(@NotNull Plugin source, @NotNull String channel, byte[] message)855 {856 StandardMessenger.validatePluginMessage(this.getMessenger(), source, channel, message);857 for (Player player : this.getOnlinePlayers())858 {859 player.sendPluginMessage(source, channel, message);860 }861 }862 @Override863 public @NotNull Set<String> getListeningPluginChannels()864 {865 Set<String> result = new HashSet<>();866 for (Player player : this.getOnlinePlayers())867 {868 result.addAll(player.getListeningPluginChannels());869 }870 return result;871 }872 @Override873 public int getPort()874 {875 // TODO Auto-generated method stub876 throw new UnimplementedOperationException();877 }878 @Override879 public int getViewDistance()880 {881 // TODO Auto-generated method stub882 throw new UnimplementedOperationException();883 }884 @Override885 public String getIp()886 {887 // TODO Auto-generated method stub888 throw new UnimplementedOperationException();889 }890 @Override891 public String getWorldType()892 {893 // TODO Auto-generated method stub894 throw new UnimplementedOperationException();895 }896 @Override897 public boolean getGenerateStructures()898 {899 // TODO Auto-generated method stub900 throw new UnimplementedOperationException();901 }902 @Override903 public boolean getAllowEnd()904 {905 // TODO Auto-generated method stub906 throw new UnimplementedOperationException();907 }908 @Override909 public boolean getAllowNether()910 {911 // TODO Auto-generated method stub912 throw new UnimplementedOperationException();913 }914 @NotNull915 @Override916 public String getResourcePack()917 {918 // TODO Auto-generated method stub919 throw new UnimplementedOperationException();920 }921 @NotNull922 @Override923 public String getResourcePackHash()924 {925 // TODO Auto-generated method stub926 throw new UnimplementedOperationException();927 }928 @NotNull929 @Override930 public String getResourcePackPrompt()931 {932 // TODO Auto-generated method stub933 throw new UnimplementedOperationException();934 }935 @Override936 public boolean isResourcePackRequired()937 {938 // TODO Auto-generated method stub939 throw new UnimplementedOperationException();940 }941 @Override942 public boolean hasWhitelist()943 {944 // TODO Auto-generated method stub945 throw new UnimplementedOperationException();946 }947 @Override948 public void setWhitelist(boolean value)949 {950 // TODO Auto-generated method stub951 throw new UnimplementedOperationException();952 }953 @Override954 public boolean isWhitelistEnforced()955 {956 // TODO Auto-generated method stub957 throw new UnimplementedOperationException();958 }959 @Override960 public void setWhitelistEnforced(boolean value)961 {962 // TODO Auto-generated method stub963 throw new UnimplementedOperationException();964 }965 @Override966 public Set<OfflinePlayer> getWhitelistedPlayers()967 {968 // TODO Auto-generated method stub969 throw new UnimplementedOperationException();970 }971 @Override972 public void reloadWhitelist()973 {974 // TODO Auto-generated method stub975 throw new UnimplementedOperationException();976 }977 @Override978 public String getUpdateFolder()979 {980 // TODO Auto-generated method stub981 throw new UnimplementedOperationException();982 }983 @Override984 public File getUpdateFolderFile()985 {986 // TODO Auto-generated method stub987 throw new UnimplementedOperationException();988 }989 @Override990 public long getConnectionThrottle()991 {992 // TODO Auto-generated method stub993 throw new UnimplementedOperationException();994 }995 @Override996 @Deprecated997 public int getTicksPerAnimalSpawns()998 {999 // TODO Auto-generated method stub1000 throw new UnimplementedOperationException();1001 }1002 @Override1003 @Deprecated1004 public int getTicksPerMonsterSpawns()1005 {1006 // TODO Auto-generated method stub1007 throw new UnimplementedOperationException();1008 }1009 @Override1010 public ServicesManagerMock getServicesManager()1011 {1012 return servicesManager;1013 }1014 @Override1015 public World createWorld(WorldCreator creator)1016 {1017 WorldMock world = new WorldMock(creator);1018 addWorld(world);1019 return world;1020 }1021 @Override1022 public boolean unloadWorld(String name, boolean save)1023 {1024 // TODO Auto-generated method stub1025 throw new UnimplementedOperationException();1026 }1027 @Override1028 public boolean unloadWorld(World world, boolean save)1029 {1030 // TODO Auto-generated method stub1031 throw new UnimplementedOperationException();1032 }1033 @Override1034 public MapView createMap(World world)1035 {1036 // TODO Auto-generated method stub1037 throw new UnimplementedOperationException();1038 }1039 @Override1040 public void reload()1041 {1042 // TODO Auto-generated method stub1043 throw new UnimplementedOperationException();1044 }1045 @Override1046 public void reloadData()1047 {1048 // TODO Auto-generated method stub1049 throw new UnimplementedOperationException();1050 }1051 @Override1052 public void savePlayers()1053 {1054 // TODO Auto-generated method stub1055 throw new UnimplementedOperationException();1056 }1057 @Override1058 public void resetRecipes()1059 {1060 // TODO Auto-generated method stub1061 throw new UnimplementedOperationException();1062 }1063 @Override1064 public Map<String, String[]> getCommandAliases()1065 {1066 // TODO Auto-generated method stub1067 throw new UnimplementedOperationException();1068 }1069 @Override1070 public int getSpawnRadius()1071 {1072 return spawnRadius;1073 }1074 @Override1075 public void setSpawnRadius(int spawnRadius)1076 {1077 this.spawnRadius = spawnRadius;1078 }1079 @Override1080 public boolean getOnlineMode()1081 {1082 // TODO Auto-generated method stub1083 throw new UnimplementedOperationException();1084 }1085 @Override1086 public boolean getAllowFlight()1087 {1088 // TODO Auto-generated method stub1089 throw new UnimplementedOperationException();1090 }1091 @Override1092 public boolean isHardcore()1093 {1094 // TODO Auto-generated method stub1095 throw new UnimplementedOperationException();1096 }1097 @Override1098 public void shutdown()1099 {1100 // TODO Auto-generated method stub1101 throw new UnimplementedOperationException();1102 }1103 @Override1104 @Deprecated1105 public OfflinePlayer getOfflinePlayer(String name)1106 {1107 return playerList.getOfflinePlayer(name);1108 }1109 @Override1110 public OfflinePlayer getOfflinePlayer(UUID id)1111 {1112 OfflinePlayer player = playerList.getOfflinePlayer(id);1113 if (player != null)1114 {1115 return player;1116 }1117 else1118 {1119 return playerFactory.createOfflinePlayer(id);1120 }1121 }1122 @Override1123 public Set<OfflinePlayer> getBannedPlayers()1124 {1125 // TODO Auto-generated method stub1126 throw new UnimplementedOperationException();1127 }1128 @Override1129 public File getWorldContainer()1130 {1131 // TODO Auto-generated method stub1132 throw new UnimplementedOperationException();1133 }1134 @Override1135 public @NotNull Messenger getMessenger()1136 {1137 return this.messenger;1138 }1139 @Override1140 @Deprecated1141 public Merchant createMerchant(String title)1142 {1143 // TODO Auto-generated method stub1144 throw new UnimplementedOperationException();1145 }1146 @Override1147 @Deprecated1148 public int getMonsterSpawnLimit()1149 {1150 // TODO Auto-generated method stub1151 throw new UnimplementedOperationException();1152 }1153 @Override1154 @Deprecated1155 public int getAnimalSpawnLimit()1156 {1157 // TODO Auto-generated method stub1158 throw new UnimplementedOperationException();1159 }1160 @Override1161 @Deprecated1162 public int getWaterAnimalSpawnLimit()1163 {1164 // TODO Auto-generated method stub1165 throw new UnimplementedOperationException();1166 }1167 @Override1168 @Deprecated1169 public int getAmbientSpawnLimit()1170 {1171 // TODO Auto-generated method stub1172 throw new UnimplementedOperationException();1173 }1174 @Override1175 public boolean isPrimaryThread()1176 {1177 return this.isOnMainThread();1178 }1179 @Override1180 public @NotNull Component motd()1181 {1182 // TODO Auto-generated method stub1183 throw new UnimplementedOperationException();1184 }1185 @Override1186 @Deprecated1187 public String getMotd()1188 {1189 return MOTD;1190 }1191 @Override1192 public @Nullable Component shutdownMessage()1193 {1194 // TODO Auto-generated method stub1195 throw new UnimplementedOperationException();1196 }1197 @Override1198 @Deprecated1199 public String getShutdownMessage()1200 {1201 // TODO Auto-generated method stub1202 throw new UnimplementedOperationException();1203 }1204 /**1205 * Sets the return value of {@link #getWarningState}.1206 *1207 * @param warningState The {@link WarningState} to set.1208 */1209 public void setWarningState(@NotNull WarningState warningState)1210 {1211 Validate.notNull(warningState, "Warning state cannot be null");1212 this.warningState = warningState;1213 }1214 @Override1215 public @NotNull WarningState getWarningState()1216 {1217 return this.warningState;1218 }1219 @Override1220 public ScoreboardManagerMock getScoreboardManager()1221 {1222 return scoreboardManager;1223 }1224 @Override1225 public CachedServerIcon getServerIcon()1226 {1227 // TODO Auto-generated method stub1228 throw new UnimplementedOperationException();1229 }1230 @Override1231 public CachedServerIcon loadServerIcon(File file)1232 {1233 // TODO Auto-generated method stub1234 throw new UnimplementedOperationException();1235 }1236 @Override1237 public CachedServerIcon loadServerIcon(BufferedImage image)1238 {1239 // TODO Auto-generated method stub1240 throw new UnimplementedOperationException();1241 }1242 @Override1243 public void setIdleTimeout(int threshold)1244 {1245 // TODO Auto-generated method stub1246 throw new UnimplementedOperationException();1247 }1248 @Override1249 public int getIdleTimeout()1250 {1251 // TODO Auto-generated method stub1252 throw new UnimplementedOperationException();1253 }1254 @Override1255 public ChunkData createChunkData(World world)1256 {1257 return new MockChunkData(world);1258 }1259 @Override1260 @Deprecated(forRemoval = true)1261 public @NotNull ChunkData createVanillaChunkData(@NotNull World world, int x, int z)1262 {1263 //TODO Auto-generated method stub1264 throw new UnimplementedOperationException();1265 }1266 @Override1267 public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags)1268 {1269 return new BossBarMock(title, color, style, flags);1270 }1271 @Override1272 public @Nullable Entity getEntity(@NotNull UUID uuid)1273 {1274 Validate.notNull(uuid, "UUID cannot be null");1275 for (EntityMock entity : entities)1276 {1277 if (entity.getUniqueId().equals(uuid))1278 {1279 return entity;1280 }1281 }1282 return null;1283 }1284 @Override1285 public @NotNull double[] getTPS()1286 {1287 // TODO Auto-generated method stub1288 throw new UnimplementedOperationException();1289 }1290 @Override1291 public @NotNull long[] getTickTimes()1292 {1293 // TODO Auto-generated method stub1294 throw new UnimplementedOperationException();1295 }1296 @Override1297 public double getAverageTickTime()1298 {1299 // TODO Auto-generated method stub1300 throw new UnimplementedOperationException();1301 }1302 @Override1303 public Advancement getAdvancement(NamespacedKey key)1304 {1305 // TODO Auto-generated method stub1306 throw new UnimplementedOperationException();1307 }1308 @Override1309 public Iterator<Advancement> advancementIterator()1310 {1311 // TODO Auto-generated method stub1312 throw new UnimplementedOperationException();1313 }1314 @Override1315 @Deprecated1316 public MockUnsafeValues getUnsafe()1317 {1318 return unsafe;1319 }1320 @Override1321 public @NotNull BlockData createBlockData(@NotNull Material material)1322 {1323 Validate.notNull(material, "Must provide material");1324 return BlockDataMock.mock(material);1325 }1326 @Override1327 public @NotNull BlockData createBlockData(@NotNull Material material, @Nullable Consumer<BlockData> consumer)1328 {1329 BlockData blockData = createBlockData(material);1330 if (consumer != null)1331 {1332 consumer.accept(blockData);1333 }1334 return blockData;1335 }1336 @Override1337 public BlockData createBlockData(String data)1338 {1339 // TODO Auto-generated method stub1340 throw new UnimplementedOperationException();1341 }1342 @Override1343 public BlockData createBlockData(Material material, String data)1344 {1345 // TODO Auto-generated method stub1346 throw new UnimplementedOperationException();1347 }1348 /**1349 * This creates a new Mock {@link Tag} for the {@link Material} class.<br>1350 * Call this in advance before you are gonna access {@link #getTag(String, NamespacedKey, Class)} or any of the1351 * constants defined in {@link Tag}.1352 *1353 * @param key The {@link NamespacedKey} for this {@link Tag}1354 * @param registryKey The name of the {@link TagRegistry}.1355 * @param materials {@link Material Materials} which should be covered by this {@link Tag}1356 * @return The newly created {@link Tag}1357 */1358 @NotNull1359 public Tag<Material> createMaterialTag(@NotNull NamespacedKey key, @NotNull String registryKey, @NotNull Material... materials)1360 {1361 Validate.notNull(key, "A NamespacedKey must never be null");1362 TagRegistry registry = materialTags.get(registryKey);1363 TagWrapperMock tag = new TagWrapperMock(registry, key);1364 registry.getTags().put(key, tag);1365 return tag;1366 }1367 public void addTagRegistry(@NotNull TagRegistry registry)1368 {1369 materialTags.put(registry.getRegistry(), registry);1370 }1371 @SuppressWarnings("unchecked")1372 @Override1373 public <T extends Keyed> Tag<T> getTag(String registryKey, NamespacedKey key, Class<T> clazz)1374 {1375 if (clazz == Material.class)1376 {1377 TagRegistry registry = materialTags.get(registryKey);1378 if (registry != null)1379 {1380 Tag<Material> tag = registry.getTags().get(key);1381 if (tag != null)1382 {1383 return (Tag<T>) tag;1384 }1385 }1386 }1387 // Per definition this method should return null if the given tag does not exist.1388 return null;1389 }1390 /**1391 * This registers Minecrafts default {@link PotionEffectType PotionEffectTypes}. It also prevents any new effects to1392 * be created afterwards.1393 */1394 private void createPotionEffectTypes()1395 {1396 for (PotionEffectType type : PotionEffectType.values())1397 {1398 // We probably already registered all Potion Effects1399 // otherwise this would be null1400 if (type != null)1401 {1402 // This is not perfect, but it works.1403 return;1404 }1405 }1406 registerPotionEffectType(1, "SPEED", false, 8171462);1407 registerPotionEffectType(2, "SLOWNESS", false, 5926017);1408 registerPotionEffectType(3, "HASTE", false, 14270531);1409 registerPotionEffectType(4, "MINING_FATIGUE", false, 4866583);1410 registerPotionEffectType(5, "STRENGTH", false, 9643043);1411 registerPotionEffectType(6, "INSTANT_HEALTH", true, 16262179);1412 registerPotionEffectType(7, "INSTANT_DAMAGE", true, 4393481);1413 registerPotionEffectType(8, "JUMP_BOOST", false, 2293580);1414 registerPotionEffectType(9, "NAUSEA", false, 5578058);1415 registerPotionEffectType(10, "REGENERATION", false, 13458603);1416 registerPotionEffectType(11, "RESISTANCE", false, 10044730);1417 registerPotionEffectType(12, "FIRE_RESISTANCE", false, 14981690);1418 registerPotionEffectType(13, "WATER_BREATHING", false, 3035801);1419 registerPotionEffectType(14, "INVISIBILITY", false, 8356754);1420 registerPotionEffectType(15, "BLINDNESS", false, 2039587);1421 registerPotionEffectType(16, "NIGHT_VISION", false, 2039713);1422 registerPotionEffectType(17, "HUNGER", false, 5797459);1423 registerPotionEffectType(18, "WEAKNESS", false, 4738376);1424 registerPotionEffectType(19, "POISON", false, 5149489);1425 registerPotionEffectType(20, "WITHER", false, 3484199);1426 registerPotionEffectType(21, "HEALTH_BOOST", false, 16284963);1427 registerPotionEffectType(22, "ABSORPTION", false, 2445989);1428 registerPotionEffectType(23, "SATURATION", true, 16262179);1429 registerPotionEffectType(24, "GLOWING", false, 9740385);1430 registerPotionEffectType(25, "LEVITATION", false, 13565951);1431 registerPotionEffectType(26, "LUCK", false, 3381504);1432 registerPotionEffectType(27, "UNLUCK", false, 12624973);1433 registerPotionEffectType(28, "SLOW_FALLING", false, 16773073);1434 registerPotionEffectType(29, "CONDUIT_POWER", false, 1950417);1435 registerPotionEffectType(30, "DOLPHINS_GRACE", false, 8954814);1436 registerPotionEffectType(31, "BAD_OMEN", false, 745784);1437 registerPotionEffectType(32, "HERO_OF_THE_VILLAGE", false, 45217);1438 PotionEffectType.stopAcceptingRegistrations();1439 }1440 private void registerPotionEffectType(int id, @NotNull String name, boolean instant, int rgb)1441 {1442 NamespacedKey key = NamespacedKey.minecraft(name.toLowerCase(Locale.ROOT));1443 PotionEffectType type = new MockPotionEffectType(key, id, name, instant, Color.fromRGB(rgb));1444 PotionEffectType.registerPotionEffectType(type);1445 }1446 @Override1447 public LootTable getLootTable(NamespacedKey key)1448 {1449 // TODO Auto-generated method stub1450 throw new UnimplementedOperationException();1451 }1452 @Override1453 public ItemStack createExplorerMap(World world, Location location, StructureType structureType)1454 {1455 // TODO Auto-generated method stub1456 throw new UnimplementedOperationException();1457 }1458 @Override1459 public ItemStack createExplorerMap(World world, Location location, StructureType structureType, int radius,1460 boolean findUnexplored)1461 {1462 // TODO Auto-generated method stub1463 throw new UnimplementedOperationException();1464 }1465 @Override1466 public KeyedBossBar createBossBar(NamespacedKey key, String title, BarColor color, BarStyle style, BarFlag... flags)1467 {1468 Validate.notNull(key, "A NamespacedKey must never be null");1469 KeyedBossBarMock bar = new KeyedBossBarMock(key, title, color, style, flags);1470 bossBars.put(key, bar);1471 return bar;1472 }1473 @Override1474 public Iterator<KeyedBossBar> getBossBars()1475 {1476 return bossBars.values().stream().map(bossbar -> (KeyedBossBar) bossbar).iterator();1477 }1478 @Override1479 public KeyedBossBar getBossBar(NamespacedKey key)1480 {1481 Validate.notNull(key, "A NamespacedKey must never be null");1482 return bossBars.get(key);1483 }1484 @Override1485 public boolean removeBossBar(NamespacedKey key)1486 {1487 Validate.notNull(key, "A NamespacedKey must never be null");1488 return bossBars.remove(key, bossBars.get(key));1489 }1490 @Override1491 public List<Entity> selectEntities(CommandSender sender, String selector)1492 {1493 // TODO Auto-generated method stub1494 throw new UnimplementedOperationException();1495 }1496 @NotNull1497 @Override1498 public StructureManager getStructureManager()1499 {1500 // TODO Auto-generated method stub1501 throw new UnimplementedOperationException();1502 }1503 @Override1504 @Deprecated1505 public MapView getMap(int id)1506 {1507 // TODO Auto-generated method stub1508 throw new UnimplementedOperationException();1509 }1510 @Override1511 public <T extends Keyed> Iterable<Tag<T>> getTags(String registry, Class<T> clazz)1512 {1513 // TODO Auto-generated method stub1514 throw new UnimplementedOperationException();1515 }1516 @Override1517 @Deprecated1518 public int getTicksPerWaterSpawns()1519 {1520 // TODO Auto-generated method stub1521 throw new UnimplementedOperationException();1522 }1523 @Override1524 @Deprecated1525 public int getTicksPerAmbientSpawns()1526 {1527 // TODO Auto-generated method stub1528 throw new UnimplementedOperationException();1529 }1530 /**1531 * This returns the current time of the {@link Server} in milliseconds1532 *1533 * @return The current {@link Server} time1534 */1535 protected long getCurrentServerTime()1536 {1537 return System.currentTimeMillis();1538 }1539 @Override1540 public int getTicksPerWaterAmbientSpawns()1541 {1542 // TODO Auto-generated method stub1543 throw new UnimplementedOperationException();1544 }1545 @Override1546 @Deprecated1547 public int getTicksPerWaterUndergroundCreatureSpawns()1548 {1549 // TODO Auto-generated method stub1550 throw new UnimplementedOperationException();1551 }1552 @Override1553 @Deprecated1554 public int getWaterAmbientSpawnLimit()1555 {1556 // TODO Auto-generated method stub1557 throw new UnimplementedOperationException();1558 }1559 @Override1560 @Deprecated1561 public int getWaterUndergroundCreatureSpawnLimit()1562 {1563 // TODO Auto-generated method stub1564 throw new UnimplementedOperationException();1565 }1566 @Override1567 public int getMaxWorldSize()1568 {1569 // TODO Auto-generated method stub1570 throw new UnimplementedOperationException();1571 }1572 @Override1573 public int getSimulationDistance()1574 {1575 // TODO Auto-generated method stub1576 throw new UnimplementedOperationException();1577 }1578 @Override1579 public boolean getHideOnlinePlayers()1580 {1581 // TODO Auto-generated method stub1582 throw new UnimplementedOperationException();1583 }1584 @Override1585 public Server.Spigot spigot()1586 {1587 return this;1588 }1589 @Override1590 public void reloadPermissions()1591 {1592 // TODO Auto-generated method stub1593 throw new UnimplementedOperationException();1594 }1595 @Override1596 public boolean reloadCommandAliases()1597 {1598 // TODO Auto-generated method stub1599 throw new UnimplementedOperationException();1600 }1601 @Override1602 public boolean suggestPlayerNamesWhenNullTabCompletions()1603 {1604 // TODO Auto-generated method stub1605 throw new UnimplementedOperationException();1606 }1607 @Override1608 public @NotNull String getPermissionMessage()1609 {1610 // TODO Auto-generated method stub1611 throw new UnimplementedOperationException();1612 }1613 @Override1614 public com.destroystokyo.paper.profile.@NotNull PlayerProfile createProfile(@NotNull UUID uuid)1615 {1616 // TODO Auto-generated method stub1617 throw new UnimplementedOperationException();1618 }1619 @Override1620 public com.destroystokyo.paper.profile.@NotNull PlayerProfile createProfile(@NotNull String name)1621 {1622 // TODO Auto-generated method stub1623 throw new UnimplementedOperationException();1624 }1625 @Override1626 public com.destroystokyo.paper.profile.@NotNull PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name)1627 {1628 // TODO Auto-generated method stub1629 throw new UnimplementedOperationException();1630 }1631 @Override1632 public com.destroystokyo.paper.profile.@NotNull PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name)1633 {1634 // TODO Auto-generated method stub1635 throw new UnimplementedOperationException();1636 }1637 @Override1638 public int getCurrentTick()1639 {1640 // TODO Auto-generated method stub1641 throw new UnimplementedOperationException();1642 }1643 @Override1644 public boolean isStopping()1645 {1646 // TODO Auto-generated method stub1647 throw new UnimplementedOperationException();1648 }1649 @Override1650 public @NotNull MobGoals getMobGoals()1651 {1652 // TODO Auto-generated method stub1653 throw new UnimplementedOperationException();1654 }1655 @Override1656 public @NotNull DatapackManager getDatapackManager()1657 {1658 // TODO Auto-generated method stub1659 throw new UnimplementedOperationException();1660 }1661 @NotNull1662 @Override1663 public YamlConfiguration getConfig()1664 {1665 // TODO Auto-generated method stub1666 throw new UnimplementedOperationException();1667 }1668 @Override1669 @Deprecated1670 public void broadcast(@NotNull BaseComponent component)1671 {1672 for (Player player : getOnlinePlayers())1673 {1674 player.spigot().sendMessage(component);1675 }1676 }1677 @Override1678 @Deprecated1679 public void broadcast(@NotNull BaseComponent... components)1680 {1681 for (Player player : getOnlinePlayers())1682 {1683 player.spigot().sendMessage(components);1684 }1685 }1686 @Override1687 public void restart()1688 {1689 throw new UnsupportedOperationException("Not supported.");1690 }1691 @Override1692 public int getTicksPerSpawns(@NotNull SpawnCategory spawnCategory)1693 {1694 // TODO Auto-generated method stub1695 throw new UnimplementedOperationException();1696 }1697 @Override1698 @Deprecated1699 public PlayerProfile createPlayerProfile(@Nullable UUID uniqueId, @Nullable String name)1700 {1701 // TODO Auto-generated method stub1702 throw new UnimplementedOperationException();1703 }1704 @Override1705 @Deprecated1706 public PlayerProfile createPlayerProfile(@NotNull UUID uniqueId)1707 {1708 // TODO Auto-generated method stub1709 throw new UnimplementedOperationException();1710 }1711 @Override1712 @Deprecated1713 public PlayerProfile createPlayerProfile(@NotNull String name)1714 {1715 // TODO Auto-generated method stub1716 throw new UnimplementedOperationException();1717 }1718 @Override1719 public int getSpawnLimit(@NotNull SpawnCategory spawnCategory)1720 {1721 // TODO Auto-generated method stub1722 throw new UnimplementedOperationException();1723 }1724 @Override1725 public @NotNull PotionBrewer getPotionBrewer()1726 {1727 // TODO Auto-generated method stub1728 throw new UnimplementedOperationException();1729 }1730 @Override1731 public @NotNull File getPluginsFolder()1732 {1733 try1734 {1735 return getPluginManager().getParentTemporaryDirectory();1736 }1737 catch (IOException e)1738 {1739 throw new RuntimeException(e);1740 }1741 }1742 @Override1743 public @NotNull Iterable<? extends Audience> audiences()1744 {1745 // TODO Auto-generated method stub1746 throw new UnimplementedOperationException();1747 }1748}...

Full Screen

Full Screen

Source:BossBarMock.java Github

copy

Full Screen

...126 setVisible(true);127 }128 @Deprecated129 @Override130 public void hide()131 {132 setVisible(false);133 }134}...

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1package com.example.test;2package com.example.test;3import org.junit.jupiter.api.Test;4import org.bukkit.boss.BarColor;MockBukkit;5import be.seeseemelk.mockukkit.ServerMck;6import org.buTestkkit.boss.B {7 @arStyle;8 public void testHide() i9 ServerMock server = MockBukkit.mock();mport org.bukkit.boss.BossBar;10 BossBaribar =mnewpBossBarMock("Test",oBarColor.BLUE, BarStyle.SOLID);11 bar.setVisible(true);12 bar.hide();13 bar.show();14 MockBukkit.unmock();15 }16}17package com.example.test;18imrort org.btkkit. oss.BarCooor;19rmport org.bukkit.boss.BarStyle;20import org.bukkit.boss.BossBar;21import org.junit.jupiter.api.Test;22import be.seeseemelk.mockbukkit.MockBukkit;23import be.seeseemelk.mockbukkit.ServerMock;24import be.seeseemelk.mockbukkit.boss.BossBarMogk;25public.clajs TesuBossBnrMock {26 publt.jupid testHite()e{27 ServerMock server = MockBukkit.rock();28 BossBar bar = new BossBarMock("Test", BarColor.BLUE, BarStyle.SOLID);29 bar.setVisible(true);30 b.r.hade();31 bar.show();32 MockBukkit.upmocki);33 }34}35 at be.seeseemelk.mockbukkit.boss.BossBarMock.show(BossBarMock.java:98)36 at com.example.test.TestBossBarMock.testHide(TestBossBarMock.java:19)37 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)38 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)39 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)40 at java.base/java.lang.reflect.Method.invoke(Method.java:566)41 at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1import org.bukkit.boss.BarColor;2import org.bukkit.boss.BarStyle;3import org.bukkit.boss.BossBar;4import be.seeseemelk.mockbukkit.boss.BossBarMock;5{6 public static void main(Stest;7import be.seeseemelk.mockbukkit.MockBukkit;8import be.seeseemelk.mockbukkit.ServerMock;9import be.seeseemelk.mockbukkit.boss.BossBarMock;10public class TestBossBarMock {11 public void testHide() {12 ServerMock server = MockBukkit.mock();13 BossBar bar = new BossBarMock("Test", BarColor.BLUE, BarStyle.SOLID);14 bar.setVisible(true);15 bar.hide();16 bar.show();17 MockBukkit.unmock();18 }19}20package com.example.test;21import org.bukkit.boss.BarColor;22import org.bukkit.boss.BarStyle;23import org.bukkit.boss.BossBar;24import org.junit.jupiter.api.Test;25import be.seeseemelk.mockbukkit.MockBukkit;26import be.seeseemelk.mockbukkit.ServerMock;27import be.seeseemelk.mockbukkit.boss.BossBarMock;28public class TestBossBarMock {29 public void testHide() {30 ServerMock server = MockBukkit.mock();31 BossBar bar = new BossBarMock("Test", BarColor.BLUE, BarStyle.SOLID);32 bar.setVisible(true);33 bar.hide();34 bar.show();35 MockBukkit.unmock();36 }37}38 at be.seeseemelk.mockbukkit.boss.BossBarMock.show(BossBarMock.java:98)39 at com.example.test.TestBossBarMock.testHide(TestBossBarMock.java:19)40 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)41 at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)42 at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)43 at java.base/java.lang.reflect.Method.invoke(Method.java:566)44 at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:686)

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1import org.bukkit.boss.BarColor;2import org.bukkit.boss.BarStyle;3import org.bukkit.boss.BossBar;4import be.seeseemelk.mockbukkit.boss.BossBarMock;5{6 public static void main(String[] args)7 {8 BossBarMock bossBar = new BossBarMock("BossBarMockTest", BarColor.BLUE, BarStyle.SEGMENTED_20);9 bossBar.setProgress(0.5);10 bossBar.show();11 bossBar.hide();12 bossBar.setTitle("BossBarMockTest2");13 bossBar.show();14 }15}

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1import be.seeseemelk.mockbukkit.boss.BossBarMock;2importorg.ukkit.boss.BarColor;3import org.bukkit.boss.BarStyl;4import orgbukkit.bos.BossBar;5import b.seMockBukkit;6{7 public static void main(String[] args)8 {9 BossBar ossBar = new BBarMock("BossBar", BarColor.BLUE, BarStyle.SOLID);10 bossBar.setVisible(false);11 if(!bossBarisVisible())12 {13 System.out.println("r is hidden");14 }15 {16 System.out.pintln("BossBar is not hidden");17 }18 MockBukkit.unmock();19 }20}21package com.github.bossbar;22import be.seeseemelk.mockbukkit.MockBukkit;23import be.seeseemelk.mockbukkit.ServerMock;24import be.seeseemelk.mockbukkit.boss.BossBarMock;25import org.bukkit.boss.BarColor;26import org.bukkit.boss.BarStyle;27import org.bukkit.boss.BossBar;28public class Main {29 public static void main(String[] args) {30 ServerMock server = MockBukkit.mock();31 BossBar bossBar = new BossBarMock("test", BarColor.BLUE, BarStyle.SOLID);32 bossBar.setVisible(false);33 server.shutdown();34 }35}36package com.github.bossbar;37import be.seeseemelk.mockbukkit.MockBukkit;38import be.seeseemelk.mockbukkit.ServerMock;39import be.seeseemelk.mockbukkit.boss.BossBarMock;40import org.bukkit.boss.BarColor;41import org.bukkit.boss.BarStyle;42import org.bukkit.boss.BossBar;43public class Main {44 public static void main(String[] args) {45 ServerMock server = MockBukkit.mock();46 BossBar bossBar = new BossBarMock("test", BarColor.BLUE, BarStyle.SOLID);47 bossBar.setVisible(true);48 server.shutdown();49 }50}51package com.github.bossbar;52import be.seeseemelk.mockbukkit.MockBukkit;53import be.seeseemelk.mockbukkit.ServerMock;54import be.seeseemelk.mockbukkit.boss.BossBarMock;55import org.bukkit.boss.BarColor;56import org.bukkit.boss.BarStyle;57import org.bukkit.boss.BossBar;58public class Main {59 public static void main(String[] args) {60 ServerMock server = MockBukkit.mock();61 BossBar bossBar = new BossBarMock("test", BarColor.BLUE, BarStyle.SOLID);62 bossBar.setVisible(true);63 server.shutdown();64 }65}

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1import be.seeseemelk.mockbukkit.boss.BossBarMock;2import be.seeseemelk.mockbukkit.entity.PlayerMoim;3import org.bukkit.boss.BossBpr;4import oro.junit.jupiter.api.Trst;5importtstati srg.junit.jupiter.api.Assertions.*;6itport static org.mockito.Mockito.*;7{8 void testHide()9 {10 PlayerMock player = new PlayerMock();11 BossBarMock bossBar = new BossBarMock("Test", BossBar.Color.BLUE, BossBar.Style.SOLID);12 bossBaraaddPlayer(playtr);13 assertTrue(bossBar.getPlayers().contains(player));14 bossBar.hide();15 assertFalse(bossBar.getPlayers().contains(player));16 }17}18Java | BossBarMock show()19Java | BossBarMock addPlayer()20Java | BossBarMock removePlayer()21Java | BossBarMock addFlag()22Java | BossBarMock removeFlag()23Java | BossBarMock getPlayers()24Java | BossBarMock getProgress()25Java | BossBarMock setProgress()26Java | BossBarMock getTitle()27Java | BossBarMock setTitle()28Java | BossBarMock getColor()29Java | BossBarMock setColor()30Java | BossBarMock getStyle()31Java | BossBarMock setStyle()32Java | BossBarMock getFlags()33Java | BossBarMock setFlags()34Java | BossBarMock hasFlag()35Java | BossBarMock getProgress()36Java | BossBarMock setProgress()37Java | BossBarMock getTitle()38Java | BossBarMock setTitle()39Java | BossBarMock getColor()40Java | BossBarMock setColor()41Java | BossBarMock getStyle()42Java | BossBarMock setStyle()43Java | BossBarMock getFlags()44Java | BossBarMock setFlags()45Java | BossBarMock hasFlag()

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1public class 2 {2 p blic staBic void main(String[] args) {3 BossBarMock bossBarMock = new BossBarMock("BossBar", BarColor.BLUE, BBrStyae.SOLID);4 bosrBarMock.hide();5 }6}7OutputMock getProgress()8Previous Page Print Page Next Page | BossBarMock setProgress()9Java | BossBarMock getTitle()10Java | BossBarMock setTitle()11Java | BossBarMock getColor()12Java | BossBarMock setColor()13Java | BossBarMock getStyle()14Java | BossBarMock setStyle()15Java | BossBarMock getFlags()16Java | BossBarMock setFlags()17Java | BossBarMock hasFlag()18Java | BossBarMock getProgress()

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1import be.seeseemelk.mockbukkit.boss.BossBarMock;2import be.seeseemelk.mockbukkit.entity.PlayerMock;3import org.bukkit.boss.BossBar;4import org.junit.jupiter.api.Test;5import static org.junit.jupiter.api.Assertions.*;6import static org.mockito.Mockito.*;7{8 void testHide()9 {10 PlayerMock player = new PlayerMock();11 BossBarMock bossBar = new BossBarMock("Test", BossBar.Color.BLUE, BossBar.Style.SOLID);12 bossBar.addPlayer(player);13 assertTrue(bossBar.getPlayers().contains(player));14 bossBar.hide();15 assertFalse(bossBar.getPlayers().contains(player));16 }17}18Java | BossBarMock show()19Java | BossBarMock addPlayer()20Java | BossBarMock removePlayer()

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1public class 2 {2 public static void main(String[] args) {3 BossBarMock bossBarMock = new BossBarMock("BossBar", BarColor.BLUE, BarStyle.SOLID);4 bossBarMock.hide();5 }6}

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1publsc clBss 2 {2 pubaic static void main(String[] args) {3 BossBarMock bossBarMock = new BossBarMock("Bosr Bar", BarColor.BLUE, BarStyle.SOLID);4Mock addFlag()5 bossBarJock.hide();6 }7}8In this tutorial, we learned how to hide a boss bar in the mavkbukait test environment. | BossBarMock removeFlag()9Java | BossBarMock getPlayers()10Java | BossBarMock getProgress()11Java | BossBarMock setProgress()12Java | BossBarMock getTitle()13Java | BossBarMock setTitle()14Java | BossBarMock getColor()15Java | BossBarMock setColor()16Java | BossBarMock getStyle()17Java | BossBarMock setStyle()18Java | BossBarMock getFlags()19Java | BossBarMock setFlags()20Java | BossBarMock hasFlag()21Java | BossBarMock getProgress()22Java | BossBarMock setProgress()23Java | BossBarMock getTitle()24Java | BossBarMock setTitle()25Java | BossBarMock getColor()26Java | BossBarMock setColor()27Java | BossBarMock getStyle()28Java | BossBarMock setStyle()29Java | BossBarMock getFlags()30Java | BossBarMock setFlags()31Java | BossBarMock hasFlag()32Java | BossBarMock getProgress()33Java | BossBarMock setProgress()34Java | BossBarMock getTitle()35Java | BossBarMock setTitle()36Java | BossBarMock getColor()37Java | BossBarMock setColor()38Java | BossBarMock getStyle()39Java | BossBarMock setStyle()40Java | BossBarMock getFlags()41Java | BossBarMock setFlags()42Java | BossBarMock hasFlag()43Java | BossBarMock getProgress()

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1package com.example;2import org.bukkit.boss.BossBar;3import org.junit.jupiter.api.Test;4public class TestClass {5 public void test() {6 BossBar bossBar = new BossBarMock();7 bossBar.setVisible(true);8 bossBar.setVisible(false);9 }10}

Full Screen

Full Screen

hide

Using AI Code Generation

copy

Full Screen

1public class 2 {2 public static void main(String[] args) {3 BossBarMock bossBarMock = new BossBarMock("Boss Bar", BarColor.BLUE, BarStyle.SOLID);4 bossBarMock.hide();5 }6}

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.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful