Commits
Doc authored and md_5 committed 0a0fc3beec0
1 1 | package org.bukkit.craftbukkit.ban; |
2 2 | |
3 - | import java.net.InetSocketAddress; |
3 + | import com.google.common.net.InetAddresses; |
4 + | import java.net.InetAddress; |
4 5 | import java.time.Instant; |
5 6 | import java.util.Date; |
6 7 | import net.minecraft.server.players.IpBanEntry; |
7 8 | import net.minecraft.server.players.IpBanList; |
8 9 | import org.bukkit.BanEntry; |
9 10 | |
10 - | public final class CraftIpBanEntry implements BanEntry<InetSocketAddress> { |
11 + | public final class CraftIpBanEntry implements BanEntry<InetAddress> { |
11 12 | private static final Date minorDate = Date.from(Instant.parse("1899-12-31T04:00:00Z")); |
12 13 | private final IpBanList list; |
13 14 | private final String target; |
14 15 | private Date created; |
15 16 | private String source; |
16 17 | private Date expiration; |
17 18 | private String reason; |
18 19 | |
19 20 | public CraftIpBanEntry(String target, IpBanEntry entry, IpBanList list) { |
20 21 | this.list = list; |
24 25 | this.expiration = entry.getExpires() != null ? new Date(entry.getExpires().getTime()) : null; |
25 26 | this.reason = entry.getReason(); |
26 27 | } |
27 28 | |
28 29 | |
29 30 | public String getTarget() { |
30 31 | return this.target; |
31 32 | } |
32 33 | |
33 34 | |
34 - | public InetSocketAddress getBanTarget() { |
35 - | return new InetSocketAddress(this.target, 0); |
35 + | public InetAddress getBanTarget() { |
36 + | return InetAddresses.forString(this.target); |
36 37 | } |
37 38 | |
38 39 | |
39 40 | public Date getCreated() { |
40 41 | return this.created == null ? null : (Date) this.created.clone(); |
41 42 | } |
42 43 | |
43 44 | |
44 45 | public void setCreated(Date created) { |
45 46 | this.created = created; |