Forgot to push this

This commit is contained in:
boy0001 2015-08-26 08:35:32 +10:00
parent b2f8238f5d
commit dc37465c8a
8 changed files with 280 additions and 139 deletions

144
.gitignore vendored
View File

@ -1,139 +1,9 @@
### Ignore script files
*.sh
*.bat
### Maven template
target/classes
target/maven-archiver
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
dependency-reduced-pom.xml
buildNumber.properties
.mvn/timing.properties
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
/out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
### NetBeans template
nbproject/private/
build/
nbbuild/
dist/
nbdist/
nbactions.xml
nb-configuration.xml
.nb-gradle/
### Eclipse template
*.pydevproject
.metadata
.gradle
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.settings/
.loadpath
# Eclipse Core
.project
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# JDT-specific (Eclipse Java Development Tools)
.classpath
# Java annotation processor (APT)
.factorypath
# PDT-specific
.buildpath
# sbteclipse plugin
.target
# TeXlipse plugin
.texlipse
### Java template
*.prefs
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.war
*.ear
*.zip
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
*.java
target/PlotSquared-Null.jar
target/PlotSquared-Uber.jar
/target/
/target/classes
/target/PlotSquared-Null.jar
/target/PlotSquared-Uber.jar
/target/maven-archiver
*.project
*.classpath

View File

@ -0,0 +1,54 @@
package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.util.ChatManager;
public class PlotMessage {
private Object builder;
public PlotMessage() {
this.builder = ChatManager.manager.builder();
}
public <T> T $(ChatManager<T> manager) {
return (T) builder;
}
public PlotMessage(String text) {
this();
text(text);
}
public PlotMessage text(String text) {
ChatManager.manager.text(this, text);
return this;
}
public PlotMessage tooltip(PlotMessage... tooltip) {
ChatManager.manager.tooltip(this, tooltip);
return this;
}
public PlotMessage tooltip(String tooltip) {
return tooltip(new PlotMessage(tooltip));
}
public PlotMessage command(String command) {
ChatManager.manager.command(this, command);
return this;
}
public PlotMessage suggest(String command) {
ChatManager.manager.suggest(this, command);
return this;
}
public PlotMessage color(String color) {
ChatManager.manager.color(this, color);
return this;
}
public void send(PlotPlayer player) {
ChatManager.manager.send(this, player);
}
}

View File

@ -0,0 +1,22 @@
package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.PlotMessage;
import com.intellectualcrafters.plot.object.PlotPlayer;
public abstract class ChatManager<T> {
public static ChatManager<?> manager;
public abstract T builder();
public abstract void color(PlotMessage message, String color);
public abstract void tooltip(PlotMessage message, PlotMessage... tooltip);
public abstract void command(PlotMessage message, String command);
public abstract void text(PlotMessage message, String text);
public abstract void send(PlotMessage plotMessage, PlotPlayer player);
public abstract void suggest(PlotMessage plotMessage, String command);
}

View File

@ -0,0 +1,12 @@
package com.plotsquared.bukkit.listeners.worldedit;
import com.sk89q.worldedit.extent.AbstractDelegateExtent;
import com.sk89q.worldedit.extent.Extent;
public class ExtentWrapper extends AbstractDelegateExtent {
protected ExtentWrapper(Extent extent) {
super(extent);
}
}

View File

@ -0,0 +1,62 @@
package com.plotsquared.bukkit.util;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import com.intellectualcrafters.plot.config.C;
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.bukkit.chat.FancyMessage;
import com.plotsquared.bukkit.object.BukkitPlayer;
public class BukkitChatManager extends ChatManager<FancyMessage> {
@Override
public FancyMessage builder() {
return new FancyMessage("");
}
@Override
public void color(PlotMessage m, String color) {
m.$(this).color(ChatColor.getByChar(C.color(color).substring(1)));
}
@Override
public void tooltip(PlotMessage m, PlotMessage... tooltips) {
List<FancyMessage> lines = new ArrayList<>();
for (PlotMessage tooltip : tooltips) {
lines.add(tooltip.$(this));
}
m.$(this).formattedTooltip(lines);
}
@Override
public void command(PlotMessage m, String command) {
m.$(this).command(command);
}
@Override
public void text(PlotMessage m, String text) {
m.$(this).then(ChatColor.stripColor(text));
}
@Override
public void send(PlotMessage m, PlotPlayer player) {
if (ConsolePlayer.isConsole(player)) {
player.sendMessage(m.$(this).toOldMessageFormat());
}
else {
m.$(this).send(((BukkitPlayer) player).player);
}
}
@Override
public void suggest(PlotMessage m, String command) {
m.$(this).suggest(command);
}
}

