4
1
mirror of https://e.coding.net/circlecloud/MiaoChat.git synced 2024-11-21 14:28:46 +00:00

feat: 更新混淆 添加URL打开支持

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-09-10 17:41:48 +08:00
parent 115e45c389
commit 3561b1809d
12 changed files with 738 additions and 155 deletions

View File

@ -1,65 +0,0 @@
IIIIiI
IIiIiI
iiIIiI
Iiiiii
IIIIIi
IiIiII
iiIIIi
iIIIii
iIiiIi
iiiIiI
IiiIii
iIiiiI
iiiIIi
IIiIII
IIIIii
IIIiii
iiiiII
iIIiII
IIiiII
iiIIii
IiiIII
iIiIII
IiIIii
iiIiiI
iIiiII
IiiIiI
iiiIII
IIiIIi
iIiIiI
iiIiii
IiIiii
IiIIiI
IiiIIi
IiIIIi
IIiiIi
iIIiIi
iIIIII
IIIiIi
iiiiiI
iIiIIi
IIIiiI
iiiiIi
iiIiIi
IIiiiI
IiiiII
iIIiii
iIiIii
IiIiiI
IIiIii
IiIIII
IIIIII
iIIIIi
IIIiII
iiiiii
IiiiiI
IiIiIi
iiiIii
iIIIiI
iIIiiI
iIiiii
iiIiII
IIiiii
iiIIII
IiiiIi
llllll

674
obf.dict
View File

