1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-11 09:42:54 +00:00

Template concept changes

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-15 18:53:17 -03:00
parent fe41dbdc6f
commit 85f1f8eba0
139 changed files with 1310 additions and 409 deletions

View File

@@ -58,6 +58,6 @@ public class CharacterIDFactory implements ObjectIDFactory<CharacterID> {
* the numeric ID
* @return the new ID created by injection
*/
public CharacterID create(@Assisted int id);
CharacterID create(@Assisted int id);
}
}

View File

@@ -57,6 +57,6 @@ public class ClanIDFactory implements ObjectIDFactory<ClanID> {
* the numeric ID
* @return the new ID created by injection
*/
public ClanID create(@Assisted int id);
ClanID create(@Assisted int id);
}
}

View File

@@ -57,6 +57,6 @@ public class ItemIDFactory implements ObjectIDFactory<ItemID> {
* the numeric ID
* @return the new ID created by injection
*/
public ItemID create(@Assisted int id);
ItemID create(@Assisted int id);
}
}

View File

@@ -57,6 +57,6 @@ public class PetIDFactory implements ObjectIDFactory<PetID> {
* the numeric ID
* @return the new ID created by injection
*/
public PetID create(@Assisted int id);
PetID create(@Assisted int id);
}
}

View File

@@ -0,0 +1,32 @@
package com.l2jserver.model.id.template;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.ActorTemplate;
import com.l2jserver.service.game.template.TemplateService;
/**
* An {@link TemplateID} instance representing an {@link ActorTemplate}
* object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class ActorTemplateID<T extends ActorTemplate<?>> extends TemplateID<T> {
/**
* The template service
*/
private final TemplateService templateService;
@Inject
protected ActorTemplateID(@Assisted int id,
TemplateService templateService) {
super(id);
this.templateService = templateService;
}
@Override
public T getTemplate() {
return templateService.getTemplate(this);
}
}

View File

@@ -12,21 +12,10 @@ import com.l2jserver.service.game.template.TemplateService;
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterTemplateID extends TemplateID<CharacterTemplate> {
/**
* The template service
*/
private final TemplateService templateService;
public class CharacterTemplateID extends ActorTemplateID<CharacterTemplate> {
@Inject
protected CharacterTemplateID(@Assisted int id,
TemplateService templateService) {
super(id);
this.templateService = templateService;
}
@Override
public CharacterTemplate getTemplate() {
return templateService.getTemplate(this);
super(id, templateService);
}
}

View File

@@ -0,0 +1,21 @@
package com.l2jserver.model.id.template;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.NPCTemplate;
import com.l2jserver.service.game.template.TemplateService;
/**
* An {@link TemplateID} instance representing an {@link NPCTemplate}
* object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class NPCTemplateID extends ActorTemplateID<NPCTemplate> {
@Inject
protected NPCTemplateID(@Assisted int id,
TemplateService templateService) {
super(id, templateService);
}
}