jetrix-cvs Mailing List for Jetrix TetriNET Server
Brought to you by:
smanux
You can subscribe to this list here.
| 2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(47) |
Dec
(39) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2003 |
Jan
(11) |
Feb
(34) |
Mar
(52) |
Apr
(79) |
May
(14) |
Jun
(41) |
Jul
(19) |
Aug
(44) |
Sep
(36) |
Oct
(36) |
Nov
(6) |
Dec
(58) |
| 2004 |
Jan
(23) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(91) |
| 2005 |
Jan
(137) |
Feb
(10) |
Mar
(2) |
Apr
(41) |
May
(62) |
Jun
(9) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(10) |
Dec
|
| 2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(39) |
Sep
(18) |
Oct
|
Nov
(9) |
Dec
|
| 2009 |
Jan
|
Feb
(27) |
Mar
(4) |
Apr
|
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
| 2010 |
Jan
(3) |
Feb
(14) |
Mar
(3) |
Apr
(10) |
May
(15) |
Jun
|
Jul
|
Aug
(9) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
| 2011 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
| 2012 |
Jan
|
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
|
From: <sm...@us...> - 2012-02-20 11:27:47
|
Revision: 877
http://jetrix.svn.sourceforge.net/jetrix/?rev=877&view=rev
Author: smanux
Date: 2012-02-20 11:27:41 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
Added the missing copyright file for the Debian package
Added Paths:
-----------
jetrix/trunk/src/etc/deb/data/usr/share/doc/
jetrix/trunk/src/etc/deb/data/usr/share/doc/jetrix/
jetrix/trunk/src/etc/deb/data/usr/share/doc/jetrix/copyright
Added: jetrix/trunk/src/etc/deb/data/usr/share/doc/jetrix/copyright
===================================================================
--- jetrix/trunk/src/etc/deb/data/usr/share/doc/jetrix/copyright (rev 0)
+++ jetrix/trunk/src/etc/deb/data/usr/share/doc/jetrix/copyright 2012-02-20 11:27:41 UTC (rev 877)
@@ -0,0 +1,20 @@
+Copyright:
+
+ Copyright (C) 2001-2012 Emmanuel Bourg
+
+License: GNU General Public License Version 2
+
+ Jetrix 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 2
+ of the License, or (at your option) any later version.
+
+ This program 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 with
+ your Debian GNU/Linux system, in /usr/share/common-licenses/GPL-2; if not,
+ write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ Boston, MA 02111-1307 USA.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2012-02-20 11:19:26
|
Revision: 876
http://jetrix.svn.sourceforge.net/jetrix/?rev=876&view=rev
Author: smanux
Date: 2012-02-20 11:19:16 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
Changed the Debian dependencies to run Jetrix with OpenJDK
Modified Paths:
--------------
jetrix/trunk/src/etc/deb/control/control
Modified: jetrix/trunk/src/etc/deb/control/control
===================================================================
--- jetrix/trunk/src/etc/deb/control/control 2012-02-20 11:18:16 UTC (rev 875)
+++ jetrix/trunk/src/etc/deb/control/control 2012-02-20 11:19:16 UTC (rev 876)
@@ -3,7 +3,7 @@
Section: games
Priority: optional
Architecture: all
-Depends: sun-java6-jre
+Depends: default-jre-headless
Suggest: gtetrinet
Maintainer: Emmanuel Bourg <sm...@lf...>
Homepage: http://jetrix.sourceforge.net
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2012-02-20 11:18:22
|
Revision: 875
http://jetrix.svn.sourceforge.net/jetrix/?rev=875&view=rev
Author: smanux
Date: 2012-02-20 11:18:16 +0000 (Mon, 20 Feb 2012)
Log Message:
-----------
Updated the pack200 Ant task and simplified the build
Modified Paths:
--------------
jetrix/trunk/build.xml
Added Paths:
-----------
jetrix/trunk/lib/build/deployment-ant-pack200-1.0-rc1.jar
Removed Paths:
-------------
jetrix/trunk/lib/build/Pack200Task.jar
Modified: jetrix/trunk/build.xml
===================================================================
--- jetrix/trunk/build.xml 2012-02-18 15:00:17 UTC (rev 874)
+++ jetrix/trunk/build.xml 2012-02-20 11:18:16 UTC (rev 875)
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project name="Jetrix TetriNET Server" default="dist" basedir=".">
- <taskdef name="pack200" classname="com.sun.tools.apache.ant.pack200.Pack200Task" classpath="lib/build/Pack200Task.jar"/>
+ <taskdef resource="org/jdesktop/deployment/ant/pack200/antlib.xml" classpath="lib/build/deployment-ant-pack200-1.0-rc1.jar"/>
<property name="compile.debug" value="true"/>
<property name="compile.optimize" value="false"/>
@@ -16,10 +16,7 @@
<property file="password.properties" />
<path id="classpath.main">
- <fileset dir="${lib}">
- <include name="**/*.jar"/>
- <include name="**/*.zip"/>
- </fileset>
+ <fileset dir="${lib}" includes="**/*.jar"/>
</path>
<target name="init">
@@ -98,9 +95,7 @@
<attribute name="Implementation-Title" value="Jetrix TetriNET Server"/>
<attribute name="Implementation-Version" value="${version}"/>
</manifest>
- <fileset dir="${build}/classes">
- <exclude name="**/Launcher*.class"/>
- </fileset>
+ <fileset dir="${build}/classes" excludes="**/Launcher*.class"/>
<fileset dir="${src}/etc">
<include name="tetrinet-server.dtd"/>
<include name="tetrinet-channels.dtd"/>
@@ -116,9 +111,7 @@
<attribute name="Implementation-Version" value="${version}"/>
<attribute name="Main-Class" value="net.jetrix.Launcher"/>
</manifest>
- <fileset dir="${build}/classes">
- <include name="**/Launcher*.class"/>
- </fileset>
+ <fileset dir="${build}/classes" includes="**/Launcher*.class"/>
</jar>
<!-- Create the WAR for the administration console -->
@@ -129,9 +122,7 @@
<exclude name="**/*.jsp"/>
<exclude name="**/*.java"/>
</fileset>
- <classes dir="${build}/jsp">
- <include name="**/*.class"/>
- </classes>
+ <classes dir="${build}/jsp" includes="**/*.class"/>
</war>
</target>
@@ -146,23 +137,11 @@
<pack200 src="${dist}/webapp/jetrix-admin-${version}.war" destfile="${dist}/webapp/jetrix-admin-${version}.war.pack" gzipoutput="false" stripdebug="false" keepfileorder="false"/>
<!-- Pack the dependencies -->
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-digester"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-beanutils"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-lang-2.0-light"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-pool-1.4"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="commons-dbcp-1.2.2"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="winstone-lite-0.9.10"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="jsp-api-light"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="jasper-runtime"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="jcrontab-1.4.1-light"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="mailapi-1.4.1"/></antcall>
- <antcall target="pack.lib" inheritAll="true"><param name="library" value="smtp-1.4.1"/></antcall>
+ <pack200 gzipoutput="false" stripdebug="true" keepfileorder="false" segmentlimit="-1" todir="${build}/lib">
+ <fileset dir="${build}/lib" includes="*.jar" excludes="jetrix-${version}.jar"/>
+ </pack200>
</target>
- <target name="pack.lib" description="Pack the library specified by the ${library} property">
- <pack200 src="${build}/lib/${library}.jar" destfile="${build}/lib/${library}.jar.pack" gzipoutput="false" stripdebug="true" keepfileorder="false"/>
- </target>
-
<target name="dist" depends="pack">
<mkdir dir="${build}/dist"/>
@@ -178,21 +157,15 @@
<include name="data/**" />
<include name="log/**" />
</fileset>
- <fileset dir="${build}">
- <include name="lib/*.pack" />
- </fileset>
+ <fileset dir="${build}" includes="lib/*.pack"/>
<fileset dir="${dist}">
<include name="lib/jetrix-${version}.jar.pack" />
<include name="lib/jetrix-launcher-${version}.jar" />
</fileset>
- <fileset dir="${src}">
- <include name="lang/**/*.properties" />
- </fileset>
+ <fileset dir="${src}" includes="lang/**/*.properties"/>
</copy>
<copy todir="${build}/dist/lib">
- <fileset dir="${dist}/webapp/">
- <include name="*.war.pack" />
- </fileset>
+ <fileset dir="${dist}/webapp/" includes="*.war.pack"/>
</copy>
<!-- Create the distribution directory -->
@@ -200,27 +173,21 @@
<!-- Create the Windows distribution -->
<zip zipfile="${dist}/bin/jetrix-${version}.zip">
- <zipfileset prefix="jetrix-${version}" dir="${build}/dist" filemode="755">
- <include name="jetrix"/>
- </zipfileset>
- <zipfileset prefix="jetrix-${version}" dir="${build}/dist">
- <exclude name="jetrix"/>
- </zipfileset>
+ <zipfileset prefix="jetrix-${version}" dir="${build}/dist" includes="jetrix" filemode="755"/>
+ <zipfileset prefix="jetrix-${version}" dir="${build}/dist" excludes="jetrix"/>
</zip>
<!-- Create the Unix distribution -->
<tar destfile="${dist}/bin/jetrix-${version}.tar.bz2" compression="bzip2">
- <tarfileset prefix="jetrix-${version}" dir="${build}/dist" filemode="755">
- <include name="jetrix"/>
- </tarfileset>
- <tarfileset prefix="jetrix-${version}" dir="${build}/dist">
- <exclude name="jetrix"/>
- </tarfileset>
+ <tarfileset prefix="jetrix-${version}" dir="${build}/dist" includes="jetrix" filemode="755"/>
+ <tarfileset prefix="jetrix-${version}" dir="${build}/dist" excludes="jetrix"/>
</tar>
</target>
- <target name="dist.linux" depends="dist" description="Build the Linux installer">
+ <target name="dist.linux" depends="dist.debian" description="Build the Linux packages"/>
+
+ <target name="dist.debian" depends="dist" description="Build the Debian package">
<mkdir dir="${build}/control"/>
<copy todir="${build}/control" filtering="true" >
<fileset dir="src/etc/deb/control"/>
@@ -277,9 +244,7 @@
<include name="project.xml" />
<include name="project.properties" />
</zipfileset>
- <zipfileset prefix="jetrix-${version}-src/src/" dir="${src}">
- <exclude name="site/"/>
- </zipfileset>
+ <zipfileset prefix="jetrix-${version}-src/src/" dir="${src}" excludes="site/"/>
<zipfileset prefix="jetrix-${version}-src/lib/" dir="${lib}" />
</zip>
@@ -289,9 +254,7 @@
<include name="project.xml" />
<include name="project.properties" />
</tarfileset>
- <tarfileset prefix="jetrix-${version}-src/src/" dir="${src}">
- <exclude name="site/"/>
- </tarfileset>
+ <tarfileset prefix="jetrix-${version}-src/src/" dir="${src}" excludes="site/"/>
<tarfileset prefix="jetrix-${version}-src/lib/" dir="${lib}" />
</tar>
Deleted: jetrix/trunk/lib/build/Pack200Task.jar
===================================================================
(Binary files differ)
Added: jetrix/trunk/lib/build/deployment-ant-pack200-1.0-rc1.jar
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/lib/build/deployment-ant-pack200-1.0-rc1.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2012-02-18 15:00:23
|
Revision: 874
http://jetrix.svn.sourceforge.net/jetrix/?rev=874&view=rev
Author: smanux
Date: 2012-02-18 15:00:17 +0000 (Sat, 18 Feb 2012)
Log Message:
-----------
Removed the update system
Modified Paths:
--------------
jetrix/trunk/build.xml
Removed Paths:
-------------
jetrix/trunk/src/bin/update
jetrix/trunk/src/bin/update.bat
jetrix/trunk/src/java/net/jetrix/tools/patcher/
Modified: jetrix/trunk/build.xml
===================================================================
--- jetrix/trunk/build.xml 2011-08-11 12:03:17 UTC (rev 873)
+++ jetrix/trunk/build.xml 2012-02-18 15:00:17 UTC (rev 874)
@@ -202,11 +202,9 @@
<zip zipfile="${dist}/bin/jetrix-${version}.zip">
<zipfileset prefix="jetrix-${version}" dir="${build}/dist" filemode="755">
<include name="jetrix"/>
- <include name="update"/>
</zipfileset>
<zipfileset prefix="jetrix-${version}" dir="${build}/dist">
<exclude name="jetrix"/>
- <exclude name="update"/>
</zipfileset>
</zip>
@@ -214,11 +212,9 @@
<tar destfile="${dist}/bin/jetrix-${version}.tar.bz2" compression="bzip2">
<tarfileset prefix="jetrix-${version}" dir="${build}/dist" filemode="755">
<include name="jetrix"/>
- <include name="update"/>
</tarfileset>
<tarfileset prefix="jetrix-${version}" dir="${build}/dist">
<exclude name="jetrix"/>
- <exclude name="update"/>
</tarfileset>
</tar>
@@ -239,7 +235,6 @@
</tarfileset>
<tarfileset prefix="/usr/share/jetrix" dir="${build}/dist" username="root" group="root">
<exclude name="jetrix"/>
- <exclude name="update"/>
<exclude name="*.bat"/>
</tarfileset>
</deb>
@@ -312,7 +307,6 @@
<mkdir dir="${deploy}"/>
<unzip src="${dist}/bin/jetrix-${version}.zip" dest="${deploy}" />
<chmod file="${deploy}/jetrix-${version}/jetrix" perm="+x"/>
- <chmod file="${deploy}/jetrix-${version}/update" perm="+x"/>
</target>
<target name="run" depends="deploy">
@@ -323,21 +317,6 @@
</java>
</target>
- <target name="update" depends="deploy" description="Uploads Jetrix to the patch server">
- <!-- Installing -->
- <delete dir="${deploy}"/>
- <mkdir dir="${deploy}"/>
- <unzip src="${dist}/bin/jetrix-${version}.zip" dest="${deploy}" />
-
- <!-- Checksum computation -->
- <java classname="net.jetrix.tools.patcher.UpdateList" dir="${deploy}/jetrix-${version}" classpath="${deploy}/jetrix-${version}/lib/jetrix-${version}.jar" fork="yes" />
-
- <!-- Uploading to patch server -->
- <ftp server="${ftp.host}" remotedir="/vsite/tetrinet/public_html/jetrix/autoupdate" userid="${ftp.login}" password="${ftp.pass}" depends="yes" verbose="yes" ignoreNoncriticalErrors="yes">
- <fileset dir="${deploy}/jetrix-${version}"/>
- </ftp>
- </target>
-
<target name="docgen" depends="compile" description="Generates the documentation of the server commands">
<java classname="net.jetrix.tools.DocumentationGenerator" fork="true">
<classpath>
Deleted: jetrix/trunk/src/bin/update
===================================================================
--- jetrix/trunk/src/bin/update 2011-08-11 12:03:17 UTC (rev 873)
+++ jetrix/trunk/src/bin/update 2012-02-18 15:00:17 UTC (rev 874)
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if [ -n "$JAVA_HOME" ]
-then
- JAVA_PATH="$JAVA_HOME/bin/java";
-else
- JAVA_PATH="java";
-fi
-
-$JAVA_PATH -cp lib/jetrix-@version@.jar net.jetrix.patcher.JetrixUpdate
Deleted: jetrix/trunk/src/bin/update.bat
===================================================================
--- jetrix/trunk/src/bin/update.bat 2011-08-11 12:03:17 UTC (rev 873)
+++ jetrix/trunk/src/bin/update.bat 2012-02-18 15:00:17 UTC (rev 874)
@@ -1,8 +0,0 @@
-@echo off
-
-SETLOCAL
-
-IF NOT JAVA_HOME == "" SET JAVA_EXE="%JAVA_HOME%\bin\java"
-IF JAVA_HOME == "" SET JAVA_EXE=java
-
-%JAVA_EXE% -cp lib/jetrix-@version@.jar net.jetrix.tools.patcher.JetrixUpdate
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2011-08-11 12:03:23
|
Revision: 873
http://jetrix.svn.sourceforge.net/jetrix/?rev=873&view=rev
Author: smanux
Date: 2011-08-11 12:03:17 +0000 (Thu, 11 Aug 2011)
Log Message:
-----------
Fixed the UK flag
Added Paths:
-----------
monitor/trunk/src/main/webapp/images/flags/24/United Kingdom.png
Removed Paths:
-------------
monitor/trunk/src/main/webapp/images/flags/24/United Kingdom(Great Britain).png
Deleted: monitor/trunk/src/main/webapp/images/flags/24/United Kingdom(Great Britain).png
===================================================================
(Binary files differ)
Copied: monitor/trunk/src/main/webapp/images/flags/24/United Kingdom.png (from rev 833, monitor/trunk/src/main/webapp/images/flags/24/United Kingdom(Great Britain).png)
===================================================================
(Binary files differ)
Property changes on: monitor/trunk/src/main/webapp/images/flags/24/United Kingdom.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2011-06-27 21:26:33
|
Revision: 872
http://jetrix.svn.sourceforge.net/jetrix/?rev=872&view=rev
Author: smanux
Date: 2011-06-27 21:26:26 +0000 (Mon, 27 Jun 2011)
Log Message:
-----------
Updating blocks and specials occurancies from the admin panel now works properly (issue reported by latcarfe)
Refactored the handling of occurancies
Modified Paths:
--------------
jetrix/trunk/pom.xml
jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/SettingsAction.java
jetrix/trunk/src/admin/settings.jsp
jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java
jetrix/trunk/src/java/net/jetrix/config/ChannelsRuleSet.java
jetrix/trunk/src/java/net/jetrix/config/Settings.java
jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java
jetrix/trunk/src/java/net/jetrix/filter/RandomFilter.java
jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java
jetrix/trunk/src/test/net/jetrix/config/SettingsTest.java
Added Paths:
-----------
jetrix/trunk/src/java/net/jetrix/config/Occurancy.java
jetrix/trunk/src/test/net/jetrix/config/OccurancyTest.java
Modified: jetrix/trunk/pom.xml
===================================================================
--- jetrix/trunk/pom.xml 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/pom.xml 2011-06-27 21:26:26 UTC (rev 872)
@@ -154,6 +154,13 @@
<version>3.8.2</version>
<scope>test</scope>
</dependency>
+
+ <dependency>
+ <groupId>junit-addons</groupId>
+ <artifactId>junit-addons</artifactId>
+ <version>1.4</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
Modified: jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/SettingsAction.java
===================================================================
--- jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/SettingsAction.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/admin/WEB-INF/classes/net/jetrix/servlets/SettingsAction.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -19,15 +19,25 @@
package net.jetrix.servlets;
-import net.jetrix.*;
-import net.jetrix.config.*;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Collection;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
-import javax.servlet.*;
-import javax.servlet.http.*;
-import java.io.*;
-import java.lang.reflect.*;
-import java.util.*;
+import org.apache.commons.lang.StringUtils;
+import net.jetrix.Channel;
+import net.jetrix.ChannelManager;
+import net.jetrix.Server;
+import net.jetrix.config.Block;
+import net.jetrix.config.Occurancy;
+import net.jetrix.config.Settings;
+import net.jetrix.config.Special;
+
/**
* Action Servlet handling the server and channels settings changes.
*
@@ -36,7 +46,6 @@
*/
public class SettingsAction extends HttpServlet
{
-
protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
{
Collection errors = new ArrayList();
@@ -61,41 +70,57 @@
settings = Settings.getDefaultSettings();
}
}
-
+
// update the special occurancies
boolean resetSpecials = true;
+ Occurancy<Special> specialOccurancy = settings.getSpecialOccurancy().clone();
for (Special special : Special.values())
{
String value = request.getParameter(special.getCode());
- resetSpecials = resetSpecials && (value == null || "".equals(value.trim()));
-
- if (value != null && !"".equals(value.trim()) && !value.equals(String.valueOf(settings.getOccurancy(special))))
+ resetSpecials = resetSpecials && StringUtils.isBlank(value);
+
+ if (StringUtils.isNotBlank(value))
{
- settings.setOccurancy(special, Integer.parseInt(value));
+ specialOccurancy.setOccurancy(special, Integer.parseInt(value));
}
}
-
- settings.setDefaultSpecialOccurancy(resetSpecials);
-
+
+ if (!specialOccurancy.equals(settings.getSpecialOccurancy()))
+ {
+ specialOccurancy.normalize();
+ settings.setSpecialOccurancy(specialOccurancy);
+ }
+ else if (resetSpecials)
+ {
+ settings.setDefaultSpecialOccurancy(true);
+ }
+
+
// update the block occurancies
boolean resetBlocks = true;
+ Occurancy<Block> blockOccurancy = settings.getBlockOccurancy().clone();
for (Block block : Block.values())
{
String value = request.getParameter(block.getCode());
- resetBlocks = resetBlocks && (value == null || "".equals(value.trim()));
-
- if (value != null && !"".equals(value.trim()) && !value.equals(String.valueOf(settings.getOccurancy(block))))
+ resetBlocks = resetBlocks && StringUtils.isBlank(value);
+
+ if (StringUtils.isNotBlank(value))
{
- settings.setOccurancy(block, Integer.parseInt(request.getParameter(block.getCode())));
+ blockOccurancy.setOccurancy(block, Integer.parseInt(value));
}
}
-
- settings.setDefaultSpecialOccurancy(resetSpecials);
-
- // normalize the occurancies
- settings.normalizeBlockOccurancy();
- settings.normalizeSpecialOccurancy();
-
+
+ if (!blockOccurancy.equals(settings.getBlockOccurancy()))
+ {
+ blockOccurancy.normalize();
+ settings.setBlockOccurancy(blockOccurancy);
+ }
+ else if (resetBlocks)
+ {
+ settings.setDefaultBlockOccurancy(true);
+ }
+
+
// update the game settings
updateSettingsField(settings, "startingLevel", request);
updateSettingsField(settings, "stackHeight", request);
Modified: jetrix/trunk/src/admin/settings.jsp
===================================================================
--- jetrix/trunk/src/admin/settings.jsp 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/admin/settings.jsp 2011-06-27 21:26:26 UTC (rev 872)
@@ -46,7 +46,7 @@
<table class="thin" style="width: 100%">
<tr>
- <th width="70%">Special</th>
+ <th width="70%">Block</th>
<th width="30%">Occurancy</th>
</tr>
<% for (Block block : Block.values()) { %>
Modified: jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/java/net/jetrix/commands/ModeCommand.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -67,11 +67,13 @@
public void updateSetting(Settings settings, int[] mode)
{
+ Occurancy<Block> occurancy = new Occurancy<Block>();
for (Block block : Block.values())
{
- settings.setOccurancy(block, mode[block.ordinal()]);
+ occurancy.setOccurancy(block, mode[block.ordinal()]);
}
-
+
+ settings.setBlockOccurancy(occurancy);
settings.setLinesPerSpecial(mode[7]);
settings.setSpecialAdded(mode[8]);
}
Modified: jetrix/trunk/src/java/net/jetrix/config/ChannelsRuleSet.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/config/ChannelsRuleSet.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/java/net/jetrix/config/ChannelsRuleSet.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -31,7 +31,6 @@
*/
class ChannelsRuleSet extends RuleSetBase
{
-
public void addRuleInstances(Digester digester)
{
digester.addCallMethod("tetrinet-channels/motd", "setMessageOfTheDay", 0);
@@ -54,21 +53,25 @@
digester.addCallMethod("*/classic-rules", "setClassicRules", 0, new Class[] {Boolean.TYPE});
digester.addCallMethod("*/average-levels", "setAverageLevels", 0, new Class[] {Boolean.TYPE});
digester.addCallMethod("*/same-blocks", "setSameBlocks", 0, new Class[] {Boolean.TYPE});
-
+
+ // block occurancy
+ digester.addObjectCreate("*/block-occurancy", Occurancy.class.getName());
+ digester.addCallMethod("*/block-occurancy", "normalize", 0, (Class[]) null);
+ digester.addSetNext("*/block-occurancy", "setBlockOccurancy", Occurancy.class.getName());
for (Block block : Block.values())
{
- digester.addRule("*/block-occurancy/" + block.getCode(), new OccurancyRule(digester, block));
+ digester.addRule("*/block-occurancy/" + block.getCode(), new OccurancyRule<Block>(digester, block));
}
-
- digester.addCallMethod("*/block-occurancy", "normalizeBlockOccurancy", 0, (Class[]) null);
-
+
+ // special occurancy
+ digester.addObjectCreate("*/special-occurancy", Occurancy.class.getName());
+ digester.addCallMethod("*/special-occurancy", "normalize", 0, (Class[]) null);
+ digester.addSetNext("*/special-occurancy", "setSpecialOccurancy", Occurancy.class.getName());
for (Special special : Special.values())
{
- digester.addRule("*/special-occurancy/" + special.getCode(), new OccurancyRule(digester, special));
+ digester.addRule("*/special-occurancy/" + special.getCode(), new OccurancyRule<Special>(digester, special));
}
-
- digester.addCallMethod("*/special-occurancy", "normalizeSpecialOccurancy", 0, (Class[]) null);
-
+
digester.addCallMethod("*/sudden-death/time", "setSuddenDeathTime", 0, new Class[] { Integer.TYPE });
digester.addCallMethod("*/sudden-death/message", "setSuddenDeathMessage", 0);
digester.addCallMethod("*/sudden-death/delay", "setSuddenDeathDelay", 0, new Class[] { Integer.TYPE });
@@ -133,41 +136,26 @@
/**
* Custom rule to set the block and special occurancies.
*/
- private class OccurancyRule extends Rule
+ private class OccurancyRule<T extends Enum> extends Rule
{
- private Block block;
- private Special special;
+ private T element;
- public OccurancyRule(Digester digester, Block block)
+ public OccurancyRule(Digester digester, T element)
{
super(digester);
- this.block = block;
+ this.element = element;
}
- public OccurancyRule(Digester digester, Special special)
- {
- super(digester);
- this.special = special;
- }
-
public void body(String body) throws Exception
{
// get the settings on the stack
- Settings settings = (Settings) digester.peek();
+ Occurancy<T> occurancy = (Occurancy<T>) digester.peek();
// get the value of the occurancy
int value = Integer.parseInt(body);
// set the value
- if (special == null)
- {
- settings.setOccurancy(block, value);
- }
- else
- {
- settings.setOccurancy(special, value);
- }
+ occurancy.setOccurancy(element, value);
}
}
-
}
Added: jetrix/trunk/src/java/net/jetrix/config/Occurancy.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/config/Occurancy.java (rev 0)
+++ jetrix/trunk/src/java/net/jetrix/config/Occurancy.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -0,0 +1,155 @@
+/**
+ * Jetrix TetriNET Server
+ * Copyright (C) 2011 Emmanuel Bourg
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.jetrix.config;
+
+import java.util.Arrays;
+
+/**
+ * The occurancies in percents of a set of elements.
+ *
+ * @author Emmanuel Bourg
+ * @version $Revision$, $Date$
+ * @since 0.3
+ */
+public class Occurancy<T extends Enum> implements Cloneable
+{
+ private int[] occurancies;
+
+ /**
+ * Sets the occurancy of the specified element.
+ *
+ * @param element
+ * @param value
+ */
+ public void setOccurancy(T element, int value)
+ {
+ if (occurancies == null)
+ {
+ Class enumType = element.getClass();
+ occurancies = new int[enumType.getEnumConstants().length];
+ }
+ occurancies[element.ordinal()] = value;
+ }
+
+ /**
+ * Returns the occurancy of the specified element.
+ *
+ * @param element
+ */
+ public int getOccurancy(T element)
+ {
+ return occurancies[element.ordinal()];
+ }
+
+ /**
+ * Normalizes the occurancies such that the sum is equal to 100.
+ * Negative values are considered null.
+ */
+ public void normalize()
+ {
+ normalize(this.occurancies);
+ }
+
+ void normalize(int[] occurancies)
+ {
+ int sum = 0;
+
+ // computing sum
+ for (int i = 0; i < occurancies.length; i++)
+ {
+ if (occurancies[i] < 0)
+ {
+ occurancies[i] = 0;
+ }
+ sum = sum + occurancies[i];
+ }
+
+ if (sum != 100)
+ {
+ // equalization
+ if (sum == 0)
+ {
+ int v = 100 / occurancies.length;
+ for (int i = 0; i < occurancies.length; i++)
+ {
+ occurancies[i] = v;
+ }
+ }
+ else
+ {
+ float f = 100f / sum;
+ for (int i = 0; i < occurancies.length; i++)
+ {
+ occurancies[i] = (int) (occurancies[i] * f);
+ }
+ }
+
+ // distributing points left
+ sum = 0;
+ for (int occurancy : occurancies)
+ {
+ sum = sum + occurancy;
+ }
+ int r = 100 - sum;
+ int i = 0;
+ while (i < occurancies.length && r > 0)
+ {
+ occurancies[i] = occurancies[i] + 1;
+ r = r - 1;
+ i = i + 1;
+ }
+ }
+ }
+
+ public boolean equals(Object o)
+ {
+ if (this == o)
+ {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass())
+ {
+ return false;
+ }
+
+ Occurancy occurancy = (Occurancy) o;
+
+ return Arrays.equals(occurancies, occurancy.occurancies);
+ }
+
+ public int hashCode()
+ {
+ return Arrays.hashCode(occurancies);
+ }
+
+ public final Occurancy<T> clone()
+ {
+ try
+ {
+ Occurancy<T> occurancy = (Occurancy<T>) super.clone();
+ occurancy.occurancies = occurancies.clone();
+ return occurancy;
+ }
+ catch (CloneNotSupportedException e)
+ {
+ throw new InternalError();
+ }
+ }
+}
Property changes on: jetrix/trunk/src/java/net/jetrix/config/Occurancy.java
___________________________________________________________________
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: jetrix/trunk/src/java/net/jetrix/config/Settings.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/config/Settings.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/java/net/jetrix/config/Settings.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -19,8 +19,6 @@
package net.jetrix.config;
-import java.util.*;
-
/**
* Game settings.
*
@@ -61,8 +59,8 @@
private int levelIncrease;
private int specialAdded;
private int specialCapacity;
- private int blockOccurancy[];
- private int specialOccurancy[];
+ private Occurancy<Block> blockOccurancy = new Occurancy<Block>();
+ private Occurancy<Special> specialOccurancy = new Occurancy<Special>();
private boolean averageLevels;
private boolean classicRules;
private boolean sameBlocks;
@@ -96,9 +94,6 @@
*/
public Settings(boolean useDefaultSettings)
{
- blockOccurancy = new int[Block.values().length];
- specialOccurancy = new int [Special.values().length];
-
if (useDefaultSettings)
{
defaultBlockOccurancy = true;
@@ -211,12 +206,12 @@
public int getOccurancy(Block piece)
{
- return isDefaultBlockOccurancy() ? defaultSettings.getOccurancy(piece) : blockOccurancy[piece.ordinal()];
+ return getBlockOccurancy().getOccurancy(piece);
}
public int getOccurancy(Special special)
{
- return isDefaultSpecialOccurancy() ? defaultSettings.getOccurancy(special) : specialOccurancy[special.ordinal()];
+ return getSpecialOccurancy().getOccurancy(special);
}
public void setStartingLevel(int startingLevel)
@@ -324,111 +319,28 @@
defaultSuddenDeathDelay = false;
}
-
- /**
- * Set the occurancy of a block.
- *
- * @since 0.2
- *
- * @param block
- * @param occurancy
- */
- public void setOccurancy(Block block, int occurancy)
+ public Occurancy<Block> getBlockOccurancy()
{
- if (defaultBlockOccurancy)
- {
- defaultBlockOccurancy = false;
- Arrays.fill(blockOccurancy, 0);
- }
-
- blockOccurancy[block.ordinal()] = occurancy;
+ return defaultBlockOccurancy ? defaultSettings.blockOccurancy : blockOccurancy;
}
- /**
- * Set the occurancy of a special block
- *
- * @since 0.2
- *
- * @param special
- * @param occurancy
- */
- public void setOccurancy(Special special, int occurancy)
+ public void setBlockOccurancy(Occurancy<Block> blockOccurancy)
{
- if (defaultSpecialOccurancy)
- {
- defaultSpecialOccurancy = false;
- Arrays.fill(specialOccurancy, 0);
- }
-
- specialOccurancy[special.ordinal()] = occurancy;
+ defaultBlockOccurancy = false;
+ this.blockOccurancy = blockOccurancy;
}
- /**
- * Normalize array values to get a sum equals to 100.
- * Any negative value is nullified.
- */
- protected void normalize(int[] tab)
+ public Occurancy<Special> getSpecialOccurancy()
{
- int sum = 0;
-
- // computing sum
- for (int i = 0; i < tab.length; i++)
- {
- if (tab[i] < 0)
- {
- tab[i] = 0;
- }
- sum = sum + tab[i];
- }
-
- if (sum != 100)
- {
- // equalization
- if (sum == 0)
- {
- int v = 100 / tab.length;
- for (int i = 0; i < tab.length; i++)
- {
- tab[i] = v;
- }
- }
- else
- {
- float f = 100f / sum;
- for (int i = 0; i < tab.length; i++)
- {
- tab[i] = (int) (tab[i] * f);
- }
- }
-
- // distributing points left
- sum = 0;
- for (int i = 0; i < tab.length; i++)
- {
- sum = sum + tab[i];
- }
- int r = 100 - sum;
- int i = 0;
- while (i < tab.length && r > 0)
- {
- tab[i] = tab[i] + 1;
- r = r - 1;
- i = i + 1;
- }
- }
+ return defaultSpecialOccurancy ? defaultSettings.specialOccurancy : specialOccurancy;
}
-
- public void normalizeBlockOccurancy()
+ public void setSpecialOccurancy(Occurancy<Special> specialOccurancy)
{
- normalize(blockOccurancy);
+ defaultSpecialOccurancy = false;
+ this.specialOccurancy = specialOccurancy;
}
- public void normalizeSpecialOccurancy()
- {
- normalize(specialOccurancy);
- }
-
private boolean isDefault()
{
return defaultSettings == null || this == defaultSettings;
Modified: jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/java/net/jetrix/filter/DownstackPuzzleGenerator.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -171,23 +171,27 @@
else if (line.startsWith("SPECIAL"))
{
// parse the special occurancies
- String[] occurancy = StringUtils.split(line.substring(7).trim(), ' ');
-
+ String[] values = StringUtils.split(line.substring(7).trim(), ' ');
+
+ Occurancy<Special> occurancy = new Occurancy<Special>();
for (Special special : Special.values())
{
- settings.setOccurancy(special, Integer.parseInt(occurancy[special.ordinal()]));
+ occurancy.setOccurancy(special, Integer.parseInt(values[special.ordinal()]));
}
+ settings.setSpecialOccurancy(occurancy);
}
else if (line.startsWith("BLOCK"))
{
// parse the block occurancies
- String[] occurancy = StringUtils.split(line.substring(5).trim(), ' ');
-
+ String[] values = StringUtils.split(line.substring(5).trim(), ' ');
+
// careful, it doesn't follow the standard order
+ Occurancy<Block> occurancy = new Occurancy<Block>();
for (int i = 0; i < BLOCKS.length; i++)
{
- settings.setOccurancy(BLOCKS[i], Integer.parseInt(occurancy[i]));
+ occurancy.setOccurancy(BLOCKS[i], Integer.parseInt(values[i]));
}
+ settings.setBlockOccurancy(occurancy);
}
else if (line.startsWith("SUDDENDEATHMSG"))
{
Modified: jetrix/trunk/src/java/net/jetrix/filter/RandomFilter.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/filter/RandomFilter.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/java/net/jetrix/filter/RandomFilter.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -19,11 +19,14 @@
package net.jetrix.filter;
-import java.util.*;
+import java.util.List;
-import net.jetrix.*;
-import net.jetrix.config.*;
-import net.jetrix.messages.channel.*;
+import net.jetrix.Message;
+import net.jetrix.config.Block;
+import net.jetrix.config.Occurancy;
+import net.jetrix.config.Settings;
+import net.jetrix.config.Special;
+import net.jetrix.messages.channel.NewGameMessage;
/**
* A filter randomizing the blocks and the specials occurancies when the game starts.
@@ -39,24 +42,25 @@
{
// get the settings
Settings settings = m.getSettings();
+
+ // randomize the block and special occurancies
+ settings.setBlockOccurancy(getRandomOccurancy(Block.class));
+ settings.setSpecialOccurancy(getRandomOccurancy(Special.class));
+
+ // forward the new game message
+ out.add(m);
+ }
- // randomize the block occurancies
- for (Block block : Block.values())
+ private <T extends Enum> Occurancy<T> getRandomOccurancy(Class<T> enumType)
+ {
+ Occurancy<T> occurancy = new Occurancy<T>();
+ for (T element : enumType.getEnumConstants())
{
- settings.setOccurancy(block, (int) (Math.random() * 100));
+ occurancy.setOccurancy(element, (int) (Math.random() * 100));
}
-
- settings.normalizeBlockOccurancy();
-
- for (Special special : Special.values())
- {
- settings.setOccurancy(special, (int) (Math.random() * 100));
- }
-
- settings.normalizeSpecialOccurancy();
-
- // forward the new game message
- out.add(m);
+
+ occurancy.normalize();
+
+ return occurancy;
}
-
}
Modified: jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -29,6 +29,7 @@
import net.jetrix.config.Block;
import net.jetrix.config.ServerConfig;
import net.jetrix.config.Settings;
+import net.jetrix.config.Occurancy;
import net.jetrix.messages.channel.EndGameMessage;
import net.jetrix.messages.channel.FieldMessage;
import net.jetrix.messages.channel.GmsgMessage;
@@ -81,11 +82,14 @@
protected void prologue(Client client)
{
// start the game at high speed with squares only
- Settings settings = new Settings();
- settings.setOccurancy(Block.SQUARE, 100);
+ Settings settings = new Settings(false);
settings.setStartingLevel(99);
settings.setAverageLevels(false);
+ Occurancy<Block> occurancy = new Occurancy<Block>();
+ occurancy.setOccurancy(Block.SQUARE, 100);
+ settings.setBlockOccurancy(occurancy);
+
client.send(new NewGameMessage(settings));
FieldMessage fieldmessage = new FieldMessage(getField().getFieldString());
Added: jetrix/trunk/src/test/net/jetrix/config/OccurancyTest.java
===================================================================
--- jetrix/trunk/src/test/net/jetrix/config/OccurancyTest.java (rev 0)
+++ jetrix/trunk/src/test/net/jetrix/config/OccurancyTest.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -0,0 +1,96 @@
+/**
+ * Jetrix TetriNET Server
+ * Copyright (C) 2011 Emmanuel Bourg
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.jetrix.config;
+
+import junit.framework.TestCase;
+import junitx.framework.ArrayAssert;
+
+/**
+ * @author Emmanuel Bourg
+ * @version $Revision$, $Date$
+ */
+public class OccurancyTest extends TestCase
+{
+ private long sum(int[] values)
+ {
+ long sum = 0;
+ for (int value : values)
+ {
+ sum = sum + value;
+ }
+ return sum;
+ }
+
+ public void testNormalize1()
+ {
+ Occurancy s = new Occurancy();
+ int[] tab = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
+ s.normalize(tab);
+ assertEquals("Erreur de normalisation", 100, sum(tab));
+ }
+
+ public void testNormalize2()
+ {
+ Occurancy s = new Occurancy();
+ int[] tab = { 0, 0, 0, 0, 0 };
+ s.normalize(tab);
+ assertEquals("Erreur de normalisation", 100, sum(tab));
+ assertEquals("tab[0]", 20, tab[0]);
+ assertEquals("tab[1]", 20, tab[1]);
+ assertEquals("tab[2]", 20, tab[2]);
+ assertEquals("tab[3]", 20, tab[3]);
+ assertEquals("tab[4]", 20, tab[4]);
+ }
+
+ public void testNormalize3()
+ {
+ Occurancy s = new Occurancy();
+ int[] tab = { 100, 200, 300, 50, 100, 50, 250, 300 };
+ s.normalize(tab);
+ assertEquals("Erreur de normalisation", 100, sum(tab));
+ }
+
+ public void testNormalize4()
+ {
+ Occurancy s = new Occurancy();
+ int[] tab = { 8, 14, 1, 19, 5, 15, 3, 17, 6, 12 };
+ s.normalize(tab);
+ assertEquals("Erreur de normalisation", 100, sum(tab));
+ }
+
+ public void testNormalize5()
+ {
+ Occurancy s = new Occurancy();
+ int[] tab4 = { 8, 14, 1, 19, 5, 15, 3, 17, 6, 12 };
+ int[] tab5 = { 8, 14, 1, 19, 5, 15, 3, 17, 6, 12 };
+ s.normalize(tab4);
+ ArrayAssert.assertEquals("Normalization error", tab4, tab5);
+ }
+
+ public void testNormalize6()
+ {
+ Occurancy s = new Occurancy();
+ int[] tab = { 0, -10 };
+ s.normalize(tab);
+ assertEquals("Erreur de normalisation", 100, sum(tab));
+ assertEquals("tab[0]", 50, tab[0]);
+ assertEquals("tab[1]", 50, tab[1]);
+ }
+}
Property changes on: jetrix/trunk/src/test/net/jetrix/config/OccurancyTest.java
___________________________________________________________________
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: jetrix/trunk/src/test/net/jetrix/config/SettingsTest.java
===================================================================
--- jetrix/trunk/src/test/net/jetrix/config/SettingsTest.java 2011-04-20 07:46:12 UTC (rev 871)
+++ jetrix/trunk/src/test/net/jetrix/config/SettingsTest.java 2011-06-27 21:26:26 UTC (rev 872)
@@ -19,7 +19,7 @@
package net.jetrix.config;
-import junit.framework.*;
+import junit.framework.TestCase;
/**
* JUnit TestCase for the class net.jetrix.config.Settings
@@ -49,8 +49,8 @@
defaultSettings.setSuddenDeathMessage("Hurry Up!");
defaultSettings.setSuddenDeathTime(20);
- defaultSettings.setOccurancy(Block.LINE, 10);
- defaultSettings.setOccurancy(Special.GRAVITY, 10);
+ defaultSettings.getBlockOccurancy().setOccurancy(Block.LINE, 10);
+ defaultSettings.getSpecialOccurancy().setOccurancy(Special.GRAVITY, 10);
Settings.setDefaultSettings(defaultSettings);
}
@@ -60,93 +60,6 @@
assertEquals(defaultSettings, Settings.getDefaultSettings());
}
- public void testNormalize1()
- {
- Settings s = new Settings();
- int[] tab = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
- s.normalize(tab);
- assertEquals("Erreur de normalisation", 100, sum(tab));
- }
-
- public void testNormalize2()
- {
- Settings s = new Settings();
- int[] tab = { 0, 0, 0, 0, 0 };
- s.normalize(tab);
- assertEquals("Erreur de normalisation", 100, sum(tab));
- assertEquals("tab[0]", 20, tab[0]);
- assertEquals("tab[1]", 20, tab[1]);
- assertEquals("tab[2]", 20, tab[2]);
- assertEquals("tab[3]", 20, tab[3]);
- assertEquals("tab[4]", 20, tab[4]);
- }
-
- public void testNormalize3()
- {
- Settings s = new Settings();
- int[] tab = { 100, 200, 300, 50, 100, 50, 250, 300 };
- s.normalize(tab);
- assertEquals("Erreur de normalisation", 100, sum(tab));
- }
-
- public void testNormalize4()
- {
- Settings s = new Settings();
- int[] tab = { 8, 14, 1, 19, 5, 15, 3, 17, 6, 12 };
- s.normalize(tab);
- assertEquals("Erreur de normalisation", 100, sum(tab));
- }
-
- public void testNormalize5()
- {
- Settings s = new Settings();
- int[] tab4 = { 8, 14, 1, 19, 5, 15, 3, 17, 6, 12 };
- int[] tab5 = { 8, 14, 1, 19, 5, 15, 3, 17, 6, 12 };
- s.normalize(tab4);
- assertTrue("Erreur de normalisation", equals(tab4, tab5));
- }
-
- public void testNormalize6()
- {
- Settings s = new Settings();
- int[] tab = { 0, -10 };
- s.normalize(tab);
- assertEquals("Erreur de normalisation", 100, sum(tab));
- assertEquals("tab[0]", 50, tab[0]);
- assertEquals("tab[1]", 50, tab[1]);
- }
-
- private long sum(int[] tab)
- {
- long s = 0;
- for(int i=0; i<tab.length; i++) s = s + tab[i];
- return s;
- }
-
- /**
- * todo: replace with ArrayAssert from junit-addons
- */
- private boolean equals(int[] a, int[] b)
- {
- boolean equals = true;
-
- if (a.length == b.length)
- {
- int i=0;
- while(equals && i<a.length)
- {
- equals = (a[i]==b[i]);
- i++;
- }
- }
- else
- {
- equals = false;
- }
-
- return equals;
- }
-
public void testAverageLevels()
{
Settings settings = new Settings();
@@ -263,7 +176,7 @@
{
Settings settings = new Settings();
assertEquals(defaultSettings.getOccurancy(Block.LINE), settings.getOccurancy(Block.LINE));
- settings.setOccurancy(Block.LINE, 50);
+ settings.getBlockOccurancy().setOccurancy(Block.LINE, 50);
assertEquals(50, settings.getOccurancy(Block.LINE));
}
@@ -271,8 +184,7 @@
{
Settings settings = new Settings();
assertEquals(defaultSettings.getOccurancy(Special.GRAVITY), settings.getOccurancy(Special.GRAVITY));
- settings.setOccurancy(Special.GRAVITY, 50);
+ settings.getSpecialOccurancy().setOccurancy(Special.GRAVITY, 50);
assertEquals(50, settings.getOccurancy(Special.GRAVITY));
}
-
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2011-04-20 07:46:18
|
Revision: 871
http://jetrix.svn.sourceforge.net/jetrix/?rev=871&view=rev
Author: smanux
Date: 2011-04-20 07:46:12 +0000 (Wed, 20 Apr 2011)
Log Message:
-----------
6to4 addresses are no longer submitted to the server directory
Modified Paths:
--------------
jetrix/trunk/src/java/net/jetrix/services/PublishingService.java
Modified: jetrix/trunk/src/java/net/jetrix/services/PublishingService.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2010-09-16 20:50:33 UTC (rev 870)
+++ jetrix/trunk/src/java/net/jetrix/services/PublishingService.java 2011-04-20 07:46:12 UTC (rev 871)
@@ -25,6 +25,7 @@
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.HttpURLConnection;
+import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
@@ -52,7 +53,6 @@
*/
public class PublishingService extends ScheduledService
{
-
private Logger log = Logger.getLogger("net.jetrix");
private String host;
@@ -226,7 +226,8 @@
InetAddress addr = addresses.nextElement();
if (!addr.isLoopbackAddress()
&& !addr.isLinkLocalAddress()
- && !addr.isSiteLocalAddress())
+ && !addr.isSiteLocalAddress()
+ && !is6to4(addr))
{
address = addr;
}
@@ -235,10 +236,18 @@
}
catch (SocketException e)
{
- log.log(Level.WARNING, e.getMessage(), e);
+ log.log(Level.WARNING, "Couldn't find the network address", e);
}
return address;
}
+ /**
+ * Check if the specified address is a 6to4 address (an IPv6 address starting with the 2002: prefix).
+ * @since 0.3
+ */
+ private boolean is6to4(InetAddress addr)
+ {
+ return (addr instanceof Inet6Address) && addr.getHostName().startsWith("2002");
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-09-16 20:50:39
|
Revision: 870
http://jetrix.svn.sourceforge.net/jetrix/?rev=870&view=rev
Author: smanux
Date: 2010-09-16 20:50:33 +0000 (Thu, 16 Sep 2010)
Log Message:
-----------
Field loading from a stream
Modified Paths:
--------------
jetrix/trunk/src/java/net/jetrix/Field.java
Modified: jetrix/trunk/src/java/net/jetrix/Field.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/Field.java 2010-08-28 22:22:39 UTC (rev 869)
+++ jetrix/trunk/src/java/net/jetrix/Field.java 2010-09-16 20:50:33 UTC (rev 870)
@@ -266,44 +266,54 @@
}
}
-
/**
- * Load the field from the specified file
+ * Load the field from the specified stream
*
* @since 0.3
*/
- public void load(String file) throws IOException
+ public void load(InputStream in) throws IOException
{
- BufferedReader in = null;
-
- try
+ BufferedReader reader = new BufferedReader(new InputStreamReader(in));
+
+ for (int i = 0; i < HEIGHT; i++)
{
- in = new BufferedReader(new FileReader(file));
+ String line = reader.readLine();
- for (int i = 0; i < HEIGHT; i++)
+ if (line == null || line.length() != WIDTH)
{
- String line = in.readLine();
+ throw new IOException("Field format error at line " + i);
+ }
+
+ for (int j = 0; j < WIDTH; j++)
+ {
+ byte block = (byte) line.charAt(j);
- if (line == null || line.length() != WIDTH)
+ if (isValidBlock(block))
{
- throw new IOException("Field format error at line " + i);
+ field[j][HEIGHT - i - 1] = block;
}
-
- for (int j = 0; j < WIDTH; j++)
+ else
{
- byte block = (byte) line.charAt(j);
-
- if (isValidBlock(block))
- {
- field[j][HEIGHT - i - 1] = block;
- }
- else
- {
- throw new IOException("Illegal block '" + block + "' at line " + i + " , column " + j);
- }
+ throw new IOException("Illegal block '" + block + "' at line " + i + " , column " + j);
}
}
}
+ }
+
+ /**
+ * Load the field from the specified file
+ *
+ * @since 0.3
+ */
+ public void load(String file) throws IOException
+ {
+ InputStream in = null;
+
+ try
+ {
+ in = new FileInputStream(file);
+ load(in);
+ }
finally
{
if (in != null)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-28 22:22:45
|
Revision: 869
http://jetrix.svn.sourceforge.net/jetrix/?rev=869&view=rev
Author: smanux
Date: 2010-08-28 22:22:39 +0000 (Sat, 28 Aug 2010)
Log Message:
-----------
Explicit maximum heap size
Modified Paths:
--------------
jetrix/trunk/src/bin/jetrix.bat
jetrix/trunk/src/bin/launcher.nsi
jetrix/trunk/src/etc/deb/data/etc/default/jetrix
jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix
Modified: jetrix/trunk/src/bin/jetrix.bat
===================================================================
--- jetrix/trunk/src/bin/jetrix.bat 2010-08-27 11:41:18 UTC (rev 868)
+++ jetrix/trunk/src/bin/jetrix.bat 2010-08-28 22:22:39 UTC (rev 869)
@@ -5,4 +5,4 @@
IF NOT JAVA_HOME == "" SET JAVA_EXE="%JAVA_HOME%\bin\java"
IF JAVA_HOME == "" SET JAVA_EXE=java
-%JAVA_EXE% -Djava.library.path=lib -jar lib/jetrix-launcher-@version@.jar %1
+%JAVA_EXE% -Xmx128m -Djava.library.path=lib -jar lib/jetrix-launcher-@version@.jar %1
Modified: jetrix/trunk/src/bin/launcher.nsi
===================================================================
--- jetrix/trunk/src/bin/launcher.nsi 2010-08-27 11:41:18 UTC (rev 868)
+++ jetrix/trunk/src/bin/launcher.nsi 2010-08-28 22:22:39 UTC (rev 869)
@@ -18,7 +18,7 @@
AutoCloseWindow true
ShowInstDetails nevershow
-!define ARGS "-Djava.library.path=lib -jar lib/jetrix-launcher-@version@.jar"
+!define ARGS "-Xmx128m -Djava.library.path=lib -jar lib/jetrix-launcher-@version@.jar"
Section ""
Call GetJRE
Modified: jetrix/trunk/src/etc/deb/data/etc/default/jetrix
===================================================================
--- jetrix/trunk/src/etc/deb/data/etc/default/jetrix 2010-08-27 11:41:18 UTC (rev 868)
+++ jetrix/trunk/src/etc/deb/data/etc/default/jetrix 2010-08-28 22:22:39 UTC (rev 869)
@@ -3,3 +3,6 @@
# Master system-wide jetrix switch. The initscript
# will not run if it is not set to yes.
RUN="yes"
+
+# Arguments to pass to the Java virtual machine (JVM).
+JAVA_OPTS=-Xmx128m
Modified: jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix
===================================================================
--- jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix 2010-08-27 11:41:18 UTC (rev 868)
+++ jetrix/trunk/src/etc/deb/data/etc/init.d/jetrix 2010-08-28 22:22:39 UTC (rev 869)
@@ -1,11 +1,16 @@
#!/bin/sh
+#
+# Debian system startup script for Jetrix
+#
+#
### BEGIN INIT INFO
# Provides: tetrinet-server jetrix
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
-# Short-Description: Init script for Jetrix
+# Short-Description: Jetrix TetriNET Server
+# Description: Jetrix TetriNET Server (http://jetrix.sourceforge.net)
### END INIT INFO
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-27 11:41:24
|
Revision: 868
http://jetrix.svn.sourceforge.net/jetrix/?rev=868&view=rev
Author: smanux
Date: 2010-08-27 11:41:18 +0000 (Fri, 27 Aug 2010)
Log Message:
-----------
Fixed the end logo on non standard clients
The semantic of the color code '6' has been changed, it now stands for the previous color instead of a random color. This code is no longer sent to the client, the actual value is computed by the server and then sent to the client.
Modified Paths:
--------------
jetrix/trunk/doc/changelog.txt
jetrix/trunk/src/java/net/jetrix/Channel.java
jetrix/trunk/src/java/net/jetrix/Field.java
jetrix/trunk/src/java/net/jetrix/messages/channel/FieldMessage.java
Modified: jetrix/trunk/doc/changelog.txt
===================================================================
--- jetrix/trunk/doc/changelog.txt 2010-08-26 12:32:10 UTC (rev 867)
+++ jetrix/trunk/doc/changelog.txt 2010-08-27 11:41:18 UTC (rev 868)
@@ -14,6 +14,7 @@
- Channels can be dedicated to TetriFast or non TetriFast clients. A warning is displayed when mixed clients play together.
- Spaces in team names are now properly handled
- The winner can now hear the victory sound at the end of the game
+- The end screen displayed after a player has lost renders properly on alternative clients
Admin visible changes
- Jetrix now requires Java 6
Modified: jetrix/trunk/src/java/net/jetrix/Channel.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/Channel.java 2010-08-26 12:32:10 UTC (rev 867)
+++ jetrix/trunk/src/java/net/jetrix/Channel.java 2010-08-27 11:41:18 UTC (rev 868)
@@ -173,7 +173,7 @@
}
/**
- * Main loop. The channel listens for incomming messages until the server
+ * Main loop. The channel listens for incoming messages until the server
* or the channel closes. Every message is first passed through the
* registered filters and then handled by the channel.
*/
@@ -437,6 +437,11 @@
}
else
{
+ if (m.isFullUpdate())
+ {
+ // rewrite the field to handle properly the BLOCK_PREVIOUS type on non standard client
+ m.setField(fields[slot - 1].getFieldString());
+ }
sendAll(m);
}
}
@@ -665,7 +670,7 @@
client.send(winlistMessage);
}
- // send a welcome message to the incomming client
+ // send a welcome message to the incoming client
PlineMessage mwelcome = new PlineMessage();
mwelcome.setKey("channel.welcome", client.getUser().getName(), channelConfig.getName());
client.send(mwelcome);
Modified: jetrix/trunk/src/java/net/jetrix/Field.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/Field.java 2010-08-26 12:32:10 UTC (rev 867)
+++ jetrix/trunk/src/java/net/jetrix/Field.java 2010-08-27 11:41:18 UTC (rev 868)
@@ -1,6 +1,6 @@
/**
* Jetrix TetriNET Server
- * Copyright (C) 2001-2005 Emmanuel Bourg
+ * Copyright (C) 2001-2010 Emmanuel Bourg
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -21,9 +21,9 @@
import static net.jetrix.config.Special.*;
-import java.util.logging.*;
-import java.util.*;
import java.io.*;
+import java.util.*;
+import java.util.logging.*;
import net.jetrix.config.*;
import net.jetrix.messages.channel.*;
@@ -36,34 +36,35 @@
*/
public class Field
{
+ private static Logger log = Logger.getLogger("net.jetrix");
+
public static final int WIDTH = 12;
public static final int HEIGHT = 22;
- public static final byte BLOCK_VOID = '0';
- public static final byte BLOCK_BLUE = '1';
- public static final byte BLOCK_YELLOW = '2';
- public static final byte BLOCK_GREEN = '3';
- public static final byte BLOCK_PURPLE = '4';
- public static final byte BLOCK_RED = '5';
- public static final byte BLOCK_RANDOM = '6';
+ public static final byte BLOCK_VOID = '0';
+ public static final byte BLOCK_BLUE = '1';
+ public static final byte BLOCK_YELLOW = '2';
+ public static final byte BLOCK_GREEN = '3';
+ public static final byte BLOCK_PURPLE = '4';
+ public static final byte BLOCK_RED = '5';
+ public static final byte BLOCK_PREVIOUS = '6';
- private static final byte blocks[] =
- new byte[] { BLOCK_VOID, BLOCK_BLUE, BLOCK_YELLOW, BLOCK_GREEN, BLOCK_PURPLE, BLOCK_RED,
- (byte) ADDLINE.getLetter(),
- (byte) CLEARLINE.getLetter(),
- (byte) NUKEFIELD.getLetter(),
- (byte) RANDOMCLEAR.getLetter(),
- (byte) SWITCHFIELD.getLetter(),
- (byte) CLEARSPECIAL.getLetter(),
- (byte) GRAVITY.getLetter(),
- (byte) QUAKEFIELD.getLetter(),
- (byte) BLOCKBOMB.getLetter() };
+ /** The index of blocks used in a partial update. */
+ private static final byte[] BLOCKS = {
+ BLOCK_VOID, BLOCK_BLUE, BLOCK_YELLOW, BLOCK_GREEN, BLOCK_PURPLE, BLOCK_RED,
+ (byte) ADDLINE.getLetter(),
+ (byte) CLEARLINE.getLetter(),
+ (byte) NUKEFIELD.getLetter(),
+ (byte) RANDOMCLEAR.getLetter(),
+ (byte) SWITCHFIELD.getLetter(),
+ (byte) CLEARSPECIAL.getLetter(),
+ (byte) GRAVITY.getLetter(),
+ (byte) QUAKEFIELD.getLetter(),
+ (byte) BLOCKBOMB.getLetter()};
- /** Array of blocks. (0, 0) is the bottom left block, and (12, 22) is the upper right block. */
+ /** Array of blocks. (0, 0) is the bottom left block, and (11, 21) is the upper right block. */
private byte[][] field = new byte[WIDTH][HEIGHT];
- private Logger log = Logger.getLogger("net.jetrix");
-
public Field()
{
clear();
@@ -180,51 +181,44 @@
* Update the field with the specified FieldMessage.
*/
public void update(FieldMessage message)
- {
- String fieldString = message.getField();
- if (fieldString != null && fieldString.length() > 0)
+ {
+ if (message.isPartialUpdate())
{
- char first = fieldString.charAt(0);
- if (first >= 0x21 && first <= 0x2f)
+ StringTokenizer tokenizer = new StringTokenizer(message.getField(), "!\"#$%&'()*+,-./", true);
+
+ while (tokenizer.hasMoreTokens())
{
- // partial update
- StringTokenizer tokenizer = new StringTokenizer(fieldString, "!\"#$%&'()*+,-./", true);
-
- while (tokenizer.hasMoreTokens())
+ // block type
+ String type = tokenizer.nextToken();
+ byte color = BLOCKS[type.charAt(0) - 0x21];
+
+ // locations
+ String locations = tokenizer.nextToken();
+ for (int i = 0; i < locations.length(); i = i + 2)
{
- // block type
- String type = tokenizer.nextToken();
- byte color = blocks[type.charAt(0) - 0x21];
-
- // locations
- String locations = tokenizer.nextToken();
- for (int i = 0; i < locations.length(); i = i + 2)
- {
- int x = locations.charAt(i) - '3';
- int y = HEIGHT - (locations.charAt(i + 1) - '3') - 1;
- field[x][y] = color;
- }
+ int x = locations.charAt(i) - '3';
+ int y = HEIGHT - (locations.charAt(i + 1) - '3') - 1;
+ field[x][y] = color;
}
}
- else if (fieldString.length() == WIDTH * HEIGHT)
+ }
+ else if (message.isFullUpdate())
+ {
+ String fieldString = message.getField();
+ for (int i = 0; i < fieldString.length(); i++)
{
- // full update
- for (int i = 0; i < fieldString.length(); i++)
+ char c = fieldString.charAt(i);
+ if (c != BLOCK_PREVIOUS)
{
- char c = fieldString.charAt(i);
-
- // replace random colored blocks
- c = (c == BLOCK_RANDOM) ? (char) (BLOCK_BLUE + ((int) (Math.random() * 5))) : c;
-
field[i % WIDTH][HEIGHT - i / WIDTH - 1] = (byte) c;
}
}
- else
- {
- // malformed message
- log.warning("Malformed field update received from " + message.getSource());
- }
}
+ else if (!message.isEmpty())
+ {
+ // malformed message
+ log.warning("Malformed field update received from " + message.getSource());
+ }
}
/**
@@ -248,7 +242,7 @@
/**
* Return the block at the specified location. (0, 0) is the bottom left
- * block, and (12, 22) is the upper right block.
+ * block, and (11, 21) is the upper right block.
*
* @param x
* @param y
Modified: jetrix/trunk/src/java/net/jetrix/messages/channel/FieldMessage.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/messages/channel/FieldMessage.java 2010-08-26 12:32:10 UTC (rev 867)
+++ jetrix/trunk/src/java/net/jetrix/messages/channel/FieldMessage.java 2010-08-27 11:41:18 UTC (rev 868)
@@ -19,6 +19,8 @@
package net.jetrix.messages.channel;
+import net.jetrix.Field;
+
/**
* A field change message.
*
@@ -52,4 +54,39 @@
this.field = field;
}
+ /**
+ * Tells if the field message is a full update.
+ *
+ * @since 0.3
+ */
+ public boolean isFullUpdate()
+ {
+ return !isEmpty() && field.length() == Field.WIDTH * Field.HEIGHT;
+ }
+
+ /**
+ * Tells if the field message is a partial update.
+ *
+ * @since 0.3
+ */
+ public boolean isPartialUpdate()
+ {
+ if (isEmpty())
+ {
+ return false;
+ }
+
+ char first = field.charAt(0);
+ return first >= 0x21 && first <= 0x2f;
+ }
+
+ /**
+ * Tells if the field message is empty.
+ *
+ * @since 0.3
+ */
+ public boolean isEmpty()
+ {
+ return field == null || field.length() == 0;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-26 12:32:16
|
Revision: 867
http://jetrix.svn.sourceforge.net/jetrix/?rev=867&view=rev
Author: smanux
Date: 2010-08-26 12:32:10 +0000 (Thu, 26 Aug 2010)
Log Message:
-----------
Enabled TCP_NODELAY on the sockets
Modified Paths:
--------------
jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java
Modified: jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2010-08-23 15:02:51 UTC (rev 866)
+++ jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2010-08-26 12:32:10 UTC (rev 867)
@@ -24,7 +24,6 @@
import java.util.*;
import java.util.logging.*;
-
import net.jetrix.*;
import net.jetrix.clients.*;
import net.jetrix.config.*;
@@ -33,7 +32,7 @@
import net.jetrix.services.*;
/**
- * Abstract Listener waiting for incomming clients.
+ * Abstract Listener waiting for incoming clients.
*
* @author Emmanuel Bourg
* @version $Revision$, $Date$
@@ -60,24 +59,22 @@
{
log = Logger.getLogger("net.jetrix");
ServerConfig serverConfig = Server.getInstance().getConfig();
- running = true;
-
+
try
{
// bind the listener to the host & port
serverSocket = new ServerSocket(getPort(), 50, serverConfig.getHost());
+ running = true;
log.info("Listening at " + getName() + " port " + getPort()
+ ((serverConfig.getHost() != null) ? ", bound to " + serverConfig.getHost() : ""));
}
catch (BindException e)
{
log.severe("Unable to bind " + getName() + " listener at port " + getPort());
- running = false;
}
catch (IOException e)
{
- log.severe("Cannot open ServerSocket");
- e.printStackTrace();
+ log.log(Level.SEVERE, "Cannot open ServerSocket on port " + getPort(), e);
}
while (serverConfig.isRunning() && running)
@@ -87,7 +84,9 @@
// waiting for connexions
socket = serverSocket.accept();
socket.setSoTimeout(10000);
-
+ socket.setTcpNoDelay(true);
+ socket.setTrafficClass(0x10); // low delay
+
InetAddress address = socket.getInetAddress();
// log the connection
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-23 15:02:58
|
Revision: 866
http://jetrix.svn.sourceforge.net/jetrix/?rev=866&view=rev
Author: smanux
Date: 2010-08-23 15:02:51 +0000 (Mon, 23 Aug 2010)
Log Message:
-----------
Implemented the speed check
Modified Paths:
--------------
jetrix/trunk/doc/changelog.txt
jetrix/trunk/src/etc/conf/server.xml
jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java
jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java
jetrix/trunk/src/java/net/jetrix/messages/channel/LevelMessage.java
Added Paths:
-----------
jetrix/trunk/src/etc/data/speedcheck.field
jetrix/trunk/src/java/net/jetrix/listeners/interceptor/InteractiveInterceptor.java
jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java
Modified: jetrix/trunk/doc/changelog.txt
===================================================================
--- jetrix/trunk/doc/changelog.txt 2010-08-23 14:40:34 UTC (rev 865)
+++ jetrix/trunk/doc/changelog.txt 2010-08-23 15:02:51 UTC (rev 866)
@@ -22,6 +22,7 @@
- Channels can now be created from the administration console
- The IP of the server is no longer submitted to tfast.org since the site is dead
- The web administration console has been moved from port 8080 to port 31460
+- The client speed can now be checked by setting the server property 'speedcheck.enabled" to "true"
Developer visible changes
- added a readLine(Reader) method in the Protocol interface
Modified: jetrix/trunk/src/etc/conf/server.xml
===================================================================
--- jetrix/trunk/src/etc/conf/server.xml 2010-08-23 14:40:34 UTC (rev 865)
+++ jetrix/trunk/src/etc/conf/server.xml 2010-08-23 15:02:51 UTC (rev 866)
@@ -129,7 +129,7 @@
<!-- Extended properties -->
<properties>
- <property name="speedcheck.enable" value="false"/>
+ <property name="speedcheck.enabled" value="false"/>
</properties>
</tetrinet-server>
Added: jetrix/trunk/src/etc/data/speedcheck.field
===================================================================
--- jetrix/trunk/src/etc/data/speedcheck.field (rev 0)
+++ jetrix/trunk/src/etc/data/speedcheck.field 2010-08-23 15:02:51 UTC (rev 866)
@@ -0,0 +1,22 @@
+000040040000
+000000000000
+000040011011
+011100000100
+100010011111
+111110000000
+000000010001
+100010010001
+101010011111
+111110000000
+000000010001
+100010010101
+101010011111
+111110000000
+000000011111
+111040000100
+101000011111
+111110000000
+000000010001
+101110010001
+101010011111
+111010000000
\ No newline at end of file
Modified: jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-08-23 14:40:34 UTC (rev 865)
+++ jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-08-23 15:02:51 UTC (rev 866)
@@ -1044,7 +1044,6 @@
*/
public void setProperty(String key, String value)
{
- System.out.println("setting " + key + " to " + value);
properties.setProperty(key, value);
}
}
Modified: jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2010-08-23 14:40:34 UTC (rev 865)
+++ jetrix/trunk/src/java/net/jetrix/listeners/ClientListener.java 2010-08-23 15:02:51 UTC (rev 866)
@@ -205,7 +205,8 @@
Collection<ClientInterceptor> validators = new ArrayList<ClientInterceptor>();
validators.add(new AccessInterceptor());
validators.add(new NameCheckInterceptor());
-
+ validators.add(new SpeedCheckInterceptor());
+
// run the validators
for (ClientInterceptor interceptor : validators)
{
Added: jetrix/trunk/src/java/net/jetrix/listeners/interceptor/InteractiveInterceptor.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/interceptor/InteractiveInterceptor.java (rev 0)
+++ jetrix/trunk/src/java/net/jetrix/listeners/interceptor/InteractiveInterceptor.java 2010-08-23 15:02:51 UTC (rev 866)
@@ -0,0 +1,179 @@
+/**
+ * Jetrix TetriNET Server
+ * Copyright (C) 2010 Emmanuel Bourg
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.jetrix.listeners.interceptor;
+
+import java.io.IOException;
+import java.net.SocketException;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import net.jetrix.Client;
+import net.jetrix.Destination;
+import net.jetrix.Message;
+import net.jetrix.clients.QueryClient;
+import net.jetrix.clients.TetrinetClient;
+import net.jetrix.messages.channel.PlayerNumMessage;
+
+/**
+ * Interceptor expecting a response from the client (a password, a speed check, etc).
+ *
+ * @author Emmanuel Bourg
+ * @version $Revision$, $Date$
+ * @since 0.3
+ */
+public abstract class InteractiveInterceptor implements ClientInterceptor, Destination
+{
+ protected Logger log = Logger.getLogger("net.jetrix");
+
+ private BlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
+
+ private boolean running;
+
+ public void process(Client client) throws ClientValidationException
+ {
+ if (client instanceof QueryClient)
+ {
+ return;
+ }
+
+ // adjust the read timeout for the client
+ if (client instanceof TetrinetClient)
+ {
+ TetrinetClient c = (TetrinetClient) client;
+ try
+ {
+ c.getSocket().setSoTimeout(2 * getTimeout() * 1000);
+ }
+ catch (SocketException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ // start listening the messages sent by the client
+ MessageReader messageReader = new MessageReader(client);
+ messageReader.start();
+
+ // initiates the dialogue
+ client.send(new PlayerNumMessage(1));
+ prologue(client);
+
+ // wait until the client is processed
+ try
+ {
+ Boolean accepted = queue.poll(getTimeout(), TimeUnit.SECONDS);
+ if ((accepted == null || accepted == Boolean.FALSE) && isValidating())
+ {
+ log.info("Rejecting " + client);
+ client.disconnect();
+ throw new ClientValidationException();
+ }
+ else
+ {
+ log.info("Accepting: " + client);
+ }
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Returns the time to wait for a response from the client.
+ */
+ protected abstract int getTimeout();
+
+ /**
+ * Initiates the interaction with the client (i.e. display a message)
+ */
+ protected abstract void prologue(Client client);
+
+ /**
+ * Process a message received from the client.
+ *
+ * @param message
+ */
+ public abstract void send(Message message);
+
+
+ protected void accept()
+ {
+ try
+ {
+ running = false;
+ queue.put(Boolean.TRUE);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ protected void reject()
+ {
+ try
+ {
+ running = false;
+ queue.put(Boolean.FALSE);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ private class MessageReader extends Thread
+ {
+ private Client client;
+
+ private MessageReader(Client client)
+ {
+ setDaemon(true);
+ this.client = client;
+ }
+
+ public void run()
+ {
+ running = true;
+
+ try
+ {
+ log.finer("Message reader started (" + this + ")");
+ Message message;
+ while (running && (message = client.receive()) != null)
+ {
+ send(message);
+ }
+ }
+ catch (IOException e)
+ {
+ log.log(Level.WARNING, "Error reading client message during the interception", e);
+ }
+ finally
+ {
+ log.finer("Message reader stopped (" + this + ")");
+ }
+ }
+ }
+}
Property changes on: jetrix/trunk/src/java/net/jetrix/listeners/interceptor/InteractiveInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Added: jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java (rev 0)
+++ jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java 2010-08-23 15:02:51 UTC (rev 866)
@@ -0,0 +1,161 @@
+/**
+ * Jetrix TetriNET Server
+ * Copyright (C) 2010 Emmanuel Bourg
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.jetrix.listeners.interceptor;
+
+import java.io.IOException;
+import java.util.logging.Level;
+
+import net.jetrix.Client;
+import net.jetrix.Field;
+import net.jetrix.Message;
+import net.jetrix.Server;
+import net.jetrix.config.Block;
+import net.jetrix.config.ServerConfig;
+import net.jetrix.config.Settings;
+import net.jetrix.messages.channel.EndGameMessage;
+import net.jetrix.messages.channel.FieldMessage;
+import net.jetrix.messages.channel.GmsgMessage;
+import net.jetrix.messages.channel.NewGameMessage;
+import net.jetrix.messages.channel.PlayerLostMessage;
+
+/**
+ * Interceptor checking the delay between two successive pieces.
+ *
+ * @author Emmanuel Bourg
+ * @version $Revision$, $Date$
+ * @since 0.3
+ */
+public class SpeedCheckInterceptor extends InteractiveInterceptor
+{
+ /** The time the speed check was started */
+ private long startTime;
+
+ /** The cumulated delay between the piece drops (~83000 expected for a standard client, 17500 for a tetrifast client) */
+ private long sum = -1;
+
+ protected Field getField()
+ {
+ Field field = new Field();
+
+ try
+ {
+ field.load("data/speedcheck.field");
+ }
+ catch (IOException e)
+ {
+ log.log(Level.WARNING, "Unable to load the speedcheck field", e);
+ }
+
+ return field;
+ }
+
+ public void process(Client client) throws ClientValidationException
+ {
+ ServerConfig config = Server.getInstance().getConfig();
+ boolean enabled = "true".equals(config.getProperty("speedcheck.enabled"));
+
+ // skip the test for tetrifast clients
+ if (enabled && !"tetrifast".equals(client.getProtocol().getName()))
+ {
+ super.process(client);
+ }
+ }
+
+ protected void prologue(Client client)
+ {
+ // start the game at high speed with squares only
+ Settings settings = new Settings();
+ settings.setOccurancy(Block.SQUARE, 100);
+ settings.setStartingLevel(99);
+ settings.setAverageLevels(false);
+
+ client.send(new NewGameMessage(settings));
+
+ FieldMessage fieldmessage = new FieldMessage(getField().getFieldString());
+ fieldmessage.setSlot(1);
+ client.send(fieldmessage);
+
+ client.send(new GmsgMessage("*** Please wait, the server is checking your client..."));
+ client.send(new GmsgMessage("*** Do not move, rotate or drop pieces."));
+ }
+
+ public void send(Message message)
+ {
+ Client client = (Client) message.getSource();
+
+ if (message instanceof PlayerLostMessage)
+ {
+ // stop the game
+ message.getSource().send(new EndGameMessage());
+
+ if (isFast())
+ {
+ log.warning("Speed check failed for " + client);
+ reject();
+ }
+ else
+ {
+ accept();
+ }
+ }
+ else if (message instanceof FieldMessage)
+ {
+ FieldMessage msg = (FieldMessage) message;
+
+ long now = System.currentTimeMillis();
+
+ if (sum == -1 && isFirstPiece(msg))
+ {
+ // start the timer after the first drop
+ startTime = now;
+ sum = 0L;
+ }
+
+ if (sum >= 0)
+ {
+ sum += (now - startTime);
+ }
+ }
+ }
+
+ protected boolean isFirstPiece(FieldMessage msg)
+ {
+ Field field = new Field();
+ field.update(msg);
+
+ return field.getBlock(5, 0) == Field.BLOCK_YELLOW;
+ }
+
+ protected boolean isFast()
+ {
+ // the client must not be more than 10% faster
+ return sum < 83000 * 0.9;
+ }
+
+ protected int getTimeout()
+ {
+ return 30;
+ }
+
+ public boolean isValidating()
+ {
+ return true;
+ }
+}
Property changes on: jetrix/trunk/src/java/net/jetrix/listeners/interceptor/SpeedCheckInterceptor.java
___________________________________________________________________
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: jetrix/trunk/src/java/net/jetrix/messages/channel/LevelMessage.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/messages/channel/LevelMessage.java 2010-08-23 14:40:34 UTC (rev 865)
+++ jetrix/trunk/src/java/net/jetrix/messages/channel/LevelMessage.java 2010-08-23 15:02:51 UTC (rev 866)
@@ -29,6 +29,15 @@
{
private int level;
+ public LevelMessage()
+ {
+ }
+
+ public LevelMessage(int level)
+ {
+ this.level = level;
+ }
+
public int getLevel()
{
return level;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-23 14:40:41
|
Revision: 865
http://jetrix.svn.sourceforge.net/jetrix/?rev=865&view=rev
Author: smanux
Date: 2010-08-23 14:40:34 +0000 (Mon, 23 Aug 2010)
Log Message:
-----------
Extended server properties
Modified Paths:
--------------
jetrix/trunk/src/etc/conf/server.xml
jetrix/trunk/src/etc/tetrinet-server.dtd
jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java
jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java
Modified: jetrix/trunk/src/etc/conf/server.xml
===================================================================
--- jetrix/trunk/src/etc/conf/server.xml 2010-08-23 08:27:28 UTC (rev 864)
+++ jetrix/trunk/src/etc/conf/server.xml 2010-08-23 14:40:34 UTC (rev 865)
@@ -127,4 +127,9 @@
<!-- Mail server parameters -->
<mailserver host="localhost" port="25" auth="false" username="" password="" debug="false"/>
+ <!-- Extended properties -->
+ <properties>
+ <property name="speedcheck.enable" value="false"/>
+ </properties>
+
</tetrinet-server>
Modified: jetrix/trunk/src/etc/tetrinet-server.dtd
===================================================================
--- jetrix/trunk/src/etc/tetrinet-server.dtd 2010-08-23 08:27:28 UTC (rev 864)
+++ jetrix/trunk/src/etc/tetrinet-server.dtd 2010-08-23 14:40:34 UTC (rev 865)
@@ -24,7 +24,7 @@
<!ELEMENT tetrinet-server (name?, language?, timeout?, max-channels?,
max-players?, max-connections?, op-password, admin-password, access-log,
error-log, channels?, listeners, services?, commands, ban?, datasources?,
- mailserver?)>
+ mailserver?, properties?)>
<!ATTLIST tetrinet-server host CDATA #IMPLIED>
<!ELEMENT name (#PCDATA)>
@@ -88,3 +88,8 @@
<!ATTLIST mailserver username CDATA #IMPLIED>
<!ATTLIST mailserver password CDATA #IMPLIED>
<!ATTLIST mailserver debug CDATA #IMPLIED>
+
+<!ELEMENT properties (property*)>
+<!ELEMENT property EMPTY>
+<!ATTLIST property name CDATA #REQUIRED>
+<!ATTLIST property value CDATA #REQUIRED>
Modified: jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-08-23 08:27:28 UTC (rev 864)
+++ jetrix/trunk/src/java/net/jetrix/config/ServerConfig.java 2010-08-23 14:40:34 UTC (rev 865)
@@ -81,6 +81,9 @@
/** Mail session configuration */
private MailSessionConfig mailSessionConfig;
+ /** Extended properties */
+ private Properties properties = new Properties();
+
private URL serverConfigURL;
private URL channelsConfigURL;
@@ -340,6 +343,17 @@
out.println();
}
+ if (properties != null && !properties.isEmpty())
+ {
+ out.println(" <!-- Extended properties -->");
+ out.println(" <properties>");
+ for (String key : properties.stringPropertyNames())
+ {
+ out.println(" <property name=\"" + key + "\" value=\"" + properties.getProperty(key) + "\">");
+ }
+ out.println(" </properties>");
+ out.println();
+ }
out.println("</tetrinet-server>");
@@ -1016,4 +1030,21 @@
{
this.mailSessionConfig = mailSessionConfig;
}
+
+ /**
+ * @since 0.3
+ */
+ public String getProperty(String key)
+ {
+ return properties != null ? properties.getProperty(key) : null;
+ }
+
+ /**
+ * @since 0.3
+ */
+ public void setProperty(String key, String value)
+ {
+ System.out.println("setting " + key + " to " + value);
+ properties.setProperty(key, value);
+ }
}
Modified: jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java 2010-08-23 08:27:28 UTC (rev 864)
+++ jetrix/trunk/src/java/net/jetrix/config/ServerRuleSet.java 2010-08-23 14:40:34 UTC (rev 865)
@@ -49,20 +49,20 @@
digester.addCallParam("tetrinet-server/error-log", 0, "path");
digester.addCallMethod("tetrinet-server/channels", "setChannelsFile", 1);
digester.addCallParam("tetrinet-server/channels", 0, "path");
-
+
// command definitions
digester.addObjectCreate("*/command", null, "class");
digester.addSetNext("*/command", "addCommand", "net.jetrix.commands.Command");
digester.addCallMethod("*/command", "setAccessLevel", 1, new Class[] {Integer.TYPE});
digester.addCallParam("*/command", 0, "access-level");
-
+
// listeners
digester.addObjectCreate("*/listener", null, "class");
digester.addSetProperties("*/listener");
digester.addCallMethod("*/listener", "setAutoStart", 1, new Class[] {Boolean.TYPE});
digester.addCallParam("*/listener", 0, "auto-start");
digester.addSetNext("*/listener", "addListener", "net.jetrix.Listener");
-
+
// services
digester.addObjectCreate("*/service", null, "class");
digester.addSetProperties("*/service");
@@ -70,10 +70,10 @@
digester.addCallParam("*/service", 0, "auto-start");
digester.addSetProperty("*/service/param", "name", "value");
digester.addSetNext("*/service", "addService", "net.jetrix.Service");
-
+
// banlist
digester.addCallMethod("tetrinet-server/ban/host", "addBannedHost", 0);
-
+
// datasource
digester.addObjectCreate("*/datasource", "net.jetrix.config.DataSourceConfig");
digester.addSetNext("*/datasource", "addDataSource", "net.jetrix.config.DataSourceConfig");
@@ -85,7 +85,7 @@
digester.addCallMethod("*/datasource/password", "setPassword", 0);
digester.addCallMethod("*/datasource/min-idle", "setMinIdle", 0);
digester.addCallMethod("*/datasource/max-active", "setMaxActive", 0);
-
+
// mail session
digester.addObjectCreate("*/mailserver", "net.jetrix.config.MailSessionConfig");
digester.addSetNext("*/mailserver", "setMailSessionConfig", "net.jetrix.config.MailSessionConfig");
@@ -101,5 +101,10 @@
digester.addCallParam("*/mailserver", 0, "password");
digester.addCallMethod("*/mailserver", "setDebug", 1, new Class[] {Boolean.TYPE});
digester.addCallParam("*/mailserver", 0, "debug");
+
+ // extended properties
+ digester.addCallMethod("*/properties/property", "setProperty", 2);
+ digester.addCallParam("*/properties/property", 0, "name");
+ digester.addCallParam("*/properties/property", 1, "value");
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-23 08:27:34
|
Revision: 864
http://jetrix.svn.sourceforge.net/jetrix/?rev=864&view=rev
Author: smanux
Date: 2010-08-23 08:27:28 +0000 (Mon, 23 Aug 2010)
Log Message:
-----------
Fixed the propagation of the playerwon message
Modified Paths:
--------------
jetrix/trunk/doc/changelog.txt
jetrix/trunk/src/java/net/jetrix/Channel.java
Modified: jetrix/trunk/doc/changelog.txt
===================================================================
--- jetrix/trunk/doc/changelog.txt 2010-08-20 10:26:25 UTC (rev 863)
+++ jetrix/trunk/doc/changelog.txt 2010-08-23 08:27:28 UTC (rev 864)
@@ -13,6 +13,7 @@
- The 'TServ' mode of TSpec is now supported
- Channels can be dedicated to TetriFast or non TetriFast clients. A warning is displayed when mixed clients play together.
- Spaces in team names are now properly handled
+- The winner can now hear the victory sound at the end of the game
Admin visible changes
- Jetrix now requires Java 6
Modified: jetrix/trunk/src/java/net/jetrix/Channel.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/Channel.java 2010-08-20 10:26:25 UTC (rev 863)
+++ jetrix/trunk/src/java/net/jetrix/Channel.java 2010-08-23 08:27:28 UTC (rev 864)
@@ -327,6 +327,14 @@
sendAll(m);
}
+ private void process(PlayerWonMessage m)
+ {
+ if (m.getSource() == null)
+ {
+ sendAll(m);
+ }
+ }
+
private void process(PlayerLostMessage m)
{
int slot = m.getSlot();
@@ -803,7 +811,7 @@
{
if (log.isLoggable(Level.FINEST))
{
- log.finest("[" + channelConfig.getName() + "] Processing " + m);
+ log.finest("[" + channelConfig.getName() + "] Processing " + m.getClass().getSimpleName() + " from " + m.getSource());
}
if (m instanceof CommandMessage) process((CommandMessage) m);
@@ -811,6 +819,7 @@
else if (m instanceof SpecialMessage) process((SpecialMessage) m);
else if (m instanceof LevelMessage) process((LevelMessage) m);
else if (m instanceof PlayerLostMessage) process((PlayerLostMessage) m);
+ else if (m instanceof PlayerWonMessage) process((PlayerWonMessage) m);
else if (m instanceof TeamMessage) process((TeamMessage) m);
else if (m instanceof PlineMessage) process((PlineMessage) m);
else if (m instanceof GmsgMessage) process((GmsgMessage) m);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-20 10:26:31
|
Revision: 863
http://jetrix.svn.sourceforge.net/jetrix/?rev=863&view=rev
Author: smanux
Date: 2010-08-20 10:26:25 +0000 (Fri, 20 Aug 2010)
Log Message:
-----------
Fixed the parsing of team messages when the name contains a space character
Modified Paths:
--------------
jetrix/trunk/doc/changelog.txt
jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java
jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java
Modified: jetrix/trunk/doc/changelog.txt
===================================================================
--- jetrix/trunk/doc/changelog.txt 2010-08-20 10:17:33 UTC (rev 862)
+++ jetrix/trunk/doc/changelog.txt 2010-08-20 10:26:25 UTC (rev 863)
@@ -11,7 +11,8 @@
- Added support for the client identification protocol (i.e lvl 0 0 request, clientinfo response)
- The number of players and spectators currently online is now displayed on logging in
- The 'TServ' mode of TSpec is now supported
-- Channels can be dedicated to TetriFast or non TetriFast clients.
+- Channels can be dedicated to TetriFast or non TetriFast clients. A warning is displayed when mixed clients play together.
+- Spaces in team names are now properly handled
Admin visible changes
- Jetrix now requires Java 6
Modified: jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-08-20 10:17:33 UTC (rev 862)
+++ jetrix/trunk/src/java/net/jetrix/protocols/TetrinetProtocol.java 2010-08-20 10:26:25 UTC (rev 863)
@@ -152,7 +152,10 @@
{
TeamMessage team = new TeamMessage();
team.setSlot(Integer.parseInt(st.nextToken()));
- team.setName(st.hasMoreTokens() ? st.nextToken() : null);
+ if (st.hasMoreTokens())
+ {
+ team.setName(line.substring("team".length() + 3).trim());
+ }
m = team;
m.setRawMessage(this, line);
}
Modified: jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java
===================================================================
--- jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-08-20 10:17:33 UTC (rev 862)
+++ jetrix/trunk/src/test/net/jetrix/protocols/TetrinetProtocolTest.java 2010-08-20 10:26:25 UTC (rev 863)
@@ -186,6 +186,34 @@
assertEquals("name", null, team.getName());
}
+ public void testGetMessageTeam3()
+ {
+ // check the parsing of a team name containing a space character
+ String raw = "team 1 L F J R";
+ Message message = protocol.getMessage(raw);
+
+ assertNotNull("message not parsed", message);
+ assertEquals("message class", TeamMessage.class, message.getClass());
+
+ TeamMessage team = (TeamMessage) message;
+ assertEquals("slot", 1, team.getSlot());
+ assertEquals("name", "L F J R", team.getName());
+ }
+
+ public void testGetMessageTeam4()
+ {
+ // check the parsing of a team name containing a leading and a trailing space character
+ String raw = "team 1 LFJR ";
+ Message message = protocol.getMessage(raw);
+
+ assertNotNull("message not parsed", message);
+ assertEquals("message class", TeamMessage.class, message.getClass());
+
+ TeamMessage team = (TeamMessage) message;
+ assertEquals("slot", 1, team.getSlot());
+ assertEquals("name", "LFJR", team.getName());
+ }
+
public void testTranslatePlayerLeave()
{
LeaveMessage message = new LeaveMessage();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-20 10:17:39
|
Revision: 862
http://jetrix.svn.sourceforge.net/jetrix/?rev=862&view=rev
Author: smanux
Date: 2010-08-20 10:17:33 +0000 (Fri, 20 Aug 2010)
Log Message:
-----------
Added the team name on the user page
Modified Paths:
--------------
jetrix/trunk/src/admin/user.jsp
Modified: jetrix/trunk/src/admin/user.jsp
===================================================================
--- jetrix/trunk/src/admin/user.jsp 2010-08-17 10:31:31 UTC (rev 861)
+++ jetrix/trunk/src/admin/user.jsp 2010-08-20 10:17:33 UTC (rev 862)
@@ -1,5 +1,4 @@
<%@ page import="net.jetrix.*"%>
-<%@ page import="java.util.*"%>
<%
ClientRepository clientRepository = ClientRepository.getInstance();
@@ -35,6 +34,10 @@
<td><%= user.getName() %></td>
</tr>
<tr>
+ <td>Team</td>
+ <td><%= user.getTeam() != null ? user.getTeam() : "" %></td>
+ </tr>
+ <tr>
<td>Access Level</td>
<td><%= user.getAccessLevel() %></td>
</tr>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-08-17 10:31:37
|
Revision: 861
http://jetrix.svn.sourceforge.net/jetrix/?rev=861&view=rev
Author: smanux
Date: 2010-08-17 10:31:31 +0000 (Tue, 17 Aug 2010)
Log Message:
-----------
Minor simplification in the way the browser is opened from the system tray
Modified Paths:
--------------
jetrix/trunk/src/java/net/jetrix/SystrayManager.java
Modified: jetrix/trunk/src/java/net/jetrix/SystrayManager.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/SystrayManager.java 2010-05-06 11:21:05 UTC (rev 860)
+++ jetrix/trunk/src/java/net/jetrix/SystrayManager.java 2010-08-17 10:31:31 UTC (rev 861)
@@ -22,7 +22,7 @@
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
-import java.io.IOException;
+import java.net.*;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.*;
@@ -80,7 +80,7 @@
itemLink.addActionListener(new OpenURLActionListener("http://jetrix.sourceforge.net"));
MenuItem itemSupport = new MenuItem("Technical Support");
- itemSupport.addActionListener(new OpenURLActionListener("http://sourceforge.net/forum/forum.php?forum_id=172941"));
+ itemSupport.addActionListener(new OpenURLActionListener("http://sourceforge.net/projects/jetrix/forums/forum/172941"));
MenuItem itemExit = new MenuItem("Stop & Exit");
itemExit.addActionListener(new ActionListener()
@@ -186,24 +186,11 @@
{
try
{
- // open the browser
- String osname = System.getProperty("os.name");
- if (osname.contains("Linux"))
- {
- Runtime.getRuntime().exec("firefox " + url);
- }
- else if (osname.contains("Windows"))
- {
- Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
- }
- else if (osname.contains("Mac"))
- {
- Runtime.getRuntime().exec("open " + url);
- }
+ Desktop.getDesktop().browse(new URI(url));
}
- catch (IOException e)
+ catch (Exception e)
{
- log.log(Level.WARNING, e.getMessage(), e);
+ log.log(Level.WARNING, "Unable to open the url: " + url, e);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 21:48:23
|
Revision: 858
http://jetrix.svn.sourceforge.net/jetrix/?rev=858&view=rev
Author: smanux
Date: 2010-05-04 21:48:17 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Proper initialization of the SourceForge shell session when deploying the web site
Modified Paths:
--------------
jetrix/trunk/build.xml
Modified: jetrix/trunk/build.xml
===================================================================
--- jetrix/trunk/build.xml 2010-05-04 17:55:19 UTC (rev 857)
+++ jetrix/trunk/build.xml 2010-05-04 21:48:17 UTC (rev 858)
@@ -405,6 +405,7 @@
<scp file="${dist}/site.tar.bz2" todir="${username}:${password}@web.sourceforge.net:${deploy.dir}" trust="true"/>
+ <sshexec host="shell.sf.net" username="${username}" password="${password}" trust="true" command="create"/>
<sshexec host="shell.sf.net" username="${username}" password="${password}" trust="true" command="tar -jxf ${deploy.dir}/site.tar.bz2 --directory=${deploy.dir}/htdocs "/>
</target>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 17:55:25
|
Revision: 857
http://jetrix.svn.sourceforge.net/jetrix/?rev=857&view=rev
Author: smanux
Date: 2010-05-04 17:55:19 +0000 (Tue, 04 May 2010)
Log Message:
-----------
The name of the client software is stored in a separate field and replaces the type field
Modified Paths:
--------------
jetrix/trunk/src/admin/server.jsp
jetrix/trunk/src/admin/user.jsp
jetrix/trunk/src/java/net/jetrix/Client.java
jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java
jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java
jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java
jetrix/trunk/src/java/net/jetrix/commands/WhoCommand.java
jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java
jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java
Modified: jetrix/trunk/src/admin/server.jsp
===================================================================
--- jetrix/trunk/src/admin/server.jsp 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/admin/server.jsp 2010-05-04 17:55:19 UTC (rev 857)
@@ -143,8 +143,7 @@
<table class="thin" style="width: 500px">
<tr>
<th>Name</th>
- <th>Type</th>
- <th>Version</th>
+ <th>Agent</th>
<th>Protocol</th>
<th>IP</th>
<th>Access Level</th>
@@ -154,8 +153,7 @@
User user = client.getUser(); %>
<tr>
<td><a href="user.jsp?name=<%= user.getName() %>"><%= user.getName() %></a></td>
- <td align="center"><%= client.getType() %></td>
- <td align="center"><%= client.getVersion() %></td>
+ <td align="center"><%= client.getAgent() %> <%= client.getVersion() %></td>
<td align="center"><%= client.getProtocol().getName() %></td>
<td><%= client.getInetAddress().getHostName() %></td>
<td align="center"><%= user.getAccessLevel() %></td>
Modified: jetrix/trunk/src/admin/user.jsp
===================================================================
--- jetrix/trunk/src/admin/user.jsp 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/admin/user.jsp 2010-05-04 17:55:19 UTC (rev 857)
@@ -48,14 +48,10 @@
<table class="thin" style="width: 500px">
<tr>
- <td width="30%">Type</td>
- <td><%= client.getType() %></td>
+ <td width="30%">Agent</td>
+ <td><%= client.getAgent() %> <%= client.getVersion() %></td>
</tr>
<tr>
- <td>Version</td>
- <td><%= client.getVersion() %></td>
- </tr>
- <tr>
<td>Protocol</td>
<td><%= client.getProtocol().getName() %></td>
</tr>
Modified: jetrix/trunk/src/java/net/jetrix/Client.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/Client.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/Client.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -69,12 +69,14 @@
User getUser();
/**
- * Return the type of the client (tetrinet or tetrifast).
+ * Returns the name of the user agent (GTetrinet, aTwin, Blocktrix...)
+ *
+ * @since 0.3
*/
- String getType();
+ String getAgent();
/**
- * Return the version of this client (1.13, 1.14, GTetrinet 0.7.10, etc).
+ * Return the version of the user agent (1.13, 1.14, etc)
*/
String getVersion();
Modified: jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/clients/ConsoleClient.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -148,14 +148,14 @@
return user;
}
- public String getVersion()
+ public String getAgent()
{
- return "1.0";
+ return "Console";
}
- public String getType()
+ public String getVersion()
{
- return "Console";
+ return "1.0";
}
public Date getConnectionTime()
Modified: jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/clients/QueryClient.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -99,7 +99,7 @@
message.append("\" \"");
message.append(user.getTeam() == null ? "" : user.getTeam());
message.append("\" \"");
- message.append(client.getVersion());
+ message.append(client.getAgent() + " " + client.getVersion());
message.append("\" ");
message.append(client.getChannel().getClientSlot(client));
message.append(" ");
Modified: jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/clients/TetrinetClient.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -41,7 +41,7 @@
*/
public class TetrinetClient implements Client
{
- private String type;
+ private String agent;
private String version;
private Protocol protocol;
private Channel channel;
@@ -143,7 +143,8 @@
else if (message instanceof ClientInfoMessage)
{
ClientInfoMessage info = (ClientInfoMessage) message;
- setVersion(info.getName() + " " + info.getVersion());
+ setAgent(info.getName());
+ setVersion(info.getVersion());
if ("gtetrinet".equalsIgnoreCase(info.getName()))
{
encoding = "UTF-8";
@@ -351,14 +352,14 @@
return version;
}
- public void setType(String type)
+ public String getAgent()
{
- this.type = type;
+ return agent;
}
- public String getType()
+ public void setAgent(String agent)
{
- return type;
+ this.agent = agent;
}
public Date getConnectionTime()
@@ -408,7 +409,7 @@
public String toString()
{
- return "[Client " + getInetAddress() + " type=" + type + "]";
+ return "[Client " + getInetAddress() + " type=" + agent + " " + version + "]";
}
/**
Modified: jetrix/trunk/src/java/net/jetrix/commands/WhoCommand.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/commands/WhoCommand.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/commands/WhoCommand.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -71,11 +71,13 @@
{
message.append("<purple>\xAE</purple>");
}
-
+
+ boolean fast = clientInChannel.getProtocol().getName().equals("tetrifast");
+
if (user.getAccessLevel() > AccessLevel.PLAYER) message.append("<b>");
- if (clientInChannel.getProtocol().getName().equals("tetrifast")) message.append("<i>");
+ if (fast) message.append("<i>");
message.append(user.getName());
- if (clientInChannel.getProtocol().getName().equals("tetrifast")) message.append("</i>");
+ if (fast) message.append("</i>");
if (user.getAccessLevel() > AccessLevel.PLAYER) message.append("</b>");
}
Modified: jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/listeners/TSpecListener.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -80,7 +80,10 @@
user.setName(tokens[1]);
}
-
+
+ client.setAgent("TSpec");
+ client.setVersion("1.13");
+
return client;
}
}
Modified: jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java 2010-05-04 17:00:37 UTC (rev 856)
+++ jetrix/trunk/src/java/net/jetrix/listeners/TetrinetListener.java 2010-05-04 17:55:19 UTC (rev 857)
@@ -88,10 +88,12 @@
if ((tokens.get(0)).equals(TetrinetProtocol.INIT_TOKEN))
{
client.setProtocol(protocolManager.getProtocol(TetrinetProtocol.class));
+ client.setAgent("TetriNET");
}
else if ((tokens.get(0)).equals(TetrifastProtocol.INIT_TOKEN))
{
client.setProtocol(protocolManager.getProtocol(TetrifastProtocol.class));
+ client.setAgent("TetriFast");
}
else
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 17:00:43
|
Revision: 856
http://jetrix.svn.sourceforge.net/jetrix/?rev=856&view=rev
Author: smanux
Date: 2010-05-04 17:00:37 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Code clarification in NameCheckInterceptor
Modified Paths:
--------------
jetrix/trunk/src/java/net/jetrix/listeners/interceptor/NameCheckInterceptor.java
Modified: jetrix/trunk/src/java/net/jetrix/listeners/interceptor/NameCheckInterceptor.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/listeners/interceptor/NameCheckInterceptor.java 2010-05-04 16:22:12 UTC (rev 855)
+++ jetrix/trunk/src/java/net/jetrix/listeners/interceptor/NameCheckInterceptor.java 2010-05-04 17:00:37 UTC (rev 856)
@@ -45,20 +45,23 @@
public void process(Client client) throws ClientValidationException
{
User user = client.getUser();
-
+
+ if (client instanceof QueryClient)
+ {
+ return;
+ }
+
// test the name unicity
- ClientRepository repository = ClientRepository.getInstance();
- if (repository.getClient(user.getName()) != null)
+ if (isNameUsed(user.getName()))
{
Message m = new NoConnectingMessage("Nickname already in use!");
client.send(m);
client.disconnect();
throw new ClientValidationException();
}
-
+
// validate the name
- String name = user.getName();
- if (!(client instanceof QueryClient) && (name == null || "server".equalsIgnoreCase(name) || name.indexOf("\u00a0") != -1))
+ if (!isNamedAccepted(user.getName()))
{
Message m = new NoConnectingMessage("Invalid name!");
client.send(m);
@@ -66,4 +69,17 @@
throw new ClientValidationException();
}
}
+
+ protected boolean isNameUsed(String name)
+ {
+ ClientRepository repository = ClientRepository.getInstance();
+ return repository.getClient(name) != null;
+ }
+
+ protected boolean isNamedAccepted(String name)
+ {
+ return name != null
+ && !"server".equalsIgnoreCase(name)
+ && name.indexOf("\u00a0") == -1;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 16:22:19
|
Revision: 855
http://jetrix.svn.sourceforge.net/jetrix/?rev=855&view=rev
Author: smanux
Date: 2010-05-04 16:22:12 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Updated the dev guide:
- added the missing small block images
- fixed the links to the javadoc
- updated the Hello World example
Modified Paths:
--------------
jetrix/trunk/src/site/dev-guide.php
Added Paths:
-----------
jetrix/trunk/src/site/images/blocks/small/
jetrix/trunk/src/site/images/blocks/small/halfcross.png
jetrix/trunk/src/site/images/blocks/small/leftl.png
jetrix/trunk/src/site/images/blocks/small/leftz.png
jetrix/trunk/src/site/images/blocks/small/line.png
jetrix/trunk/src/site/images/blocks/small/rightl.png
jetrix/trunk/src/site/images/blocks/small/rightz.png
jetrix/trunk/src/site/images/blocks/small/square.png
Modified: jetrix/trunk/src/site/dev-guide.php
===================================================================
--- jetrix/trunk/src/site/dev-guide.php 2010-05-04 15:32:18 UTC (rev 854)
+++ jetrix/trunk/src/site/dev-guide.php 2010-05-04 16:22:12 UTC (rev 855)
@@ -180,37 +180,37 @@
</tr>
<tr>
<td align="center" width="10%">1</td>
- <td align="center"><img src="/images/blocks/small/line.png" alt="Line" /></td>
+ <td align="center"><img src="images/blocks/small/line.png" alt="Line" /></td>
<td align="center">15 %</td>
</tr>
<tr>
<td align="center">2</td>
- <td align="center"><img src="/images/blocks/small/square.png" alt="Square" /></td>
+ <td align="center"><img src="images/blocks/small/square.png" alt="Square" /></td>
<td align="center">15 %</td>
</tr>
<tr>
<td align="center">3</td>
- <td align="center"><img src="/images/blocks/small/leftl.png" alt="Left L" /></td>
+ <td align="center"><img src="images/blocks/small/leftl.png" alt="Left L" /></td>
<td align="center">14 %</td>
</tr>
<tr>
<td align="center">4</td>
- <td align="center"><img src="/images/blocks/small/rightl.png" alt="Right L" /></td>
+ <td align="center"><img src="images/blocks/small/rightl.png" alt="Right L" /></td>
<td align="center">14 %</td>
</tr>
<tr>
<td align="center">5</td>
- <td align="center"><img src="/images/blocks/small/leftz.png" alt="Left Z" /></td>
+ <td align="center"><img src="images/blocks/small/leftz.png" alt="Left Z" /></td>
<td align="center">14 %</td>
</tr>
<tr>
<td align="center">6</td>
- <td align="center"><img src="/images/blocks/small/rightz.png" alt="Right Z" /></td>
+ <td align="center"><img src="images/blocks/small/rightz.png" alt="Right Z" /></td>
<td align="center">14 %</td>
</tr>
<tr>
<td align="center">7</td>
- <td align="center"><img src="/images/blocks/small/halfcross.png" alt="Half Cross" /></td>
+ <td align="center"><img src="images/blocks/small/halfcross.png" alt="Half Cross" /></td>
<td align="center">14 %</td>
</tr>
</table>
@@ -291,46 +291,46 @@
<tr>
<td>0x00000000</td>
<td>
- <img src="images/blocks/line1.png"/>
- <img src="images/blocks/halfcross1.png"/>
- <img src="images/blocks/square.png"/>
- <img src="images/blocks/leftl1.png"/>
- <img src="images/blocks/leftl4.png"/>
- <img src="images/blocks/line2.png"/>
- <img src="images/blocks/line2.png"/>
- <img src="images/blocks/line2.png"/>
- <img src="images/blocks/halfcross4.png"/>
- <img src="images/blocks/leftz2.png"/>
+ <img src="images/blocks/line1.png" alt="Line"/>
+ <img src="images/blocks/halfcross1.png" alt="Half Cross"/>
+ <img src="images/blocks/square.png" alt="Square"/>
+ <img src="images/blocks/leftl1.png" alt="Left L"/>
+ <img src="images/blocks/leftl4.png" alt="Left L"/>
+ <img src="images/blocks/line2.png" alt="Line"/>
+ <img src="images/blocks/line2.png" alt="Line"/>
+ <img src="images/blocks/line2.png" alt="Line"/>
+ <img src="images/blocks/halfcross4.png" alt="Half Cross"/>
+ <img src="images/blocks/leftz2.png" alt="Left Z"/>
</td>
</tr>
<tr>
<td>0xAABBCCDD</td>
<td>
- <img src="images/blocks/rightl4.png"/>
- <img src="images/blocks/rightl4.png"/>
- <img src="images/blocks/leftl1.png"/>
- <img src="images/blocks/leftl3.png"/>
- <img src="images/blocks/square.png"/>
- <img src="images/blocks/rightz2.png"/>
- <img src="images/blocks/square.png"/>
- <img src="images/blocks/rightl4.png"/>
- <img src="images/blocks/halfcross3.png"/>
- <img src="images/blocks/rightl1.png"/>
+ <img src="images/blocks/rightl4.png" alt="Right L"/>
+ <img src="images/blocks/rightl4.png" alt="Right L"/>
+ <img src="images/blocks/leftl1.png" alt="Left L"/>
+ <img src="images/blocks/leftl3.png" alt="Left L"/>
+ <img src="images/blocks/square.png" alt="Square"/>
+ <img src="images/blocks/rightz2.png" alt="Right Z"/>
+ <img src="images/blocks/square.png" alt="Square"/>
+ <img src="images/blocks/rightl4.png" alt="Right L"/>
+ <img src="images/blocks/halfcross3.png" alt="Half Cross"/>
+ <img src="images/blocks/rightl1.png" alt="Right L"/>
</td>
</tr>
<tr>
<td>0x12345678</td>
<td>
- <img src="images/blocks/leftz2.png"/>
- <img src="images/blocks/leftz2.png"/>
- <img src="images/blocks/halfcross2.png"/>
- <img src="images/blocks/rightz2.png"/>
- <img src="images/blocks/leftl2.png"/>
- <img src="images/blocks/rightz1.png"/>
- <img src="images/blocks/rightz2.png"/>
- <img src="images/blocks/halfcross1.png"/>
- <img src="images/blocks/line2.png"/>
- <img src="images/blocks/rightl1.png"/>
+ <img src="images/blocks/leftz2.png" alt="Left Z"/>
+ <img src="images/blocks/leftz2.png" alt="Left Z"/>
+ <img src="images/blocks/halfcross2.png" alt="Half Cross"/>
+ <img src="images/blocks/rightz2.png" alt="Right Z"/>
+ <img src="images/blocks/leftl2.png" alt="Left L"/>
+ <img src="images/blocks/rightz1.png" alt="Right Z"/>
+ <img src="images/blocks/rightz2.png" alt="Right Z"/>
+ <img src="images/blocks/halfcross1.png" alt="Half Cross"/>
+ <img src="images/blocks/line2.png" alt="Line"/>
+ <img src="images/blocks/rightl1.png" alt="Right L"/>
</td>
</tr>
</tbody>
@@ -432,15 +432,15 @@
<h3>Write the command</h3>
Every command is represented by a Java class implementing the
-<a class="api" href="/api/net/jetrix/commands/Command.html">Command</a>
+<a class="api" href="/api/@version.stable@/net/jetrix/commands/Command.html">Command</a>
interface. Let's create our class, <tt>HelloCommand</tt>, it'll be based on the
-<a class="api" href="/api/net/jetrix/commands/AbstractCommand.html">AbstractCommand</a>
+<a class="api" href="/api/@version.stable@/net/jetrix/commands/AbstractCommand.html">AbstractCommand</a>
class implementing part of the <tt>Command</tt> interface methods :
<div class="code">
<span class="blue">import</span> java.util.*;
<span class="blue">import</span> net.jetrix.*;
-<span class="blue">import</span> net.jetrix.messages.*;
+<span class="blue">import</span> net.jetrix.messages.channel.*;
<span class="blue">import</span> net.jetrix.commands.*;
<span class="blue">public class</span> HelloCommand <span class="blue">extends</span> <span class="red">AbstractCommand</span>
@@ -528,7 +528,7 @@
<div class="code">
<span class="blue">import</span> java.util.*;
<span class="blue">import</span> net.jetrix.*;
-<span class="blue">import</span> net.jetrix.messages.*;
+<span class="blue">import</span> net.jetrix.messages.channel.*;
<span class="blue">import</span> net.jetrix.commands.*;
<span class="blue">public class</span> HelloCommand <span class="blue">extends</span> <span class="red">AbstractCommand</span>
@@ -612,10 +612,10 @@
<h3>Write the filter</h3>
-<p>Filters extend the base class <a class="api" href="/api/net/jetrix/filter/MessageFilter.html">MessageFilter</a>,
+<p>Filters extend the base class <a class="api" href="/api/@version.stable@/net/jetrix/filter/MessageFilter.html">MessageFilter</a>,
this class defines a <tt>process(Message m, List out)</tt> method that must be
overridden to implement the behaviour of the filter. A higher level filter
-<a class="api" href="/api/net/jetrix/filter/GenericFilter.html">GenericFilter</a>
+<a class="api" href="/api/@version.stable@/net/jetrix/filter/GenericFilter.html">GenericFilter</a>
with process methods for all message types is provided, we will use it for our
filter.</p>
Added: jetrix/trunk/src/site/images/blocks/small/halfcross.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/halfcross.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: jetrix/trunk/src/site/images/blocks/small/leftl.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/leftl.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: jetrix/trunk/src/site/images/blocks/small/leftz.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/leftz.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: jetrix/trunk/src/site/images/blocks/small/line.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/line.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: jetrix/trunk/src/site/images/blocks/small/rightl.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/rightl.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: jetrix/trunk/src/site/images/blocks/small/rightz.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/rightz.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
Added: jetrix/trunk/src/site/images/blocks/small/square.png
===================================================================
(Binary files differ)
Property changes on: jetrix/trunk/src/site/images/blocks/small/square.png
___________________________________________________________________
Added: svn:mime-type
+ image/png
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 15:32:24
|
Revision: 854
http://jetrix.svn.sourceforge.net/jetrix/?rev=854&view=rev
Author: smanux
Date: 2010-05-04 15:32:18 +0000 (Tue, 04 May 2010)
Log Message:
-----------
New contributors page
Modified Paths:
--------------
jetrix/trunk/src/site/menu.inc.php
Added Paths:
-----------
jetrix/trunk/src/site/contributors.php
Added: jetrix/trunk/src/site/contributors.php
===================================================================
--- jetrix/trunk/src/site/contributors.php (rev 0)
+++ jetrix/trunk/src/site/contributors.php 2010-05-04 15:32:18 UTC (rev 854)
@@ -0,0 +1,26 @@
+<? include("header.inc.php") ?>
+
+<h1>Contributors</h1>
+
+<p>A successful project requires many people to play many roles. Some members write code or documentation, while others
+are valuable as testers, submitting patches and suggestions.</p>
+
+<p>The team is comprised of members and contributors. Members have direct access to the source of a project and actively
+evolve the code-base. Contributors improve the project through submission of patches and suggestions.</p>
+
+<p>Here are the people who contributed to the project:</p>
+
+<ul>
+ <li>Emmanuel Bourg (sm...@lf...) : main developper</li>
+ <li>Nilsen Filc : logo</li>
+ <li>Claudio Gargiulo : italian translation</li>
+ <li>Mario Meuser : german translation</li>
+ <li>Tim Van Wassenhove : dutch translation</li>
+ <li>Julian Mesa Llopis : spanish translation</li>
+ <li>Bryan Reynaert : spanish translation</li>
+ <li>V\xEDtor Melo : portuguese translation</li>
+</ul>
+
+Get involved today. All contributions to the project are greatly appreciated.
+
+<? include("footer.inc.php") ?>
Modified: jetrix/trunk/src/site/menu.inc.php
===================================================================
--- jetrix/trunk/src/site/menu.inc.php 2010-05-04 15:10:31 UTC (rev 853)
+++ jetrix/trunk/src/site/menu.inc.php 2010-05-04 15:32:18 UTC (rev 854)
@@ -32,7 +32,7 @@
<li><a href="http://sourceforge.net/tracker/?group_id=52188&atid=466005">Feature Requests</a></li>
<li><a href="changelog.php">Changelog</a></li>
<li><a href="docs/changelog.html">Commits</a></li>
- <li><a href="docs/team-list.html">Contributors</a></li>
+ <li><a href="contributors.php">Contributors</a></li>
</ul>
</div>
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 15:10:37
|
Revision: 853
http://jetrix.svn.sourceforge.net/jetrix/?rev=853&view=rev
Author: smanux
Date: 2010-05-04 15:10:31 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Todo list update
Modified Paths:
--------------
jetrix/trunk/doc/todo.txt
Modified: jetrix/trunk/doc/todo.txt
===================================================================
--- jetrix/trunk/doc/todo.txt 2010-05-04 15:09:46 UTC (rev 852)
+++ jetrix/trunk/doc/todo.txt 2010-05-04 15:10:31 UTC (rev 853)
@@ -17,9 +17,11 @@
- friend list (/friend command + notification system)
- bonus points depending on the skill of the players (i.e intensity level on tnet.org with 5+ players and at least 4 players in the top 100)
- bonus points when the same player wins several games in a row
+- dynamic channels (i.e /join #pure spawns #pure2 if the channel is full)
- immunity mode: a tetris grants a 10 seconds immunity against any special (detrimental and beneficial)
- check the end of the game when a player leaves the channel
- handicap filter: increase the difficulty for the winner (increased starting height)
+- use the end game screen to display the rank of the player for the game
Commands
- /mute <nick>
@@ -42,13 +44,17 @@
- run as a service on Windows (using Java Service Wrapper)
- run as a service on Linux (init.d script)
- deploy as a web application
-- UPnP support (with http://www.cybergarage.org and http://jupnp.dev.java.net, or UPNPLib from http://www.sbbi.net)
+- disabling a command
Website
- feature matrix similar to http://damagecontrol.codehaus.org/Continuous+Integration+Server+Feature+Matrix
- java web start demo
- compress the files on the patch server
+- color codes documentation
+Networking
+- UPnP NAT Traversal (with http://www.cybergarage.org and http://jupnp.dev.java.net, or UPNPLib from http://www.sbbi.net)
+
Code
- split the code in two parts : the core tetrinet classes and the server specific classes
- reusable project to develop an independent command/filter
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 15:09:53
|
Revision: 852
http://jetrix.svn.sourceforge.net/jetrix/?rev=852&view=rev
Author: smanux
Date: 2010-05-04 15:09:46 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Removed Jetty from the javadoc links
Modified Paths:
--------------
jetrix/trunk/pom.xml
Modified: jetrix/trunk/pom.xml
===================================================================
--- jetrix/trunk/pom.xml 2010-05-04 12:47:25 UTC (rev 851)
+++ jetrix/trunk/pom.xml 2010-05-04 15:09:46 UTC (rev 852)
@@ -244,7 +244,6 @@
<link>http://commons.apache.org/digester/apidocs</link>
<link>http://commons.apache.org/collections/apidocs</link>
<link>http://commons.apache.org/lang/apidocs</link>
- <link>http://jetty.mortbay.org/javadoc</link>
</links>
<quiet>true</quiet>
</configuration>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sm...@us...> - 2010-05-04 12:47:31
|
Revision: 851
http://jetrix.svn.sourceforge.net/jetrix/?rev=851&view=rev
Author: smanux
Date: 2010-05-04 12:47:25 +0000 (Tue, 04 May 2010)
Log Message:
-----------
Automatic generation of the commands documentation
Modified Paths:
--------------
jetrix/trunk/build.xml
jetrix/trunk/doc/todo.txt
jetrix/trunk/src/site/style.css
jetrix/trunk/src/site/user-guide.php
Added Paths:
-----------
jetrix/trunk/src/java/net/jetrix/tools/DocumentationGenerator.java
jetrix/trunk/src/site/commands.html
Modified: jetrix/trunk/build.xml
===================================================================
--- jetrix/trunk/build.xml 2010-05-04 10:10:28 UTC (rev 850)
+++ jetrix/trunk/build.xml 2010-05-04 12:47:25 UTC (rev 851)
@@ -337,8 +337,19 @@
<fileset dir="${deploy}/jetrix-${version}"/>
</ftp>
</target>
-
- <target name="site" description="Generate and publish the web site to SourceForge">
+
+ <target name="docgen" depends="compile" description="Generates the documentation of the server commands">
+ <java classname="net.jetrix.tools.DocumentationGenerator" fork="true">
+ <classpath>
+ <pathelement path="${build}/classes"/>
+ <pathelement path="${src}/etc"/>
+ <pathelement path="${src}/lang"/>
+ <fileset dir="lib" includes="*.jar"/>
+ </classpath>
+ </java>
+ </target>
+
+ <target name="site" depends="docgen" description="Generate and publish the web site to SourceForge">
<!-- Create the site distribution directory -->
<mkdir dir="${dist}/site/docs"/>
Modified: jetrix/trunk/doc/todo.txt
===================================================================
--- jetrix/trunk/doc/todo.txt 2010-05-04 10:10:28 UTC (rev 850)
+++ jetrix/trunk/doc/todo.txt 2010-05-04 12:47:25 UTC (rev 851)
@@ -19,6 +19,7 @@
- bonus points when the same player wins several games in a row
- immunity mode: a tetris grants a 10 seconds immunity against any special (detrimental and beneficial)
- check the end of the game when a player leaves the channel
+- handicap filter: increase the difficulty for the winner (increased starting height)
Commands
- /mute <nick>
@@ -41,12 +42,14 @@
- run as a service on Windows (using Java Service Wrapper)
- run as a service on Linux (init.d script)
- deploy as a web application
+- UPnP support (with http://www.cybergarage.org and http://jupnp.dev.java.net, or UPNPLib from http://www.sbbi.net)
Website
- feature matrix similar to http://damagecontrol.codehaus.org/Continuous+Integration+Server+Feature+Matrix
-- automatic generation of the commands documentation
- java web start demo
- compress the files on the patch server
Code
- split the code in two parts : the core tetrinet classes and the server specific classes
+- reusable project to develop an independent command/filter
+- publish Maven artifacts to SonaType (http://nexus.sonatype.org/oss-repository-hosting.html)
Added: jetrix/trunk/src/java/net/jetrix/tools/DocumentationGenerator.java
===================================================================
--- jetrix/trunk/src/java/net/jetrix/tools/DocumentationGenerator.java (rev 0)
+++ jetrix/trunk/src/java/net/jetrix/tools/DocumentationGenerator.java 2010-05-04 12:47:25 UTC (rev 851)
@@ -0,0 +1,165 @@
+/**
+ * Jetrix TetriNET Server
+ * Copyright (C) 20010 Emmanuel Bourg
+ *
+ * This program 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 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program 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 this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+
+package net.jetrix.tools;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.TreeMap;
+
+import net.jetrix.AccessLevel;
+import net.jetrix.commands.Command;
+import net.jetrix.commands.CommandManager;
+import net.jetrix.config.ChannelConfig;
+import net.jetrix.config.FilterConfig;
+import net.jetrix.config.ServerConfig;
+
+/**
+ * Generates the documentation for the server commands.
+ *
+ * @author Emmanuel Bourg
+ * @version $Revision$, $Date$
+ */
+public class DocumentationGenerator
+{
+ public static void main(String[] args) throws Exception
+ {
+ File configFile = new File("src/etc/conf/server.xml");
+ ServerConfig config = new ServerConfig();
+ config.load(configFile);
+
+ File file = new File("src/site/commands.html");
+ file.getParentFile().mkdirs();
+
+ System.out.println("Exporting commands documentation from " + configFile + " to " + file);
+ System.out.println("");
+
+ // collect the general commands
+ TreeMap<String, Command> commands = new TreeMap<String, Command>();
+ Iterator<Command> it = CommandManager.getInstance().getCommands(AccessLevel.ADMINISTRATOR);
+ while (it.hasNext())
+ {
+ Command command = it.next();
+ commands.put(command.getAliases()[0], command);
+ }
+
+ // collect the filter commands
+ for (ChannelConfig channel : config.getChannels())
+ {
+ Iterator<FilterConfig> filters = channel.getFilters();
+ while (filters.hasNext())
+ {
+ FilterConfig filter = filters.next();
+ if (!filter.isGlobal() && filter.getName().equals("command"))
+ {
+ String cls = filter.getProperties().getProperty("class");
+ Command command = (Command) Class.forName(cls).newInstance();
+ commands.put(command.getAliases()[0], command);
+ }
+ }
+ }
+
+ PrintWriter out = new PrintWriter(new FileWriter(file));
+
+ for (Command command : commands.values())
+ {
+ String alias = command.getAliases()[0];
+
+ out.println("<h2 id=\"command-" + alias + "\">" + alias + "</h2>");
+ out.println();
+ out.println("<p>" + command.getDescription(Locale.ENGLISH) + "</p>");
+ out.println();
+ out.println("<div><b>Usage:</b> <tt>" + htmlizeUsage(command.getUsage(Locale.ENGLISH)) + "</tt></div>");
+ if (command.getAliases().length > 1)
+ {
+ out.println("<div><b>Aliases:</b> <tt>" + Arrays.toString(command.getAliases()) + "</tt></div>");
+ }
+ String role = getRoleName(command.getAccessLevel());
+ if (role != null)
+ {
+ out.println("<div><b>Access Level:</b> " + role + "</div>");
+ }
+ out.println();
+ out.println();
+
+ System.out.println(command.getUsage(Locale.ENGLISH));
+ }
+
+
+ out.flush();
+ out.close();
+ }
+
+ private static String getRoleName(int level)
+ {
+ if (level == 0)
+ {
+ return "Player";
+ }
+ else if (level == 1)
+ {
+ return "Channel Operator";
+ }
+ else if (level == 2)
+ {
+ return "Operator";
+ }
+ else if (level == 100)
+ {
+ return "Administrator";
+ }
+ else
+ {
+ return null;
+ }
+ }
+
+ /**
+ * Return a colorized usage string of the specified command.
+ */
+ private static String htmlizeUsage(String usage)
+ {
+ StringBuffer htmlized = new StringBuffer();
+ htmlized.append("<span style=\"color: red\">");
+
+ for (char c : usage.toCharArray())
+ {
+ if (c == '<')
+ {
+ htmlized.append("<span style=\"color: blue\"><");
+ }
+ else if (c == '>')
+ {
+ htmlized.append("></span>");
+ }
+ else
+ {
+ htmlized.append(c);
+ }
+ }
+
+ htmlized.append("</span>");
+
+ return htmlized.toString();
+ }
+}
Property changes on: jetrix/trunk/src/java/net/jetrix/tools/DocumentationGenerator.java
___________________________________________________________________
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Added: jetrix/trunk/src/site/commands.html
===================================================================
--- jetrix/trunk/src/site/commands.html (rev 0)
+++ jetrix/trunk/src/site/commands.html 2010-05-04 12:47:25 UTC (rev 851)
@@ -0,0 +1,268 @@
+<h2 id="command-away">away</h2>
+
+<p>Set your away status.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/afk <span style="color: blue"><message></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[away, afk]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-broadcast">broadcast</h2>
+
+<p>Send a message to all clients on the server.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/br <span style="color: blue"><message></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[broadcast, br, gmsg, shout]</tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-config">config</h2>
+
+<p>Display the channel settings.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/config</span></tt></div>
+<div><b>Aliases:</b> <tt>[config, conf, settings]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-emote">emote</h2>
+
+<p>Display an emote.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/me</span></tt></div>
+<div><b>Aliases:</b> <tt>[emote, me]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-goto">goto</h2>
+
+<p>Go to the channel of the specified player.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/goto <span style="color: blue"><player name></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[goto, go]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-help">help</h2>
+
+<p>List all commands available.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/help</span></tt></div>
+<div><b>Aliases:</b> <tt>[help, ?, h]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-ignore">ignore</h2>
+
+<p>Add or remove a player from the ignore list.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/ignore <span style="color: blue"><player name|number></span></span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-ip">ip</h2>
+
+<p>Display the IP of a player.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/ip <span style="color: blue"><player name|number></span></span></tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-join">join</h2>
+
+<p>Join or create a channel.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/join <span style="color: blue"><channel name|number></span> <span style="color: blue"><password></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[join, j]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-kick">kick</h2>
+
+<p>Kick a player out of the server.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/kick <span style="color: blue"><player name|number></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[kick, disconnect]</tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-language">language</h2>
+
+<p>Set the language of the user.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/language <span style="color: blue"><language code></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[language, lang]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-list">list</h2>
+
+<p>List available channels.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/list</span></tt></div>
+<div><b>Aliases:</b> <tt>[list, l]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-mode">mode</h2>
+
+<p>Change the channel's configuration.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/mode <span style="color: blue"><0-9></span></span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-motd">motd</h2>
+
+<p>Display the message of the day.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/motd</span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-move">move</h2>
+
+<p>Move a player to a new slot.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/move <span style="color: blue"><player number></span> <span style="color: blue"><slot number></span></span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-operator">operator</h2>
+
+<p>Gain authenticated operator status.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/op <span style="color: blue"><password></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[operator, op]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-pause">pause</h2>
+
+<p>Pause or unpause the game.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/pause</span></tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-petition">petition</h2>
+
+<p>Send a request for assistance to all operators online.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/petition <span style="color: blue"><message></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[petition, omsg]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-ping">ping</h2>
+
+<p>Display the ping to the server.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/ping</span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-random">random</h2>
+
+<p>Display a random number.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/random <span style="color: blue"><min></span> <span style="color: blue"><max></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[random, roll]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-reply">reply</h2>
+
+<p>Reply to the previous private message.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/reply <span style="color: blue"><message></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[reply, r]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-speclist">speclist</h2>
+
+<p>Show the spectators in the channel</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/speclist</span></tt></div>
+<div><b>Aliases:</b> <tt>[speclist, slist]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-start">start</h2>
+
+<p>Start the game.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/start <span style="color: blue"><seconds></span></span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-stop">stop</h2>
+
+<p>Stop the game.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/stop</span></tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-summon">summon</h2>
+
+<p>Summon a player to the current channel.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/summon <span style="color: blue"><player name></span></span></tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-teleport">teleport</h2>
+
+<p>Teleport a player to another channel.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/teleport <span style="color: blue"><player name|number></span> <span style="color: blue"><channel name|number></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[teleport, tp]</tt></div>
+<div><b>Access Level:</b> Operator</div>
+
+
+<h2 id="command-tell">tell</h2>
+
+<p>Send a private message to a player.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/tell <span style="color: blue"><player name|number></span> <span style="color: blue"><message></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[tell, msg, cmsg, send]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-time">time</h2>
+
+<p>Display the server's time.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/time</span></tt></div>
+<div><b>Aliases:</b> <tt>[time, date]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-tmsg">tmsg</h2>
+
+<p>Send a message to the team.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/tmsg <span style="color: blue"><message></span></span></tt></div>
+<div><b>Aliases:</b> <tt>[tmsg, gu]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-version">version</h2>
+
+<p>Display the version of the server.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/version</span></tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
+<h2 id="command-who">who</h2>
+
+<p>List all players connected to the server.</p>
+
+<div><b>Usage:</b> <tt><span style="color: red">/who</span></tt></div>
+<div><b>Aliases:</b> <tt>[who, w, cwho]</tt></div>
+<div><b>Access Level:</b> Player</div>
+
+
Property changes on: jetrix/trunk/src/site/commands.html
___________________________________________________________________
Added: svn:keywords
+ Date Author Id Revision HeadURL
Added: svn:eol-style
+ native
Modified: jetrix/trunk/src/site/style.css
===================================================================
--- jetrix/trunk/src/site/style.css 2010-05-04 10:10:28 UTC (rev 850)
+++ jetrix/trunk/src/site/style.css 2010-05-04 12:47:25 UTC (rev 851)
@@ -1,4 +1,4 @@
-body { color: black; background-color: white; margin: 0; font-family: Arial, Helvetica, Sans Serif }
+body { color: black; background-color: white; margin: 0 1em; font-family: Arial, Helvetica, Sans Serif; }
a { color: #525d76 }
a:hover { color: #2B313D }
Modified: jetrix/trunk/src/site/user-guide.php
===================================================================
--- jetrix/trunk/src/site/user-guide.php 2010-05-04 10:10:28 UTC (rev 850)
+++ jetrix/trunk/src/site/user-guide.php 2010-05-04 12:47:25 UTC (rev 851)
@@ -17,41 +17,7 @@
</ul>
</li>
<li><a href="#section3">Web Administration</a></li>
- <li><a href="#section4">Command Reference</a>
- <ul>
- <li><a href="#section4-away">Away</a></li>
- <li><a href="#section4-broadcast">Broadcast</a></li>
- <li><a href="#section4-config">Config</a></li>
- <li><a href="#section4-emote">Emote</a></li>
- <li><a href="#section4-goto">Goto</a></li>
- <li><a href="#section4-help">Help</a></li>
- <li><a href="#section4-ignore">Ignore</a></li>
- <li><a href="#section4-ip">Ip</a></li>
- <li><a href="#section4-join">Join</a></li>
- <li><a href="#section4-kick">Kick</a></li>
- <li><a href="#section4-language">Language</a></li>
- <li><a href="#section4-list">List</a></li>
- <li><a href="#section4-mode">Mode</a></li>
- <li><a href="#section4-motd">Motd</a></li>
- <li><a href="#section4-move">Move</a></li>
- <li><a href="#section4-operator">Operator</a></li>
- <li><a href="#section4-pause">Pause</a></li>
- <li><a href="#section4-petition">Petition</a></li>
- <li><a href="#section4-ping">Ping</a></li>
- <li><a href="#section4-random">Random</a></li>
- <li><a href="#section4-reply">Reply</a></li>
- <li><a href="#section4-speclist">Speclist</a></li>
- <li><a href="#section4-start">Start</a></li>
- <li><a href="#section4-stop">Stop</a></li>
- <li><a href="#section4-summon">Summon</a></li>
- <li><a href="#section4-teleport">Teleport</a></li>
- <li><a href="#section4-tell">Tell</a></li>
- <li><a href="#section4-time">Time</a></li>
- <li><a href="#section4-tmsg">Tmsg</a></li>
- <li><a href="#section4-version">Version</a></li>
- <li><a href="#section4-who">Who</a></li>
- </ul>
- </li>
+ <li><a href="#section4">Command Reference</a></li>
</ol>
<h1><a id="section1"></a>Installation</h1>
@@ -60,7 +26,7 @@
<ul>
<li>Linux, Windows, Solaris or MacOS X</li>
- <li>Java Runtime Environnement 1.5.x or higher</li>
+ <li>Java 6 or higher</li>
<li>32 Mb RAM</li>
<li>5 Mb hard drive space</li>
<li>If you have a firewall, open the ports 31456, 31457 and 31458</li>
@@ -68,10 +34,9 @@
<h3>Running & Upgrading</h3>
-<p>You need a JRE 1.5 or higher installed on your server to run Jetrix. You can
-download it here :</p>
+<p>You need Java 6 or higher installed on your server to run Jetrix. You can
+download it on <a href="http://java.com">http://java.com</a></p>
-<a href="http://java.sun.com/j2se/1.5.0/download.jsp">http://java.sun.com/j2se/1.5.0/download.jsp</a>
<h4>Unix</h4>
@@ -79,7 +44,7 @@
environnement variable pointing to your Java directory. For example on
Linux you can add this line to your /etc/profile file:</p>
-<code>export JAVA_HOME=/usr/java/jre_1.5.0</code>
+<code>export JAVA_HOME=/usr/java/jre_1.6.0</code>
<p>Then decompress the Jetrix archive to the installation directory:</p>
@@ -154,55 +119,6 @@
<h1><a id="section4"></a>Command Reference</h1>
-<h2><a id="section4-broadcast"></a>Broadcast</h2>
+<? include("commands.html") ?>
-<h2><a id="section4-config"></a>Config</h2>
-
-<h2><a id="section4-emote"></a>Emote</h2>
-
-<h2><a id="section4-goto"></a>Goto</h2>
-
-<h2><a id="section4-help"></a>Help</h2>
-
-<h2><a id="section4-ip"></a>Ip</h2>
-
-<h2><a id="section4-join"></a>Join</h2>
-
-<h2><a id="section4-kick"></a>Kick</h2>
-
-<h2><a id="section4-language"></a>Language</h2>
-
-<h2><a id="section4-list"></a>List</h2>
-
-<h2><a id="section4-motd"></a>Motd</h2>
-
-<h2><a id="section4-move"></a>Move</h2>
-
-<h2><a id="section4-operator"></a>Operator</h2>
-
-<h2><a id="section4-pause"></a>Pause</h2>
-
-<h2><a id="section4-ping"></a>Ping</h2>
-
-<h2><a id="section4-random"></a>Random</h2>
-
-<h2><a id="section4-reply"></a>Reply</h2>
-
-<h2><a id="section4-start"></a>Start</h2>
-
-<h2><a id="section4-stop"></a>Stop</h2>
-
-<h2><a id="section4-summon"></a>Summon</h2>
-
-<h2><a id="section4-teleport"></a>Teleport</h2>
-
-<h2><a id="section4-tell"></a>Tell</h2>
-
-<h2><a id="section4-time"></a>Time</h2>
-
-<h2><a id="section4-version"></a>Version</h2>
-
-<h2><a id="section4-who"></a>Who</h2>
-
-
<? include("footer.inc.php") ?>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|