-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpluton.cs
More file actions
133 lines (105 loc) · 4.78 KB
/
pluton.cs
File metadata and controls
133 lines (105 loc) · 4.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
namespace Pluton.Rust
{
using System;
using System.Linq;
using Objects;
using Core;
using Core.PluginLoaders;
[ConsoleSystem.Factory("pluton")]
public class pluton : ConsoleSystem
{
[ConsoleSystem.Admin, ConsoleSystem.Help("Helps to break basic functionality", "")]
public static bool enabled;
[ConsoleSystem.Admin, ConsoleSystem.Help("Measure perfomance of method calls.", "")]
public static bool stopper;
static pluton()
{
pluton.enabled = true;
pluton.stopper = false;
}
[ConsoleSystem.Admin]
public static void ban(ConsoleSystem.Arg arg)
{
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Ban("Banned by: " + nameFrom);
Server.GetInstance().Broadcast(arg.ArgsStr + " is banned from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is banned!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
[ConsoleSystem.Admin]
public static void kick(ConsoleSystem.Arg arg)
{
Player player = Player.Find(arg.ArgsStr);
if (player != null) {
string nameFrom;
if (arg.connection != null && arg.connection.username != null)
nameFrom = arg.connection.username;
else
nameFrom = "RCON";
player.Kick("Kicked by: " + nameFrom);
Server.GetInstance().Broadcast(arg.ArgsStr + " is kicked from the server by " + nameFrom + "!");
arg.ReplyWith(arg.ArgsStr + " is kicked!");
} else {
arg.ReplyWith("Couldn't find player: " + arg.ArgsStr);
}
}
[ConsoleSystem.User, ConsoleSystem.Help("pluton.login <rcon.password>", "")]
public static void login(ConsoleSystem.Arg arg)
{
if (arg.connection != null && arg.ArgsStr == rcon.password) {
ServerUsers.Set(arg.connection.userid,
ServerUsers.UserGroup.Moderator,
arg.connection.username,
"Console login!");
ServerUsers.Save();
arg.ReplyWith("You are a moderator now!");
}
}
[ConsoleSystem.Admin, ConsoleSystem.Help("pluton.reload <optional = plugin name>", "")]
public static void reload(ConsoleSystem.Arg arg)
{
if (PluginLoader.GetInstance().Plugins.ContainsKey(arg.ArgsStr)) {
PluginLoader.GetInstance().ReloadPlugin(arg.ArgsStr);
arg.ReplyWith(String.Format("{0} plugin reloaded!", arg.ArgsStr));
} else if (arg.ArgsStr == "") {
DirectoryConfig.GetInstance().Reload();
CoreConfig.GetInstance().Reload();
Config.GetInstance().Reload();
Server.GetInstance().LoadLoadouts();
if (Server.GetInstance().Loaded)
Hooks.On_ServerInit();
PluginLoader.GetInstance().ReloadPlugins();
arg.ReplyWith("Pluton reloaded!");
var planes = (from plane in UnityEngine.Object.FindObjectsOfType<CargoPlane>()
where plane.transform.position.y < 10f
select plane).ToList();
if (planes.Count != 0) {
planes.ForEach(p => p.SendMessage("KillMessage",
UnityEngine.SendMessageOptions.DontRequireReceiver));
Logger.LogWarning(String.Format("Destroyed {0} plane at Vector3.zero", planes.Count));
}
} else {
arg.ReplyWith(String.Format("Couldn't find plugin: {0}!", arg.ArgsStr));
}
}
[ConsoleSystem.Admin, ConsoleSystem.Help("Manually saves stats, server", "")]
public static void saveall(ConsoleSystem.Arg arg)
{
Core.Bootstrap.SaveAll();
arg.ReplyWith("Everything saved!");
}
[ConsoleSystem.Admin, ConsoleSystem.Help("Prints some data to the server console.", "")]
public static void status(ConsoleSystem.Arg arg)
{
arg.ReplyWith($"Instances:\r\n{CountedInstance.InstanceReportText()}\r\n{plugins.Loaded()}{plugins.Hooks()}");
}
}
}