Guava optional is possibly the stupidest thing

Sponge API is still unstable, so updating our code to the design pattern
of the day.
This commit is contained in:
cmastudios 2014-11-05 19:14:28 -06:00
parent 2280e5d857
commit f6f7c91801
2 changed files with 9 additions and 10 deletions

View File

@ -1,5 +1,6 @@
package com.tommytony.war;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.tommytony.war.zone.ZoneConfig;
import org.spongepowered.api.entity.Player;
@ -104,10 +105,9 @@ public class WarConfig implements Closeable {
UUID playerId = UUID.fromString(result.getString(1));
if (playerId == null)
continue;
Player player = plugin.getGame().getPlayer(playerId);
if (player == null)
continue;
makers.add(player);
Optional<Player> player = plugin.getGame().getPlayer(playerId);
if (player.isPresent())
makers.add(player.get());
}
}
return ImmutableList.copyOf(makers);

View File

@ -1,5 +1,6 @@
package com.tommytony.war.command;
import com.google.common.base.Optional;
import com.google.common.collect.ImmutableList;
import com.tommytony.war.WarConfig;
import com.tommytony.war.WarPlugin;
@ -53,16 +54,14 @@ public class WarConfigCommand implements CommandCallable {
@Override
public Description getDescription() {
return new Description() {
@Nullable
@Override
public String getShortDescription() {
return "View/modify war config";
public Optional<String> getShortDescription() {
return Optional.of("View/modify war config");
}
@Nullable
@Override
public String getHelp() {
return "Allows viewing of the war server config or changing various settings.";
public Optional<String> getHelp() {
return Optional.of("Allows viewing of the war server config or changing various settings.");
}
@Override