001 package org.bukkit; 002 003 import java.awt.image.BufferedImage; 004 import java.io.File; 005 import java.io.Serializable; 006 import java.util.Collection; 007 import java.util.Collections; 008 import java.util.Iterator; 009 import java.util.List; 010 import java.util.Map; 011 import java.util.Set; 012 import java.util.UUID; 013 import java.util.logging.Logger; 014 015 import org.bukkit.Warning.WarningState; 016 import org.bukkit.command.CommandException; 017 import org.bukkit.command.CommandSender; 018 import org.bukkit.command.ConsoleCommandSender; 019 import org.bukkit.command.PluginCommand; 020 import org.bukkit.entity.Entity; 021 import org.bukkit.entity.Player; 022 import org.bukkit.event.inventory.InventoryType; 023 import org.bukkit.event.server.ServerListPingEvent; 024 import org.bukkit.help.HelpMap; 025 import org.bukkit.inventory.Inventory; 026 import org.bukkit.inventory.InventoryHolder; 027 import org.bukkit.inventory.ItemStack; 028 import org.bukkit.inventory.Recipe; 029 import org.bukkit.map.MapView; 030 import org.bukkit.permissions.Permissible; 031 import org.bukkit.plugin.PluginManager; 032 import org.bukkit.plugin.ServicesManager; 033 import org.bukkit.plugin.messaging.Messenger; 034 import org.bukkit.plugin.messaging.PluginMessageRecipient; 035 import org.bukkit.scheduler.BukkitScheduler; 036 import org.bukkit.scoreboard.ScoreboardManager; 037 import org.bukkit.util.CachedServerIcon; 038 039 import com.avaje.ebean.config.ServerConfig; 040 import com.google.common.collect.ImmutableList; 041 042 import org.bukkit.inventory.ItemFactory; 043 import org.bukkit.inventory.meta.ItemMeta; 044 045 /** 046 * Represents a server implementation. 047 */ 048 public interface Server extends PluginMessageRecipient { 049 050 /** 051 * Used for all administrative messages, such as an operator using a 052 * command. 053 * <p> 054 * For use in {@link #broadcast(java.lang.String, java.lang.String)}. 055 */ 056 public static final String BROADCAST_CHANNEL_ADMINISTRATIVE = "bukkit.broadcast.admin"; 057 058 /** 059 * Used for all announcement messages, such as informing users that a 060 * player has joined. 061 * <p> 062 * For use in {@link #broadcast(java.lang.String, java.lang.String)}. 063 */ 064 public static final String BROADCAST_CHANNEL_USERS = "bukkit.broadcast.user"; 065 066 /** 067 * Gets the name of this server implementation. 068 * 069 * @return name of this server implementation 070 */ 071 public String getName(); 072 073 /** 074 * Gets the version string of this server implementation. 075 * 076 * @return version of this server implementation 077 */ 078 public String getVersion(); 079 080 /** 081 * Gets the Bukkit version that this server is running. 082 * 083 * @return version of Bukkit 084 */ 085 public String getBukkitVersion(); 086 087 /** 088 * Gets an array copy of all currently logged in players. 089 * <p> 090 * This method exists for legacy reasons to provide backwards 091 * compatibility. It will not exist at runtime and should not be used 092 * under any circumstances. 093 * 094 * @Deprecated superseded by {@link #getOnlinePlayers()} 095 * @return an array of Players that are currently online 096 */ 097 @Deprecated 098 public Player[] _INVALID_getOnlinePlayers(); 099 100 /** 101 * Gets a view of all currently logged in players. This {@linkplain 102 * Collections#unmodifiableCollection(Collection) view} is a reused 103 * object, making some operations like {@link Collection#size()} 104 * zero-allocation. 105 * <p> 106 * The collection is a view backed by the internal representation, such 107 * that, changes to the internal state of the server will be reflected 108 * immediately. However, the reuse of the returned collection (identity) 109 * is not strictly guaranteed for future or all implementations. Casting 110 * the collection, or relying on interface implementations (like {@link 111 * Serializable} or {@link List}), is deprecated. 112 * <p> 113 * Iteration behavior is undefined outside of self-contained main-thread 114 * uses. Normal and immediate iterator use without consequences that 115 * affect the collection are fully supported. The effects following 116 * (non-exhaustive) {@link Entity#teleport(Location) teleportation}, 117 * {@link Player#setHealth(double) death}, and {@link Player#kickPlayer( 118 * String) kicking} are undefined. Any use of this collection from 119 * asynchronous threads is unsafe. 120 * <p> 121 * For safe consequential iteration or mimicking the old array behavior, 122 * using {@link Collection#toArray(Object[])} is recommended. For making 123 * snapshots, {@link ImmutableList#copyOf(Collection)} is recommended. 124 * 125 * @return a view of currently online players. 126 */ 127 public Collection<? extends Player> getOnlinePlayers(); 128 129 /** 130 * Get the maximum amount of players which can login to this server. 131 * 132 * @return the amount of players this server allows 133 */ 134 public int getMaxPlayers(); 135 136 /** 137 * Get the game port that the server runs on. 138 * 139 * @return the port number of this server 140 */ 141 public int getPort(); 142 143 /** 144 * Get the view distance from this server. 145 * 146 * @return the view distance from this server. 147 */ 148 public int getViewDistance(); 149 150 /** 151 * Get the IP that this server is bound to, or empty string if not 152 * specified. 153 * 154 * @return the IP string that this server is bound to, otherwise empty 155 * string 156 */ 157 public String getIp(); 158 159 /** 160 * Get the name of this server. 161 * 162 * @return the name of this server 163 */ 164 public String getServerName(); 165 166 /** 167 * Get an ID of this server. The ID is a simple generally alphanumeric ID 168 * that can be used for uniquely identifying this server. 169 * 170 * @return the ID of this server 171 */ 172 public String getServerId(); 173 174 /** 175 * Get world type (level-type setting) for default world. 176 * 177 * @return the value of level-type (e.g. DEFAULT, FLAT, DEFAULT_1_1) 178 */ 179 public String getWorldType(); 180 181 /** 182 * Get generate-structures setting. 183 * 184 * @return true if structure generation is enabled, false otherwise 185 */ 186 public boolean getGenerateStructures(); 187 188 /** 189 * Gets whether this server allows the End or not. 190 * 191 * @return whether this server allows the End or not 192 */ 193 public boolean getAllowEnd(); 194 195 /** 196 * Gets whether this server allows the Nether or not. 197 * 198 * @return whether this server allows the Nether or not 199 */ 200 public boolean getAllowNether(); 201 202 /** 203 * Gets whether this server has a whitelist or not. 204 * 205 * @return whether this server has a whitelist or not 206 */ 207 public boolean hasWhitelist(); 208 209 /** 210 * Sets if the server is whitelisted. 211 * 212 * @param value true for whitelist on, false for off 213 */ 214 public void setWhitelist(boolean value); 215 216 /** 217 * Gets a list of whitelisted players. 218 * 219 * @return a set containing all whitelisted players 220 */ 221 public Set<OfflinePlayer> getWhitelistedPlayers(); 222 223 /** 224 * Reloads the whitelist from disk. 225 */ 226 public void reloadWhitelist(); 227 228 /** 229 * Broadcast a message to all players. 230 * <p> 231 * This is the same as calling {@link #broadcast(java.lang.String, 232 * java.lang.String)} to {@link #BROADCAST_CHANNEL_USERS} 233 * 234 * @param message the message 235 * @return the number of players 236 */ 237 public int broadcastMessage(String message); 238 239 /** 240 * Gets the name of the update folder. The update folder is used to safely 241 * update plugins at the right moment on a plugin load. 242 * <p> 243 * The update folder name is relative to the plugins folder. 244 * 245 * @return the name of the update folder 246 */ 247 public String getUpdateFolder(); 248 249 /** 250 * Gets the update folder. The update folder is used to safely update 251 * plugins at the right moment on a plugin load. 252 * 253 * @return the update folder 254 */ 255 public File getUpdateFolderFile(); 256 257 /** 258 * Gets the value of the connection throttle setting. 259 * 260 * @return the value of the connection throttle setting 261 */ 262 public long getConnectionThrottle(); 263 264 /** 265 * Gets default ticks per animal spawns value. 266 * <p> 267 * <b>Example Usage:</b> 268 * <ul> 269 * <li>A value of 1 will mean the server will attempt to spawn monsters 270 * every tick. 271 * <li>A value of 400 will mean the server will attempt to spawn monsters 272 * every 400th tick. 273 * <li>A value below 0 will be reset back to Minecraft's default. 274 * </ul> 275 * <p> 276 * <b>Note:</b> If set to 0, animal spawning will be disabled. We 277 * recommend using spawn-animals to control this instead. 278 * <p> 279 * Minecraft default: 400. 280 * 281 * @return the default ticks per animal spawns value 282 */ 283 public int getTicksPerAnimalSpawns(); 284 285 /** 286 * Gets the default ticks per monster spawns value. 287 * <p> 288 * <b>Example Usage:</b> 289 * <ul> 290 * <li>A value of 1 will mean the server will attempt to spawn monsters 291 * every tick. 292 * <li>A value of 400 will mean the server will attempt to spawn monsters 293 * every 400th tick. 294 * <li>A value below 0 will be reset back to Minecraft's default. 295 * </ul> 296 * <p> 297 * <b>Note:</b> If set to 0, monsters spawning will be disabled. We 298 * recommend using spawn-monsters to control this instead. 299 * <p> 300 * Minecraft default: 1. 301 * 302 * @return the default ticks per monsters spawn value 303 */ 304 public int getTicksPerMonsterSpawns(); 305 306 /** 307 * Gets a player object by the given username. 308 * <p> 309 * This method may not return objects for offline players. 310 * 311 * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer 312 * guaranteed to be unique 313 * @param name the name to look up 314 * @return a player if one was found, null otherwise 315 */ 316 @Deprecated 317 public Player getPlayer(String name); 318 319 /** 320 * Gets the player with the exact given name, case insensitive. 321 * 322 * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer 323 * guaranteed to be unique 324 * @param name Exact name of the player to retrieve 325 * @return a player object if one was found, null otherwise 326 */ 327 @Deprecated 328 public Player getPlayerExact(String name); 329 330 /** 331 * Attempts to match any players with the given name, and returns a list 332 * of all possibly matches. 333 * <p> 334 * This list is not sorted in any particular order. If an exact match is 335 * found, the returned list will only contain a single result. 336 * 337 * @deprecated Use {@link #getPlayer(UUID)} as player names are no longer 338 * guaranteed to be unique 339 * @param name the (partial) name to match 340 * @return list of all possible players 341 */ 342 @Deprecated 343 public List<Player> matchPlayer(String name); 344 345 /** 346 * Gets the player with the given UUID. 347 * 348 * @param id UUID of the player to retrieve 349 * @return a player object if one was found, null otherwise 350 */ 351 public Player getPlayer(UUID id); 352 353 /** 354 * Gets the plugin manager for interfacing with plugins. 355 * 356 * @return a plugin manager for this Server instance 357 */ 358 public PluginManager getPluginManager(); 359 360 /** 361 * Gets the scheduler for managing scheduled events. 362 * 363 * @return a scheduling service for this server 364 */ 365 public BukkitScheduler getScheduler(); 366 367 /** 368 * Gets a services manager. 369 * 370 * @return s services manager 371 */ 372 public ServicesManager getServicesManager(); 373 374 /** 375 * Gets a list of all worlds on this server. 376 * 377 * @return a list of worlds 378 */ 379 public List<World> getWorlds(); 380 381 /** 382 * Creates or loads a world with the given name using the specified 383 * options. 384 * <p> 385 * If the world is already loaded, it will just return the equivalent of 386 * getWorld(creator.name()). 387 * 388 * @param creator the options to use when creating the world 389 * @return newly created or loaded world 390 */ 391 public World createWorld(WorldCreator creator); 392 393 /** 394 * Unloads a world with the given name. 395 * 396 * @param name Name of the world to unload 397 * @param save whether to save the chunks before unloading 398 * @return true if successful, false otherwise 399 */ 400 public boolean unloadWorld(String name, boolean save); 401 402 /** 403 * Unloads the given world. 404 * 405 * @param world the world to unload 406 * @param save whether to save the chunks before unloading 407 * @return true if successful, false otherwise 408 */ 409 public boolean unloadWorld(World world, boolean save); 410 411 /** 412 * Gets the world with the given name. 413 * 414 * @param name the name of the world to retrieve 415 * @return a world with the given name, or null if none exists 416 */ 417 public World getWorld(String name); 418 419 /** 420 * Gets the world from the given Unique ID. 421 * 422 * @param uid a unique-id of the world to retrieve 423 * @return a world with the given Unique ID, or null if none exists 424 */ 425 public World getWorld(UUID uid); 426 427 /** 428 * Gets the map from the given item ID. 429 * 430 * @param id the id of the map to get 431 * @return a map view if it exists, or null otherwise 432 * @deprecated Magic value 433 */ 434 @Deprecated 435 public MapView getMap(short id); 436 437 /** 438 * Create a new map with an automatically assigned ID. 439 * 440 * @param world the world the map will belong to 441 * @return a newly created map view 442 */ 443 public MapView createMap(World world); 444 445 /** 446 * Reloads the server, refreshing settings and plugin information. 447 */ 448 public void reload(); 449 450 /** 451 * Returns the primary logger associated with this server instance. 452 * 453 * @return Logger associated with this server 454 */ 455 public Logger getLogger(); 456 457 /** 458 * Gets a {@link PluginCommand} with the given name or alias. 459 * 460 * @param name the name of the command to retrieve 461 * @return a plugin command if found, null otherwise 462 */ 463 public PluginCommand getPluginCommand(String name); 464 465 /** 466 * Writes loaded players to disk. 467 */ 468 public void savePlayers(); 469 470 /** 471 * Dispatches a command on this server, and executes it if found. 472 * 473 * @param sender the apparent sender of the command 474 * @param commandLine the command + arguments. Example: <code>test abc 475 * 123</code> 476 * @return returns false if no target is found 477 * @throws CommandException thrown when the executor for the given command 478 * fails with an unhandled exception 479 */ 480 public boolean dispatchCommand(CommandSender sender, String commandLine) throws CommandException; 481 482 /** 483 * Populates a given {@link ServerConfig} with values attributes to this 484 * server. 485 * 486 * @param config the server config to populate 487 */ 488 public void configureDbConfig(ServerConfig config); 489 490 /** 491 * Adds a recipe to the crafting manager. 492 * 493 * @param recipe the recipe to add 494 * @return true if the recipe was added, false if it wasn't for some 495 * reason 496 */ 497 public boolean addRecipe(Recipe recipe); 498 499 /** 500 * Get a list of all recipes for a given item. The stack size is ignored 501 * in comparisons. If the durability is -1, it will match any data value. 502 * 503 * @param result the item to match against recipe results 504 * @return a list of recipes with the given result 505 */ 506 public List<Recipe> getRecipesFor(ItemStack result); 507 508 /** 509 * Get an iterator through the list of crafting recipes. 510 * 511 * @return an iterator 512 */ 513 public Iterator<Recipe> recipeIterator(); 514 515 /** 516 * Clears the list of crafting recipes. 517 */ 518 public void clearRecipes(); 519 520 /** 521 * Resets the list of crafting recipes to the default. 522 */ 523 public void resetRecipes(); 524 525 /** 526 * Gets a list of command aliases defined in the server properties. 527 * 528 * @return a map of aliases to command names 529 */ 530 public Map<String, String[]> getCommandAliases(); 531 532 /** 533 * Gets the radius, in blocks, around each worlds spawn point to protect. 534 * 535 * @return spawn radius, or 0 if none 536 */ 537 public int getSpawnRadius(); 538 539 /** 540 * Sets the radius, in blocks, around each worlds spawn point to protect. 541 * 542 * @param value new spawn radius, or 0 if none 543 */ 544 public void setSpawnRadius(int value); 545 546 /** 547 * Gets whether the Server is in online mode or not. 548 * 549 * @return true if the server authenticates clients, false otherwise 550 */ 551 public boolean getOnlineMode(); 552 553 /** 554 * Gets whether this server allows flying or not. 555 * 556 * @return true if the server allows flight, false otherwise 557 */ 558 public boolean getAllowFlight(); 559 560 /** 561 * Gets whether the server is in hardcore mode or not. 562 * 563 * @return true if the server mode is hardcore, false otherwise 564 */ 565 public boolean isHardcore(); 566 567 /** 568 * Gets whether to use vanilla (false) or exact behaviour (true). 569 * 570 * <ul> 571 * <li>Vanilla behaviour: check for collisions and move the player if 572 * needed. 573 * <li>Exact behaviour: spawn players exactly where they should be. 574 * </ul> 575 * 576 * @return true if exact location locations are used for spawning, false 577 * for vanilla collision detection or otherwise 578 */ 579 public boolean useExactLoginLocation(); 580 581 /** 582 * Shutdowns the server, stopping everything. 583 */ 584 public void shutdown(); 585 586 /** 587 * Broadcasts the specified message to every user with the given 588 * permission name. 589 * 590 * @param message message to broadcast 591 * @param permission the required permission {@link Permissible 592 * permissibles} must have to receive the broadcast 593 * @return number of message recipients 594 */ 595 public int broadcast(String message, String permission); 596 597 /** 598 * Gets the player by the given name, regardless if they are offline or 599 * online. 600 * <p> 601 * This method may involve a blocking web request to get the UUID for the 602 * given name. 603 * <p> 604 * This will return an object even if the player does not exist. To this 605 * method, all players will exist. 606 * 607 * @deprecated Persistent storage of users should be by UUID as names are no longer 608 * unique past a single session. 609 * @param name the name the player to retrieve 610 * @return an offline player 611 * @see #getOfflinePlayer(java.util.UUID) 612 */ 613 @Deprecated 614 public OfflinePlayer getOfflinePlayer(String name); 615 616 /** 617 * Gets the player by the given UUID, regardless if they are offline or 618 * online. 619 * <p> 620 * This will return an object even if the player does not exist. To this 621 * method, all players will exist. 622 * 623 * @param id the UUID of the player to retrieve 624 * @return an offline player 625 */ 626 public OfflinePlayer getOfflinePlayer(UUID id); 627 628 /** 629 * Gets a set containing all current IPs that are banned. 630 * 631 * @return a set containing banned IP addresses 632 */ 633 public Set<String> getIPBans(); 634 635 /** 636 * Bans the specified address from the server. 637 * 638 * @param address the IP address to ban 639 */ 640 public void banIP(String address); 641 642 /** 643 * Unbans the specified address from the server. 644 * 645 * @param address the IP address to unban 646 */ 647 public void unbanIP(String address); 648 649 /** 650 * Gets a set containing all banned players. 651 * 652 * @return a set containing banned players 653 */ 654 public Set<OfflinePlayer> getBannedPlayers(); 655 656 /** 657 * Gets a ban list for the supplied type. 658 * <p> 659 * Bans by name are no longer supported and this method will return 660 * null when trying to request them. The replacement is bans by UUID. 661 * 662 * @param type the type of list to fetch, cannot be null 663 * @return a ban list of the specified type 664 */ 665 public BanList getBanList(BanList.Type type); 666 667 /** 668 * Gets a set containing all player operators. 669 * 670 * @return a set containing player operators 671 */ 672 public Set<OfflinePlayer> getOperators(); 673 674 /** 675 * Gets the default {@link GameMode} for new players. 676 * 677 * @return the default game mode 678 */ 679 public GameMode getDefaultGameMode(); 680 681 /** 682 * Sets the default {@link GameMode} for new players. 683 * 684 * @param mode the new game mode 685 */ 686 public void setDefaultGameMode(GameMode mode); 687 688 /** 689 * Gets a {@link ConsoleCommandSender} that may be used as an input source 690 * for this server. 691 * 692 * @return a console command sender 693 */ 694 public ConsoleCommandSender getConsoleSender(); 695 696 /** 697 * Gets the folder that contains all of the various {@link World}s. 698 * 699 * @return folder that contains all worlds 700 */ 701 public File getWorldContainer(); 702 703 /** 704 * Gets every player that has ever played on this server. 705 * 706 * @return an array containing all previous players 707 */ 708 public OfflinePlayer[] getOfflinePlayers(); 709 710 /** 711 * Gets the {@link Messenger} responsible for this server. 712 * 713 * @return messenger responsible for this server 714 */ 715 public Messenger getMessenger(); 716 717 /** 718 * Gets the {@link HelpMap} providing help topics for this server. 719 * 720 * @return a help map for this server 721 */ 722 public HelpMap getHelpMap(); 723 724 /** 725 * Creates an empty inventory of the specified type. If the type is {@link 726 * InventoryType#CHEST}, the new inventory has a size of 27; otherwise the 727 * new inventory has the normal size for its type. 728 * 729 * @param owner the holder of the inventory, or null to indicate no holder 730 * @param type the type of inventory to create 731 * @return a new inventory 732 */ 733 Inventory createInventory(InventoryHolder owner, InventoryType type); 734 735 /** 736 * Creates an empty inventory with the specified type and title. If the type 737 * is {@link InventoryType#CHEST}, the new inventory has a size of 27; 738 * otherwise the new inventory has the normal size for its type.<br /> 739 * It should be noted that some inventory types do not support titles and 740 * may not render with said titles on the Minecraft client. 741 * 742 * @param owner The holder of the inventory; can be null if there's no holder. 743 * @param type The type of inventory to create. 744 * @param title The title of the inventory, to be displayed when it is viewed. 745 * @return The new inventory. 746 */ 747 Inventory createInventory(InventoryHolder owner, InventoryType type, String title); 748 749 /** 750 * Creates an empty inventory of type {@link InventoryType#CHEST} with the 751 * specified size. 752 * 753 * @param owner the holder of the inventory, or null to indicate no holder 754 * @param size a multiple of 9 as the size of inventory to create 755 * @return a new inventory 756 * @throws IllegalArgumentException if the size is not a multiple of 9 757 */ 758 Inventory createInventory(InventoryHolder owner, int size) throws IllegalArgumentException; 759 760 /** 761 * Creates an empty inventory of type {@link InventoryType#CHEST} with the 762 * specified size and title. 763 * 764 * @param owner the holder of the inventory, or null to indicate no holder 765 * @param size a multiple of 9 as the size of inventory to create 766 * @param title the title of the inventory, displayed when inventory is 767 * viewed 768 * @return a new inventory 769 * @throws IllegalArgumentException if the size is not a multiple of 9 770 */ 771 Inventory createInventory(InventoryHolder owner, int size, String title) throws IllegalArgumentException; 772 773 /** 774 * Gets user-specified limit for number of monsters that can spawn in a 775 * chunk. 776 * 777 * @return the monster spawn limit 778 */ 779 int getMonsterSpawnLimit(); 780 781 /** 782 * Gets user-specified limit for number of animals that can spawn in a 783 * chunk. 784 * 785 * @return the animal spawn limit 786 */ 787 int getAnimalSpawnLimit(); 788 789 /** 790 * Gets user-specified limit for number of water animals that can spawn in 791 * a chunk. 792 * 793 * @return the water animal spawn limit 794 */ 795 int getWaterAnimalSpawnLimit(); 796 797 /** 798 * Gets user-specified limit for number of ambient mobs that can spawn in 799 * a chunk. 800 * 801 * @return the ambient spawn limit 802 */ 803 int getAmbientSpawnLimit(); 804 805 /** 806 * Checks the current thread against the expected primary thread for the 807 * server. 808 * <p> 809 * <b>Note:</b> this method should not be used to indicate the current 810 * synchronized state of the runtime. A current thread matching the main 811 * thread indicates that it is synchronized, but a mismatch <b>does not 812 * preclude</b> the same assumption. 813 * 814 * @return true if the current thread matches the expected primary thread, 815 * false otherwise 816 */ 817 boolean isPrimaryThread(); 818 819 /** 820 * Gets the message that is displayed on the server list. 821 * 822 * @return the servers MOTD 823 */ 824 String getMotd(); 825 826 /** 827 * Gets the default message that is displayed when the server is stopped. 828 * 829 * @return the shutdown message 830 */ 831 String getShutdownMessage(); 832 833 /** 834 * Gets the current warning state for the server. 835 * 836 * @return the configured warning state 837 */ 838 public WarningState getWarningState(); 839 840 /** 841 * Gets the instance of the item factory (for {@link ItemMeta}). 842 * 843 * @return the item factory 844 * @see ItemFactory 845 */ 846 ItemFactory getItemFactory(); 847 848 /** 849 * Gets the instance of the scoreboard manager. 850 * <p> 851 * This will only exist after the first world has loaded. 852 * 853 * @return the scoreboard manager or null if no worlds are loaded. 854 */ 855 ScoreboardManager getScoreboardManager(); 856 857 /** 858 * Gets an instance of the server's default server-icon. 859 * 860 * @return the default server-icon; null values may be used by the 861 * implementation to indicate no defined icon, but this behavior is 862 * not guaranteed 863 */ 864 CachedServerIcon getServerIcon(); 865 866 /** 867 * Loads an image from a file, and returns a cached image for the specific 868 * server-icon. 869 * <p> 870 * Size and type are implementation defined. An incompatible file is 871 * guaranteed to throw an implementation-defined {@link Exception}. 872 * 873 * @param file the file to load the from 874 * @throws IllegalArgumentException if image is null 875 * @throws Exception if the image does not meet current server server-icon 876 * specifications 877 * @return a cached server-icon that can be used for a {@link 878 * ServerListPingEvent#setServerIcon(CachedServerIcon)} 879 */ 880 CachedServerIcon loadServerIcon(File file) throws IllegalArgumentException, Exception; 881 882 /** 883 * Creates a cached server-icon for the specific image. 884 * <p> 885 * Size and type are implementation defined. An incompatible file is 886 * guaranteed to throw an implementation-defined {@link Exception}. 887 * 888 * @param image the image to use 889 * @throws IllegalArgumentException if image is null 890 * @throws Exception if the image does not meet current server 891 * server-icon specifications 892 * @return a cached server-icon that can be used for a {@link 893 * ServerListPingEvent#setServerIcon(CachedServerIcon)} 894 */ 895 CachedServerIcon loadServerIcon(BufferedImage image) throws IllegalArgumentException, Exception; 896 897 /** 898 * Set the idle kick timeout. Any players idle for the specified amount of 899 * time will be automatically kicked. 900 * <p> 901 * A value of 0 will disable the idle kick timeout. 902 * 903 * @param threshold the idle timeout in minutes 904 */ 905 public void setIdleTimeout(int threshold); 906 907 /** 908 * Gets the idle kick timeout. 909 * 910 * @return the idle timeout in minutes 911 */ 912 public int getIdleTimeout(); 913 914 /** 915 * @see UnsafeValues 916 */ 917 @Deprecated 918 UnsafeValues getUnsafe(); 919 }