@ -1,24 +1,650 @@
if
try
for
int
new
true
null
this
else
void
enum
final
false
class
catch
import
double
public
static
boolean
package
finally
private
protected
ʻ
ʼ
ʽ
ʾ
ʿ
ˆ
ˈ
ˉ
ˊ
ˋ
ˎ
ˏ
ˑ
י
ـ
ٴ
゙゙
ᐧᐧ
ᴵᴵ
ʻʻ
ʽʽ
ʼʼ
ʿʿ
ʾʾ
ــ
ˆˆ
ˉˉ
ˈˈ
ˋˋ
ˊˊ
ˏˏ
ˎˎ
ˑˑ
ᵔᵔ
יי
ᵎᵎ
ᵢᵢ
ⁱⁱ
ﹳﹳ
ٴٴ
ﹶﹶ
ʻʼ
ʻʽ
ʻʾ
ʻʿ
ʻˆ
ʻˈ
ʻˉ
ʻˊ
ʻˋ
ʻˎ
ʻˏ
ʻˑ
ʻי
ʻـ
ʻٴ
ʻᐧ
ʻᴵ
ʻᵎ
ʻᵔ
ʻᵢ
ʻⁱ
ʻﹳ
ʻﹶ
ʻ゙
ʼʻ
ʼʽ
ʼʾ
ʼʿ
ʼˆ
ʼˈ
ʼˉ
ʼˊ
ʼˋ
ʼˎ
ʼˏ
ʼˑ
ʼי
ʼـ
ʼٴ
ʼᐧ
ʼᴵ
ʼᵎ
ʼᵔ
ʼᵢ
ʼⁱ
ʼﹳ
ʼﹶ
ʼ゙
ʽʻ
ʽʼ
ʽʾ
ʽʿ
ʽˆ
ʽˈ
ʽˉ
ʽˊ
ʽˋ
ʽˎ
ʽˏ
ʽˑ
ʽי
ʽـ
ʽٴ
ʽᐧ
ʽᴵ
ʽᵎ
ʽᵔ
ʽᵢ
ʽⁱ
ʽﹳ
ʽﹶ
ʽ゙
ʾʻ
ʾʼ
ʾʽ
ʾʿ
ʾˆ
ʾˈ
ʾˉ
ʾˊ
ʾˋ
ʾˎ
ʾˏ
ʾˑ
ʾי
ʾـ
ʾٴ
ʾᐧ
ʾᴵ
ʾᵎ
ʾᵔ
ʾᵢ
ʾⁱ
ʾﹳ
ʾﹶ
ʾ゙
ʿʻ
ʿʼ
ʿʽ
ʿʾ
ʿˆ
ʿˈ
ʿˉ
ʿˊ
ʿˋ
ʿˎ
ʿˏ
ʿˑ
ʿי
ʿـ
ʿٴ
ʿᐧ
ʿᴵ
ʿᵎ
ʿᵔ
ʿᵢ
ʿⁱ
ʿﹳ
ʿﹶ
ʿ゙
ˆʻ
ˆʼ
ˆʽ
ˆʾ
ˆʿ
ˆˈ
ˆˉ
ˆˊ
ˆˋ
ˆˎ
ˆˏ
ˆˑ
ˆי
ˆـ
ˆٴ
ˆᐧ
ˆᴵ
ˆᵎ
ˆᵔ
ˆᵢ
ˆⁱ
ˆﹳ
ˆﹶ
ˆ゙
ˈʻ
ˈʼ
ˈʽ
ˈʾ
ˈʿ
ˈˆ
ˈˉ
ˈˊ
ˈˋ
ˈˎ
ˈˏ
ˈˑ
ˈי
ˈـ
ˈٴ
ˈᐧ
ˈᴵ
ˈᵎ
ˈᵔ
ˈᵢ
ˈⁱ
ˈﹳ
ˈﹶ
ˈ゙
ˉʻ
ˉʼ
ˉʽ
ˉʾ
ˉʿ
ˉˆ
ˉˈ
ˉˊ
ˉˋ
ˉˎ
ˉˏ
ˉˑ
ˉי
ˉـ
ˉٴ
ˉᐧ
ˉᴵ
ˉᵎ
ˉᵔ
ˉᵢ
ˉⁱ
ˉﹳ
ˉﹶ
ˉ゙
ˊʻ
ˊʼ
ˊʽ
ˊʾ
ˊʿ
ˊˆ
ˊˈ
ˊˉ
ˊˋ
ˊˎ
ˊˏ
ˊˑ
ˊי
ˊـ
ˊٴ
ˊᐧ
ˊᴵ
ˊᵎ
ˊᵔ
ˊᵢ
ˊⁱ
ˊﹳ
ˊﹶ
ˊ゙
ˋʻ
ˋʼ
ˋʽ
ˋʾ
ˋʿ
ˋˆ
ˋˈ
ˋˉ
ˋˊ
ˋˎ
ˋˏ
ˋˑ
ˋי
ˋـ
ˋٴ
ˋᐧ
ˋᴵ
ˋᵎ
ˋᵔ
ˋᵢ
ˋⁱ
ˋﹳ
ˋﹶ
ˋ゙
ˎʻ
ˎʼ
ˎʽ
ˎʾ
ˎʿ
ˎˆ
ˎˈ
ˎˉ
ˎˊ
ˎˋ
ˎˏ
ˎˑ
ˎי
ˎـ
ˎٴ
ˎᐧ
ˎᴵ
ˎᵎ
ˎᵔ
ˎᵢ
ˎⁱ
ˎﹳ
ˎﹶ
ˎ゙
ˏʻ
ˏʼ
ˏʽ
ˏʾ
ˏʿ
ˏˆ
ˏˈ
ˏˉ
ˏˊ
ˏˋ
ˏˎ
ˏˑ
ˏי
ˏـ
ˏٴ
ˏᐧ
ˏᴵ
ˏᵎ
ˏᵔ
ˏᵢ
ˏⁱ
ˏﹳ
ˏﹶ
ˏ゙
ˑʻ
ˑʼ
ˑʽ
ˑʾ
ˑʿ
ˑˆ
ˑˈ
ˑˉ
ˑˊ
ˑˋ
ˑˎ
ˑˏ
ˑי
ˑـ
ˑٴ
ˑᐧ
ˑᴵ
ˑᵎ
ˑᵔ
ˑᵢ
ˑⁱ
ˑﹳ
ˑﹶ
ˑ゙
יʻ
יʼ
יʽ
יʾ
יʿ
יˆ
יˈ
יˉ
יˊ
יˋ
יˎ
יˏ
יˑ
יـ
יٴ
יᐧ
יᴵ
יᵎ
יᵔ
יᵢ
יⁱ
יﹳ
יﹶ
י゙
ـʻ
ـʼ
ـʽ
ـʾ
ـʿ
ـˆ
ـˈ
ـˉ
ـˊ
ـˋ
ـˎ
ـˏ
ـˑ
ـי
ـٴ
ـᐧ
ـᴵ
ـᵎ
ـᵔ
ـᵢ
ـⁱ
ـﹳ
ـﹶ
ـ゙
ٴʻ
ٴʼ
ٴʽ
ٴʾ
ٴʿ
ٴˆ
ٴˈ
ٴˉ
ٴˊ
ٴˋ
ٴˎ
ٴˏ
ٴˑ
ٴי
ٴـ
ٴᐧ
ٴᴵ
ٴᵎ
ٴᵔ
ٴᵢ
ٴⁱ
ٴﹳ
ٴﹶ
ٴ゙
ᐧʻ
ᐧʼ
ᐧʽ
ᐧʾ
ᐧʿ
ᐧˆ
ᐧˈ
ᐧˉ
ᐧˊ
ᐧˋ
ᐧˎ
ᐧˏ
ᐧˑ
ᐧי
ᐧـ
ᐧٴ
ᐧᴵ
ᐧᵎ
ᐧᵔ
ᐧᵢ
ᐧⁱ
ᐧﹳ
ᐧﹶ
ᐧ゙
ᴵʻ
ᴵʼ
ᴵʽ
ᴵʾ
ᴵʿ
ᴵˆ
ᴵˈ
ᴵˉ
ᴵˊ
ᴵˋ
ᴵˎ
ᴵˏ
ᴵˑ
ᴵי
ᴵـ
ᴵٴ
ᴵᐧ
ᴵᵎ
ᴵᵔ
ᴵᵢ
ᴵⁱ
ᴵﹳ
ᴵﹶ
ᴵ゙
ᵎʻ
ᵎʼ
ᵎʽ
ᵎʾ
ᵎʿ
ᵎˆ
ᵎˈ
ᵎˉ
ᵎˊ
ᵎˋ
ᵎˎ
ᵎˏ
ᵎˑ
ᵎי
ᵎـ
ᵎٴ
ᵎᐧ
ᵎᴵ
ᵎᵔ
ᵎᵢ
ᵎⁱ
ᵎﹳ
ᵎﹶ
ᵎ゙
ᵔʻ
ᵔʼ
ᵔʽ
ᵔʾ
ᵔʿ
ᵔˆ
ᵔˈ
ᵔˉ
ᵔˊ
ᵔˋ
ᵔˎ
ᵔˏ
ᵔˑ
ᵔי
ᵔـ
ᵔٴ
ᵔᐧ
ᵔᴵ
ᵔᵎ
ᵔᵢ
ᵔⁱ
ᵔﹳ
ᵔﹶ
ᵔ゙
ᵢʻ
ᵢʼ
ᵢʽ
ᵢʾ
ᵢʿ
ᵢˆ
ᵢˈ
ᵢˉ
ᵢˊ
ᵢˋ
ᵢˎ
ᵢˏ
ᵢˑ
ᵢי
ᵢـ
ᵢٴ
ᵢᐧ
ᵢᴵ
ᵢᵎ
ᵢᵔ
ᵢⁱ
ᵢﹳ
ᵢﹶ
ᵢ゙
ⁱʻ
ⁱʼ
ⁱʽ
ⁱʾ
ⁱʿ
ⁱˆ
ⁱˈ
ⁱˉ
ⁱˊ
ⁱˋ
ⁱˎ
ⁱˏ
ⁱˑ
ⁱי
ⁱـ
ⁱٴ
ⁱᐧ
ⁱᴵ
ⁱᵎ
ⁱᵔ
ⁱᵢ
ⁱﹳ
ⁱﹶ
ⁱ゙
ﹳʻ
ﹳʼ
ﹳʽ
ﹳʾ
ﹳʿ
ﹳˆ
ﹳˈ
ﹳˉ
ﹳˊ
ﹳˋ
ﹳˎ
ﹳˏ
ﹳˑ
ﹳי
ﹳـ
ﹳٴ
ﹳᐧ
ﹳᴵ
ﹳᵎ
ﹳᵔ
ﹳᵢ
ﹳⁱ
ﹳﹶ
ﹳ゙
ﹶʻ
ﹶʼ
ﹶʽ
ﹶʾ
ﹶʿ
ﹶˆ
ﹶˈ
ﹶˉ
ﹶˊ
ﹶˋ
ﹶˎ
ﹶˏ
ﹶˑ
ﹶי
ﹶـ
ﹶٴ
ﹶᐧ
ﹶᴵ
ﹶᵎ
ﹶᵔ
ﹶᵢ
ﹶⁱ
ﹶﹳ
ﹶ゙
゙ʻ
゙ʼ
゙ʽ
゙ʾ
゙ʿ
゙ˆ
゙ˈ
゙ˉ
゙ˊ
゙ˋ
゙ˎ
゙ˏ
゙ˑ
゙י
゙ـ
゙ٴ
゙ᐧ
゙ᴵ
゙ᵎ
゙ᵔ
゙ᵢ
゙ⁱ
゙ﹳ
゙ﹶ

