Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #33 from TheWylot/dev/v2.0.0
Browse files Browse the repository at this point in the history
DEV-2.0.7 // Added Packet System
  • Loading branch information
TheWylot authored Feb 15, 2023
2 parents e491c5c + 72fd3fe commit 1b7df5b
Show file tree
Hide file tree
Showing 7 changed files with 111 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/ir/wy/wycore/behind/packet/Packet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package ir.wy.wycore.behind.packet;

import ir.wy.wycore.WyCore;

public class Packet {

// Next Version
}
42 changes: 42 additions & 0 deletions src/main/java/ir/wy/wycore/behind/packet/PacketEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package ir.wy.wycore.behind.packet;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.jetbrains.annotations.NotNull;


public class PacketEvent implements Cancellable {
private final Packet packet;

private final Player player;


private boolean cancelled = false;


public PacketEvent(@NotNull final Packet packet,
@NotNull final Player player) {
this.packet = packet;
this.player = player;
}

@NotNull
public Packet getPacket() {
return packet;
}

@NotNull
public Player getPlayer() {
return player;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(final boolean cancelled) {
this.cancelled = cancelled;
}
}
18 changes: 18 additions & 0 deletions src/main/java/ir/wy/wycore/behind/packet/PacketFactory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package ir.wy.wycore.behind.packet;

import org.jetbrains.annotations.NotNull;

public interface PacketFactory {

default void onSend(@NotNull final PacketEvent event) {
// Override when needed.
}

default void onReceive(@NotNull final PacketEvent event) {
// Override when needed.
}

default boolean getPriority() {
return PacketSorting.NORMAL;
}
}
21 changes: 21 additions & 0 deletions src/main/java/ir/wy/wycore/behind/packet/PacketSorting.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package ir.wy.wycore.behind.packet;

import org.jetbrains.annotations.NotNull;

public interface PacketSorting {

boolean NORMAL = true;

default void onSend(@NotNull final PacketEvent event) {
// Override when needed.
}

default void onReceive(@NotNull final PacketEvent event) {
// Override when needed.
}


default boolean getPriority() {
return PacketSorting.NORMAL;
}
}
5 changes: 5 additions & 0 deletions src/main/java/ir/wy/wycore/proxy/utils/ProxyBenchmark.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package ir.wy.wycore.proxy.utils

interface ProxyBenchmark {
fun getTPS(): Double
}
7 changes: 7 additions & 0 deletions src/main/java/ir/wy/wycore/proxy/utils/ProxyInitializer.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package ir.wy.wycore.proxy.utils

import ir.wy.wycore.WyCore

interface ProxyInitializer {
fun init(plugin: WyCore)
}
10 changes: 10 additions & 0 deletions src/main/java/ir/wy/wycore/proxy/utils/UnknownEntity.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package ir.wy.wycore.proxy.utils

import org.bukkit.Location
import org.bukkit.entity.Entity

interface UnknownEntity {
fun createUnknownEntity(
location: Location
): Entity
}

0 comments on commit 1b7df5b

Please sign in to comment.