mirror of
https://github.com/ClassiCube/MCGalaxy.git
synced 2025-09-22 20:16:36 -04:00
Change Warps to be an internal module, and lazy load warps/waypoints only when actually required
This commit is contained in:
parent
bd55a9e608
commit
9ead72b356
@ -32,7 +32,7 @@ namespace MCGalaxy
|
|||||||
public virtual string shortcut { get { return ""; } }
|
public virtual string shortcut { get { return ""; } }
|
||||||
/// <summary> The type/group of this command (see `CommandTypes` class) </summary>
|
/// <summary> The type/group of this command (see `CommandTypes` class) </summary>
|
||||||
public abstract string type { get; }
|
public abstract string type { get; }
|
||||||
/// <summary> Whether this comand can be used in museums </summary>
|
/// <summary> Whether this command can be used in museums </summary>
|
||||||
/// <remarks> Level altering (e.g. places a block) commands should return false </remarks>
|
/// <remarks> Level altering (e.g. places a block) commands should return false </remarks>
|
||||||
public virtual bool museumUsable { get { return true; } }
|
public virtual bool museumUsable { get { return true; } }
|
||||||
/// <summary> The default minimum rank that is required to use this command </summary>
|
/// <summary> The default minimum rank that is required to use this command </summary>
|
||||||
|
@ -25,7 +25,6 @@ namespace MCGalaxy.Core {
|
|||||||
CheckReviewList(p);
|
CheckReviewList(p);
|
||||||
if (p.CanUse("ReachDistance")) LoadReach(p);
|
if (p.CanUse("ReachDistance")) LoadReach(p);
|
||||||
|
|
||||||
LoadWaypoints(p);
|
|
||||||
p.Ignores.Load(p);
|
p.Ignores.Load(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,14 +50,5 @@ namespace MCGalaxy.Core {
|
|||||||
p.ReachDistance = reachDist / 32f;
|
p.ReachDistance = reachDist / 32f;
|
||||||
p.Session.SendSetReach(p.ReachDistance);
|
p.Session.SendSetReach(p.ReachDistance);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadWaypoints(Player p) {
|
|
||||||
try {
|
|
||||||
p.Waypoints.Filename = Paths.WaypointsDir + p.name + ".save";
|
|
||||||
p.Waypoints.Load();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
Logger.LogError("Error loading waypoints", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -317,8 +317,6 @@
|
|||||||
<Compile Include="Commands\World\CmdNewLvl.cs" />
|
<Compile Include="Commands\World\CmdNewLvl.cs" />
|
||||||
<Compile Include="Commands\World\CmdOverseer.cs" />
|
<Compile Include="Commands\World\CmdOverseer.cs" />
|
||||||
<Compile Include="Commands\World\CmdPause.cs" />
|
<Compile Include="Commands\World\CmdPause.cs" />
|
||||||
<Compile Include="Commands\World\CmdWarp.cs" />
|
|
||||||
<Compile Include="Commands\World\CmdWaypoint.cs" />
|
|
||||||
<Compile Include="Commands\World\CmdPhysics.cs" />
|
<Compile Include="Commands\World\CmdPhysics.cs" />
|
||||||
<Compile Include="Commands\World\CmdRenameLvl.cs" />
|
<Compile Include="Commands\World\CmdRenameLvl.cs" />
|
||||||
<Compile Include="Commands\World\CmdResizeLvl.cs" />
|
<Compile Include="Commands\World\CmdResizeLvl.cs" />
|
||||||
@ -604,6 +602,11 @@
|
|||||||
<Compile Include="Modules\Relay\RelayBot.cs" />
|
<Compile Include="Modules\Relay\RelayBot.cs" />
|
||||||
<Compile Include="Modules\Relay\RelayBotCmd.cs" />
|
<Compile Include="Modules\Relay\RelayBotCmd.cs" />
|
||||||
<Compile Include="Modules\Security\IPThrottler.cs" />
|
<Compile Include="Modules\Security\IPThrottler.cs" />
|
||||||
|
<Compile Include="Modules\Warps\CmdWarp.cs" />
|
||||||
|
<Compile Include="Modules\Warps\CmdWaypoint.cs" />
|
||||||
|
<Compile Include="Modules\Warps\Warp.cs" />
|
||||||
|
<Compile Include="Modules\Warps\WarpCommand.cs" />
|
||||||
|
<Compile Include="Modules\Warps\WarpPlugin.cs" />
|
||||||
<Compile Include="Network\BaseWebSocket.cs" />
|
<Compile Include="Network\BaseWebSocket.cs" />
|
||||||
<Compile Include="Network\ClassicProtocol.cs" />
|
<Compile Include="Network\ClassicProtocol.cs" />
|
||||||
<Compile Include="Network\CPESupport.cs" />
|
<Compile Include="Network\CPESupport.cs" />
|
||||||
@ -634,7 +637,6 @@
|
|||||||
<Compile Include="Player\PlayerOperations.cs" />
|
<Compile Include="Player\PlayerOperations.cs" />
|
||||||
<Compile Include="Player\PlayerPhysics.cs" />
|
<Compile Include="Player\PlayerPhysics.cs" />
|
||||||
<Compile Include="Player\SpamChecker.cs" />
|
<Compile Include="Player\SpamChecker.cs" />
|
||||||
<Compile Include="Player\Warp.cs" />
|
|
||||||
<Compile Include="Database\Undo\UndoFormat.cs" />
|
<Compile Include="Database\Undo\UndoFormat.cs" />
|
||||||
<Compile Include="Network\Player.Networking.cs" />
|
<Compile Include="Network\Player.Networking.cs" />
|
||||||
<Compile Include="Scripting\Plugin.cs" />
|
<Compile Include="Scripting\Plugin.cs" />
|
||||||
@ -710,7 +712,9 @@
|
|||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup />
|
<ItemGroup>
|
||||||
|
<Folder Include="Modules\Warps" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
|
@ -58,6 +58,15 @@ namespace MCGalaxy.Modules.Awards
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary> Finds partial matches of 'name' against the list of all awards </summary>
|
||||||
|
public static string FindMatch(Player p, string name) {
|
||||||
|
int matches;
|
||||||
|
Award award = Matcher.Find(p, name, out matches, Awards,
|
||||||
|
null, a => a.Name, "awards");
|
||||||
|
return award == null ? null : award.Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static readonly object saveLock = new object();
|
static readonly object saveLock = new object();
|
||||||
public static void Save() {
|
public static void Save() {
|
||||||
lock (saveLock)
|
lock (saveLock)
|
||||||
|
@ -35,9 +35,11 @@ namespace MCGalaxy.Modules.Awards
|
|||||||
|
|
||||||
string[] args = message.SplitSpaces(2);
|
string[] args = message.SplitSpaces(2);
|
||||||
if (args.Length < 2) { Help(p); return; }
|
if (args.Length < 2) { Help(p); return; }
|
||||||
|
|
||||||
string plName = PlayerInfo.FindMatchesPreferOnline(p, args[0]);
|
string plName = PlayerInfo.FindMatchesPreferOnline(p, args[0]);
|
||||||
if (plName == null) return;
|
if (plName == null) return;
|
||||||
string award = Matcher.FindAwards(p, args[1]);
|
|
||||||
|
string award = AwardsList.FindMatch(p, args[1]);
|
||||||
if (award == null) { p.Message("Use &T/Awards &Sfor a list of awards"); return; }
|
if (award == null) { p.Message("Use &T/Awards &Sfor a list of awards"); return; }
|
||||||
|
|
||||||
string displayName = p.FormatNick(plName);
|
string displayName = p.FormatNick(plName);
|
||||||
|
46
MCGalaxy/Modules/Warps/CmdWarp.cs
Normal file
46
MCGalaxy/Modules/Warps/CmdWarp.cs
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2011 MCForge
|
||||||
|
|
||||||
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
|
not use this file except in compliance with the Licenses. You may
|
||||||
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
|
https://opensource.org/license/ecl-2-0/
|
||||||
|
https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
or implied. See the Licenses for the specific language governing
|
||||||
|
permissions and limitations under the Licenses.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using MCGalaxy.Commands;
|
||||||
|
using MCGalaxy.Maths;
|
||||||
|
|
||||||
|
namespace MCGalaxy.Modules.Warps
|
||||||
|
{
|
||||||
|
class CmdWarp : WarpCommand
|
||||||
|
{
|
||||||
|
public override string name { get { return "Warp"; } }
|
||||||
|
public override CommandPerm[] ExtraPerms {
|
||||||
|
get { return new[] { new CommandPerm(LevelPermission.Operator, "can manage warps") }; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Use(Player p, string message, CommandData data) {
|
||||||
|
if (WarpList.Global == null)
|
||||||
|
WarpList.Global = LoadList("extra/warps.save");
|
||||||
|
|
||||||
|
UseCore(p, message, data, WarpList.Global, "Warp");
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Help(Player p) {
|
||||||
|
p.Message("&T/Warp [name] &H- Move to that warp");
|
||||||
|
p.Message("&T/Warp list &H- List all the warps");
|
||||||
|
p.Message("&T/Warp create [name] &H- Create a warp at your position");
|
||||||
|
p.Message("&T/Warp delete [name] &H- Deletes a warp");
|
||||||
|
p.Message("&T/Warp move [name] &H- Moves a warp to your position");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -17,15 +17,22 @@
|
|||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
namespace MCGalaxy.Commands.World {
|
namespace MCGalaxy.Modules.Warps
|
||||||
public sealed class CmdWaypoint : CmdWarp {
|
{
|
||||||
|
sealed class CmdWaypoint : WarpCommand
|
||||||
|
{
|
||||||
public override string name { get { return "Waypoint"; } }
|
public override string name { get { return "Waypoint"; } }
|
||||||
public override string shortcut { get { return "wp"; } }
|
public override string shortcut { get { return "wp"; } }
|
||||||
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
public override LevelPermission defaultRank { get { return LevelPermission.Builder; } }
|
||||||
public override CommandPerm[] ExtraPerms { get { return null; } }
|
|
||||||
|
|
||||||
public override void Use(Player p, string message, CommandData data) {
|
public override void Use(Player p, string message, CommandData data) {
|
||||||
UseCore(p, message, data, p.Waypoints, "Waypoint");
|
if (!p.Extras.Contains("MCG_WAYPOINTS")) {
|
||||||
|
p.Extras["MCG_WAYPOINTS"] = LoadList(Paths.WAYPOINTS_DIR + p.name + ".save");
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Better thread safety
|
||||||
|
WarpList waypoints = (WarpList)p.Extras["MCG_WAYPOINTS"];
|
||||||
|
UseCore(p, message, data, waypoints, "Waypoint");
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
public override void Help(Player p) {
|
@ -16,10 +16,11 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace MCGalaxy {
|
namespace MCGalaxy.Modules.Warps
|
||||||
|
{
|
||||||
/// <summary> A named pair of position and orientation, located on a particular map. </summary>
|
/// <summary> A named pair of position and orientation, located on a particular map. </summary>
|
||||||
public class Warp {
|
public class Warp
|
||||||
|
{
|
||||||
/// <summary> Position of this warp. </summary>
|
/// <summary> Position of this warp. </summary>
|
||||||
public Position Pos;
|
public Position Pos;
|
||||||
/// <summary> Orientation of this warp. </summary>
|
/// <summary> Orientation of this warp. </summary>
|
||||||
@ -30,13 +31,15 @@ namespace MCGalaxy {
|
|||||||
public string Level;
|
public string Level;
|
||||||
}
|
}
|
||||||
|
|
||||||
public sealed class WarpList {
|
public sealed class WarpList
|
||||||
public static WarpList Global = new WarpList();
|
{
|
||||||
|
public static WarpList Global;
|
||||||
public List<Warp> Items = new List<Warp>();
|
public List<Warp> Items = new List<Warp>();
|
||||||
public string Filename;
|
public string Filename;
|
||||||
|
|
||||||
public Warp Find(string name) {
|
public Warp Find(string name) {
|
||||||
foreach (Warp wp in Items) {
|
foreach (Warp wp in Items)
|
||||||
|
{
|
||||||
if (wp.Name.CaselessEq(name)) return wp;
|
if (wp.Name.CaselessEq(name)) return wp;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
@ -81,6 +84,16 @@ namespace MCGalaxy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary> Find partial matches of 'name' against this list of warps. </summary>
|
||||||
|
public Warp FindMatch(Player p, string name) {
|
||||||
|
string group = (this == Global) ? "warps" : "waypoints";
|
||||||
|
int matches;
|
||||||
|
|
||||||
|
return Matcher.Find(p, name, out matches, Items,
|
||||||
|
null, wp => wp.Name, group);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void Load() {
|
public void Load() {
|
||||||
if (!File.Exists(Filename)) return;
|
if (!File.Exists(Filename)) return;
|
||||||
List<Warp> warps = new List<Warp>();
|
List<Warp> warps = new List<Warp>();
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2011 MCForge
|
Copyright 2011 MCForge
|
||||||
|
|
||||||
Dual-licensed under the Educational Community License, Version 2.0 and
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
@ -16,22 +16,16 @@
|
|||||||
permissions and limitations under the Licenses.
|
permissions and limitations under the Licenses.
|
||||||
*/
|
*/
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using MCGalaxy.Commands;
|
||||||
using MCGalaxy.Maths;
|
using MCGalaxy.Maths;
|
||||||
|
|
||||||
namespace MCGalaxy.Commands.World {
|
namespace MCGalaxy.Modules.Warps
|
||||||
public class CmdWarp : Command2 {
|
{
|
||||||
public override string name { get { return "Warp"; } }
|
abstract class WarpCommand : Command2
|
||||||
|
{
|
||||||
public override string type { get { return CommandTypes.World; } }
|
public override string type { get { return CommandTypes.World; } }
|
||||||
public override bool museumUsable { get { return false; } }
|
public override bool museumUsable { get { return false; } }
|
||||||
public override bool SuperUseable { get { return false; } }
|
public override bool SuperUseable { get { return false; } }
|
||||||
public override CommandPerm[] ExtraPerms {
|
|
||||||
get { return new[] { new CommandPerm(LevelPermission.Operator, "can manage warps") }; }
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void Use(Player p, string message, CommandData data) {
|
|
||||||
UseCore(p, message, data, WarpList.Global, "Warp");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void PrintWarp(Player p, Warp warp) {
|
static void PrintWarp(Player p, Warp warp) {
|
||||||
Vec3S32 pos = warp.Pos.BlockCoords;
|
Vec3S32 pos = warp.Pos.BlockCoords;
|
||||||
@ -52,7 +46,7 @@ namespace MCGalaxy.Commands.World {
|
|||||||
group + " list", group + "s", modifier);
|
group + " list", group + "s", modifier);
|
||||||
return;
|
return;
|
||||||
} else if (args.Length == 1) {
|
} else if (args.Length == 1) {
|
||||||
Warp warp = Matcher.FindWarps(p, warps, cmd);
|
Warp warp = warps.FindMatch(p, cmd);
|
||||||
if (warp != null) warps.Goto(warp, p);
|
if (warp != null) warps.Goto(warp, p);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -66,32 +60,32 @@ namespace MCGalaxy.Commands.World {
|
|||||||
p.Message("{0} {1} created.", group, name);
|
p.Message("{0} {1} created.", group, name);
|
||||||
} else if (IsDeleteAction(cmd)) {
|
} else if (IsDeleteAction(cmd)) {
|
||||||
if (checkExtraPerms && !CheckExtraPerm(p, data, 1)) return;
|
if (checkExtraPerms && !CheckExtraPerm(p, data, 1)) return;
|
||||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
Warp warp = warps.FindMatch(p, name);
|
||||||
if (warp == null) return;
|
if (warp == null) return;
|
||||||
|
|
||||||
warps.Remove(warp, p);
|
warps.Remove(warp, p);
|
||||||
p.Message("{0} {1} deleted.", group, warp.Name);
|
p.Message("{0} {1} deleted.", group, warp.Name);
|
||||||
} else if (IsEditAction(cmd)) {
|
} else if (IsEditAction(cmd)) {
|
||||||
if (checkExtraPerms && !CheckExtraPerm(p, data, 1)) return;
|
if (checkExtraPerms && !CheckExtraPerm(p, data, 1)) return;
|
||||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
Warp warp = warps.FindMatch(p, name);
|
||||||
if (warp == null) return;
|
if (warp == null) return;
|
||||||
|
|
||||||
warps.Update(warp, p);
|
warps.Update(warp, p);
|
||||||
p.Message("{0} {1} moved.", group, warp.Name);
|
p.Message("{0} {1} moved.", group, warp.Name);
|
||||||
} else if (cmd.CaselessEq("goto")) {
|
} else if (cmd.CaselessEq("goto")) {
|
||||||
Warp warp = Matcher.FindWarps(p, warps, name);
|
Warp warp = warps.FindMatch(p, name);
|
||||||
if (warp != null) warps.Goto(warp, p);
|
if (warp != null) warps.Goto(warp, p);
|
||||||
} else {
|
} else {
|
||||||
Help(p);
|
Help(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Help(Player p) {
|
protected static WarpList LoadList(string path) {
|
||||||
p.Message("&T/Warp [name] &H- Move to that warp");
|
WarpList list = new WarpList();
|
||||||
p.Message("&T/Warp list &H- List all the warps");
|
|
||||||
p.Message("&T/Warp create [name] &H- Create a warp at your position");
|
list.Filename = path;
|
||||||
p.Message("&T/Warp delete [name] &H- Deletes a warp");
|
list.Load();
|
||||||
p.Message("&T/Warp move [name] &H- Moves a warp to your position");
|
return list;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
48
MCGalaxy/Modules/Warps/WarpPlugin.cs
Normal file
48
MCGalaxy/Modules/Warps/WarpPlugin.cs
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2015 MCGalaxy
|
||||||
|
|
||||||
|
Dual-licensed under the Educational Community License, Version 2.0 and
|
||||||
|
the GNU General Public License, Version 3 (the "Licenses"); you may
|
||||||
|
not use this file except in compliance with the Licenses. You may
|
||||||
|
obtain a copy of the Licenses at
|
||||||
|
|
||||||
|
https://opensource.org/license/ecl-2-0/
|
||||||
|
https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
|
||||||
|
Unless required by applicable law or agreed to in writing,
|
||||||
|
software distributed under the Licenses are distributed on an "AS IS"
|
||||||
|
BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
|
||||||
|
or implied. See the Licenses for the specific language governing
|
||||||
|
permissions and limitations under the Licenses.
|
||||||
|
*/
|
||||||
|
using System;
|
||||||
|
using MCGalaxy.Events.ServerEvents;
|
||||||
|
|
||||||
|
namespace MCGalaxy.Modules.Warps
|
||||||
|
{
|
||||||
|
public sealed class WarpsPlugin : Plugin
|
||||||
|
{
|
||||||
|
public override string name { get { return "Warps"; } }
|
||||||
|
|
||||||
|
Command cmdWarps = new CmdWarp();
|
||||||
|
Command cmdWaypoints = new CmdWaypoint();
|
||||||
|
|
||||||
|
public override void Load(bool startup) {
|
||||||
|
Server.EnsureDirectoryExists(Paths.WAYPOINTS_DIR);
|
||||||
|
OnConfigUpdatedEvent.Register(OnConfigUpdated, Priority.Low);
|
||||||
|
|
||||||
|
Command.Register(cmdWarps);
|
||||||
|
Command.Register(cmdWaypoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Unload(bool shutdown) {
|
||||||
|
OnConfigUpdatedEvent.Unregister(OnConfigUpdated);
|
||||||
|
Command.Unregister(cmdWarps, cmdWaypoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void OnConfigUpdated() {
|
||||||
|
if (WarpList.Global == null) return;
|
||||||
|
WarpList.Global.Load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -221,7 +221,6 @@ namespace MCGalaxy {
|
|||||||
internal DateTime cmdUnblocked;
|
internal DateTime cmdUnblocked;
|
||||||
List<DateTime> partialLog;
|
List<DateTime> partialLog;
|
||||||
|
|
||||||
public WarpList Waypoints;
|
|
||||||
public DateTime LastPatrol;
|
public DateTime LastPatrol;
|
||||||
public LevelPermission Rank { get { return group.Permission; } }
|
public LevelPermission Rank { get { return group.Permission; } }
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ namespace MCGalaxy {
|
|||||||
SetIP(Socket.IP);
|
SetIP(Socket.IP);
|
||||||
|
|
||||||
CriticalTasks = new VolatileArray<SchedulerTask>();
|
CriticalTasks = new VolatileArray<SchedulerTask>();
|
||||||
Waypoints = new WarpList();
|
|
||||||
|
|
||||||
spamChecker = new SpamChecker(this);
|
spamChecker = new SpamChecker(this);
|
||||||
partialLog = new List<DateTime>(20);
|
partialLog = new List<DateTime>(20);
|
||||||
|
@ -18,15 +18,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using MCGalaxy.Core;
|
using MCGalaxy.Core;
|
||||||
using MCGalaxy.Modules.Games.Countdown;
|
|
||||||
using MCGalaxy.Modules.Games.CTF;
|
|
||||||
using MCGalaxy.Modules.Games.LS;
|
|
||||||
using MCGalaxy.Modules.Games.TW;
|
|
||||||
using MCGalaxy.Modules.Games.ZS;
|
|
||||||
using MCGalaxy.Modules.Moderation.Notes;
|
|
||||||
using MCGalaxy.Modules.Relay.Discord;
|
|
||||||
using MCGalaxy.Modules.Relay.IRC;
|
|
||||||
using MCGalaxy.Modules.Security;
|
|
||||||
using MCGalaxy.Scripting;
|
using MCGalaxy.Scripting;
|
||||||
|
|
||||||
namespace MCGalaxy
|
namespace MCGalaxy
|
||||||
@ -134,20 +125,21 @@ namespace MCGalaxy
|
|||||||
|
|
||||||
public static void LoadAll() {
|
public static void LoadAll() {
|
||||||
LoadCorePlugin(new CorePlugin());
|
LoadCorePlugin(new CorePlugin());
|
||||||
LoadCorePlugin(new NotesPlugin());
|
|
||||||
LoadCorePlugin(new DiscordPlugin());
|
|
||||||
LoadCorePlugin(new IRCPlugin());
|
|
||||||
LoadCorePlugin(new IPThrottler());
|
|
||||||
|
|
||||||
|
LoadCorePlugin(new MCGalaxy.Modules.Moderation.Notes.NotesPlugin());
|
||||||
|
LoadCorePlugin(new MCGalaxy.Modules.Relay.Discord.DiscordPlugin());
|
||||||
|
LoadCorePlugin(new MCGalaxy.Modules.Relay.IRC.IRCPlugin());
|
||||||
|
LoadCorePlugin(new MCGalaxy.Modules.Security.IPThrottler());
|
||||||
#if !MCG_STANDALONE
|
#if !MCG_STANDALONE
|
||||||
LoadCorePlugin(new MCGalaxy.Modules.Compiling.CompilerPlugin());
|
LoadCorePlugin(new MCGalaxy.Modules.Compiling.CompilerPlugin());
|
||||||
#endif
|
#endif
|
||||||
|
LoadCorePlugin(new MCGalaxy.Modules.Warps.WarpsPlugin());
|
||||||
|
|
||||||
LoadCorePlugin(new CountdownPlugin());
|
LoadCorePlugin(new MCGalaxy.Modules.Games.Countdown.CountdownPlugin());
|
||||||
LoadCorePlugin(new CTFPlugin());
|
LoadCorePlugin(new MCGalaxy.Modules.Games.CTF.CTFPlugin());
|
||||||
LoadCorePlugin(new LSPlugin());
|
LoadCorePlugin(new MCGalaxy.Modules.Games.LS.LSPlugin());
|
||||||
LoadCorePlugin(new TWPlugin());
|
LoadCorePlugin(new MCGalaxy.Modules.Games.TW.TWPlugin());
|
||||||
LoadCorePlugin(new ZSPlugin());
|
LoadCorePlugin(new MCGalaxy.Modules.Games.ZS.ZSPlugin());
|
||||||
|
|
||||||
IScripting.AutoloadPlugins();
|
IScripting.AutoloadPlugins();
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,7 @@ namespace MCGalaxy
|
|||||||
public const string CPEDisabledFile = "properties/cpe.properties";
|
public const string CPEDisabledFile = "properties/cpe.properties";
|
||||||
|
|
||||||
public const string ImportsDir = "extra/import/";
|
public const string ImportsDir = "extra/import/";
|
||||||
public const string WaypointsDir = "extra/Waypoints/";
|
public const string WAYPOINTS_DIR = "extra/Waypoints/";
|
||||||
|
|
||||||
/// <summary> Relative path of the file containing a map's bots. </summary>
|
/// <summary> Relative path of the file containing a map's bots. </summary>
|
||||||
public static string BotsPath(string map) { return "extra/bots/" + map + ".json"; }
|
public static string BotsPath(string map) { return "extra/bots/" + map + ".json"; }
|
||||||
|
@ -138,7 +138,6 @@ namespace MCGalaxy
|
|||||||
PlayerDB.EnsureDirectoriesExist();
|
PlayerDB.EnsureDirectoriesExist();
|
||||||
|
|
||||||
EnsureDirectoryExists("extra");
|
EnsureDirectoryExists("extra");
|
||||||
EnsureDirectoryExists(Paths.WaypointsDir);
|
|
||||||
EnsureDirectoryExists("extra/bots");
|
EnsureDirectoryExists("extra/bots");
|
||||||
EnsureDirectoryExists(Paths.ImportsDir);
|
EnsureDirectoryExists(Paths.ImportsDir);
|
||||||
EnsureDirectoryExists("blockdefs");
|
EnsureDirectoryExists("blockdefs");
|
||||||
@ -172,8 +171,6 @@ namespace MCGalaxy
|
|||||||
AwardsList.Load();
|
AwardsList.Load();
|
||||||
PlayerAwards.Load();
|
PlayerAwards.Load();
|
||||||
Economy.Load();
|
Economy.Load();
|
||||||
WarpList.Global.Filename = "extra/warps.save";
|
|
||||||
WarpList.Global.Load();
|
|
||||||
CommandExtraPerms.Load();
|
CommandExtraPerms.Load();
|
||||||
ProfanityFilter.Init();
|
ProfanityFilter.Init();
|
||||||
Team.LoadList();
|
Team.LoadList();
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using MCGalaxy.Modules.Awards;
|
|
||||||
|
|
||||||
namespace MCGalaxy
|
namespace MCGalaxy
|
||||||
{
|
{
|
||||||
@ -26,14 +25,6 @@ namespace MCGalaxy
|
|||||||
/// <remarks> returns number of matches found, and the matching item if only 1 match is found. </remarks>
|
/// <remarks> returns number of matches found, and the matching item if only 1 match is found. </remarks>
|
||||||
public static class Matcher
|
public static class Matcher
|
||||||
{
|
{
|
||||||
/// <summary> Finds partial matches of 'name' against the list of all awards. </summary>
|
|
||||||
public static string FindAwards(Player p, string name) {
|
|
||||||
int matches;
|
|
||||||
Award award = Find(p, name, out matches, AwardsList.Awards,
|
|
||||||
null, a => a.Name, "awards");
|
|
||||||
return award == null ? null : award.Name;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Finds partial matches of 'color' against the list of colors. </summary>
|
/// <summary> Finds partial matches of 'color' against the list of colors. </summary>
|
||||||
public static string FindColor(Player p, string color) {
|
public static string FindColor(Player p, string color) {
|
||||||
int matches;
|
int matches;
|
||||||
@ -72,14 +63,6 @@ namespace MCGalaxy
|
|||||||
null, g => Colors.Strip(g.Name), g => g.ColoredName, "ranks");
|
null, g => Colors.Strip(g.Name), g => g.ColoredName, "ranks");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> Find partial matches of 'name' against a list of warps. </summary>
|
|
||||||
public static Warp FindWarps(Player p, WarpList warps, string name) {
|
|
||||||
string group = (warps == WarpList.Global) ? "warps" : "waypoints";
|
|
||||||
int matches;
|
|
||||||
return Find(p, name, out matches, warps.Items,
|
|
||||||
null, wp => wp.Name, group);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary> Find partial matches of 'name' against the list of zones in a map. </summary>
|
/// <summary> Find partial matches of 'name' against the list of zones in a map. </summary>
|
||||||
public static Zone FindZones(Player p, Level lvl, string name) {
|
public static Zone FindZones(Player p, Level lvl, string name) {
|
||||||
int matches;
|
int matches;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user