REST status or v2/server/status now checks for a permission to display ips to the caller. The only way to get this enabled is to use securetokenendpoint config option.
Refactored a tsplayer method.
This commit is contained in:
parent
4c5c2ba0de
commit
ec9cb09cd8
3 changed files with 52 additions and 38 deletions
|
|
@ -647,45 +647,52 @@ namespace TShockAPI
|
|||
|
||||
public virtual bool SendTileSquare(int x, int y, int size = 10)
|
||||
{
|
||||
try
|
||||
{
|
||||
int num = (size - 1)/2;
|
||||
int m_x=0;
|
||||
int m_y=0;
|
||||
try
|
||||
{
|
||||
int num = (size - 1)/2;
|
||||
int m_x = 0;
|
||||
int m_y = 0;
|
||||
|
||||
if (x - num <0){
|
||||
m_x=0;
|
||||
}else{
|
||||
m_x = x - num;
|
||||
}
|
||||
if (x - num < 0)
|
||||
{
|
||||
m_x = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_x = x - num;
|
||||
}
|
||||
|
||||
if (y - num <0){
|
||||
m_y=0;
|
||||
}else{
|
||||
m_y = y - num;
|
||||
}
|
||||
if (y - num < 0)
|
||||
{
|
||||
m_y = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_y = y - num;
|
||||
}
|
||||
|
||||
if (m_x + size > Main.maxTilesX){
|
||||
m_x=Main.maxTilesX - size;
|
||||
}
|
||||
if (m_x + size > Main.maxTilesX)
|
||||
{
|
||||
m_x = Main.maxTilesX - size;
|
||||
}
|
||||
|
||||
if (m_y + size > Main.maxTilesY){
|
||||
m_y=Main.maxTilesY - size;
|
||||
}
|
||||
if (m_y + size > Main.maxTilesY)
|
||||
{
|
||||
m_y = Main.maxTilesY - size;
|
||||
}
|
||||
|
||||
SendData(PacketTypes.TileSendSquare, "", size, m_x, m_y);
|
||||
return true;
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
|
||||
// This is expected if square exceeds array.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
return false;
|
||||
SendData(PacketTypes.TileSendSquare, "", size, m_x, m_y);
|
||||
return true;
|
||||
}
|
||||
catch (IndexOutOfRangeException)
|
||||
{
|
||||
// This is expected if square exceeds array.
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Error(ex.ToString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool GiveItemCheck(int type, string name, int width, int height, int stack, int prefix = 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue