Commit ee8c53e 1 parent 48c7e0b commit ee8c53e Copy full SHA for ee8c53e
File tree 5 files changed +40
-17
lines changed
5 files changed +40
-17
lines changed Original file line number Diff line number Diff line change 7
7
<version >3.6.7</version >
8
8
<repositories >
9
9
<repository >
10
- <id >spigot -repo</id >
11
- <url >https://hub.spigotmc.org/nexus/content/repositories/snapshots /</url >
10
+ <id >paper -repo</id >
11
+ <url >https://repo.papermc.io/repository/maven-public /</url >
12
12
</repository >
13
13
<repository >
14
14
<id >CodeMC</id >
22
22
<dependencies >
23
23
<!-- Spigot API -->
24
24
<dependency >
25
- <groupId >org.spigotmc </groupId >
26
- <artifactId >spigot -api</artifactId >
27
- <version >1.18 .1-R0.1-SNAPSHOT</version >
25
+ <groupId >io.papermc.paper </groupId >
26
+ <artifactId >paper -api</artifactId >
27
+ <version >1.20 .1-R0.1-SNAPSHOT</version >
28
28
<scope >provided</scope >
29
29
</dependency >
30
30
<dependency >
31
31
<groupId >org.jsoup</groupId >
32
32
<artifactId >jsoup</artifactId >
33
- <version >1.14.2 </version >
33
+ <version >1.15.3 </version >
34
34
</dependency >
35
35
<dependency >
36
36
<groupId >mysql</groupId >
37
37
<artifactId >mysql-connector-java</artifactId >
38
- <version >8.0.17 </version >
38
+ <version >8.0.28 </version >
39
39
</dependency >
40
40
<dependency >
41
41
<groupId >org.xerial</groupId >
Original file line number Diff line number Diff line change
1
+ package me .xiaozhangup .velocity ;
2
+
3
+ import net .kyori .adventure .text .Component ;
4
+ import net .kyori .adventure .text .serializer .gson .GsonComponentSerializer ;
5
+ import org .bukkit .Bukkit ;
6
+ import org .bukkit .plugin .Plugin ;
7
+
8
+ public class VelocityMessage {
9
+
10
+ Plugin plugin ;
11
+
12
+ public VelocityMessage (Plugin plugin ) {
13
+ this .plugin = plugin ;
14
+
15
+ plugin .getServer ().getMessenger ().registerOutgoingPluginChannel (plugin , "slime:old" );
16
+ plugin .getServer ().getMessenger ().registerOutgoingPluginChannel (plugin , "slime:modern" );
17
+ }
18
+
19
+ public void broadcast (String string ) {
20
+ Bukkit .getServer ().sendPluginMessage (plugin , "slime:pull" , string .getBytes ());
21
+ }
22
+
23
+ public void broadcast (Component component ) {
24
+ String string = GsonComponentSerializer .gson ().serialize (component );
25
+ Bukkit .getServer ().sendPluginMessage (plugin , "slime:pull" , string .getBytes ());
26
+ }
27
+
28
+ }
Original file line number Diff line number Diff line change 1
1
package moe .feo .bbstoper ;
2
2
3
+ import me .xiaozhangup .velocity .VelocityMessage ;
3
4
import org .bstats .bukkit .Metrics ;
4
5
import org .bukkit .Bukkit ;
5
6
import org .bukkit .plugin .java .JavaPlugin ;
@@ -13,10 +14,12 @@ public class BBSToper extends JavaPlugin {
13
14
public static BBSToper getInstance () {
14
15
return bbstoper ;
15
16
}
17
+ public static VelocityMessage velocity ;
16
18
17
19
@ Override
18
20
public void onEnable () {
19
21
bbstoper = this ;
22
+ velocity = new VelocityMessage (bbstoper );
20
23
this .saveDefaultConfig ();
21
24
Option .load ();
22
25
Message .saveDefaultConfig ();
Original file line number Diff line number Diff line change @@ -278,11 +278,7 @@ public void task() {
278
278
sql .updatePoster (poster );// 更新poster
279
279
if (issucceed ) {
280
280
sender .sendMessage (Message .PREFIX .getString () + Message .REWARDGIVED .getString ());
281
- for (Player p :Bukkit .getOnlinePlayers ()) {// 给有奖励权限且能看见此玩家(防止Vanish)的玩家广播
282
- if (!p .canSee ((Player )sender )) continue ;
283
- if (!p .hasPermission ("bbstoper.reward" )) continue ;
284
- p .sendMessage (Message .PREFIX .getString () + Message .BROADCAST .getString ().replaceAll ("%PLAYER%" , player .getName ()));
285
- }
281
+ BBSToper .velocity .broadcast (Message .PREFIX .getString () + Message .BROADCAST .getString ().replaceAll ("%PLAYER%" , player .getName ()));
286
282
}
287
283
if (isovertime ) {
288
284
int rewardtimes = Option .REWARD_TIMES .getInt ();
Original file line number Diff line number Diff line change @@ -136,11 +136,7 @@ public void activeReward() {// 主动给玩家发奖励
136
136
sql .addTopState (bbsname , time );
137
137
poster .setRewardtime (poster .getRewardtime () + 1 );
138
138
sql .updatePoster (poster );// 把poster储存起来
139
- for (Player p :Bukkit .getOnlinePlayers ()) {// 给有奖励权限且能看见此玩家(防止Vanish)的玩家广播
140
- if (!p .canSee (olplayer )) continue ;
141
- if (!p .hasPermission ("bbstoper.reward" )) continue ;
142
- p .sendMessage (Message .PREFIX .getString () + Message .BROADCAST .getString ().replaceAll ("%PLAYER%" , player .getName ()));
143
- }
139
+ BBSToper .velocity .broadcast (Message .PREFIX .getString () + Message .BROADCAST .getString ().replaceAll ("%PLAYER%" , player .getName ()));
144
140
}
145
141
}
146
142
}
You can’t perform that action at this time.
0 commit comments