Skip to content

Commit 4cc4f3f

Browse files
committed
Removed ClearAndBright Listener on enable.
1 parent c50f968 commit 4cc4f3f

File tree

4 files changed

+56
-59
lines changed

4 files changed

+56
-59
lines changed

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
<id>spigot-repo</id>
1313
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
1414
</repository>
15-
<repository>
15+
<!-- <repository>
1616
<id>dmulloy2-repo</id>
1717
<url>https://repo.dmulloy2.net/repository/public/</url>
18-
</repository>
18+
</repository> -->
1919
</repositories>
2020

2121
<!-- Dependencies -->
@@ -28,11 +28,11 @@
2828
<type>jar</type>
2929
<scope>provided</scope>
3030
</dependency>
31-
<dependency>
31+
<!-- <dependency>
3232
<groupId>com.comphenix.protocol</groupId>
3333
<artifactId>ProtocolLib</artifactId>
3434
<version>4.7.0</version>
35-
</dependency>
35+
</dependency> -->
3636
</dependencies>
3737

3838
<build>

src/main/java/com/github/katorly/starlinutils/StarlinUtils.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,8 @@
77
import java.util.Map;
88
import java.util.UUID;
99

10-
import com.comphenix.protocol.ProtocolLibrary;
11-
import com.comphenix.protocol.ProtocolManager;
1210
import com.github.katorly.starlinutils.backup.ConfigReader;
1311
import com.github.katorly.starlinutils.commands.*;
14-
import com.github.katorly.starlinutils.festival.*;
1512
import com.github.katorly.starlinutils.utils.PlayTime;
1613

