Shade in Kashike's lib

This commit is contained in:
Matthew Miller 2019-04-19 14:49:29 +10:00
parent 3e4004ad9e
commit 55348346e9
13 changed files with 44 additions and 17 deletions

View File

@ -142,6 +142,9 @@ subprojects {
include(dependency('com.sk89q:jchronic:0.2.4a')) include(dependency('com.sk89q:jchronic:0.2.4a'))
include(dependency('com.thoughtworks.paranamer:paranamer:2.6')) include(dependency('com.thoughtworks.paranamer:paranamer:2.6'))
include(dependency('com.sk89q.lib:jlibnoise:1.0.0')) include(dependency('com.sk89q.lib:jlibnoise:1.0.0'))
relocate('net.kyori.text', 'com.sk89q.worldedit.util.formatting') {
include(dependency('net.kyori:text-api:2.0.0'))
}
} }
exclude 'GradleStart**' exclude 'GradleStart**'
exclude '.cache' exclude '.cache'

View File

@ -16,6 +16,7 @@
<allow pkg="net.royawesome.jlibnoise"/> <allow pkg="net.royawesome.jlibnoise"/>
<allow pkg="org.json.simple" /> <allow pkg="org.json.simple" />
<allow pkg="org.slf4j"/> <allow pkg="org.slf4j"/>
<allow pkg="net.kyori.text"/>
<subpackage name="util.yaml"> <subpackage name="util.yaml">
<allow pkg="org.yaml.snakeyaml"/> <allow pkg="org.yaml.snakeyaml"/>

View File

@ -15,6 +15,7 @@ dependencies {
compile 'org.bstats:bstats-bukkit:1.4' compile 'org.bstats:bstats-bukkit:1.4'
compile "io.papermc:paperlib:1.0.1" compile "io.papermc:paperlib:1.0.1"
compile 'org.slf4j:slf4j-jdk14:1.7.26' compile 'org.slf4j:slf4j-jdk14:1.7.26'
compile 'net.kyori:text-adapter-bukkit:1.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1' testCompile 'org.mockito:mockito-core:1.9.0-rc1'
} }

View File

@ -26,7 +26,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.auth.AuthorizationException;
import com.sk89q.worldedit.util.formatting.Fragment; import net.kyori.text.TextComponent;
import net.kyori.text.adapter.bukkit.TextAdapter;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -93,9 +94,8 @@ public class BukkitCommandSender implements Actor {
} }
@Override @Override
public void print(Fragment fragment) { public void print(TextComponent component) {
// TODO Bukkit is bad and the API is somewhat lacking TextAdapter.sendComponent(sender, component);
printRaw(fragment.toString());
} }
@Override @Override

View File

@ -31,14 +31,14 @@ import com.sk89q.worldedit.math.BlockVector3;
import com.sk89q.worldedit.math.Vector3; import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.formatting.Fragment;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes; import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import net.kyori.text.TextComponent;
import net.kyori.text.adapter.bukkit.TextAdapter;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -127,9 +127,8 @@ public class BukkitPlayer extends AbstractPlayerActor {
} }
@Override @Override
public void print(Fragment fragment) { public void print(TextComponent component) {
// TODO Bukkit is bad and the API is somewhat lacking TextAdapter.sendComponent(player, component);
printRaw(fragment.toString());
} }
@Override @Override

View File

@ -13,6 +13,7 @@ dependencies {
compile 'com.sk89q.lib:jlibnoise:1.0.0' compile 'com.sk89q.lib:jlibnoise:1.0.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1' compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.slf4j:slf4j-api:1.7.26' compile 'org.slf4j:slf4j-api:1.7.26'
compile 'net.kyori:text-api:2.0.0'
//compile 'net.sf.trove4j:trove4j:3.0.3' //compile 'net.sf.trove4j:trove4j:3.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1' testCompile 'org.mockito:mockito-core:1.9.0-rc1'
} }
@ -29,4 +30,4 @@ sourceSets {
} }
} }
build.dependsOn(shadowJar) build.dependsOn(shadowJar { classifier = null })

View File

