NotifyCommand class
Пакет: com.hypixel.hytale.server.core.command.commands.utility
Файл: com/hypixel/hytale/server/core/command/commands/utility/NotifyCommand.java
extends: CommandBase
Поля (12)
| Модификаторы | Тип | Имя |
|---|---|---|
|
|
return |
|
Message |
var10 |
|
|
var10 |
|
|
var10 |
|
String |
var2 |
|
NotificationStyle |
var3 |
|
|
var3 |
|
String |
var4 |
|
|
var4 |
|
int |
var5 |
|
String |
var6 |
|
Message |
var7 |
Методы (1)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
abstract |
|
super super("notify", "server.commands.notify.desc") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.core.command.commands.utility;
class="kw">import com.hypixel.hytale.protocol.packets.interface_.NotificationStyle;
class="kw">import com.hypixel.hytale.server.core.Message;
class="kw">import com.hypixel.hytale.server.core.command.system.CommandContext;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.system.RequiredArg;
class="kw">import com.hypixel.hytale.server.core.command.system.arguments.types.ArgTypes;
class="kw">import com.hypixel.hytale.server.core.command.system.basecommands.CommandBase;
class="kw">import com.hypixel.hytale.server.core.util.NotificationUtil;
class="kw">import java.util.Locale;
class="kw">import javax.annotation.Nonnull;
class="kw">public class NotifyCommand class="kw">extends CommandBase {
@Nonnull
class="kw">private class="kw">final RequiredArg<String> messageArg = this.withRequiredArg("message", "server.commands.notify.message.desc", ArgTypes.GREEDY_STRING);
class="kw">public NotifyCommand() {
super("notify", "server.commands.notify.desc");
}
@Override
class="kw">protected void executeSync(@Nonnull CommandContext var1) {
String var2 = this.messageArg.get(var1);
NotificationStyle var3 = NotificationStyle.Default;
String var4 = var2;
int var5 = var2.indexOf(32);
if (var5 > 0 && !var2.startsWith("{")) {
String var6 = var2.substring(0, var5);
try {
var3 = NotificationStyle.valueOf(var6.toUpperCase(Locale.ROOT));
var4 = var2.substring(var5 + 1);
} catch (IllegalArgumentException var9) {
}
}
Message var10;
if (var4.startsWith("{")) {
try {
var10 = Message.parse(var4);
} catch (IllegalArgumentException var8) {
var1.sendMessage(Message.raw("Invalid formatted message: " + var8.getMessage()));
class="kw">return;
}
} else {
var10 = Message.raw(var4);
}
Message var7 = Message.raw(var1.sender().getUsername());
NotificationUtil.sendNotificationToUniverse(var10, var7, "announcement", null, var3);
}
}