1714
import org.bukkit.Bukkit;
@@ -32,13 +29,13 @@ public StarlinUtils() {
3229
public Map<UUID, Long> StartTime = new HashMap<>();
3330
public static boolean serverClosing = false;
3431
public final List<NamespacedKey> recipeKeys = new ArrayList<>();
35-
public static ProtocolManager cab = ProtocolLibrary.getProtocolManager();
32+
// public static ProtocolManager cab = ProtocolLibrary.getProtocolManager(); //清明节
3633

3734
@Override
3835
public void onEnable() {
3936
getServer().getPluginManager().registerEvents(new EventListener(), this);
40-
ClearAndBright.grayChatting();
41-
// getServer().getPluginManager().registerEvents(new AprilFools(),this);
37+
// ClearAndBright.grayChatting(); //清明节
38+
// getServer().getPluginManager().registerEvents(new AprilFools(),this); //愚人节
4239
config = new ConfigReader(this,"","config.yml");
4340
config.saveDefaultConfig();
4441
timedata = new ConfigReader(this, "", "timedata.yml");
Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
1-
package com.github.katorly.starlinutils.festival;
1+
// package com.github.katorly.starlinutils.festival;
22

3-
import java.text.SimpleDateFormat;
4-
import java.util.Objects;
3+
// import java.text.SimpleDateFormat;
4+
// import java.util.Objects;
55

6-
import com.comphenix.protocol.PacketType;
7-
import com.comphenix.protocol.events.*;
8-
import com.comphenix.protocol.injector.GamePhase;
9-
import com.comphenix.protocol.wrappers.EnumWrappers;
10-
import com.comphenix.protocol.wrappers.WrappedChatComponent;
11-
import com.github.katorly.starlinutils.StarlinUtils;
6+
// import com.comphenix.protocol.PacketType;
7+
// import com.comphenix.protocol.events.*;
8+
// import com.comphenix.protocol.injector.GamePhase;
9+
// import com.comphenix.protocol.wrappers.EnumWrappers;
10+
// import com.comphenix.protocol.wrappers.WrappedChatComponent;
11+
// import com.github.katorly.starlinutils.StarlinUtils;
1212

13-
import net.md_5.bungee.api.ChatColor;
14-
import net.md_5.bungee.api.chat.BaseComponent;
15-
import net.md_5.bungee.api.chat.TextComponent;
16-
import net.md_5.bungee.chat.ComponentSerializer;
13+
// import net.md_5.bungee.api.ChatColor;
14+
// import net.md_5.bungee.api.chat.BaseComponent;
15+
// import net.md_5.bungee.api.chat.TextComponent;
16+
// import net.md_5.bungee.chat.ComponentSerializer;
1717

18-
public class ClearAndBright {
19-
public static boolean isToday(String date) {
20-
long t = System.currentTimeMillis();
21-
SimpleDateFormat d = new SimpleDateFormat("MM-dd");
22-
String n = d.format(t);
23-
if (Objects.equals(n, date))
24-
return true;
25-
else
26-
return false;
27-
}
18+
// public class ClearAndBright {
19+
// public static boolean isToday(String date) {
20+
// long t = System.currentTimeMillis();
21+
// SimpleDateFormat d = new SimpleDateFormat("MM-dd");
22+
// String n = d.format(t);
23+
// if (Objects.equals(n, date))
24+
// return true;
25+
// else
26+
// return false;
27+
// }
2828

29-
public static void grayChatting() {
30-
StarlinUtils.cab.addPacketListener(new PacketAdapter(PacketAdapter.params().plugin(StarlinUtils.INSTANCE).serverSide().listenerPriority(ListenerPriority.NORMAL).gamePhase(GamePhase.PLAYING).optionAsync().options(ListenerOptions.SKIP_PLUGIN_VERIFIER).types(PacketType.Play.Server.CHAT)) {
31-
@Override
32-
public void onPacketSending(PacketEvent event) {
33-
if (isToday("04-05")) {
34-
PacketContainer packet = event.getPacket();
35-
PacketType packetType = event.getPacketType();
36-
if (packetType.equals(PacketType.Play.Server.CHAT)) {
37-
if (packet.getChatTypes() == null) return;
38-
if (packet.getChatTypes().getValues().get(0) != EnumWrappers.ChatType.SYSTEM) return;
39-
WrappedChatComponent warppedComponent = packet.getChatComponents().getValues().get(0);
40-
String json = warppedComponent.getJson();
41-
BaseComponent[] components = ComponentSerializer.parse(json);
42-
components = TextComponent.fromLegacyText(TextComponent.toLegacyText(components));
43-
for(BaseComponent component:components) component.setColor(ChatColor.GRAY);
44-
String newJson = ComponentSerializer.toString(components);
45-
warppedComponent.setJson(newJson);
46-
packet.getChatComponents().write(0, warppedComponent);
47-
}
48-
}
49-
}
50-
});
51-
}
52-
}
29+
// public static void grayChatting() {
30+
// StarlinUtils.cab.addPacketListener(new PacketAdapter(PacketAdapter.params().plugin(StarlinUtils.INSTANCE).serverSide().listenerPriority(ListenerPriority.NORMAL).gamePhase(GamePhase.PLAYING).optionAsync().options(ListenerOptions.SKIP_PLUGIN_VERIFIER).types(PacketType.Play.Server.CHAT)) {
31+
// @Override
32+
// public void onPacketSending(PacketEvent event) {
33+
// if (isToday("04-05")) { //启用前请修改每年清明对应的时间
34+
// PacketContainer packet = event.getPacket();
35+
// PacketType packetType = event.getPacketType();
36+
// if (packetType.equals(PacketType.Play.Server.CHAT)) {
37+
// if (packet.getChatTypes() == null) return;
38+
// if (packet.getChatTypes().getValues().get(0) != EnumWrappers.ChatType.SYSTEM) return;
39+
// WrappedChatComponent warppedComponent = packet.getChatComponents().getValues().get(0);
40+
// String json = warppedComponent.getJson();
41+
// BaseComponent[] components = ComponentSerializer.parse(json);
42+
// components = TextComponent.fromLegacyText(TextComponent.toLegacyText(components));
43+
// for(BaseComponent component:components) component.setColor(ChatColor.GRAY);
44+
// String newJson = ComponentSerializer.toString(components);
45+
// warppedComponent.setJson(newJson);
46+
// packet.getChatComponents().write(0, warppedComponent);
47+
// }
48+
// }
49+
// }
50+
// });
51+
// }
52+
// }

src/main/resources/plugin.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ version: 1.0.6
33
author: Katorly
44
main: com.github.katorly.starlinutils.StarlinUtils
55
api-version: 1.18
6-
softdepend:
7-
- "ProtocolLib"
6+
# softdepend:
7+
# - "ProtocolLib"
88
description: A Spigot plugin made for StarlinWorld.
99
commands:
1010
su:

0 commit comments

Comments
 (0)