https://github.com/404setup/vico
https://github.com/404setup/vico
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/404setup/vico
- Owner: 404Setup
- License: apache-2.0
- Created: 2024-12-10T07:32:30.000Z (6 months ago)
- Default Branch: master
- Last Pushed: 2024-12-11T12:04:19.000Z (5 months ago)
- Last Synced: 2025-02-09T09:28:50.718Z (3 months ago)
- Language: Java
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# VicoLib
Provides a reusable API for easy development## Update Tool
Support: Github Release, Hangar, Modrinth, Spigot, Spiget## MessageSender
Easy to use Kyori API operations```Java
// You cannot use this method to create new instances everywhere.
//It should only be called once during the lifetime of your plugin.
VicoImpl plugin = VicoAPI.getVicoPlugin();plugin.getMessageSender().sendMessage("message", sender);
plugin.getMessageSender().close(); // Called when the plugin is closed
```## Player teleport
It is just a very simple API and does not work with ProxyServer.```Java
// You cannot use this method to create new instances everywhere.
//It should only be called once during the lifetime of your plugin.
VicoImpl plugin = VicoAPI.getVicoPlugin();// In folia, it always returns true
plugin.getPluginPlayer().teleport(player, location);
CompletableFuture result = plugin.getPluginPlayer().teleportAsync(player, location);
```## Scheduler
Vico has two types of schedulers, namely Proxy scheduler and PluginServer scheduler.### Proxy Scheduler
```Java
VicoAPI.getProxyScheduler(proxyServer).runAsyncOnProxy(this, () -> System.out.println("ProxyServer test"));
VicoAPI.getProxyScheduler(proxyServer).runAsyncOnPlugin(this, () -> System.out.println("ProxyServer test"));
```### Plugin Scheduler
Proper use of PluginSchedulerBuilder can reduce a lot of boilerplate code and reduce the workload of developers,
but you still need to distribute the tasks reasonably, which is for Folia compatibility considerations.Except for some broken APIs, it is not that difficult to be compatible, and the standard API is basically stable.
```java
PluginSchedulerBuilder.builder(this).sync().setTask(() -> System.out.println("PluginServer test")).run();// In Spigot and Paper, this is equivalent to the following code
Bukkit.getScheduler().runTask(this, () -> System.out.println("PluginServer test"));// In Folia
Bukkit.getGlobalRegionScheduler().runNow(this, (e) -> System.out.println("PluginServer test"));
```