Commits
md_5 authored a3bf95b8de4
1 - | From c3c3d2f79636ffe44ecaf83d156c83dae5e3d923 Mon Sep 17 00:00:00 2001 |
1 + | From 201a0a0a084c8b5ad77d1bcd6c3e3f6a2ea0e6d0 Mon Sep 17 00:00:00 2001 |
2 2 | From: md_5 <md_5@live.com.au> |
3 3 | Date: Sun, 2 Jun 2013 15:20:49 +1000 |
4 4 | Subject: [PATCH] BungeeCord Support |
5 5 | |
6 6 | |
7 7 | diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java |
8 8 | index 2b3e490a..c5f6bae4 100644 |
9 9 | --- a/src/main/java/org/bukkit/entity/Player.java |
10 10 | +++ b/src/main/java/org/bukkit/entity/Player.java |
11 11 | |
18 18 | + * |
19 19 | + * @return the player's connection address |
20 20 | + */ |
21 21 | + @NotNull |
22 22 | + public InetSocketAddress getRawAddress() { |
23 23 | + throw new UnsupportedOperationException("Not supported yet."); |
24 24 | + } |
25 25 | } |
26 26 | |
27 27 | @NotNull |
28 - | diff --git a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java |
29 - | index 498f0be8..084ca8cf 100644 |
30 - | --- a/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java |
31 - | +++ b/src/main/java/org/bukkit/event/player/PlayerLoginEvent.java |
32 - | |
33 - | private final String hostname; |
34 - | private Result result = Result.ALLOWED; |
35 - | private String message = ""; |
36 - | + private final InetAddress realAddress; // Spigot |
37 - | |
38 - | /** |
39 - | * This constructor defaults message to an empty string, and result to |
40 - | |
41 - | * @param hostname The hostname that was used to connect to the server |
42 - | * @param address The address the player used to connect, provided for |
43 - | * timing issues |
44 - | + * @param realAddress the actual, unspoofed connecting address |
45 - | */ |
46 - | - public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address) { |
47 - | + public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address, final @NotNull InetAddress realAddress) { // Spigot |
48 - | super(player); |
49 - | this.hostname = hostname; |
50 - | this.address = address; |
51 - | + // Spigot start |
52 - | + this.realAddress = realAddress; |
53 - | + } |
54 - | + |
55 - | + public PlayerLoginEvent(@NotNull final Player player, @NotNull final String hostname, @NotNull final InetAddress address) { |
56 - | + this(player, hostname, address, address); |
57 - | + // Spigot end |
58 - | } |
59 - | |
60 - | /** |
61 - | |
62 - | * timing issues |
63 - | * @param result The result status for this event |
64 - | * @param message The message to be displayed if result denies login |
65 - | + * @param realAddress the actual, unspoofed connecting address |
66 - | */ |
67 - | - public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message) { |
68 - | - this(player, hostname, address); |
69 - | + public PlayerLoginEvent(@NotNull final Player player, @NotNull String hostname, @NotNull final InetAddress address, @NotNull final Result result, @NotNull final String message, @NotNull final InetAddress realAddress) { // Spigot |
70 - | + this(player, hostname, address, realAddress); // Spigot |
71 - | this.result = result; |
72 - | this.message = message; |
73 - | } |
74 - | |
75 - | + // Spigot start |
76 - | + /** |
77 - | + * Gets the connection address of this player, regardless of whether it has been spoofed or not. |
78 - | + * |
79 - | + * @return the player's connection address |
80 - | + */ |
81 - | + @NotNull |
82 - | + public InetAddress getRealAddress() { |
83 - | + return realAddress; |
84 - | + } |
85 - | + // Spigot end |
86 - | + |
87 - | /** |
88 - | * Gets the current result of the login, as an enum |
89 - | * |
90 28 | -- |
91 29 | 2.43.0 |
92 30 | |