Skip to content
Browse files

Merge pull request #209 from bryanburke/myAreaConf

Added config.xml properties for maximum area size
  • Loading branch information...
2 parents f29ed2e + 4c870fa commit f7a512a7c2a0d52537a6f503e1386638f1e74c96 @sadimusi sadimusi committed
Showing with 277 additions and 181 deletions.
  1. +1 −0 CONTRIBUTORS
  2. +91 −22 README
  3. +28 −6 src/simpleserver/command/MyAreaCommand.java
  4. +157 −153 src/simpleserver/config/xml/config.xml
View
1 CONTRIBUTORS
@@ -7,3 +7,4 @@ Dominic Langenegger <D0L4@tippfix.ch>
Anton Pirogov <anton.pirogov at gmail.com>
Ben Scholzen <mail@dasprids.de>
Valter Str. <>
+Bryan Burke <burke.bryan@gmail.com>
View
113 README
@@ -1,4 +1,4 @@
-Simple Server 8.3.0
+Simple Server 8.3.5 RC
An open source simple server tunnel for minecraft beta multiplayer servers.
Copyright (c) 2011 SimpleServer authors (see CONTRIBUTORS)
See LICENSE for details.
@@ -8,7 +8,8 @@ Forum thread: http://www.minecraftforum.net/viewtopic.php?f=1023&t=336496
Source: http://github.com/SimpleServer/SimpleServer
Installation:
-1) Run launch.bat or launch.sh to start the server for the first time
+1) Run launch.bat (Windows), launch.command (Mac OS X), or launch.sh (Linux/BSD)
+ to start the server for the first time
2) You can now connect to the server using your IP Address (www.whatismyip.com)
and the port indicated in simpleserver.properties
@@ -33,52 +34,70 @@ Features (See CHANGES for updates):
* Rules listing (rules.txt).
* Optional member whitelist (white-list.txt).
* Selectable language packages for all in-game notifications.
-See simpleserver.properties for general configuration.
+See simpleserver.properties and simpleserver/config.xml for general configuration.
Console Commands:
Say help in the console for all the standard minecraft server commands.
Added commands:
- backup -- Force a backup
- reload -- Reload all configuration files
- restart -- Restart the server
- save -- Save all configuration files
- setgroup -- Set group of palyer
- giveplayer -- Give a player items using the aliases defined in give-alias-list.txt
+ enchant -- Spawns enchanted items
+ global -- Send a chat message to all players
+ idbehold -- Make tools work instantly for yourself
+ me -- Displays a message like "* Notch is a cool man!"
+ read -- Display a specified text document
+ rename -- Rename a player
+ toggledownfall -- Toggle rain and snow
+ xp -- Gives XP to a player
In-game Commands:
Commands are based on rank. Say /help in game for a list of currently
accessible commands.
/area -- Show the name of current area
- /areasay -- Send chat message to players in your area
- /back -- Return to your death place
+ /areasay MESSAGE -- Send message to all players in your area
+ Alias: /a
+ /back -- Teleports you back to the position you died
/backup -- Backup the map
/ban PLAYER [REASON] -- Kick and ban the named player
/banip IPADDRESS -- Kick and ban players with this IP
- /chat -- Select chat mode
- /dimension -- Send chat message to players in your dimension
- /gamemode -- Set game mode (survival or multiplayer)
+ /chat MODE [ARGUMENTS] -- Set default chatroom
+ Alias: /c
+ /dimension [DIMENSION] MESSAGE -- Send message only in specified dimension and to yourself
+ Alias: /d
+ /enchant [ITEM | add ID:LEVEL | give | remove ID] -- Spawns enchanted items
+ Alias: /e
+ /gamemode [PLAYER] MODE -- Set gamemode for a specific player
/give ITEM[:DAMAGE] [AMOUNT] -- Spawn items for yourself
/giveplayer PLAYER ITEM [AMOUNT] -- Spawn items for another player
+ /global MESSAGE -- Send a chat message to all players
/gps [PLAYER] -- Display block coordinates of named player or yourself
- /group -- Send chat message to players in your group
+ /group [GROUP] MESSAGE -- Talk to the specified or your group (use id)
+ Alias: /g
/help [COMMAND] -- List commands or get help for one command
- /home [COMMAND] [NAME] -- Use and modify homes
- /iddqd -- Make yourself invulnerable to other players attacks
+ Alias: /commands
+ /home [help|set|delete|public|private|ilist|list|invite|uninvite] [name] -- Teleport to and manage your home
+ /idbehold -- Make tools work instantly for yourself
+ /iddqd -- Make yourself invulnerable to other players' attacks
/kick PLAYER [REASON] -- Kick the named player from the server
/kit [KIT] -- Display all kits or give yourself the named kit
+ Alias: /kits
/listips -- Display the name and IP of each connected player
/local MESSAGE -- Send a chat message to nearby players
- /localtoggle [on|off] -- Toggle local chat mode
+ Alias: /l
/lock [name|list] -- Create or list locked chests
- /login PLAYER PASSWORD -- Login using CustAuth.
+ /login PLAYER PASSWORD -- Login using Custom Authentication
+ /me MESSAGE -- Displays a message like "* Notch is a cool man!"
/motd -- Display the message of the day
/mute PLAYER -- Block the named player from normal chat
/myarea [start|end|save|unsave|rename] -- Manage your personal area
/mystats -- Display your statistics
+ /ok PLAYER -- Agree to a visit request
/rcon COMMAND ARGUMENTS... -- Execute a command on the server console
- /register [OLD PASSWORD] NEW_PASSWORD NEW_PASSWORD -- Set or change password for CustAuth.
+ /read DOCUMENT -- Display a specified text document
+ /register [OLD PASSWORD] NEW_PASSWORD NEW_PASSWORD -- Set or change password for Custom Authentication
+ Alias: /passwd
/reload -- Reread the configuration files from disk
+ /rename PLAYER RENAME -- Rename a player
/reply MESSAGE -- Sends a message to the player that last told you something
+ Alias: /r
/restart -- Stop the Minecraft server and start it again
/rules -- Display the server rules
/save -- Store configuration to disk and force a map save
@@ -88,20 +107,70 @@ accessible commands.
/spawn -- Teleport to spawn
/stop -- Shutdown the entire server
/teleport PLAYER1 PLAYER2 -- Teleport the first player to the second
+ Alias: /tp
/tell PLAYER MESSAGE... -- Send a message to the named player
+ Alias: /t
/time [set] [number|day|night|unfreeze] [freeze] -- Set or freeze time
+ /toggledownfall -- Toggle rain and snow
+ Alias: /rain
/unban PLAYER -- Remove the named player from the ban list
/unbanip IPADDRESS -- Remove the IP address from the ban list
/unlock [name] -- Unlocks locked chests
/unmute PLAYER -- Allow the named player to use normal chat again
/unwhitelist PLAYER -- Remove player from server access list
- /visit PLAYER -- Teleport to the player if he agrees with ok
+ /visit PLAYER -- Teleport to the player if he agrees with /ok
/warp [list|remove|add] [name] -- Use and manage waypoints
/warpmeto PLAYER -- Teleport to the named player
+ Alias: /tpto
/warptome PLAYER -- Teleport the named player to you
/whitelist PLAYER -- Add player to server access list
- /who -- Display online players names
+ /who -- Display online players' names
+ Alias: /list
+ /xp [PLAYER] AMOUNT -- Gives XP to a player
+Configuration: simpleserver/config.xml
+===== Properties =====
+announceBackup | Announce backups to players
+announceRestart | Announce planned restarts to players
+announceSave | Announce world saves to players
+areaMaxX | Maximum width (X-axis) of player-defined areas in METERS
+areaMaxZ | Maximum breadth (Z-axis) of player-defined areas in METERS
+autoBackup | Back up world at regular intervals
+autoBackupMins | Time between backups in MINUTES
+autoRestart | Restart server at regular intervals
+autoRestartMins | Time between restarts in MINUTES
+autoSave | Force world saves at regular intervals
+autoSaveMins | Time between forced saves in MINUTES
+chatConsoleToOps | Server OPs see all console commands
+chatToConsole | Display all chat in server console
+custAuth | Use custom user authentication
+debug | Enable server debugging
+defaultGroup | Default group assigned to new players
+exitOnFailure | Shut down server when major errors occur
+forwardAllCommands | Forward every command to server JAR
+forwardChat | Forward chat messages to server JAR
+keepBackupHours | Amount of time to keep old backups in HOURS
+localChatRadius | How far local chat can be heard in METERS
+logMessageFormat | Format for chat log entries (EXPERT SETTING)
+logMessages | Log all chat messages
+maxPlayers | Maximum number of players on server
+meCommandFormat | Format for output of !me command (EXPERT SETTING)
+msgFormat | Format for chat messages (EXPERT SETTING)
+msgForwardFormat | Format for forwarded messages (EXPERT SETTING)
+msgTitleFormat | Format for messages with group titles (EXPERT SETTING)
+msgWrap | Wrap long chat messages to fit chat window
+onlineMode | Only allow authenticated players to join server
+serverDescription | Message that appears in client's server list
+serverLanguage | Language code for localization
+showListOnConnect | Show list of connected players when joining server
+useMsgFormats | Format chat messages
+useWhitelist | Only allow whitelisted players to join server
+xmlInlineAttributes | Turn on inline XML attributes (EXPERT SETTING)
+xmlPCDATA | Turn on XML PCDATA between tags (EXPERT SETTING)
+
+For more help with configuration, please see:
+https://github.com/SimpleServer/SimpleServer/wiki/Configuration
+
Technical Details:
This wrapper works by proxying all network and console data to and from the
minecraft server. This means that your clients will be connecting to the
View
34 src/simpleserver/command/MyAreaCommand.java
@@ -35,18 +35,39 @@
import simpleserver.config.xml.Config.AreaStoragePair;
public class MyAreaCommand extends AbstractCommand implements PlayerCommand {
+ private static final byte DEFAULT_SIZE = 50;
+
public MyAreaCommand() {
super("myarea [start|end|save|unsave|rename]",
"Manage your personal area");
}
- private boolean areaSizeOk(Player player) {
- return (Math.abs(player.areastart.x() - player.areaend.x()) < 50)
- && (Math.abs(player.areastart.z() - player.areaend.z()) < 50)
+ private boolean areaSizeOk(Player player, int[] size) {
+ return (Math.abs(player.areastart.x() - player.areaend.x()) < size[0])
+ && (Math.abs(player.areastart.z() - player.areaend.z()) < size[1])
&& player.areaend.dimension() == player.areastart.dimension();
}
+
+ private int[] getAreaMax(Player player) {
+ // Get the maximum area sizes from config.xml
+ int[] size = { Math.abs(player.getServer().config.properties.getInt("areaMaxX")),
+ Math.abs(player.getServer().config.properties.getInt("areaMaxZ")) };
+
+ // Check to make sure the configuration is valid
+ // If not, reset to default size
+ for (byte i = 0; i < size.length; i++) {
+ if (size[i] <= 0 || Integer.valueOf(size[i]) == null) {
+ size[i] = DEFAULT_SIZE;
+ }
+ }
+
+ return size;
+ }
public void execute(Player player, String message) {
+ // Set up an integer array to hold the maximum area size
+ int[] maxSize = getAreaMax(player); // X, Z
+
Config config = player.getServer().config;
String arguments[] = extractArguments(message);
@@ -54,7 +75,7 @@ public void execute(Player player, String message) {
player.addTCaptionedMessage("Usage", commandPrefix() + "myarea [start|end|save|unsave|rename]");
return;
}
-
+
if (arguments[0].equals("start")) {
player.areastart = player.position();
player.areastart = player.areastart.setY((byte) 0); // no height limit
@@ -68,8 +89,9 @@ public void execute(Player player, String message) {
player.addTMessage(Color.RED, "Define start and end coordinates for your area first!");
return;
}
- if (!areaSizeOk(player)) {
- player.addTMessage(Color.RED, "Your area is allowed to have a maximum size of 50x50!");
+ if (!areaSizeOk(player, maxSize)) {
+ player.addTMessage(Color.RED, "Your area is allowed to have a maximum size of " +
+ maxSize[0] + "x" + maxSize[1] + "!");
return;
}
if (player.getServer().config.playerArea(player) != null) {
View
310 src/simpleserver/config/xml/config.xml
@@ -1,153 +1,157 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE config SYSTEM "http://simpleserver.ceilingcat.ch/resources/config.1.dtd">
-<config>
- <property name="announceRestart">true</property>
- <property name="logMessages">true</property>
- <property name="autoSaveMins">5</property>
- <property name="keepBackupHours">24</property>
- <property name="msgWrap">true</property>
- <property name="announceSave">true</property>
- <property name="msgForwardFormat">%2$s</property>
- <property name="defaultGroup">1</property>
- <property name="announceBackup">true</property>
- <property name="useMsgFormats">true</property>
- <property name="autoSave">false</property>
- <property name="localChatRadius">30</property>
- <property name="serverDescription">A server running SimpleServer</property>
- <property name="chatConsoleToOps">false</property>
- <property name="autoRestart">false</property>
- <property name="showListOnConnect">false</property>
- <property name="autoBackupMins">30</property>
- <property name="autoBackup">true</property>
- <property name="serverLanguage">en</property>
- <property name="logMessageFormat">%1$s-&gt;%2$s\: %3$s</property>
- <property name="autoRestartMins">240</property>
- <property name="msgTitleFormat">§%3$s&lt;[%2$s]%1$s&gt;§f</property>
- <property name="meCommandFormat"> * %1$s%3$s%2$s</property>
- <property name="exitOnFailure">true</property>
- <property name="msgFormat">§%3$s&lt;%1$s&gt;§f</property>
- <property name="forwardAllCommands">false</property>
- <property name="forwardChat">false</property>
- <property name="chatToConsole">true</property>
- <property name="useWhitelist">false</property>
- <property name="debug">false</property>
- <property name="defaultGroup">1</property>
- <property name="maxPlayers">16</property>
- <property name="serverDescription">A server running SimpleServer</property>
- <property name="xmlInlineAttributes">true</property>
- <property name="xmlPCDATA">true</property>
- <property name="onlineMode">true</property>
- <property name="custAuth">false</property>
-
- <ip group="5">127.0.0.1</ip>
-
- <group id="0" name="Guest" color="f">
- <showTitle />
- </group>
- <group id="1" name="Player" color="f" />
- <group id="2" name="Trusted" color="9" />
- <group id="3" name="Mod" color="9">
- <ignoreChestLocks />
- </group>
- <group id="4" name="Admin" color="2">
- <ignoreChestLocks />
- <ignoreAreas />
- </group>
- <group id="5" name="Owner" color="3">
- <ignoreChestLocks />
- <ignoreAreas />
- </group>
-
- <command name="area" allow="0+" />
- <command name="areasay" allow="0+">
- <alias>a</alias>
- </command>
- <command name="back" allow="4+" />
- <command name="backup" allow="4+" />
- <command name="ban" allow="4+" />
- <command name="banip" allow="4+" />
- <command name="chat" allow="1+">
- <alias>c</alias>
- </command>
- <command name="dimension" allow="0+">
- <alias>d</alias>
- </command>
- <command name="enchant" alias="e" allow="4+" />
- <command name="gamemode" allow="4+" />
- <command name="give" allow="3+" />
- <command name="giveplayer" allow="4+" />
- <command name="global" allow="0+" />
- <command name="gps" allow="3+" />
- <command name="group" allow="0+">
- <alias>g</alias>
- </command>
- <command name="help" allow="0+">
- <alias>commands</alias>
- </command>
- <command name="home" allow="1+" />
- <command name="iddqd" allow="4+" />
- <command name="kick" allow="3+" />
- <command name="kit" allow="1+">
- <alias>kits</alias>
- </command>
- <command name="listips" allow="3+" />
- <command name="local" allow="0+">
- <alias>l</alias>
- </command>
- <command name="lock" allow="1+" />
- <command name="login" allow="0+" />
- <command name="me" allow="0+" />
- <command name="motd" allow="0+" />
- <command name="mute" allow="3+" />
- <command name="myarea" allow="2+" />
- <command name="mystats" allow="1+" />
- <command name="register" allow="1+">
- <alias>passwd</alias>
- </command>
- <command name="rcon" allow="5+" />
- <command name="read" allow="0+" />
- <command name="reload" allow="4+">
- <forward />
- </command>
- <command name="reply" allow="1+">
- <alias>r</alias>
- </command>
- <command name="restart" allow="4+" />
- <command name="rules" allow="0+" />
- <command name="save" allow="4+">
- <forward />
- </command>
- <command name="servertime" allow="0+" />
- <command name="setgroup" allow="4+" />
- <command name="setipgroup" allow="4+" />
- <command name="spawn" allow="3+" />
- <command name="stop" allow="-" />
- <command name="teleport" allow="4+">
- <alias>tp</alias>
- </command>
- <command name="tell" allow="1+">
- <alias>t</alias>
- </command>
- <command name="time" allow="0+">
- <argument allow="4+">*</argument>
- </command>
- <command name="toggledownfall" alias="rain" allow="4+" />
- <command name="unban" allow="4+" />
- <command name="unbanip" allow="4+" />
- <command name="unlock" allow="1+" />
- <command name="unmute" allow="3+" />
- <command name="unwhitelist" allow="3+" />
- <command name="visit" allow="3+" />
- <command name="warp" allow="3+" />
- <command name="warpmeto" allow="3+">
- <alias>tpto</alias>
- </command>
- <command name="warptome" allow="3+" />
- <command name="whitelist" allow="3+" />
- <command name="who" allow="0+">
- <alias>list</alias>
- </command>
- <command name="xp" allow="4+" />
-
- <allblocks destroy="1+" place="1+" use="1+" />
-</config>
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE config SYSTEM "http://simpleserver.ceilingcat.ch/resources/config.1.dtd">
+<config>
+ <property name="announceBackup">true</property>
+ <property name="announceRestart">true</property>
+ <property name="announceSave">true</property>
+ <property name="areaMaxX">50</property>
+ <property name="areaMaxZ">50</property>
+ <property name="autoBackup">true</property>
+ <property name="autoBackupMins">30</property>
+ <property name="autoRestart">false</property>
+ <property name="autoRestartMins">240</property>
+ <property name="autoSave">false</property>
+ <property name="autoSaveMins">5</property>
+ <property name="chatConsoleToOps">false</property>
+ <property name="chatToConsole">true</property>
+ <property name="custAuth">false</property>
+ <property name="debug">false</property>
+ <property name="defaultGroup">1</property>
+ <property name="exitOnFailure">true</property>
+ <property name="forwardAllCommands">false</property>
+ <property name="forwardChat">false</property>
+ <property name="keepBackupHours">24</property>
+ <property name="localChatRadius">30</property>
+ <property name="logMessageFormat">%1$s-&gt;%2$s\: %3$s</property>
+ <property name="logMessages">true</property>
+ <property name="maxPlayers">16</property>
+ <property name="meCommandFormat"> * %1$s%3$s%2$s</property>
+ <property name="msgFormat">§%3$s&lt;%1$s&gt;§f</property>
+ <property name="msgForwardFormat">%2$s</property>
+ <property name="msgTitleFormat">§%3$s&lt;[%2$s]%1$s&gt;§f</property>
+ <property name="msgWrap">true</property>
+ <property name="onlineMode">true</property>
+ <property name="serverDescription">A server running SimpleServer</property>
+ <property name="serverLanguage">en</property>
+ <property name="showListOnConnect">false</property>
+ <property name="useMsgFormats">true</property>
+ <property name="useWhitelist">false</property>
+ <property name="xmlInlineAttributes">true</property>
+ <property name="xmlPCDATA">true</property>
+
+ <ip group="5">127.0.0.1</ip>
+
+ <group id="0" name="Guest" color="f">
+ <showTitle />
+ </group>
+ <group id="1" name="Player" color="f" />
+ <group id="2" name="Trusted" color="9" />
+ <group id="3" name="Mod" color="9">
+ <ignoreChestLocks />
+ </group>
+ <group id="4" name="Admin" color="2">
+ <ignoreChestLocks />
+ <ignoreAreas />
+ </group>
+ <group id="5" name="Owner" color="3">
+ <ignoreChestLocks />
+ <ignoreAreas />
+ </group>
+
+ <command name="area" allow="0+" />
+ <command name="areasay" allow="0+">
+ <alias>a</alias>
+ </command>
+ <command name="back" allow="4+" />
+ <command name="backup" allow="4+" />
+ <command name="ban" allow="4+" />
+ <command name="banip" allow="4+" />
+ <command name="chat" allow="1+">
+ <alias>c</alias>
+ </command>
+ <command name="dimension" allow="0+">
+ <alias>d</alias>
+ </command>
+ <command name="enchant" allow="4+">
+ <alias>e</alias>
+ </command>
+ <command name="gamemode" allow="4+" />
+ <command name="give" allow="3+" />
+ <command name="giveplayer" allow="4+" />
+ <command name="global" allow="0+" />
+ <command name="gps" allow="3+" />
+ <command name="group" allow="0+">
+ <alias>g</alias>
+ </command>
+ <command name="help" allow="0+">
+ <alias>commands</alias>
+ </command>
+ <command name="home" allow="1+" />
+ <command name="iddqd" allow="4+" />
+ <command name="kick" allow="3+" />
+ <command name="kit" allow="1+">
+ <alias>kits</alias>
+ </command>
+ <command name="listips" allow="3+" />
+ <command name="local" allow="0+">
+ <alias>l</alias>
+ </command>
+ <command name="lock" allow="1+" />
+ <command name="login" allow="0+" />
+ <command name="me" allow="0+" />
+ <command name="motd" allow="0+" />
+ <command name="mute" allow="3+" />
+ <command name="myarea" allow="2+" />
+ <command name="mystats" allow="1+" />
+ <command name="register" allow="1+">
+ <alias>passwd</alias>
+ </command>
+ <command name="rcon" allow="5+" />
+ <command name="read" allow="0+" />
+ <command name="reload" allow="4+">
+ <forward />
+ </command>
+ <command name="reply" allow="1+">
+ <alias>r</alias>
+ </command>
+ <command name="restart" allow="4+" />
+ <command name="rules" allow="0+" />
+ <command name="save" allow="4+">
+ <forward />
+ </command>
+ <command name="servertime" allow="0+" />
+ <command name="setgroup" allow="4+" />
+ <command name="setipgroup" allow="4+" />
+ <command name="spawn" allow="3+" />
+ <command name="stop" allow="-" />
+ <command name="teleport" allow="4+">
+ <alias>tp</alias>
+ </command>
+ <command name="tell" allow="1+">
+ <alias>t</alias>
+ </command>
+ <command name="time" allow="0+">
+ <argument allow="4+">*</argument>
+ </command>
+ <command name="toggledownfall" allow="4+">
+ <alias>rain</alias>
+ </command>
+ <command name="unban" allow="4+" />
+ <command name="unbanip" allow="4+" />
+ <command name="unlock" allow="1+" />
+ <command name="unmute" allow="3+" />
+ <command name="unwhitelist" allow="3+" />
+ <command name="visit" allow="3+" />
+ <command name="warp" allow="3+" />
+ <command name="warpmeto" allow="3+">
+ <alias>tpto</alias>
+ </command>
+ <command name="warptome" allow="3+" />
+ <command name="whitelist" allow="3+" />
+ <command name="who" allow="0+">
+ <alias>list</alias>
+ </command>
+ <command name="xp" allow="4+" />
+
+ <allblocks destroy="1+" place="1+" use="1+" />
+</config>

0 comments on commit f7a512a

Please sign in to comment.
Something went wrong with that request. Please try again.