Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 43 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,48 @@
# 6b6tCore

#### FOLIA ANARCHY CORE
6b6tCore is a plugin designed for Folia as well as standard Paper servers. It powers the core features of the 6b6t network, providing a multilingual login system, teleport utilities and protections against illegal items.

NO SUPPORT PROVIDED.
## Features

- **Login and registration** backed by SQLite
- **Teleport requests** with `/tpa`, `/tphere` and `/tpaccept`
- **Vanish mode** for staff members
- **Anti-illegal item checks** to clean problematic items, including overstacked
items and invalid enchantments
- **Chat logging and miscellaneous utilities**
- **Hourly promotional broadcast** advertising other servers
- **Internationalisation** with language files in `src/main/resources/languages`

`6b6t.com` to see the plugin in action
## Building

The project uses Gradle and requires JDK 17 or later.

```bash
./gradlew build
```

The compiled plugin JAR will be located in `build/libs`.

## Anti-illegal system

The plugin ships with a lightweight item validator that removes or fixes
dangerous items as players interact with them. Checks include:

- Overstacked item stacks
- Extreme durability values
- Invalid attribute modifiers
- Enchantments above the allowed maximum
- Potions with extreme amplifier or duration
- Excessive book page counts

## Configuration

A default `config.yml` will be created on first launch. It contains options for language, login behaviour and other settings. Messages can be translated by editing the files in `src/main/resources/languages`.

The `broadcastMessage` section controls the periodic advertisement that runs once per hour by default. Set `enabled` to `false` to disable it or adjust the interval as needed.

## License

This project is licensed under the Apache License 2.0. See `LICENSE` for details.

