mirror of
https://github.com/darksaid98/Carbon.git
synced 2026-12-01 22:15:08 +00:00
Disable relational MiniPlaceholders by default
With MP v2, we would add "non-relational placeholders for sender (principal)" and then "placeholders for viewer (principal), in relation to sender", as was our understanding of how relational placeholders should generally be used in PlaceholderAPI and MiniPlaceholders. With MP v3, we must add both tag resolvers and pass a relational audience to MiniMessage. The issue is that the principal audience for non-relational placeholders then becomes the viewer instead of the sender. Pending any change in how relational MiniPlaceholders work (or how they should be used according to the dev), we will disable them by default to reduce the need for render_for tags to effectively disable this new principal audience swap behavior in formats. If relational support is desired, you will need to deal with the consequences, including how preprocess tags inherently do not play nice with render_for due to how MiniMessage parsing works.
This commit is contained in:
11 files changed
+96
-24
No files matched your search
@@ -123,6 +123,13 @@ public abstract class CarbonChatInternal implements CarbonChat {
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
|
||||
// Load channels
|
||||
this.channelRegistry().loadConfigChannels(this.carbonMessages);
|
||||
|
||||
this.messagingManager.get();
|
||||
}
|
||||
|
||||
protected void initIntegrations() {
|
||||
// Integration
|
||||
final Set<Integration> integrations = this.injector().getInstance(Key.get(new TypeLiteral<>() {}));
|
||||
|
||||
@@ -133,11 +140,6 @@ public abstract class CarbonChatInternal implements CarbonChat {
|
||||
|
||||
integration.register();
|
||||
}
|
||||
|
||||
// Load channels
|
||||
this.channelRegistry().loadConfigChannels(this.carbonMessages);
|
||||
|
||||
this.messagingManager.get();
|
||||
}
|
||||
|
||||
protected final void checkVersion() {
|
||||
|
||||
@@ -22,6 +22,7 @@ package net.draycia.carbon.common;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.multibindings.Multibinder;
|
||||
import net.draycia.carbon.common.integration.Integration;
|
||||
import net.draycia.carbon.common.integration.miniplaceholders.MiniPlaceholdersIntegration;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
|
||||
@@ -44,6 +45,8 @@ public abstract class CarbonPlatformModule extends AbstractModule {
|
||||
final Multibinder<Integration> integrations,
|
||||
final Multibinder<Integration.ConfigMeta> configs
|
||||
) {
|
||||
integrations.addBinding().to(MiniPlaceholdersIntegration.class);
|
||||
configs.addBinding().toInstance(MiniPlaceholdersIntegration.configMeta());
|
||||
}
|
||||
|
||||
}
|
||||
+1
-8
@@ -20,7 +20,6 @@
|
||||
package net.draycia.carbon.common.integration.miniplaceholders;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Injector;
|
||||
import io.github.miniplaceholders.api.Expansion;
|
||||
import java.util.UUID;
|
||||
import net.draycia.carbon.api.channels.ChannelRegistry;
|
||||
@@ -51,13 +50,7 @@ public final class MiniPlaceholdersExpansion {
|
||||
this.channels = channels;
|
||||
}
|
||||
|
||||
public static void register(final Injector injector) {
|
||||
if (MiniPlaceholdersUtil.miniPlaceholdersLoaded()) {
|
||||
injector.getInstance(MiniPlaceholdersExpansion.class).registerExpansion();
|
||||
}
|
||||
}
|
||||
|
||||
private void registerExpansion() {
|
||||
public void registerExpansion() {
|
||||
final Expansion expansion = Expansion.builder("carbonchat")
|
||||
.audiencePlaceholder("party", (audience, queue, ctx) -> {
|
||||
if (!hasId(audience)) {
|
||||
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
/*
|
||||
* CarbonChat
|
||||
*
|
||||
* Copyright (c) 2024 Josua Parks (Vicarious)
|
||||
* Contributors
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
package net.draycia.carbon.common.integration.miniplaceholders;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
import net.draycia.carbon.common.config.ConfigManager;
|
||||
import net.draycia.carbon.common.integration.Integration;
|
||||
import org.checkerframework.checker.nullness.qual.NonNull;
|
||||
import org.checkerframework.framework.qual.DefaultQualifier;
|
||||
import org.spongepowered.configurate.objectmapping.ConfigSerializable;
|
||||
import org.spongepowered.configurate.objectmapping.meta.Comment;
|
||||
|
||||
@DefaultQualifier(NonNull.class)
|
||||
public final class MiniPlaceholdersIntegration implements Integration {
|
||||
|
||||
private final Provider<MiniPlaceholdersExpansion> expansionProvider;
|
||||
private final Config config;
|
||||
|
||||
@Inject
|
||||
private MiniPlaceholdersIntegration(
|
||||
final ConfigManager configManager,
|
||||
final Provider<MiniPlaceholdersExpansion> expansionProvider
|
||||
) {
|
||||
this.expansionProvider = expansionProvider;
|
||||
this.config = this.config(configManager, configMeta());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean eligible() {
|
||||
return MiniPlaceholdersUtil.miniPlaceholdersLoaded();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void register() {
|
||||
this.expansionProvider.get().registerExpansion();
|
||||
}
|
||||
|
||||
public static ConfigMeta configMeta() {
|
||||
return Integration.configMeta("miniplaceholders", MiniPlaceholdersIntegration.Config.class);
|
||||
}
|
||||
|
||||
@ConfigSerializable
|
||||
public static final class Config {
|
||||
@Comment("Enabling relational placeholders may require reworking your format configs due to the way MiniPlaceholders v3 works.")
|
||||
public boolean relationalPlaceholders = false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user