View File

@ -65,7 +65,6 @@
</goals>
<configuration>
<options>
<option>-repackageclasses nul.${project.groupId}.for.${project.artifactId}.class</option>
<option>-keep class ${project.groupId}.${project.artifactId}.${project.artifactId}</option>
</options>
<libs>

View File

@ -10,12 +10,15 @@
# -----启用混淆字典-----
-obfuscationdictionary obf.dict
-classobfuscationdictionary class.dict
-packageobfuscationdictionary class.dict
-classobfuscationdictionary obf.dict
-packageobfuscationdictionary obf.dict
# -----保留所有属性
-keepattributes **
# -----替换包名
-repackageclasses \ʼ.ʽ.ʾ
# -----公共数据不混淆-----
-keep class cn.citycraft.CommonData.** {*;}
@ -26,31 +29,26 @@
-keepclassmembers class * implements org.bukkit.event.Listener {
@org.bukkit.event.EventHandler <methods>;
}
# -----保护枚举方法的完整性-----
-keep enum ** {*;}
-keepclassmembers enum * {
public static **[] values();
public static ** valueOf(java.lang.String);
}
# -----保护配置注入不被清理-----
-keepclassmembers class * extends **.config.InjectConfigurationSection {
-keepclassmembers class * extends **.config.Inject** {
<fields>;
}
-keepclassmembers class * extends **.config.InjectConfig {
<fields>;
}
}
# -----保护注解命令方法不被清理-----
-keepclassmembers class **.commands.annotation.** { <methods>; }
-keepclassmembers class * implements **.commands.CommandExecutor { <methods>; }
-keepclassmembers class **.commands.HandlerCommand { <methods>; }
-keepclassmembers class * implements **.commands.HandlerCommands {
@**.commands.HandlerCommand <methods>;
@**.commands.HandlerTabComplete <methods>;
}
# -----保护注解NotProguard标记-----
-keep class **.NotProguard
-keep @**.NotProguard class * {*;}
-keepclassmembers class * {
@**.NotProguard <fields>;
@**.NotProguard <methods>;
}
# -----保护命令解析正常-----
-keepnames class * extends **.commands.BaseCommand
}