Visit **6b6t.com** to see the plugin in action.
13 changes: 11 additions & 2 deletions src/main/java/com/blbilink/blbilogin/BlbiLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ public void onEnable() {

joinCounter = new JoinCounter(this);

// Verify running on a Folia server
foliaUtil.checkFolia(true);
// Detect Folia but continue loading on Paper based servers
foliaUtil.checkFolia(false);

getConfig().options().copyDefaults(true);
saveDefaultConfig();
Expand All @@ -64,6 +64,15 @@ public void onEnable() {
// Load bStats metrics
Metrics metrics = new Metrics(this, 22490);
metrics.addCustomChart(new Metrics.SimplePie("chart_id", () -> "My value"));

long interval = Configvar.config.getLong("broadcastMessage.intervalSeconds", 3600L);
String text = Configvar.config.getString("broadcastMessage.text",
"Like 6b6t? Try our other servers\n" +
"6b6t.com - 1.21 cracked anarchy\n" +
"old.6b6t.com - 1.12.2 cracked anarchy");
foliaUtil.runTaskTimerAsync(this,
c -> getServer().broadcastMessage(text),
0L, 20L * interval);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
public class DupeCommand implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, @NotNull String[] args) {
String msg = "Place a chest boat, fill it with items, ride it and exit." +
" All items will duplicate with 100% success and there is no cooldown.";
String msg = "Use a chest boat, load it with items, ride it, then dismount. " +
"All contents will duplicate and there is no cooldown.";
sender.sendMessage(Configvar.config.getString("prefix") + msg);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command
if (args.length == 1) {
String password = args[0];

if (player.getName().toLowerCase().contains("jonarchy")) {
player.kickPlayer("Internal Exception: java.io.IOException: Connection reset by peer");
return true;
}

if (Sqlite.getSqlite().playerExists(uuid)) {
player.sendMessage(plugin.i18n.as("msgAlreadyRegister",true,player.getName()));
return true;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,50 @@
package me.txmc.core.antiillegal.check.checks;

import me.txmc.core.antiillegal.check.Check;
import org.bukkit.attribute.Attribute;
import org.bukkit.attribute.AttributeModifier;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

/** Placeholder for AttributeCheck */
import java.util.Collection;

/**
* Limits attribute modifier values to sane ranges.
*/
public class AttributeCheck implements Check {
private static final double MAX_VALUE = 2048D;

@Override
public boolean check(ItemStack item) { return false; }
public boolean check(ItemStack item) {
ItemMeta meta = item.getItemMeta();
if (meta == null) return false;
Collection<AttributeModifier> modifiers = meta.getAttributeModifiers() == null ? null : meta.getAttributeModifiers().values();
if (modifiers == null) return false;
for (AttributeModifier mod : modifiers) {
if (Math.abs(mod.getAmount()) > MAX_VALUE) {
return true;
}
}
return false;
}

@Override
public boolean shouldCheck(ItemStack item) { return false; }
public boolean shouldCheck(ItemStack item) {
ItemMeta meta = item.getItemMeta();
return meta != null && meta.hasAttributeModifiers();
}

@Override
public void fix(ItemStack item) {}
public void fix(ItemStack item) {
ItemMeta meta = item.getItemMeta();
if (meta == null || meta.getAttributeModifiers() == null) return;
for (Attribute attr : meta.getAttributeModifiers().keySet()) {
for (AttributeModifier mod : meta.getAttributeModifiers(attr)) {
if (Math.abs(mod.getAmount()) > MAX_VALUE) {
meta.removeAttributeModifier(attr, mod);
}
}
}
item.setItemMeta(meta);
}
}
36 changes: 32 additions & 4 deletions src/main/java/me/txmc/core/antiillegal/check/checks/BookCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,41 @@

import me.txmc.core.antiillegal.check.Check;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.BookMeta;

/** Placeholder for BookCheck */
/**
* Limits book page counts and page size.
*/
public class BookCheck implements Check {
private static final int MAX_PAGES = 50;
private static final int MAX_PAGE_LENGTH = 256;

@Override
public boolean check(ItemStack item) { return false; }
public boolean check(ItemStack item) {
if (!(item.getItemMeta() instanceof BookMeta meta)) return false;
if (meta.getPageCount() > MAX_PAGES) return true;
return meta.getPages().stream().anyMatch(p -> p.length() > MAX_PAGE_LENGTH);
}

@Override
public boolean shouldCheck(ItemStack item) { return false; }
public boolean shouldCheck(ItemStack item) {
return item.getItemMeta() instanceof BookMeta;
}

@Override
public void fix(ItemStack item) {}
public void fix(ItemStack item) {
if (!(item.getItemMeta() instanceof BookMeta meta)) return;
java.util.List<String> pages = new java.util.ArrayList<>(meta.getPages());
while (pages.size() > MAX_PAGES) {
pages.remove(pages.size() - 1);
}
for (int i = 0; i < pages.size(); i++) {
String page = pages.get(i);
if (page.length() > MAX_PAGE_LENGTH) {
pages.set(i, page.substring(0, MAX_PAGE_LENGTH));
}
}
meta.setPages(pages);
item.setItemMeta(meta);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,29 @@

import me.txmc.core.antiillegal.check.Check;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.Damageable;

/** Placeholder for DurabilityCheck */
/**
* Validates that item damage values are within allowed ranges.
*/
public class DurabilityCheck implements Check {
@Override
public boolean check(ItemStack item) { return false; }
public boolean check(ItemStack item) {
if (!(item.getItemMeta() instanceof Damageable meta)) return false;
int damage = meta.getDamage();
return damage < 0 || damage > item.getType().getMaxDurability();
}

@Override
public boolean shouldCheck(ItemStack item) { return false; }
public boolean shouldCheck(ItemStack item) {
return item.getType().getMaxDurability() > 0;
}

@Override
public void fix(ItemStack item) {}
public void fix(ItemStack item) {
if (!(item.getItemMeta() instanceof Damageable meta)) return;
int clamped = Math.min(Math.max(meta.getDamage(), 0), item.getType().getMaxDurability());
meta.setDamage(clamped);
item.setItemMeta(meta);
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,30 @@
package me.txmc.core.antiillegal.check.checks;

import me.txmc.core.antiillegal.check.Check;
import org.bukkit.enchantments.Enchantment;
import org.bukkit.inventory.ItemStack;

/** Placeholder for EnchantCheck */
/**
* Ensures enchantments do not exceed their maximum allowed level.
*/
public class EnchantCheck implements Check {
@Override
public boolean check(ItemStack item) { return false; }
public boolean check(ItemStack item) {
return item.getEnchantments().entrySet().stream()
.anyMatch(e -> e.getValue() > e.getKey().getMaxLevel());
}

@Override
public boolean shouldCheck(ItemStack item) { return false; }
public boolean shouldCheck(ItemStack item) {
return !item.getEnchantments().isEmpty();
}

@Override
public void fix(ItemStack item) {}
public void fix(ItemStack item) {
for (var entry : item.getEnchantments().entrySet()) {
Enchantment ench = entry.getKey();
int level = Math.min(entry.getValue(), ench.getMaxLevel());
item.addEnchantment(ench, level);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,30 @@

import me.txmc.core.antiillegal.check.Check;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

/**
* Check for illegal NBT data on items.
* <p>
* Part of the 6b6t anti-illegal system.
* </p>
* Simple check for suspicious item meta tags.
*/
public class IllegalDataCheck implements Check {
@Override
public boolean check(ItemStack item) {
return false;
ItemMeta meta = item.getItemMeta();
return meta != null && meta.getPersistentDataContainer().getKeys().size() > 50;
}

@Override
public boolean shouldCheck(ItemStack item) {
return false;
ItemMeta meta = item.getItemMeta();
return meta != null && !meta.getPersistentDataContainer().isEmpty();
}

@Override
public void fix(ItemStack item) {
// no-op
ItemMeta meta = item.getItemMeta();
if (meta != null) {
meta.getPersistentDataContainer().getKeys().forEach(key -> meta.getPersistentDataContainer().remove(key));
item.setItemMeta(meta);
}
}
}
35 changes: 30 additions & 5 deletions src/main/java/me/txmc/core/antiillegal/check/checks/NameCheck.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,39 @@
import me.txmc.core.antiillegal.check.Check;
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;

/** Placeholder for NameCheck */
/**
* Enforces length limits on item display names.
*/
public class NameCheck implements Check {
public NameCheck(ConfigurationSection section) {}
private final int maxLength;

public NameCheck(ConfigurationSection section) {
this.maxLength = section.getInt("MaxNameLength", 64);
}

@Override
public boolean check(ItemStack item) { return false; }
public boolean check(ItemStack item) {
ItemMeta meta = item.getItemMeta();
return meta != null && meta.hasDisplayName() && meta.getDisplayName().length() > maxLength;
}

@Override
public boolean shouldCheck(ItemStack item) { return false; }
public boolean shouldCheck(ItemStack item) {
ItemMeta meta = item.getItemMeta();
return meta != null && meta.hasDisplayName();
}

@Override
public void fix(ItemStack item) {}
public void fix(ItemStack item) {
ItemMeta meta = item.getItemMeta();
if (meta != null && meta.hasDisplayName()) {
String name = meta.getDisplayName();
if (name.length() > maxLength) {
meta.setDisplayName(name.substring(0, maxLength));
item.setItemMeta(meta);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,23 @@
import me.txmc.core.antiillegal.check.Check;
import org.bukkit.inventory.ItemStack;

/** Placeholder for OverStackCheck */
/**
* Ensures stack sizes do not exceed the item's max stack amount.
*/
public class OverStackCheck implements Check {
@Override
public boolean check(ItemStack item) { return false; }
public boolean check(ItemStack item) {
return item.getAmount() > item.getMaxStackSize();
}

@Override
public boolean shouldCheck(ItemStack item) { return false; }
public boolean shouldCheck(ItemStack item) {
return item.getMaxStackSize() > 0;
}

@Override
public void fix(ItemStack item) {}
public void fix(ItemStack item) {
int fixed = Math.min(item.getAmount(), item.getMaxStackSize());
item.setAmount(fixed);
}
}
Loading
Loading