Skip to main content

Getting Started with Vexor Core APIs

Learn how to integrate Vexor Core plugins into your own plugins.

Prerequisites

  • Java 21 or higher
  • Maven or Gradle build tool
  • Basic understanding of Bukkit/Paper API
  • Vexor Core plugin(s) you want to integrate with

Setup Your Project

Maven Project

Create or update your pom.xml:

<project>
<properties>
<java.version>21</java.version>
</properties>

<repositories>
<repository>
<id>papermc</id>
<url>https://repo.papermc.io/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
<!-- Paper API -->
<dependency>
<groupId>io.papermc.paper</groupId>
<artifactId>paper-api</artifactId>
<version>1.21.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

<!-- Vexor Core Plugin (example: PivotPoly) -->
<dependency>
<groupId>VexorCore.Logix</groupId>
<artifactId>pivotpoly</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>

Gradle Project

Update your build.gradle:

plugins {
id 'java'
}

group = 'com.yourname'
version = '1.0'
sourceCompatibility = '21'

repositories {
mavenCentral()
maven {
url = 'https://repo.papermc.io/repository/maven-public/'
}
}

dependencies {
compileOnly 'io.papermc.paper:paper-api:1.21.3-R0.1-SNAPSHOT'
compileOnly 'VexorCore.Logix:pivotpoly:1.0'
}

Configure plugin.yml

Add soft dependencies to your plugin.yml:

name: YourPlugin
version: 1.0
main: com.yourname.yourplugin.YourPlugin
api-version: '1.21'

# Optional integration
softdepend: [PivotPoly, CoreTeams, SupplyCrates]

# Or required dependency
depend: [PivotPoly]

Basic Integration

Step 1: Create Main Plugin Class

package com.yourname.yourplugin;

import org.bukkit.Bukkit;
import org.bukkit.plugin.java.JavaPlugin;
import VexorCore.Logix.pivotPoly.PivotPoly;

public class YourPlugin extends JavaPlugin {
private PivotPoly pivotPoly;

@Override
public void onEnable() {
// Hook into PivotPoly
if (!setupPivotPoly()) {
getLogger().warning("PivotPoly not found - some features disabled");
}

getLogger().info("YourPlugin enabled!");
}

private boolean setupPivotPoly() {
if (Bukkit.getPluginManager().getPlugin("PivotPoly") == null) {
return false;
}

pivotPoly = (PivotPoly) Bukkit.getPluginManager().getPlugin("PivotPoly");
getLogger().info("Successfully hooked into PivotPoly v" +
pivotPoly.getDescription().getVersion());
return true;
}

public PivotPoly getPivotPoly() {
return pivotPoly;
}
}

Step 2: Use the API

package com.yourname.yourplugin;

import org.bukkit.command.CommandExecutor;
import org.bukkit.entity.Player;
import VexorCore.Logix.pivotPoly.DoorManager;
import VexorCore.Logix.pivotPoly.AnimatedDoor;

public class DoorCommand implements CommandExecutor {
private final YourPlugin plugin;

public DoorCommand(YourPlugin plugin) {
this.plugin = plugin;
}

@Override
public boolean onCommand(...) {
PivotPoly pivotPoly = plugin.getPivotPoly();

if (pivotPoly == null) {
player.sendMessage("PivotPoly not available!");
return true;
}

// Use the API
DoorManager doorManager = pivotPoly.getDoorManager();

// List all doors
for (String doorName : doorManager.getDoors().keySet()) {
player.sendMessage("Door: " + doorName);
}

// Toggle a specific door
AnimatedDoor door = doorManager.getDoors().get("CastleGate");
if (door != null) {
door.toggle();
}

return true;
}
}

Error Handling

Always handle cases where plugins might not be available:

public void performIntegration() {
// Check if plugin is available
if (pivotPoly == null) {
getLogger().warning("Cannot perform operation - PivotPoly not loaded");
return;
}

try {
// Perform API calls
DoorManager manager = pivotPoly.getDoorManager();
// ...
} catch (Exception e) {
getLogger().severe("Error during PivotPoly integration: " + e.getMessage());
e.printStackTrace();
}
}

Testing Your Integration

  1. Build your plugin:

    mvn clean package
    # or
    gradle build
  2. Install dependencies:

    • Place Vexor Core plugins in server plugins/ folder
    • Place your plugin in plugins/ folder
  3. Start server and verify:

    # Check console for hook messages
    [YourPlugin] Successfully hooked into PivotPoly v1.0
  4. Test functionality:

    • Use your plugin's commands
    • Verify API calls work correctly
    • Check for any errors in console

Next Steps


Need help? Join our Discord developer channel!