Skip to content

Commit 3133189

Browse files
committed
Add ChannelMember#getUniqueId
1 parent 371e52a commit 3133189

File tree

10 files changed

+75
-1
lines changed

10 files changed

+75
-1
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<modelVersion>4.0.0</modelVersion>
33
<groupId>net.azisaba</groupId>
44
<artifactId>LunaChatPlus</artifactId>
5-
<version>3.1.0</version>
5+
<version>3.2.0</version>
66
<description>A powerfull chat channel plugin with IME (Kana-Kanji conversion) support</description>
77
<url>https://github.com/ucchyocean/LunaChat</url>
88

src/main/java/com/github/ucchyocean/lc3/member/ChannelMember.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
import com.github.ucchyocean.lc3.LunaChatMode;
1010

1111
import net.md_5.bungee.api.chat.BaseComponent;
12+
import org.jetbrains.annotations.Nullable;
13+
14+
import java.util.UUID;
1215

1316
/**
1417
* チャンネルメンバーの抽象クラス
@@ -28,6 +31,13 @@ public abstract class ChannelMember implements Comparable<ChannelMember> {
2831
*/
2932
public abstract String getName();
3033

34+
/**
35+
* プレイヤーのUUIDを返す
36+
* @return UUIDもしくはプレイヤーではない場合はnull
37+
*/
38+
@Nullable
39+
public abstract UUID getUniqueId();
40+
3141
/**
3242
* プレイヤー表示名を返す
3343
* @return プレイヤー表示名

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberBlock.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import org.bukkit.entity.Player;
1313

1414
import net.md_5.bungee.api.chat.BaseComponent;
15+
import org.jetbrains.annotations.Nullable;
16+
17+
import java.util.UUID;
1518

1619
/**
1720
* ChannelMemberのBukkit-BlockCommandSender実装
@@ -49,6 +52,11 @@ public String getName() {
4952
return sender.getName();
5053
}
5154

55+
@Override
56+
public @Nullable UUID getUniqueId() {
57+
return null;
58+
}
59+
5260
/**
5361
* プレイヤー表示名を返す
5462
* @return プレイヤー表示名

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberBukkitConsole.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
import org.bukkit.entity.Player;
1313

1414
import net.md_5.bungee.api.chat.BaseComponent;
15+
import org.jetbrains.annotations.Nullable;
16+
17+
import java.util.UUID;
1518

1619
/**
1720
* ChannelMemberのBukkit-ConsoleCommandSender実装
@@ -49,6 +52,11 @@ public String getName() {
4952
return sender.getName();
5053
}
5154

55+
@Override
56+
public @Nullable UUID getUniqueId() {
57+
return null;
58+
}
59+
5260
/**
5361
* プレイヤー表示名を返す
5462
* @return プレイヤー表示名

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberBungeeConsole.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@
1111
import net.md_5.bungee.api.chat.TextComponent;
1212
import net.md_5.bungee.api.connection.ProxiedPlayer;
1313
import net.md_5.bungee.api.connection.Server;
14+
import org.jetbrains.annotations.Nullable;
15+
16+
import java.util.UUID;
1417

1518
/**
1619
* ChannelMemberのBungee-ConsoleCommandSender実装
@@ -68,6 +71,11 @@ public String getName() {
6871
return sender.getName();
6972
}
7073

74+
@Override
75+
public @Nullable UUID getUniqueId() {
76+
return null;
77+
}
78+
7179
/**
7280
* 発言者の表示名を取得する
7381
* @return 発言者の表示名

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberOther.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
import net.md_5.bungee.api.chat.BaseComponent;
99

10+
import java.util.UUID;
11+
1012
/**
1113
* 任意の内容を設定できるChannelMember
1214
* @author ucchy
@@ -21,6 +23,7 @@ public class ChannelMemberOther extends ChannelMember {
2123
private BlockLocation location;
2224
private String serverName;
2325
private String worldName;
26+
private UUID uniqueId;
2427

2528
public ChannelMemberOther(@NotNull String name) {
2629
this(name, name);
@@ -62,6 +65,16 @@ public String getName() {
6265
return name;
6366
}
6467

68+
@Nullable
69+
@Override
70+
public UUID getUniqueId() {
71+
return uniqueId;
72+
}
73+
74+
public void setUniqueId(@Nullable UUID uniqueId) {
75+
this.uniqueId = uniqueId;
76+
}
77+
6578
@Override
6679
public String getDisplayName() {
6780
return displayName;

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberPlayer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.github.ucchyocean.lc3.util.BlockLocation;
2121

2222
import net.md_5.bungee.api.chat.BaseComponent;
23+
import org.jetbrains.annotations.Nullable;
2324

2425
/**
2526
* ChannelMemberのBukkitPlayer実装
@@ -108,6 +109,11 @@ public String getName() {
108109
return id.toString();
109110
}
110111

112+
@Override
113+
public @Nullable UUID getUniqueId() {
114+
return id;
115+
}
116+
111117
/**
112118
* プレイヤー表示名を返す
113119
* @return プレイヤー表示名

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberProxiedPlayer.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ public String getName() {
8686
return id.toString();
8787
}
8888

89+
@Override
90+
public @Nullable UUID getUniqueId() {
91+
return id;
92+
}
93+
8994
/**
9095
* プレイヤー表示名を返す
9196
* @return プレイヤー表示名

src/main/java/com/github/ucchyocean/lc3/member/ChannelMemberSystem.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
package com.github.ucchyocean.lc3.member;
22

33
import net.md_5.bungee.api.chat.BaseComponent;
4+
import org.jetbrains.annotations.Nullable;
5+
6+
import java.util.UUID;
47

58
public class ChannelMemberSystem extends ChannelMember {
69

@@ -17,6 +20,11 @@ public String getName() {
1720
return NAME;
1821
}
1922

23+
@Override
24+
public @Nullable UUID getUniqueId() {
25+
return null;
26+
}
27+
2028
@Override
2129
public String getDisplayName() {
2230
return NAME;

src/test/java/com/github/ucchyocean/lc3/member/ChannelMemberDummy.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
package com.github.ucchyocean.lc3.member;
77

88
import net.md_5.bungee.api.chat.BaseComponent;
9+
import org.jetbrains.annotations.Nullable;
10+
11+
import java.util.UUID;
912

1013
/**
1114
* テスト用のダミーメンバー
@@ -31,6 +34,11 @@ public String getName() {
3134
return "ucchy";
3235
}
3336

37+
@Override
38+
public @Nullable UUID getUniqueId() {
39+
return UUID.fromString("9603ae84-5be8-40af-af14-a62ed0f14a29");
40+
}
41+
3442
/**
3543
* @return
3644
* @see com.github.ucchyocean.lc3.member.ChannelMember#getDisplayName()

0 commit comments

Comments
 (0)