8000 Expose player's entity id in ServerConnectedEvent by robinbraemer · Pull Request #114 · minekube/gate · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Expose player's entity id in ServerConnectedEvent #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 8 additions & 14 deletions .examples/docker-compose/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# This is a simplified config where the rest of the
# settings are omitted and will be set by default.
# See config.yml for the full configuration options.
#
# The Minecraft editions Gate supports.
editions:
# Java Minecraft edition is the first popular edition for desktops.
java:
enabled: true
config:
bind: 0.0.0.0:25565
servers:
server-0: 0.0.0.0:25566
server-1: 0.0.0.0:25567
try:
- server-0
- server-1
config:
bind: 0.0.0.0:25565
servers:
server-0: 0.0.0.0:25566
server-1: 0.0.0.0:25567
try:
- server-0
- server-1
4 changes: 3 additions & 1 deletion .examples/docker-compose/docker-compose.yml
B93C
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ services:
restart: unless-stopped
network_mode: host
volumes:
- ./config.yml:/gate/config.yml
- ./config.yml:/config.yml
server-0:
image: itzg/minecraft-server
container_name: server-0
environment:
EULA: "true"
TYPE: "PUFFERFISH"
Expand All @@ -21,6 +22,7 @@ services:
restart: unless-stopped
server-1:
image: itzg/minecraft-server
container_name: server-1
environment:
EULA: "true"
TYPE: "PUFFERFISH"
Expand Down
2 changes: 1 addition & 1 deletion .examples/extend/simple-proxy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ This is an example of how to embed and extend Gate in your own Go projects.
The most important part is to register a plugin init hook to initialize your
code (see main function).

**Refer to the [docs](https://gate.minekube.com/docs/extend/go) for a tutorial.**
**Refer to the [Developer Guide](https://gate.minekube.com/developers/) for a tutorial.**
22 changes: 8 additions & 14 deletions .examples/extend/simple-proxy/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# This is a simplified config where the rest of the
# settings are omitted and will be set by default.
# See config.yml for the full configuration options.
#
# The Minecraft editions Gate supports.
editions:
# Java Minecraft edition is the first popular edition for desktops.
java:
enabled: true
config:
bind: 0.0.0.0:25565
servers:
server1: localhost:25566
server2: localhost:25567
try:
- server1
- server2
config:
bind: 0.0.0.0:25565
servers:
server1: localhost:25566
server2: localhost:25567
try:
- server1
- server2
2 changes: 1 addition & 1 deletion .examples/extend/simple-proxy/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/robinbraemer/event v0.0.1
go.minekube.com/brigodier v0.0.1
go.minekube.com/common v0.0.5
go.minekube.com/gate v0.21.5
go.minekube.com/gate v0.22.3-0.20221217193608-d4dee7f48c8c
)

require (
Expand Down
5 changes: 5 additions & 0 deletions .examples/extend/simple-proxy/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,11 @@ func (p *SimpleProxy) registerCommands() {
b.Suggest("&oI am &6&l" + player.Username())
}
b.Suggest("Hello world!")

// We can also order suggestion based on the current input and sort them.
// The slice provides available suggestion candidates.
//return suggest.Similar(b, []string{"FirstTry", "SecondTry"}).Build()

return b.Build()
})).
// Executed when running "/broadcast <message>"
Expand Down
43 changes: 26 additions & 17 deletions .examples/kubernetes/bundle.yaml
10000
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@ data:
# This is a simplified config where the rest of the
# settings are omitted and will be set by default.
# See config.yml for the full configuration options.
#
# The Minecraft editions Gate supports.
editions:
# Java Minecraft edition is the first popular edition for desktops.
java:
enabled: true
config:
bind: 0.0.0.0:25565
servers:
server-0: server-0.servers:25565
server-1: server-1.servers:25565
try:
- server-0
- server-1
config:
bind: 0.0.0.0:25565
servers:
server-0: server-0.servers:25565
server-1: server-1.servers:25565
try:
- server-0
- server-1
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/name: gate
name: gate-config-t5m52f4d44
name: gate-config-8bh2kdmfmd
---
apiVersion: v1
data:
Expand Down Expand Up @@ -99,7 +93,7 @@ spec:
subPath: config.yml
volumes:
- configMap:
name: gate-config-t5m52f4d44
name: gate-config-8bh2kdmfmd
name: config
---
apiVersion: apps/v1
Expand All @@ -125,16 +119,31 @@ spec:
containers:
- env:
- name: TYPE
value: PAPER
value: PUFFERFISH
- name: EULA
value: "TRUE"
- name: ONLINE_MODE
value: "FALSE"
image: itzg/minecraft-server:latest
livenessProbe:
exec:
command:
- mc-health
initialDelaySeconds: 120
periodSeconds: 60
name: server1
ports:
- containerPort: 25565
name: minecraft
readinessProbe:
exec:
command:
- mc-health
failureThreshold: 12
initialDelaySeconds: 20
periodSeconds: 10
stdin: true
tty: true
volumeMounts:
- mountPath: /data/spigot.yml
name: spigot
Expand Down
22 changes: 8 additions & 14 deletions .examples/kubernetes/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# This is a simplified config where the rest of the
# settings are omitted and will be set by default.
# See config.yml for the full configuration options.
#
# The Minecraft editions Gate supports.
editions:
# Java Minecraft edition is the first popular edition for desktops.
java:
enabled: true
config:
bind: 0.0.0.0:25565
servers:
server-0: server-0.servers:25565
server-1: server-1.servers:25565
try:
- server-0
- server-1
config:
bind: 0.0.0.0:25565
servers:
server-0: server-0.servers:25565
server-1: server-1.servers:25565
try:
- server-0
- server-1
5 changes: 5 additions & 0 deletions .examples/simple-network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Simple Network

