-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from Nookure/dev
Dev
- Loading branch information
Showing
219 changed files
with
4,265 additions
and
1,639 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 7 additions & 6 deletions
13
MAStaff-API/src/main/java/es/angelillo15/mast/api/Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,18 @@ | ||
package es.angelillo15.mast.api; | ||
|
||
import lombok.Getter; | ||
|
||
public class Constants { | ||
public static final String VERSION = "{version}"; | ||
|
||
public static final String COMMIT = "{git-commit}"; | ||
|
||
public static final String COMMIT_USER = "{git-user}"; | ||
|
||
public static final String COMMIT_TIME = "{git-date}"; | ||
|
||
public static final String GIT_BRANCH = "{git-branch}"; | ||
|
||
public static final boolean DEV_MODE = false; | ||
|
||
public static String getVersion() { | ||
return VERSION; | ||
} | ||
private Constants() {} | ||
|
||
|
||
} |
30 changes: 20 additions & 10 deletions
30
MAStaff-API/src/main/java/es/angelillo15/mast/api/ILogger.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 0 additions & 17 deletions
17
MAStaff-API/src/main/java/es/angelillo15/mast/api/IServerUtils.java
This file was deleted.
Oops, something went wrong.
62 changes: 62 additions & 0 deletions
62
MAStaff-API/src/main/java/es/angelillo15/mast/api/IServerUtils.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package es.angelillo15.mast.api | ||
|
||
import java.util.* | ||
|
||
interface IServerUtils { | ||
/** | ||
* Check if a player is online | ||
* @param uuid The UUID of the player | ||
* @return true if the player is online, false otherwise | ||
*/ | ||
fun isOnline(uuid: UUID): Boolean | ||
|
||
/** | ||
* Check if a player is online | ||
* @param name The name of the player | ||
* @return true if the player is online, false otherwise | ||
*/ | ||
fun isOnline(name: String): Boolean | ||
|
||
/** | ||
* Get the IP of a player | ||
* @param uuid The UUID of the player | ||
* @return The IP of the player | ||
*/ | ||
fun getIP(uuid: UUID): String | ||
|
||
/** | ||
* Get the IP of a player | ||
* @param name The name of the player | ||
* @return The IP of the player | ||
*/ | ||
fun getIP(name: String): String | ||
|
||
/** | ||
* Get the UUID of a player | ||
* @param name The name of the player | ||
* @return The UUID of the player | ||
*/ | ||
fun getUUID(name: String): UUID | ||
|
||
/** | ||
* Get the name of a player | ||
* @param uuid The UUID of the player | ||
* @return The name of the player | ||
*/ | ||
fun getName(uuid: UUID): String | ||
|
||
/** | ||
* Broadcast a message to the players with a specific permission | ||
* @param message The message to broadcast | ||
* @param permission The permission to check | ||
*/ | ||
fun broadcastMessage(message: String, permission: String) | ||
|
||
/** | ||
* Broadcast a message to the players with the permission "mast.staff" | ||
* @param message The message to broadcast | ||
*/ | ||
fun broadcastStaffMessage(message: String) { | ||
broadcastMessage(message, "mast.staff") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 7 additions & 56 deletions
63
MAStaff-API/src/main/java/es/angelillo15/mast/api/MAStaffInstance.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,25 @@ | ||
package es.angelillo15.mast.api; | ||
|
||
import es.angelillo15.mast.api.cmd.Command; | ||
import es.angelillo15.mast.api.exceptions.PluginNotLoadedException; | ||
import es.angelillo15.mast.api.utils.MAStaffInject; | ||
import es.angelillo15.mast.api.utils.ServerUtils; | ||
import es.angelillo15.mast.api.utils.VersionUtils; | ||
import net.md_5.bungee.api.ProxyServer; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
import java.io.File; | ||
import java.io.InputStream; | ||
public interface MAStaffInstance<P> extends MAStaffInject { | ||
P getPluginInstance(); | ||
|
||
|
||
public interface MAStaffInstance<P> { | ||
public static int version() { | ||
static int version() { | ||
if (ServerUtils.getServerType() == ServerUtils.ServerType.BUNGEE) { | ||
return 19; | ||
} else { | ||
return VersionUtils.getBukkitVersion(); | ||
} | ||
} | ||
|
||
public static MAStaffInstance<Plugin> getInstance(){ | ||
MAStaffInstance<Plugin> instance = (MAStaffInstance<Plugin>) Bukkit.getPluginManager().getPlugin("MAStaff"); | ||
if(instance == null){ | ||
throw new PluginNotLoadedException("MAStaff is not loaded"); | ||
} | ||
return instance; | ||
} | ||
|
||
public static MAStaffInstance<net.md_5.bungee.api.plugin.Plugin> getBungeeInstance() { | ||
MAStaffInstance<net.md_5.bungee.api.plugin.Plugin> instance = (MAStaffInstance<net.md_5.bungee.api.plugin.Plugin>) ProxyServer | ||
.getInstance().getPluginManager() | ||
.getPlugin("MAStaff"); | ||
if(instance == null){ | ||
throw new PluginNotLoadedException("MAStaff is not loaded"); | ||
} | ||
return instance; | ||
} | ||
|
||
public static boolean placeholderCheck() { | ||
static boolean placeholderCheck() { | ||
return Bukkit.getPluginManager().getPlugin("PlaceholderAPI") != null; | ||
} | ||
|
||
public ILogger getPLogger(); | ||
public static ILogger getLogger() { | ||
if (ServerUtils.getServerType() == ServerUtils.ServerType.BUKKIT) { | ||
return getInstance().getPLogger(); | ||
} else { | ||
return getBungeeInstance().getPLogger(); | ||
} | ||
static ILogger getLogger() { | ||
return ILogger.getInstance(); | ||
} | ||
public default void registerCommand(Command command){}; | ||
public IServerUtils getServerUtils(); | ||
public boolean isDebug(); | ||
public void drawLogo(); | ||
public void loadConfig(); | ||
public void registerCommands(); | ||
public void registerListeners(); | ||
public void loadDatabase(); | ||
public void loadModules(); | ||
public void unregisterCommands(); | ||
public void unregisterListeners(); | ||
public void unloadDatabase(); | ||
public void reload(); | ||
public default IStaffPlayer createStaffPlayer(Player player) { return null; } | ||
File getPluginDataFolder(); | ||
InputStream getPluginResource(String s); | ||
void setDebug(boolean debug); | ||
public P getPluginInstance(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.