Fix compatibility with bukkit 1.5
Recover on failed fancy message initialization
Fix /2 remove *
This commit is contained in:
Jesse Boyd
2016-06-27 18:38:14 +10:00
parent 047f9a75b9
commit 817a5bc16e
8 changed files with 25 additions and 22 deletions

View File

@ -54,7 +54,7 @@ public class Kick extends SubCommand {
}
players.add(pp);
}
break;
continue;
}
PlotPlayer pp = UUIDHandler.getPlayer(uuid);
if (pp != null) {
@ -67,8 +67,7 @@ public class Kick extends SubCommand {
return false;
}
for (PlotPlayer player2 : players) {
Location location2 = player2.getLocation();
if (!player2.getLocation().getWorld().equals(location2.getWorld()) || !plot.equals(location2.getPlot())) {
if (!plot.equals(player2.getCurrentPlot())) {
MainUtil.sendMessage(player, C.INVALID_PLAYER, args[0]);
return false;
}

View File

@ -1650,7 +1650,7 @@ public class Plot {
if (uuid == DBFunc.everyone) {
boolean result = false;
for (UUID other : new HashSet<>(getDenied())) {
result = result || rmvDenied(other);
result = rmvDenied(other) || result;
}
return result;
}
@ -1677,7 +1677,7 @@ public class Plot {
if (uuid == DBFunc.everyone) {
boolean result = false;
for (UUID other : new HashSet<>(getTrusted())) {
result = result || rmvTrusted(other);
result = rmvTrusted(other) || result;
}
return result;
}
@ -1707,7 +1707,7 @@ public class Plot {
if (uuid == DBFunc.everyone) {
boolean result = false;
for (UUID other : new HashSet<>(this.members)) {
result = result || rmvMember(other);
result = rmvMember(other) || result;
}
return result;
}

View File

@ -1,6 +1,8 @@
package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.chat.PlainChatManager;
import com.intellectualcrafters.plot.util.ChatManager;
public class PlotMessage {
@ -8,7 +10,13 @@ public class PlotMessage {
private Object builder;
public PlotMessage() {
reset(ChatManager.manager);
try {
reset(ChatManager.manager);
} catch (Throwable e) {
PS.debug("PlotSquared doesn't support fancy chat for " + PS.get().IMP.getServerVersion());
ChatManager.manager = new PlainChatManager();
reset(ChatManager.manager);
}
}
public PlotMessage(String text) {

View File

@ -0,0 +1,47 @@
package com.intellectualcrafters.plot.object.chat;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotMessage;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.ChatManager;
import java.util.ArrayList;
import java.util.List;
public class PlainChatManager extends ChatManager<List<StringBuilder>> {
@Override
public List<StringBuilder> builder() {
return new ArrayList<>();
}
@Override
public void color(PlotMessage message, String color) {
List<StringBuilder> parts = message.$(this);
parts.get(parts.size() - 1).insert(0, color);
}
@Override
public void tooltip(PlotMessage message, PlotMessage... tooltips) {}
@Override
public void command(PlotMessage message, String command) {}
@Override
public void text(PlotMessage message, String text) {
message.$(this).add(new StringBuilder(C.color(text)));
}
@Override
public void send(PlotMessage plotMessage, PlotPlayer player) {
StringBuilder built = new StringBuilder();
for (StringBuilder sb : plotMessage.$(this)) {
built.append(sb);
}
player.sendMessage(built.toString());
}
@Override
public void suggest(PlotMessage plotMessage, String command) {}
}