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.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());
}
}

View File

@ -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<TextBuilder> {
public class SpongeChatManager extends ChatManager<Text.Builder> {
@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<TextBuilder> {
@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());
}