mirror of
https://github.com/plexusorg/Plex.git
synced 2025-06-27 06:06:40 +00:00
Move Plex to API-driven plugin and fix NoClassDefFoundError on startup
This commit is contained in:
21
api/build.gradle
Normal file
21
api/build.gradle
Normal file
@ -0,0 +1,21 @@
|
||||
plugins {
|
||||
id 'java'
|
||||
}
|
||||
|
||||
group 'dev.plex'
|
||||
version '1.1-SNAPSHOT'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
mavenLocal()
|
||||
maven {
|
||||
url = uri("https://papermc.io/repo/repository/maven-public/")
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compileOnly "org.projectlombok:lombok:1.18.22"
|
||||
annotationProcessor "org.projectlombok:lombok:1.18.22"
|
||||
compileOnly "io.papermc.paper:paper-api:1.18.2-R0.1-SNAPSHOT"
|
||||
compileOnly "org.json:json:20220320"
|
||||
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
api/build/classes/java/main/dev/plex/api/rank/IRank.class
Normal file
BIN
api/build/classes/java/main/dev/plex/api/rank/IRank.class
Normal file
Binary file not shown.
BIN
api/build/libs/api-1.1-SNAPSHOT.jar
Normal file
BIN
api/build/libs/api-1.1-SNAPSHOT.jar
Normal file
Binary file not shown.
BIN
api/build/tmp/compileJava/previous-compilation-data.bin
Normal file
BIN
api/build/tmp/compileJava/previous-compilation-data.bin
Normal file
Binary file not shown.
2
api/build/tmp/jar/MANIFEST.MF
Normal file
2
api/build/tmp/jar/MANIFEST.MF
Normal file
@ -0,0 +1,2 @@
|
||||
Manifest-Version: 1.0
|
||||
|
40
api/src/main/java/dev/plex/api/event/AdminAddEvent.java
Normal file
40
api/src/main/java/dev/plex/api/event/AdminAddEvent.java
Normal file
@ -0,0 +1,40 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is run when a player is added to the admin list
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class AdminAddEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* The sender who added the player
|
||||
*/
|
||||
private final CommandSender sender;
|
||||
|
||||
/**
|
||||
* The PlexPlayer that was added
|
||||
*/
|
||||
private final IPlexPlayer plexPlayer;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
}
|
39
api/src/main/java/dev/plex/api/event/AdminRemoveEvent.java
Normal file
39
api/src/main/java/dev/plex/api/event/AdminRemoveEvent.java
Normal file
@ -0,0 +1,39 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is run when a player is removed from the admin list
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class AdminRemoveEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* The sender who added the player
|
||||
*/
|
||||
private final CommandSender sender;
|
||||
|
||||
/**
|
||||
* The PlexPlayer that was removed
|
||||
*/
|
||||
private final IPlexPlayer plexPlayer;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
45
api/src/main/java/dev/plex/api/event/AdminSetRankEvent.java
Normal file
45
api/src/main/java/dev/plex/api/event/AdminSetRankEvent.java
Normal file
@ -0,0 +1,45 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import dev.plex.api.rank.IRank;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is run when an admins rank is set
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class AdminSetRankEvent extends Event
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* The sender who added the player
|
||||
*/
|
||||
private final CommandSender sender;
|
||||
|
||||
/**
|
||||
* The PlexPlayer that was removed
|
||||
*/
|
||||
private final IPlexPlayer plexPlayer;
|
||||
|
||||
/**
|
||||
* The rank the player was set to
|
||||
*/
|
||||
private final IRank rank;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
public class GameModeUpdateEvent extends Event
|
||||
{
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
private final CommandSender sender;
|
||||
|
||||
private final Player player;
|
||||
|
||||
private final GameMode gameMode;
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
/**
|
||||
* Superclass for punishment events
|
||||
*/
|
||||
@Getter
|
||||
public abstract class PunishedPlayerEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
/**
|
||||
* The player who was punished
|
||||
*/
|
||||
protected IPlexPlayer punishedPlayer;
|
||||
|
||||
/**
|
||||
* Whether the event was cancelled
|
||||
*/
|
||||
@Setter
|
||||
protected boolean cancelled; //TODO: unsure if cancelling the event does anything
|
||||
|
||||
/**
|
||||
* Creates an event object
|
||||
*
|
||||
* @param punishedPlayer The player who was punished
|
||||
* @see IPlexPlayer
|
||||
*/
|
||||
protected PunishedPlayerEvent(IPlexPlayer punishedPlayer)
|
||||
{
|
||||
super(Bukkit.getPlayer(punishedPlayer.getUuid()));
|
||||
this.punishedPlayer = punishedPlayer;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is called when a player is frozen or unfrozen
|
||||
*/
|
||||
@Getter
|
||||
public class PunishedPlayerFreezeEvent extends PunishedPlayerEvent implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* New frozen state of the player
|
||||
*/
|
||||
private final boolean frozen;
|
||||
|
||||
/**
|
||||
* Creates a new event instance
|
||||
*
|
||||
* @param punishedPlayer The player who was punished
|
||||
* @param frozen The new frozen status
|
||||
*/
|
||||
public PunishedPlayerFreezeEvent(IPlexPlayer punishedPlayer, boolean frozen)
|
||||
{
|
||||
super(punishedPlayer);
|
||||
this.frozen = frozen;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is called when a player is frozen or unfrozen
|
||||
*/
|
||||
@Getter
|
||||
public class PunishedPlayerLockupEvent extends PunishedPlayerEvent implements Cancellable
|
||||
{
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* New lock up state of the player
|
||||
*/
|
||||
private final boolean lockedUp;
|
||||
|
||||
/**
|
||||
* Creates a new event instance
|
||||
*
|
||||
* @param punishedPlayer The player who was punished
|
||||
* @param lockedUp The new muted status
|
||||
*/
|
||||
public PunishedPlayerLockupEvent(IPlexPlayer punishedPlayer, boolean lockedUp)
|
||||
{
|
||||
super(punishedPlayer);
|
||||
this.lockedUp = lockedUp;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package dev.plex.api.event;
|
||||
|
||||
import dev.plex.api.player.IPlexPlayer;
|
||||
import lombok.Getter;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
|
||||
/**
|
||||
* Event that is called when a player is frozen or unfrozen
|
||||
*/
|
||||
@Getter
|
||||
public class PunishedPlayerMuteEvent extends PunishedPlayerEvent implements Cancellable
|
||||
{
|
||||
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
|
||||
/**
|
||||
* New muted state of the player
|
||||
*/
|
||||
private final boolean muted;
|
||||
|
||||
/**
|
||||
* Creates a new event instance
|
||||
*
|
||||
* @param punishedPlayer The player who was punished
|
||||
* @param muted The new muted status
|
||||
*/
|
||||
public PunishedPlayerMuteEvent(IPlexPlayer punishedPlayer, boolean muted)
|
||||
{
|
||||
super(punishedPlayer);
|
||||
this.muted = muted;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return handlers;
|
||||
}
|
||||
}
|
68
api/src/main/java/dev/plex/api/player/IPlexPlayer.java
Normal file
68
api/src/main/java/dev/plex/api/player/IPlexPlayer.java
Normal file
@ -0,0 +1,68 @@
|
||||
package dev.plex.api.player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.permissions.PermissionAttachment;
|
||||
|
||||
public interface IPlexPlayer
|
||||
{
|
||||
|
||||
String getId();
|
||||
|
||||
UUID getUuid();
|
||||
|
||||
String getName();
|
||||
|
||||
Player getPlayer();
|
||||
|
||||
void setPlayer(Player player);
|
||||
|
||||
String getLoginMessage();
|
||||
|
||||
void setLoginMessage(String message);
|
||||
|
||||
String getPrefix();
|
||||
|
||||
void setPrefix(String prefix);
|
||||
|
||||
boolean isVanished();
|
||||
|
||||
void setVanished(boolean vanished);
|
||||
|
||||
boolean isCommandSpy();
|
||||
|
||||
void setCommandSpy(boolean commandSpy);
|
||||
|
||||
boolean isFrozen();
|
||||
|
||||
void setFrozen(boolean frozen);
|
||||
|
||||
boolean isMuted();
|
||||
|
||||
void setMuted(boolean muted);
|
||||
|
||||
boolean isLockedUp();
|
||||
|
||||
void setLockedUp(boolean lockedUp);
|
||||
|
||||
boolean isAdminActive();
|
||||
|
||||
void setAdminActive(boolean active);
|
||||
|
||||
long getCoins();
|
||||
|
||||
void setCoins(long coins);
|
||||
|
||||
String getRank();
|
||||
|
||||
void setRank(String rank);
|
||||
|
||||
List<String> getIps();
|
||||
|
||||
void setIps(List<String> ips);
|
||||
|
||||
PermissionAttachment getPermissionAttachment();
|
||||
|
||||
void setPermissionAttachment(PermissionAttachment attachment);
|
||||
}
|
27
api/src/main/java/dev/plex/api/rank/IRank.java
Normal file
27
api/src/main/java/dev/plex/api/rank/IRank.java
Normal file
@ -0,0 +1,27 @@
|
||||
package dev.plex.api.rank;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public interface IRank
|
||||
{
|
||||
|
||||
int getLevel();
|
||||
|
||||
String getLoginMessage();
|
||||
|
||||
void setLoginMessage(String message);
|
||||
|
||||
String getReadable();
|
||||
|
||||
Component getPrefix();
|
||||
|
||||
void setPrefix(String prefix);
|
||||
|
||||
NamedTextColor getColor();
|
||||
|
||||
boolean isAtLeast(IRank rank);
|
||||
|
||||
JSONObject toJSON();
|
||||
}
|
Reference in New Issue
Block a user