Skip to content

Commit

Permalink
chore: rename more things to PaperTweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Machine-Maker committed Jun 12, 2023
1 parent b312762 commit aa1f95a
Show file tree
Hide file tree
Showing 27 changed files with 44 additions and 42 deletions.
2 changes: 1 addition & 1 deletion src/main/java/me/machinemaker/papertweaks/RootCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public RootCommand(final ModuleManager moduleManager, @Named("modules") final Co
}

public void registerCommands() {
this.builder = this.manager.commandBuilder("vanillatweaks", RichDescription.translatable("commands.root"), "vt", "vtweaks");
this.builder = this.manager.commandBuilder("vanillatweaks", RichDescription.translatable("commands.root"), "vt", "vtweaks", "pt", "papertweaks", "ptweaks");

this.manager.command(this.simple("reload")
.handler(this.sync(this::reloadEverything))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@

public final class TranslationRegistry {

private static final Key LANG_KEY = Key.key("vanillatweaks", "lang");
private static final Key LANG_KEY = Key.key("papertweaks", "lang");
private static final Map<String, Translation> TRANSLATIONS = Maps.newConcurrentMap();
private static final net.kyori.adventure.translation.TranslationRegistry ADVENTURE_REGISTRY = net.kyori.adventure.translation.TranslationRegistry.create(LANG_KEY);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

public final class MetaKeys {

public static final CommandMeta.Key<GameMode> GAMEMODE_KEY = CommandMeta.Key.of(GameMode.class, "vanillatweaks:gamemode");
public static final CommandMeta.Key<GameMode> GAMEMODE_KEY = CommandMeta.Key.of(GameMode.class, "papertweaks:gamemode");

private MetaKeys() {
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/
public interface CommandCooldown<C> {

CommandMeta.Key<CommandCooldown<?>> COMMAND_META_KEY = CommandMeta.Key.of(new TypeToken<>() {}, "vanillatweaks:command_cooldown");
CommandMeta.Key<CommandCooldown<?>> COMMAND_META_KEY = CommandMeta.Key.of(new TypeToken<>() {}, "papertweaks:command_cooldown");

/**
* Apply this {@link CommandCooldown} to a {@link Command.Builder} instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

public final class SimpleSuggestionProcessor implements CommandSuggestionProcessor<CommandDispatcher> {

public static final CloudKey<Boolean> IGNORE_CASE = SimpleCloudKey.of("vanillatweaks:suggestions/ignore_case", TypeToken.get(Boolean.class));
public static final CloudKey<Boolean> IGNORE_CASE = SimpleCloudKey.of("papertweaks:suggestions/ignore_case", TypeToken.get(Boolean.class));

@Override
public List<String> apply(final CommandPreprocessingContext<CommandDispatcher> context, final List<String> strings) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@

public abstract class ModuleCommand extends VanillaTweaksCommand {

private static final CommandMeta.Key<ModuleBase> MODULE_OWNER = CommandMeta.Key.of(ModuleBase.class, "vanillatweaks:commands/module_owner");
private static final CommandMeta.Key<ModuleBase> MODULE_OWNER = CommandMeta.Key.of(ModuleBase.class, "papertweaks:commands/module_owner");
private static final MinecraftHelp.HelpColors MODULE_HELP_COLORS = MinecraftHelp.HelpColors.of(
TextColor.color(0x70B3B3),
NamedTextColor.AQUA,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@ModuleInfo(name = "Elevators", configPath = "experimental.elevators", description = "Create vertical elevators on wool blocks by throwing an enderpearl on the wool block")
public class Elevators extends ModuleBase {

static final PDCKey<Boolean> IS_ELEVATOR = PDCKey.bool(Keys.key("is_elevator"));
static final PDCKey<Boolean> IS_ELEVATOR = PDCKey.bool(Keys.legacyKey("is_elevator"));

@Override
protected Class<? extends ModuleLifecycle> lifecycle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
@ModuleInfo(name = "XPManagement", configPath = "experimental.xp-management", description = "Store XP in bottles, smelt in furnace to retrieve XP")
public class XPManagement extends ModuleBase {

private static final NamespacedKey XP_RECIPE_KEY = Keys.key("xp_management_recipe");
private static final NamespacedKey XP_RECIPE_KEY = Keys.legacyKey("xp_management_recipe");
private static final FurnaceRecipe XP_RECIPE = new FurnaceRecipe(XP_RECIPE_KEY, new ItemStack(Material.GLASS_BOTTLE), Material.EXPERIENCE_BOTTLE, 12, 1);

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
public class Tag extends ModuleBase {

static final ItemStack TAG_ITEM = new ItemStack(Material.NAME_TAG);
static final PDCKey<Boolean> IT = PDCKey.bool(Keys.key("tag"));
static final PDCKey<Long> COOLDOWN = PDCKey.forLong(Keys.key("cooldown"));
static final PDCKey<Boolean> IT = PDCKey.bool(Keys.legacyKey("tag"));
static final PDCKey<Long> COOLDOWN = PDCKey.forLong(Keys.legacyKey("cooldown"));

static {
final ItemMeta meta = TAG_ITEM.getItemMeta();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@ModuleInfo(name = "ThunderShrine", configPath = "hermitcraft.thunder-shrine", description = "Create a shrine to summon thunderstorms")
public class ThunderShrine extends ModuleBase {

static final PDCKey<UUID> SHRINE = PDCKey.uuid(Keys.key("shrine"));
static final PDCKey<UUID> SHRINE = PDCKey.uuid(Keys.legacyKey("shrine"));

@Override
protected Class<? extends ModuleLifecycle> lifecycle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@

class ItemDropRunnable extends BukkitRunnable {

static final PDCKey<ItemStack> ELYTRA_ITEM = PDCKey.itemStack(Keys.key("ae.elytra_item"));
static final PDCKey<ItemStack> CHESTPLATE_ITEM = PDCKey.itemStack(Keys.key("ae.chestplate_item"));
static final PDCKey<ItemStack> ELYTRA_ITEM = PDCKey.itemStack(Keys.legacyKey("ae.elytra_item"));
static final PDCKey<ItemStack> CHESTPLATE_ITEM = PDCKey.itemStack(Keys.legacyKey("ae.chestplate_item"));

private final Item item;
private final LookingFor lookingFor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

class ItemListener implements ModuleListener {

static final PDCKey<Boolean> IS_ARMORED_ELYTRA = PDCKey.bool(Keys.key("ae.is_armored_elytra"));
static final PDCKey<Boolean> IS_ARMORED_ELYTRA = PDCKey.bool(Keys.legacyKey("ae.is_armored_elytra"));

private final Plugin plugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class Lifecycle extends ModuleLifecycle {
static final byte[] RESOURCE_PACK_HASH = new BigInteger("1ACF79C491B3CB9EEE50816AD0CC1FC45AABA147", 16).toByteArray();

static final ItemStack WRENCH = new ItemStack(Material.CARROT_ON_A_STICK, 1);
static final NamespacedKey WRENCH_RECIPE_KEY = Keys.key("redstone_wrench");
static final NamespacedKey WRENCH_RECIPE_KEY = Keys.legacyKey("redstone_wrench");
static final ShapedRecipe WRENCH_RECIPE = new ShapedRecipe(WRENCH_RECIPE_KEY, WRENCH)
.shape(
" # ",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@

class BlockListener implements ModuleListener {

private static final PDCKey<Component> HEAD_NAME = new PDCKey<>(Keys.key("head_name"), PaperDataTypes.COMPONENT);
private static final PDCKey<List<Component>> HEAD_LORE = new PDCKey<>(Keys.key("head_lore"), PaperDataTypes.COMPONENT_LIST);
private static final PDCKey<Component> HEAD_NAME = new PDCKey<>(Keys.legacyKey("head_name"), PaperDataTypes.COMPONENT);
private static final PDCKey<List<Component>> HEAD_LORE = new PDCKey<>(Keys.legacyKey("head_lore"), PaperDataTypes.COMPONENT_LIST);

private final Plugin plugin;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
@ModuleInfo(name = "AFKDisplay", configPath = "survival.afk-display", description = "Tracks player AFK status")
public class AFKDisplay extends ModuleBase {

public static final PDCKey<Boolean> AFK_DISPLAY = PDCKey.bool(Keys.key("afk"));
public static final PDCKey<Boolean> AFK_DISPLAY = PDCKey.bool(Keys.legacyKey("afk"));

@Override
protected Class<? extends ModuleLifecycle> lifecycle() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import me.machinemaker.papertweaks.pdc.PDCKey;
import me.machinemaker.papertweaks.utils.Keys;
import me.machinemaker.papertweaks.utils.runnables.TimerRunnable;
import net.kyori.adventure.audience.Audience;
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.TextComponent;
import net.kyori.adventure.text.format.NamedTextColor;
Expand All @@ -42,7 +41,7 @@
@Singleton
class HUDRunnable extends TimerRunnable {

private static final PDCKey<Boolean> COORDINATES_HUD_KEY = PDCKey.bool(Keys.key("coordinateshud"));
private static final PDCKey<Boolean> COORDINATES_HUD_KEY = PDCKey.bool(Keys.legacyKey("coordinateshud"));

private final Set<UUID> enabled = ConcurrentHashMap.newKeySet();
private final Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import me.machinemaker.papertweaks.modules.ModuleListener;
import me.machinemaker.papertweaks.utils.CachedHashObjectWrapper;
import me.machinemaker.papertweaks.utils.Keys;
import net.kyori.adventure.audience.Audience;
import org.apache.commons.lang3.mutable.MutableInt;
import org.bukkit.Bukkit;
import org.bukkit.Location;
Expand Down Expand Up @@ -73,18 +72,18 @@

class PlayerListener implements ModuleListener {

static final NamespacedKey GRAVE_KEY = Keys.key("graves.grave_key");
static final NamespacedKey GRAVE_KEY = Keys.legacyKey("graves.grave_key");

static final NamespacedKey LAST_GRAVE_LOCATION = Keys.key("graves.last_grave_location");
static final NamespacedKey LAST_GRAVE_LOCATION = Keys.legacyKey("graves.last_grave_location");

private static final NamespacedKey PROTECTED = Keys.key("protected");
private static final NamespacedKey TIMESTAMP = Keys.key("timestamp");
private static final NamespacedKey PLAYER_UUID = Keys.key("player_uuid");
private static final NamespacedKey PLAYER_ALL_CONTENTS = Keys.key("player_all_contents");
private static final NamespacedKey PLAYER_EXPERIENCE = Keys.key("graves.player_experience");
private static final @Deprecated NamespacedKey PLAYER_INV_CONTENTS = Keys.key("player_inventory_contents");
private static final @Deprecated NamespacedKey PLAYER_ARM_CONTENTS = Keys.key("player_armor_contents");
private static final @Deprecated NamespacedKey PLAYER_EXTRA_CONTENTS = Keys.key("player_extra_contents");
private static final NamespacedKey PROTECTED = Keys.legacyKey("protected");
private static final NamespacedKey TIMESTAMP = Keys.legacyKey("timestamp");
private static final NamespacedKey PLAYER_UUID = Keys.legacyKey("player_uuid");
private static final NamespacedKey PLAYER_ALL_CONTENTS = Keys.legacyKey("player_all_contents");
private static final NamespacedKey PLAYER_EXPERIENCE = Keys.legacyKey("graves.player_experience");
private static final @Deprecated NamespacedKey PLAYER_INV_CONTENTS = Keys.legacyKey("player_inventory_contents");
private static final @Deprecated NamespacedKey PLAYER_ARM_CONTENTS = Keys.legacyKey("player_armor_contents");
private static final @Deprecated NamespacedKey PLAYER_EXTRA_CONTENTS = Keys.legacyKey("player_extra_contents");

private final JavaPlugin plugin;
private final Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@ModuleInfo(name = "Back", configPath = "teleportation.back", description = "Adds a /back command to teleport back to previous locations")
public class Back extends ModuleBase {

static final PDCKey<Location> BACK_LOCATION = new PDCKey<>(Keys.key("back/location"), DataTypes.LOCATION);
static final PDCKey<Location> BACK_LOCATION = new PDCKey<>(Keys.legacyKey("back/location"), DataTypes.LOCATION);

@Override
protected void configure() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
@ModuleCommand.Info(value = "back", i18n = "back", perm = "back", infoOnRoot = false)
class Commands extends ConfiguredModuleCommand {

static final CloudKey<Void> BACK_COMMAND_COOLDOWN_KEY = SimpleCloudKey.of("vanillatweaks:back_cmd_cooldown");
static final CloudKey<Void> BACK_COMMAND_COOLDOWN_KEY = SimpleCloudKey.of("papertweaks:back_cmd_cooldown");

private final Config config;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
@ModuleCommand.Info(value = "homes", i18n = "homes", perm = "homes")
class Commands extends ConfiguredModuleCommand {

static final CloudKey<Void> HOME_COMMAND_COOLDOWN_KEY = SimpleCloudKey.of("vanillatweaks:home_cmd_cooldown");
static final CloudKey<Void> HOME_COMMAND_COOLDOWN_KEY = SimpleCloudKey.of("papertweaks:home_cmd_cooldown");

private final HomesDAO homesDAO;
private final Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class Commands extends ModuleCommand {
private static final CommandArgument<CommandDispatcher, World> WORLD_ARG = WorldArgument.of("world");

static final Map<UUID, BukkitTask> AWAITING_TELEPORT = Maps.newHashMap();
static final CloudKey<Void> SPAWN_CMD_COOLDOWN_KEY = SimpleCloudKey.of("vanillatweaks:spawn_cmd_cooldown");
static final CloudKey<Void> SPAWN_CMD_COOLDOWN_KEY = SimpleCloudKey.of("papertweaks:spawn_cmd_cooldown");

private final JavaPlugin plugin;
private final Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
@ModuleCommand.Info(value = "tpa", i18n = "tpa", perm = "tpa")
class Commands extends ConfiguredModuleCommand {

static final CloudKey<Void> TPA_REQUEST_COOLDOWN_KEY = SimpleCloudKey.of("vanillatweaks:tpa_request_cmd_cooldown");
static final CloudKey<Void> TPA_REQUEST_COOLDOWN_KEY = SimpleCloudKey.of("papertweaks:tpa_request_cmd_cooldown");

private final TPAManager tpaManager;
private final Config config;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
@ModuleCommand.Info(value = "spawningspheres", aliases = {"spawnsphere", "ss"}, i18n = "spawning-spheres", perm = "spawningspheres")
class Commands extends ConfiguredModuleCommand {

private static final PDCKey<Color> COLOR_KEY = PDCKey.enums(Keys.key("color"), Color.class);
private static final PDCKey<Color> COLOR_KEY = PDCKey.enums(Keys.legacyKey("color"), Color.class);
private static final double PHI = Math.PI * (3.0 - Math.sqrt(5.0));

private static final DespawnDistances DESPAWN_DISTANCES = Services.service(DespawnDistances.Provider.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
public record SettingKey<T>(NamespacedKey key) {

public SettingKey(final String key) {
this(Keys.key(key));
this(Keys.legacyKey(key));
}
}
2 changes: 1 addition & 1 deletion src/main/java/me/machinemaker/papertweaks/tags/Tags.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,6 @@ private Tags() {
.endsWith("_CHESTPLATE").verify(6).build();

private static MaterialTag.Builder material(String name) {
return MaterialTag.builder(Keys.key(name));
return MaterialTag.builder(Keys.legacyKey(name));
}
}
7 changes: 6 additions & 1 deletion src/main/java/me/machinemaker/papertweaks/utils/Keys.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,16 @@

public final class Keys {

private static final String NAMESPACE = "vanillatweaks";
private static final String LEGACY_NAMESPACE = "vanillatweaks";
private static final String NAMESPACE = "papertweaks";

private Keys() {
}

public static NamespacedKey legacyKey(final String string) {
return new NamespacedKey(LEGACY_NAMESPACE, string);
}

public static NamespacedKey key(final String string) {
return new NamespacedKey(NAMESPACE, string);
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/paper-plugin.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
name: VanillaTweaks
name: PaperTweaks
version: ${version}
main: me.machinemaker.papertweaks.PaperTweaks
api-version: "1.20"
authors:
- Machine_Maker
description: A replacement for the VanillaTweaks datapack
prefix: PaperTweaks

dependencies:
server:
Expand Down

0 comments on commit aa1f95a

Please sign in to comment.