Skip to content

Commit

Permalink
Merge pull request #29 from Nookure/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Angelillo15 authored Aug 1, 2023
2 parents 623c956 + 0c3ad9f commit fce6643
Show file tree
Hide file tree
Showing 219 changed files with 4,265 additions and 1,639 deletions.
9 changes: 0 additions & 9 deletions .gitattributes

This file was deleted.

20 changes: 4 additions & 16 deletions MAStaff-API/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,9 @@ plugins {
group = "es.angelillo15"
version = parent?.version ?: "2.0.0"

repositories {
mavenCentral()
maven("https://papermc.io/repo/repository/maven-public/")
maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
maven("https://oss.sonatype.org/content/repositories/snapshots")
maven("https://oss.sonatype.org/content/repositories/central")
maven("https://repo.alessiodp.com/releases/")
maven("https://jitpack.io")
maven("https://repo.dmulloy2.net/repository/public/")
}
val compileOnlyApi: Configuration by configurations.creating
configurations["compileClasspath"].extendsFrom(compileOnlyApi)
configurations["apiElements"].extendsFrom(compileOnlyApi)

dependencies {
compileOnly(libs.waterfall)
Expand All @@ -43,6 +36,7 @@ dependencies {
compileOnly(libs.miniMessage)
compileOnly(libs.protocolLib)
compileOnly(libs.vault)
compileOnly(libs.velocity)
}

blossom {
Expand All @@ -64,10 +58,4 @@ blossom {
{
replaceToken("false", "true")
}

}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
13 changes: 7 additions & 6 deletions MAStaff-API/src/main/java/es/angelillo15/mast/api/Constants.java
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 MAStaff-API/src/main/java/es/angelillo15/mast/api/ILogger.java
Original file line number Diff line number Diff line change
@@ -1,31 +1,41 @@
package es.angelillo15.mast.api;

public interface ILogger {
void info(String message);
public abstract class ILogger {
private static ILogger instance;

void warn(String message);
public static ILogger getInstance() {
return instance;
}

public static void setInstance(ILogger instance) {
ILogger.instance = instance;
}

abstract public void info(String message);

abstract public void warn(String message);

void error(String message);
abstract public void error(String message);

void debug(String message);
abstract public void debug(String message);

default void info(String message, Object... args) {
void info(String message, Object... args) {
info(format(message, args));
}

default void warn(String message, Object... args) {
void warn(String message, Object... args) {
warn(format(message, args));
}

default void error(String message, Object... args) {
void error(String message, Object... args) {
error(format(message, args));
}

default void debug(String message, Object... args) {
void debug(String message, Object... args) {
debug(format(message, args));
}

default String format(String message, Object... args) {
String format(String message, Object... args) {
String msg = message;
for (Object arg : args) {
msg = msg.replaceFirst("\\{\\}", arg.toString());
Expand Down

This file was deleted.

62 changes: 62 additions & 0 deletions MAStaff-API/src/main/java/es/angelillo15/mast/api/IServerUtils.kt
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")
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ public interface IStaffPlayer {
*/
boolean isFreezed(Player player);

/**
* Execute staff mode commands
*/
void executeStaffModeCommands();

/**
* Get the vanish player
* @return the vanish player or null if is disabled
Expand Down
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();

}
64 changes: 32 additions & 32 deletions MAStaff-API/src/main/java/es/angelillo15/mast/api/TextUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,44 +139,44 @@ public static String toMM(String str) {
sb.replace(m.start(), m.end(), sb.substring(m.start(), m.end()).toLowerCase());
}
return sb.toString()
.replace("&0", "<black>")
.replace("&1", "<dark_blue>")
.replace("&2", "<dark_green>")
.replace("&3", "<dark_aqua>")
.replace("&4", "<dark_red>")
.replace("&5", "<dark_purple>")
.replace("&6", "<gold>")
.replace("&7", "<grey>")
.replace("&8", "<dark_grey>")
.replace("&9", "<blue>")
.replace("&a", "<green>")
.replace("&b", "<aqua>")
.replace("&c", "<red>")
.replace("&d", "<light_purple>")
.replace("&e", "<yellow>")
.replace("&f", "<white>")
.replace("&0", "<reset><black>")
.replace("&1", "<reset><dark_blue>")
.replace("&2", "<reset><dark_green>")
.replace("&3", "<reset><dark_aqua>")
.replace("&4", "<reset><dark_red>")
.replace("&5", "<reset><dark_purple>")
.replace("&6", "<reset><gold>")
.replace("&7", "<reset><grey>")
.replace("&8", "<reset><dark_grey>")
.replace("&9", "<reset><blue>")
.replace("&a", "<reset><green>")
.replace("&b", "<reset><aqua>")
.replace("&c", "<reset><red>")
.replace("&d", "<reset><light_purple>")
.replace("&e", "<reset><yellow>")
.replace("&f", "<reset><white>")
.replace("&k", "<obf>")
.replace("&l", "<b>")
.replace("&m", "<st>")
.replace("&n", "<u>")
.replace("&r", "<reset>")
.replace("&o", "<i>")
.replace("§0", "<black>")
.replace("§1", "<dark_blue>")
.replace("§2", "<dark_green>")
.replace("§3", "<dark_aqua>")
.replace("§4", "<dark_red>")
.replace("§5", "<dark_purple>")
.replace("§6", "<gold>")
.replace("§7", "<grey>")
.replace("§8", "<dark_grey>")
.replace("§9", "<blue>")
.replace("§a", "<green>")
.replace("§b", "<aqua>")
.replace("§c", "<red>")
.replace("§d", "<light_purple>")
.replace("§e", "<yellow>")
.replace("§f", "<white>")
.replace("§0", "<reset><black>")
.replace("§1", "<reset><dark_blue>")
.replace("§2", "<reset><dark_green>")
.replace("§3", "<reset><dark_aqua>")
.replace("§4", "<reset><dark_red>")
.replace("§5", "<reset><dark_purple>")
.replace("§6", "<reset><gold>")
.replace("§7", "<reset><grey>")
.replace("§8", "<reset><dark_grey>")
.replace("§9", "<reset><blue>")
.replace("§a", "<reset><green>")
.replace("§b", "<reset><aqua>")
.replace("§c", "<reset><red>")
.replace("§d", "<reset><light_purple>")
.replace("§e", "<reset><yellow>")
.replace("§f", "<reset><white>")
.replace("§k", "<obf>")
.replace("§l", "<b>")
.replace("§m", "<st>")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import es.angelillo15.mast.api.ILogger;

public class AddonLogger implements ILogger {
private MAStaffAddon addon;
private ILogger logger;
public class AddonLogger extends ILogger {
private MAStaffAddon<?> addon;
private final ILogger logger;

public AddonLogger(MAStaffAddon addon, ILogger logger) {
public AddonLogger(MAStaffAddon<?> addon, ILogger logger) {
this.addon = addon;
this.logger = logger;
}
Expand Down
Loading

0 comments on commit fce6643

Please sign in to comment.