-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed tpa not working in players with similar names
- Loading branch information
1 parent
516f5a8
commit 7cebfd9
Showing
7 changed files
with
453 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
bin | ||
obj | ||
.vs | ||
bin | ||
obj | ||
.vs | ||
.vscode |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,65 @@ | ||
using Rocket.API; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using SDG.Unturned; | ||
|
||
namespace SimpleTPA.Commands | ||
{ | ||
internal class Tpa : IRocketCommand | ||
{ | ||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "tpa"; | ||
|
||
public string Help => "Teleport to a player"; | ||
|
||
public string Syntax => "/tpa [playerName]"; | ||
|
||
public List<string> Aliases => new(); | ||
|
||
public List<string> Permissions => new(); | ||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
if (caller is not UnturnedPlayer) | ||
{ | ||
UnturnedChat.Say(caller, SimpleTPAPlugin.instance!.Translate("Invalid_Player"), Palette.COLOR_R); | ||
return; | ||
}; | ||
|
||
if (command[0].Length < 1) | ||
{ | ||
UnturnedChat.Say(caller, SimpleTPAPlugin.instance!.Translate("Invalid_Arguments"), Palette.COLOR_R); | ||
return; | ||
} | ||
|
||
UnturnedPlayer playerCommanded = (UnturnedPlayer)caller; | ||
UnturnedPlayer playerParameter = UnturnedPlayer.FromName(command[0]); | ||
|
||
switch (command[0].ToLower()) | ||
{ | ||
#region abort | ||
case "ab": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAbort(playerCommanded); return; | ||
case "abort": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAbort(playerCommanded); return; | ||
#endregion | ||
#region deny | ||
case "d": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaDeny(playerCommanded); return; | ||
case "deny": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaDeny(playerCommanded); return; | ||
#endregion | ||
#region accept | ||
case "a": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAccept(playerCommanded); return; | ||
case "accept": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAccept(playerCommanded); return; | ||
#endregion | ||
|
||
default: | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaRequest(playerCommanded, playerParameter); return; | ||
} | ||
} | ||
} | ||
} | ||
using Rocket.API; | ||
using Rocket.Unturned.Chat; | ||
using Rocket.Unturned.Player; | ||
using SDG.Unturned; | ||
|
||
namespace SimpleTPA.Commands | ||
{ | ||
internal class Tpa : IRocketCommand | ||
{ | ||
public AllowedCaller AllowedCaller => AllowedCaller.Player; | ||
|
||
public string Name => "tpa"; | ||
|
||
public string Help => "Teleport to a player"; | ||
|
||
public string Syntax => "/tpa [playerName]"; | ||
|
||
public List<string> Aliases => new(); | ||
|
||
public List<string> Permissions => new(); | ||
|
||
public void Execute(IRocketPlayer caller, string[] command) | ||
{ | ||
if (caller is not UnturnedPlayer) | ||
{ | ||
UnturnedChat.Say(caller, SimpleTPAPlugin.instance!.Translate("Invalid_Player"), Palette.COLOR_R); | ||
return; | ||
}; | ||
|
||
if (command[0].Length < 1) | ||
{ | ||
UnturnedChat.Say(caller, SimpleTPAPlugin.instance!.Translate("Invalid_Arguments"), Palette.COLOR_R); | ||
return; | ||
} | ||
|
||
UnturnedPlayer playerCommanded = (UnturnedPlayer)caller; | ||
UnturnedPlayer playerParameter = UnturnedPlayer.FromName(command[0]); | ||
|
||
switch (command[0].ToLower()) | ||
{ | ||
#region abort | ||
case "ab": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAbort(playerCommanded); return; | ||
case "abort": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAbort(playerCommanded); return; | ||
#endregion | ||
#region deny | ||
case "d": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaDeny(playerCommanded); return; | ||
case "deny": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaDeny(playerCommanded); return; | ||
#endregion | ||
#region accept | ||
case "a": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAccept(playerCommanded); return; | ||
case "accept": | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaAccept(playerCommanded); return; | ||
#endregion | ||
|
||
default: | ||
SimpleTPAPlugin.instance!.tpaSystem!.TpaRequest(playerCommanded, playerParameter); return; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
# Simple TPA | ||
Add 4 new command to the unturned server | ||
- /tpa playername : request a teleport for the desired player | ||
- /tpa accept : accept the teleport request | ||
- /tpa deny : denied the request received | ||
- /tpa abort : abort accepted request | ||
|
||
### Configurations | ||
- TickrateToExpire: time to a tpa request expire, calculation: Seconds * ServerTickrate | ||
- TickrateToTeleport: time to player teleport to other player | ||
- ServerTickrate: Actual server tickrate from ``Rocket.config``, used to calculate tickrate seconds | ||
|
||
# Building | ||
|
||
*Windows*: The project uses dotnet 4.8, consider installing into your machine, you need visual studio, simple open the solution file open the Build section and hit the build button (ctrl + shift + b) or you can do into powershell the command dotnet build -c Debug if you have installed dotnet 4.8. | ||
|
||
*Linux*: Install dotnet-sdk from your distro package manager, open the root folder of this project and type ``dotnet build -c Debug``. | ||
|
||
FTM License. | ||
# Simple TPA | ||
Add 4 new command to the unturned server | ||
- /tpa playername : request a teleport for the desired player | ||
- /tpa accept : accept the teleport request | ||
- /tpa deny : denied the request received | ||
- /tpa abort : abort accepted request | ||
|
||
### Configurations | ||
- TickrateToExpire: time to a tpa request expire, calculation: Seconds * ServerTickrate | ||
- TickrateToTeleport: time to player teleport to other player | ||
- ServerTickrate: Actual server tickrate from ``Rocket.config``, used to calculate tickrate seconds | ||
|
||
# Building | ||
|
||
*Windows*: The project uses dotnet 4.8, consider installing into your machine, you need visual studio, simple open the solution file open the Build section and hit the build button (ctrl + shift + b) or you can do into powershell the command dotnet build -c Debug if you have installed dotnet 4.8. | ||
|
||
*Linux*: Install dotnet-sdk from your distro package manager, open the root folder of this project and type ``dotnet build -c Debug``. | ||
|
||
FTM License. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,39 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net4.8</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>10</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>..\SkinRestriction-master\Libs\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="com.rlabrecque.steamworks.net"> | ||
<HintPath>..\SkinRestriction-master\Libs\com.rlabrecque.steamworks.net.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.API"> | ||
<HintPath>..\SkinRestriction-master\Libs\Rocket.API.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.Core"> | ||
<HintPath>..\SkinRestriction-master\Libs\Rocket.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.Unturned"> | ||
<HintPath>..\SkinRestriction-master\Libs\Rocket.Unturned.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>..\SkinRestriction-master\Libs\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>Libs\UnityEngine.CoreModule.dll</HintPath> | ||
<Aliases>UnityEngineCoreModule</Aliases> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
</Project> | ||
|
||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net4.8</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
<LangVersion>10</LangVersion> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="AntiCombatLogout"> | ||
<HintPath>Libs\AntiCombatLogout.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>Libs\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="com.rlabrecque.steamworks.net"> | ||
<HintPath>Libs\com.rlabrecque.steamworks.net.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.API"> | ||
<HintPath>Libs\Rocket.API.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.Core"> | ||
<HintPath>Libs\Rocket.Core.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Rocket.Unturned"> | ||
<HintPath>Libs\Rocket.Unturned.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>Libs\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>Libs\UnityEngine.CoreModule.dll</HintPath> | ||
<Aliases>UnityEngineCoreModule</Aliases> | ||
</Reference> | ||
</ItemGroup> | ||
|
||
</Project> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34902.65 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleTPA", "SimpleTPA.csproj", "{54A3C5CA-5C19-42B5-80FC-07B61DC67422}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5CC3CA60-EF70-4BC6-94C3-A4D4FE5F2BCA} | ||
EndGlobalSection | ||
EndGlobal | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.9.34902.65 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SimpleTPA", "SimpleTPA.csproj", "{54A3C5CA-5C19-42B5-80FC-07B61DC67422}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{54A3C5CA-5C19-42B5-80FC-07B61DC67422}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {5CC3CA60-EF70-4BC6-94C3-A4D4FE5F2BCA} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
using Rocket.API; | ||
|
||
namespace SimpleTPA | ||
{ | ||
public class SimpleTPAConfiguration : IRocketPluginConfiguration | ||
{ | ||
public uint TickrateToExpire = 900; | ||
public uint TickrateToTeleport = 900; | ||
public uint ServerTickrate = 60; | ||
public void LoadDefaults() | ||
{ | ||
|
||
} | ||
} | ||
} | ||
using Rocket.API; | ||
|
||
namespace SimpleTPA | ||
{ | ||
public class SimpleTPAConfiguration : IRocketPluginConfiguration | ||
{ | ||
public uint TickrateToExpire = 900; | ||
public uint TickrateToTeleport = 900; | ||
public uint ServerTickrate = 60; | ||
public void LoadDefaults() | ||
{ | ||
|
||
} | ||
} | ||
} |
Oops, something went wrong.