Jump to content

Maybe a Fix for exploit when restart the server or shutdown


Recommended Posts

This code will paralyze all the players before the server restarts (15 seconds before the server restarts/shuts down by default but you can change it), and unparalyze them if the server restart is cancelled.

 

I create this because many ppl when server restarted or shutdown they cheat such us safe enchanting,buffs stucking and more

 

So the code is the following:

 

 

 

 

 

Index: D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/Shutdown.java

===================================================================

--- D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/Shutdown.java

+++ D:/Workspace/GameServer_Clean/java/net/sf/l2j/gameserver/Shutdown.java

@@ -52,8 +52,35 @@

public static final int GM_RESTART = 2;

public static final int ABORT = 3;

private static String[] _modeText = {"SIGTERM", "shutting down", "restarting", "aborting"};

-   

    /**

+    * Don't allow players to do anything while server is Restarting/Shuting down

+    * this way they won't be able tu use any exploit during restart procedure.

+    */

+    private void paralyzeAllCharacters()

+    {

+    for (L2PcInstance player : L2World.getInstance().getAllPlayers())

+    {

+    //Stop movement for every character connected

+    player.setTarget(null); // Delete it's target

+    player.stopMove(null); // Stop it's movement

+    player.setIsParalyzed(true); // Deny movement

+    player.setIsInvul(true); // Make it invul (this way they won't get killed by a mob)

+    }

+    }

+    /**

+    * Allow players to move again and erase their invul status

+    */

+    private void unparalyzeAllCharacters ()

+    {

+    for (L2PcInstance player: L2World.getInstance().getAllPlayers())

+    {

+    //Restore movement for every char connected

+    player.setIsParalyzed(false); //Unparalize

+    player.setIsInvul(false); //Make vulnerable once again

+    }

+    }

+

+    /**

      * This function starts a shutdown countdown from Telnet (Copied from Function startShutdown())

      *

      * @param ip            IP Which Issued shutdown command

@@ -100,7 +127,8 @@

        Announcements _an = Announcements.getInstance();

        _log.warning("IP: " + IP + " issued shutdown ABORT. " + _modeText[shutdownMode] + " has been stopped!");

        _an.announceToAll("Server aborts " + _modeText[shutdownMode] + " and continues normal operation!");

-

+        //Restore movement in case shutdown/restart are cancelled

+        unparalyzeAllCharacters();

        if (_counterInstance != null) {

            _counterInstance._abort();

        }

@@ -310,6 +338,9 @@

LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN); //avoids new players from logging in

_an.announceToAll("The server is " + _modeText[shutdownMode] + " in 1 minute.");break;

case 30:_an.announceToAll("The server is " + _modeText[shutdownMode] + " in 30 seconds.");break;

+                    case 15:

+                        paralyzeAllCharacters();

+                        _an.announceToAll("The players will now be inmobilized to prevent Exploits during the "+ _modeText[shutdownMode] +" procedure");break;

case 5:_an.announceToAll("The server is " + _modeText[shutdownMode] + " in 5 seconds, please delog NOW !");break;

}

 

Index: D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminShutdown.java

===================================================================

--- D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminShutdown.java (revision 669)

+++ D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminShutdown.java (working copy)

@@ -53,7 +53,15 @@

try

{

int val = Integer.parseInt(command.substring(22));

- serverShutdown(activeChar, val, false);

+                //A restart procedure HAS to be issued at least 60 seconds before it takes effect

+                if (val >= 60)

+                    {

+                        serverShutdown(activeChar, val, false);

+                    }

+                else

+                    {

+                    sendHtmlForm(activeChar);

+                    } 

}

catch (StringIndexOutOfBoundsException e)

{

@@ -64,7 +72,15 @@

try

{

int val = Integer.parseInt(command.substring(21));

- serverShutdown(activeChar, val, true);

+                //A restart procedure HAS to be issued at least 60 seconds before it takes effect

+                if (val >= 60)

+                {

+                serverShutdown(activeChar, val, true);

+                }

+                else

+                {

+                sendHtmlForm(activeChar);

+                }

}

catch (StringIndexOutOfBoundsException e)

{

@@ -111,7 +127,7 @@

replyMSG.append("<tr><td>Game Time: " + format.format(cal.getTime()) + "</td></tr>");

replyMSG.append("</table><br>");

replyMSG.append("<table width=270>");

- replyMSG.append("<tr><td>Enter in seconds the time till the server shutdowns bellow:</td></tr>");

+        replyMSG.append("<tr><td>Enter in seconds the time till the server shutdowns bellow (min. 60 sec.):</td></tr>");

replyMSG.append("<br>");

replyMSG.append("<tr><td><center>Seconds till: <edit var=\"shutdown_time\" width=60></center></td></tr>");

replyMSG.append("</table><

 

 

Link to comment
Share on other sites

Thx for that

I dont understand the code... :S actually where to put it ...for example what is this? @@ -52,8 +52,35 @@

But in some servers you see a message that u cannot enchant while server restarts. Doesnt it work here?

 

Link to comment
Share on other sites

It freezes the playes and makes them invul (for the last 15''), while it announces them that, and stops their movement packs exchange with the server. It also has negate values if you wanna issue a stop shutdown command. It also forces you to issue at least a 60'' shutdown command...

 

I would say it is good, but, l2joff has added a security bar that does the same thing.. And i'm sure i had seen the same code arround... Gimme a sec ^^

 

Actually, my memory never traits me... http://forum.l2jserver.com/thread.php?threadid=23476 ;D

Is that me or i believe that we have some credits problems on this forum? x.x Anyway, i don't want to mess... Let's call it a good share to exist, and a typo at the post's syntax...

 

*Ehm, if you don't know what it actually is, do not consider using it :P It's a java patch, it can be used with eclipse, but first you have to edit it to match to your revision...

Link to comment
Share on other sites

This code will paralyze all the players before the server restarts (15 seconds before the server restarts/shuts down by default but you can change it), and unparalyze them if the server restart is cancelled.

 

I create this because many ppl when server restarted or shutdown they cheat such us safe enchanting,buffs stucking and more

 

So the code is the following:

 

 

 

 

 

Index: D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/Shutdown.java

===================================================================

--- D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/Shutdown.java

+++ D:/Workspace/GameServer_Clean/java/net/sf/l2j/gameserver/Shutdown.java

@@ -52,8 +52,35 @@

public static final int GM_RESTART = 2;

public static final int ABORT = 3;

private static String[] _modeText = {"SIGTERM", "shutting down", "restarting", "aborting"};

-   

    /**

+    * Don't allow players to do anything while server is Restarting/Shuting down

+    * this way they won't be able tu use any exploit during restart procedure.

+    */

+    private void paralyzeAllCharacters()

+    {

+    for (L2PcInstance player : L2World.getInstance().getAllPlayers())

+    {

+    //Stop movement for every character connected

+    player.setTarget(null); // Delete it's target

+    player.stopMove(null); // Stop it's movement

+    player.setIsParalyzed(true); // Deny movement

+    player.setIsInvul(true); // Make it invul (this way they won't get killed by a mob)

+    }

+    }

+    /**

+    * Allow players to move again and erase their invul status

+    */

+    private void unparalyzeAllCharacters ()

+    {

+    for (L2PcInstance player: L2World.getInstance().getAllPlayers())

+    {

+    //Restore movement for every char connected

+    player.setIsParalyzed(false); //Unparalize

+    player.setIsInvul(false); //Make vulnerable once again

+    }

+    }

+