It **does not** contain server jars, download it yourself https://papermc.io/downloads.

In order to start Gate with the provided config run `gate --config config.yml`.
24 changes: 9 additions & 15 deletions .examples/simple-network/config-velocity.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,12 @@
# This is a simplified config where the rest of the
# settings are omitted and will be set by default.
# See config.yml for the full configuration options.
#
# The Minecraft editions Gate supports.
editions:
# Java Minecraft edition is the first popular edition for desktops.
java:
enabled: true
config:
bind: 0.0.0.0:25565
servers:
velocityserver1: localhost:25568
try:
- velocityserver1
forwarding:
mode: velocity
velocitySecret: my-secret
config:
bind: 0.0.0.0:25565
servers:
velocityserver1: localhost:25568
try:
- velocityserver1
forwarding:
mode: velocity
velocitySecret: my-secret
22 changes: 8 additions & 14 deletions .examples/simple-network/config.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,11 @@
# This is a simplified config where the rest of the
# settings are omitted and will be set by default.
# See config.yml for the full configuration options.
#
# The Minecraft editions Gate supports.
editions:
# Java Minecraft edition is the first popular edition for desktops.
java:
enabled: true
config:
bind: 0.0.0.0:25565
servers:
server1: localhost:25566
server2: localhost:25567
try:
- server1
- server2
config:
bind: 0.0.0.0:25565
servers:
server1: localhost:25566
server2: localhost:25567
try:
- server1
- server2
Binary file not shown.
Binary file not shown.
8 changes: 3 additions & 5 deletions .examples/simple-network/velocityserver1/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
# Velocity test server
# Try Velocity Forwarding Mode

This is a minimal config for testing velocity forwording mode supported by Gate on an 1.18 paper server.
It **does not** contain a server jar and you need to download one yourself https://papermc.io/downloads#Paper-1.18.
This config is known to work with [paper-1.18.1-148.jar](https://papermc.io/api/v2/projects/paper/versions/1.18.1/builds/148/downloads/paper-1.18.1-148.jar),
though any version of paper which supports modern velocity should work.
This is a minimal config for testing velocity forwarding mode supported by Gate on a paper server.
It **does not** contain a server jar, and you need to download one yourself https://papermc.io/downloads.

In order to start Gate with the provided config run `gate --config config-velocity.yml` in the parent directory.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ jobs:
go-version-file: go.mod

- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v3
uses: goreleaser/goreleaser-action@v4
with:
version: latest
args: release --rm-dist
Expand Down
31 changes: 28 additions & 3 deletions .web/docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default defineConfig({
nav: [
{text: 'Quick Start', link: '/guide/quick-start'},
{text: 'Guide', link: '/guide/'},
{text: 'Developers Guide', link: '/developers/'},
{text: 'Developer Guide', link: '/developers/'},
{text: 'Config', link: '/guide/config/'},
{text: 'Downloads', link: '/guide/install/'},
{
Expand Down Expand Up @@ -107,12 +107,24 @@ export default defineConfig({
]
},
{
text: 'Guide',
text: 'Guides',
items: [
{
text: 'Developers Guide',
link: '/developers/',
},
{
text: 'Configurations',
link: '/guide/config/',
},
{
text: 'Security & DDoS Protection',
link: '/guide/security'
},
{
text: 'Lite Mode',
link: '/guide/lite'
},
{
text: 'Enabling Connect',
link: '/guide/connect'
Expand All @@ -138,7 +150,20 @@ export default defineConfig({
items: [
{
text: 'Introduction',
link: '/guide/developers/'
link: '/developers/'
},
{
text: 'Events',
link: '/developers/events'
},
]
},
{
text: 'Learn by Examples',
items: [
{
text: 'Simple Proxy',
link: '/developers/examples/simple-proxy'
},
]
},
Expand Down
2 changes: 2 additions & 0 deletions .web/docs/badges.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
| [![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/minekube/gate?sort=semver)](https://github.com/minekube/gate/releases) | [![Doc](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go)](https://pkg.go.dev/go.minekube.com/gate) | [![GitHub go.mod Go version](https://img.shields.io/github/go-mod/go-version/minekube/gate?logo=go)](https://golang.org/doc/devel/release.html) | [![Go Report Card](https://goreportcard.com/badge/go.minekube.com/gate)](https://goreportcard.com/report/go.minekube.com/gate) | [![test](https://github.com/minekube/gate/workflows/ci/badge.svg)](https://github.com/minekube/gate/actions) | [![Discord](https://img.shields.io/discord/633708750032863232?logo=discord)](https://discord.gg/6vMDqWE) |
|---------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------|
27 changes: 27 additions & 0 deletions .web/docs/developers/events.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Events

_Gate provides a powerful event system that allows you to listen to and modify events that occur in the proxy._

## Subscribing to Events

Events are a way to communicate between different parts between your code and Gate.
They are a way to decouple Gate from your own application code and make it more flexible.

Checkout the [Simple Proxy](examples/simple-proxy#code) for more examples.

Example:
```go
<!--@include: subscribe_example.go -->
```


## Available Events

::: details Available Events

See source on [GitHub](https://github.com/minekube/gate/blob/master/pkg/edition/java/proxy/events.go).

```go
<!--@include: ../../../pkg/edition/java/proxy/events.go -->
```
:::
Loading
0