This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
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 #33 from TheWylot/dev/v2.0.0
DEV-2.0.7 // Added Packet System
- Loading branch information
Showing
7 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
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,8 @@ | ||
package ir.wy.wycore.behind.packet; | ||
|
||
import ir.wy.wycore.WyCore; | ||
|
||
public class Packet { | ||
|
||
// Next Version | ||
} |
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,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
18
src/main/java/ir/wy/wycore/behind/packet/PacketFactory.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 |
---|---|---|
@@ -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
21
src/main/java/ir/wy/wycore/behind/packet/PacketSorting.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 |
---|---|---|
@@ -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; | ||
} | ||
} |
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,5 @@ | ||
package ir.wy.wycore.proxy.utils | ||
|
||
interface ProxyBenchmark { | ||
fun getTPS(): Double | ||
} |
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,7 @@ | ||
package ir.wy.wycore.proxy.utils | ||
|
||
import ir.wy.wycore.WyCore | ||
|
||
interface ProxyInitializer { | ||
fun init(plugin: WyCore) | ||
} |
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,10 @@ | ||
package ir.wy.wycore.proxy.utils | ||
|
||
import org.bukkit.Location | ||
import org.bukkit.entity.Entity | ||
|
||
interface UnknownEntity { | ||
fun createUnknownEntity( | ||
location: Location | ||
): Entity | ||
} |