mirror of
https://github.com/Eaglercraft-Archive/Eaglercraft-1.5.2-src
synced 2025-06-05 18:32:01 -09:00
uploading files
This commit is contained in:
commit
a2de686d7c
24
.classpath
Normal file
24
.classpath
Normal file
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="bin/main" path="src/main/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/main" path="src/teavm/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="src" output="bin/main" path="sp-server/src/ipc/java">
|
||||
<attributes>
|
||||
<attribute name="gradle_scope" value="main"/>
|
||||
<attribute name="gradle_used_by_scope" value="main,test"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8/"/>
|
||||
<classpathentry kind="con" path="org.eclipse.buildship.core.gradleclasspathcontainer"/>
|
||||
<classpathentry kind="output" path="bin/default"/>
|
||||
</classpath>
|
10
.gitattributes
vendored
Normal file
10
.gitattributes
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
#
|
||||
# https://help.github.com/articles/dealing-with-line-endings/
|
||||
#
|
||||
|
||||
*.bat text eol=crlf
|
||||
*.sh text eol=lf
|
||||
gradlew text eol=lf
|
||||
|
||||
*.html linguist-vendored
|
||||
*.htm linguist-vendored
|
35
.gitignore
vendored
Normal file
35
.gitignore
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
.gradle
|
||||
.settings
|
||||
.idea
|
||||
build
|
||||
bin
|
||||
eaglercraftbungee/.idea
|
||||
eaglercraftbungee/bin
|
||||
eaglercraftbungee/rundir
|
||||
eaglercraftbungee/test
|
||||
eaglercraftbungee/src/main/java/META-INF
|
||||
eaglercraftbungee/out
|
||||
epkcompiler/bin
|
||||
spigot-server/world*
|
||||
eaglercraftbungee/rundir
|
||||
stable-download/java/spigot_command/world/*
|
||||
stable-download/java/spigot_command/world_nether/*
|
||||
stable-download/java/spigot_command/world_the_end/*
|
||||
stable-download/java/spigot_command/server.log
|
||||
stable-download/java/bungee_command/proxy*
|
||||
lwjgl-rundir/_eagstorage*
|
||||
sp-server/.gradle
|
||||
sp-server/.settings
|
||||
sp-server/build
|
||||
sp-server/bin
|
||||
stable-download/_repl*
|
||||
lwjgl-rundir/_eagstorage*
|
||||
*.bak
|
||||
sp-relay/out
|
||||
sp-relay/test
|
||||
sp-relay/.idea
|
||||
sp-relay/src/main/java/META-INF
|
||||
zip-generator/out
|
||||
zip-generator/src/main/java/META-INF
|
||||
*.iml
|
||||
crash_report_override.txt
|
23
.project
Normal file
23
.project
Normal file
@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>eaglercraft</name>
|
||||
<comment>Project eaglercraft-unified created by Buildship.</comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.buildship.core.gradleprojectbuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
<nature>org.eclipse.buildship.core.gradleprojectnature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
3
CompileEPK.bat
Normal file
3
CompileEPK.bat
Normal file
@ -0,0 +1,3 @@
|
||||
@echo off
|
||||
cd epkcompiler
|
||||
run
|
3
CompileEPK.sh
Normal file
3
CompileEPK.sh
Normal file
@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
cd epkcompiler
|
||||
./run_unix.sh
|
4
GetRepositorySignature.bat
Normal file
4
GetRepositorySignature.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
title GetRepositorySignature
|
||||
java -cp GetRepositorySignature.jar net.lax1dude.signature_tool.checker.SignatureChecker
|
||||
pause
|
BIN
GetRepositorySignature.jar
Normal file
BIN
GetRepositorySignature.jar
Normal file
Binary file not shown.
2
GetRepositorySignature.sh
Normal file
2
GetRepositorySignature.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
java -cp GetRepositorySignature.jar net.lax1dude.signature_tool.checker.SignatureChecker
|
76
LAX1DUDE_SIGNATURE.txt
Normal file
76
LAX1DUDE_SIGNATURE.txt
Normal file
@ -0,0 +1,76 @@
|
||||
-----BEGIN PGP SIGNED MESSAGE-----
|
||||
Hash: SHA256
|
||||
|
||||
Hello, this is lax1dude, I regret to inform you that the official repository
|
||||
for Eaglercraft 1.5.2 has been deleted
|
||||
|
||||
This folder contains a copy of the repo from the day it was deleted, and a tool
|
||||
to verify it's authenticity
|
||||
|
||||
Run "GetRepositorySignature.bat", and verify that this is the result:
|
||||
|
||||
|
||||
~~~ Repository SHA-256: ~~~
|
||||
|
||||
ba2015db643a0dd6
|
||||
e78bbf92f27f76ae
|
||||
0797feb78874edb4
|
||||
19d14a8b54373269
|
||||
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
|
||||
Additionally, verify that the following files have the following SHA-1 checksums:
|
||||
|
||||
GetRepositorySignature.jar: DCE2D7FDA9065B2475E5894E5D0960B57B03C661
|
||||
GetRepositorySignature.bat: 4B995076348E03A5322F3EB6AF72948E4C27CEB6
|
||||
GetRepositorySignature.sh: 8B269BA0D54C2B4BD7E9199B10C9769D39F00DC6
|
||||
|
||||
|
||||
If this is all correct, then you are truly using the official final release of
|
||||
Eaglercraft 1.5.2, made by the real LAX1DUDE ;>
|
||||
|
||||
|
||||
You can download a clean copy of "GetRepositorySignature.jar" here: [https://deev.is/eagler/GetRepositorySignature.jar]
|
||||
|
||||
Use "GetRepositorySignature.sh" in place of "GetRepositorySignature.bat" on linux
|
||||
|
||||
|
||||
run "java -jar GetRepositorySignature.jar" to launch a GUI version of the tool,
|
||||
which allows you to select the repository to check using a file chooser
|
||||
|
||||
|
||||
To verify the PGP signature on this message, my public key is here: [https://deev.is/certs/LAX1DUDE_eagler_public.asc]
|
||||
|
||||
The original copy of this message is available here too: [https://deev.is/eagler/LAX1DUDE_SIGNATURE.txt]
|
||||
|
||||
|
||||
Thank you all for the stars and support for this project but I simply want closure
|
||||
that I will never wake up one busy day in the future and have to drop everything
|
||||
and come back to this project and fight a DMCA when I'm not even working on it
|
||||
anymore. When a repository on github gets DMCA'd, all of it's forks also get DMCA'd
|
||||
which would eradicate it off github, but if we all fork it and then delete the
|
||||
original then Microsoft would have to DMCA individual forks instead of just my
|
||||
original repository which they obviously don't have time to do. This is for the
|
||||
best, trust me, we'll always have this checksum here of the files of the official
|
||||
final release so we can always find a repo and come back to this commit and check
|
||||
if it's mine and if it is then play it the way it was meant to be played with all
|
||||
of my original code and it'll be like I never deleted it
|
||||
|
||||
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
|
||||
iQIzBAEBCAAdFiEEcBgAq2s4AHU8tLsdcu68cJImpGoFAmNmFz4ACgkQcu68cJIm
|
||||
pGrjlBAAjxaXHOI6DNoAORhsJUi+B9z84/3i+XJ7U7RXYnbI1Gtg6A6s2hozoXI3
|
||||
Dp3lrmS6VpaZiutlyzl6maraAtMKR/edQPl1N2p8ugqr6g+nwfCuBCjl32MOI56a
|
||||
DDti9Vzd8SUVKh4KCxQ4MJy8v0lg42z/1DBEWDWb/Ri7dWeGcxQARjNHnql999Jo
|
||||
f+ECDvOQgOtgQrIQkkFXfxqSvJi5uAT3MXQvEF7hBhMf9XbwNy8gfE8s1+o7rn55
|
||||
D78jmk0w3utzCzzj7QmAha+fLt9K97Xyd4L3vtMvnoEraW87Z3H8UCBQde+gXmm6
|
||||
Qwvul+pX/AmZaYF7cLs74oTctu6njCswXiKmobQpi0eIu1F4Q7fefByMFUUeF3kB
|
||||
8fNLUb7FYsYr97LWEtufDPdJ3eM/o5qn4SGlzjQlYUG/BGSfKd2dioNAKxwQZ4yb
|
||||
rLegHuQOjm3aAk0qlYaDM1PFpK5wiz3xjGIxt8uxxVrZ023Nk6fPF3ONyWlswYyv
|
||||
cnIIO9dSmcvvyIanhHF+tGYaPOct61YLH1vDoWE/OUrCG/B7vGGDnKW3X2dcI7NQ
|
||||
Pe+hgpcKc0qEkX8qr3SxHNJQgcWkVXnWLx8e3zZBqTYdSN8n4KgxJg0enHN9ylMu
|
||||
VOAaCkMYZfwK7wQgh0rgynmRyOYO2eQaet4HRsbxJlZLQ01sI5c=
|
||||
=Jgpm
|
||||
-----END PGP SIGNATURE-----
|
3
LICENSE
Normal file
3
LICENSE
Normal file
@ -0,0 +1,3 @@
|
||||
This work is licensed under a Creative Commons
|
||||
Attribution-NonCommercial 4.0 International License
|
||||
http://creativecommons.org/licenses/by-nc/4.0/
|
366
README.md
Normal file
366
README.md
Normal file
@ -0,0 +1,366 @@
|
||||
# This repository will be deleted imminently
|
||||
|
||||
### Create a fresh fork ASAP to preserve it, you MUST fork a 100% fresh copy in order for the repository to be considered genuine
|
||||
|
||||
### Please read `LAX1DUDE_SIGNATURE.txt` for instructions to verify this is an original copy, if the file is not present then do not use this copy of the project
|
||||
|
||||
### LAX1DUDE's PGP key is here: [https://deev.is/certs/LAX1DUDE_eagler_public.asc](https://deev.is/certs/LAX1DUDE_eagler_public.asc)
|
||||
|
||||
### Do not edit this README, modifying any file will invalidate the repository's checksum
|
||||
|
||||
### Download your worlds off of [https://g.deev.is/eaglercraft/](https://g.deev.is/eaglercraft/) and alts in case of a URL change for the demo client
|
||||
|
||||
### MY LAN WORLD RELAYS (relay.deev.is, relay.lax1dude.net) WILL REMAIN ONLINE FOR CONVENIENCE
|
||||
|
||||
# Eaglercraft
|
||||
|
||||

|
||||
:-:
|
||||
Eaglercraft is real Minecraft 1.5.2 that you can play in any regular web browser. That includes school chromebooks, it works on all chromebooks. It supports both singleplayer and multiplayer.
|
||||
|
||||
**Currently maintained by [ayunami2000](https://github.com/ayunami2000)**
|
||||
|
||||
**For any questions you can join the discord server and hit us up there [https://discord.gg/Ekzcgs3DKZ](https://discord.gg/Ekzcgs3DKZ)**
|
||||
|
||||
# Quick Start
|
||||
|
||||
### Client: [https://g.deev.is/eaglercraft/](https://g.deev.is/eaglercraft/) [^1]
|
||||
|
||||
### Offline Client Download: [Offline_Download_Version.html](https://github.com/lax1dude/eaglercraft/raw/main/stable-download/Offline_Download_Version.html)
|
||||
|
||||
**(right click the link and press 'Save link as...' to download the file)**
|
||||
|
||||
### Play Minecraft Beta Singleplayer: [https://g.deev.is/eaglercraft/beta/](https://g.deev.is/eaglercraft/beta/)
|
||||
|
||||
[^1]: A list of public servers are already added into the official client
|
||||
|
||||
# Table Of Contents:
|
||||
| [Singleplayer](#Singleplayer) | [Multiplayer](#Multiplayer) | [Others](#Others) |
|
||||
|---------------------------------------------------------------|---------------------------------------------------------------------------------|-------------------------------------------------------|
|
||||
| [Importing and Exporting Worlds](#Importing-and-Exporting-Worlds) | [Public clients and servers](#Public-clients-and-servers) | [Plugin Development](#Plugin-Development) |
|
||||
| [LAN Worlds](#LAN-Worlds) | [Creating a Server - Bukkit](#Creating-a-server---Bukkit) | [Compiling](#Compiling) |
|
||||
| [Public LAN Relays](#Public-LAN-Relays) | [Creating a Server - EaglercraftBungee](#Creating-a-server---EaglercraftBungee) | [Creating a resource pack](#Creating-a-resource-pack) |
|
||||
| [Creating a LAN Relay](#Creating-a-LAN-Relay) | [Creating a Client](#Creating-a-Client) | [Contributing](#Contributing) |
|
||||
| | [EaglercraftBungee Configuration](#EaglercraftBungee-Configuration) | |
|
||||
| | [Creating a Reverse Proxy - NGINX](#Creating-a-Reverse-Proxy---NGINX) | |
|
||||
| | [NGINX Configuration](#NGINX-Configuration) | |
|
||||
|
||||
# Singleplayer
|
||||
|
||||
Simply press the 'Singleplayer' button on the main menu and you can create a regular vanilla minecraft and play it any time.
|
||||
|
||||
## Importing and Exporting Worlds
|
||||
The worlds are stored in your browser's local storage, **you can export them as EPK files and import them again on all other Eaglercraft sites that also support singleplayer.** You can even copy an exported world to an entirely different computer, or send it to a friend, and import it and continue playing with all your progress saved.
|
||||
|
||||
## LAN Worlds
|
||||
|
||||
### Eaglercraft fully supports LAN worlds, you can share your world with any player and they can connect directly to it as if you are running a server in your browser.
|
||||
|
||||
**LAN worlds will work between any two devices connected to the internet, you are not limited to only players connected to your Wi-Fi network**
|
||||
|
||||
To open your world to LAN, go to the pause menu and click 'Open to LAN'. You can configure the gamemode and cheats and if you would like to hide your LAN world. **When you do not hide your LAN world, it will appear on the Multiplayer screen from the main menu to anybody else also on your Wi-Fi network.** Set the world hidden if you are at school or something and don't want everyone else in your class to join as well and start griefing.
|
||||
|
||||
When you open the world to LAN it will give you a 'join code'. Simply share the code with your friends and they can visit the Multiplayer screen from the main menu and click 'Direct Connect' and enter the code and they will be able to join your world.
|
||||
|
||||
Make sure they add the relay server your game opens the LAN world on to their "Network Settings" menu accessable from the Multiplayer screen. You simply must send them the URL indicated in the pause menu once the world is opened and they can use the "Add Relay" option to add the URL to their list.
|
||||
|
||||
### THIS IS A REQUIRED STEP FOR A PERSON TO JOIN YOUR WORLD, IF THEY DO NOT HAVE THE RELAY YOUR WORLD IS HOSTED ON ADDED TO THEIR "Network Settings" THE GAME WILL BE UNABLE TO LOCATE THE WORLD
|
||||
|
||||
## Public LAN Relays
|
||||
|
||||
### Here are some public relay servers you can use:
|
||||
|
||||
- `wss://relay.deev.is/`
|
||||
- `wss://relay.lax1dude.net/`
|
||||
- `wss://relay.shhnowisnottheti.me/`
|
||||
|
||||
## Creating a LAN Relay
|
||||
|
||||
### Simply download [stable-download/sp-relay.jar](https://github.com/lax1dude/eaglercraft/blob/main/stable-download/sp-relay.jar) and run `java -jar sp-relay.jar`
|
||||
|
||||
**Run `java -jar sp-relay.jar --debug` to view debug info like all the IPs of incoming connections, as it is not shown by default because logging all that info will reduce performance when the relay is being pinged many times a second depending on it's popularity.**
|
||||
|
||||
Edit the `relayConfig.ini` file generated on first launch to change the port and configure ratelimiting and such, and `relays.txt` to change the list of STUN and TURN relays reported to clients connecting to the relay, which are required to correctly establish a P2P LAN world connection in browsers
|
||||
|
||||
**The `origin-whitelist` config variable is a semicolon (`;`) seperated list of domains used to restrict what sites are to be allowed to use your relay. When left blank it allows all sites. Add `offline` to allow offline download clients to use your relay as well, and `null` to allow connections that do not specify an `Origin:` header. Use `*` as a wildcard, for example: `*.deev.is` allows all domains ending with "deev.is" to use the relay.**
|
||||
|
||||
# Multiplayer
|
||||
Multiplayer functions like vanilla Minecraft, allowing you to join normal Minecraft servers like a normal client.
|
||||
|
||||
## Public clients and servers
|
||||
|
||||
### There are multiple official clients hosted by lax1dude, here is a small list:
|
||||
- Main: [https://g.deev.is/](https://g.deev.is/ "https://g.deev.is/")
|
||||
- [https://eaglercraft.net/](https://eaglercraft.net/ "https://eaglercraft.net/")
|
||||
- [https://eaglercraft.org/](https://eaglercraft.org/ "https://eaglercraft.org/")
|
||||
- [https://eaglercraft.me/](https://eaglercraft.me/ "https://eaglercraft.me/")
|
||||
- [https://g.lax1dude.net/eaglercraft/](https://g.lax1dude.net/eaglercraft/ "https://g.lax1dude.net/eaglercraft/")
|
||||
### There are also multiple community hosted servers, the best way to discover those is to use the [official clients](https://g.deev.is/eaglercraft/)
|
||||
|
||||
#### Alternatively, there is a server list[^2] to find servers.
|
||||
|
||||
[^2]: Server list is currently being rebuilt, use official client for now
|
||||
|
||||
# Creating your own server
|
||||
|
||||
There are ***multiple parts*** **to a server**, mainly consisting of a **regular 1.5.2 Bukkit server**, and a **modified version of Bungeecord** called **EaglercraftBungee**, which on top of the regular Bungeecord functionality, it translates WebSocket connections to raw TCP connections which Bukkit can understand.
|
||||
|
||||
You may also want to set up your own **client**, allowing you to *control default server listings, resource packs, and an overall faster connection due to less load.*
|
||||
|
||||
If you want to use a domain for your server, **a reverse proxy** can be set up to enable extra functionality within EaglercraftBungee. **NGINX** is recommended, and a tutorial is included **[here](#Creating-a-Reverse-Proxy---NGINX)**. **This is optional, and can be skipped by just connecting with the IP.**
|
||||
|
||||
### If replit is acceptable, you can use [this](https://replit.com/@ayunami2000/eaglercraft-server) to automatically set up everything for a server, otherwise, look below for instructions
|
||||
|
||||
## Creating a server - Bukkit
|
||||
|
||||
1. **Check if Java is installed.** You can download it from [https://www.java.com/en/download/](https://www.java.com/en/download/)
|
||||
2. Download the [stable-download/stable-download.zip](https://github.com/lax1dude/eaglercraft/raw/main/stable-download/stable-download.zip) file from this repository
|
||||
4. Extract the ZIP file you downloaded to a new folder
|
||||
5. Open the new folder, go into the `java/bukkit_command` folder
|
||||
6. In Windows, double-click `run.bat`. It should open a new terminal window
|
||||

|
||||
**Some computers may just say 'run' instead of 'run.bat', both are correct**
|
||||
7. On macOS or Linux, google how to open the terminal and use the `cd` command to navigate to `java/bukkit_command`
|
||||
Then, in that folder, run `chmod +x run_unix.sh` and then run `./run_unix.sh`. It should start the same server
|
||||
8. To add some bukkit plugins, download the plugin's JAR file for CraftBukkit 1.5.2 and place it in `java/bukkit_command/plugins`
|
||||
(See [https://github.com/lax1dude/eaglercraft-plugins/](https://github.com/lax1dude/eaglercraft-plugins/) to download some supported plugins)
|
||||
|
||||
## Creating a server - EaglercraftBungee
|
||||
1. In the same new folder, go into the `java/bungee_command` folder
|
||||
2. In Windows, double-click `run.bat`. It should open a second terminal window
|
||||
Keep both the first and second terminal window you opened, just minimize them, don't close
|
||||
3. On macOS or Linux, repeat step 7 in [Creating a Server - Bukkit](#Creating-a-server---Bukkit), but navigate to `java/bungee_command` this time
|
||||
4. To add some bungee plugins, download the plugin's JAR file and place it in `java/bungee_command/plugins`
|
||||
|
||||
There are alot more configurations in bungeecord, but this should set you up
|
||||
|
||||
**Your server is now ready.** Visit any client, and go to 'Multiplayer' from the main menu. Select 'Direct Connect', type `127.0.0.1:25565` and press 'Join Server'
|
||||
**It should allow you to connect, if not, check the two terminal windows for errors**
|
||||
|
||||
## Creating a client
|
||||
1. To install, upload the contents of `stable-download/web` to a web server.
|
||||
- There are *multiple ways of setting up a web server*. **[NGINX](https://nginx.org) is a powerful web server, but alternatives like [Web Server for Chrome](https://chrome.google.com/webstore/detail/web-server-for-chrome/ofhbbkphhbklhfoeikjpcbhemlocgigb?hl=en) may be easier to set up.**
|
||||
- A quick crash course on setting up NGINX is provided [here](#Creating-a-Reverse-Proxy---NGINX), **FOLLOW STEPS 1 AND 2 ONLY**, then navigate to `/var/www/html` and upload the contents of `stable-download/web` there.
|
||||
- If you had installed NGINX earlier as a reverse proxy, you can also use it to host the client, **follow the steps above ^^^**
|
||||
- Make sure that the URL to connect to the client and the server are separate, preferably with a path, like `https://eaglercraft.example.com/server`
|
||||
|
||||
2. **The 'web' folder will not work if you open it in your browser locally! If you see 'file:///' in the URL you are doing it wrong. You need to upload the folder to an HTTP or HTTPS server and access it over the internet via http:// or https://. The game will not load otherwise, this is not a bug**
|
||||
3. To modify the list of default servers, modify the `window.eaglercraftOpts` variable in `index.html`.
|
||||
4. **A full guide on how to configure `eaglercraftOpts` is coming soon, but it should be fairly intuitive to figure out how to set it up based on what the default values already are when you look in stable-download**
|
||||
5. **To create a link to your site that automatically joins the server,** add a `?server=` variable to the URL, like (for example): [https://g.deev.is/eaglercraft/?server=127.0.0.1:25565](https://g.deev.is/eaglercraft/?server=127.0.0.1:25565) will automatically join `ws://127.0.0.1:25565/` as soon as the player finishes setting their username and skin
|
||||
|
||||
# EaglercraftBungee Configuration
|
||||
|
||||
## MOTD
|
||||
- To change your server's MOTD and icon, edit the `motd1:` tag of the listener config in `java/bungee_command/config.yml`, and replace `server-icon.png` in the folder where the config file is. Use `&` to add color/formatting codes. The server list will downscale your icon to 64x64 pixels
|
||||
- You can give your MOTD multiple lines, add a `motd2:` to define a second line
|
||||
- **For an animated MOTD and icon, install EaglerMOTD: [https://github.com/lax1dude/eaglercraft-motd/](https://github.com/lax1dude/eaglercraft-motd/)**
|
||||
|
||||
## Authentication
|
||||
**To enable the /login and /register commands in EaglercraftBungee, you can edit this portion of config.yml**
|
||||
|
||||
```yaml
|
||||
authservice:
|
||||
authfile: auths.db
|
||||
register_enabled: true
|
||||
ip_limit: 0
|
||||
join_messages:
|
||||
- '&3Welcome to my &aEaglercraftBungee &3server!'
|
||||
login_timeout: 30
|
||||
enabled: false
|
||||
```
|
||||
- `authfile` Sets the authentication database file, which is **compatible with AuthMe**
|
||||
|
||||
- `register_enabled` Turns register command on and off
|
||||
|
||||
- `ip_limit` Sets the max number of registrations per IP, 0 = unlimited
|
||||
|
||||
- `join_messages` List of messages to show the player when they join
|
||||
|
||||
- `login_timeout` Sets how many seconds players have to log in before they are kicked
|
||||
|
||||
- `enable` Turns login commands on and off
|
||||
|
||||
## Moderation
|
||||
### Miscellaneous
|
||||
- **If you use /op on your server, keep in mind that if you "/op LAX1DUDE", a player joining as 'laX1DUDE' or 'LaX1dUdE' or 'lax1dude' will all have /op too. To solve this problem, force all operators to only be able to join with all lowercase ('lax1dude') letters in their usernames by moving 'BitchFilterPlugin.jar" into "java/bukkit_command/plugins" and then register every op username lowercase**
|
||||
|
||||
- **To disable voice chat, set `voice_enabled: false` in the bungeecord config.yml**
|
||||
|
||||
### Username Bans
|
||||
- **To ban a username on Eaglercraftbungee, use:** `eag-ban <username>`
|
||||
- **You can edit bans.txt in your EaglercraftBungee folder, the server automatically reloads the file when it is saved**
|
||||
- To ban users by regular expression, use: `eag-ban-regex <regex>` with a regular expression to match the username in **lowercase**
|
||||
|
||||
### IP Bans
|
||||
|
||||
In order for IP Bans to work, a [**a reverse proxy**](#Creating-a-Reverse-Proxy---NGINX) is required, and **[`forward_ip`](#NGINX-Configuration) needs to be configured,** ***otherwise it cannot ban the user's IP***
|
||||
|
||||
- **To ban an IP on Eaglercraftbungee, use:** `eag-ban-ip <ip>`, or `eag-ban-ip <name>` to ban the IP of a player automatically
|
||||
- To ban a range of IP addresses, use slash notation to define a subnet. Example: `eag-ban-ip 192.168.0.0/8`
|
||||
- To ban users by wildcard (\*) use: `eag-ban-wildcard <text>*` or `eag-ban-wildcard *<text>` or `eag-ban-wildcard *<text>*`
|
||||
|
||||
### Client Bans
|
||||
- **EaglercraftBungee has a built in domain blacklist that updates automatically, you can disable it by setting this in config.yml:**
|
||||
|
||||
```yaml
|
||||
enable_web_origin_blacklist: false
|
||||
```
|
||||
|
||||
- **To block all clients on replit from joining, set this to true in config.yml:**
|
||||
|
||||
```yaml
|
||||
origin_blacklist_block_replit_clients: true
|
||||
```
|
||||
|
||||
- **To block all offline-download clients, set this to true in config.yml:**
|
||||
|
||||
```yaml
|
||||
origin_blacklist_block_offline_download: true
|
||||
```
|
||||
|
||||
- **To block the debug runtime (or other desktop clients), set this to true in config.yml:**
|
||||
|
||||
```yaml
|
||||
origin_blacklist_block_missing_origin_header: true
|
||||
```
|
||||
- **To add your own blacklisted domains**, create a file called `origin_blacklist.txt` in your bungeecord directory and put the regular expressions inside, one on each line. There 's also a `domain` command in the console to view a player's domain, and a `block-domain` and `block-domain-name` and `unblock-domain` command to manage the local `origin_blacklist.txt` from the bungee console (if you don't know how to edit a file on your own). The list reloads automatically when changes to the file are detected.
|
||||
|
||||
- ### To configure bungee to block connections from all clients except your own, set this option:
|
||||
|
||||
```yaml
|
||||
origin_blacklist_use_simple_whitelist: true
|
||||
```
|
||||
|
||||
Then, add your domain to `origin_blacklist_simple_whitelist` like this:
|
||||
|
||||
```yaml
|
||||
origin_blacklist_simple_whitelist:
|
||||
- type the name of your client's domain here
|
||||
```
|
||||
Then, unless still you want it as an option for your players, disable the offline download so hackers don't use it to bypass the whitelist, as it is not blocked in whitelist mode by default:
|
||||
|
||||
```yaml
|
||||
origin_blacklist_block_offline_download: true
|
||||
```
|
||||
## Others
|
||||
|
||||
- The server has built in DoS protection, reset it via typing 'eag-ratelimit reset' in the bungee console**
|
||||
|
||||
- Rate limiting is possible, but [**a reverse proxy**](#Creating-a-Reverse-Proxy---NGINX) is required, and **[`forward_ip`](#NGINX-Configuration) needs to be configured to use rate limiting,** ***otherwise it will be disabled by default***
|
||||
|
||||
```yaml
|
||||
ratelimit:
|
||||
ip:
|
||||
enable: true
|
||||
period: 90
|
||||
limit: 60
|
||||
limit_lockout: 80
|
||||
lockout_duration: 1200
|
||||
exceptions: []
|
||||
```
|
||||
|
||||
- `enable` enable rate limiting
|
||||
|
||||
- `period` and `limit` set the number of requests (`limit`) can be made in (`period`) number of seconds
|
||||
|
||||
- `limit_lockout` and `lockout_duration` set the number of requests (`limit_lockout`) that can be made in (`period`) seconds before the IP is blocked for `lockout_duration` number of seconds
|
||||
|
||||
- `exceptions` a list of IP addresses that should never get rate limited. **Local IPs like 127.0.0.1 and 192.168.\*.\* and such are set as exceptions by default**
|
||||
|
||||
- ### Redirecting the client to a new WebSocket
|
||||
|
||||
If you would like to signal the client to disconnect from your bungeecord and reconnect to a different bungeecord, configure an entry in the `servers` part of config.yml like this:
|
||||
|
||||
```yaml
|
||||
test:
|
||||
redirect: wss://ServerHere/
|
||||
restricted: false
|
||||
```
|
||||
|
||||
In this example, sending a player to the server `test`, such as when they enter a portal or type `/server test`, will trigger their client to disconnect from your bungeecord and then automatically reconnect to `wss://ServerHere/` as if it was entered via "Direct Connect"
|
||||
|
||||
## Creating a Reverse Proxy - NGINX
|
||||
|
||||
Here is a quick crash course of setting up NGINX on Linux, specifically on Debian distributions.
|
||||
|
||||
Here are some google searches for other distributions:
|
||||
|
||||
- [Windows](https://www.google.com/search?q=set+up+nginx+on+windows)
|
||||
- [Mac](https://www.google.com/search?q=set+up+nginx+on+mac)
|
||||
- [Linux - Arch](https://www.google.com/search?q=set+up+nginx+on+arch)
|
||||
- [Linux - Fedora](https://www.google.com/search?q=set+up+nginx+on+fedora)
|
||||
|
||||
1. Open up your terminal, and run
|
||||
``sudo apt update``
|
||||
and
|
||||
``sudo apt install nginx``
|
||||
2. Open any web browser, and search for `localhost` in your search bar. You should see something like this:
|
||||
3. Navigate to NGINX's configuration with `cd /etc/nginx/sites-enabled`.
|
||||
|
||||
4. Create a new configuration file with your domain name, for example `nano eaglercraft.example.com`
|
||||
|
||||
5. Paste in the following code into the file. Replace `example.com` with your own domain, and `app_server_address` as the `ip:port` of your EaglercraftBungee server you want the URL to connect to.
|
||||
```
|
||||
server {
|
||||
listen 80;
|
||||
listen [::]:80;
|
||||
|
||||
server_name example.com eaglercraft.example.com;
|
||||
|
||||
location / {
|
||||
proxy_pass app_server_address;
|
||||
include proxy_params;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
6. Now, restart NGINX with `sudo service nginx restart` and you should be good to go!
|
||||
|
||||
## NGINX Configuration
|
||||
|
||||
### To implement the following configuration, add the lines below the `proxy_pass` line.
|
||||
- **To stop people from using bookmarklets to load a client from a different URL onto your official URL via XXS, add these headers to NGINX:**
|
||||
|
||||
```
|
||||
add_header X-Frame-Options "SAMEORIGIN";
|
||||
add_header Referrer-Policy "strict-origin";
|
||||
add_header X-XSS-Protection "1; mode=block";
|
||||
add_header Content-Security-Policy "default-src 'self' 'unsafe-inline'; img-src 'self' 'unsafe-inline' data: blob:; connect-src 'self' ws: wss:; upgrade-insecure-requests";
|
||||
```
|
||||
|
||||
###### (not fully tested, excuse the scroll bar)
|
||||
|
||||
- **To use IP bans and rate limiting, add `proxy_set_header X-Real-IP $remote_addr` to your proxy configuration**
|
||||
|
||||
# Others
|
||||
|
||||
## Plugin Development
|
||||
|
||||
**To develop a plugin, download [stable-download/java/bungee_command/bungee_dist.jar](https://github.com/lax1dude/eaglercraft/blob/main/stable-download/java/bungee_command/bungee-dist.jar) and add it to the Build Path of your Java IDE. Develop the plugin just like a regular BungeeCord plugin, see [EaglerMOTD](https://github.com/lax1dude/eaglercraft-motd/) for an example.**
|
||||
|
||||
**Test your plugin by exporting it as a jar and putting it in the '/plugins' directory of EaglercraftBungee and then clicking 'run.bat'**
|
||||
|
||||
### New Events:
|
||||
|
||||
- **[net.md_5.bungee.api.event.WebsocketMOTDEvent](https://github.com/lax1dude/eaglercraft/blob/main/eaglercraftbungee/src/main/java/net/md_5/bungee/api/event/WebsocketMOTDEvent.java)**: Triggered when a client or website requests the MOTD
|
||||
|
||||
- **[net.md_5.bungee.api.event.WebsocketQueryEvent](https://github.com/lax1dude/eaglercraft/blob/main/eaglercraftbungee/src/main/java/net/md_5/bungee/api/event/WebsocketQueryEvent.java)**: Triggered when a client or website requests a query. This happens when a site opens a text WebSocket to a listener and sends a single string `Accept: <query>` packet. Can be used to provide additional custom statistics to server list sites supporting integrated WebSocket queries
|
||||
|
||||
**Register event handlers using the standard BungeeCord** `@EventHandler` **annotation in your** `Listener` **class**
|
||||
|
||||
## Compiling
|
||||
|
||||
To compile for the web, run the gradle 'teavm' compile target to generate the classes.js file.
|
||||
|
||||
The LWJGL runtime is no longer supported it is only included for reference
|
||||
|
||||
## Creating a resource pack
|
||||
|
||||
- To make a custom resource pack for your site, clone this repository and edit the files in [lwjgl-rundir/resources](https://github.com/lax1dude/eaglercraft/tree/main/lwjgl-rundir/resources).
|
||||
- When you are done, navigate to [epkcompiler/](https://github.com/lax1dude/eaglercraft/tree/main/epkcompiler) and double-click `run.bat`. Wait for the window to say `Press any key to continue...` and close it. Then, go to `../javascript` in the repository and copy `javascript/assets.epk` to the `assets.epk` on your website
|
||||
- If you're on mac or linux, navigate to the epkcompiler folder via `cd` and run `chmod +x run_unix.sh` and then `./run_unix.sh` to do this, then copy the same `javascript/assets.epk` to the `assets.epk` on your website
|
||||
|
||||
## Contributing
|
||||
|
||||
All I really have to say is, tabs not spaces, and format the code to be like the eclipse auto format tool on factory settings, but also run-on lines of code long enough to go off the screen and single line if statements and other format violations in that category are welcome if it helps enhance the contrast between the less important code and the more important code in a file. Don't commit changes to `javascript/classes.js` or `javascript/classes_server.js` or `javascript/assets.epk` or anything in `stable-download/`. I'll recompile those myself when I merge the pull request.
|
4
ZipStableDownload.bat
Normal file
4
ZipStableDownload.bat
Normal file
@ -0,0 +1,4 @@
|
||||
@echo off
|
||||
title ZipStableDownload
|
||||
java -cp zip-generator/deps/*;zip-generator/zipGenerator.jar net.lax1dude.eaglercraft.zip_generator.ZipGenerator
|
||||
pause
|
2
ZipStableDownload.sh
Normal file
2
ZipStableDownload.sh
Normal file
@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
java -cp zip-generator/deps/*:zip-generator/zipGenerator.jar net.lax1dude.eaglercraft.zip_generator.ZipGenerator
|
84
build.gradle
Normal file
84
build.gradle
Normal file
@ -0,0 +1,84 @@
|
||||
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath 'io.github.zebalu:teavm-gradle-plugin:1.0.0'
|
||||
}
|
||||
}
|
||||
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'io.github.zebalu.teavm-gradle-plugin'
|
||||
|
||||
sourceCompatibility = 1.8
|
||||
targetCompatibility = 1.8
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDir 'src/main/java'
|
||||
srcDir 'src/teavm/java'
|
||||
srcDir 'sp-server/src/ipc/java'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'org.teavm:teavm-platform:0.6.1'
|
||||
implementation 'org.teavm:teavm-classlib:0.6.1'
|
||||
}
|
||||
|
||||
teavm {
|
||||
|
||||
compileScopes = null;
|
||||
minifying = true;
|
||||
maxTopLevelNames = 10000;
|
||||
properties = null;
|
||||
debugInformationGenerated = false;
|
||||
sourceMapsGenerated = true;
|
||||
sourceFilesCopied = false;
|
||||
incremental = false;
|
||||
transformers = null;
|
||||
|
||||
/** Where to save the result */
|
||||
targetDirectory = file("javascript");
|
||||
|
||||
/** The directory to monitor to decide if compile is up-to-date or not */
|
||||
sourceDirectory = file("src");
|
||||
|
||||
/** How to name the result file. */
|
||||
targetFileName = "classes.js";
|
||||
|
||||
/** Which class holds your public static void main(Strin[] args) method */
|
||||
mainClass = 'net.lax1dude.eaglercraft.Client';
|
||||
|
||||
/** This will be the name of your main method after compilation. */
|
||||
entryPointName = 'main';
|
||||
|
||||
classesToPreserve = null;
|
||||
stopOnErrors = false;
|
||||
optimizationLevel = "ADVANCED"; //org.teavm.vm.TeaVMOptimizationLevel.SIMPLE;
|
||||
fastGlobalAnalysis = false;
|
||||
targetType = "JAVASCRIPT"; //org.teavm.tooling.TeaVMTargetType.JAVASCRIPT;
|
||||
cacheDirectory = null;
|
||||
wasmVersion = "V_0x1"; //org.teavm.backend.wasm.render.WasmBinaryVersion.V_0x1;
|
||||
minHeapSize = 4;
|
||||
maxHeapSize = 128;
|
||||
outOfProcess = false;
|
||||
processMemory = 512;
|
||||
longjmpSupported = true;
|
||||
heapDump = false;
|
||||
|
||||
/** Add name of configurations here where to look for jarfiles. */
|
||||
includeJarsFrom = [];
|
||||
|
||||
/** By default teavmc taskd epends on javaCompile task, unless this varaibale is true. */
|
||||
skipJavaCompile = false;
|
||||
}
|
8
eaglercraftbungee/.classpath
Normal file
8
eaglercraftbungee/.classpath
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src/main/java"/>
|
||||
<classpathentry kind="lib" path="bungee-deps.jar"/>
|
||||
<classpathentry kind="lib" path="Java-WebSocket-1.5.1-with-dependencies.jar"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_231"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
17
eaglercraftbungee/.project
Normal file
17
eaglercraftbungee/.project
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>minecrafthtml5bungee</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
BIN
eaglercraftbungee/Java-WebSocket-1.5.1-with-dependencies.jar
Normal file
BIN
eaglercraftbungee/Java-WebSocket-1.5.1-with-dependencies.jar
Normal file
Binary file not shown.
BIN
eaglercraftbungee/bungee-deps.jar
Normal file
BIN
eaglercraftbungee/bungee-deps.jar
Normal file
Binary file not shown.
578
eaglercraftbungee/src/main/java/net/md_5/bungee/BungeeCord.java
Normal file
578
eaglercraftbungee/src/main/java/net/md_5/bungee/BungeeCord.java
Normal file
@ -0,0 +1,578 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintStream;
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.ServerSocket;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.MissingResourceException;
|
||||
import java.util.Optional;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import org.fusesource.jansi.AnsiConsole;
|
||||
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
|
||||
import io.netty.bootstrap.ServerBootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelException;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.MultithreadEventLoopGroup;
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioServerSocketChannel;
|
||||
import io.netty.util.AttributeKey;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
import jline.UnsupportedTerminal;
|
||||
import jline.console.ConsoleReader;
|
||||
import jline.internal.Log;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.ReconnectHandler;
|
||||
import net.md_5.bungee.api.config.ConfigurationAdapter;
|
||||
import net.md_5.bungee.api.config.ListenerInfo;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
import net.md_5.bungee.api.plugin.PluginManager;
|
||||
import net.md_5.bungee.api.scheduler.TaskScheduler;
|
||||
import net.md_5.bungee.api.tab.CustomTabList;
|
||||
import net.md_5.bungee.command.CommandAlert;
|
||||
import net.md_5.bungee.command.CommandBungee;
|
||||
import net.md_5.bungee.command.CommandChangePassword;
|
||||
import net.md_5.bungee.command.CommandClearRatelimit;
|
||||
import net.md_5.bungee.command.CommandConfirmCode;
|
||||
import net.md_5.bungee.command.CommandDomain;
|
||||
import net.md_5.bungee.command.CommandDomainBlock;
|
||||
import net.md_5.bungee.command.CommandDomainBlockDomain;
|
||||
import net.md_5.bungee.command.CommandDomainUnblock;
|
||||
import net.md_5.bungee.command.CommandEnd;
|
||||
import net.md_5.bungee.command.CommandFind;
|
||||
import net.md_5.bungee.command.CommandGlobalBan;
|
||||
import net.md_5.bungee.command.CommandGlobalBanIP;
|
||||
import net.md_5.bungee.command.CommandGlobalBanRegex;
|
||||
import net.md_5.bungee.command.CommandGlobalBanReload;
|
||||
import net.md_5.bungee.command.CommandGlobalBanWildcard;
|
||||
import net.md_5.bungee.command.CommandGlobalCheckBan;
|
||||
import net.md_5.bungee.command.CommandGlobalListBan;
|
||||
import net.md_5.bungee.command.CommandGlobalUnban;
|
||||
import net.md_5.bungee.command.CommandIP;
|
||||
import net.md_5.bungee.command.CommandList;
|
||||
import net.md_5.bungee.command.CommandPerms;
|
||||
import net.md_5.bungee.command.CommandReload;
|
||||
import net.md_5.bungee.command.CommandSend;
|
||||
import net.md_5.bungee.command.CommandServer;
|
||||
import net.md_5.bungee.command.ConsoleCommandSender;
|
||||
import net.md_5.bungee.config.Configuration;
|
||||
import net.md_5.bungee.config.YamlConfig;
|
||||
import net.md_5.bungee.eaglercraft.AuthHandler;
|
||||
import net.md_5.bungee.eaglercraft.AuthSystem;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
import net.md_5.bungee.eaglercraft.DomainBlacklist;
|
||||
import net.md_5.bungee.eaglercraft.PluginEaglerSkins;
|
||||
import net.md_5.bungee.eaglercraft.PluginEaglerVoice;
|
||||
import net.md_5.bungee.eaglercraft.WebSocketListener;
|
||||
import net.md_5.bungee.log.BungeeLogger;
|
||||
import net.md_5.bungee.log.LoggingOutputStream;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.Packet3Chat;
|
||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||
import net.md_5.bungee.reconnect.SQLReconnectHandler;
|
||||
import net.md_5.bungee.scheduler.BungeeScheduler;
|
||||
import net.md_5.bungee.scheduler.BungeeThreadPool;
|
||||
import net.md_5.bungee.tab.Custom;
|
||||
import net.md_5.bungee.util.CaseInsensitiveMap;
|
||||
|
||||
public class BungeeCord extends ProxyServer {
|
||||
public volatile boolean isRunning;
|
||||
public final Configuration config;
|
||||
public final ResourceBundle bundle;
|
||||
public final ScheduledThreadPoolExecutor executors;
|
||||
public final MultithreadEventLoopGroup eventLoops;
|
||||
private final Timer saveThread;
|
||||
private final Timer reloadBanThread;
|
||||
private final Timer closeInactiveSockets;
|
||||
private final Timer authTimeoutTimer;
|
||||
private Collection<Channel> listeners;
|
||||
private Collection<WebSocketListener> wsListeners;
|
||||
private final Map<String, UserConnection> connections;
|
||||
private final ReadWriteLock connectionLock;
|
||||
public final PluginManager pluginManager;
|
||||
private ReconnectHandler reconnectHandler;
|
||||
private ConfigurationAdapter configurationAdapter;
|
||||
private final Collection<String> pluginChannels;
|
||||
private final File pluginsFolder;
|
||||
private final TaskScheduler scheduler;
|
||||
private ConsoleReader consoleReader;
|
||||
private final Logger logger;
|
||||
private Collection<Command> banCommands;
|
||||
public AuthSystem authSystem;
|
||||
public String tokenVerify;
|
||||
|
||||
public static BungeeCord getInstance() {
|
||||
return (BungeeCord) ProxyServer.getInstance();
|
||||
}
|
||||
|
||||
public BungeeCord() throws IOException {
|
||||
this.config = new Configuration();
|
||||
this.bundle = ResourceBundle.getBundle("messages_en");
|
||||
this.executors = new BungeeThreadPool(new ThreadFactoryBuilder().setNameFormat("Bungee Pool Thread #%1$d").build());
|
||||
this.eventLoops = (MultithreadEventLoopGroup) new NioEventLoopGroup(Runtime.getRuntime().availableProcessors(), new ThreadFactoryBuilder().setNameFormat("Netty IO Thread #%1$d").build());
|
||||
this.saveThread = new Timer("Reconnect Saver");
|
||||
this.reloadBanThread = new Timer("Ban List Reload");
|
||||
this.closeInactiveSockets = new Timer("Close Inactive WebSockets");
|
||||
this.authTimeoutTimer = new Timer("Auth Timeout");
|
||||
this.listeners = new HashSet<Channel>();
|
||||
this.wsListeners = new HashSet<WebSocketListener>();
|
||||
this.connections = (Map<String, UserConnection>) new CaseInsensitiveMap();
|
||||
this.connectionLock = new ReentrantReadWriteLock();
|
||||
this.pluginManager = new PluginManager(this);
|
||||
this.configurationAdapter = new YamlConfig();
|
||||
this.pluginChannels = new HashSet<String>();
|
||||
this.pluginsFolder = new File("plugins");
|
||||
this.scheduler = new BungeeScheduler();
|
||||
this.banCommands = new ArrayList();
|
||||
this.getPluginManager().registerCommand(null, new CommandReload());
|
||||
this.getPluginManager().registerCommand(null, new CommandEnd());
|
||||
this.getPluginManager().registerCommand(null, new CommandList());
|
||||
this.getPluginManager().registerCommand(null, new CommandServer());
|
||||
this.getPluginManager().registerCommand(null, new CommandIP());
|
||||
this.getPluginManager().registerCommand(null, new CommandAlert());
|
||||
this.getPluginManager().registerCommand(null, new CommandBungee());
|
||||
this.getPluginManager().registerCommand(null, new CommandPerms());
|
||||
this.getPluginManager().registerCommand(null, new CommandSend());
|
||||
this.getPluginManager().registerCommand(null, new CommandFind());
|
||||
this.getPluginManager().registerCommand(null, new CommandClearRatelimit());
|
||||
this.getPluginManager().registerCommand(null, new CommandConfirmCode());
|
||||
this.getPluginManager().registerCommand(null, new CommandDomain());
|
||||
this.getPluginManager().registerCommand(null, new CommandDomainBlock());
|
||||
this.getPluginManager().registerCommand(null, new CommandDomainBlockDomain());
|
||||
this.getPluginManager().registerCommand(null, new CommandDomainUnblock());
|
||||
this.registerChannel("BungeeCord");
|
||||
Log.setOutput(new PrintStream(ByteStreams.nullOutputStream()));
|
||||
AnsiConsole.systemInstall();
|
||||
this.consoleReader = new ConsoleReader();
|
||||
this.logger = new BungeeLogger(this);
|
||||
System.setErr(new PrintStream(new LoggingOutputStream(this.logger, Level.SEVERE), true));
|
||||
System.setOut(new PrintStream(new LoggingOutputStream(this.logger, Level.INFO), true));
|
||||
if (this.consoleReader.getTerminal() instanceof UnsupportedTerminal) {
|
||||
this.logger.info("Unable to initialize fancy terminal. To fix this on Windows, install the correct Microsoft Visual C++ 2008 Runtime");
|
||||
this.logger.info("NOTE: This error is non crucial, and BungeeCord will still function correctly! Do not bug the author about it unless you are still unable to get it working");
|
||||
}
|
||||
}
|
||||
|
||||
public void reconfigureBanCommands(boolean replaceBukkit) {
|
||||
if(banCommands.size() > 0) {
|
||||
for(Command c : banCommands) {
|
||||
this.getPluginManager().unregisterCommand(c);
|
||||
}
|
||||
banCommands.clear();
|
||||
}
|
||||
|
||||
Command cBan = new CommandGlobalBan(replaceBukkit);
|
||||
Command cUnban = new CommandGlobalUnban(replaceBukkit);
|
||||
Command cBanReload = new CommandGlobalBanReload(replaceBukkit);
|
||||
Command cBanIP = new CommandGlobalBanIP(replaceBukkit);
|
||||
Command cBanWildcard = new CommandGlobalBanWildcard(replaceBukkit);
|
||||
Command cBanRegex = new CommandGlobalBanRegex(replaceBukkit);
|
||||
Command cBanCheck = new CommandGlobalCheckBan(replaceBukkit);
|
||||
Command cBanList = new CommandGlobalListBan(replaceBukkit);
|
||||
|
||||
banCommands.add(cBan);
|
||||
banCommands.add(cUnban);
|
||||
banCommands.add(cBanReload);
|
||||
banCommands.add(cBanIP);
|
||||
banCommands.add(cBanWildcard);
|
||||
banCommands.add(cBanRegex);
|
||||
banCommands.add(cBanCheck);
|
||||
banCommands.add(cBanList);
|
||||
|
||||
this.getPluginManager().registerCommand(null, cBan);
|
||||
this.getPluginManager().registerCommand(null, cUnban);
|
||||
this.getPluginManager().registerCommand(null, cBanReload);
|
||||
this.getPluginManager().registerCommand(null, cBanIP);
|
||||
this.getPluginManager().registerCommand(null, cBanWildcard);
|
||||
this.getPluginManager().registerCommand(null, cBanRegex);
|
||||
this.getPluginManager().registerCommand(null, cBanCheck);
|
||||
this.getPluginManager().registerCommand(null, cBanList);
|
||||
}
|
||||
|
||||
public static void main(final String[] args) throws Exception {
|
||||
final BungeeCord bungee = new BungeeCord();
|
||||
ProxyServer.setInstance(bungee);
|
||||
bungee.getLogger().info("Enabled BungeeCord version " + bungee.getVersion());
|
||||
bungee.start();
|
||||
while (bungee.isRunning) {
|
||||
final String line = bungee.getConsoleReader().readLine(">");
|
||||
if (line != null && !bungee.getPluginManager().dispatchCommand(ConsoleCommandSender.getInstance(), line)) {
|
||||
bungee.getConsole().sendMessage(ChatColor.RED + "Command not found");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
this.pluginsFolder.mkdir();
|
||||
this.config.load();
|
||||
this.pluginManager.detectPlugins(this.pluginsFolder);
|
||||
this.pluginManager.addInternalPlugin(new PluginEaglerSkins());
|
||||
this.pluginManager.addInternalPlugin(new PluginEaglerVoice(this.config.getVoiceEnabled()));
|
||||
if (this.config.getAuthInfo().isEnabled()) {
|
||||
this.authSystem = new AuthSystem(this.config.getAuthInfo());
|
||||
this.getPluginManager().registerCommand(null, new CommandChangePassword(this.authSystem));
|
||||
}
|
||||
this.tokenVerify = Optional.ofNullable(System.getenv("YEEISH_TOKEN")).orElse(this.config.getTokenVerify());
|
||||
if (this.reconnectHandler == null) {
|
||||
this.reconnectHandler = new SQLReconnectHandler();
|
||||
}
|
||||
this.isRunning = true;
|
||||
this.pluginManager.loadAndEnablePlugins();
|
||||
this.startListeners();
|
||||
this.saveThread.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
BungeeCord.this.getReconnectHandler().save();
|
||||
}
|
||||
}, 0L, TimeUnit.MINUTES.toMillis(5L));
|
||||
this.reloadBanThread.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
BanList.maybeReloadBans(null);
|
||||
}
|
||||
}, 0L, TimeUnit.SECONDS.toMillis(3L));
|
||||
DomainBlacklist.init(this);
|
||||
this.closeInactiveSockets.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
DomainBlacklist.update();
|
||||
for(WebSocketListener lst : BungeeCord.this.wsListeners) {
|
||||
lst.closeInactiveSockets();
|
||||
ListenerInfo info = lst.getInfo();
|
||||
if(info.getRateLimitIP() != null) info.getRateLimitIP().deleteClearLimiters();
|
||||
if(info.getRateLimitLogin() != null) info.getRateLimitLogin().deleteClearLimiters();
|
||||
if(info.getRateLimitMOTD() != null) info.getRateLimitMOTD().deleteClearLimiters();
|
||||
if(info.getRateLimitQuery() != null) info.getRateLimitQuery().deleteClearLimiters();
|
||||
}
|
||||
}
|
||||
}, 0L, TimeUnit.SECONDS.toMillis(10L));
|
||||
final int authTimeout = this.config.getAuthInfo().getLoginTimeout();
|
||||
this.authTimeoutTimer.scheduleAtFixedRate(new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
AuthHandler.closeInactive(authTimeout);
|
||||
}
|
||||
}, 0L, TimeUnit.SECONDS.toMillis(2L));
|
||||
}
|
||||
|
||||
public void startListeners() {
|
||||
for (final ListenerInfo info : this.config.getListeners()) {
|
||||
InetSocketAddress sock = info.getHost();
|
||||
if(info.isWebsocket()) {
|
||||
sock = info.getJavaHost();
|
||||
if(sock == null) {
|
||||
try {
|
||||
ServerSocket s = new ServerSocket(0, 0, InetAddress.getByName("127.11.0.1"));
|
||||
sock = new InetSocketAddress("127.11.0.1", s.getLocalPort());
|
||||
s.close();
|
||||
} catch(IOException e) {
|
||||
sock = new InetSocketAddress("127.11.0.1",(int) (System.nanoTime() % 64000L + 1025L));
|
||||
}
|
||||
}
|
||||
try {
|
||||
this.wsListeners.add(new WebSocketListener(info, sock, this));
|
||||
BungeeCord.this.getLogger().info("Listening websockets on " + info.getHost());
|
||||
}catch(Throwable t) {
|
||||
BungeeCord.this.getLogger().log(Level.WARNING, "Could not bind websocket listener to host " + info.getHost(), t);
|
||||
}
|
||||
}
|
||||
final InetSocketAddress sock2 = sock;
|
||||
final ChannelFutureListener listener = (ChannelFutureListener) new ChannelFutureListener() {
|
||||
public void operationComplete(final ChannelFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
BungeeCord.this.listeners.add(future.channel());
|
||||
BungeeCord.this.getLogger().info("Listening on " + sock2);
|
||||
} else {
|
||||
BungeeCord.this.getLogger().log(Level.WARNING, "Could not bind to host " + sock2, future.cause());
|
||||
}
|
||||
}
|
||||
};
|
||||
((ServerBootstrap) ((ServerBootstrap) new ServerBootstrap().channel((Class) NioServerSocketChannel.class)).childAttr((AttributeKey) PipelineUtils.LISTENER, (Object) info).childHandler((ChannelHandler) PipelineUtils.SERVER_CHILD)
|
||||
.group((EventLoopGroup) this.eventLoops).localAddress((SocketAddress) sock)).bind().addListener((GenericFutureListener) listener);
|
||||
}
|
||||
}
|
||||
|
||||
public void stopListeners() {
|
||||
for (final Channel listener : this.listeners) {
|
||||
this.getLogger().log(Level.INFO, "Closing listener {0}", listener);
|
||||
try {
|
||||
listener.close().syncUninterruptibly();
|
||||
} catch (ChannelException ex) {
|
||||
this.getLogger().severe("Could not close listen thread");
|
||||
}
|
||||
}
|
||||
for (final WebSocketListener listener : this.wsListeners) {
|
||||
this.getLogger().log(Level.INFO, "Closing websocket listener {0}", listener.getAddress());
|
||||
try {
|
||||
listener.stop();
|
||||
}catch (IOException e) {
|
||||
this.getLogger().severe("Could not close listen thread");
|
||||
e.printStackTrace();
|
||||
} catch (InterruptedException e) {
|
||||
this.getLogger().severe("Could not close listen thread");
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
this.listeners.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
new Thread("Shutdown Thread") {
|
||||
@Override
|
||||
public void run() {
|
||||
BungeeCord.this.isRunning = false;
|
||||
BungeeCord.this.executors.shutdown();
|
||||
BungeeCord.this.stopListeners();
|
||||
BungeeCord.this.getLogger().info("Closing pending connections");
|
||||
BungeeCord.this.connectionLock.readLock().lock();
|
||||
try {
|
||||
BungeeCord.this.getLogger().info("Disconnecting " + BungeeCord.this.connections.size() + " connections");
|
||||
for (final UserConnection user : BungeeCord.this.connections.values()) {
|
||||
user.disconnect(BungeeCord.this.getTranslation("restart"));
|
||||
}
|
||||
} finally {
|
||||
BungeeCord.this.connectionLock.readLock().unlock();
|
||||
}
|
||||
BungeeCord.this.getLogger().info("Closing IO threads");
|
||||
BungeeCord.this.eventLoops.shutdownGracefully();
|
||||
try {
|
||||
BungeeCord.this.eventLoops.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
|
||||
} catch (InterruptedException ex) {
|
||||
}
|
||||
BungeeCord.this.getLogger().info("Saving reconnect locations");
|
||||
BungeeCord.this.reconnectHandler.save();
|
||||
BungeeCord.this.reconnectHandler.close();
|
||||
BungeeCord.this.saveThread.cancel();
|
||||
BungeeCord.this.reloadBanThread.cancel();
|
||||
BungeeCord.this.closeInactiveSockets.cancel();
|
||||
BungeeCord.this.authTimeoutTimer.cancel();
|
||||
BungeeCord.this.getLogger().info("Disabling plugins");
|
||||
for (final Plugin plugin : BungeeCord.this.pluginManager.getPlugins()) {
|
||||
plugin.onDisable();
|
||||
BungeeCord.this.getScheduler().cancel(plugin);
|
||||
}
|
||||
BungeeCord.this.getLogger().info("Thankyou and goodbye");
|
||||
System.exit(0);
|
||||
}
|
||||
}.start();
|
||||
}
|
||||
|
||||
public void broadcast(final DefinedPacket packet) {
|
||||
this.connectionLock.readLock().lock();
|
||||
try {
|
||||
for (final UserConnection con : this.connections.values()) {
|
||||
con.unsafe().sendPacket(packet);
|
||||
}
|
||||
} finally {
|
||||
this.connectionLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "BungeeCord";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return (BungeeCord.class.getPackage().getImplementationVersion() == null) ? "unknown" : BungeeCord.class.getPackage().getImplementationVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTranslation(final String name) {
|
||||
String translation = "<translation '" + name + "' missing>";
|
||||
try {
|
||||
translation = this.bundle.getString(name);
|
||||
} catch (MissingResourceException ex) {
|
||||
}
|
||||
return translation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ProxiedPlayer> getPlayers() {
|
||||
this.connectionLock.readLock().lock();
|
||||
try {
|
||||
return new HashSet<ProxiedPlayer>(this.connections.values());
|
||||
} finally {
|
||||
this.connectionLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getOnlineCount() {
|
||||
return this.connections.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProxiedPlayer getPlayer(final String name) {
|
||||
this.connectionLock.readLock().lock();
|
||||
try {
|
||||
return this.connections.get(name);
|
||||
} finally {
|
||||
this.connectionLock.readLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ServerInfo> getServers() {
|
||||
return (Map<String, ServerInfo>) this.config.getServers();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerInfo getServerInfo(final String name) {
|
||||
return this.getServers().get(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerChannel(final String channel) {
|
||||
synchronized (this.pluginChannels) {
|
||||
this.pluginChannels.add(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterChannel(final String channel) {
|
||||
synchronized (this.pluginChannels) {
|
||||
this.pluginChannels.remove(channel);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getChannels() {
|
||||
synchronized (this.pluginChannels) {
|
||||
return Collections.unmodifiableCollection((Collection<? extends String>) this.pluginChannels);
|
||||
}
|
||||
}
|
||||
|
||||
public PacketFAPluginMessage registerChannels() {
|
||||
return new PacketFAPluginMessage("REGISTER", Util.format(this.pluginChannels, "\u0000").getBytes());
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte getProtocolVersion() {
|
||||
return 61;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGameVersion() {
|
||||
return "1.5.2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerInfo constructServerInfo(final String name, final InetSocketAddress address, final boolean restricted) {
|
||||
return new BungeeServerInfo(name, address, restricted);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommandSender getConsole() {
|
||||
return ConsoleCommandSender.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void broadcast(final String message) {
|
||||
this.getConsole().sendMessage(message);
|
||||
this.broadcast(new Packet3Chat(message));
|
||||
}
|
||||
|
||||
public void addConnection(final UserConnection con) {
|
||||
this.connectionLock.writeLock().lock();
|
||||
try {
|
||||
this.connections.put(con.getName(), con);
|
||||
} finally {
|
||||
this.connectionLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeConnection(final UserConnection con) {
|
||||
this.connectionLock.writeLock().lock();
|
||||
try {
|
||||
this.connections.remove(con.getName());
|
||||
} finally {
|
||||
this.connectionLock.writeLock().unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public CustomTabList customTabList(final ProxiedPlayer player) {
|
||||
return new Custom(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PluginManager getPluginManager() {
|
||||
return this.pluginManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReconnectHandler getReconnectHandler() {
|
||||
return this.reconnectHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReconnectHandler(final ReconnectHandler reconnectHandler) {
|
||||
this.reconnectHandler = reconnectHandler;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConfigurationAdapter getConfigurationAdapter() {
|
||||
return this.configurationAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfigurationAdapter(final ConfigurationAdapter configurationAdapter) {
|
||||
this.configurationAdapter = configurationAdapter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public File getPluginsFolder() {
|
||||
return this.pluginsFolder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TaskScheduler getScheduler() {
|
||||
return this.scheduler;
|
||||
}
|
||||
|
||||
public ConsoleReader getConsoleReader() {
|
||||
return this.consoleReader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Logger getLogger() {
|
||||
return this.logger;
|
||||
}
|
||||
}
|
@ -0,0 +1,142 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.connection.PingHandler;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||
|
||||
public class BungeeServerInfo implements ServerInfo {
|
||||
private final String name;
|
||||
private final InetSocketAddress address;
|
||||
private final Collection<ProxiedPlayer> players;
|
||||
private final boolean restricted;
|
||||
private final Queue<DefinedPacket> packetQueue;
|
||||
|
||||
public void addPlayer(final ProxiedPlayer player) {
|
||||
synchronized (this.players) {
|
||||
this.players.add(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void removePlayer(final ProxiedPlayer player) {
|
||||
synchronized (this.players) {
|
||||
this.players.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<ProxiedPlayer> getPlayers() {
|
||||
synchronized (this.players) {
|
||||
return Collections.unmodifiableCollection((Collection<? extends ProxiedPlayer>) this.players);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canAccess(final CommandSender player) {
|
||||
Preconditions.checkNotNull((Object) player, (Object) "player");
|
||||
return !this.restricted || player.hasPermission("bungeecord.server." + this.name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
return obj instanceof ServerInfo && Objects.equals(this.getAddress(), ((ServerInfo) obj).getAddress());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return this.address.hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(final String channel, final byte[] data) {
|
||||
Preconditions.checkNotNull((Object) channel, (Object) "channel");
|
||||
Preconditions.checkNotNull((Object) data, (Object) "data");
|
||||
final Server server = this.players.isEmpty() ? null : this.players.iterator().next().getServer();
|
||||
if (server != null) {
|
||||
server.sendData(channel, data);
|
||||
} else {
|
||||
synchronized (this.packetQueue) {
|
||||
this.packetQueue.add(new PacketFAPluginMessage(channel, data));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void ping(final Callback<ServerPing> callback) {
|
||||
Preconditions.checkNotNull((Object) callback, (Object) "callback");
|
||||
final ChannelFutureListener listener = (ChannelFutureListener) new ChannelFutureListener() {
|
||||
public void operationComplete(final ChannelFuture future) throws Exception {
|
||||
if (future.isSuccess()) {
|
||||
((HandlerBoss) future.channel().pipeline().get((Class) HandlerBoss.class)).setHandler(new PingHandler(BungeeServerInfo.this, callback));
|
||||
} else {
|
||||
callback.done(null, future.cause());
|
||||
}
|
||||
}
|
||||
};
|
||||
((Bootstrap) ((Bootstrap) ((Bootstrap) ((Bootstrap) new Bootstrap().channel((Class) NioSocketChannel.class)).group((EventLoopGroup) BungeeCord.getInstance().eventLoops)).handler((ChannelHandler) PipelineUtils.BASE))
|
||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Integer.valueOf(5000))).remoteAddress((SocketAddress) this.getAddress()).connect().addListener((GenericFutureListener) listener);
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "name", "address", "restricted" })
|
||||
public BungeeServerInfo(final String name, final InetSocketAddress address, final boolean restricted) {
|
||||
this.players = new ArrayList<ProxiedPlayer>();
|
||||
this.packetQueue = new LinkedList<DefinedPacket>();
|
||||
this.name = name;
|
||||
this.address = address;
|
||||
this.restricted = restricted;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getAddress() {
|
||||
return this.address;
|
||||
}
|
||||
|
||||
public boolean isRestricted() {
|
||||
return this.restricted;
|
||||
}
|
||||
|
||||
public Queue<DefinedPacket> getPacketQueue() {
|
||||
return this.packetQueue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRedirect() {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.Key;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.KeyPair;
|
||||
import java.security.KeyPairGenerator;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.security.PublicKey;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.Arrays;
|
||||
import java.util.Random;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import net.md_5.bungee.protocol.packet.PacketFCEncryptionResponse;
|
||||
import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest;
|
||||
|
||||
public class EncryptionUtil
|
||||
{
|
||||
private static final Random random;
|
||||
public static KeyPair keys;
|
||||
private static SecretKey secret;
|
||||
|
||||
public static PacketFDEncryptionRequest encryptRequest() {
|
||||
final String hash = BungeeCord.getInstance().config.isOnlineMode() ? Long.toString(EncryptionUtil.random.nextLong(), 16) : "-";
|
||||
final byte[] pubKey = EncryptionUtil.keys.getPublic().getEncoded();
|
||||
final byte[] verify = new byte[4];
|
||||
EncryptionUtil.random.nextBytes(verify);
|
||||
return new PacketFDEncryptionRequest(hash, pubKey, verify);
|
||||
}
|
||||
|
||||
public static SecretKey getSecret(final PacketFCEncryptionResponse resp, final PacketFDEncryptionRequest request) throws GeneralSecurityException {
|
||||
final Cipher cipher = Cipher.getInstance("RSA");
|
||||
cipher.init(2, EncryptionUtil.keys.getPrivate());
|
||||
final byte[] decrypted = cipher.doFinal(resp.getVerifyToken());
|
||||
if (!Arrays.equals(request.getVerifyToken(), decrypted)) {
|
||||
throw new IllegalStateException("Key pairs do not match!");
|
||||
}
|
||||
cipher.init(2, EncryptionUtil.keys.getPrivate());
|
||||
return new SecretKeySpec(cipher.doFinal(resp.getSharedSecret()), "AES");
|
||||
}
|
||||
|
||||
public static Cipher getCipher(final int opMode, final Key shared) throws GeneralSecurityException {
|
||||
final Cipher cip = Cipher.getInstance("AES/CFB8/NoPadding");
|
||||
cip.init(opMode, shared, new IvParameterSpec(shared.getEncoded()));
|
||||
return cip;
|
||||
}
|
||||
|
||||
public static PublicKey getPubkey(final PacketFDEncryptionRequest request) throws GeneralSecurityException {
|
||||
return KeyFactory.getInstance("RSA").generatePublic(new X509EncodedKeySpec(request.getPublicKey()));
|
||||
}
|
||||
|
||||
public static byte[] encrypt(final Key key, final byte[] b) throws GeneralSecurityException {
|
||||
final Cipher hasher = Cipher.getInstance("RSA");
|
||||
hasher.init(1, key);
|
||||
return hasher.doFinal(b);
|
||||
}
|
||||
|
||||
public static SecretKey getSecret() {
|
||||
return EncryptionUtil.secret;
|
||||
}
|
||||
|
||||
static {
|
||||
random = new Random();
|
||||
EncryptionUtil.secret = new SecretKeySpec(new byte[16], "AES");
|
||||
try {
|
||||
EncryptionUtil.keys = KeyPairGenerator.getInstance("RSA").generateKeyPair();
|
||||
}
|
||||
catch (NoSuchAlgorithmException ex) {
|
||||
throw new ExceptionInInitializerError(ex);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
public class EntityMap {
|
||||
public static final int[][] entityIds;
|
||||
|
||||
public static void rewrite(final byte[] packet, final int oldId, final int newId) {
|
||||
final int packetId = packet[0] & 0xFF;
|
||||
if (packetId == 29) {
|
||||
for (int pos = 2; pos < packet.length; pos += 4) {
|
||||
final int readId = readInt(packet, pos);
|
||||
if (readId == oldId) {
|
||||
setInt(packet, pos, newId);
|
||||
} else if (readId == newId) {
|
||||
setInt(packet, pos, oldId);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
final int[] idArray = EntityMap.entityIds[packetId];
|
||||
if (idArray != null) {
|
||||
for (final int pos2 : idArray) {
|
||||
final int readId2 = readInt(packet, pos2);
|
||||
if (readId2 == oldId) {
|
||||
setInt(packet, pos2, newId);
|
||||
} else if (readId2 == newId) {
|
||||
setInt(packet, pos2, oldId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (packetId == 23) {
|
||||
final int type = packet[5] & 0xFF;
|
||||
if (type == 60 || type == 90) {
|
||||
final int index20 = readInt(packet, 20);
|
||||
if (packet.length > 24 && index20 == oldId) {
|
||||
setInt(packet, 20, newId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void setInt(final byte[] buf, final int pos, final int i) {
|
||||
buf[pos] = (byte) (i >> 24);
|
||||
buf[pos + 1] = (byte) (i >> 16);
|
||||
buf[pos + 2] = (byte) (i >> 8);
|
||||
buf[pos + 3] = (byte) i;
|
||||
}
|
||||
|
||||
private static int readInt(final byte[] buf, final int pos) {
|
||||
return (buf[pos] & 0xFF) << 24 | (buf[pos + 1] & 0xFF) << 16 | (buf[pos + 2] & 0xFF) << 8 | (buf[pos + 3] & 0xFF);
|
||||
}
|
||||
|
||||
static {
|
||||
(entityIds = new int[256][])[5] = new int[] { 1 };
|
||||
EntityMap.entityIds[7] = new int[] { 1, 5 };
|
||||
EntityMap.entityIds[17] = new int[] { 1 };
|
||||
EntityMap.entityIds[18] = new int[] { 1 };
|
||||
EntityMap.entityIds[19] = new int[] { 1 };
|
||||
EntityMap.entityIds[20] = new int[] { 1 };
|
||||
EntityMap.entityIds[22] = new int[] { 1, 5 };
|
||||
EntityMap.entityIds[23] = new int[] { 1 };
|
||||
EntityMap.entityIds[24] = new int[] { 1 };
|
||||
EntityMap.entityIds[25] = new int[] { 1 };
|
||||
EntityMap.entityIds[26] = new int[] { 1 };
|
||||
EntityMap.entityIds[28] = new int[] { 1 };
|
||||
EntityMap.entityIds[30] = new int[] { 1 };
|
||||
EntityMap.entityIds[31] = new int[] { 1 };
|
||||
EntityMap.entityIds[32] = new int[] { 1 };
|
||||
EntityMap.entityIds[33] = new int[] { 1 };
|
||||
EntityMap.entityIds[34] = new int[] { 1 };
|
||||
EntityMap.entityIds[35] = new int[] { 1 };
|
||||
EntityMap.entityIds[38] = new int[] { 1 };
|
||||
EntityMap.entityIds[39] = new int[] { 1, 5 };
|
||||
EntityMap.entityIds[40] = new int[] { 1 };
|
||||
EntityMap.entityIds[41] = new int[] { 1 };
|
||||
EntityMap.entityIds[42] = new int[] { 1 };
|
||||
EntityMap.entityIds[55] = new int[] { 1 };
|
||||
EntityMap.entityIds[71] = new int[] { 1 };
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import net.md_5.bungee.protocol.packet.Packet9Respawn;
|
||||
import net.md_5.bungee.protocol.packet.PacketCDClientStatus;
|
||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||
|
||||
public class PacketConstants {
|
||||
public static final Packet9Respawn DIM1_SWITCH;
|
||||
public static final Packet9Respawn DIM2_SWITCH;
|
||||
public static final PacketCDClientStatus CLIENT_LOGIN;
|
||||
public static final PacketFAPluginMessage FORGE_MOD_REQUEST;
|
||||
public static final PacketFAPluginMessage I_AM_BUNGEE;
|
||||
|
||||
static {
|
||||
DIM1_SWITCH = new Packet9Respawn(1, (byte) 0, (byte) 0, (short) 256, "DEFAULT");
|
||||
DIM2_SWITCH = new Packet9Respawn(-1, (byte) 0, (byte) 0, (short) 256, "DEFAULT");
|
||||
CLIENT_LOGIN = new PacketCDClientStatus((byte) 0);
|
||||
FORGE_MOD_REQUEST = new PacketFAPluginMessage("FML", new byte[] { 0, 0, 0, 0, 0, 2 });
|
||||
I_AM_BUNGEE = new PacketFAPluginMessage("BungeeCord", new byte[0]);
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.md_5.bungee.api.connection.Connection;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.netty.ChannelWrapper;
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||
import net.md_5.bungee.protocol.packet.PacketFFKick;
|
||||
|
||||
public class ServerConnection implements Server {
|
||||
private final ChannelWrapper ch;
|
||||
private final BungeeServerInfo info;
|
||||
private boolean isObsolete;
|
||||
private final Connection.Unsafe unsafe;
|
||||
|
||||
@Override
|
||||
public void sendData(final String channel, final byte[] data) {
|
||||
this.unsafe().sendPacket(new PacketFAPluginMessage(channel, data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void disconnect(final String reason) {
|
||||
if (this.ch != null && !this.ch.isClosed()) {
|
||||
this.unsafe().sendPacket(new PacketFFKick(reason));
|
||||
this.ch.getHandle().eventLoop().schedule((Runnable) new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ServerConnection.this.ch.getHandle().close();
|
||||
}
|
||||
}, 100L, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getAddress() {
|
||||
return this.getInfo() == null ? null : this.getInfo().getAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection.Unsafe unsafe() {
|
||||
return this.unsafe;
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "ch", "info" })
|
||||
public ServerConnection(final ChannelWrapper ch, final BungeeServerInfo info) {
|
||||
this.unsafe = new Connection.Unsafe() {
|
||||
@Override
|
||||
public void sendPacket(final DefinedPacket packet) {
|
||||
if (ServerConnection.this.ch != null) ServerConnection.this.ch.write(packet);
|
||||
}
|
||||
};
|
||||
this.ch = ch;
|
||||
this.info = info;
|
||||
}
|
||||
|
||||
public ChannelWrapper getCh() {
|
||||
return this.ch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BungeeServerInfo getInfo() {
|
||||
return this.info;
|
||||
}
|
||||
|
||||
public boolean isObsolete() {
|
||||
return this.isObsolete;
|
||||
}
|
||||
|
||||
public void setObsolete(final boolean isObsolete) {
|
||||
this.isObsolete = isObsolete;
|
||||
}
|
||||
}
|
@ -0,0 +1,267 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.security.PublicKey;
|
||||
import java.util.Objects;
|
||||
import java.util.Queue;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.io.ByteArrayDataInput;
|
||||
import com.google.common.io.ByteArrayDataOutput;
|
||||
import com.google.common.io.ByteStreams;
|
||||
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.event.ServerConnectedEvent;
|
||||
import net.md_5.bungee.api.event.ServerKickEvent;
|
||||
import net.md_5.bungee.api.event.ServerSwitchEvent;
|
||||
import net.md_5.bungee.api.score.Objective;
|
||||
import net.md_5.bungee.api.score.Scoreboard;
|
||||
import net.md_5.bungee.api.score.Team;
|
||||
import net.md_5.bungee.connection.CancelSendSignal;
|
||||
import net.md_5.bungee.connection.DownstreamBridge;
|
||||
import net.md_5.bungee.netty.ChannelWrapper;
|
||||
import net.md_5.bungee.netty.CipherDecoder;
|
||||
import net.md_5.bungee.netty.CipherEncoder;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
import net.md_5.bungee.netty.PacketDecoder;
|
||||
import net.md_5.bungee.netty.PacketHandler;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import net.md_5.bungee.protocol.Forge;
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.Packet1Login;
|
||||
import net.md_5.bungee.protocol.packet.Packet9Respawn;
|
||||
import net.md_5.bungee.protocol.packet.PacketCEScoreboardObjective;
|
||||
import net.md_5.bungee.protocol.packet.PacketD1Team;
|
||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||
import net.md_5.bungee.protocol.packet.PacketFCEncryptionResponse;
|
||||
import net.md_5.bungee.protocol.packet.PacketFDEncryptionRequest;
|
||||
import net.md_5.bungee.protocol.packet.PacketFFKick;
|
||||
import net.md_5.bungee.protocol.packet.forge.Forge1Login;
|
||||
|
||||
public class ServerConnector extends PacketHandler
|
||||
{
|
||||
private final ProxyServer bungee;
|
||||
private ChannelWrapper ch;
|
||||
private final UserConnection user;
|
||||
private final BungeeServerInfo target;
|
||||
private State thisState;
|
||||
private SecretKey secretkey;
|
||||
private boolean sentMessages;
|
||||
private boolean protocolSupport = BungeeCord.getInstance().config.getProtocolSupport();
|
||||
|
||||
@Override
|
||||
public void exception(final Throwable t) throws Exception {
|
||||
final String message = "Exception Connecting:" + Util.exception(t);
|
||||
if (this.user.getServer() == null || this.user.getServer().getInfo() == null) {
|
||||
this.user.disconnect(message);
|
||||
}
|
||||
else {
|
||||
this.user.sendMessage(ChatColor.RED + message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connected(final ChannelWrapper channel) throws Exception {
|
||||
this.ch = channel;
|
||||
channel.write(this.user.getPendingConnection().getHandshake());
|
||||
if (!protocolSupport) {
|
||||
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Login");
|
||||
out.writeUTF(this.user.getAddress().getHostString());
|
||||
out.writeInt(this.user.getAddress().getPort());
|
||||
channel.write(new PacketFAPluginMessage("BungeeCord", out.toByteArray()));
|
||||
if (this.user.getPendingConnection().getForgeLogin() == null) {
|
||||
channel.write(PacketConstants.CLIENT_LOGIN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void disconnected(final ChannelWrapper channel) throws Exception {
|
||||
this.user.getPendingConnects().remove(this.target);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(final Packet1Login login) throws Exception {
|
||||
Preconditions.checkState(this.thisState == State.LOGIN || this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting LOGIN/ENCRYPT_REQUEST");
|
||||
if (this.thisState == State.ENCRYPT_REQUEST) {
|
||||
this.thisState = State.LOGIN;
|
||||
}
|
||||
final ServerConnection server = new ServerConnection(this.ch, this.target);
|
||||
final ServerConnectedEvent event = new ServerConnectedEvent(this.user, server);
|
||||
this.bungee.getPluginManager().callEvent(event);
|
||||
this.ch.write(BungeeCord.getInstance().registerChannels());
|
||||
final Queue<DefinedPacket> packetQueue = this.target.getPacketQueue();
|
||||
synchronized (packetQueue) {
|
||||
while (!packetQueue.isEmpty()) {
|
||||
this.ch.write(packetQueue.poll());
|
||||
}
|
||||
}
|
||||
for (final PacketFAPluginMessage message : this.user.getPendingConnection().getRegisterMessages()) {
|
||||
this.ch.write(message);
|
||||
}
|
||||
if (!this.sentMessages) {
|
||||
for (final PacketFAPluginMessage message : this.user.getPendingConnection().getLoginMessages()) {
|
||||
this.ch.write(message);
|
||||
}
|
||||
}
|
||||
if (this.user.getSettings() != null) {
|
||||
this.ch.write(this.user.getSettings());
|
||||
}
|
||||
synchronized (this.user.getSwitchMutex()) {
|
||||
if (this.user.getServer() == null) {
|
||||
this.user.setClientEntityId(login.getEntityId());
|
||||
this.user.setServerEntityId(login.getEntityId());
|
||||
Packet1Login modLogin;
|
||||
if (((PacketDecoder)this.ch.getHandle().pipeline().get((Class)PacketDecoder.class)).getProtocol() == Forge.getInstance()) {
|
||||
modLogin = new Forge1Login(login.getEntityId(), login.getLevelType(), login.getGameMode(), login.getDimension(), login.getDifficulty(), login.getUnused(), (byte)this.user.getPendingConnection().getListener().getTabListSize());
|
||||
}
|
||||
else {
|
||||
modLogin = new Packet1Login(login.getEntityId(), login.getLevelType(), login.getGameMode(), (byte)login.getDimension(), login.getDifficulty(), login.getUnused(), (byte)this.user.getPendingConnection().getListener().getTabListSize());
|
||||
}
|
||||
this.user.unsafe().sendPacket(modLogin);
|
||||
}
|
||||
else {
|
||||
this.user.getTabList().onServerChange();
|
||||
final Scoreboard serverScoreboard = this.user.getServerSentScoreboard();
|
||||
for (final Objective objective : serverScoreboard.getObjectives()) {
|
||||
this.user.unsafe().sendPacket(new PacketCEScoreboardObjective(objective.getName(), objective.getValue(), (byte)1));
|
||||
}
|
||||
for (final Team team : serverScoreboard.getTeams()) {
|
||||
this.user.unsafe().sendPacket(new PacketD1Team(team.getName()));
|
||||
}
|
||||
serverScoreboard.clear();
|
||||
this.user.sendDimensionSwitch();
|
||||
this.user.setServerEntityId(login.getEntityId());
|
||||
this.user.unsafe().sendPacket(new Packet9Respawn(login.getDimension(), login.getDifficulty(), login.getGameMode(), (short)256, login.getLevelType()));
|
||||
this.user.getServer().setObsolete(true);
|
||||
this.user.getServer().disconnect("Quitting");
|
||||
}
|
||||
if (!this.user.isActive()) {
|
||||
server.disconnect("Quitting");
|
||||
this.bungee.getLogger().warning("No client connected for pending server!");
|
||||
return;
|
||||
}
|
||||
this.target.addPlayer(this.user);
|
||||
this.user.getPendingConnects().remove(this.target);
|
||||
this.user.setServer(server);
|
||||
((HandlerBoss)this.ch.getHandle().pipeline().get((Class)HandlerBoss.class)).setHandler(new DownstreamBridge(this.bungee, this.user, server));
|
||||
}
|
||||
this.bungee.getPluginManager().callEvent(new ServerSwitchEvent(this.user));
|
||||
this.thisState = State.FINISHED;
|
||||
throw new CancelSendSignal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(final PacketFDEncryptionRequest encryptRequest) throws Exception {
|
||||
Preconditions.checkState(this.thisState == State.ENCRYPT_REQUEST, (Object)"Not expecting ENCRYPT_REQUEST");
|
||||
if (protocolSupport) {
|
||||
final ByteArrayDataOutput out = ByteStreams.newDataOutput();
|
||||
out.writeUTF("Login");
|
||||
out.writeUTF(this.user.getAddress().getHostString());
|
||||
out.writeInt(this.user.getAddress().getPort());
|
||||
this.user.unsafe().sendPacket(new PacketFAPluginMessage("BungeeCord", out.toByteArray()));
|
||||
if (this.user.getPendingConnection().getForgeLogin() == null) {
|
||||
this.user.unsafe().sendPacket(PacketConstants.CLIENT_LOGIN);
|
||||
}
|
||||
}
|
||||
if (this.user.getPendingConnection().getForgeLogin() != null) {
|
||||
final PublicKey publickey = EncryptionUtil.getPubkey(encryptRequest);
|
||||
this.secretkey = EncryptionUtil.getSecret();
|
||||
final byte[] shared = EncryptionUtil.encrypt(publickey, this.secretkey.getEncoded());
|
||||
final byte[] token = EncryptionUtil.encrypt(publickey, encryptRequest.getVerifyToken());
|
||||
this.ch.write(new PacketFCEncryptionResponse(shared, token));
|
||||
final Cipher encrypt = EncryptionUtil.getCipher(1, this.secretkey);
|
||||
this.ch.getHandle().pipeline().addBefore(PipelineUtils.PACKET_DECODE_HANDLER, PipelineUtils.ENCRYPT_HANDLER, (ChannelHandler)new CipherEncoder(encrypt));
|
||||
this.thisState = State.ENCRYPT_RESPONSE;
|
||||
}
|
||||
else {
|
||||
this.thisState = State.LOGIN;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(final PacketFCEncryptionResponse encryptResponse) throws Exception {
|
||||
Preconditions.checkState(this.thisState == State.ENCRYPT_RESPONSE, (Object)"Not expecting ENCRYPT_RESPONSE");
|
||||
final Cipher decrypt = EncryptionUtil.getCipher(2, this.secretkey);
|
||||
this.ch.getHandle().pipeline().addBefore(PipelineUtils.PACKET_DECODE_HANDLER, PipelineUtils.DECRYPT_HANDLER, (ChannelHandler)new CipherDecoder(decrypt));
|
||||
this.ch.write(this.user.getPendingConnection().getForgeLogin());
|
||||
this.ch.write(PacketConstants.CLIENT_LOGIN);
|
||||
this.thisState = State.LOGIN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(final PacketFFKick kick) throws Exception {
|
||||
ServerInfo def = this.bungee.getServerInfo(this.user.getPendingConnection().getListener().getFallbackServer());
|
||||
if (Objects.equals(this.target, def)) {
|
||||
def = null;
|
||||
}
|
||||
final ServerKickEvent event = this.bungee.getPluginManager().callEvent(new ServerKickEvent(this.user, kick.getMessage(), def));
|
||||
if (event.isCancelled() && event.getCancelServer() != null) {
|
||||
this.user.connect(event.getCancelServer());
|
||||
return;
|
||||
}
|
||||
final String message = this.bungee.getTranslation("connect_kick") + this.target.getName() + ": " + kick.getMessage();
|
||||
if (this.user.getServer() == null || this.user.getServer().getInfo() == null) {
|
||||
this.user.disconnect(message);
|
||||
}
|
||||
else {
|
||||
this.user.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(final PacketFAPluginMessage pluginMessage) throws Exception {
|
||||
if (pluginMessage.equals(PacketConstants.I_AM_BUNGEE) && !BungeeCord.getInstance().config.allowBungeeOnBungee()) {
|
||||
throw new IllegalStateException("May not connect to another BungeeCord!");
|
||||
}
|
||||
if (pluginMessage.getTag().equals("FML") && (pluginMessage.getData()[0] & 0xFF) == 0x0) {
|
||||
final ByteArrayDataInput in = ByteStreams.newDataInput(pluginMessage.getData());
|
||||
in.readUnsignedByte();
|
||||
for (int count = in.readInt(), i = 0; i < count; ++i) {
|
||||
in.readUTF();
|
||||
}
|
||||
if (in.readByte() != 0) {
|
||||
((PacketDecoder)this.ch.getHandle().pipeline().get((Class)PacketDecoder.class)).setProtocol(Forge.getInstance());
|
||||
}
|
||||
}
|
||||
this.user.unsafe().sendPacket(pluginMessage);
|
||||
if (!this.sentMessages && this.user.getPendingConnection().getForgeLogin() != null) {
|
||||
for (final PacketFAPluginMessage message : this.user.getPendingConnection().getLoginMessages()) {
|
||||
this.ch.write(message);
|
||||
}
|
||||
this.sentMessages = true;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "[" + this.user.getName() + "] <-> ServerConnector [" + this.target.getName() + "]";
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "bungee", "user", "target" })
|
||||
public ServerConnector(final ProxyServer bungee, final UserConnection user, final BungeeServerInfo target) {
|
||||
this.thisState = State.ENCRYPT_REQUEST;
|
||||
this.bungee = bungee;
|
||||
this.user = user;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
private enum State
|
||||
{
|
||||
ENCRYPT_REQUEST,
|
||||
ENCRYPT_RESPONSE,
|
||||
LOGIN,
|
||||
FINISHED;
|
||||
}
|
||||
}
|
@ -0,0 +1,396 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.SocketAddress;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.WeakHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import io.netty.bootstrap.Bootstrap;
|
||||
import io.netty.channel.Channel;
|
||||
import io.netty.channel.ChannelFuture;
|
||||
import io.netty.channel.ChannelFutureListener;
|
||||
import io.netty.channel.ChannelHandler;
|
||||
import io.netty.channel.ChannelInitializer;
|
||||
import io.netty.channel.ChannelOption;
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
import io.netty.channel.socket.nio.NioSocketChannel;
|
||||
import io.netty.util.concurrent.GenericFutureListener;
|
||||
import io.netty.util.internal.PlatformDependent;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.config.TexturePackInfo;
|
||||
import net.md_5.bungee.api.connection.Connection;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.event.PermissionCheckEvent;
|
||||
import net.md_5.bungee.api.event.ServerConnectEvent;
|
||||
import net.md_5.bungee.api.score.Scoreboard;
|
||||
import net.md_5.bungee.api.tab.TabListHandler;
|
||||
import net.md_5.bungee.connection.InitialHandler;
|
||||
import net.md_5.bungee.eaglercraft.RedirectServerInfo;
|
||||
import net.md_5.bungee.netty.ChannelWrapper;
|
||||
import net.md_5.bungee.netty.HandlerBoss;
|
||||
import net.md_5.bungee.netty.PipelineUtils;
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
import net.md_5.bungee.protocol.packet.Packet3Chat;
|
||||
import net.md_5.bungee.protocol.packet.PacketCCSettings;
|
||||
import net.md_5.bungee.protocol.packet.PacketFAPluginMessage;
|
||||
import net.md_5.bungee.protocol.packet.PacketFFKick;
|
||||
import net.md_5.bungee.util.CaseInsensitiveSet;
|
||||
|
||||
public final class UserConnection implements ProxiedPlayer {
|
||||
private final ProxyServer bungee;
|
||||
private final ChannelWrapper ch;
|
||||
private final String name;
|
||||
private final InitialHandler pendingConnection;
|
||||
private ServerConnection server;
|
||||
private final Object switchMutex;
|
||||
private final Collection<ServerInfo> pendingConnects;
|
||||
private TabListHandler tabList;
|
||||
private int sentPingId;
|
||||
private long sentPingTime;
|
||||
private int ping;
|
||||
private final Collection<String> groups;
|
||||
private final Collection<String> permissions;
|
||||
private int clientEntityId;
|
||||
private int serverEntityId;
|
||||
private PacketCCSettings settings;
|
||||
private final Scoreboard serverSentScoreboard;
|
||||
private String displayName;
|
||||
private final Connection.Unsafe unsafe;
|
||||
private final Map<String, Object> attachment = new WeakHashMap();
|
||||
|
||||
public void init() {
|
||||
this.displayName = this.name;
|
||||
try {
|
||||
this.tabList = (TabListHandler) this.getPendingConnection().getListener().getTabList().getDeclaredConstructor((Class<?>[]) new Class[0]).newInstance(new Object[0]);
|
||||
} catch (ReflectiveOperationException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
this.tabList.init(this);
|
||||
final Collection<String> g = this.bungee.getConfigurationAdapter().getGroups(this.name);
|
||||
for (final String s : g) {
|
||||
this.addGroups(s);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTabList(final TabListHandler tabList) {
|
||||
tabList.init(this);
|
||||
this.tabList = tabList;
|
||||
}
|
||||
|
||||
public void sendPacket(final byte[] b) {
|
||||
this.ch.write(b);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public boolean isActive() {
|
||||
return !this.ch.isClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDisplayName(final String name) {
|
||||
Preconditions.checkNotNull((Object) name, (Object) "displayName");
|
||||
Preconditions.checkArgument(name.length() <= 16, (Object) "Display name cannot be longer than 16 characters");
|
||||
this.getTabList().onDisconnect();
|
||||
this.displayName = name;
|
||||
this.getTabList().onConnect();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void connect(final ServerInfo target) {
|
||||
this.connect(target, false);
|
||||
}
|
||||
|
||||
void sendDimensionSwitch() {
|
||||
this.unsafe().sendPacket(PacketConstants.DIM1_SWITCH);
|
||||
this.unsafe().sendPacket(PacketConstants.DIM2_SWITCH);
|
||||
}
|
||||
|
||||
public void connectNow(final ServerInfo target) {
|
||||
this.sendDimensionSwitch();
|
||||
this.connect(target);
|
||||
}
|
||||
|
||||
public void connect(final ServerInfo info, final boolean retry) {
|
||||
if(info instanceof RedirectServerInfo) {
|
||||
sendData("EAG|Reconnect", ((RedirectServerInfo)info).getRedirect().getBytes(StandardCharsets.UTF_8));
|
||||
return;
|
||||
}
|
||||
final ServerConnectEvent event = new ServerConnectEvent(this, info);
|
||||
if (this.bungee.getPluginManager().callEvent(event).isCancelled()) {
|
||||
return;
|
||||
}
|
||||
final BungeeServerInfo target = (BungeeServerInfo) event.getTarget();
|
||||
if (this.getServer() != null && this.getServer().getInfo() != null && Objects.equals(this.getServer().getInfo(), target)) {
|
||||
//this.sendMessage(ChatColor.RED + "Cannot connect to server you are already on!");
|
||||
return;
|
||||
}
|
||||
if (this.pendingConnects.contains(target)) {
|
||||
this.sendMessage(ChatColor.RED + "Already connecting to this server!");
|
||||
return;
|
||||
}
|
||||
this.pendingConnects.add(target);
|
||||
final ChannelInitializer initializer = new ChannelInitializer() {
|
||||
protected void initChannel(final Channel ch) throws Exception {
|
||||
PipelineUtils.BASE.initChannel(ch);
|
||||
((HandlerBoss) ch.pipeline().get((Class) HandlerBoss.class)).setHandler(new ServerConnector(UserConnection.this.bungee, UserConnection.this, target));
|
||||
}
|
||||
};
|
||||
final ChannelFutureListener listener = (ChannelFutureListener) new ChannelFutureListener() {
|
||||
public void operationComplete(final ChannelFuture future) throws Exception {
|
||||
if (!future.isSuccess()) {
|
||||
future.channel().close();
|
||||
UserConnection.this.pendingConnects.remove(target);
|
||||
final ServerInfo def = ProxyServer.getInstance().getServers().get(UserConnection.this.getPendingConnection().getListener().getFallbackServer());
|
||||
if ((retry & target != def) && ((UserConnection.this.getServer() == null || UserConnection.this.getServer().getInfo() == null) || def != UserConnection.this.getServer().getInfo())) {
|
||||
UserConnection.this.sendMessage(UserConnection.this.bungee.getTranslation("fallback_lobby"));
|
||||
UserConnection.this.connect(def, false);
|
||||
} else if (UserConnection.this.getServer() == null || UserConnection.this.getServer().getInfo() == null) {
|
||||
UserConnection.this.disconnect(UserConnection.this.bungee.getTranslation("fallback_kick") + future.cause().getClass().getName());
|
||||
} else {
|
||||
UserConnection.this.sendMessage(UserConnection.this.bungee.getTranslation("fallback_kick") + future.cause().getClass().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
final Bootstrap b = ((Bootstrap) ((Bootstrap) ((Bootstrap) ((Bootstrap) new Bootstrap().channel((Class) NioSocketChannel.class)).group((EventLoopGroup) BungeeCord.getInstance().eventLoops)).handler((ChannelHandler) initializer))
|
||||
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, Integer.valueOf(5000))).remoteAddress((SocketAddress) target.getAddress());
|
||||
if (!PlatformDependent.isWindows()) {
|
||||
b.localAddress(this.getPendingConnection().getListener().getHost().getHostString(), 0);
|
||||
}
|
||||
b.connect().addListener((GenericFutureListener) listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized void disconnect(final String reason) {
|
||||
if (this.ch.getHandle().isActive()) {
|
||||
this.bungee.getLogger().log(Level.INFO, "[" + this.getName() + "] disconnected with: " + reason);
|
||||
this.unsafe().sendPacket(new PacketFFKick(reason));
|
||||
this.ch.close();
|
||||
if (this.server != null && this.server.getInfo() != null) {
|
||||
this.server.disconnect("Quitting");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void chat(final String message) {
|
||||
Preconditions.checkState(this.server != null, (Object) "Not connected to server");
|
||||
this.server.getCh().write(new Packet3Chat(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(final String message) {
|
||||
this.unsafe().sendPacket(new Packet3Chat(message));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessages(final String... messages) {
|
||||
for (final String message : messages) {
|
||||
this.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendData(final String channel, final byte[] data) {
|
||||
this.unsafe().sendPacket(new PacketFAPluginMessage(channel, data));
|
||||
}
|
||||
|
||||
@Override
|
||||
public InetSocketAddress getAddress() {
|
||||
return (InetSocketAddress) this.ch.getHandle().remoteAddress();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getGroups() {
|
||||
return Collections.unmodifiableCollection((Collection<? extends String>) this.groups);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addGroups(final String... groups) {
|
||||
for (final String group : groups) {
|
||||
this.groups.add(group);
|
||||
for (final String permission : this.bungee.getConfigurationAdapter().getPermissions(group)) {
|
||||
this.setPermission(permission, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeGroups(final String... groups) {
|
||||
for (final String group : groups) {
|
||||
this.groups.remove(group);
|
||||
for (final String permission : this.bungee.getConfigurationAdapter().getPermissions(group)) {
|
||||
this.setPermission(permission, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(final String permission) {
|
||||
return this.bungee.getPluginManager().callEvent(new PermissionCheckEvent(this, permission, this.permissions.contains(permission))).hasPermission();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPermission(final String permission, final boolean value) {
|
||||
if (value) {
|
||||
this.permissions.add(permission);
|
||||
} else {
|
||||
this.permissions.remove(permission);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTexturePack(final TexturePackInfo pack) {
|
||||
this.unsafe().sendPacket(new PacketFAPluginMessage("MC|TPack", (pack.getUrl() + "\u0000" + pack.getSize()).getBytes()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection.Unsafe unsafe() {
|
||||
return this.unsafe;
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "bungee", "ch", "name", "pendingConnection" })
|
||||
public UserConnection(final ProxyServer bungee, final ChannelWrapper ch, final String name, final InitialHandler pendingConnection) {
|
||||
this.switchMutex = new Object();
|
||||
this.pendingConnects = new HashSet<ServerInfo>();
|
||||
this.ping = 100;
|
||||
this.groups = (Collection<String>) new CaseInsensitiveSet();
|
||||
this.permissions = (Collection<String>) new CaseInsensitiveSet();
|
||||
this.serverSentScoreboard = new Scoreboard();
|
||||
this.unsafe = new Connection.Unsafe() {
|
||||
@Override
|
||||
public void sendPacket(final DefinedPacket packet) {
|
||||
UserConnection.this.ch.write(packet);
|
||||
}
|
||||
};
|
||||
if (bungee == null) {
|
||||
throw new NullPointerException("bungee");
|
||||
}
|
||||
if (ch == null) {
|
||||
throw new NullPointerException("ch");
|
||||
}
|
||||
if (name == null) {
|
||||
throw new NullPointerException("name");
|
||||
}
|
||||
this.bungee = bungee;
|
||||
this.ch = ch;
|
||||
this.name = name;
|
||||
this.pendingConnection = pendingConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InitialHandler getPendingConnection() {
|
||||
return this.pendingConnection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ServerConnection getServer() {
|
||||
return this.server;
|
||||
}
|
||||
|
||||
public void setServer(final ServerConnection server) {
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public Object getSwitchMutex() {
|
||||
return this.switchMutex;
|
||||
}
|
||||
|
||||
public Collection<ServerInfo> getPendingConnects() {
|
||||
return this.pendingConnects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TabListHandler getTabList() {
|
||||
return this.tabList;
|
||||
}
|
||||
|
||||
public int getSentPingId() {
|
||||
return this.sentPingId;
|
||||
}
|
||||
|
||||
public void setSentPingId(final int sentPingId) {
|
||||
this.sentPingId = sentPingId;
|
||||
}
|
||||
|
||||
public long getSentPingTime() {
|
||||
return this.sentPingTime;
|
||||
}
|
||||
|
||||
public void setSentPingTime(final long sentPingTime) {
|
||||
this.sentPingTime = sentPingTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPing() {
|
||||
return this.ping;
|
||||
}
|
||||
|
||||
public void setPing(final int ping) {
|
||||
this.ping = ping;
|
||||
}
|
||||
|
||||
public int getClientEntityId() {
|
||||
return this.clientEntityId;
|
||||
}
|
||||
|
||||
public void setClientEntityId(final int clientEntityId) {
|
||||
this.clientEntityId = clientEntityId;
|
||||
}
|
||||
|
||||
public int getServerEntityId() {
|
||||
return this.serverEntityId;
|
||||
}
|
||||
|
||||
public void setServerEntityId(final int serverEntityId) {
|
||||
this.serverEntityId = serverEntityId;
|
||||
}
|
||||
|
||||
public PacketCCSettings getSettings() {
|
||||
return this.settings;
|
||||
}
|
||||
|
||||
public void setSettings(final PacketCCSettings settings) {
|
||||
this.settings = settings;
|
||||
}
|
||||
|
||||
public Scoreboard getServerSentScoreboard() {
|
||||
return this.serverSentScoreboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getAttachment() {
|
||||
return attachment;
|
||||
}
|
||||
}
|
43
eaglercraftbungee/src/main/java/net/md_5/bungee/Util.java
Normal file
43
eaglercraftbungee/src/main/java/net/md_5/bungee/Util.java
Normal file
@ -0,0 +1,43 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
|
||||
public class Util {
|
||||
private static final int DEFAULT_PORT = 25565;
|
||||
|
||||
public static InetSocketAddress getAddr(final String hostline) {
|
||||
final String[] split = hostline.split(":");
|
||||
int port = 25565;
|
||||
if (split.length > 1) {
|
||||
port = Integer.parseInt(split[1]);
|
||||
}
|
||||
return new InetSocketAddress(split[0], port);
|
||||
}
|
||||
|
||||
public static String hex(final int i) {
|
||||
return String.format("0x%02X", i);
|
||||
}
|
||||
|
||||
public static String exception(final Throwable t) {
|
||||
final StackTraceElement[] trace = t.getStackTrace();
|
||||
return t.getClass().getSimpleName() + " : " + t.getMessage() + ((trace.length > 0) ? (" @ " + t.getStackTrace()[0].getClassName() + ":" + t.getStackTrace()[0].getLineNumber()) : "");
|
||||
}
|
||||
|
||||
public static String csv(final Collection<?> objects) {
|
||||
return format(objects, ", ");
|
||||
}
|
||||
|
||||
public static String format(final Collection<?> objects, final String separators) {
|
||||
final StringBuilder ret = new StringBuilder();
|
||||
for (final Object o : objects) {
|
||||
ret.append(o);
|
||||
ret.append(separators);
|
||||
}
|
||||
return (ret.length() == 0) ? "" : ret.substring(0, ret.length() - separators.length());
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
public interface Callback<V> {
|
||||
void done(final V p0, final Throwable p1);
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public enum ChatColor {
|
||||
BLACK('0'), DARK_BLUE('1'), DARK_GREEN('2'), DARK_AQUA('3'), DARK_RED('4'), DARK_PURPLE('5'), GOLD('6'), GRAY('7'), DARK_GRAY('8'), BLUE('9'), GREEN('a'), AQUA('b'), RED('c'), LIGHT_PURPLE('d'), YELLOW('e'), WHITE('f'), MAGIC('k'),
|
||||
BOLD('l'), STRIKETHROUGH('m'), UNDERLINE('n'), ITALIC('o'), RESET('r');
|
||||
|
||||
public static final char COLOR_CHAR = '\u00A7';
|
||||
private static final Pattern STRIP_COLOR_PATTERN;
|
||||
private static final Map<Character, ChatColor> BY_CHAR;
|
||||
private final char code;
|
||||
private final String toString;
|
||||
|
||||
private ChatColor(final char code) {
|
||||
this.code = code;
|
||||
this.toString = new String(new char[] { '\u00A7', code });
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return this.toString;
|
||||
}
|
||||
|
||||
public static String stripColor(final String input) {
|
||||
if (input == null) {
|
||||
return null;
|
||||
}
|
||||
return ChatColor.STRIP_COLOR_PATTERN.matcher(input).replaceAll("");
|
||||
}
|
||||
|
||||
public static String translateAlternateColorCodes(final char altColorChar, final String textToTranslate) {
|
||||
final char[] b = textToTranslate.toCharArray();
|
||||
for (int i = 0; i < b.length - 1; ++i) {
|
||||
if (b[i] == altColorChar && "0123456789AaBbCcDdEeFfKkLlMmNnOoRr".indexOf(b[i + 1]) > -1) {
|
||||
b[i] = '\u00A7';
|
||||
b[i + 1] = Character.toLowerCase(b[i + 1]);
|
||||
}
|
||||
}
|
||||
return new String(b);
|
||||
}
|
||||
|
||||
public static ChatColor getByChar(final char code) {
|
||||
return ChatColor.BY_CHAR.get(code);
|
||||
}
|
||||
|
||||
static {
|
||||
STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + String.valueOf('\u00A7') + "[0-9A-FK-OR]");
|
||||
BY_CHAR = new HashMap<Character, ChatColor>();
|
||||
for (final ChatColor colour : values()) {
|
||||
ChatColor.BY_CHAR.put(colour.code, colour);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public interface CommandSender {
|
||||
String getName();
|
||||
|
||||
void sendMessage(final String p0);
|
||||
|
||||
void sendMessages(final String... p0);
|
||||
|
||||
Collection<String> getGroups();
|
||||
|
||||
void addGroups(final String... p0);
|
||||
|
||||
void removeGroups(final String... p0);
|
||||
|
||||
boolean hasPermission(final String p0);
|
||||
|
||||
void setPermission(final String p0, final boolean p1);
|
||||
|
||||
Map<String, Object> getAttachment();
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface MOTD extends QueryConnection {
|
||||
|
||||
public void sendToUser();
|
||||
|
||||
public String getLine1();
|
||||
public String getLine2();
|
||||
public List<String> getPlayerList();
|
||||
public int[] getBitmap();
|
||||
public int getOnlinePlayers();
|
||||
public int getMaxPlayers();
|
||||
public String getSubType();
|
||||
|
||||
public void setLine1(String p);
|
||||
public void setLine2(String p);
|
||||
public void setPlayerList(List<String> p);
|
||||
public void setPlayerList(String... p);
|
||||
public void setBitmap(int[] p);
|
||||
public void setOnlinePlayers(int i);
|
||||
public void setMaxPlayers(int i);
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.md_5.bungee.api.config.ConfigurationAdapter;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.PluginManager;
|
||||
import net.md_5.bungee.api.scheduler.TaskScheduler;
|
||||
import net.md_5.bungee.api.tab.CustomTabList;
|
||||
|
||||
public abstract class ProxyServer {
|
||||
private static ProxyServer instance;
|
||||
|
||||
public static void setInstance(final ProxyServer instance) {
|
||||
Preconditions.checkNotNull((Object) instance, (Object) "instance");
|
||||
Preconditions.checkArgument(ProxyServer.instance == null, (Object) "Instance already set");
|
||||
ProxyServer.instance = instance;
|
||||
}
|
||||
|
||||
public abstract String getName();
|
||||
|
||||
public abstract String getVersion();
|
||||
|
||||
public abstract String getTranslation(final String p0);
|
||||
|
||||
public abstract Logger getLogger();
|
||||
|
||||
public abstract Collection<ProxiedPlayer> getPlayers();
|
||||
|
||||
public abstract ProxiedPlayer getPlayer(final String p0);
|
||||
|
||||
public abstract Map<String, ServerInfo> getServers();
|
||||
|
||||
public abstract ServerInfo getServerInfo(final String p0);
|
||||
|
||||
public abstract PluginManager getPluginManager();
|
||||
|
||||
public abstract ConfigurationAdapter getConfigurationAdapter();
|
||||
|
||||
public abstract void setConfigurationAdapter(final ConfigurationAdapter p0);
|
||||
|
||||
public abstract ReconnectHandler getReconnectHandler();
|
||||
|
||||
public abstract void setReconnectHandler(final ReconnectHandler p0);
|
||||
|
||||
public abstract void stop();
|
||||
|
||||
public abstract void start() throws Exception;
|
||||
|
||||
public abstract void registerChannel(final String p0);
|
||||
|
||||
public abstract void unregisterChannel(final String p0);
|
||||
|
||||
public abstract Collection<String> getChannels();
|
||||
|
||||
public abstract String getGameVersion();
|
||||
|
||||
public abstract byte getProtocolVersion();
|
||||
|
||||
public abstract ServerInfo constructServerInfo(final String p0, final InetSocketAddress p1, final boolean p2);
|
||||
|
||||
public abstract CommandSender getConsole();
|
||||
|
||||
public abstract File getPluginsFolder();
|
||||
|
||||
public abstract TaskScheduler getScheduler();
|
||||
|
||||
public abstract int getOnlineCount();
|
||||
|
||||
public abstract void broadcast(final String p0);
|
||||
|
||||
public abstract CustomTabList customTabList(final ProxiedPlayer p0);
|
||||
|
||||
public static ProxyServer getInstance() {
|
||||
return ProxyServer.instance;
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import org.json.JSONObject;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.config.ListenerInfo;
|
||||
import net.md_5.bungee.eaglercraft.EaglercraftBungee;
|
||||
|
||||
public interface QueryConnection {
|
||||
|
||||
public InetAddress getRemoteAddress();
|
||||
public ListenerInfo getListener();
|
||||
|
||||
public String getAccept();
|
||||
public void setReturnType(String type);
|
||||
public String getReturnType();
|
||||
|
||||
public int availableRequests();
|
||||
|
||||
public default JSONObject readRequestData() {
|
||||
String s = readRequestString();
|
||||
return s == null ? null : new JSONObject(s);
|
||||
}
|
||||
|
||||
public String readRequestString();
|
||||
public long getConnectionTimestamp();
|
||||
|
||||
public default long getConnectionAge() {
|
||||
return System.currentTimeMillis() - getConnectionTimestamp();
|
||||
}
|
||||
|
||||
public default void writeResponse(JSONObject msg) {
|
||||
JSONObject toSend = new JSONObject();
|
||||
toSend.put("type", getReturnType());
|
||||
toSend.put("name", BungeeCord.getInstance().config.getServerName());
|
||||
toSend.put("brand", EaglercraftBungee.brand);
|
||||
toSend.put("vers", EaglercraftBungee.version);
|
||||
toSend.put("cracked", EaglercraftBungee.cracked);
|
||||
toSend.put("secure", false);
|
||||
toSend.put("time", System.currentTimeMillis());
|
||||
toSend.put("uuid", BungeeCord.getInstance().config.getUuid());
|
||||
toSend.put("data", msg);
|
||||
writeResponseRaw(toSend.toString());
|
||||
}
|
||||
|
||||
public default void writeResponse(String msg) {
|
||||
JSONObject toSend = new JSONObject();
|
||||
toSend.put("type", getReturnType());
|
||||
toSend.put("name", BungeeCord.getInstance().config.getServerName());
|
||||
toSend.put("brand", EaglercraftBungee.brand);
|
||||
toSend.put("vers", EaglercraftBungee.version);
|
||||
toSend.put("cracked", EaglercraftBungee.cracked);
|
||||
toSend.put("secure", false);
|
||||
toSend.put("time", System.currentTimeMillis());
|
||||
toSend.put("uuid", BungeeCord.getInstance().config.getUuid());
|
||||
toSend.put("data", msg);
|
||||
writeResponseRaw(toSend.toString());
|
||||
}
|
||||
|
||||
public void writeResponseRaw(String msg);
|
||||
public void writeResponseBinary(byte[] blob);
|
||||
|
||||
public void keepAlive(boolean yes);
|
||||
public boolean shouldKeepAlive();
|
||||
public boolean isClosed();
|
||||
public void close();
|
||||
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public interface ReconnectHandler {
|
||||
ServerInfo getServer(final ProxiedPlayer p0);
|
||||
|
||||
void setServer(final ProxiedPlayer p0);
|
||||
|
||||
void save();
|
||||
|
||||
void close();
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.RenderingHints;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
public class ServerIcon {
|
||||
|
||||
public static int[] createServerIcon(BufferedImage awtIcon) {
|
||||
BufferedImage icon = awtIcon;
|
||||
boolean gotScaled = false;
|
||||
if(icon.getWidth() != 64 || icon.getHeight() != 64) {
|
||||
icon = new BufferedImage(64, 64, awtIcon.getType());
|
||||
Graphics2D g = (Graphics2D) icon.getGraphics();
|
||||
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, (awtIcon.getWidth() < 64 || awtIcon.getHeight() < 64) ?
|
||||
RenderingHints.VALUE_INTERPOLATION_NEAREST_NEIGHBOR : RenderingHints.VALUE_INTERPOLATION_BICUBIC);
|
||||
g.setBackground(new Color(0, true));
|
||||
g.clearRect(0, 0, 64, 64);
|
||||
int ow = awtIcon.getWidth();
|
||||
int oh = awtIcon.getHeight();
|
||||
int nw, nh;
|
||||
float aspectRatio = (float)oh / (float)ow;
|
||||
if(aspectRatio >= 1.0f) {
|
||||
nw = (int)(64 / aspectRatio);
|
||||
nh = 64;
|
||||
}else {
|
||||
nw = 64;
|
||||
nh = (int)(64 * aspectRatio);
|
||||
}
|
||||
g.drawImage(awtIcon, (64 - nw) / 2, (64 - nh) / 2, (64 - nw) / 2 + nw, (64 - nh) / 2 + nh, 0, 0, awtIcon.getWidth(), awtIcon.getHeight(), null);
|
||||
g.dispose();
|
||||
gotScaled = true;
|
||||
}
|
||||
int[] pxls = icon.getRGB(0, 0, 64, 64, new int[4096], 0, 64);
|
||||
if(gotScaled) {
|
||||
for(int i = 0; i < pxls.length; ++i) {
|
||||
if((pxls[i] & 0xFFFFFF) == 0) {
|
||||
pxls[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pxls;
|
||||
}
|
||||
|
||||
public static int[] createServerIcon(InputStream f) {
|
||||
try {
|
||||
return createServerIcon(ImageIO.read(f));
|
||||
}catch(Throwable t) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static int[] createServerIcon(File f) {
|
||||
try {
|
||||
return createServerIcon(ImageIO.read(f));
|
||||
}catch(Throwable t) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,107 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
public class ServerPing {
|
||||
private final byte protocolVersion;
|
||||
private final String gameVersion;
|
||||
private final String motd;
|
||||
private final int currentPlayers;
|
||||
private final int maxPlayers;
|
||||
|
||||
@ConstructorProperties({ "protocolVersion", "gameVersion", "motd", "currentPlayers", "maxPlayers" })
|
||||
public ServerPing(final byte protocolVersion, final String gameVersion, final String motd, final int currentPlayers, final int maxPlayers) {
|
||||
this.protocolVersion = protocolVersion;
|
||||
this.gameVersion = gameVersion;
|
||||
this.motd = motd;
|
||||
this.currentPlayers = currentPlayers;
|
||||
this.maxPlayers = maxPlayers;
|
||||
}
|
||||
|
||||
public byte getProtocolVersion() {
|
||||
return this.protocolVersion;
|
||||
}
|
||||
|
||||
public String getGameVersion() {
|
||||
return this.gameVersion;
|
||||
}
|
||||
|
||||
public String getMotd() {
|
||||
return this.motd;
|
||||
}
|
||||
|
||||
public int getCurrentPlayers() {
|
||||
return this.currentPlayers;
|
||||
}
|
||||
|
||||
public int getMaxPlayers() {
|
||||
return this.maxPlayers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ServerPing)) {
|
||||
return false;
|
||||
}
|
||||
final ServerPing other = (ServerPing) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (this.getProtocolVersion() != other.getProtocolVersion()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$gameVersion = this.getGameVersion();
|
||||
final Object other$gameVersion = other.getGameVersion();
|
||||
Label_0078: {
|
||||
if (this$gameVersion == null) {
|
||||
if (other$gameVersion == null) {
|
||||
break Label_0078;
|
||||
}
|
||||
} else if (this$gameVersion.equals(other$gameVersion)) {
|
||||
break Label_0078;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$motd = this.getMotd();
|
||||
final Object other$motd = other.getMotd();
|
||||
if (this$motd == null) {
|
||||
if (other$motd == null) {
|
||||
return this.getCurrentPlayers() == other.getCurrentPlayers() && this.getMaxPlayers() == other.getMaxPlayers();
|
||||
}
|
||||
} else if (this$motd.equals(other$motd)) {
|
||||
return this.getCurrentPlayers() == other.getCurrentPlayers() && this.getMaxPlayers() == other.getMaxPlayers();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ServerPing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
result = result * 31 + this.getProtocolVersion();
|
||||
final Object $gameVersion = this.getGameVersion();
|
||||
result = result * 31 + (($gameVersion == null) ? 0 : $gameVersion.hashCode());
|
||||
final Object $motd = this.getMotd();
|
||||
result = result * 31 + (($motd == null) ? 0 : $motd.hashCode());
|
||||
result = result * 31 + this.getCurrentPlayers();
|
||||
result = result * 31 + this.getMaxPlayers();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerPing(protocolVersion=" + this.getProtocolVersion() + ", gameVersion=" + this.getGameVersion() + ", motd=" + this.getMotd() + ", currentPlayers=" + this.getCurrentPlayers() + ", maxPlayers=" + this.getMaxPlayers()
|
||||
+ ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AuthServiceInfo {
|
||||
|
||||
private final boolean enabled;
|
||||
private final boolean registerEnabled;
|
||||
private final String authfile;
|
||||
private final int ipLimit;
|
||||
private final List<String> joinMessages;
|
||||
private final int loginTimeout;
|
||||
|
||||
public AuthServiceInfo(boolean enabled, boolean registerEnabled, String authfile,
|
||||
int timeout, List<String> joinMessages, int loginTimeout) {
|
||||
this.enabled = enabled;
|
||||
this.registerEnabled = registerEnabled;
|
||||
this.authfile = authfile;
|
||||
this.ipLimit = timeout;
|
||||
this.joinMessages = joinMessages;
|
||||
this.loginTimeout = loginTimeout;
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
public boolean isRegisterEnabled() {
|
||||
return registerEnabled;
|
||||
}
|
||||
|
||||
public String getAuthfile() {
|
||||
return authfile;
|
||||
}
|
||||
|
||||
public int getIpLimit() {
|
||||
return ipLimit;
|
||||
}
|
||||
|
||||
public List<String> getJoinMessages() {
|
||||
return joinMessages;
|
||||
}
|
||||
|
||||
public int getLoginTimeout() {
|
||||
return loginTimeout;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConfigurationAdapter {
|
||||
void load();
|
||||
|
||||
int getInt(final String p0, final int p1);
|
||||
|
||||
String getString(final String p0, final String p1);
|
||||
|
||||
boolean getBoolean(final String p0, final boolean p1);
|
||||
|
||||
Map<String, ServerInfo> getServers();
|
||||
|
||||
Collection<ListenerInfo> getListeners();
|
||||
|
||||
Collection<String> getGroups(final String p0);
|
||||
|
||||
Collection<String> getPermissions(final String p0);
|
||||
|
||||
Collection<String> getBlacklistURLs();
|
||||
|
||||
Collection<String> getBlacklistSimpleWhitelist();
|
||||
|
||||
Collection<String> getDisabledCommands();
|
||||
|
||||
Collection<String> getICEServers();
|
||||
|
||||
AuthServiceInfo getAuthSettings();
|
||||
|
||||
Map<String, Object> getMap();
|
||||
|
||||
void forceSave();
|
||||
}
|
@ -0,0 +1,360 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Map;
|
||||
|
||||
import net.md_5.bungee.api.ServerIcon;
|
||||
import net.md_5.bungee.api.tab.TabListHandler;
|
||||
import net.md_5.bungee.eaglercraft.WebSocketRateLimiter;
|
||||
|
||||
public class ListenerInfo {
|
||||
private final String hostString;
|
||||
private final InetSocketAddress host;
|
||||
private final InetSocketAddress javaHost;
|
||||
private final String motd;
|
||||
private final int maxPlayers;
|
||||
private final int tabListSize;
|
||||
private final String defaultServer;
|
||||
private final String fallbackServer;
|
||||
private final boolean forceDefault;
|
||||
private final boolean websocket;
|
||||
private final boolean forwardIp;
|
||||
private final String forwardIpHeader;
|
||||
private final Map<String, String> forcedHosts;
|
||||
private final TexturePackInfo texturePack;
|
||||
private final Class<? extends TabListHandler> tabList;
|
||||
private final String serverIcon;
|
||||
private final int[] serverIconCache;
|
||||
private boolean serverIconLoaded;
|
||||
private boolean serverIconSet;
|
||||
private final boolean allowMOTD;
|
||||
private final boolean allowQuery;
|
||||
private final MOTDCacheConfiguration cacheConfig;
|
||||
private final WebSocketRateLimiter rateLimitIP;
|
||||
private final WebSocketRateLimiter rateLimitLogin;
|
||||
private final WebSocketRateLimiter rateLimitMOTD;
|
||||
private final WebSocketRateLimiter rateLimitQuery;
|
||||
|
||||
|
||||
public ListenerInfo(final String hostString, final InetSocketAddress host, final InetSocketAddress javaHost,
|
||||
final String forwardIpHeader, final String motd, final int maxPlayers, final int tabListSize,
|
||||
final String defaultServer, final String fallbackServer, final boolean forceDefault,
|
||||
final boolean websocket, final boolean forwardIp, final Map<String, String> forcedHosts,
|
||||
final TexturePackInfo texturePack, final Class<? extends TabListHandler> tabList, final String serverIcon,
|
||||
final MOTDCacheConfiguration cacheConfig, final boolean allowMOTD, final boolean allowQuery,
|
||||
final WebSocketRateLimiter rateLimitIP, final WebSocketRateLimiter rateLimitLogin,
|
||||
final WebSocketRateLimiter rateLimitMOTD, final WebSocketRateLimiter rateLimitQuery) {
|
||||
this.hostString = hostString;
|
||||
this.host = host;
|
||||
this.javaHost = javaHost;
|
||||
this.motd = motd;
|
||||
this.maxPlayers = maxPlayers;
|
||||
this.tabListSize = tabListSize;
|
||||
this.defaultServer = defaultServer;
|
||||
this.fallbackServer = fallbackServer;
|
||||
this.forceDefault = forceDefault;
|
||||
this.websocket = websocket;
|
||||
this.forwardIp = forwardIp;
|
||||
this.forwardIpHeader = forwardIpHeader;
|
||||
this.forcedHosts = forcedHosts;
|
||||
this.texturePack = texturePack;
|
||||
this.tabList = tabList;
|
||||
this.serverIcon = serverIcon;
|
||||
this.serverIconCache = new int[4096];
|
||||
this.serverIconLoaded = false;
|
||||
this.serverIconSet = false;
|
||||
this.allowMOTD = allowMOTD;
|
||||
this.allowQuery = allowQuery;
|
||||
this.cacheConfig = cacheConfig;
|
||||
this.rateLimitIP = rateLimitIP;
|
||||
this.rateLimitLogin = rateLimitLogin;
|
||||
this.rateLimitMOTD = rateLimitMOTD;
|
||||
this.rateLimitQuery = rateLimitQuery;
|
||||
}
|
||||
|
||||
public String getHostString() {
|
||||
return this.hostString;
|
||||
}
|
||||
|
||||
public InetSocketAddress getHost() {
|
||||
return this.host;
|
||||
}
|
||||
|
||||
public InetSocketAddress getJavaHost() {
|
||||
return this.javaHost;
|
||||
}
|
||||
|
||||
public String getMotd() {
|
||||
return this.motd;
|
||||
}
|
||||
|
||||
public int getMaxPlayers() {
|
||||
return this.maxPlayers;
|
||||
}
|
||||
|
||||
public int getTabListSize() {
|
||||
return this.tabListSize;
|
||||
}
|
||||
|
||||
public String getDefaultServer() {
|
||||
return this.defaultServer;
|
||||
}
|
||||
|
||||
public String getFallbackServer() {
|
||||
return this.fallbackServer;
|
||||
}
|
||||
|
||||
public boolean isForceDefault() {
|
||||
return this.forceDefault;
|
||||
}
|
||||
|
||||
public Map<String, String> getForcedHosts() {
|
||||
return this.forcedHosts;
|
||||
}
|
||||
|
||||
public TexturePackInfo getTexturePack() {
|
||||
return this.texturePack;
|
||||
}
|
||||
|
||||
public Class<? extends TabListHandler> getTabList() {
|
||||
return this.tabList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ListenerInfo)) {
|
||||
return false;
|
||||
}
|
||||
final ListenerInfo other = (ListenerInfo) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$host = this.getHost();
|
||||
final Object other$host = other.getHost();
|
||||
Label_0065: {
|
||||
if (this$host == null) {
|
||||
if (other$host == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$host.equals(other$host)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$motd = this.getMotd();
|
||||
final Object other$motd = other.getMotd();
|
||||
Label_0102: {
|
||||
if (this$motd == null) {
|
||||
if (other$motd == null) {
|
||||
break Label_0102;
|
||||
}
|
||||
} else if (this$motd.equals(other$motd)) {
|
||||
break Label_0102;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (this.getMaxPlayers() != other.getMaxPlayers()) {
|
||||
return false;
|
||||
}
|
||||
if (this.getTabListSize() != other.getTabListSize()) {
|
||||
return false;
|
||||
}
|
||||
if (this.isWebsocket() != other.isWebsocket()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$defaultServer = this.getDefaultServer();
|
||||
final Object other$defaultServer = other.getDefaultServer();
|
||||
Label_0165: {
|
||||
if (this$defaultServer == null) {
|
||||
if (other$defaultServer == null) {
|
||||
break Label_0165;
|
||||
}
|
||||
} else if (this$defaultServer.equals(other$defaultServer)) {
|
||||
break Label_0165;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$fallbackServer = this.getFallbackServer();
|
||||
final Object other$fallbackServer = other.getFallbackServer();
|
||||
Label_0202: {
|
||||
if (this$fallbackServer == null) {
|
||||
if (other$fallbackServer == null) {
|
||||
break Label_0202;
|
||||
}
|
||||
} else if (this$fallbackServer.equals(other$fallbackServer)) {
|
||||
break Label_0202;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (this.isForceDefault() != other.isForceDefault()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$forcedHosts = this.getForcedHosts();
|
||||
final Object other$forcedHosts = other.getForcedHosts();
|
||||
Label_0252: {
|
||||
if (this$forcedHosts == null) {
|
||||
if (other$forcedHosts == null) {
|
||||
break Label_0252;
|
||||
}
|
||||
} else if (this$forcedHosts.equals(other$forcedHosts)) {
|
||||
break Label_0252;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$texturePack = this.getTexturePack();
|
||||
final Object other$texturePack = other.getTexturePack();
|
||||
Label_0289: {
|
||||
if (this$texturePack == null) {
|
||||
if (other$texturePack == null) {
|
||||
break Label_0289;
|
||||
}
|
||||
} else if (this$texturePack.equals(other$texturePack)) {
|
||||
break Label_0289;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$tabList = this.getTabList();
|
||||
final Object other$tabList = other.getTabList();
|
||||
if (this$tabList == null) {
|
||||
if (other$tabList == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$tabList.equals(other$tabList)) {
|
||||
return true;
|
||||
}
|
||||
final Object this$getServerIcon = this.getServerIcon();
|
||||
final Object other$getServerIcon = other.getServerIcon();
|
||||
if (this$getServerIcon == null) {
|
||||
if (other$getServerIcon == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$getServerIcon.equals(other$getServerIcon)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ListenerInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $host = this.getHost();
|
||||
result = result * 31 + (($host == null) ? 0 : $host.hashCode());
|
||||
final Object $motd = this.getMotd();
|
||||
result = result * 31 + (($motd == null) ? 0 : $motd.hashCode());
|
||||
result = result * 31 + this.getMaxPlayers();
|
||||
result = result * 31 + this.getTabListSize();
|
||||
final Object $defaultServer = this.getDefaultServer();
|
||||
result = result * 31 + (($defaultServer == null) ? 0 : $defaultServer.hashCode());
|
||||
final Object $fallbackServer = this.getFallbackServer();
|
||||
result = result * 31 + (($fallbackServer == null) ? 0 : $fallbackServer.hashCode());
|
||||
result = result * 31 + (this.isForceDefault() ? 1231 : 1237);
|
||||
final Object $forcedHosts = this.getForcedHosts();
|
||||
result = result * 31 + (($forcedHosts == null) ? 0 : $forcedHosts.hashCode());
|
||||
final Object $texturePack = this.getTexturePack();
|
||||
result = result * 31 + (($texturePack == null) ? 0 : $texturePack.hashCode());
|
||||
final Object $tabList = this.getTabList();
|
||||
result = result * 31 + (($tabList == null) ? 0 : $tabList.hashCode());
|
||||
final Object $serverIconCache = this.getTabList();
|
||||
result = result * 31 + (($serverIconCache == null) ? 0 : $serverIconCache.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ListenerInfo(host=" + this.getHost() + ", motd=" + this.getMotd() + ", maxPlayers=" + this.getMaxPlayers() + ", tabListSize=" + this.getTabListSize() + ", defaultServer=" + this.getDefaultServer() + ", fallbackServer="
|
||||
+ this.getFallbackServer() + ", forceDefault=" + this.isForceDefault() + ", websocket=" + this.isWebsocket() + ", forcedHosts=" + this.getForcedHosts() + ", texturePack=" + this.getTexturePack() + ", tabList=" + this.getTabList() + ")";
|
||||
}
|
||||
|
||||
public boolean isWebsocket() {
|
||||
return websocket;
|
||||
}
|
||||
|
||||
public boolean hasForwardedHeaders() {
|
||||
return forwardIp;
|
||||
}
|
||||
|
||||
public String getForwardedIPHeader() {
|
||||
return forwardIpHeader;
|
||||
}
|
||||
|
||||
public String getServerIcon() {
|
||||
return serverIcon;
|
||||
}
|
||||
|
||||
public int[] getServerIconCache() {
|
||||
if(!serverIconLoaded) {
|
||||
if(serverIcon != null) {
|
||||
int[] img = ServerIcon.createServerIcon(new File(serverIcon));
|
||||
if(img != null) {
|
||||
System.arraycopy(img, 0, serverIconCache, 0, img.length);
|
||||
serverIconSet = true;
|
||||
}else {
|
||||
serverIconSet = false;
|
||||
}
|
||||
}else {
|
||||
serverIconSet = false;
|
||||
}
|
||||
serverIconLoaded = true;
|
||||
}
|
||||
return serverIconCache;
|
||||
}
|
||||
|
||||
public boolean isIconSet() {
|
||||
getServerIconCache();
|
||||
return serverIconSet;
|
||||
}
|
||||
|
||||
public boolean isForwardIp() {
|
||||
return forwardIp;
|
||||
}
|
||||
|
||||
public boolean isServerIconLoaded() {
|
||||
return serverIconLoaded;
|
||||
}
|
||||
|
||||
public boolean isServerIconSet() {
|
||||
return serverIconSet;
|
||||
}
|
||||
|
||||
public boolean isAllowMOTD() {
|
||||
return allowMOTD;
|
||||
}
|
||||
|
||||
public boolean isAllowQuery() {
|
||||
return allowQuery;
|
||||
}
|
||||
|
||||
public MOTDCacheConfiguration getCacheConfig() {
|
||||
return cacheConfig;
|
||||
}
|
||||
|
||||
public WebSocketRateLimiter getRateLimitIP() {
|
||||
return rateLimitIP;
|
||||
}
|
||||
|
||||
public WebSocketRateLimiter getRateLimitLogin() {
|
||||
return rateLimitLogin;
|
||||
}
|
||||
|
||||
public WebSocketRateLimiter getRateLimitMOTD() {
|
||||
return rateLimitMOTD;
|
||||
}
|
||||
|
||||
public WebSocketRateLimiter getRateLimitQuery() {
|
||||
return rateLimitQuery;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
public class MOTDCacheConfiguration {
|
||||
|
||||
public final int cacheTTL;
|
||||
public final boolean cacheServerListAnimation;
|
||||
public final boolean cacheServerListResults;
|
||||
public final boolean cacheServerListTrending;
|
||||
public final boolean cacheServerListPortfolios;
|
||||
|
||||
public MOTDCacheConfiguration(int cacheTTL, boolean cacheServerListAnimation, boolean cacheServerListResults,
|
||||
boolean cacheServerListTrending, boolean cacheServerListPortfolios) {
|
||||
this.cacheTTL = cacheTTL;
|
||||
this.cacheServerListAnimation = cacheServerListAnimation;
|
||||
this.cacheServerListResults = cacheServerListResults;
|
||||
this.cacheServerListTrending = cacheServerListTrending;
|
||||
this.cacheServerListPortfolios = cacheServerListPortfolios;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public interface ServerInfo {
|
||||
String getName();
|
||||
|
||||
InetSocketAddress getAddress();
|
||||
|
||||
String getRedirect();
|
||||
|
||||
Collection<ProxiedPlayer> getPlayers();
|
||||
|
||||
boolean canAccess(final CommandSender p0);
|
||||
|
||||
void sendData(final String p0, final byte[] p1);
|
||||
|
||||
void ping(final Callback<ServerPing> p0);
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.config;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
public class TexturePackInfo {
|
||||
private final String url;
|
||||
private final int size;
|
||||
|
||||
@ConstructorProperties({ "url", "size" })
|
||||
public TexturePackInfo(final String url, final int size) {
|
||||
this.url = url;
|
||||
this.size = size;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return this.url;
|
||||
}
|
||||
|
||||
public int getSize() {
|
||||
return this.size;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof TexturePackInfo)) {
|
||||
return false;
|
||||
}
|
||||
final TexturePackInfo other = (TexturePackInfo) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$url = this.getUrl();
|
||||
final Object other$url = other.getUrl();
|
||||
if (this$url == null) {
|
||||
if (other$url == null) {
|
||||
return this.getSize() == other.getSize();
|
||||
}
|
||||
} else if (this$url.equals(other$url)) {
|
||||
return this.getSize() == other.getSize();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof TexturePackInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $url = this.getUrl();
|
||||
result = result * 31 + (($url == null) ? 0 : $url.hashCode());
|
||||
result = result * 31 + this.getSize();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TexturePackInfo(url=" + this.getUrl() + ", size=" + this.getSize() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.connection;
|
||||
|
||||
public interface ConnectedPlayer extends ProxiedPlayer {
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.connection;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import net.md_5.bungee.protocol.packet.DefinedPacket;
|
||||
|
||||
public interface Connection {
|
||||
InetSocketAddress getAddress();
|
||||
|
||||
void disconnect(final String p0);
|
||||
|
||||
Unsafe unsafe();
|
||||
|
||||
public interface Unsafe {
|
||||
void sendPacket(final DefinedPacket p0);
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.connection;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import net.md_5.bungee.api.config.ListenerInfo;
|
||||
|
||||
public interface PendingConnection extends Connection {
|
||||
String getName();
|
||||
|
||||
byte getVersion();
|
||||
|
||||
InetSocketAddress getVirtualHost();
|
||||
|
||||
ListenerInfo getListener();
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.connection;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.config.TexturePackInfo;
|
||||
import net.md_5.bungee.api.tab.TabListHandler;
|
||||
|
||||
public interface ProxiedPlayer extends Connection, CommandSender {
|
||||
String getDisplayName();
|
||||
|
||||
void setDisplayName(final String p0);
|
||||
|
||||
void connect(final ServerInfo p0);
|
||||
|
||||
Server getServer();
|
||||
|
||||
int getPing();
|
||||
|
||||
void sendData(final String p0, final byte[] p1);
|
||||
|
||||
PendingConnection getPendingConnection();
|
||||
|
||||
void chat(final String p0);
|
||||
|
||||
void setTexturePack(final TexturePackInfo p0);
|
||||
|
||||
void setTabList(final TabListHandler p0);
|
||||
|
||||
TabListHandler getTabList();
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.connection;
|
||||
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
|
||||
public interface Server extends Connection {
|
||||
ServerInfo getInfo();
|
||||
|
||||
void sendData(final String p0, final byte[] p1);
|
||||
}
|
@ -0,0 +1,160 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public class AsyncEvent<T> extends Event {
|
||||
private final Callback<T> done;
|
||||
private final Set<Plugin> intents;
|
||||
private final AtomicBoolean fired;
|
||||
private final AtomicInteger latch;
|
||||
|
||||
@Override
|
||||
public void postCall() {
|
||||
this.fired.set(true);
|
||||
if (this.latch.get() == 0) {
|
||||
this.done.done((T) this, null);
|
||||
}
|
||||
}
|
||||
|
||||
public void registerIntent(final Plugin plugin) {
|
||||
Preconditions.checkState(!this.fired.get(), "Event %s has already been fired", new Object[] { this });
|
||||
Preconditions.checkState(!this.intents.contains(plugin), "Plugin %s already registered intent for event %s", new Object[] { plugin, this });
|
||||
this.intents.add(plugin);
|
||||
this.latch.incrementAndGet();
|
||||
}
|
||||
|
||||
public void completeIntent(final Plugin plugin) {
|
||||
Preconditions.checkState(this.intents.contains(plugin), "Plugin %s has not registered intent for event %s", new Object[] { plugin, this });
|
||||
this.intents.remove(plugin);
|
||||
if (this.latch.decrementAndGet() == 0 && this.fired.get()) {
|
||||
this.done.done((T) this, null);
|
||||
}
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "done" })
|
||||
public AsyncEvent(final Callback<T> done) {
|
||||
this.intents = Collections.newSetFromMap(new ConcurrentHashMap<Plugin, Boolean>());
|
||||
this.fired = new AtomicBoolean();
|
||||
this.latch = new AtomicInteger();
|
||||
this.done = done;
|
||||
}
|
||||
|
||||
public Callback<T> getDone() {
|
||||
return this.done;
|
||||
}
|
||||
|
||||
public Set<Plugin> getIntents() {
|
||||
return this.intents;
|
||||
}
|
||||
|
||||
public AtomicBoolean getFired() {
|
||||
return this.fired;
|
||||
}
|
||||
|
||||
public AtomicInteger getLatch() {
|
||||
return this.latch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AsyncEvent(super=" + super.toString() + ", done=" + this.getDone() + ", intents=" + this.getIntents() + ", fired=" + this.getFired() + ", latch=" + this.getLatch() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof AsyncEvent)) {
|
||||
return false;
|
||||
}
|
||||
final AsyncEvent<?> other = (AsyncEvent<?>) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$done = this.getDone();
|
||||
final Object other$done = other.getDone();
|
||||
Label_0075: {
|
||||
if (this$done == null) {
|
||||
if (other$done == null) {
|
||||
break Label_0075;
|
||||
}
|
||||
} else if (this$done.equals(other$done)) {
|
||||
break Label_0075;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$intents = this.getIntents();
|
||||
final Object other$intents = other.getIntents();
|
||||
Label_0112: {
|
||||
if (this$intents == null) {
|
||||
if (other$intents == null) {
|
||||
break Label_0112;
|
||||
}
|
||||
} else if (this$intents.equals(other$intents)) {
|
||||
break Label_0112;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$fired = this.getFired();
|
||||
final Object other$fired = other.getFired();
|
||||
Label_0149: {
|
||||
if (this$fired == null) {
|
||||
if (other$fired == null) {
|
||||
break Label_0149;
|
||||
}
|
||||
} else if (this$fired.equals(other$fired)) {
|
||||
break Label_0149;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$latch = this.getLatch();
|
||||
final Object other$latch = other.getLatch();
|
||||
if (this$latch == null) {
|
||||
if (other$latch == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$latch.equals(other$latch)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof AsyncEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
result = result * 31 + super.hashCode();
|
||||
final Object $done = this.getDone();
|
||||
result = result * 31 + (($done == null) ? 0 : $done.hashCode());
|
||||
final Object $intents = this.getIntents();
|
||||
result = result * 31 + (($intents == null) ? 0 : $intents.hashCode());
|
||||
final Object $fired = this.getFired();
|
||||
result = result * 31 + (($fired == null) ? 0 : $fired.hashCode());
|
||||
final Object $latch = this.getLatch();
|
||||
result = result * 31 + (($latch == null) ? 0 : $latch.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,91 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import net.md_5.bungee.api.connection.Connection;
|
||||
import net.md_5.bungee.api.plugin.Cancellable;
|
||||
|
||||
public class ChatEvent extends TargetedEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private String message;
|
||||
|
||||
public ChatEvent(final Connection sender, final Connection receiver, final String message) {
|
||||
super(sender, receiver);
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public boolean isCommand() {
|
||||
return this.message.length() > 0 && this.message.charAt(0) == '/';
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return this.message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public void setMessage(final String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ChatEvent(super=" + super.toString() + ", cancelled=" + this.isCancelled() + ", message=" + this.getMessage() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ChatEvent)) {
|
||||
return false;
|
||||
}
|
||||
final ChatEvent other = (ChatEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
if (this.isCancelled() != other.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$message = this.getMessage();
|
||||
final Object other$message = other.getMessage();
|
||||
if (this$message == null) {
|
||||
if (other$message == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$message.equals(other$message)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ChatEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
result = result * 31 + super.hashCode();
|
||||
result = result * 31 + (this.isCancelled() ? 1231 : 1237);
|
||||
final Object $message = this.getMessage();
|
||||
result = result * 31 + (($message == null) ? 0 : $message.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,103 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import net.md_5.bungee.api.Callback;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
import net.md_5.bungee.api.plugin.Cancellable;
|
||||
|
||||
public class LoginEvent extends AsyncEvent<LoginEvent> implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private String cancelReason;
|
||||
private final PendingConnection connection;
|
||||
|
||||
public LoginEvent(final PendingConnection connection, final Callback<LoginEvent> done) {
|
||||
super(done);
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public String getCancelReason() {
|
||||
return this.cancelReason;
|
||||
}
|
||||
|
||||
public PendingConnection getConnection() {
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public void setCancelReason(final String cancelReason) {
|
||||
this.cancelReason = cancelReason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LoginEvent(cancelled=" + this.isCancelled() + ", cancelReason=" + this.getCancelReason() + ", connection=" + this.getConnection() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof LoginEvent)) {
|
||||
return false;
|
||||
}
|
||||
final LoginEvent other = (LoginEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (this.isCancelled() != other.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$cancelReason = this.getCancelReason();
|
||||
final Object other$cancelReason = other.getCancelReason();
|
||||
Label_0078: {
|
||||
if (this$cancelReason == null) {
|
||||
if (other$cancelReason == null) {
|
||||
break Label_0078;
|
||||
}
|
||||
} else if (this$cancelReason.equals(other$cancelReason)) {
|
||||
break Label_0078;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$connection = this.getConnection();
|
||||
final Object other$connection = other.getConnection();
|
||||
if (this$connection == null) {
|
||||
if (other$connection == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$connection.equals(other$connection)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof LoginEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
result = result * 31 + (this.isCancelled() ? 1231 : 1237);
|
||||
final Object $cancelReason = this.getCancelReason();
|
||||
result = result * 31 + (($cancelReason == null) ? 0 : $cancelReason.hashCode());
|
||||
final Object $connection = this.getConnection();
|
||||
result = result * 31 + (($connection == null) ? 0 : $connection.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,96 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class PermissionCheckEvent extends Event {
|
||||
private final CommandSender sender;
|
||||
private final String permission;
|
||||
private boolean hasPermission;
|
||||
|
||||
public boolean hasPermission() {
|
||||
return this.hasPermission;
|
||||
}
|
||||
|
||||
public CommandSender getSender() {
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
public String getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
public void setHasPermission(final boolean hasPermission) {
|
||||
this.hasPermission = hasPermission;
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "sender", "permission", "hasPermission" })
|
||||
public PermissionCheckEvent(final CommandSender sender, final String permission, final boolean hasPermission) {
|
||||
this.sender = sender;
|
||||
this.permission = permission;
|
||||
this.hasPermission = hasPermission;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PermissionCheckEvent(sender=" + this.getSender() + ", permission=" + this.getPermission() + ", hasPermission=" + this.hasPermission + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof PermissionCheckEvent)) {
|
||||
return false;
|
||||
}
|
||||
final PermissionCheckEvent other = (PermissionCheckEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$sender = this.getSender();
|
||||
final Object other$sender = other.getSender();
|
||||
Label_0065: {
|
||||
if (this$sender == null) {
|
||||
if (other$sender == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$sender.equals(other$sender)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$permission = this.getPermission();
|
||||
final Object other$permission = other.getPermission();
|
||||
if (this$permission == null) {
|
||||
if (other$permission == null) {
|
||||
return this.hasPermission == other.hasPermission;
|
||||
}
|
||||
} else if (this$permission.equals(other$permission)) {
|
||||
return this.hasPermission == other.hasPermission;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof PermissionCheckEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $sender = this.getSender();
|
||||
result = result * 31 + (($sender == null) ? 0 : $sender.hashCode());
|
||||
final Object $permission = this.getPermission();
|
||||
result = result * 31 + (($permission == null) ? 0 : $permission.hashCode());
|
||||
result = result * 31 + (this.hasPermission ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class PlayerDisconnectEvent extends Event {
|
||||
private final ProxiedPlayer player;
|
||||
|
||||
@ConstructorProperties({ "player" })
|
||||
public PlayerDisconnectEvent(final ProxiedPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PlayerDisconnectEvent(player=" + this.getPlayer() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof PlayerDisconnectEvent)) {
|
||||
return false;
|
||||
}
|
||||
final PlayerDisconnectEvent other = (PlayerDisconnectEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$player = this.getPlayer();
|
||||
final Object other$player = other.getPlayer();
|
||||
if (this$player == null) {
|
||||
if (other$player == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$player.equals(other$player)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof PlayerDisconnectEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $player = this.getPlayer();
|
||||
result = result * 31 + (($player == null) ? 0 : $player.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import net.md_5.bungee.api.connection.Connection;
|
||||
import net.md_5.bungee.api.plugin.Cancellable;
|
||||
|
||||
public class PluginMessageEvent extends TargetedEvent implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final String tag;
|
||||
private final byte[] data;
|
||||
|
||||
public PluginMessageEvent(final Connection sender, final Connection receiver, final String tag, final byte[] data) {
|
||||
super(sender, receiver);
|
||||
this.tag = tag;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public String getTag() {
|
||||
return this.tag;
|
||||
}
|
||||
|
||||
public byte[] getData() {
|
||||
return this.data;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PluginMessageEvent(super=" + super.toString() + ", cancelled=" + this.isCancelled() + ", tag=" + this.getTag() + ", data=" + Arrays.toString(this.getData()) + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof PluginMessageEvent)) {
|
||||
return false;
|
||||
}
|
||||
final PluginMessageEvent other = (PluginMessageEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(o)) {
|
||||
return false;
|
||||
}
|
||||
if (this.isCancelled() != other.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$tag = this.getTag();
|
||||
final Object other$tag = other.getTag();
|
||||
if (this$tag == null) {
|
||||
if (other$tag == null) {
|
||||
return Arrays.equals(this.getData(), other.getData());
|
||||
}
|
||||
} else if (this$tag.equals(other$tag)) {
|
||||
return Arrays.equals(this.getData(), other.getData());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof PluginMessageEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
result = result * 31 + super.hashCode();
|
||||
result = result * 31 + (this.isCancelled() ? 1231 : 1237);
|
||||
final Object $tag = this.getTag();
|
||||
result = result * 31 + (($tag == null) ? 0 : $tag.hashCode());
|
||||
result = result * 31 + Arrays.hashCode(this.getData());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class PostLoginEvent extends Event {
|
||||
private final ProxiedPlayer player;
|
||||
|
||||
@ConstructorProperties({ "player" })
|
||||
public PostLoginEvent(final ProxiedPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PostLoginEvent(player=" + this.getPlayer() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof PostLoginEvent)) {
|
||||
return false;
|
||||
}
|
||||
final PostLoginEvent other = (PostLoginEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$player = this.getPlayer();
|
||||
final Object other$player = other.getPlayer();
|
||||
if (this$player == null) {
|
||||
if (other$player == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$player.equals(other$player)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof PostLoginEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $player = this.getPlayer();
|
||||
result = result * 31 + (($player == null) ? 0 : $player.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.ServerPing;
|
||||
import net.md_5.bungee.api.connection.PendingConnection;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class ProxyPingEvent extends Event {
|
||||
private final PendingConnection connection;
|
||||
private ServerPing response;
|
||||
|
||||
public PendingConnection getConnection() {
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
public ServerPing getResponse() {
|
||||
return this.response;
|
||||
}
|
||||
|
||||
public void setResponse(final ServerPing response) {
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "connection", "response" })
|
||||
public ProxyPingEvent(final PendingConnection connection, final ServerPing response) {
|
||||
this.connection = connection;
|
||||
this.response = response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ProxyPingEvent(connection=" + this.getConnection() + ", response=" + this.getResponse() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ProxyPingEvent)) {
|
||||
return false;
|
||||
}
|
||||
final ProxyPingEvent other = (ProxyPingEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$connection = this.getConnection();
|
||||
final Object other$connection = other.getConnection();
|
||||
Label_0065: {
|
||||
if (this$connection == null) {
|
||||
if (other$connection == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$connection.equals(other$connection)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$response = this.getResponse();
|
||||
final Object other$response = other.getResponse();
|
||||
if (this$response == null) {
|
||||
if (other$response == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$response.equals(other$response)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ProxyPingEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $connection = this.getConnection();
|
||||
result = result * 31 + (($connection == null) ? 0 : $connection.hashCode());
|
||||
final Object $response = this.getResponse();
|
||||
result = result * 31 + (($response == null) ? 0 : $response.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,100 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Cancellable;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class ServerConnectEvent extends Event implements Cancellable {
|
||||
private final ProxiedPlayer player;
|
||||
private ServerInfo target;
|
||||
private boolean cancelled;
|
||||
|
||||
public ServerConnectEvent(final ProxiedPlayer player, final ServerInfo target) {
|
||||
this.player = player;
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public ServerInfo getTarget() {
|
||||
return this.target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public void setTarget(final ServerInfo target) {
|
||||
this.target = target;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerConnectEvent(player=" + this.getPlayer() + ", target=" + this.getTarget() + ", cancelled=" + this.isCancelled() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ServerConnectEvent)) {
|
||||
return false;
|
||||
}
|
||||
final ServerConnectEvent other = (ServerConnectEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$player = this.getPlayer();
|
||||
final Object other$player = other.getPlayer();
|
||||
Label_0065: {
|
||||
if (this$player == null) {
|
||||
if (other$player == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$player.equals(other$player)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$target = this.getTarget();
|
||||
final Object other$target = other.getTarget();
|
||||
if (this$target == null) {
|
||||
if (other$target == null) {
|
||||
return this.isCancelled() == other.isCancelled();
|
||||
}
|
||||
} else if (this$target.equals(other$target)) {
|
||||
return this.isCancelled() == other.isCancelled();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ServerConnectEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $player = this.getPlayer();
|
||||
result = result * 31 + (($player == null) ? 0 : $player.hashCode());
|
||||
final Object $target = this.getTarget();
|
||||
result = result * 31 + (($target == null) ? 0 : $target.hashCode());
|
||||
result = result * 31 + (this.isCancelled() ? 1231 : 1237);
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.connection.Server;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class ServerConnectedEvent extends Event {
|
||||
private final ProxiedPlayer player;
|
||||
private final Server server;
|
||||
|
||||
@ConstructorProperties({ "player", "server" })
|
||||
public ServerConnectedEvent(final ProxiedPlayer player, final Server server) {
|
||||
this.player = player;
|
||||
this.server = server;
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public Server getServer() {
|
||||
return this.server;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerConnectedEvent(player=" + this.getPlayer() + ", server=" + this.getServer() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ServerConnectedEvent)) {
|
||||
return false;
|
||||
}
|
||||
final ServerConnectedEvent other = (ServerConnectedEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$player = this.getPlayer();
|
||||
final Object other$player = other.getPlayer();
|
||||
Label_0065: {
|
||||
if (this$player == null) {
|
||||
if (other$player == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$player.equals(other$player)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$server = this.getServer();
|
||||
final Object other$server = other.getServer();
|
||||
if (this$server == null) {
|
||||
if (other$server == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$server.equals(other$server)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ServerConnectedEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $player = this.getPlayer();
|
||||
result = result * 31 + (($player == null) ? 0 : $player.hashCode());
|
||||
final Object $server = this.getServer();
|
||||
result = result * 31 + (($server == null) ? 0 : $server.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,127 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import net.md_5.bungee.api.config.ServerInfo;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Cancellable;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class ServerKickEvent extends Event implements Cancellable {
|
||||
private boolean cancelled;
|
||||
private final ProxiedPlayer player;
|
||||
private String kickReason;
|
||||
private ServerInfo cancelServer;
|
||||
|
||||
public ServerKickEvent(final ProxiedPlayer player, final String kickReason, final ServerInfo cancelServer) {
|
||||
this.player = player;
|
||||
this.kickReason = kickReason;
|
||||
this.cancelServer = cancelServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled() {
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
public String getKickReason() {
|
||||
return this.kickReason;
|
||||
}
|
||||
|
||||
public ServerInfo getCancelServer() {
|
||||
return this.cancelServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(final boolean cancelled) {
|
||||
this.cancelled = cancelled;
|
||||
}
|
||||
|
||||
public void setKickReason(final String kickReason) {
|
||||
this.kickReason = kickReason;
|
||||
}
|
||||
|
||||
public void setCancelServer(final ServerInfo cancelServer) {
|
||||
this.cancelServer = cancelServer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerKickEvent(cancelled=" + this.isCancelled() + ", player=" + this.getPlayer() + ", kickReason=" + this.getKickReason() + ", cancelServer=" + this.getCancelServer() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ServerKickEvent)) {
|
||||
return false;
|
||||
}
|
||||
final ServerKickEvent other = (ServerKickEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
if (this.isCancelled() != other.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$player = this.getPlayer();
|
||||
final Object other$player = other.getPlayer();
|
||||
Label_0078: {
|
||||
if (this$player == null) {
|
||||
if (other$player == null) {
|
||||
break Label_0078;
|
||||
}
|
||||
} else if (this$player.equals(other$player)) {
|
||||
break Label_0078;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$kickReason = this.getKickReason();
|
||||
final Object other$kickReason = other.getKickReason();
|
||||
Label_0115: {
|
||||
if (this$kickReason == null) {
|
||||
if (other$kickReason == null) {
|
||||
break Label_0115;
|
||||
}
|
||||
} else if (this$kickReason.equals(other$kickReason)) {
|
||||
break Label_0115;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$cancelServer = this.getCancelServer();
|
||||
final Object other$cancelServer = other.getCancelServer();
|
||||
if (this$cancelServer == null) {
|
||||
if (other$cancelServer == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$cancelServer.equals(other$cancelServer)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ServerKickEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
result = result * 31 + (this.isCancelled() ? 1231 : 1237);
|
||||
final Object $player = this.getPlayer();
|
||||
result = result * 31 + (($player == null) ? 0 : $player.hashCode());
|
||||
final Object $kickReason = this.getKickReason();
|
||||
result = result * 31 + (($kickReason == null) ? 0 : $kickReason.hashCode());
|
||||
final Object $cancelServer = this.getCancelServer();
|
||||
result = result * 31 + (($cancelServer == null) ? 0 : $cancelServer.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class ServerSwitchEvent extends Event {
|
||||
private final ProxiedPlayer player;
|
||||
|
||||
@ConstructorProperties({ "player" })
|
||||
public ServerSwitchEvent(final ProxiedPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ServerSwitchEvent(player=" + this.getPlayer() + ")";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof ServerSwitchEvent)) {
|
||||
return false;
|
||||
}
|
||||
final ServerSwitchEvent other = (ServerSwitchEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$player = this.getPlayer();
|
||||
final Object other$player = other.getPlayer();
|
||||
if (this$player == null) {
|
||||
if (other$player == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$player.equals(other$player)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof ServerSwitchEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $player = this.getPlayer();
|
||||
result = result * 31 + (($player == null) ? 0 : $player.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
import net.md_5.bungee.api.connection.Connection;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public abstract class TargetedEvent extends Event {
|
||||
private final Connection sender;
|
||||
private final Connection receiver;
|
||||
|
||||
public Connection getSender() {
|
||||
return this.sender;
|
||||
}
|
||||
|
||||
public Connection getReceiver() {
|
||||
return this.receiver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TargetedEvent(sender=" + this.getSender() + ", receiver=" + this.getReceiver() + ")";
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "sender", "receiver" })
|
||||
public TargetedEvent(final Connection sender, final Connection receiver) {
|
||||
this.sender = sender;
|
||||
this.receiver = receiver;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof TargetedEvent)) {
|
||||
return false;
|
||||
}
|
||||
final TargetedEvent other = (TargetedEvent) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$sender = this.getSender();
|
||||
final Object other$sender = other.getSender();
|
||||
Label_0065: {
|
||||
if (this$sender == null) {
|
||||
if (other$sender == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$sender.equals(other$sender)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$receiver = this.getReceiver();
|
||||
final Object other$receiver = other.getReceiver();
|
||||
if (this$receiver == null) {
|
||||
if (other$receiver == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$receiver.equals(other$receiver)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof TargetedEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $sender = this.getSender();
|
||||
result = result * 31 + (($sender == null) ? 0 : $sender.hashCode());
|
||||
final Object $receiver = this.getReceiver();
|
||||
result = result * 31 + (($receiver == null) ? 0 : $receiver.hashCode());
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import net.md_5.bungee.api.MOTD;
|
||||
|
||||
public class WebsocketMOTDEvent extends WebsocketQueryEvent {
|
||||
|
||||
public WebsocketMOTDEvent(MOTD connection) {
|
||||
super(connection);
|
||||
}
|
||||
|
||||
public MOTD getMOTD() {
|
||||
return (MOTD)connection;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package net.md_5.bungee.api.event;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import net.md_5.bungee.api.QueryConnection;
|
||||
import net.md_5.bungee.api.config.ListenerInfo;
|
||||
import net.md_5.bungee.api.plugin.Event;
|
||||
|
||||
public class WebsocketQueryEvent extends Event {
|
||||
|
||||
protected final QueryConnection connection;
|
||||
|
||||
public WebsocketQueryEvent(QueryConnection connection) {
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
public InetAddress getRemoteAddress() {
|
||||
return connection.getRemoteAddress();
|
||||
}
|
||||
|
||||
public ListenerInfo getListener() {
|
||||
return connection.getListener();
|
||||
}
|
||||
|
||||
public String getAccept() {
|
||||
return connection.getAccept();
|
||||
}
|
||||
|
||||
public QueryConnection getQuery() {
|
||||
return connection;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,11 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
public interface Cancellable {
|
||||
boolean isCancelled();
|
||||
|
||||
void setCancelled(final boolean p0);
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
|
||||
public abstract class Command {
|
||||
private final String name;
|
||||
private final String permission;
|
||||
private final String[] aliases;
|
||||
|
||||
public Command(final String name) {
|
||||
this(name, null, new String[0]);
|
||||
}
|
||||
|
||||
public Command(final String name, final String permission, final String... aliases) {
|
||||
Preconditions.checkArgument(name != null, (Object) "name");
|
||||
this.name = name;
|
||||
this.permission = permission;
|
||||
this.aliases = aliases;
|
||||
}
|
||||
|
||||
public abstract void execute(final CommandSender p0, final String[] p1);
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getPermission() {
|
||||
return this.permission;
|
||||
}
|
||||
|
||||
public String[] getAliases() {
|
||||
return this.aliases;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Command)) {
|
||||
return false;
|
||||
}
|
||||
final Command other = (Command) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$name = this.getName();
|
||||
final Object other$name = other.getName();
|
||||
Label_0065: {
|
||||
if (this$name == null) {
|
||||
if (other$name == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$name.equals(other$name)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$permission = this.getPermission();
|
||||
final Object other$permission = other.getPermission();
|
||||
if (this$permission == null) {
|
||||
if (other$permission == null) {
|
||||
return Arrays.deepEquals(this.getAliases(), other.getAliases());
|
||||
}
|
||||
} else if (this$permission.equals(other$permission)) {
|
||||
return Arrays.deepEquals(this.getAliases(), other.getAliases());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof Command;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $name = this.getName();
|
||||
result = result * 31 + (($name == null) ? 0 : $name.hashCode());
|
||||
final Object $permission = this.getPermission();
|
||||
result = result * 31 + (($permission == null) ? 0 : $permission.hashCode());
|
||||
result = result * 31 + Arrays.deepHashCode(this.getAliases());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Command(name=" + this.getName() + ", permission=" + this.getPermission() + ", aliases=" + Arrays.deepToString(this.getAliases()) + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
public abstract class Event {
|
||||
public void postCall() {
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
public interface Listener {
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
|
||||
public class Plugin {
|
||||
private PluginDescription description;
|
||||
private ProxyServer proxy;
|
||||
private File file;
|
||||
private Logger logger;
|
||||
|
||||
protected Plugin() {
|
||||
}
|
||||
|
||||
protected Plugin(PluginDescription forceDesc) {
|
||||
this.description = forceDesc;
|
||||
}
|
||||
|
||||
public void onLoad() {
|
||||
}
|
||||
|
||||
public void onEnable() {
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
}
|
||||
|
||||
public final File getDataFolder() {
|
||||
return new File(this.getProxy().getPluginsFolder(), this.getDescription().getName());
|
||||
}
|
||||
|
||||
public final InputStream getResourceAsStream(final String name) {
|
||||
return this.getClass().getClassLoader().getResourceAsStream(name);
|
||||
}
|
||||
|
||||
final void init(final ProxyServer proxy, final PluginDescription description) {
|
||||
this.proxy = proxy;
|
||||
this.description = (this.description == null ? description : this.description);
|
||||
this.file = description.getFile();
|
||||
this.logger = new PluginLogger(this);
|
||||
}
|
||||
|
||||
public PluginDescription getDescription() {
|
||||
return this.description;
|
||||
}
|
||||
|
||||
public ProxyServer getProxy() {
|
||||
return this.proxy;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return this.file;
|
||||
}
|
||||
|
||||
public Logger getLogger() {
|
||||
return this.logger;
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class PluginClassloader extends URLClassLoader {
|
||||
private static final Set<PluginClassloader> allLoaders;
|
||||
|
||||
public PluginClassloader(final URL[] urls) {
|
||||
super(urls);
|
||||
PluginClassloader.allLoaders.add(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Class<?> loadClass(final String name, final boolean resolve) throws ClassNotFoundException {
|
||||
return this.loadClass0(name, resolve, true);
|
||||
}
|
||||
|
||||
private Class<?> loadClass0(final String name, final boolean resolve, final boolean checkOther) throws ClassNotFoundException {
|
||||
try {
|
||||
return super.loadClass(name, resolve);
|
||||
} catch (ClassNotFoundException ex) {
|
||||
if (checkOther) {
|
||||
for (final PluginClassloader loader : PluginClassloader.allLoaders) {
|
||||
if (loader != this) {
|
||||
try {
|
||||
return loader.loadClass0(name, resolve, false);
|
||||
} catch (ClassNotFoundException ex2) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
throw new ClassNotFoundException(name);
|
||||
}
|
||||
}
|
||||
|
||||
static {
|
||||
allLoaders = new HashSet<PluginClassloader>();
|
||||
}
|
||||
}
|
@ -0,0 +1,196 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.io.File;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class PluginDescription {
|
||||
private String name;
|
||||
private String main;
|
||||
private String version;
|
||||
private String author;
|
||||
private Set<String> depends;
|
||||
private File file;
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getMain() {
|
||||
return this.main;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return this.version;
|
||||
}
|
||||
|
||||
public String getAuthor() {
|
||||
return this.author;
|
||||
}
|
||||
|
||||
public Set<String> getDepends() {
|
||||
return this.depends;
|
||||
}
|
||||
|
||||
public File getFile() {
|
||||
return this.file;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setMain(final String main) {
|
||||
this.main = main;
|
||||
}
|
||||
|
||||
public void setVersion(final String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public void setAuthor(final String author) {
|
||||
this.author = author;
|
||||
}
|
||||
|
||||
public void setDepends(final Set<String> depends) {
|
||||
this.depends = depends;
|
||||
}
|
||||
|
||||
public void setFile(final File file) {
|
||||
this.file = file;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof PluginDescription)) {
|
||||
return false;
|
||||
}
|
||||
final PluginDescription other = (PluginDescription) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$name = this.getName();
|
||||
final Object other$name = other.getName();
|
||||
Label_0065: {
|
||||
if (this$name == null) {
|
||||
if (other$name == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$name.equals(other$name)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$main = this.getMain();
|
||||
final Object other$main = other.getMain();
|
||||
Label_0102: {
|
||||
if (this$main == null) {
|
||||
if (other$main == null) {
|
||||
break Label_0102;
|
||||
}
|
||||
} else if (this$main.equals(other$main)) {
|
||||
break Label_0102;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$version = this.getVersion();
|
||||
final Object other$version = other.getVersion();
|
||||
Label_0139: {
|
||||
if (this$version == null) {
|
||||
if (other$version == null) {
|
||||
break Label_0139;
|
||||
}
|
||||
} else if (this$version.equals(other$version)) {
|
||||
break Label_0139;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$author = this.getAuthor();
|
||||
final Object other$author = other.getAuthor();
|
||||
Label_0176: {
|
||||
if (this$author == null) {
|
||||
if (other$author == null) {
|
||||
break Label_0176;
|
||||
}
|
||||
} else if (this$author.equals(other$author)) {
|
||||
break Label_0176;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$depends = this.getDepends();
|
||||
final Object other$depends = other.getDepends();
|
||||
Label_0213: {
|
||||
if (this$depends == null) {
|
||||
if (other$depends == null) {
|
||||
break Label_0213;
|
||||
}
|
||||
} else if (this$depends.equals(other$depends)) {
|
||||
break Label_0213;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$file = this.getFile();
|
||||
final Object other$file = other.getFile();
|
||||
if (this$file == null) {
|
||||
if (other$file == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$file.equals(other$file)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof PluginDescription;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $name = this.getName();
|
||||
result = result * 31 + (($name == null) ? 0 : $name.hashCode());
|
||||
final Object $main = this.getMain();
|
||||
result = result * 31 + (($main == null) ? 0 : $main.hashCode());
|
||||
final Object $version = this.getVersion();
|
||||
result = result * 31 + (($version == null) ? 0 : $version.hashCode());
|
||||
final Object $author = this.getAuthor();
|
||||
result = result * 31 + (($author == null) ? 0 : $author.hashCode());
|
||||
final Object $depends = this.getDepends();
|
||||
result = result * 31 + (($depends == null) ? 0 : $depends.hashCode());
|
||||
final Object $file = this.getFile();
|
||||
result = result * 31 + (($file == null) ? 0 : $file.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "PluginDescription(name=" + this.getName() + ", main=" + this.getMain() + ", version=" + this.getVersion() + ", author=" + this.getAuthor() + ", depends=" + this.getDepends() + ", file=" + this.getFile() + ")";
|
||||
}
|
||||
|
||||
public PluginDescription() {
|
||||
this.depends = new HashSet<String>();
|
||||
this.file = null;
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "name", "main", "version", "author", "depends", "file" })
|
||||
public PluginDescription(final String name, final String main, final String version, final String author, final Set<String> depends, final File file) {
|
||||
this.depends = new HashSet<String>();
|
||||
this.file = null;
|
||||
this.name = name;
|
||||
this.main = main;
|
||||
this.version = version;
|
||||
this.author = author;
|
||||
this.depends = depends;
|
||||
this.file = file;
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
|
||||
public class PluginLogger extends Logger {
|
||||
private String pluginName;
|
||||
|
||||
protected PluginLogger(final Plugin plugin) {
|
||||
super(plugin.getClass().getCanonicalName(), null);
|
||||
this.pluginName = "[" + plugin.getDescription().getName() + "] ";
|
||||
this.setParent(ProxyServer.getInstance().getLogger());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(final LogRecord logRecord) {
|
||||
logRecord.setMessage(this.pluginName + logRecord.getMessage());
|
||||
super.log(logRecord);
|
||||
}
|
||||
}
|
@ -0,0 +1,228 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.plugin;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.io.File;
|
||||
import java.io.InputStream;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.logging.Level;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.command.ConsoleCommandSender;
|
||||
import net.md_5.bungee.event.EventBus;
|
||||
import net.md_5.bungee.event.EventHandler;
|
||||
|
||||
public class PluginManager {
|
||||
private static final Pattern argsSplit;
|
||||
private final ProxyServer proxy;
|
||||
private final Yaml yaml;
|
||||
private final EventBus eventBus;
|
||||
private final Map<String, Plugin> plugins;
|
||||
private final Map<String, Command> commandMap;
|
||||
private Map<String, PluginDescription> toLoad;
|
||||
|
||||
public PluginManager(final ProxyServer proxy) {
|
||||
this.yaml = new Yaml();
|
||||
this.plugins = new LinkedHashMap<String, Plugin>();
|
||||
this.commandMap = new HashMap<String, Command>();
|
||||
this.toLoad = new HashMap<String, PluginDescription>();
|
||||
this.proxy = proxy;
|
||||
this.eventBus = new EventBus(proxy.getLogger(), (Class<? extends Annotation>[]) new Class[] { Subscribe.class, EventHandler.class });
|
||||
}
|
||||
|
||||
public void registerCommand(final Plugin plugin, final Command command) {
|
||||
this.commandMap.put(command.getName().toLowerCase(), command);
|
||||
for (final String alias : command.getAliases()) {
|
||||
this.commandMap.put(alias.toLowerCase(), command);
|
||||
}
|
||||
}
|
||||
|
||||
public void unregisterCommand(final Command command) {
|
||||
this.commandMap.values().remove(command);
|
||||
}
|
||||
|
||||
public boolean dispatchCommand(final CommandSender sender, final String commandLine) {
|
||||
final String[] split = PluginManager.argsSplit.split(commandLine);
|
||||
final Command command = this.commandMap.get(split[0].toLowerCase());
|
||||
if (command == null) {
|
||||
return false;
|
||||
}
|
||||
if(!(sender instanceof ConsoleCommandSender) && ((BungeeCord)proxy).config.getDisabledCommands().contains(command.getName())) {
|
||||
return false;
|
||||
}
|
||||
final String permission = command.getPermission();
|
||||
if (permission != null && !permission.isEmpty() && !sender.hasPermission(permission)) {
|
||||
sender.sendMessage(this.proxy.getTranslation("no_permission"));
|
||||
return true;
|
||||
}
|
||||
final String[] args = Arrays.copyOfRange(split, 1, split.length);
|
||||
try {
|
||||
command.execute(sender, args);
|
||||
} catch (Exception ex) {
|
||||
sender.sendMessage(ChatColor.RED + "An internal error occurred whilst executing this command, please check the console log for details.");
|
||||
ProxyServer.getInstance().getLogger().log(Level.WARNING, "Error in dispatching command", ex);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public Collection<Plugin> getPlugins() {
|
||||
return this.plugins.values();
|
||||
}
|
||||
|
||||
public Plugin getPlugin(final String name) {
|
||||
return this.plugins.get(name);
|
||||
}
|
||||
|
||||
public void loadAndEnablePlugins() {
|
||||
final Map<PluginDescription, Boolean> pluginStatuses = new HashMap<PluginDescription, Boolean>();
|
||||
for (final Map.Entry<String, PluginDescription> entry : this.toLoad.entrySet()) {
|
||||
final PluginDescription plugin = entry.getValue();
|
||||
if (!this.enablePlugin(pluginStatuses, new Stack<PluginDescription>(), plugin)) {
|
||||
ProxyServer.getInstance().getLogger().warning("Failed to enable " + entry.getKey());
|
||||
}
|
||||
}
|
||||
this.toLoad.clear();
|
||||
this.toLoad = null;
|
||||
for (final Plugin plugin2 : this.plugins.values()) {
|
||||
try {
|
||||
plugin2.onEnable();
|
||||
ProxyServer.getInstance().getLogger().log(Level.INFO, "Enabled plugin {0} version {1} by {2}",
|
||||
new Object[] { plugin2.getDescription().getName(), plugin2.getDescription().getVersion(), plugin2.getDescription().getAuthor() });
|
||||
} catch (Throwable t) {
|
||||
ProxyServer.getInstance().getLogger().log(Level.WARNING, "Exception encountered when loading plugin: " + plugin2.getDescription().getName(), t);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean enablePlugin(final Map<PluginDescription, Boolean> pluginStatuses, final Stack<PluginDescription> dependStack, final PluginDescription plugin) {
|
||||
if (pluginStatuses.containsKey(plugin)) {
|
||||
return pluginStatuses.get(plugin);
|
||||
}
|
||||
boolean status = true;
|
||||
for (final String dependName : plugin.getDepends()) {
|
||||
final PluginDescription depend = this.toLoad.get(dependName);
|
||||
Boolean dependStatus = (depend != null) ? pluginStatuses.get(depend) : Boolean.FALSE;
|
||||
if (dependStatus == null) {
|
||||
if (dependStack.contains(depend)) {
|
||||
final StringBuilder dependencyGraph = new StringBuilder();
|
||||
for (final PluginDescription element : dependStack) {
|
||||
dependencyGraph.append(element.getName()).append(" -> ");
|
||||
}
|
||||
dependencyGraph.append(plugin.getName()).append(" -> ").append(dependName);
|
||||
ProxyServer.getInstance().getLogger().log(Level.WARNING, "Circular dependency detected: " + (Object) dependencyGraph);
|
||||
status = false;
|
||||
} else {
|
||||
dependStack.push(plugin);
|
||||
dependStatus = this.enablePlugin(pluginStatuses, dependStack, depend);
|
||||
dependStack.pop();
|
||||
}
|
||||
}
|
||||
if (dependStatus == Boolean.FALSE) {
|
||||
ProxyServer.getInstance().getLogger().log(Level.WARNING, "{0} (required by {1}) is unavailable", new Object[] { depend.getName(), plugin.getName() });
|
||||
status = false;
|
||||
}
|
||||
if (!status) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (status) {
|
||||
try {
|
||||
final URLClassLoader loader = new PluginClassloader(new URL[] { plugin.getFile().toURI().toURL() });
|
||||
final Class<?> main = loader.loadClass(plugin.getMain());
|
||||
final Plugin clazz = (Plugin) main.getDeclaredConstructor((Class<?>[]) new Class[0]).newInstance(new Object[0]);
|
||||
clazz.init(this.proxy, plugin);
|
||||
this.plugins.put(plugin.getName(), clazz);
|
||||
clazz.onLoad();
|
||||
ProxyServer.getInstance().getLogger().log(Level.INFO, "Loaded plugin {0} version {1} by {2}", new Object[] { plugin.getName(), plugin.getVersion(), plugin.getAuthor() });
|
||||
} catch (Throwable t) {
|
||||
this.proxy.getLogger().log(Level.WARNING, "Error enabling plugin " + plugin.getName(), t);
|
||||
}
|
||||
}
|
||||
pluginStatuses.put(plugin, status);
|
||||
return status;
|
||||
}
|
||||
|
||||
public void addInternalPlugin(Plugin plug) {
|
||||
this.plugins.put(plug.getDescription().getName(), plug);
|
||||
plug.init(proxy, plug.getDescription());
|
||||
}
|
||||
|
||||
public void detectPlugins(final File folder) {
|
||||
Preconditions.checkNotNull((Object) folder, (Object) "folder");
|
||||
Preconditions.checkArgument(folder.isDirectory(), (Object) "Must load from a directory");
|
||||
for (final File file : folder.listFiles()) {
|
||||
if (file.isFile() && file.getName().endsWith(".jar")) {
|
||||
try (final JarFile jar = new JarFile(file)) {
|
||||
final JarEntry pdf = jar.getJarEntry("plugin.yml");
|
||||
Preconditions.checkNotNull((Object) pdf, (Object) "Plugin must have a plugin.yml");
|
||||
try (final InputStream in = jar.getInputStream(pdf)) {
|
||||
final PluginDescription desc = (PluginDescription) this.yaml.loadAs(in, (Class) PluginDescription.class);
|
||||
desc.setFile(file);
|
||||
this.toLoad.put(desc.getName(), desc);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ProxyServer.getInstance().getLogger().log(Level.WARNING, "Could not load plugin from file " + file, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public <T extends Event> T callEvent(final T event) {
|
||||
Preconditions.checkNotNull((Object) event, (Object) "event");
|
||||
final long start = System.nanoTime();
|
||||
this.eventBus.post(event);
|
||||
event.postCall();
|
||||
final long elapsed = start - System.nanoTime();
|
||||
if (elapsed > 250000L) {
|
||||
ProxyServer.getInstance().getLogger().log(Level.WARNING, "Event {0} took more {1}ns to process!", new Object[] { event, elapsed });
|
||||
}
|
||||
return event;
|
||||
}
|
||||
|
||||
public void registerListener(final Plugin plugin, final Listener listener) {
|
||||
for (final Method method : listener.getClass().getDeclaredMethods()) {
|
||||
if (method.isAnnotationPresent((Class<? extends Annotation>) Subscribe.class)) {
|
||||
this.proxy.getLogger().log(Level.WARNING,
|
||||
"Listener " + listener + " has registered using depreceated subscribe annotation!" + " Please advice author to update to @EventHandler." + " As a server owner you may safely ignore this.", new Exception());
|
||||
}
|
||||
}
|
||||
this.eventBus.register(listener);
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "proxy", "eventBus" })
|
||||
public PluginManager(final ProxyServer proxy, final EventBus eventBus) {
|
||||
this.yaml = new Yaml();
|
||||
this.plugins = new LinkedHashMap<String, Plugin>();
|
||||
this.commandMap = new HashMap<String, Command>();
|
||||
this.toLoad = new HashMap<String, PluginDescription>();
|
||||
this.proxy = proxy;
|
||||
this.eventBus = eventBus;
|
||||
}
|
||||
|
||||
static {
|
||||
argsSplit = Pattern.compile(" ");
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.scheduler;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public interface ScheduledTask {
|
||||
int getId();
|
||||
|
||||
Plugin getOwner();
|
||||
|
||||
Runnable getTask();
|
||||
|
||||
long getDelay(final TimeUnit p0);
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.scheduler;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import net.md_5.bungee.api.plugin.Plugin;
|
||||
|
||||
public interface TaskScheduler {
|
||||
void cancel(final int p0);
|
||||
|
||||
void cancel(final ScheduledTask p0);
|
||||
|
||||
int cancel(final Plugin p0);
|
||||
|
||||
ScheduledTask runAsync(final Plugin p0, final Runnable p1);
|
||||
|
||||
ScheduledTask schedule(final Plugin p0, final Runnable p1, final long p2, final TimeUnit p3);
|
||||
|
||||
ScheduledTask schedule(final Plugin p0, final Runnable p1, final long p2, final long p3, final TimeUnit p4);
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.score;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
public class Objective {
|
||||
private final String name;
|
||||
private final String value;
|
||||
|
||||
@ConstructorProperties({ "name", "value" })
|
||||
public Objective(final String name, final String value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Objective)) {
|
||||
return false;
|
||||
}
|
||||
final Objective other = (Objective) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$name = this.getName();
|
||||
final Object other$name = other.getName();
|
||||
Label_0065: {
|
||||
if (this$name == null) {
|
||||
if (other$name == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$name.equals(other$name)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$value = this.getValue();
|
||||
final Object other$value = other.getValue();
|
||||
if (this$value == null) {
|
||||
if (other$value == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$value.equals(other$value)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof Objective;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $name = this.getName();
|
||||
result = result * 31 + (($name == null) ? 0 : $name.hashCode());
|
||||
final Object $value = this.getValue();
|
||||
result = result * 31 + (($value == null) ? 0 : $value.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Objective(name=" + this.getName() + ", value=" + this.getValue() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.score;
|
||||
|
||||
public enum Position {
|
||||
LIST, SIDEBAR, BELOW;
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.score;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
|
||||
public class Score {
|
||||
private final String itemName;
|
||||
private final String scoreName;
|
||||
private final int value;
|
||||
|
||||
@ConstructorProperties({ "itemName", "scoreName", "value" })
|
||||
public Score(final String itemName, final String scoreName, final int value) {
|
||||
this.itemName = itemName;
|
||||
this.scoreName = scoreName;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getItemName() {
|
||||
return this.itemName;
|
||||
}
|
||||
|
||||
public String getScoreName() {
|
||||
return this.scoreName;
|
||||
}
|
||||
|
||||
public int getValue() {
|
||||
return this.value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Score)) {
|
||||
return false;
|
||||
}
|
||||
final Score other = (Score) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$itemName = this.getItemName();
|
||||
final Object other$itemName = other.getItemName();
|
||||
Label_0065: {
|
||||
if (this$itemName == null) {
|
||||
if (other$itemName == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$itemName.equals(other$itemName)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$scoreName = this.getScoreName();
|
||||
final Object other$scoreName = other.getScoreName();
|
||||
if (this$scoreName == null) {
|
||||
if (other$scoreName == null) {
|
||||
return this.getValue() == other.getValue();
|
||||
}
|
||||
} else if (this$scoreName.equals(other$scoreName)) {
|
||||
return this.getValue() == other.getValue();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof Score;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $itemName = this.getItemName();
|
||||
result = result * 31 + (($itemName == null) ? 0 : $itemName.hashCode());
|
||||
final Object $scoreName = this.getScoreName();
|
||||
result = result * 31 + (($scoreName == null) ? 0 : $scoreName.hashCode());
|
||||
result = result * 31 + this.getValue();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Score(itemName=" + this.getItemName() + ", scoreName=" + this.getScoreName() + ", value=" + this.getValue() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,193 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.score;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
|
||||
public class Scoreboard {
|
||||
private String name;
|
||||
private Position position;
|
||||
private final Map<String, Objective> objectives;
|
||||
private final Map<String, Score> scores;
|
||||
private final Map<String, Team> teams;
|
||||
|
||||
public Collection<Objective> getObjectives() {
|
||||
return Collections.unmodifiableCollection((Collection<? extends Objective>) this.objectives.values());
|
||||
}
|
||||
|
||||
public Collection<Score> getScores() {
|
||||
return Collections.unmodifiableCollection((Collection<? extends Score>) this.scores.values());
|
||||
}
|
||||
|
||||
public Collection<Team> getTeams() {
|
||||
return Collections.unmodifiableCollection((Collection<? extends Team>) this.teams.values());
|
||||
}
|
||||
|
||||
public void addObjective(final Objective objective) {
|
||||
Preconditions.checkNotNull((Object) objective, (Object) "objective");
|
||||
Preconditions.checkArgument(!this.objectives.containsKey(objective.getName()), "Objective %s already exists in this scoreboard", new Object[] { objective.getName() });
|
||||
this.objectives.put(objective.getName(), objective);
|
||||
}
|
||||
|
||||
public void addScore(final Score score) {
|
||||
Preconditions.checkNotNull((Object) score, (Object) "score");
|
||||
this.scores.put(score.getItemName(), score);
|
||||
}
|
||||
|
||||
public void addTeam(final Team team) {
|
||||
Preconditions.checkNotNull((Object) team, (Object) "team");
|
||||
Preconditions.checkArgument(!this.teams.containsKey(team.getName()), "Team %s already exists in this scoreboard", new Object[] { team.getName() });
|
||||
this.teams.put(team.getName(), team);
|
||||
}
|
||||
|
||||
public Team getTeam(final String name) {
|
||||
return this.teams.get(name);
|
||||
}
|
||||
|
||||
public void removeObjective(final String objectiveName) {
|
||||
this.objectives.remove(objectiveName);
|
||||
}
|
||||
|
||||
public void removeScore(final String scoreName) {
|
||||
this.scores.remove(scoreName);
|
||||
}
|
||||
|
||||
public void removeTeam(final String teamName) {
|
||||
this.teams.remove(teamName);
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.name = null;
|
||||
this.position = null;
|
||||
this.objectives.clear();
|
||||
this.scores.clear();
|
||||
this.teams.clear();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public Position getPosition() {
|
||||
return this.position;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setPosition(final Position position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Scoreboard)) {
|
||||
return false;
|
||||
}
|
||||
final Scoreboard other = (Scoreboard) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$name = this.getName();
|
||||
final Object other$name = other.getName();
|
||||
Label_0065: {
|
||||
if (this$name == null) {
|
||||
if (other$name == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$name.equals(other$name)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$position = this.getPosition();
|
||||
final Object other$position = other.getPosition();
|
||||
Label_0102: {
|
||||
if (this$position == null) {
|
||||
if (other$position == null) {
|
||||
break Label_0102;
|
||||
}
|
||||
} else if (this$position.equals(other$position)) {
|
||||
break Label_0102;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$objectives = this.getObjectives();
|
||||
final Object other$objectives = other.getObjectives();
|
||||
Label_0139: {
|
||||
if (this$objectives == null) {
|
||||
if (other$objectives == null) {
|
||||
break Label_0139;
|
||||
}
|
||||
} else if (this$objectives.equals(other$objectives)) {
|
||||
break Label_0139;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$scores = this.getScores();
|
||||
final Object other$scores = other.getScores();
|
||||
Label_0176: {
|
||||
if (this$scores == null) {
|
||||
if (other$scores == null) {
|
||||
break Label_0176;
|
||||
}
|
||||
} else if (this$scores.equals(other$scores)) {
|
||||
break Label_0176;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$teams = this.getTeams();
|
||||
final Object other$teams = other.getTeams();
|
||||
if (this$teams == null) {
|
||||
if (other$teams == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$teams.equals(other$teams)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof Scoreboard;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $name = this.getName();
|
||||
result = result * 31 + (($name == null) ? 0 : $name.hashCode());
|
||||
final Object $position = this.getPosition();
|
||||
result = result * 31 + (($position == null) ? 0 : $position.hashCode());
|
||||
final Object $objectives = this.getObjectives();
|
||||
result = result * 31 + (($objectives == null) ? 0 : $objectives.hashCode());
|
||||
final Object $scores = this.getScores();
|
||||
result = result * 31 + (($scores == null) ? 0 : $scores.hashCode());
|
||||
final Object $teams = this.getTeams();
|
||||
result = result * 31 + (($teams == null) ? 0 : $teams.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Scoreboard(name=" + this.getName() + ", position=" + this.getPosition() + ", objectives=" + this.getObjectives() + ", scores=" + this.getScores() + ", teams=" + this.getTeams() + ")";
|
||||
}
|
||||
|
||||
public Scoreboard() {
|
||||
this.objectives = new HashMap<String, Objective>();
|
||||
this.scores = new HashMap<String, Score>();
|
||||
this.teams = new HashMap<String, Team>();
|
||||
}
|
||||
}
|
@ -0,0 +1,183 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.score;
|
||||
|
||||
import java.beans.ConstructorProperties;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class Team {
|
||||
private final String name;
|
||||
private String displayName;
|
||||
private String prefix;
|
||||
private String suffix;
|
||||
private boolean friendlyFire;
|
||||
private Set<String> players;
|
||||
|
||||
public Collection<String> getPlayers() {
|
||||
return (Collection<String>) (Collection<?>) Collections.unmodifiableSet((Set<?>) this.players);
|
||||
}
|
||||
|
||||
public void addPlayer(final String name) {
|
||||
this.players.add(name);
|
||||
}
|
||||
|
||||
public void removePlayer(final String name) {
|
||||
this.players.remove(name);
|
||||
}
|
||||
|
||||
@ConstructorProperties({ "name" })
|
||||
public Team(final String name) {
|
||||
this.players = new HashSet<String>();
|
||||
if (name == null) {
|
||||
throw new NullPointerException("name");
|
||||
}
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return this.displayName;
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
return this.prefix;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return this.suffix;
|
||||
}
|
||||
|
||||
public boolean isFriendlyFire() {
|
||||
return this.friendlyFire;
|
||||
}
|
||||
|
||||
public void setDisplayName(final String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public void setPrefix(final String prefix) {
|
||||
this.prefix = prefix;
|
||||
}
|
||||
|
||||
public void setSuffix(final String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public void setFriendlyFire(final boolean friendlyFire) {
|
||||
this.friendlyFire = friendlyFire;
|
||||
}
|
||||
|
||||
public void setPlayers(final Set<String> players) {
|
||||
this.players = players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object o) {
|
||||
if (o == this) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof Team)) {
|
||||
return false;
|
||||
}
|
||||
final Team other = (Team) o;
|
||||
if (!other.canEqual(this)) {
|
||||
return false;
|
||||
}
|
||||
final Object this$name = this.getName();
|
||||
final Object other$name = other.getName();
|
||||
Label_0065: {
|
||||
if (this$name == null) {
|
||||
if (other$name == null) {
|
||||
break Label_0065;
|
||||
}
|
||||
} else if (this$name.equals(other$name)) {
|
||||
break Label_0065;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$displayName = this.getDisplayName();
|
||||
final Object other$displayName = other.getDisplayName();
|
||||
Label_0102: {
|
||||
if (this$displayName == null) {
|
||||
if (other$displayName == null) {
|
||||
break Label_0102;
|
||||
}
|
||||
} else if (this$displayName.equals(other$displayName)) {
|
||||
break Label_0102;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$prefix = this.getPrefix();
|
||||
final Object other$prefix = other.getPrefix();
|
||||
Label_0139: {
|
||||
if (this$prefix == null) {
|
||||
if (other$prefix == null) {
|
||||
break Label_0139;
|
||||
}
|
||||
} else if (this$prefix.equals(other$prefix)) {
|
||||
break Label_0139;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
final Object this$suffix = this.getSuffix();
|
||||
final Object other$suffix = other.getSuffix();
|
||||
Label_0176: {
|
||||
if (this$suffix == null) {
|
||||
if (other$suffix == null) {
|
||||
break Label_0176;
|
||||
}
|
||||
} else if (this$suffix.equals(other$suffix)) {
|
||||
break Label_0176;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (this.isFriendlyFire() != other.isFriendlyFire()) {
|
||||
return false;
|
||||
}
|
||||
final Object this$players = this.getPlayers();
|
||||
final Object other$players = other.getPlayers();
|
||||
if (this$players == null) {
|
||||
if (other$players == null) {
|
||||
return true;
|
||||
}
|
||||
} else if (this$players.equals(other$players)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canEqual(final Object other) {
|
||||
return other instanceof Team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int PRIME = 31;
|
||||
int result = 1;
|
||||
final Object $name = this.getName();
|
||||
result = result * 31 + (($name == null) ? 0 : $name.hashCode());
|
||||
final Object $displayName = this.getDisplayName();
|
||||
result = result * 31 + (($displayName == null) ? 0 : $displayName.hashCode());
|
||||
final Object $prefix = this.getPrefix();
|
||||
result = result * 31 + (($prefix == null) ? 0 : $prefix.hashCode());
|
||||
final Object $suffix = this.getSuffix();
|
||||
result = result * 31 + (($suffix == null) ? 0 : $suffix.hashCode());
|
||||
result = result * 31 + (this.isFriendlyFire() ? 1231 : 1237);
|
||||
final Object $players = this.getPlayers();
|
||||
result = result * 31 + (($players == null) ? 0 : $players.hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Team(name=" + this.getName() + ", displayName=" + this.getDisplayName() + ", prefix=" + this.getPrefix() + ", suffix=" + this.getSuffix() + ", friendlyFire=" + this.isFriendlyFire() + ", players=" + this.getPlayers() + ")";
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.tab;
|
||||
|
||||
public interface CustomTabList extends TabListHandler {
|
||||
void clear();
|
||||
|
||||
int getColumns();
|
||||
|
||||
int getRows();
|
||||
|
||||
int getSize();
|
||||
|
||||
String setSlot(final int p0, final int p1, final String p2);
|
||||
|
||||
String setSlot(final int p0, final int p1, final String p2, final boolean p3);
|
||||
|
||||
void update();
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.tab;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public abstract class TabListAdapter implements TabListHandler {
|
||||
private ProxiedPlayer player;
|
||||
|
||||
@Override
|
||||
public void init(final ProxiedPlayer player) {
|
||||
this.player = player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onConnect() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDisconnect() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onServerChange() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPingChange(final int ping) {
|
||||
}
|
||||
|
||||
public ProxiedPlayer getPlayer() {
|
||||
return this.player;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.api.tab;
|
||||
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
|
||||
public interface TabListHandler {
|
||||
void init(final ProxiedPlayer p0);
|
||||
|
||||
void onConnect();
|
||||
|
||||
void onServerChange();
|
||||
|
||||
void onPingChange(final int p0);
|
||||
|
||||
void onDisconnect();
|
||||
|
||||
boolean onListUpdate(final String p0, final boolean p1, final int p2);
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public class CommandAlert extends Command {
|
||||
public CommandAlert() {
|
||||
super("alert", "bungeecord.command.alert", new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
if (args.length == 0) {
|
||||
sender.sendMessage(ChatColor.RED + "You must supply a message.");
|
||||
} else {
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
if (args[0].startsWith("&h")) {
|
||||
args[0] = args[0].substring(2, args[0].length());
|
||||
} else {
|
||||
builder.append(ProxyServer.getInstance().getTranslation("alert"));
|
||||
}
|
||||
for (final String s : args) {
|
||||
builder.append(ChatColor.translateAlternateColorCodes('&', s));
|
||||
builder.append(" ");
|
||||
}
|
||||
final String message = builder.substring(0, builder.length() - 1);
|
||||
ProxyServer.getInstance().broadcast(message);
|
||||
ProxyServer.getInstance().getConsole().sendMessage(message);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public class CommandBungee extends Command {
|
||||
public CommandBungee() {
|
||||
super("bungee");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
sender.sendMessage(ChatColor.BLUE + "This server is running BungeeCord version " + ProxyServer.getInstance().getVersion() + " by md_5");
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.AuthSystem;
|
||||
|
||||
public class CommandChangePassword extends Command {
|
||||
private final AuthSystem authSystem;
|
||||
|
||||
public CommandChangePassword(AuthSystem authSystem) {
|
||||
super("changepassword", "bungeecord.command.eag.changepassword",
|
||||
new String[] { "changepwd", "changepasswd", "changepass" });
|
||||
this.authSystem = authSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
if (!(sender instanceof ProxiedPlayer)) {
|
||||
return;
|
||||
}
|
||||
String username = sender.getName();
|
||||
if (args.length == 0 || args.length == 1) {
|
||||
sender.sendMessage("\u00A7cUsage: /changepassword <oldPassword> <newPassword>");
|
||||
} else if (this.authSystem.login(username, args[0])) {
|
||||
if (this.authSystem.changePass(username, args[1])) {
|
||||
sender.sendMessage("\u00A7cPassword changed successfully!");
|
||||
} else {
|
||||
sender.sendMessage("\u00A7cUnable to change your password...");
|
||||
}
|
||||
} else {
|
||||
sender.sendMessage("\u00A7cThe old password specified is incorrect!");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.config.ListenerInfo;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public class CommandClearRatelimit extends Command {
|
||||
|
||||
public CommandClearRatelimit() {
|
||||
super("eag-ratelimit", "bungeecord.command.eag.ratelimit", "e-ratelimit", "gratelimit");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if(p1.length >= 1 && ("clear".equalsIgnoreCase(p1[0]) || "reset".equalsIgnoreCase(p1[0]))) {
|
||||
if(p1.length == 1 || (p1.length == 2 && "all".equalsIgnoreCase(p1[1]))) {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getRateLimitIP() != null) l.getRateLimitIP().resetLimiters();
|
||||
if(l.getRateLimitLogin() != null) l.getRateLimitLogin().resetLimiters();
|
||||
if(l.getRateLimitMOTD() != null) l.getRateLimitMOTD().resetLimiters();
|
||||
if(l.getRateLimitQuery() != null) l.getRateLimitQuery().resetLimiters();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all ratelimits");
|
||||
return;
|
||||
}else if(p1.length == 2 || p1.length == 3) {
|
||||
ListenerInfo ll = null;
|
||||
if(p1.length == 3) {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getHostString().equalsIgnoreCase(p1[2])) {
|
||||
ll = l;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(ll == null) {
|
||||
p0.sendMessage(ChatColor.RED + "Listener does not exist: " + ChatColor.WHITE + p1[2]);
|
||||
String accum = "";
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(accum.length() > 0) {
|
||||
accum += ", ";
|
||||
}
|
||||
accum += l.getHostString();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Listeners Available: " + ChatColor.WHITE + accum);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if("all".equalsIgnoreCase(p1[1])) {
|
||||
if(ll != null) {
|
||||
if(ll.getRateLimitIP() != null) ll.getRateLimitIP().resetLimiters();
|
||||
if(ll.getRateLimitLogin() != null) ll.getRateLimitLogin().resetLimiters();
|
||||
if(ll.getRateLimitMOTD() != null) ll.getRateLimitMOTD().resetLimiters();
|
||||
if(ll.getRateLimitQuery() != null) ll.getRateLimitQuery().resetLimiters();
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all ratelimits on listener: " + ChatColor.WHITE + ll.getHostString());
|
||||
}else {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getRateLimitIP() != null) l.getRateLimitIP().resetLimiters();
|
||||
if(l.getRateLimitLogin() != null) l.getRateLimitLogin().resetLimiters();
|
||||
if(l.getRateLimitMOTD() != null) l.getRateLimitMOTD().resetLimiters();
|
||||
if(l.getRateLimitQuery() != null) l.getRateLimitQuery().resetLimiters();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all ratelimits");
|
||||
}
|
||||
return;
|
||||
}else if("ip".equalsIgnoreCase(p1[1])) {
|
||||
if(ll != null) {
|
||||
if(ll.getRateLimitIP() != null) ll.getRateLimitIP().resetLimiters();
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all IP ratelimits on listener: " + ChatColor.WHITE + ll.getHostString());
|
||||
}else {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getRateLimitIP() != null) l.getRateLimitIP().resetLimiters();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all IP ratelimits.");
|
||||
}
|
||||
return;
|
||||
}else if("login".equalsIgnoreCase(p1[1])) {
|
||||
if(ll != null) {
|
||||
if(ll.getRateLimitLogin() != null) ll.getRateLimitLogin().resetLimiters();
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all login ratelimits on listener: " + ChatColor.WHITE + ll.getHostString());
|
||||
}else {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getRateLimitLogin() != null) l.getRateLimitLogin().resetLimiters();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all login ratelimits.");
|
||||
}
|
||||
return;
|
||||
}else if("motd".equalsIgnoreCase(p1[1])) {
|
||||
if(ll != null) {
|
||||
if(ll.getRateLimitMOTD() != null) ll.getRateLimitMOTD().resetLimiters();
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all MOTD ratelimits on listener: " + ChatColor.WHITE + ll.getHostString());
|
||||
}else {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getRateLimitMOTD() != null) l.getRateLimitMOTD().resetLimiters();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all MOTD ratelimits.");
|
||||
}
|
||||
return;
|
||||
}else if("query".equalsIgnoreCase(p1[1])) {
|
||||
if(ll != null) {
|
||||
if(ll.getRateLimitMOTD() != null) ll.getRateLimitMOTD().resetLimiters();
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all query ratelimits on listener: " + ChatColor.WHITE + ll.getHostString());
|
||||
}else {
|
||||
for(ListenerInfo l : BungeeCord.getInstance().config.getListeners()) {
|
||||
if(l.getRateLimitMOTD() != null) l.getRateLimitMOTD().resetLimiters();
|
||||
}
|
||||
p0.sendMessage(ChatColor.GREEN + "Reset all query ratelimits.");
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
p0.sendMessage(ChatColor.RED + "How to reset all rate limits: " + ChatColor.WHITE + "/eag-ratelimit reset");
|
||||
p0.sendMessage(ChatColor.RED + "How to reset a specific rate limit: " + ChatColor.WHITE + "/eag-ratelimit reset <ip|login|motd|query>");
|
||||
p0.sendMessage(ChatColor.RED + "How to reset a specific listener: " + ChatColor.WHITE + "/eag-ratelimit reset <all|ip|login|motd|query> <host>");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import java.nio.charset.StandardCharsets;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.QueryConnectionImpl;
|
||||
import net.md_5.bungee.eaglercraft.SHA1Digest;
|
||||
|
||||
public class CommandConfirmCode extends Command {
|
||||
|
||||
public CommandConfirmCode() {
|
||||
super("confirm-code", "bungeecord.command.eag.confirmcode", "confirmcode");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if(p1.length != 1) {
|
||||
p0.sendMessage(ChatColor.RED + "How to use: " + ChatColor.WHITE + "/confirm-code <code>");
|
||||
}else {
|
||||
p0.sendMessage(ChatColor.YELLOW + "Server list 2FA code has been set to: " + ChatColor.GREEN + p1[0]);
|
||||
p0.sendMessage(ChatColor.YELLOW + "You can now return to the server list site and continue");
|
||||
byte[] bts = p1[0].getBytes(StandardCharsets.US_ASCII);
|
||||
SHA1Digest dg = new SHA1Digest();
|
||||
dg.update(bts, 0, bts.length);
|
||||
byte[] f = new byte[20];
|
||||
dg.doFinal(f, 0);
|
||||
QueryConnectionImpl.confirmHash = SHA1Digest.hash2string(f);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public class CommandDomain extends Command {
|
||||
|
||||
public CommandDomain() {
|
||||
super("domain", "bungeecord.command.eag.domain");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if (p1.length < 1) {
|
||||
p0.sendMessage(ChatColor.RED + "Please follow this command by a user name");
|
||||
return;
|
||||
}
|
||||
final ProxiedPlayer user = ProxyServer.getInstance().getPlayer(p1[0]);
|
||||
if (user == null) {
|
||||
p0.sendMessage(ChatColor.RED + "That user is not online");
|
||||
} else {
|
||||
Object o = user.getAttachment().get("origin");
|
||||
if(o != null) {
|
||||
p0.sendMessage(ChatColor.BLUE + "Domain of " + p1[0] + " is " + o);
|
||||
if(p0.hasPermission("bungeecord.command.eag.blockdomain")) {
|
||||
p0.sendMessage(ChatColor.BLUE + "Type " + ChatColor.WHITE + "/block-domain " + p1[0] + ChatColor.BLUE + " to block this person");
|
||||
}
|
||||
}else {
|
||||
p0.sendMessage(ChatColor.RED + "Domain of " + p1[0] + " is unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.DomainBlacklist;
|
||||
|
||||
public class CommandDomainBlock extends Command {
|
||||
|
||||
public CommandDomainBlock() {
|
||||
super("block-domain", "bungeecord.command.eag.blockdomain");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if (p1.length < 1) {
|
||||
p0.sendMessage(ChatColor.RED + "Please follow this command by a username");
|
||||
return;
|
||||
}
|
||||
final ProxiedPlayer user = ProxyServer.getInstance().getPlayer(p1[0]);
|
||||
if (user == null) {
|
||||
p0.sendMessage(ChatColor.RED + "That user is not online");
|
||||
}else {
|
||||
Object o = user.getAttachment().get("origin");
|
||||
if(o != null) {
|
||||
DomainBlacklist.addLocal((String)o);
|
||||
p0.sendMessage(ChatColor.RED + "Domain of " + ChatColor.WHITE + p1[0] + ChatColor.RED + " is " + ChatColor.WHITE + o);
|
||||
p0.sendMessage(ChatColor.RED + "It was added to the local block list.");
|
||||
user.disconnect("client blocked");
|
||||
}else {
|
||||
p0.sendMessage(ChatColor.RED + "Domain of " + p1[0] + " is unknown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.DomainBlacklist;
|
||||
|
||||
public class CommandDomainBlockDomain extends Command {
|
||||
|
||||
public CommandDomainBlockDomain() {
|
||||
super("block-domain-name", "bungeecord.command.eag.blockdomainname");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if (p1.length < 1) {
|
||||
p0.sendMessage(ChatColor.RED + "Please follow this command by a domain");
|
||||
return;
|
||||
}
|
||||
DomainBlacklist.addLocal(p1[0]);
|
||||
p0.sendMessage(ChatColor.GREEN + "The domain '" + ChatColor.WHITE + p1[0] + ChatColor.GREEN + "' was added to the block list");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.DomainBlacklist;
|
||||
|
||||
public class CommandDomainUnblock extends Command {
|
||||
|
||||
public CommandDomainUnblock() {
|
||||
super("unblock-domain", "bungeecord.command.eag.unblockdomain", "unblock-domain-name");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if (p1.length < 1) {
|
||||
p0.sendMessage(ChatColor.RED + "Please follow this command by a domain");
|
||||
return;
|
||||
}
|
||||
if(DomainBlacklist.removeLocal(p1[0])) {
|
||||
p0.sendMessage(ChatColor.GREEN + "The domain '" + p1[0] + "' was removed from the local block list");
|
||||
}else {
|
||||
p0.sendMessage(ChatColor.RED + "The domain was not removed, is it on the block list? Check '" + DomainBlacklist.localBlacklist.getName() + "' in your bungeecord directory");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public class CommandEnd extends Command {
|
||||
public CommandEnd() {
|
||||
super("end", "bungeecord.command.end", new String[] { "exit", "quit" });
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
BungeeCord.getInstance().stop();
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
//
|
||||
// Decompiled by Procyon v0.5.36
|
||||
//
|
||||
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.ProxyServer;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
|
||||
public class CommandFind extends Command {
|
||||
public CommandFind() {
|
||||
super("find", "bungeecord.command.find", new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(final CommandSender sender, final String[] args) {
|
||||
if (args.length != 1) {
|
||||
sender.sendMessage(ChatColor.RED + "Please follow this command by a user name");
|
||||
} else {
|
||||
final ProxiedPlayer player = ProxyServer.getInstance().getPlayer(args[0]);
|
||||
if (player == null || player.getServer() == null || player.getServer().getInfo() == null) {
|
||||
sender.sendMessage(ChatColor.RED + "That user is not online");
|
||||
} else {
|
||||
sender.sendMessage(ChatColor.BLUE + args[0] + " is online at " + player.getServer().getInfo().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
|
||||
public class CommandGlobalBan extends Command {
|
||||
|
||||
private final boolean replaceBukkit;
|
||||
|
||||
public CommandGlobalBan(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "ban" : "eag-ban", "bungeecord.command.eag.ban", replaceBukkit ? new String[] { "kickban", "eag-ban", "e-ban", "gban" } : new String[] { "e-ban", "gban" });
|
||||
this.replaceBukkit = replaceBukkit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if(p1.length >= 1) {
|
||||
String p = p1[0].trim().toLowerCase();
|
||||
if(p0.getName().equalsIgnoreCase(p)) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "You cannot ban yourself");
|
||||
return;
|
||||
}
|
||||
String reason = "The ban hammer has spoken!";
|
||||
if(p1.length >= 2) {
|
||||
reason = "";
|
||||
for(int i = 1; i < p1.length; ++i) {
|
||||
if(reason.length() > 0) {
|
||||
reason += " ";
|
||||
}
|
||||
reason += p1[i];
|
||||
}
|
||||
}
|
||||
String wasTheKick = null;
|
||||
Collection<ProxiedPlayer> playerz = BungeeCord.getInstance().getPlayers();
|
||||
for(ProxiedPlayer pp : playerz) {
|
||||
if(pp.getName().equalsIgnoreCase(p)) {
|
||||
wasTheKick = pp.getName();
|
||||
pp.disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: " + reason);
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.WHITE + "Kicked: " + pp.getName());
|
||||
}
|
||||
}
|
||||
if(BanList.ban(p, reason)) {
|
||||
if(wasTheKick == null) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Warning! '" + ChatColor.WHITE + p + ChatColor.YELLOW + "' is not currently on this server");
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Username '" + ChatColor.WHITE + (wasTheKick == null ? p : wasTheKick) + ChatColor.GREEN + "' was added to the ban list");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Username '" + ChatColor.WHITE + p + ChatColor.RED + "' is already banned");
|
||||
}
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To ban a player, use: " + ChatColor.WHITE + "/" + (replaceBukkit?"":"eag-") + "ban <player> [reason]");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,147 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
import net.md_5.bungee.eaglercraft.BanList.IPBan;
|
||||
|
||||
public class CommandGlobalBanIP extends Command {
|
||||
|
||||
private final boolean replaceBukkit;
|
||||
|
||||
public CommandGlobalBanIP(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "ban-ip" : "eag-ban-ip", "bungeecord.command.eag.banip", (replaceBukkit ? new String[] {"eag-ban-ip", "banip", "e-ban-ip", "gban-ip"} :
|
||||
new String[] {"gban-ip", "e-ban-ip", "gbanip", "e-banip"}) );
|
||||
this.replaceBukkit = replaceBukkit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
String w = (String) p0.getAttachment().get("banIPWaitingToAdd");
|
||||
if(w != null) {
|
||||
List<ProxiedPlayer> lst = (List<ProxiedPlayer>)p0.getAttachment().get("banIPWaitingToKick");
|
||||
if(p1.length != 1 || (!p1[0].equalsIgnoreCase("confirm") && !p1[0].equalsIgnoreCase("cancel"))) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-ip" : "/eag-ban-ip") + " confirm" + ChatColor.RED + " to add IP " + ChatColor.WHITE + w +
|
||||
ChatColor.RED + " and ban " + ChatColor.WHITE + lst.size() + ChatColor.RED + " players");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-ip" : "/eag-ban-ip") + " cancel" + ChatColor.RED + " to cancel this operation");
|
||||
}else {
|
||||
if(p1[0].equalsIgnoreCase("confirm")) {
|
||||
try {
|
||||
if(BanList.banIP(w)) {
|
||||
for(ProxiedPlayer pp : lst) {
|
||||
pp.disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: banned by IP");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Kicked: " + ChatColor.WHITE + pp.getName());
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Added IP '" + ChatColor.WHITE + w + ChatColor.GREEN + "' to the ban list");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "IP '" + ChatColor.WHITE + w + ChatColor.RED + "' is already on the ban list");
|
||||
}
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "ERROR: address '" + ChatColor.WHITE + w + ChatColor.RED + "' is suddenly invalid for some reason");
|
||||
}
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Canceled ban");
|
||||
}
|
||||
p0.getAttachment().remove("banIPWaitingToAdd");
|
||||
p0.getAttachment().remove("banIPWaitingToKick");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(p1.length != 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "How to use: " + ChatColor.WHITE + (replaceBukkit ? "/ban-ip" : "/eag-ban-ip") + " <addr|player>");
|
||||
return;
|
||||
}
|
||||
boolean isPlayer = false;
|
||||
IPBan p = null;
|
||||
try {
|
||||
p = BanList.constructIpBan(p1[0]);
|
||||
}catch(Throwable t) {
|
||||
for(ProxiedPlayer pp : BungeeCord.getInstance().getPlayers()) {
|
||||
if(pp.getName().equalsIgnoreCase(p1[0])) {
|
||||
Object addr = pp.getAttachment().get("remoteAddr");
|
||||
if(addr != null) {
|
||||
String newAddr = ((InetAddress)addr).getHostAddress();
|
||||
isPlayer = true;
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Player '" + ChatColor.WHITE + p1[0] + ChatColor.GREEN + "' has IP " + ChatColor.WHITE + newAddr);
|
||||
p1[0] = newAddr;
|
||||
try {
|
||||
p = BanList.constructIpBan(p1[0]);
|
||||
}catch(UnknownHostException ex) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Address '" + ChatColor.WHITE + p1[0] + "' is suddenly invalid: " + ChatColor.WHITE + p1[0]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!isPlayer) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Player '" + ChatColor.WHITE + p1[0] + "' is not on this server");
|
||||
return;
|
||||
}
|
||||
}
|
||||
boolean blocked = false;
|
||||
for(IPBan b : BanList.blockedBans) {
|
||||
if(b.checkBan(p.getBaseAddress()) || p.checkBan(b.getBaseAddress())) {
|
||||
blocked = true;
|
||||
}
|
||||
}
|
||||
if(blocked) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Cannot ban '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "', it will ban local addresses that may break your game");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To force, add to the " + ChatColor.WHITE + "[IPs]" + ChatColor.RED + " section of " + ChatColor.WHITE + "bans.txt" + ChatColor.RED + " in your bungee directory");
|
||||
return;
|
||||
}
|
||||
boolean isSenderGonnaGetKicked = false;
|
||||
List<ProxiedPlayer> usersThatAreGonnaBeKicked = new ArrayList();
|
||||
for(ProxiedPlayer pp : BungeeCord.getInstance().getPlayers()) {
|
||||
Object addr = pp.getAttachment().get("remoteAddr");
|
||||
if(addr != null) {
|
||||
InetAddress addrr = (InetAddress)addr;
|
||||
if(p.checkBan(addrr)) {
|
||||
usersThatAreGonnaBeKicked.add(pp);
|
||||
if(pp.getName().equalsIgnoreCase(p0.getName())) {
|
||||
isSenderGonnaGetKicked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isSenderGonnaGetKicked) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "banning address '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' will ban you off of your own server");
|
||||
return;
|
||||
}
|
||||
if(usersThatAreGonnaBeKicked.size() > 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "WARNING: banning address '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is gonna ban " +
|
||||
ChatColor.WHITE + usersThatAreGonnaBeKicked.size() + ChatColor.RED + " players off of your server");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-ip" : "/eag-ban-ip") + " confirm" + ChatColor.RED + " to continue, or type " +
|
||||
ChatColor.WHITE + (replaceBukkit ? "/ban-ip" : "/eag-ban-ip") + " cancel" + ChatColor.RED + " to cancel");
|
||||
p0.getAttachment().put("banIPWaitingToKick", usersThatAreGonnaBeKicked);
|
||||
p0.getAttachment().put("banIPWaitingToAdd", p1[0]);
|
||||
}else {
|
||||
try {
|
||||
if(BanList.banIP(p1[0])) {
|
||||
if(usersThatAreGonnaBeKicked.size() > 0) {
|
||||
usersThatAreGonnaBeKicked.get(0).disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: banned by IP");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Kicked: " + ChatColor.WHITE + usersThatAreGonnaBeKicked.get(0).getName());
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Added IP '" + ChatColor.WHITE + p1[0] + ChatColor.GREEN + "' to the ban list");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "IP '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is already on the ban list");
|
||||
}
|
||||
} catch (UnknownHostException e) {
|
||||
e.printStackTrace();
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "ERROR: address '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is suddenly invalid for some reason");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
|
||||
public class CommandGlobalBanRegex extends Command {
|
||||
|
||||
private final boolean replaceBukkit;
|
||||
|
||||
public CommandGlobalBanRegex(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "ban-regex" : "eag-ban-regex", "bungeecord.command.eag.banregex", replaceBukkit ? new String[] { "eag-ban-regex", "e-ban-regex",
|
||||
"gban-regex", "eag-banregex", "e-banregex", "gbanregex", "banregex" } : new String[] { "e-ban-regex", "gban-regex",
|
||||
"eag-banregex", "e-banregex", "gbanregex" });
|
||||
this.replaceBukkit = replaceBukkit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
String w = (String) p0.getAttachment().get("banRegexWaitingToAdd");
|
||||
if(w != null) {
|
||||
List<ProxiedPlayer> lst = (List<ProxiedPlayer>)p0.getAttachment().get("banRegexWaitingToKick");
|
||||
if(p1.length != 1 || (!p1[0].equalsIgnoreCase("confirm") && !p1[0].equalsIgnoreCase("cancel"))) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-regex" : "/eag-ban-regex") + " confirm" + ChatColor.RED + " to add regex " + ChatColor.WHITE + w +
|
||||
ChatColor.RED + " and ban " + ChatColor.WHITE + lst.size() + ChatColor.RED + " players");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-regex" : "/eag-ban-regex") + " cancel" + ChatColor.RED + " to cancel this operation");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Note: all usernames are converted to lowercase before being matched");
|
||||
}else {
|
||||
if(p1[0].equalsIgnoreCase("confirm")) {
|
||||
if(BanList.banRegex(w)) {
|
||||
for(ProxiedPlayer pp : lst) {
|
||||
pp.disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: banned by regex");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Kicked: " + ChatColor.WHITE + pp.getName());
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Added regex '" + ChatColor.WHITE + w + ChatColor.GREEN + "' to the ban list");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Regex '" + ChatColor.WHITE + w + ChatColor.RED + "' is already banned");
|
||||
}
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Canceled ban");
|
||||
}
|
||||
p0.getAttachment().remove("banRegexWaitingToAdd");
|
||||
p0.getAttachment().remove("banRegexWaitingToKick");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(p1.length != 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "How to use: " + ChatColor.WHITE + (replaceBukkit ? "/ban-regex" : "/eag-ban-regex") + " <pattern>");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Note: all usernames are converted to lowercase before being matched");
|
||||
return;
|
||||
}
|
||||
Pattern p;
|
||||
try {
|
||||
p = Pattern.compile(p1[0]);
|
||||
}catch(Throwable t) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Regex syntax error: " + t.getMessage());
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Note: all usernames are converted to lowercase before being matched");
|
||||
return;
|
||||
}
|
||||
boolean isSenderGonnaGetKicked = false;
|
||||
List<ProxiedPlayer> usersThatAreGonnaBeKicked = new ArrayList();
|
||||
for(ProxiedPlayer pp : BungeeCord.getInstance().getPlayers()) {
|
||||
String n = pp.getName().toLowerCase();
|
||||
if(p.matcher(n).matches()) {
|
||||
usersThatAreGonnaBeKicked.add(pp);
|
||||
if(n.equalsIgnoreCase(p0.getName())) {
|
||||
isSenderGonnaGetKicked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isSenderGonnaGetKicked) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "banning regex '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is gonna ban your own username");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Note: all usernames are converted to lowercase before being matched");
|
||||
return;
|
||||
}
|
||||
if(usersThatAreGonnaBeKicked.size() > 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "WARNING: banning regex '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is gonna ban " +
|
||||
ChatColor.WHITE + usersThatAreGonnaBeKicked.size() + ChatColor.RED + " players off of your server");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-regex" : "/eag-ban-regex") + " confirm" + ChatColor.RED + " to continue, or type " +
|
||||
ChatColor.WHITE + "/eag-ban-regex cancel" + ChatColor.RED + " to cancel");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Note: all usernames are converted to lowercase before being matched");
|
||||
p0.getAttachment().put("banRegexWaitingToKick", usersThatAreGonnaBeKicked);
|
||||
p0.getAttachment().put("banRegexWaitingToAdd", p1[0]);
|
||||
}else {
|
||||
if(BanList.banRegex(p1[0])) {
|
||||
if(usersThatAreGonnaBeKicked.size() > 0) {
|
||||
usersThatAreGonnaBeKicked.get(0).disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: banned by regex");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Kicked: " + ChatColor.WHITE + usersThatAreGonnaBeKicked.get(0).getName());
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Added regex '" + ChatColor.WHITE + p1[0] + ChatColor.GREEN + "' to the ban list");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.YELLOW + "Note: all usernames are converted to lowercase before being matched");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Regex '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is already banned");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
|
||||
public class CommandGlobalBanReload extends Command {
|
||||
|
||||
public CommandGlobalBanReload(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "reloadban" : "eag-reloadban", "bungeecord.command.eag.reloadban", replaceBukkit ? new String[] { "eag-reloadban", "banreload", "eag-banreload", "e-reloadban",
|
||||
"e-banreload", "gbanreload", "greloadban"} : new String[] { "eag-banreload", "e-reloadban", "e-banreload", "gbanreload", "greloadban"});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
BanList.maybeReloadBans(p0);
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.WHITE + "Ban list reloaded");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.connection.ProxiedPlayer;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
|
||||
public class CommandGlobalBanWildcard extends Command {
|
||||
|
||||
private final boolean replaceBukkit;
|
||||
|
||||
public CommandGlobalBanWildcard(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "ban-wildcard" : "eag-ban-wildcard", "bungeecord.command.eag.banwildcard", replaceBukkit ? new String[] { "eag-ban-wildcard", "e-ban-wildcard", "gban-wildcard",
|
||||
"banwildcard", "eag-banwildcard", "banwildcard"} : new String[] { "e-ban-wildcard", "gban-wildcard", "eag-banwildcard"});
|
||||
this.replaceBukkit = replaceBukkit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
String w = (String) p0.getAttachment().get("banWildcardWaitingToAdd");
|
||||
if(w != null) {
|
||||
List<ProxiedPlayer> lst = (List<ProxiedPlayer>)p0.getAttachment().get("banWildcardWaitingToKick");
|
||||
if(p1.length != 1 || (!p1[0].equalsIgnoreCase("confirm") && !p1[0].equalsIgnoreCase("cancel"))) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-wildcard" : "/eag-ban-wildcard") + " confirm" + ChatColor.RED + " to add wildcard " + ChatColor.WHITE + w +
|
||||
ChatColor.RED + " and ban " + ChatColor.WHITE + lst.size() + ChatColor.RED + " players");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-wildcard" : "/eag-ban-wildcard") + " cancel" + ChatColor.RED + " to cancel this operation");
|
||||
}else {
|
||||
if(p1[0].equalsIgnoreCase("confirm")) {
|
||||
if(BanList.banWildcard(w)) {
|
||||
for(ProxiedPlayer pp : lst) {
|
||||
pp.disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: banned by wildcard");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Kicked: " + ChatColor.WHITE + pp.getName());
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Added wildcard '" + ChatColor.WHITE + w + ChatColor.GREEN + "' to the ban list");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Wildcard '" + ChatColor.WHITE + w + ChatColor.RED + "' is already banned");
|
||||
}
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Canceled ban");
|
||||
}
|
||||
p0.getAttachment().remove("banWildcardWaitingToAdd");
|
||||
p0.getAttachment().remove("banWildcardWaitingToKick");
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(p1.length != 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "How to use: " + ChatColor.WHITE + (replaceBukkit ? "/ban-wildcard" : "/eag-ban-wildcard") + " <pattern>");
|
||||
return;
|
||||
}
|
||||
p1[0] = p1[0].toLowerCase();
|
||||
String s = p1[0];
|
||||
boolean startStar = s.startsWith("*");
|
||||
if(startStar) {
|
||||
s = s.substring(1);
|
||||
}
|
||||
boolean endStar = s.endsWith("*");
|
||||
if(endStar) {
|
||||
s = s.substring(0, s.length() - 1);
|
||||
}
|
||||
if(!startStar && !endStar) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "'" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is not a wildcard, try '"
|
||||
+ ChatColor.WHITE + "*" + p1[0] + ChatColor.RED + "' or '" + ChatColor.WHITE + p1[0] + "*" + ChatColor.RED + "' or '" + ChatColor.WHITE
|
||||
+ "*" + p1[0] + "*" + ChatColor.RED + "' instead");
|
||||
return;
|
||||
}
|
||||
boolean isSenderGonnaGetKicked = false;
|
||||
List<ProxiedPlayer> usersThatAreGonnaBeKicked = new ArrayList();
|
||||
for(ProxiedPlayer pp : BungeeCord.getInstance().getPlayers()) {
|
||||
String n = pp.getName().toLowerCase();
|
||||
if(startStar && endStar) {
|
||||
if(n.contains(s)) {
|
||||
usersThatAreGonnaBeKicked.add(pp);
|
||||
if(pp.getName().equalsIgnoreCase(p0.getName())) {
|
||||
isSenderGonnaGetKicked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else if(startStar) {
|
||||
if(n.endsWith(s)) {
|
||||
usersThatAreGonnaBeKicked.add(pp);
|
||||
if(pp.getName().equalsIgnoreCase(p0.getName())) {
|
||||
isSenderGonnaGetKicked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}else if(endStar) {
|
||||
if(n.startsWith(s)) {
|
||||
usersThatAreGonnaBeKicked.add(pp);
|
||||
if(pp.getName().equalsIgnoreCase(p0.getName())) {
|
||||
isSenderGonnaGetKicked = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(isSenderGonnaGetKicked) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "banning wildcard '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is gonna ban your own username");
|
||||
return;
|
||||
}
|
||||
if(usersThatAreGonnaBeKicked.size() > 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "WARNING: banning wildcard '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is gonna ban " +
|
||||
ChatColor.WHITE + usersThatAreGonnaBeKicked.size() + ChatColor.RED + " players off of your server");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Type " + ChatColor.WHITE + (replaceBukkit ? "/ban-wildcard" : "/eag-ban-wildcard") + " confirm" + ChatColor.RED + " to continue, or type " +
|
||||
ChatColor.WHITE + (replaceBukkit ? "/ban-wildcard" : "/eag-ban-wildcard") + " cancel" + ChatColor.RED + " to cancel");
|
||||
p0.getAttachment().put("banWildcardWaitingToKick", usersThatAreGonnaBeKicked);
|
||||
p0.getAttachment().put("banWildcardWaitingToAdd", p1[0]);
|
||||
}else {
|
||||
if(BanList.banWildcard(p1[0])) {
|
||||
if(usersThatAreGonnaBeKicked.size() > 0) {
|
||||
usersThatAreGonnaBeKicked.get(0).disconnect("" + ChatColor.RED + "You are banned.\n" + ChatColor.DARK_GRAY + "Reason: banned by wildcard");
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Kicked: " + ChatColor.WHITE + usersThatAreGonnaBeKicked.get(0).getName());
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Added wildcard '" + ChatColor.WHITE + p1[0] + ChatColor.GREEN + "' to the ban list");
|
||||
}else {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Wildcard '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is already banned");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import java.net.InetAddress;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
import net.md_5.bungee.eaglercraft.BanList.BanCheck;
|
||||
import net.md_5.bungee.eaglercraft.BanList.BanState;
|
||||
|
||||
public class CommandGlobalCheckBan extends Command {
|
||||
|
||||
private final boolean replaceBukkit;
|
||||
|
||||
public CommandGlobalCheckBan(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "banned" : "eag-bannned", "bungeecord.command.eag.banned", replaceBukkit ? new String[] { "eag-banned", "isbanned", "e-banned", "gbanned", "eag-isbanned", "e-isbanned", "gisbanned" } :
|
||||
new String[] { "e-banned", "gbanned", "eag-isbanned", "e-isbanned", "gisbanned" });
|
||||
this.replaceBukkit = replaceBukkit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if(p1.length != 1) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To check if a player or IP is banned, use: " + ChatColor.WHITE + (replaceBukkit ? "/banned" : "/eag-banned") + " <username|ip>");
|
||||
}else {
|
||||
BanCheck bc = BanList.checkBanned(p1[0]);
|
||||
if(!bc.isBanned()) {
|
||||
try {
|
||||
InetAddress addr = InetAddress.getByName(p1[0]);
|
||||
bc = BanList.checkIpBanned(addr);
|
||||
if(bc.isBanned()) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "IP address '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is banned by: "
|
||||
+ "'" + ChatColor.WHITE + bc.match + ChatColor.RED + "' " + ChatColor.YELLOW + "(" + bc.string + ")");
|
||||
return;
|
||||
}
|
||||
}catch(Throwable t) {
|
||||
// no
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Player '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' has not been banned");
|
||||
}else {
|
||||
if(bc.reason == BanState.USER_BANNED) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Player '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is banned by username, reason: "
|
||||
+ ChatColor.YELLOW + "\"" + bc.string + "\"");
|
||||
}else if(bc.reason == BanState.WILDCARD_BANNED) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Player '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is banned by wildcard: "
|
||||
+ ChatColor.WHITE + "\"" + bc.match + "\"");
|
||||
}else if(bc.reason == BanState.REGEX_BANNED) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "Player '" + ChatColor.WHITE + p1[0] + ChatColor.RED + "' is banned by regex: "
|
||||
+ ChatColor.WHITE + "\"" + bc.match + "\"");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package net.md_5.bungee.command;
|
||||
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
import net.md_5.bungee.api.CommandSender;
|
||||
import net.md_5.bungee.api.plugin.Command;
|
||||
import net.md_5.bungee.eaglercraft.BanList;
|
||||
|
||||
public class CommandGlobalListBan extends Command {
|
||||
|
||||
private final boolean replaceBukkit;
|
||||
|
||||
public CommandGlobalListBan(boolean replaceBukkit) {
|
||||
super(replaceBukkit ? "banlist" : "eag-banlist", "bungeecord.command.eag.banlist", replaceBukkit ? new String[] { "eag-banlist", "gbanlist", "e-banlist",
|
||||
"gbanlist" } : new String[] { "gbanlist", "e-banlist" });
|
||||
this.replaceBukkit = replaceBukkit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender p0, String[] p1) {
|
||||
if(p1.length == 0 || (p1.length == 1 && (p1[0].equalsIgnoreCase("user") || p1[0].equalsIgnoreCase("username")
|
||||
|| p1[0].equalsIgnoreCase("users") || p1[0].equalsIgnoreCase("usernames")))) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Players banned by username: " + ChatColor.WHITE + BanList.listAllBans());
|
||||
return;
|
||||
}else if(p1.length == 1) {
|
||||
if(p1[0].equalsIgnoreCase("regex") || p1[0].equalsIgnoreCase("regexes")) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Regex ban list: " + ChatColor.WHITE + BanList.listAllRegexBans());
|
||||
return;
|
||||
}else if(p1[0].equalsIgnoreCase("wildcard") || p1[0].equalsIgnoreCase("wildcards")) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "Wildcard ban list: " + ChatColor.WHITE + BanList.listAllWildcardBans());
|
||||
return;
|
||||
}else if(p1[0].equalsIgnoreCase("ip") || p1[0].equalsIgnoreCase("ips")) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To list IP bans, use: " + ChatColor.WHITE + (replaceBukkit ? "/banlist" : "/eag-banlist") + " ip <addr|netmask> [v4|v6]");
|
||||
return;
|
||||
}
|
||||
}else if(p1.length > 1 && p1.length <= 3 && (p1[0].equalsIgnoreCase("ip") || p1[0].equalsIgnoreCase("ips"))) {
|
||||
int addrOrNetmask = 0;
|
||||
if(p1[1].equalsIgnoreCase("addr") || p1[1].equalsIgnoreCase("addrs")) {
|
||||
addrOrNetmask = 1;
|
||||
}else if(p1[1].equalsIgnoreCase("netmask") || p1[1].equalsIgnoreCase("netmasks")) {
|
||||
addrOrNetmask = 2;
|
||||
}
|
||||
if(addrOrNetmask > 0) {
|
||||
boolean yes = false;
|
||||
if(p1.length == 2 || (p1.length == 3 && (p1[2].equalsIgnoreCase("v4") || p1[2].equals("4")))) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "IPv4 " + (addrOrNetmask == 2 ? "netmask" : "address") + " ban list: " + ChatColor.WHITE + BanList.listAllIPBans(false, addrOrNetmask == 2));
|
||||
yes = true;
|
||||
}
|
||||
if(p1.length == 2 || (p1.length == 3 && (p1[2].equalsIgnoreCase("v6") || p1[2].equals("6")))) {
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.GREEN + "IPv6 " + (addrOrNetmask == 2 ? "netmask" : "address") + " ban list: " + ChatColor.WHITE + BanList.listAllIPBans(true, addrOrNetmask == 2));
|
||||
yes = true;
|
||||
}
|
||||
if(yes) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To list IP bans, use: " + ChatColor.WHITE + (replaceBukkit ? "/banlist" : "/eag-banlist") + " ip <addr|netmask> [v4|v6]");
|
||||
return;
|
||||
}
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To list all user bans, use: " + ChatColor.WHITE + (replaceBukkit ? "/banlist" : "/eag-banlist"));
|
||||
p0.sendMessage(BanList.banChatMessagePrefix + ChatColor.RED + "To list ips, regexes, and wildcards, use: " + ChatColor.WHITE + (replaceBukkit ? "/banlist" : "/eag-banlist") + " <ip|regex|wildcard>");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user