Skip to content

Commit

Permalink
Shade in Kashike's lib
Browse files Browse the repository at this point in the history
  • Loading branch information
me4502 committed Apr 19, 2019
1 parent 3e4004a commit 5534834
Show file tree
Hide file tree
Showing 13 changed files with 44 additions and 17 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Expand Up @@ -142,6 +142,9 @@ subprojects {
include(dependency('com.sk89q:jchronic:0.2.4a'))
include(dependency('com.thoughtworks.paranamer:paranamer:2.6'))
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 '.cache'
Expand Down
1 change: 1 addition & 0 deletions config/checkstyle/import-control.xml
Expand Up @@ -16,6 +16,7 @@
<allow pkg="net.royawesome.jlibnoise"/>
<allow pkg="org.json.simple" />
<allow pkg="org.slf4j"/>
<allow pkg="net.kyori.text"/>

<subpackage name="util.yaml">
<allow pkg="org.yaml.snakeyaml"/>
Expand Down
1 change: 1 addition & 0 deletions worldedit-bukkit/build.gradle
Expand Up @@ -15,6 +15,7 @@ dependencies {
compile 'org.bstats:bstats-bukkit:1.4'
compile "io.papermc:paperlib:1.0.1"
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'
}

Expand Down
Expand Up @@ -26,7 +26,8 @@
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey;
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.entity.Player;

Expand Down Expand Up @@ -93,9 +94,8 @@ public void printError(String msg) {
}

@Override
public void print(Fragment fragment) {
// TODO Bukkit is bad and the API is somewhat lacking
printRaw(fragment.toString());
public void print(TextComponent component) {
TextAdapter.sendComponent(sender, component);
}

@Override
Expand Down
Expand Up @@ -31,14 +31,14 @@
import com.sk89q.worldedit.math.Vector3;
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.formatting.Fragment;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.block.BlockTypes;
import com.sk89q.worldedit.world.gamemode.GameMode;
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.Location;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -127,9 +127,8 @@ public void printError(String msg) {
}

@Override
public void print(Fragment fragment) {
// TODO Bukkit is bad and the API is somewhat lacking
printRaw(fragment.toString());
public void print(TextComponent component) {
TextAdapter.sendComponent(player, component);
}

@Override
Expand Down
3 changes: 2 additions & 1 deletion worldedit-core/build.gradle
Expand Up @@ -13,6 +13,7 @@ dependencies {
compile 'com.sk89q.lib:jlibnoise:1.0.0'
compile 'com.googlecode.json-simple:json-simple:1.1.1'
compile 'org.slf4j:slf4j-api:1.7.26'
compile 'net.kyori:text-api:2.0.0'
//compile 'net.sf.trove4j:trove4j:3.0.3'
testCompile 'org.mockito:mockito-core:1.9.0-rc1'
}
Expand All @@ -29,4 +30,4 @@ sourceSets {
}
}

build.dependsOn(shadowJar)
build.dependsOn(shadowJar { classifier = null })
Expand Up @@ -23,7 +23,7 @@
import com.sk89q.worldedit.session.SessionOwner;
import com.sk89q.worldedit.util.Identifiable;
import com.sk89q.worldedit.util.auth.Subject;
import com.sk89q.worldedit.util.formatting.Fragment;
import net.kyori.text.TextComponent;

import java.io.File;

Expand Down Expand Up @@ -77,11 +77,11 @@ default String getDisplayName() {
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.
Expand Down
Expand Up @@ -31,10 +31,10 @@
import com.sk89q.worldedit.session.SessionKey;
import com.sk89q.worldedit.util.HandSide;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.util.formatting.Fragment;
import com.sk89q.worldedit.world.World;
import com.sk89q.worldedit.world.block.BlockStateHolder;
import com.sk89q.worldedit.world.gamemode.GameMode;
import net.kyori.text.TextComponent;

import java.util.UUID;

Expand Down Expand Up @@ -134,8 +134,8 @@ public void printError(String msg) {
}

@Override
public void print(Fragment fragment) {
basePlayer.print(fragment);
public void print(TextComponent component) {
basePlayer.print(component);
}

@Override
Expand Down
1 change: 1 addition & 0 deletions worldedit-forge/build.gradle
Expand Up @@ -19,6 +19,7 @@ def forgeVersion = "25.0.76"
dependencies {
compile project(':worldedit-core')
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}"

Expand Down
Expand Up @@ -34,6 +34,7 @@
import com.sk89q.worldedit.world.block.BaseBlock;
import com.sk89q.worldedit.world.block.BlockStateHolder;

import net.kyori.text.TextComponent;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
Expand Down Expand Up @@ -141,6 +142,11 @@ public void printError(String msg) {
sendColorized(msg, TextFormatting.RED);
}

@Override
public void print(TextComponent component) {
// TODO
}

private void sendColorized(String msg, TextFormatting formatting) {
for (String part : msg.split("\n")) {
TextComponentString component = new TextComponentString(part);
Expand Down
1 change: 1 addition & 0 deletions worldedit-sponge/build.gradle
Expand Up @@ -19,6 +19,7 @@ dependencies {
compile project(':worldedit-core')
compile 'org.spongepowered:spongeapi:7.1.0'
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'
}

Expand Down
Expand Up @@ -26,6 +26,8 @@
import com.sk89q.worldedit.internal.cui.CUIEvent;
import com.sk89q.worldedit.session.SessionKey;
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.entity.living.player.Player;
import org.spongepowered.api.text.Text;
Expand Down Expand Up @@ -89,6 +91,11 @@ public void printError(String msg) {
sendColorized(msg, TextColors.RED);
}

@Override
public void print(TextComponent component) {
TextAdapter.sendComponent(sender, component);
}

private void sendColorized(String msg, TextColor formatting) {
for (String part : msg.split("\n")) {
sender.sendMessage(Text.of(formatting, TextSerializers.LEGACY_FORMATTING_CODE.deserialize(part)));
Expand Down
Expand Up @@ -36,6 +36,8 @@
import com.sk89q.worldedit.world.gamemode.GameModes;
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.data.type.HandTypes;
import org.spongepowered.api.entity.living.player.Player;
Expand Down Expand Up @@ -149,6 +151,11 @@ public void printError(String msg) {
sendColorized(msg, TextColors.RED);
}

@Override
public void print(TextComponent component) {
TextAdapter.sendComponent(player, component);
}

private void sendColorized(String msg, TextColor formatting) {
for (String part : msg.split("\n")) {
this.player.sendMessage(Text.of(formatting, TextSerializers.FORMATTING_CODE.deserialize(part)));
Expand Down

0 comments on commit 5534834

Please sign in to comment.