View File

@ -0,0 +1,52 @@
package com.plotsquared.bukkit.util;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.ChatColor;
import com.intellectualcrafters.plot.config.C;
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.bukkit.chat.FancyMessage;
import com.plotsquared.bukkit.object.BukkitPlayer;
public class BukkitPlainChatManager extends ChatManager<List<StringBuilder>> {
@Override
public List<StringBuilder> builder() {
return new ArrayList<StringBuilder>();
}
@Override
public void color(PlotMessage m, String color) {
List<StringBuilder> parts = m.$(this);
parts.get(parts.size() - 1).insert(0, color);
}
@Override
public void tooltip(PlotMessage m, PlotMessage... tooltips) {}
@Override
public void command(PlotMessage m, String command) {}
@Override
public void text(PlotMessage m, String text) {
m.$(this).add(new StringBuilder(ChatColor.stripColor(text)));
}
@Override
public void send(PlotMessage m, PlotPlayer player) {
StringBuilder built = new StringBuilder();
for (StringBuilder sb : m.$(this)) {
built.append(sb);
}
player.sendMessage(built.toString());
}
@Override
public void suggest(PlotMessage m, String command) {}
}

View File

@ -75,10 +75,13 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
@Override
public void run() {
if (toUpdate.size() == 0) {
return;
}
int count = 0;
ArrayList<Chunk> chunks = new ArrayList<Chunk>();
Iterator<Entry<ChunkLoc, Chunk>> i = toUpdate.entrySet().iterator();
while (i.hasNext() && count < 1024) {
while (i.hasNext() && count < 128) {
chunks.add(i.next().getValue());
i.remove();
count++;
@ -88,7 +91,7 @@ public class SetBlockFast_1_8 extends BukkitSetBlockManager {
}
update(chunks);
}
}, 20);
}, 1);
this.chunksender = new SendChunk();
}

View File

@ -0,0 +1,66 @@
package com.plotsquared.sponge.util;
import org.spongepowered.api.text.TextBuilder;
import org.spongepowered.api.text.Texts;
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;
public class SpongeChatManager extends ChatManager<TextBuilder> {
@Override
public TextBuilder builder() {
return Texts.builder();
}
@Override
public void color(PlotMessage m, String color) {
m.$(this).color(Texts.of(color).getColor());
}
@Override
public void tooltip(PlotMessage m, PlotMessage... tooltips) {
TextBuilder builder = Texts.builder();
boolean lb = false;
for (PlotMessage tooltip : tooltips) {
if (lb) {
builder.append(Texts.of("\n"));
}
builder.append(tooltip.$(this).build());
lb = true;
}
// AchievementBuilder builder = SpongeMain.THIS.getGame().getRegistry().createAchievementBuilder();
m.$(this).onHover(TextActions.showText(builder.toText()));
}
@Override
public void command(PlotMessage m, String command) {
m.$(this).onClick(TextActions.runCommand(command));
}
@Override
public void text(PlotMessage m, String text) {
m.$(this).append(Texts.of(text));
}
@Override
public void send(PlotMessage m, PlotPlayer player) {
if (ConsolePlayer.isConsole(player)) {
player.sendMessage(Texts.legacy().to(m.$(this).build()));
}
else {
((SpongePlayer) player).player.sendMessage(m.$(this).build());
}
}
@Override
public void suggest(PlotMessage m, String command) {
m.$(this).onClick(TextActions.suggestCommand(command));
}
}