Skip to content

Commit

Permalink
Merge pull request #19 from Grubnest/feature-adding-velocity
Browse files Browse the repository at this point in the history
Added Velocity
  • Loading branch information
Wyzards authored May 20, 2022
2 parents 5704a3a + 43340d6 commit eb95add
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 4 deletions.
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,20 @@
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>

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

<dependencies>
<dependency>
<groupId>com.velocitypowered</groupId>
<artifactId>velocity-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/com/grubnest/game/core/GrubnestCorePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
import org.bukkit.plugin.java.JavaPlugin;

public class GrubnestCorePlugin extends JavaPlugin {

private MySQL sql;
private static GrubnestCorePlugin instance;

/**
* Runs when plugin is enabled
*/
Expand Down Expand Up @@ -37,9 +39,10 @@ public void onDisable() {

/**
* Initialize data from config.yml
*
* @return MySQLData
*/
private MySQLData dataInitializer(){
private MySQLData dataInitializer() {
String host = getConfig().getString("Database.hostname");
String port = getConfig().getString("Database.port");
String database = getConfig().getString("Database.database");
Expand All @@ -49,22 +52,24 @@ private MySQLData dataInitializer(){
int minimumConnections = getConfig().getInt("Database.minimumConnections");
int maximumConnections = getConfig().getInt("Database.maximumConnections");
long connectionTimeout = getConfig().getLong("Database.connectionTimeout");
return new MySQLData(host,username,password,port,database,minimumConnections,maximumConnections,connectionTimeout);
return new MySQLData(host, username, password, port, database, minimumConnections, maximumConnections, connectionTimeout);
}

/**
* Get SQL Object
*
* @return SQL object
*/
public MySQL getMySQL(){
public MySQL getMySQL() {
return sql;
}

/**
* Get Plugin Instance
*
* @return Plugin Instance
*/
public static GrubnestCorePlugin getInstance(){
public static GrubnestCorePlugin getInstance() {
return instance;
}
}
39 changes: 39 additions & 0 deletions src/main/java/com/grubnest/game/core/Velocity/VelocityPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package com.grubnest.game.core.Velocity;

import com.google.inject.Inject;
import com.velocitypowered.api.plugin.Plugin;
import com.velocitypowered.api.proxy.ProxyServer;
import net.kyori.adventure.text.Component;
import org.slf4j.Logger;

/**
* The VelocityPlugin class is an implementation of the Velocity API.
* It provides communication to and from the Velocity Proxy server
* running on the Grubnest network
* <p>
* Date: 5/20/2022
* Authors: Theeef
*/
@Plugin(id = "grubnestcore", name = "Grubnest Core Plugin", version = "0.1.0-SNAPSHOT",
url = "htts://grubnest.com", description = "Grubnest Core running on Velocity", authors = {"Theeef"})
public class VelocityPlugin {

private final ProxyServer server;
private final Logger logger;


/**
* Creates an instance of the Velocity Plugin and injects it
*
* @param server The velocity proxy server
* @param logger The proxy server's logger
*/
@Inject
public VelocityPlugin(ProxyServer server, Logger logger) {
this.server = server;
this.logger = logger;

this.server.sendMessage(Component.text("GrubnestCore is enabled on Velocity!"));
}

}

0 comments on commit eb95add

Please sign in to comment.