From 7eca70e88153fc2946a14144afc196355883f346 Mon Sep 17 00:00:00 2001 From: Rogiel Date: Sun, 31 Jul 2011 13:43:10 -0300 Subject: [PATCH] Removed deprecated ScriptTemplateService Signed-off-by: Rogiel --- .../game/character/CharacterServiceImpl.java | 8 +- .../service/game/chat/ChatChannel.java | 8 +- .../service/game/chat/SimpleChatService.java | 8 +- .../game/template/ScriptTemplateService.java | 105 ------------------ .../ScriptTemplateServiceConfiguration.java | 31 ------ 5 files changed, 12 insertions(+), 148 deletions(-) delete mode 100644 src/main/java/com/l2jserver/service/game/template/ScriptTemplateService.java delete mode 100644 src/main/java/com/l2jserver/service/game/template/ScriptTemplateServiceConfiguration.java diff --git a/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java b/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java index c0f3ac086..5b19c08fd 100644 --- a/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java +++ b/src/main/java/com/l2jserver/service/game/character/CharacterServiceImpl.java @@ -170,9 +170,9 @@ public class CharacterServiceImpl extends AbstractService implements return true; // remove chat listeners - chatService.getGlobalChannel().removeChatChannelListener( + chatService.getGlobalChannel().removeMessageListener( globalChatListener); - chatService.getTradeChannel().removeChatChannelListener( + chatService.getTradeChannel().removeMessageListener( tradeChatListener); // // remove broadcast listener @@ -185,9 +185,9 @@ public class CharacterServiceImpl extends AbstractService implements }); // register global chat listener - chatService.getGlobalChannel().addChatChannelListener( + chatService.getGlobalChannel().addMessageListener( globalChatListener); - chatService.getTradeChannel().addChatChannelListener(tradeChatListener); + chatService.getTradeChannel().addMessageListener(tradeChatListener); // query client game guard -- if key is invalid, the connection will be // closed as soon as possible diff --git a/src/main/java/com/l2jserver/service/game/chat/ChatChannel.java b/src/main/java/com/l2jserver/service/game/chat/ChatChannel.java index 9903587e2..24a59275b 100644 --- a/src/main/java/com/l2jserver/service/game/chat/ChatChannel.java +++ b/src/main/java/com/l2jserver/service/game/chat/ChatChannel.java @@ -58,7 +58,7 @@ public interface ChatChannel { * @param listener * the listener */ - void addChatChannelListener(ChatChannelListener listener); + void addMessageListener(ChatChannelListener listener); /** * Removes a {@link ChatChannelListener}. @@ -66,7 +66,7 @@ public interface ChatChannel { * @param listener * the listener */ - void removeChatChannelListener(ChatChannelListener listener); + void removeMessageListener(ChatChannelListener listener); /** * Adds a {@link ChatChannelFilter} that will be used to filter each message @@ -75,7 +75,7 @@ public interface ChatChannel { * @param filter * the filter */ - void addChatChannelFilter(ChatChannelFilter filter); + void addMessageFilter(ChatChannelFilter filter); /** * Removes a {@link ChatChannelListener}. @@ -83,7 +83,7 @@ public interface ChatChannel { * @param filter * the filter */ - void removeChatChannelFilter(ChatChannelFilter filter); + void removeMessageFilter(ChatChannelFilter filter); /** * @return the chat channel numeric ID diff --git a/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java b/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java index 6254e1463..25f0facc1 100644 --- a/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java +++ b/src/main/java/com/l2jserver/service/game/chat/SimpleChatService.java @@ -246,25 +246,25 @@ public class SimpleChatService extends AbstractService implements ChatService { } @Override - public void addChatChannelListener(ChatChannelListener listener) { + public void addMessageListener(ChatChannelListener listener) { Preconditions.checkNotNull(listener, "listener"); listeners.add(listener); } @Override - public void removeChatChannelListener(ChatChannelListener listener) { + public void removeMessageListener(ChatChannelListener listener) { Preconditions.checkNotNull(listener, "listener"); listeners.remove(listener); } @Override - public void addChatChannelFilter(ChatChannelFilter filter) { + public void addMessageFilter(ChatChannelFilter filter) { Preconditions.checkNotNull(filter, "filter"); filters.add(filter); } @Override - public void removeChatChannelFilter(ChatChannelFilter filter) { + public void removeMessageFilter(ChatChannelFilter filter) { Preconditions.checkNotNull(filter, "filter"); filters.remove(filter); } diff --git a/src/main/java/com/l2jserver/service/game/template/ScriptTemplateService.java b/src/main/java/com/l2jserver/service/game/template/ScriptTemplateService.java deleted file mode 100644 index b78495980..000000000 --- a/src/main/java/com/l2jserver/service/game/template/ScriptTemplateService.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * This file is part of l2jserver . - * - * l2jserver is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * l2jserver is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with l2jserver. If not, see . - */ -package com.l2jserver.service.game.template; - -import java.util.Map; - -import com.google.common.base.Preconditions; -import com.google.inject.Inject; -import com.google.inject.Injector; -import com.l2jserver.model.id.TemplateID; -import com.l2jserver.model.template.Template; -import com.l2jserver.service.AbstractService; -import com.l2jserver.service.AbstractService.Depends; -import com.l2jserver.service.ServiceStartException; -import com.l2jserver.service.ServiceStopException; -import com.l2jserver.service.configuration.ConfigurationService; -import com.l2jserver.service.core.LoggingService; -import com.l2jserver.service.game.scripting.ScriptContext; -import com.l2jserver.service.game.scripting.ScriptingService; -import com.l2jserver.util.factory.CollectionFactory; - -@Depends({ LoggingService.class, ConfigurationService.class, - ScriptingService.class }) -public class ScriptTemplateService extends AbstractService implements - TemplateService { - private final ScriptingService scriptingService; - private final ScriptTemplateServiceConfiguration config; - private final Injector injector; - - private ScriptContext context; - - @SuppressWarnings("rawtypes") - private Map templates = CollectionFactory.newMap(); - - @Inject - public ScriptTemplateService(ScriptingService scriptingService, - ConfigurationService configService, Injector injector) { - this.scriptingService = scriptingService; - this.injector = injector; - this.config = configService - .get(ScriptTemplateServiceConfiguration.class); - } - - @Override - protected void doStart() throws ServiceStartException { - if (context == null) { - try { - context = scriptingService.load(config.getTemplateDescriptor()) - .get(0); - } catch (Exception e) { - throw new ServiceStartException(e); - } - return; - } - if (context.isInitialized()) - context.shutdown(); - context.init(); - } - - @Override - @SuppressWarnings("unchecked") - public > T getTemplate(TemplateID id) { - Preconditions.checkNotNull(id, "id"); - return (T) templates.get(id); - } - - public void addTemplate(Class> t) { - Preconditions.checkNotNull(t, "t"); - - final Template template = injector.getInstance(t); - if (templates.containsKey(template.getID())) - throw new TemplateException("Template with ID" + template.getID() - + " is already registered for " - + templates.get(template.getID())); - - if (template.getID() != null) - templates.put(template.getID(), template); - } - - public void removeTemplate(Template t) { - Preconditions.checkNotNull(t, "t"); - // TODO templates.remove(t); - } - - @Override - protected void doStop() throws ServiceStopException { - if (context.isInitialized()) - context.shutdown(); - context = null; - } -} diff --git a/src/main/java/com/l2jserver/service/game/template/ScriptTemplateServiceConfiguration.java b/src/main/java/com/l2jserver/service/game/template/ScriptTemplateServiceConfiguration.java deleted file mode 100644 index 9cec4b23c..000000000 --- a/src/main/java/com/l2jserver/service/game/template/ScriptTemplateServiceConfiguration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * This file is part of l2jserver . - * - * l2jserver is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * l2jserver is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with l2jserver. If not, see . - */ -package com.l2jserver.service.game.template; - -import java.io.File; - -import com.l2jserver.service.configuration.Configuration; -import com.l2jserver.service.configuration.Configuration.ConfigurationName; - -@ConfigurationName("template") -public interface ScriptTemplateServiceConfiguration extends Configuration { - @ConfigurationPropertyGetter(name = "template.descriptor", defaultValue = "data/script/template/template.xml") - File getTemplateDescriptor(); - - @ConfigurationPropertySetter(name = "template.descriptor") - void setTemplateDescriptor(File file); -}