Fix SpongePlayer

This commit is contained in:
Matt 2016-02-19 12:03:22 -05:00
parent 536b011ea0
commit c719d548d0
2 changed files with 14 additions and 15 deletions

View File

@ -11,8 +11,8 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotGamemode; import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.PlotWeather; import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.sponge.SpongeMain;
import com.plotsquared.sponge.util.SpongeUtil; import com.plotsquared.sponge.util.SpongeUtil;
import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.key.Keys; import org.spongepowered.api.data.key.Keys;
import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData; import org.spongepowered.api.data.manipulator.mutable.TargetedLocationData;
import org.spongepowered.api.data.value.mutable.Value; import org.spongepowered.api.data.value.mutable.Value;
@ -97,8 +97,7 @@ public class SpongePlayer extends PlotPlayer {
hasPerm.add(perm); hasPerm.add(perm);
return true; return true;
} }
final boolean value = player.hasPermission(perm); return player.hasPermission(perm);
return value;
} }
@Override @Override
@ -282,12 +281,12 @@ public class SpongePlayer extends PlotPlayer {
@Override @Override
public void kick(final String message) { public void kick(final String message) {
player.kick(SpongeMain.THIS.getText(message)); player.kick(Text.of(message));
} }
@Override @Override
public boolean isBanned() { 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()); return service.isBanned(player.getProfile());
} }
} }

View File

@ -1,32 +1,32 @@
package com.plotsquared.sponge.util; package com.plotsquared.sponge.util;
import org.spongepowered.api.text.action.TextActions;
import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.PlotMessage; import com.intellectualcrafters.plot.object.PlotMessage;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.ChatManager; import com.intellectualcrafters.plot.util.ChatManager;
import com.plotsquared.sponge.object.SpongePlayer; import com.plotsquared.sponge.object.SpongePlayer;
import org.spongepowered.api.text.Text;
import org.spongepowered.api.text.action.TextActions;
public class SpongeChatManager extends ChatManager<TextBuilder> { public class SpongeChatManager extends ChatManager<Text.Builder> {
@Override @Override
public TextBuilder builder() { public Text.Builder builder() {
return Texts.builder(); return Text.builder();
} }
@Override @Override
public void color(final PlotMessage m, final String color) { public void color(final PlotMessage m, final String color) {
m.$(this).color(Texts.of(color).getColor()); m.$(this).color(Text.of(color).getColor());
} }
@Override @Override
public void tooltip(final PlotMessage m, final PlotMessage... tooltips) { public void tooltip(final PlotMessage m, final PlotMessage... tooltips) {
final TextBuilder builder = Texts.builder(); final Text.Builder builder = Text.builder();
boolean lb = false; boolean lb = false;
for (final PlotMessage tooltip : tooltips) { for (final PlotMessage tooltip : tooltips) {
if (lb) { if (lb) {
builder.append(Texts.of("\n")); builder.append(Text.of("\n"));
} }
builder.append(tooltip.$(this).build()); builder.append(tooltip.$(this).build());
lb = true; lb = true;
@ -42,13 +42,13 @@ public class SpongeChatManager extends ChatManager<TextBuilder> {
@Override @Override
public void text(final PlotMessage m, final String text) { public void text(final PlotMessage m, final String text) {
m.$(this).append(Texts.of(text)); m.$(this).append(Text.of(text));
} }
@Override @Override
public void send(final PlotMessage m, final PlotPlayer player) { public void send(final PlotMessage m, final PlotPlayer player) {
if (ConsolePlayer.isConsole(player)) { if (ConsolePlayer.isConsole(player)) {
player.sendMessage(Texts.legacy().to(m.$(this).build())); player.sendMessage(m.$(this).build().toPlain());
} else { } else {
((SpongePlayer) player).player.sendMessage(m.$(this).build()); ((SpongePlayer) player).player.sendMessage(m.$(this).build());
} }