From c719d548d0bbbff398ed8d080d8e092d3cbf18f1 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 19 Feb 2016 12:03:22 -0500 Subject: [PATCH] Fix SpongePlayer --- .../sponge/object/SpongePlayer.java | 9 ++++----- .../sponge/util/SpongeChatManager.java | 20 +++++++++---------- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java index ca6cb6415..2860fafa9 100644 --- a/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java +++ b/src/main/java/com/plotsquared/sponge/object/SpongePlayer.java @@ -11,8 +11,8 @@ import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.PlotGamemode; import com.intellectualcrafters.plot.util.PlotWeather; import com.intellectualcrafters.plot.util.UUIDHandler; -import com.plotsquared.sponge.SpongeMain; import com.plotsquared.sponge.util.SpongeUtil; +import org.spongepowered.api.Sponge; import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData; import org.spongepowered.api.data.value.mutable.Value; @@ -97,8 +97,7 @@ public class SpongePlayer extends PlotPlayer { hasPerm.add(perm); return true; } - final boolean value = player.hasPermission(perm); - return value; + return player.hasPermission(perm); } @Override @@ -282,12 +281,12 @@ public class SpongePlayer extends PlotPlayer { @Override public void kick(final String message) { - player.kick(SpongeMain.THIS.getText(message)); + player.kick(Text.of(message)); } @Override public boolean isBanned() { - BanService service = SpongeMain.THIS.getGame().getServiceManager().provide(BanService.class).get(); + BanService service = Sponge.getServiceManager().provide(BanService.class).get(); return service.isBanned(player.getProfile()); } } diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeChatManager.java b/src/main/java/com/plotsquared/sponge/util/SpongeChatManager.java index 962b4fe0a..aac8190d9 100644 --- a/src/main/java/com/plotsquared/sponge/util/SpongeChatManager.java +++ b/src/main/java/com/plotsquared/sponge/util/SpongeChatManager.java @@ -1,32 +1,32 @@ package com.plotsquared.sponge.util; -import org.spongepowered.api.text.action.TextActions; - import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.PlotMessage; import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.util.ChatManager; import com.plotsquared.sponge.object.SpongePlayer; +import org.spongepowered.api.text.Text; +import org.spongepowered.api.text.action.TextActions; -public class SpongeChatManager extends ChatManager { +public class SpongeChatManager extends ChatManager { @Override - public TextBuilder builder() { - return Texts.builder(); + public Text.Builder builder() { + return Text.builder(); } @Override public void color(final PlotMessage m, final String color) { - m.$(this).color(Texts.of(color).getColor()); + m.$(this).color(Text.of(color).getColor()); } @Override public void tooltip(final PlotMessage m, final PlotMessage... tooltips) { - final TextBuilder builder = Texts.builder(); + final Text.Builder builder = Text.builder(); boolean lb = false; for (final PlotMessage tooltip : tooltips) { if (lb) { - builder.append(Texts.of("\n")); + builder.append(Text.of("\n")); } builder.append(tooltip.$(this).build()); lb = true; @@ -42,13 +42,13 @@ public class SpongeChatManager extends ChatManager { @Override public void text(final PlotMessage m, final String text) { - m.$(this).append(Texts.of(text)); + m.$(this).append(Text.of(text)); } @Override public void send(final PlotMessage m, final PlotPlayer player) { if (ConsolePlayer.isConsole(player)) { - player.sendMessage(Texts.legacy().to(m.$(this).build())); + player.sendMessage(m.$(this).build().toPlain()); } else { ((SpongePlayer) player).player.sendMessage(m.$(this).build()); }