mirror of
https://github.com/Aust1n46/VentureChat.git
synced 2025-05-23 02:19:05 +00:00
Model updates
This commit is contained in:
parent
ba1bc62fb9
commit
d36fca277d
@ -59,7 +59,7 @@ public class ProxyFlatFileController {
|
||||
while (m.hasMoreTokens()) {
|
||||
String[] parts = m.nextToken().split(":");
|
||||
String channelName = parts[0];
|
||||
mutes.put(channelName, new MuteContainer(channelName, Long.parseLong(parts[1])));
|
||||
mutes.put(channelName, new MuteContainer(channelName, Long.parseLong(parts[1]), ""));
|
||||
}
|
||||
HashSet<UUID> ignores = new HashSet<UUID>();
|
||||
StringTokenizer n = new StringTokenizer(playerData.getString(uuidString + ".ignores"), ",");
|
||||
|
@ -94,7 +94,7 @@ public class SpigotFlatFileController {
|
||||
continue;
|
||||
}
|
||||
String channelName = parts[0];
|
||||
mutes.put(channelName, new MuteContainer(channelName, Long.parseLong(parts[1])));
|
||||
mutes.put(channelName, new MuteContainer(channelName, Long.parseLong(parts[1]), ""));
|
||||
}
|
||||
}
|
||||
Set<String> blockedCommands = new HashSet<String>();
|
||||
|
@ -190,7 +190,7 @@ public class ChatListener implements Listener {
|
||||
|
||||
private void processMute(final VentureChatPlayer ventureChatPlayer, final ChatChannel channel) {
|
||||
MuteContainer muteContainer = ventureChatPlayer.getMute(channel.getName());
|
||||
if (muteContainer.hasDuration()) {
|
||||
if (muteContainer.getDuration() > 0) {
|
||||
long dateTimeMillis = System.currentTimeMillis();
|
||||
long muteTimeMillis = muteContainer.getDuration();
|
||||
long remainingMuteTime = muteTimeMillis - dateTimeMillis;
|
||||
@ -198,7 +198,7 @@ public class ChatListener implements Listener {
|
||||
remainingMuteTime = 1000;
|
||||
}
|
||||
String timeString = FormatUtils.parseTimeStringFromMillis(remainingMuteTime);
|
||||
if (muteContainer.hasReason()) {
|
||||
if (!muteContainer.getReason().isEmpty()) {
|
||||
ventureChatPlayer.getPlayer().sendMessage(LocalizedMessage.CHANNEL_MUTED_TIMED_REASON.toString().replace("{channel_color}", channel.getColor())
|
||||
.replace("{channel_name}", channel.getName()).replace("{time}", timeString).replace("{reason}", muteContainer.getReason()));
|
||||
} else {
|
||||
@ -206,7 +206,7 @@ public class ChatListener implements Listener {
|
||||
.replace("{channel_name}", channel.getName()).replace("{time}", timeString));
|
||||
}
|
||||
} else {
|
||||
if (muteContainer.hasReason()) {
|
||||
if (!muteContainer.getReason().isEmpty()) {
|
||||
ventureChatPlayer.getPlayer().sendMessage(LocalizedMessage.CHANNEL_MUTED_REASON.toString().replace("{channel_color}", channel.getColor())
|
||||
.replace("{channel_name}", channel.getName()).replace("{reason}", muteContainer.getReason()));
|
||||
} else {
|
||||
|
@ -2,19 +2,20 @@ package venture.Aust1n46.chat.model;
|
||||
|
||||
import com.comphenix.protocol.wrappers.WrappedChatComponent;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class ChatMessage {
|
||||
private WrappedChatComponent component;
|
||||
private String message;
|
||||
private String coloredMessage;
|
||||
private int hash;
|
||||
|
||||
public ChatMessage(WrappedChatComponent component, String message, String coloredMessage, int hash) {
|
||||
this.component = component;
|
||||
this.message = message;
|
||||
this.coloredMessage = coloredMessage;
|
||||
this.hash = hash;
|
||||
}
|
||||
}
|
||||
|
@ -2,19 +2,20 @@ package venture.Aust1n46.chat.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class JsonAttribute {
|
||||
private String name;
|
||||
private List<String> hoverText;
|
||||
private ClickAction clickAction;
|
||||
private String clickText;
|
||||
|
||||
public JsonAttribute(String name, List<String> hoverText, ClickAction clickAction, String clickText) {
|
||||
this.name = name;
|
||||
this.hoverText = hoverText;
|
||||
this.clickAction = clickAction;
|
||||
this.clickText = clickText;
|
||||
}
|
||||
}
|
||||
|
@ -2,17 +2,19 @@ package venture.Aust1n46.chat.model;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class JsonFormat {
|
||||
private List<JsonAttribute> jsonAttributes;
|
||||
private int priority;
|
||||
private String name;
|
||||
|
||||
public JsonFormat(String name, int priority, List<JsonAttribute> jsonAttributes) {
|
||||
this.name = name;
|
||||
this.priority = priority;
|
||||
this.jsonAttributes = jsonAttributes;
|
||||
}
|
||||
private int priority;
|
||||
private List<JsonAttribute> jsonAttributes;
|
||||
}
|
||||
|
@ -1,45 +1,18 @@
|
||||
package venture.Aust1n46.chat.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class MuteContainer {
|
||||
private String channel;
|
||||
private String reason;
|
||||
private long duration;
|
||||
|
||||
public MuteContainer(String channel) {
|
||||
this(channel, 0, "");
|
||||
}
|
||||
|
||||
public MuteContainer(String channel, long duration) {
|
||||
this(channel, duration, "");
|
||||
}
|
||||
|
||||
public MuteContainer(String channel, String reason) {
|
||||
this(channel, 0, reason);
|
||||
}
|
||||
|
||||
public MuteContainer(String channel, long duration, String reason) {
|
||||
this.channel = channel;
|
||||
this.reason = reason;
|
||||
this.duration = duration;
|
||||
}
|
||||
|
||||
public String getChannel() {
|
||||
return channel;
|
||||
}
|
||||
|
||||
public boolean hasReason() {
|
||||
return !reason.equals("");
|
||||
}
|
||||
|
||||
public String getReason() {
|
||||
return reason;
|
||||
}
|
||||
|
||||
public boolean hasDuration() {
|
||||
return duration > 0;
|
||||
}
|
||||
|
||||
public long getDuration() {
|
||||
return duration;
|
||||
}
|
||||
private String reason;
|
||||
}
|
||||
|
@ -3,7 +3,10 @@ package venture.Aust1n46.chat.model;
|
||||
import java.util.HashMap;
|
||||
import java.util.UUID;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
public class TemporaryDataInstance {
|
||||
@Getter
|
||||
private int messagePackets;
|
||||
private final UUID uuid;
|
||||
|
||||
@ -23,10 +26,6 @@ public class TemporaryDataInstance {
|
||||
return temporaryDataInstances.get(uuid);
|
||||
}
|
||||
|
||||
public int getMessagePackets() {
|
||||
return this.messagePackets;
|
||||
}
|
||||
|
||||
public void incrementMessagePackets() {
|
||||
this.messagePackets++;
|
||||
}
|
||||
|
@ -11,15 +11,22 @@ import java.util.UUID;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Data;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
/**
|
||||
* Wrapper for {@link Player}
|
||||
*
|
||||
* @author Aust1n46
|
||||
*/
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VentureChatPlayer {
|
||||
@Setter(value = AccessLevel.NONE)
|
||||
private UUID uuid;
|
||||
@ -54,7 +61,9 @@ public class VentureChatPlayer {
|
||||
private boolean messageToggle;
|
||||
private boolean bungeeToggle;
|
||||
|
||||
public VentureChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, MuteContainer> mutes, Set<String> blockedCommands, boolean host, UUID party, boolean filter, boolean notifications, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy, boolean messageToggle, boolean bungeeToggle) {
|
||||
public VentureChatPlayer(UUID uuid, String name, ChatChannel currentChannel, Set<UUID> ignores, Set<String> listening, HashMap<String, MuteContainer> mutes,
|
||||
Set<String> blockedCommands, boolean host, UUID party, boolean filter, boolean notifications, String jsonFormat, boolean spy, boolean commandSpy, boolean rangedSpy,
|
||||
boolean messageToggle, boolean bungeeToggle) {
|
||||
this.uuid = uuid;
|
||||
this.name = name;
|
||||
this.currentChannel = currentChannel;
|
||||
|
@ -1,9 +1,15 @@
|
||||
package venture.Aust1n46.chat.model;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.Setter;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@Getter
|
||||
@Setter
|
||||
@ToString
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class VentureChatProxyServer {
|
||||
private String name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user