Skip to content

Commit

Permalink
[CORE] Re-Implement APIs. Add 2 new APIs for the Menus and Move Prote…
Browse files Browse the repository at this point in the history
…ctions to the API folder. Add Lombok as Dependency

Signed-off-by: Wolfieheart <[email protected]>
  • Loading branch information
Wolfieheart committed Jan 3, 2025
1 parent 9ef2f62 commit 9d190a3
Show file tree
Hide file tree
Showing 14 changed files with 349 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@
<version>1.21.4-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<!-- Lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.16.16</version>
<scope>provided</scope>
</dependency>

</dependencies>
<!--Java 8-->
<build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package io.github.rypofalem.armorstandeditor.api;

import org.bukkit.block.Block;
import org.bukkit.entity.Player;

public interface Protections {
boolean checkPermission(Block block, Player player);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package io.github.rypofalem.armorstandeditor.api.events;
import lombok.Getter;

import org.bukkit.entity.ArmorStand;
import org.bukkit.event.Event;

public abstract class ArmorStandEvent extends Event {

@Getter
protected final ArmorStand armorStand;

protected ArmorStandEvent(ArmorStand armorStand) {
this.armorStand = armorStand;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;
import lombok.Setter;

import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

public class ArmorStandManipulatedEvent extends ArmorStandEvent implements Cancellable {

@Getter
@Setter
private boolean cancelled = false;

@Getter
protected final Player player;

public ArmorStandManipulatedEvent(ArmorStand armorStand, Player player) {
super(armorStand);
this.player = player;
}

/* Generated for Bukkit */
private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return (handlers);
}

@Override
public HandlerList getHandlers() {
return (handlers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;
import lombok.Setter;

import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

public class ArmorStandRenameEvent extends ArmorStandEvent implements Cancellable {

@Getter
@Setter
private boolean cancelled = false;
@Getter
@Setter
protected String name;

@Getter
protected final Player player;

public ArmorStandRenameEvent(ArmorStand armorStand, Player player, String name) {
super(armorStand);
this.player = player;
this.name = name;
}

/* Generated for Bukkit */
private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return (handlers);
}

@Override
public HandlerList getHandlers() {
return (handlers);
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;
import lombok.Setter;

import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

public class ArmorStandTargetedEvent extends ArmorStandEvent implements Cancellable {
@Getter
@Setter
private boolean cancelled = false;

@Getter
protected final Player player;

public ArmorStandTargetedEvent(ArmorStand armorStand, Player player) {
super(armorStand);
this.player = player;
}

/* Generated for Bukkit */
private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return (handlers);
}

@Override
public HandlerList getHandlers() {
return (handlers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;

import org.bukkit.entity.ItemFrame;
import org.bukkit.event.Event;

public abstract class ItemFrameEvent extends Event {

@Getter
protected final ItemFrame itemFrame;

protected ItemFrameEvent(ItemFrame itemFrame) {
this.itemFrame = itemFrame;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;
import lombok.Setter;

import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

public class ItemFrameManipulatedEvent extends ItemFrameEvent implements Cancellable {

@Getter
@Setter
private boolean cancelled = false;

@Getter
protected final Player player;

public ItemFrameManipulatedEvent(ItemFrame itemFrame, Player player) {
super(itemFrame);
this.player = player;
}

/* Generated for Bukkit */
private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return (handlers);
}

@Override
public HandlerList getHandlers() {
return (handlers);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;
import lombok.Setter;

import org.bukkit.entity.ItemFrame;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;

public class ItemFrameTargetedEvent extends ItemFrameEvent implements Cancellable {
@Getter
@Setter
private boolean cancelled = false;

@Getter
protected final Player player;

public ItemFrameTargetedEvent(ItemFrame itemFrame, Player player) {
super(itemFrame);
this.player = player;
}

/* Generated for Bukkit */
private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return (handlers);
}

@Override
public HandlerList getHandlers() {
return (handlers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.github.rypofalem.armorstandeditor.api.events;

import lombok.Getter;
import lombok.Setter;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;

public class PlayerOpenMenuEvent extends Event implements Cancellable {
@Getter
@Setter
private boolean cancelled = false;

@Getter
protected final Player player;

public PlayerOpenMenuEvent(Player player) {
this.player = player;
}

/* Generated for Bukkit */
private static final HandlerList handlers = new HandlerList();

public static HandlerList getHandlerList() {
return (handlers);
}

@Override
public HandlerList getHandlers() {
return (handlers);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package io.github.rypofalem.armorstandeditor.api.events.editor;

import io.github.rypofalem.armorstandeditor.menu.EditorMenu;
import lombok.Getter;
import lombok.Setter;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;

public class ArmorStandEditorOpenedEvent extends EditorMenuEvent implements Cancellable {
@Getter
@Setter
private boolean cancelled = false;

public ArmorStandEditorOpenedEvent(Player player, EditorMenu menu) {
super(player, menu);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package io.github.rypofalem.armorstandeditor.api.events.editor;

import io.github.rypofalem.armorstandeditor.menu.EditorMenu;
import lombok.Getter;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.jetbrains.annotations.NotNull;

public class EditorMenuEvent extends Event {

@Getter
private final Player player;
@Getter
private final EditorMenu menu;

private static final HandlerList HANDLERS = new HandlerList();

public EditorMenuEvent(Player player, EditorMenu menu){
this.player = player;
this.menu = menu;
}

@Override
public @NotNull HandlerList getHandlers() {
return HANDLERS;
}

public static HandlerList getHandlerList() {
return HANDLERS;
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.github.rypofalem.armorstandeditor.playereditor;

import io.github.rypofalem.armorstandeditor.ArmorStandEditorPlugin;

//TODO: To be Refactored
public class PlayerEditor {

public final ArmorStandEditorPlugin plugin;

public PlayerEditor(ArmorStandEditorPlugin plugin) {
this.plugin = plugin;
}

public PlayerEditorManager getManager(){
return plugin.editorManager;
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package io.github.rypofalem.armorstandeditor.playereditor;

//TODO: To be Refactored

import io.github.rypofalem.armorstandeditor.menu.ASEHolder;
import org.bukkit.event.EventHandler;

public class PlayerEditorManager {

@EventHandler
private void onEditorOpened()

}

0 comments on commit 9d190a3

Please sign in to comment.