Mein Problem ist, dass immer nur als resultat true rauskommt
sieht jemand eine lösung dafür?
Imports sind:
Code:
import java.io.FileReader; import java.io.IOException; import java.util.Properties;
import java.io.FileReader; import java.io.IOException; import java.util.Properties;
onlineMode = props.getProperty("online-mode", "false") != null;
onlineMode = (props.getProperty("online-mode", "false") != null);
onlineMode = props.getProperty("online-mode", "false");
onlineMode = props.getProperty("online-mode", "false") == "true";
#Minecraft server properties #Tue Feb 21 14:30:31 CET 2012 allow-nether=true level-name=world enable-query=false allow-flight=false server-port=25565 level-type=DEFAULT enable-rcon=false level-seed= server-ip= spawn-npcs=true white-list=false spawn-animals=true online-mode=true pvp=true difficulty=1 gamemode=0 max-players=20 spawn-monsters=true generate-structures=true view-distance=10 motd=A Minecraft Server
getProperty
public String getProperty(String key,
String defaultValue)
Searches for the property with the specified key in this property list. If the key is not found in this property list, the default property list, and its defaults, recursively, are then checked. The method returns the default value argument if the property is not found.
Parameters:
key - the hashtable key.
defaultValue - a default value.
Returns:
the value in this property list with the specified key value.
See Also:
setProperty(java.lang.String, java.lang.String), defaults
onlineMode = props.getProperty("online-mode", "false") != "false";
onlineMode = props.getProperty("online-mode") == "true";