I added a plugin to the PersistentRoomCreate example, made PersistentRoomCreate a server level plugin, then restarted my ES5. The persistent room with plugin attached shows in the Zones and Rooms screen. Restarting ES5 shows that the room is created again each time.
I don't see anything wrong with your code, although there are a few differences between it and what I have. You may want to try commenting out the plugin attachment part to see if that is the problem. Are you creating the persistent room from a server level plugin or a room level one? I haven't tried doing it from a room level plugin. Do you get any errors showing in the ES5 log?
Here's the type of code that I'm using (omitting the imports and the package line):
Code:
public class PersistentRoomCreate extends BasePlugin {
@Override
public void init(EsObjectRO parameters) {
// create the room configuration
RoomConfiguration config = new RoomConfiguration();
config.setName("example-room");
config.setDescription("Description of example room");
config.setCapacity(100);
config.setHidden(false);
config.setPersistent(true);
// used to add users to the room
Collection<UserConfig> userConfigs = new ArrayList<UserConfig>();
// Optional: add any plugins to the room
// You will have to supply the extensionName and pluginName for the plugin
ExtensionComponentConfiguration roomPlugin = new ExtensionComponentConfiguration();
roomPlugin.setExtensionName(getApi().getExtensionName());
roomPlugin.setHandle("AvatarChatPlugin");
roomPlugin.setName("AvatarChatPlugin");
//add the room plugin(s)
config.addPlugin(roomPlugin);
// create the room
RoomResponse response = getApi().createRoomInNamedZone("example-zone", true, config, userConfigs);
if (response.getStatus() == Status.Success) {
getApi().getLogger().debug("Persistent Room creation successful." +
"\n\tZone ID: " + response.getZoneId() +
"\n\tRoom ID: " + response.getRoomId());
} else {
getApi().getLogger().debug(response.getStatus().toString());
for (ErrorType errorType : response.getErrors()) {
getApi().getLogger().debug(errorType.toString());
}
}
}
}
And the Extension.xml file is:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<Extension>
<Name>PersistentRoomCreate</Name>
<Plugins>
<Plugin>
<Handle>PersistentRoomCreateExample</Handle>
<Type>Java</Type>
<Path>com.electrotank.electroserver5.examples.persistentroomcreate.PersistentRoomCreate</Path>
</Plugin>
<Plugin>
<Handle>AvatarChatPlugin</Handle>
<Type>Java</Type>
<Path>com.electrotank.electroserver5.examples.avatarchat.AvatarChatPlugin</Path>
</Plugin>
</Plugins>
</Extension>