join ! by default

This commit is contained in:
okx-code
2024-11-14 01:03:53 +00:00
parent 4efd59249e
commit dc0fcb90f7
5 changed files with 52 additions and 0 deletions

View File

@@ -21,6 +21,7 @@ chat:
range: 800
color: GRAY
globalGroup: '!'
joinGlobalGroupByDefault: true
info:
#debug: lots of debugging logging will show up in the console def=false
debug: false

View File

@@ -7,6 +7,7 @@ import vg.civcraft.mc.civchat2.commands.CivChatCommandManager;
import vg.civcraft.mc.civchat2.database.CivChatDAO;
import vg.civcraft.mc.civchat2.listeners.CivChat2Listener;
import vg.civcraft.mc.civchat2.listeners.KillListener;
import vg.civcraft.mc.civchat2.listeners.NewPlayerListener;
import vg.civcraft.mc.civchat2.utility.CivChat2Config;
import vg.civcraft.mc.civchat2.utility.CivChat2FileLogger;
import vg.civcraft.mc.civchat2.utility.CivChat2Log;
@@ -68,6 +69,9 @@ public class CivChat2 extends ACivMod {
private void registerCivChatEvents() {
getServer().getPluginManager().registerEvents(new CivChat2Listener(chatMan), this);
getServer().getPluginManager().registerEvents(new KillListener(config, databaseManager, settingsManager), this);
if (config.isJoinGlobalGroupByDefault()) {
getServer().getPluginManager().registerEvents(new NewPlayerListener(), this);
}
}
public void registerNameLayerPermissions() {

View File

@@ -0,0 +1,32 @@
package vg.civcraft.mc.civchat2.listeners;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import vg.civcraft.mc.civchat2.CivChat2;
import vg.civcraft.mc.civchat2.CivChat2Manager;
import vg.civcraft.mc.namelayer.GroupManager;
import vg.civcraft.mc.namelayer.group.Group;
public class NewPlayerListener implements Listener {
@EventHandler
public void on(PlayerJoinEvent event) {
Player player = event.getPlayer();
if (player.hasPlayedBefore()) {
return;
}
String globalGroupName = CivChat2.getInstance().getPluginConfig().getGlobalChatGroupName();
if (globalGroupName == null) {
return;
}
Group globalGroup = GroupManager.getGroup(globalGroupName);
if (globalGroup == null) {
return;
}
CivChat2Manager chatMan = CivChat2.getInstance().getCivChat2Manager();
chatMan.addGroupChat(player, globalGroup);
}
}

View File

@@ -82,6 +82,10 @@ public class CivChat2Config {
return config.getString("chat.globalGroup", null);
}
public boolean isJoinGlobalGroupByDefault() {
return config.getBoolean("chat.joinGlobalGroupByDefault", false);
}
public boolean useDynamicRangeColoring() {
return config.getBoolean("chat.dynamicColoring");
}

View File

@@ -11,6 +11,17 @@ chat:
#so yIncreaseScale=10 will be 10 extra radius per block they go up, 1 would be 1 extra radius per block
#Coded formula globalChatRange = globalChatRange + (globalChatRange * ((yIncreaseScale/1000) * #blocksaboveydist)))
yIncreaseScale: 1
killRange: 30000
dynamicColoring: false
colors:
near:
range: 0
color: WHITE
far:
range: 800
color: GRAY
globalGroup: '!'
joinGlobalGroupByDefault: false
info:
#debug: lots of debugging logging will show up in the console def=false
debug: false