Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions TextChatMeow/Commands/ProximityChat.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using CommandSystem;
using System;
using System.Linq;
using Exiled.API.Features;
using TextChatMeow.Model;
using TextChatMeow.MessageHandler;

namespace TextChatMeow.Commands
{
Expand All @@ -11,7 +10,7 @@ public class ProximityChat : ICommand
{
public string Command => "ProximityChat";

public string[] Aliases => new[] { "c" };
public string[] Aliases => ["c"];

public string Description => Plugin.Instance.Translation.ProximityChatDescription;

Expand All @@ -22,7 +21,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
if (!CheckPermission(player, out response))
return false;

var message = string.Join(" ", arguments.ToArray());
var message = string.Join(" ", [.. arguments]);
SendMessage(message, player);

response = Plugin.Instance.Translation.ResponseWhenSend.Replace("{Message}", message);
Expand Down
9 changes: 4 additions & 5 deletions TextChatMeow/Commands/PublicChat.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using CommandSystem;
using System;
using System.Linq;
using CommandSystem;
using Exiled.API.Features;
using TextChatMeow.Model;
using TextChatMeow.MessageHandler;

namespace TextChatMeow.Commands
{
Expand All @@ -11,7 +10,7 @@ public class PublicChat : ICommand
{
public string Command => "PublicChat";

public string[] Aliases => new[] { "pc" };
public string[] Aliases => ["pc"];

public string Description => Plugin.Instance.Translation.PublicChatDescription;

Expand All @@ -22,7 +21,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
if (!CheckPermission(player, out response))
return false;

var message = string.Join(" ", arguments.ToArray());
var message = string.Join(" ", [.. arguments]);
SendMessage(message, player);

response = Plugin.Instance.Translation.ResponseWhenSend.Replace("{Message}", message);
Expand Down
9 changes: 4 additions & 5 deletions TextChatMeow/Commands/RadioChat.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
using CommandSystem;
using CommandSystem;
using Exiled.API.Features.Items;
using System;
using System.Linq;
using Exiled.API.Features;
using TextChatMeow.Model;
using TextChatMeow.MessageHandler;

namespace TextChatMeow.Commands
{
Expand All @@ -12,7 +11,7 @@ public class RadioChat : ICommand
{
public string Command => "RadioChat";

public string[] Aliases => new[] { "rc" };
public string[] Aliases => ["rc"];

public string Description => Plugin.Instance.Translation.RadioChatDescription;

Expand All @@ -23,7 +22,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
if (!CheckPermission(player, out response))
return false;

var message = string.Join(" ", arguments.ToArray());
var message = string.Join(" ", [.. arguments]);
SendMessage(message, player);

response = Plugin.Instance.Translation.ResponseWhenSend.Replace("{Message}", message);
Expand Down
9 changes: 4 additions & 5 deletions TextChatMeow/Commands/TeamChat.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
using CommandSystem;
using System;
using System.Linq;
using CommandSystem;
using Exiled.API.Features;
using TextChatMeow.Model;
using TextChatMeow.MessageHandler;

namespace TextChatMeow.Commands
{
Expand All @@ -11,7 +10,7 @@ public class TeamChat : ICommand
{
public string Command => "TeamChat";

public string[] Aliases => new[] { "tc" };
public string[] Aliases => new[] ["tc"];

public string Description => Plugin.Instance.Translation.TeamChatDescription;

Expand All @@ -22,7 +21,7 @@ public bool Execute(ArraySegment<string> arguments, ICommandSender sender, out s
if (!CheckPermission(player, out response))
return false;

var message = string.Join(" ", arguments.ToArray());
var message = string.Join(" ", [.. arguments]);
SendMessage(message, player);

response = Plugin.Instance.Translation.ResponseWhenSend.Replace("{Message}", message);
Expand Down
28 changes: 11 additions & 17 deletions TextChatMeow/MessageHandler/DisplayManager.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using Exiled.API.Features;
using MEC;
using System;
using System.Collections.Generic;
using System.Linq;
using Exiled.Events.EventArgs.Player;
using HintServiceMeow.Core.Utilities;
using TextChatMeow.Model;
Expand All @@ -14,37 +11,34 @@ namespace TextChatMeow.MessageHandler
internal class DisplayManager
{
private static Config Config => Plugin.Instance.Config;

private static readonly List<DisplayManager> MessagesManagers = new List<DisplayManager>();
private static readonly List<DisplayManager> MessagesManagers = [];
private static CoroutineHandle _autoUpdateCoroutine;

private readonly Hint _textChatTip = new Hint
private static readonly Hint hint = new()
{
Text = Config.ChatTip,
YCoordinate = Config.MessageYCoordinate,
Alignment = Config.MessageAlignment,
};
private readonly List<Hint> _messageSlots = new List<Hint>()
{
new Hint
{
private readonly Hint _textChatTip = hint;
private readonly List<Hint> _messageSlots =
[
new() {
YCoordinate = Config.MessageYCoordinate + 25,
Alignment = Config.MessageAlignment,
SyncSpeed = HintSyncSpeed.Fast
},
new Hint
{
new() {
YCoordinate = Config.MessageYCoordinate + 50,
Alignment = Config.MessageAlignment,
SyncSpeed = HintSyncSpeed.Fast
},
new Hint
{
new() {
YCoordinate = Config.MessageYCoordinate + 75,
Alignment = Config.MessageAlignment,
SyncSpeed = HintSyncSpeed.Fast
}
};
];

private readonly DateTime _timeCreated = DateTime.Now;
private readonly TimeSpan _tipTimeToDisplay = TimeSpan.FromSeconds(Plugin.Instance.Config.TipDisappearTime);
Expand All @@ -53,7 +47,7 @@ internal class DisplayManager

public DisplayManager(VerifiedEventArgs ev)
{
this._player = ev.Player;
_player = ev.Player;

var playerDisplay = PlayerDisplay.Get(ev.Player);
playerDisplay.AddHint(_textChatTip);
Expand Down
7 changes: 2 additions & 5 deletions TextChatMeow/MessageHandler/MessagesList.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
using Exiled.API.Features;
using Exiled.Events.EventArgs.Server;
using MEC;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using TextChatMeow.Model;

namespace TextChatMeow
namespace TextChatMeow.MessageHandler
{
/// <summary>
/// Contain all the messages that sent by the player
Expand All @@ -32,7 +29,7 @@ public static void RemoveMessage(AbstractChatMessage ms)
MessageList.Remove(ms);
}

public static void ClearMessageList(RoundEndedEventArgs ev)
public static void ClearMessageList(RoundEndedEventArgs __)
{
MessageList.Clear();
}
Expand Down
7 changes: 4 additions & 3 deletions TextChatMeow/Plugin.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Exiled.API.Features;
using Exiled.Events.EventArgs.Player;
using System;
using TextChatMeow.MessageHandler;

// V1.2.0
Expand Down Expand Up @@ -33,11 +32,11 @@ namespace TextChatMeow
{
internal class Plugin : Plugin<Config, Translation>
{
public static Plugin Instance { get; set; }
public static Plugin Instance { get; set; } = new();

public override string Name => "TextChatMeow";
public override string Author => "MeowServerOwner";
public override Version Version => new Version(1, 4, 2);
public override Version Version => new (1, 4, 2);

public override void OnEnabled()
{
Expand All @@ -60,7 +59,9 @@ public override void OnDisabled()
Exiled.Events.Handlers.Server.RoundEnded -= MessagesList.ClearMessageList;

base.OnDisabled();
#pragma warning disable CS8625 //null。
Instance = null;
#pragma warning restore CS8625 //null。
}
}

Expand Down
Loading