Skip to content

Commit

Permalink
Update to SpongeAPI 4.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
ryantheleach committed Apr 20, 2016
1 parent 6144823 commit 4fc838f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 11 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply plugin: 'java'
apply plugin: 'com.github.johnrengelman.shadow'

group 'au.id.rleach'
version '1.1.1'
version '1.1.2'

sourceCompatibility = 1.8

Expand Down Expand Up @@ -40,5 +40,5 @@ dependencies {
testCompile group: 'junit', name: 'junit', version: '4.11'
shadow translator
compile translator
compile 'org.spongepowered:spongeapi:3.0.0'
compile 'org.spongepowered:spongeapi:4.0.3'
}
16 changes: 9 additions & 7 deletions src/main/java/au/id/rleach/translate/TranslateWithBing.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,17 @@
import org.spongepowered.api.text.format.TextColors;
import org.spongepowered.api.text.serializer.TextSerializers;

import javax.inject.Inject;
import java.io.IOException;
import java.net.URL;
import java.util.*;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Optional;

import javax.inject.Inject;


@Plugin(id="TranslateWithBing", name="TranslateWithBing", version="1.1.1")
@Plugin(id="translatewithbing", name="TranslateWithBing", version="1.1.2")
public class TranslateWithBing {

@Inject
Expand Down Expand Up @@ -194,10 +198,8 @@ public void chatEvent(final MessageChannelEvent.Chat chat, @First final Player p
.map(p -> (Player) p)
.iterator();
final ImmutableListMultimap<Language, Player> multiMap = Multimaps.index(playerI, this::languageFromPlayer);
final Optional<Text> optMessage = chat.getMessage();
optMessage.ifPresent(
message -> sendTranslatedMessages(player, multiMap, message)
);
final Text message = chat.getMessage();
sendTranslatedMessages(player, multiMap, message);
}

private Language languageFromPlayer(final Player p){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import org.spongepowered.api.data.DataHolder;
import org.spongepowered.api.data.DataView;
import org.spongepowered.api.data.manipulator.DataManipulatorBuilder;
import org.spongepowered.api.util.persistence.InvalidDataException;

import java.util.Optional;

Expand All @@ -20,7 +19,7 @@ public Optional<LanguageData> createFrom(DataHolder dataHolder) {
}

@Override
public Optional<LanguageData> build(DataView container) throws InvalidDataException {
public Optional<LanguageData> build(DataView container) {
// Note that this should check the Queries.CONTENT_VERSION, but for the sake of demonstration
// it's not necessary
if (container.contains(TranslateKeys.Language.getQuery())) {
Expand Down

0 comments on commit 4fc838f

Please sign in to comment.