get ban list

Need help with SmartFoxServer? You didn't find an answer in our documentation? Please, post your questions here!

Moderators: Lapo, Bax

alex2344
Posts: 10
Joined: 30 Oct 2018, 12:04

get ban list

Postby alex2344 » 12 Apr 2019, 16:23

hello
Can I get the ban list from the extensions side (SFS PRO Server Side Api )
User avatar
Lapo
Site Admin
Posts: 20761
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: get ban list

Postby Lapo » 13 Apr 2019, 10:41

Hi,
you can use this:

Code: Select all

List<BannedUser> banList = SmartFoxServer.getInstance().getBanList()


Cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
alex2344
Posts: 10
Joined: 30 Oct 2018, 12:04

Re: get ban list

Postby alex2344 » 13 Apr 2019, 12:29

hi
i mean something like that
https://www.smartfoxserver.com/docs/1x/ ... /index.htm
Something I can write inside the extension
User avatar
Lapo
Site Admin
Posts: 20761
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: get ban list

Postby Lapo » 15 Apr 2019, 08:14

Ok. Well the code above is valid for a Java extension :)
In Javascript it translates to:

Code: Select all

var banList = _server.getBanList()

Each item in the list is a Java class (BannedUser) with the following methods:

    getName()
    getIp()
    getBanDate() (in Unix time format)

Hope it helps
Lapo

--

gotoAndPlay()

...addicted to flash games
alex2344
Posts: 10
Joined: 30 Oct 2018, 12:04

Re: get ban list

Postby alex2344 » 16 Apr 2019, 16:13

Code: Select all

16:18:19.885 - [ WARNING ] > Error in extension [ admin.as ]: TypeError: Cannot find function getBanList. (admin.as#1627) Internal: 50 -- Line number: 49 in file: admin.as


It seems that the Fincation does not exist
User avatar
Lapo
Site Admin
Posts: 20761
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: get ban list

Postby Lapo » 16 Apr 2019, 16:34

You're right, this is not accessible via javascript, only Java.
Sorry for the inconvenience. Haven't used SFS PRO in a long time.
Lapo

--

gotoAndPlay()

...addicted to flash games
alex2344
Posts: 10
Joined: 30 Oct 2018, 12:04

Re: get ban list

Postby alex2344 » 16 Apr 2019, 16:59

np .thanks for your time
I will create a new table in the database for banned people
User avatar
Lapo
Site Admin
Posts: 20761
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: get ban list

Postby Lapo » 16 Apr 2019, 17:09

Before you do that, try this instead:

Code: Select all

var bannedUsers = _server.instance.getBanList()


the _server.instance object points to the actual Java class that exposes the method.

Cheers
Lapo

--

gotoAndPlay()

...addicted to flash games
alex2344
Posts: 10
Joined: 30 Oct 2018, 12:04

Re: get ban list

Postby alex2344 » 16 Apr 2019, 17:39

Thank you it works

Code: Select all

[{ voicemail, null, 1555435902386 }]


For a short while I was trying to restart the server from the extention side i tried

Code: Select all

var javaExt = Packages.it.gotoandplay.smartfoxserver.extensions.ExtensionHelper;
    var ExtensionHelper = javaExt.instance();
    var restart = ExtensionHelper.restart()


But it did not work , Now all I have to do is

Code: Select all

var restart = _server.instance.restart()


Thank you very much for your help lapo

Return to “SmartFoxServer 1.x Discussions and Help”

Who is online

Users browsing this forum: No registered users and 5 guests