+    /**

      * This function starts a shutdown countdown from Telnet (Copied from Function startShutdown())

      *

      * @param ip            IP Which Issued shutdown command

@@ -100,7 +127,8 @@

        Announcements _an = Announcements.getInstance();

        _log.warning("IP: " + IP + " issued shutdown ABORT. " + _modeText[shutdownMode] + " has been stopped!");

        _an.announceToAll("Server aborts " + _modeText[shutdownMode] + " and continues normal operation!");

-

+        //Restore movement in case shutdown/restart are cancelled

+        unparalyzeAllCharacters();

        if (_counterInstance != null) {

            _counterInstance._abort();

        }

@@ -310,6 +338,9 @@

LoginServerThread.getInstance().setServerStatus(ServerStatus.STATUS_DOWN); //avoids new players from logging in

_an.announceToAll("The server is " + _modeText[shutdownMode] + " in 1 minute.");break;

case 30:_an.announceToAll("The server is " + _modeText[shutdownMode] + " in 30 seconds.");break;

+                    case 15:

+                        paralyzeAllCharacters();

+                        _an.announceToAll("The players will now be inmobilized to prevent Exploits during the "+ _modeText[shutdownMode] +" procedure");break;

case 5:_an.announceToAll("The server is " + _modeText[shutdownMode] + " in 5 seconds, please delog NOW !");break;

}

 

Index: D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminShutdown.java

===================================================================

--- D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminShutdown.java (revision 669)

+++ D:/#PROJECT/l2jserver_IntGS_Clean/java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminShutdown.java (working copy)

@@ -53,7 +53,15 @@

try

{

int val = Integer.parseInt(command.substring(22));

- serverShutdown(activeChar, val, false);

+                //A restart procedure HAS to be issued at least 60 seconds before it takes effect

+                if (val >= 60)

+                    {

+                        serverShutdown(activeChar, val, false);

+                    }

+                else

+                    {

+                    sendHtmlForm(activeChar);

+                    } 

}

catch (StringIndexOutOfBoundsException e)

{

@@ -64,7 +72,15 @@

try

{

int val = Integer.parseInt(command.substring(21));

- serverShutdown(activeChar, val, true);

+                //A restart procedure HAS to be issued at least 60 seconds before it takes effect

+                if (val >= 60)

+                {

+                serverShutdown(activeChar, val, true);

+                }

+                else

+                {

+                sendHtmlForm(activeChar);

+                }

}

catch (StringIndexOutOfBoundsException e)

{

@@ -111,7 +127,7 @@

replyMSG.append("<tr><td>Game Time: " + format.format(cal.getTime()) + "</td></tr>");

replyMSG.append("</table><br>");

replyMSG.append("<table width=270>");

- replyMSG.append("<tr><td>Enter in seconds the time till the server shutdowns bellow:</td></tr>");

+        replyMSG.append("<tr><td>Enter in seconds the time till the server shutdowns bellow (min. 60 sec.):</td></tr>");

replyMSG.append("<br>");

replyMSG.append("<tr><td><center>Seconds till: <edit var=\"shutdown_time\" width=60></center></td></tr>");

replyMSG.append("</table><

 

 

Damn you let player s have funn :P

Link to comment
Share on other sites

It freezes the playes and makes them invul (for the last 15''), while it announces them that, and stops their movement packs exchange with the server. It also has negate values if you wanna issue a stop shutdown command. It also forces you to issue at least a 60'' shutdown command...

 

I would say it is good, but, l2joff has added a security bar that does the same thing.. And i'm sure i had seen the same code arround... Gimme a sec ^^

 

Actually, my memory never traits me... http://forum.l2jserver.com/thread.php?threadid=23476 ;D

Is that me or i believe that we have some credits problems on this forum? x.x Anyway, i don't want to mess... Let's call it a good share to exist, and a typo at the post's syntax...

 

*Ehm, if you don't know what it actually is, do not consider using it :P It's a java patch, it can be used with eclipse, but first you have to edit it to match to your revision...

 

I know that l2joff do that but it works on old rev not the final.The code is similar but not the same.And the patches stop work right know man.You must do that by yourselfe if you want to mae a code

 

This announce by l2joff and l2jfree

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...