Fixed interactive chat colors + added interactive pages to sponge.

This commit is contained in:
boy0001
2015-08-25 02:28:32 +10:00
parent 83d0b8cebb
commit 68df5b1930
8 changed files with 161 additions and 164 deletions

View File

@ -35,6 +35,7 @@ import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.BlockUpdateUtil;
import com.intellectualcrafters.plot.util.ChatManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ConsoleColors;
import com.intellectualcrafters.plot.util.EconHandler;
@ -64,12 +65,14 @@ import com.plotsquared.bukkit.listeners.WorldEvents;
import com.plotsquared.bukkit.listeners.worldedit.WEListener;
import com.plotsquared.bukkit.listeners.worldedit.WESubscriber;
import com.plotsquared.bukkit.titles.DefaultTitle;
import com.plotsquared.bukkit.util.BukkitChatManager;
import com.plotsquared.bukkit.util.BukkitChunkManager;
import com.plotsquared.bukkit.util.BukkitCommand;
import com.plotsquared.bukkit.util.BukkitEconHandler;
import com.plotsquared.bukkit.util.BukkitEventUtil;
import com.plotsquared.bukkit.util.BukkitHybridUtils;
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
import com.plotsquared.bukkit.util.BukkitPlainChatManager;
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.BukkitSetBlockManager;
import com.plotsquared.bukkit.util.BukkitSetupUtils;
@ -637,4 +640,14 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
PS.debug("Unknown NMS package: " + StringMan.getString(pas));
return "1_8_R3";
}
@Override
public ChatManager<?> initChatManager() {
if (Settings.FANCY_CHAT) {
return new BukkitChatManager();
}
else {
return new BukkitPlainChatManager();
}
}
}

View File

@ -35,6 +35,7 @@ import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
import com.intellectualcrafters.plot.config.C;
/**
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>.
@ -134,9 +135,6 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
* @exception IllegalArgumentException If the specified {@code ChatColor} enumeration value is not a color (but a format value).
*/
public FancyMessage color(final ChatColor color) {
if (!color.isColor()) {
throw new IllegalArgumentException(color.name() + " is not a color");
}
latest().color = color;
dirty = true;
return this;

View File

@ -152,7 +152,7 @@ public class BukkitPlayer extends PlotPlayer {
@Override
public void setAttribute(String key) {
key = "plotsquared_user_attributes." + key;
if (EconHandler.manager == null) {
if (EconHandler.manager == null || player.hasPermission("plotsquared_user_attributes.*")) {
setMeta(key, true);
return;
}

View File

@ -50,6 +50,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ChatManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
@ -66,6 +67,7 @@ import com.plotsquared.sponge.generator.WorldModify;
import com.plotsquared.sponge.listener.MainListener;
import com.plotsquared.sponge.util.KillRoadMobs;
import com.plotsquared.sponge.util.SpongeBlockManager;
import com.plotsquared.sponge.util.SpongeChatManager;
import com.plotsquared.sponge.util.SpongeChunkManager;
import com.plotsquared.sponge.util.SpongeCommand;
import com.plotsquared.sponge.util.SpongeEventUtil;
@ -229,10 +231,6 @@ public class SpongeMain implements IPlotMain, PluginContainer {
PS.instance = new PS(this, "Sponge");
// TODO Until P^2 has json chat stuff for sponge, disable this
Settings.FANCY_CHAT = false;
// done
registerBlocks();
ConfigurationSection worldSection = PS.get().config.getConfigurationSection("worlds");
@ -638,4 +636,9 @@ public class SpongeMain implements IPlotMain, PluginContainer {
public String getNMSPackage() {
return "1_8_R3";
}
@Override
public ChatManager<?> initChatManager() {
return new SpongeChatManager();
}
}

View File

@ -10,7 +10,9 @@ import org.spongepowered.api.data.value.mutable.Value;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.player.gamemode.GameMode;
import org.spongepowered.api.entity.player.gamemode.GameModes;
import org.spongepowered.api.text.TextBuilder;
import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.action.HoverAction;
import org.spongepowered.api.text.chat.ChatTypes;
import com.flowpowered.math.vector.Vector3d;