@ -23,7 +23,7 @@ import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionOwner; import com.sk89q.worldedit.session.SessionOwner;
import com.sk89q.worldedit.util.Identifiable; import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.util.auth.Subject; import com.sk89q.worldedit.util.auth.Subject;
import com.sk89q.worldedit.util.formatting.Fragment; import net.kyori.text.TextComponent;
import java.io.File; import java.io.File;
@ -77,11 +77,11 @@ public interface Actor extends Identifiable, SessionOwner, Subject {
void printError(String msg); void printError(String msg);
/** /**
* Print a {@link Fragment}. * Print a {@link TextComponent}.
* *
* @param fragment The fragment to print * @param component The component to print
*/ */
void print(Fragment fragment); void print(TextComponent component);
/** /**
* Returns true if the actor can destroy bedrock. * Returns true if the actor can destroy bedrock.

View File

@ -31,10 +31,10 @@ import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide; import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location; import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.Fragment;
import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.gamemode.GameMode; import com.sk89q.worldedit.world.gamemode.GameMode;
import net.kyori.text.TextComponent;
import java.util.UUID; import java.util.UUID;
@ -134,8 +134,8 @@ class PlayerProxy extends AbstractPlayerActor {
} }
@Override @Override
public void print(Fragment fragment) { public void print(TextComponent component) {
basePlayer.print(fragment); basePlayer.print(component);
} }
@Override @Override

View File

@ -19,6 +19,7 @@ def forgeVersion = "25.0.76"
dependencies { dependencies {
compile project(':worldedit-core') compile project(':worldedit-core')
compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2' compile 'org.apache.logging.log4j:log4j-slf4j-impl:2.11.2'
compile 'net.kyori:text-serializer-gson:2.0.0'
minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}" minecraft "net.minecraftforge:forge:${minecraftVersion}-${forgeVersion}"

View File

@ -34,6 +34,7 @@ import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder; import com.sk89q.worldedit.world.block.BlockStateHolder;
import net.kyori.text.TextComponent;
import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
@ -141,6 +142,11 @@ public class ForgePlayer extends AbstractPlayerActor {
sendColorized(msg, TextFormatting.RED); sendColorized(msg, TextFormatting.RED);
} }
@Override
public void print(TextComponent component) {
// TODO
}
private void sendColorized(String msg, TextFormatting formatting) { private void sendColorized(String msg, TextFormatting formatting) {
for (String part : msg.split("\n")) { for (String part : msg.split("\n")) {
TextComponentString component = new TextComponentString(part); TextComponentString component = new TextComponentString(part);

View File

@ -19,6 +19,7 @@ dependencies {
compile project(':worldedit-core') compile project(':worldedit-core')
compile 'org.spongepowered:spongeapi:7.1.0' compile 'org.spongepowered:spongeapi:7.1.0'
compile 'org.bstats:bstats-sponge:1.4' compile 'org.bstats:bstats-sponge:1.4'
compile 'net.kyori:text-adapter-spongeapi:1.0.3'
testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1' testCompile group: 'org.mockito', name: 'mockito-core', version:'1.9.0-rc1'
} }

View File

@ -26,6 +26,8 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.internal.cui.CUIEvent; import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey; import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.auth.AuthorizationException; import com.sk89q.worldedit.util.auth.AuthorizationException;
import net.kyori.text.TextComponent;
import net.kyori.text.adapter.spongeapi.TextAdapter;
import org.spongepowered.api.command.CommandSource; import org.spongepowered.api.command.CommandSource;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
import org.spongepowered.api.text.Text; import org.spongepowered.api.text.Text;
@ -89,6 +91,11 @@ public class SpongeCommandSender implements Actor {
sendColorized(msg, TextColors.RED); sendColorized(msg, TextColors.RED);
} }
@Override
public void print(TextComponent component) {
TextAdapter.sendComponent(sender, component);
}
private void sendColorized(String msg, TextColor formatting) { private void sendColorized(String msg, TextColor formatting) {
for (String part : msg.split("\n")) { for (String part : msg.split("\n")) {
sender.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part))); sender.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part)));

View File

@ -36,6 +36,8 @@ import com.sk89q.worldedit.world.gamemode.GameMode;
import com.sk89q.worldedit.world.gamemode.GameModes; import com.sk89q.worldedit.world.gamemode.GameModes;
import com.sk89q.worldedit.world.item.ItemTypes; import com.sk89q.worldedit.world.item.ItemTypes;
import net.kyori.text.TextComponent;
import net.kyori.text.adapter.spongeapi.TextAdapter;
import org.spongepowered.api.Sponge; import org.spongepowered.api.Sponge;
import org.spongepowered.api.data.type.HandTypes; import org.spongepowered.api.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player; import org.spongepowered.api.entity.living.player.Player;
@ -149,6 +151,11 @@ public class SpongePlayer extends AbstractPlayerActor {
sendColorized(msg, TextColors.RED); sendColorized(msg, TextColors.RED);
} }
@Override
public void print(TextComponent component) {
TextAdapter.sendComponent(player, component);
}
private void sendColorized(String msg, TextColor formatting) { private void sendColorized(String msg, TextColor formatting) {
for (String part : msg.split("\n")) { for (String part : msg.split("\n")) {
this.player.sendMessage(Text.of(formatting, TextSerializers.FORMATTING_CODE.deserialize(part))); this.player.sendMessage(Text.of(formatting, TextSerializers.FORMATTING_CODE.deserialize(part)));