View File

@ -29,14 +29,14 @@ public class MiaoChat extends JavaPlugin implements CommandExecutor {
@Cmd(permission = "MiaoChat.toggle")
@Help("关闭聊天功能")
public void off(final CommandArgument e) {
ChatListener.offList.remove(e.getSender().getName());
ChatListener.offList.add(e.getSender().getName());
Log.toSender(e.getSender(), "§c聊天功能已关闭!");
}
@Cmd(permission = "MiaoChat.toggle")
@Help("开启聊天功能")
public void on(final CommandArgument e) {
ChatListener.offList.add(e.getSender().getName());
ChatListener.offList.remove(e.getSender().getName());
Log.toSender(e.getSender(), "§a聊天功能已开启!");
}

View File

@ -2,5 +2,6 @@ package pw.yumc.MiaoChat.config;
public enum CLICKTYPE {
COMMAND,
SUGGEST;
SUGGEST,
OPENURL;
}

View File

@ -37,10 +37,19 @@ public class ChatMessagePart extends InjectConfigurationSection {
}
if (command != null && !command.isEmpty()) {
final String tc = f(p, command);
if (type == CLICKTYPE.SUGGEST) {
tr.suggest(tc);
} else if (type == CLICKTYPE.COMMAND) {
switch (type) {
case COMMAND:
tr.command(tc);
break;
case OPENURL:
tr.openurl(tc);
break;
case SUGGEST:
tr.suggest(tc);
break;
default:
break;
}
}
return tr;

View File

@ -22,7 +22,7 @@ public class ChatRule extends InjectConfigurationSection {
private Integer range;
@Default("false")
private Boolean item;
@Default("&6[%s&6]&r")
@Default("&6[&b%s&6]&r")
private String itemformat;
private transient ChatConfig formats;

View File

@ -42,17 +42,26 @@ public class ChatListener implements Listener {
new SubscribeTask(true, true);
}
@EventHandler(priority = EventPriority.HIGH, ignoreCancelled = true)
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onChat(final AsyncPlayerChatEvent e) {
final Player p = e.getPlayer();
final ChatRule cr = plugin.getConfigExt().getChatRule(e.getPlayer());
if (cr == null) {
return;
}
final ChatConfig cc = cr.getFormats();
e.setCancelled(true);
final String msg = e.getMessage();
final Tellraw tr = Tellraw.create();
handleChat(p, tr, cr, e);
}
private void handleChat(final Player p, final Tellraw tr, final ChatRule cr, final AsyncPlayerChatEvent e) {
handleFormat(p, tr, cr);
handleTellraw(p, tr, cr, e.getMessage());
handleSend(p, tr, cr);
}
private void handleFormat(final Player p, final Tellraw tr, final ChatRule cr) {
final ChatConfig cc = cr.getFormats();
for (final ChatMessagePart cmp : cc.getPrefixs()) {
cmp.then(tr, p);
}
@ -60,29 +69,9 @@ public class ChatListener implements Listener {
for (final ChatMessagePart cmp : cc.getSuffixs()) {
cmp.then(tr, p);
}
final String message = ChatColor.translateAlternateColorCodes('&', msg);
if (!message.isEmpty() && cr.isItem()) {
if (!handlerTellraw(p, tr, message, cr.getItemformat())) {
Log.toSender(p, "§c不允许展示相同的物品!");
return;
}
}
final int range = cr.getRange();
Collection<? extends Entity> plist = Collections.emptyList();
if (range != 0) {
plist = p.getNearbyEntities(range, range, range);
} else {
plist = C.Player.getOnlinePlayers();
}
for (final Entity ne : plist) {
if (ne instanceof Player && !offList.contains(ne.getName())) {
tr.send(ne);
}
}
Bukkit.getConsoleSender().sendMessage(tr.toOldMessageFormat());
}
private LinkedList<String> handlerMessage(final LinkedList<String> il, String message) {
private LinkedList<String> handleMessage(final LinkedList<String> il, String message) {
final LinkedList<String> mlist = new LinkedList<>();
if (!il.isEmpty()) {
for (final String k : il) {
@ -98,7 +87,7 @@ public class ChatListener implements Listener {
return mlist;
}
private LinkedList<String> handlerPattern(final String message) {
private LinkedList<String> handlePattern(final String message) {
final Matcher m = ITEM_PATTERN.matcher(message);
final Set<String> temp = new HashSet<>();
final LinkedList<String> ilist = new LinkedList<>();
@ -115,12 +104,35 @@ public class ChatListener implements Listener {
return ilist;
}
private boolean handlerTellraw(final Player player, final Tellraw tr, final String message, final String itemformat) {
final LinkedList<String> il = handlerPattern(message);
if (il == null) {
return false;
private void handleSend(final Player p, final Tellraw tr, final ChatRule cr) {
final int range = cr.getRange();
Collection<? extends Entity> plist = Collections.emptyList();
if (range != 0) {
plist = p.getNearbyEntities(range, range, range);
} else {
plist = C.Player.getOnlinePlayers();
}
final LinkedList<String> ml = handlerMessage(il, message);
for (final Entity ne : plist) {
if (ne instanceof Player && !offList.contains(ne.getName())) {
tr.send(ne);
}
}
Bukkit.getConsoleSender().sendMessage(tr.toOldMessageFormat());
}
private void handleTellraw(final Player player, final Tellraw tr, final ChatRule cr, String message) {
if (message.isEmpty() || !cr.isItem()) {
return;
}
if (player.hasPermission("MiaoChat.color")) {
message = ChatColor.translateAlternateColorCodes('&', message);
}
final LinkedList<String> il = handlePattern(message);
if (il == null) {
Log.toSender(player, "§c不允许展示相同的物品!");
return;
}
final LinkedList<String> ml = handleMessage(il, message);
while (!ml.isEmpty()) {
final String mm = ml.removeFirst();
if (il.contains(mm)) {
@ -132,14 +144,12 @@ public class ChatListener implements Listener {
is = player.getInventory().getItem(k - '0' - 1);
}
if (is != null && is.getType() != Material.AIR) {
tr.then(String.format(ChatColor.translateAlternateColorCodes('&', itemformat),
is.hasItemMeta() && is.getItemMeta().hasDisplayName() ? is.getItemMeta().getDisplayName() : is.getType().name()));
tr.then(String.format(ChatColor.translateAlternateColorCodes('&', cr.getItemformat()), is.hasItemMeta() && is.getItemMeta().hasDisplayName() ? is.getItemMeta().getDisplayName() : is.getType().name()));
tr.item(is);
}
} else {
tr.then(mm);
}
}
return true;
}
}

View File

@ -17,11 +17,12 @@ Format:
- '&c点击即可TP我!'
#点击操作
click:
#操作类型: [COMMAND,SUGGEST]
#操作类型: [COMMAND,SUGGEST,OPENURL]
#COMMAND代表执行命令
#SUGGEST代表命令补全
#OPENURL代表打开网址
type: 'COMMAND'
#命令 支持PAPI
#命令或网址 支持PAPI
command: '/tpa %player_name%'
# 可以添加多个
# 2:

View File

@ -15,11 +15,12 @@ Format:
- '&c点击即可TP我!'
#点击操作
click:
#操作类型: [COMMAND,SUGGEST]
#操作类型: [COMMAND,SUGGEST,OPENURL]
#COMMAND代表执行命令
#SUGGEST代表命令补全
#OPENURL代表打开网址
type: 'COMMAND'
#命令 支持PAPI
#命令或网址 支持PAPI
command: '/tpa %player_name%'
# 可以添加多个
# 2:

View File

@ -13,18 +13,21 @@ commands:
- mct
- mchat
usage: §b使用/${project.artifactId} help 查看帮助!
permission: ${project.artifactId}.reload
permission: ${project.artifactId}.default
permission-message: §c你没有 <permission> 的权限来执行此命令!
permissions:
${project.artifactId}.default:
description: 默认格式权限!
default: true
${project.artifactId}.admin:
description: 管理员格式权限!
default: op
${project.artifactId}.toggle:
description: 开启关闭聊天!
default: true
${project.artifactId}.color:
description: 彩字聊天权限!
default: true
${project.artifactId}.admin:
description: 管理员格式权限!
default: op
${project.artifactId}.reload:
description: 重新载入插件!
default: op