mirror of https://github.com/taoneill/war.git
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:
parent
2280e5d857
commit
f6f7c91801
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue