mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 12:36:41 +00:00
Compare commits
37 Commits
2022.06-RC
...
dependabot
Author | SHA1 | Date | |
---|---|---|---|
3548daa3e5 | |||
8317b1f881 | |||
fc796bd340 | |||
706e9540ce | |||
ac00d36dc6 | |||
a2133369d2 | |||
48728c9524 | |||
d343bbc3d7 | |||
2c357d1d49 | |||
5246639608 | |||
7fb4a477dc | |||
612499ff0a | |||
edb3dbfdbe | |||
a332ecfbea | |||
7f78549f9d | |||
fd6f8a2d17 | |||
21c84d76d3 | |||
88f53c05b9 | |||
51cc527697 | |||
ae5038ef0f | |||
ec5aa0304e | |||
ebafc1c669 | |||
9f8dafb075 | |||
1eaaf5fcdb | |||
42458084d7 | |||
0cd2886e40 | |||
575568cb05 | |||
02b2810488 | |||
7e110e8ac6 | |||
6d3f365878 | |||
05bb64ce85 | |||
b05238c51f | |||
7bda4beab0 | |||
97544977b0 | |||
073356be49 | |||
c472c5d5ce | |||
cb401577a4 |
2
.github/workflows/codeql-analysis.yml
vendored
2
.github/workflows/codeql-analysis.yml
vendored
@ -38,7 +38,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
- name: Setup Java JDK
|
- name: Setup Java JDK
|
||||||
uses: actions/setup-java@v3.3.0
|
uses: actions/setup-java@v3.6.0
|
||||||
with:
|
with:
|
||||||
# The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
|
# The Java version to make available on the path. Takes a whole or semver Java version, or 1.x syntax (e.g. 1.8 => Java 8.x). Early access versions can be specified in the form of e.g. 14-ea, 14.0.0-ea, or 14.0.0-ea.28
|
||||||
java-version: 17
|
java-version: 17
|
||||||
|
43
.github/workflows/downstream.yml
vendored
43
.github/workflows/downstream.yml
vendored
@ -1,43 +0,0 @@
|
|||||||
# This is a basic workflow to help you get started with Actions
|
|
||||||
|
|
||||||
name: Downstream Branch Updates
|
|
||||||
|
|
||||||
on:
|
|
||||||
schedule:
|
|
||||||
- cron: '20 7 * * *'
|
|
||||||
# scheduled at 07:00 every Monday and Thursday
|
|
||||||
|
|
||||||
workflow_dispatch: # click the button on Github repo!
|
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
sync_with_upstream:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
name: Sync main with upstream latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# Step 1: run a standard checkout action, provided by github
|
|
||||||
- name: Checkout main
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: main
|
|
||||||
# submodules: 'recursive' ### may be needed in your situation
|
|
||||||
|
|
||||||
# Step 2: run this sync action - specify the upstream repo, upstream branch to sync with, and target sync branch
|
|
||||||
- name: Pull (Fast-Forward) upstream changes
|
|
||||||
id: sync
|
|
||||||
uses: aormsby/Fork-Sync-With-Upstream-action@v3.3
|
|
||||||
with:
|
|
||||||
upstream_repository: AtlasMediaGroup/TotalFreedomMod
|
|
||||||
upstream_branch: main
|
|
||||||
target_branch: development
|
|
||||||
git_pull_args: --ff-only # optional arg use, defaults to simple 'pull'
|
|
||||||
|
|
||||||
# Step 3: Display a message if 'sync' step had new commits (simple test)
|
|
||||||
- name: Check for new commits
|
|
||||||
if: steps.sync.outputs.has_new_commits
|
|
||||||
run: echo "There were new commits."
|
|
||||||
|
|
||||||
# Step 4: Print a helpful timestamp for your records (not required, just nice)
|
|
||||||
- name: Timestamp
|
|
||||||
run: date
|
|
2
.github/workflows/java17-maven.yml
vendored
2
.github/workflows/java17-maven.yml
vendored
@ -13,7 +13,7 @@ jobs:
|
|||||||
|
|
||||||
# Java 16 Builds
|
# Java 16 Builds
|
||||||
- name: Set up JDK 17
|
- name: Set up JDK 17
|
||||||
uses: actions/setup-java@v3.3.0
|
uses: actions/setup-java@v3.6.0
|
||||||
with:
|
with:
|
||||||
java-version: 17
|
java-version: 17
|
||||||
distribution: 'adopt'
|
distribution: 'adopt'
|
||||||
|
24
pom.xml
24
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>me.totalfreedom</groupId>
|
<groupId>me.totalfreedom</groupId>
|
||||||
<artifactId>TotalFreedomMod</artifactId>
|
<artifactId>TotalFreedomMod</artifactId>
|
||||||
<version>2022.06-RC2</version>
|
<version>2022.06</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -101,7 +101,6 @@
|
|||||||
<url>https://repo.essentialsx.net/releases/</url>
|
<url>https://repo.essentialsx.net/releases/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -128,8 +127,8 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>io.papermc.paper</groupId>
|
<groupId>me.totalfreedom.scissors</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>scissors-api</artifactId>
|
||||||
<version>1.17.1-R0.1-SNAPSHOT</version>
|
<version>1.17.1-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
@ -151,7 +150,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q.worldedit</groupId>
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
<artifactId>worldedit-bukkit</artifactId>
|
<artifactId>worldedit-bukkit</artifactId>
|
||||||
<version>7.2.10</version>
|
<version>7.2.12</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -193,7 +192,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.essentialsx</groupId>
|
<groupId>net.essentialsx</groupId>
|
||||||
<artifactId>EssentialsX</artifactId>
|
<artifactId>EssentialsX</artifactId>
|
||||||
<version>2.19.4</version>
|
<version>2.19.6</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -207,17 +206,10 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.javassist</groupId>
|
<groupId>org.javassist</groupId>
|
||||||
<artifactId>javassist</artifactId>
|
<artifactId>javassist</artifactId>
|
||||||
<version>3.29.0-GA</version>
|
<version>3.29.1-GA</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>me.totalfreedom</groupId>
|
|
||||||
<artifactId>tfguilds</artifactId>
|
|
||||||
<version>2021.06-RC2</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.jetbrains</groupId>
|
<groupId>org.jetbrains</groupId>
|
||||||
<artifactId>annotations</artifactId>
|
<artifactId>annotations</artifactId>
|
||||||
@ -235,7 +227,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.junit.jupiter</groupId>
|
<groupId>org.junit.jupiter</groupId>
|
||||||
<artifactId>junit-jupiter</artifactId>
|
<artifactId>junit-jupiter</artifactId>
|
||||||
<version>5.8.2</version>
|
<version>5.9.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -396,7 +388,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
<artifactId>maven-shade-plugin</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.4.1</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<phase>package</phase>
|
<phase>package</phase>
|
||||||
|
@ -136,7 +136,7 @@ public class ChatManager extends FreedomService
|
|||||||
event.setFormat(format);
|
event.setFormat(format);
|
||||||
|
|
||||||
// Send to discord
|
// Send to discord
|
||||||
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player))
|
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted())
|
||||||
{
|
{
|
||||||
plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message));
|
plugin.dc.messageChatChannel(player.getName() + " \u00BB " + ChatColor.stripColor(message));
|
||||||
}
|
}
|
||||||
|
@ -179,7 +179,7 @@ public class LoginProcess extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Whitelist
|
// Whitelist
|
||||||
if (server.isWhitelistEnforced() && !player.isWhitelisted())
|
if (server.hasWhitelist() && !player.isWhitelisted())
|
||||||
{
|
{
|
||||||
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "You are not whitelisted on this server.");
|
||||||
}
|
}
|
||||||
|
@ -1,34 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.command.Command_sit;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.Entity;
|
|
||||||
import org.bukkit.event.EventHandler;
|
|
||||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
|
||||||
|
|
||||||
public class Sitter extends FreedomService
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@EventHandler
|
|
||||||
public void onEntityDismount(EntityDismountEvent e)
|
|
||||||
{
|
|
||||||
Entity dm = e.getDismounted();
|
|
||||||
if (dm instanceof ArmorStand)
|
|
||||||
{
|
|
||||||
if (Command_sit.STANDS.contains(dm))
|
|
||||||
{
|
|
||||||
Command_sit.STANDS.remove(dm);
|
|
||||||
dm.remove();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,6 @@ import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
|
|||||||
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
|
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
|
|
||||||
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
||||||
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
||||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||||
@ -119,7 +118,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public HTTPDaemon hd;
|
public HTTPDaemon hd;
|
||||||
public WorldRestrictions wr;
|
public WorldRestrictions wr;
|
||||||
public EntityWiper ew;
|
public EntityWiper ew;
|
||||||
public Sitter st;
|
|
||||||
public VanishHandler vh;
|
public VanishHandler vh;
|
||||||
public Pterodactyl ptero;
|
public Pterodactyl ptero;
|
||||||
//
|
//
|
||||||
@ -128,7 +126,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public EssentialsBridge esb;
|
public EssentialsBridge esb;
|
||||||
public LibsDisguisesBridge ldb;
|
public LibsDisguisesBridge ldb;
|
||||||
public CoreProtectBridge cpb;
|
public CoreProtectBridge cpb;
|
||||||
public TFGuildsBridge tfg;
|
|
||||||
public WorldEditBridge web;
|
public WorldEditBridge web;
|
||||||
public WorldGuardBridge wgb;
|
public WorldGuardBridge wgb;
|
||||||
|
|
||||||
@ -314,7 +311,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
pem = new PermissionManager();
|
pem = new PermissionManager();
|
||||||
gr = new GameRuleHandler();
|
gr = new GameRuleHandler();
|
||||||
ew = new EntityWiper();
|
ew = new EntityWiper();
|
||||||
st = new Sitter();
|
|
||||||
vh = new VanishHandler();
|
vh = new VanishHandler();
|
||||||
ptero = new Pterodactyl();
|
ptero = new Pterodactyl();
|
||||||
}
|
}
|
||||||
@ -342,7 +338,6 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
cpb = new CoreProtectBridge();
|
cpb = new CoreProtectBridge();
|
||||||
esb = new EssentialsBridge();
|
esb = new EssentialsBridge();
|
||||||
ldb = new LibsDisguisesBridge();
|
ldb = new LibsDisguisesBridge();
|
||||||
tfg = new TFGuildsBridge();
|
|
||||||
web = new WorldEditBridge();
|
web = new WorldEditBridge();
|
||||||
wgb = new WorldGuardBridge();
|
wgb = new WorldGuardBridge();
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
case STRUCTURE_BLOCK:
|
case STRUCTURE_BLOCK:
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.ALLOW_STRUCTURE_BLOCKS.getBoolean())
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
player.sendMessage(ChatColor.GRAY + "Structure blocks are disabled.");
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
@ -81,7 +81,7 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
case JIGSAW:
|
case JIGSAW:
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.ALLOW_JIGSAWS.getBoolean())
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
{
|
{
|
||||||
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
player.sendMessage(ChatColor.GRAY + "Jigsaws are disabled.");
|
||||||
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
@ -89,6 +89,16 @@ public class BlockBlocker extends FreedomService
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case REPEATING_COMMAND_BLOCK:
|
||||||
|
case CHAIN_COMMAND_BLOCK:
|
||||||
|
case COMMAND_BLOCK:
|
||||||
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.GRAY + "Command blocks are disabled.");
|
||||||
|
player.getInventory().setItem(player.getInventory().getHeldItemSlot(), new ItemStack(Material.COOKIE, 1));
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
case GRINDSTONE:
|
case GRINDSTONE:
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())
|
if (!ConfigEntry.ALLOW_GRINDSTONES.getBoolean())
|
||||||
|
@ -4,7 +4,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
/* TODO This will have to be changed from com.github.atlasmediagroup.scissors to me.totalfreedom.scissors when we migrate to 1.19 */
|
||||||
|
import com.github.atlasmediagroup.scissors.event.block.MasterBlockFireEvent;
|
||||||
import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent;
|
import io.papermc.paper.event.player.PlayerSignCommandPreprocessEvent;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
@ -20,15 +21,7 @@ import org.bukkit.entity.FallingBlock;
|
|||||||
import org.bukkit.entity.Tameable;
|
import org.bukkit.entity.Tameable;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.block.BlockBurnEvent;
|
import org.bukkit.event.block.*;
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
|
||||||
import org.bukkit.event.block.BlockGrowEvent;
|
|
||||||
import org.bukkit.event.block.BlockIgniteEvent;
|
|
||||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
|
||||||
import org.bukkit.event.block.BlockPistonExtendEvent;
|
|
||||||
import org.bukkit.event.block.BlockPistonRetractEvent;
|
|
||||||
import org.bukkit.event.block.LeavesDecayEvent;
|
|
||||||
import org.bukkit.event.entity.EntityCombustEvent;
|
import org.bukkit.event.entity.EntityCombustEvent;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityDeathEvent;
|
import org.bukkit.event.entity.EntityDeathEvent;
|
||||||
@ -117,6 +110,28 @@ public class EventBlocker extends FreedomService
|
|||||||
event.setRadius(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
|
event.setRadius(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
|
public void onBlockExplode(BlockExplodeEvent event)
|
||||||
|
{
|
||||||
|
if (!ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
event.setYield(ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void onMasterBlockFire(MasterBlockFireEvent event)
|
||||||
|
{
|
||||||
|
if (!ConfigEntry.ALLOW_MASTERBLOCKS.getBoolean())
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
event.getAt().getBlock().setType(Material.CAKE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.HIGH)
|
@EventHandler(priority = EventPriority.HIGH)
|
||||||
public void onEntityCombust(EntityCombustEvent event)
|
public void onEntityCombust(EntityCombustEvent event)
|
||||||
{
|
{
|
||||||
@ -150,7 +165,7 @@ public class EventBlocker extends FreedomService
|
|||||||
Entity entity = event.getEntity();
|
Entity entity = event.getEntity();
|
||||||
if (entity instanceof Tameable)
|
if (entity instanceof Tameable)
|
||||||
{
|
{
|
||||||
if (((Tameable)entity).isTamed())
|
if (((Tameable) entity).isTamed())
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
|
@ -69,24 +69,17 @@ public class InteractBlocker extends FreedomService
|
|||||||
private void handleRightClick(PlayerInteractEvent event)
|
private void handleRightClick(PlayerInteractEvent event)
|
||||||
{
|
{
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
|
final Block clickedBlock = event.getClickedBlock();
|
||||||
|
|
||||||
if (event.getClickedBlock() != null)
|
if (clickedBlock != null && clickedBlock.getType() == Material.RESPAWN_ANCHOR && !ConfigEntry.ALLOW_RESPAWN_ANCHORS.getBoolean())
|
||||||
{
|
|
||||||
if (event.getClickedBlock().getType().equals(Material.STRUCTURE_BLOCK) || event.getClickedBlock().getType().equals(Material.JIGSAW) || event.getClickedBlock().getType().equals(Material.RESPAWN_ANCHOR))
|
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
event.getPlayer().closeInventory();
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
|
if (Groups.SPAWN_EGGS.contains(event.getMaterial()))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
Block clickedBlock = event.getClickedBlock();
|
|
||||||
if (clickedBlock == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
EntityType eggType = null;
|
EntityType eggType = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -104,7 +97,7 @@ public class InteractBlocker extends FreedomService
|
|||||||
{
|
{
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
if (eggType != null)
|
if (eggType != null && clickedBlock != null)
|
||||||
{
|
{
|
||||||
clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType);
|
clickedBlock.getWorld().spawnEntity(clickedBlock.getLocation().add(event.getBlockFace().getDirection()).add(0.5, 0.5, 0.5), eggType);
|
||||||
}
|
}
|
||||||
|
@ -1,58 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.bridge;
|
|
||||||
|
|
||||||
import me.totalfreedom.tfguilds.Common;
|
|
||||||
import me.totalfreedom.tfguilds.TFGuilds;
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
|
||||||
|
|
||||||
public class TFGuildsBridge extends FreedomService
|
|
||||||
{
|
|
||||||
public boolean enabled = false;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isTFGuildsEnabled()
|
|
||||||
{
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final Plugin tfGuilds = server.getPluginManager().getPlugin("TFGuilds");
|
|
||||||
if (tfGuilds != null && tfGuilds.isEnabled())
|
|
||||||
{
|
|
||||||
if (tfGuilds instanceof TFGuilds)
|
|
||||||
{
|
|
||||||
enabled = true;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (NoClassDefFoundError ex)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean inGuildChat(Player player)
|
|
||||||
{
|
|
||||||
if (!isTFGuildsEnabled())
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return Common.GUILD_CHAT.contains(player);
|
|
||||||
}
|
|
||||||
}
|
|
@ -112,6 +112,9 @@ public class Command_coins extends FreedomCommand
|
|||||||
+ ChatColor.GOLD + coinsToTransfer
|
+ ChatColor.GOLD + coinsToTransfer
|
||||||
+ ChatColor.GREEN + " coin" + (coinsToTransfer > 1 ? "s" : "")
|
+ ChatColor.GREEN + " coin" + (coinsToTransfer > 1 ? "s" : "")
|
||||||
+ " to " + ChatColor.GOLD + target.getName() + ChatColor.GREEN + ".", ChatColor.GREEN);
|
+ " to " + ChatColor.GOLD + target.getName() + ChatColor.GREEN + ".", ChatColor.GREEN);
|
||||||
|
|
||||||
|
plugin.pl.save(playerData);
|
||||||
|
plugin.pl.save(senderData);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.History;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
|
||||||
@CommandParameters(description = "Check the name history of a specified player.", usage = "/<command> <username>", aliases = "nh")
|
|
||||||
public class Command_namehistory extends FreedomCommand
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (args.length != 1)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
History.reportHistory(sender, args[0]);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.entity.ArmorStand;
|
|
||||||
import org.bukkit.entity.EntityType;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
|
||||||
@CommandParameters(description = "Sit at the current place you are at.", usage = "/<command>")
|
|
||||||
public class Command_sit extends FreedomCommand
|
|
||||||
{
|
|
||||||
public static List<ArmorStand> STANDS = new ArrayList<>();
|
|
||||||
|
|
||||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (args.length != 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
ArmorStand stand = (ArmorStand)playerSender.getWorld().spawnEntity(playerSender.getLocation().clone().subtract(0.0, 1.7, 0.0), EntityType.ARMOR_STAND);
|
|
||||||
stand.setGravity(false);
|
|
||||||
stand.setAI(false);
|
|
||||||
stand.setVisible(false);
|
|
||||||
stand.setInvulnerable(true);
|
|
||||||
stand.addPassenger(playerSender);
|
|
||||||
STANDS.add(stand);
|
|
||||||
msg("You are now sitting.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -19,7 +19,7 @@ public class Command_toggle extends FreedomCommand
|
|||||||
private final List<String> toggles = Arrays.asList(
|
private final List<String> toggles = Arrays.asList(
|
||||||
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
"waterplace", "fireplace", "lavaplace", "fluidspread", "lavadmg", "firespread", "frostwalk",
|
||||||
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
"firework", "prelog", "lockdown", "petprotect", "entitywipe", "nonuke [range] [count]",
|
||||||
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "structureblocks", "jigsaws", "grindstones",
|
"explosives [radius]", "unsafeenchs", "bells", "armorstands", "masterblocks", "grindstones",
|
||||||
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
"jukeboxes", "spawners", "4chan", "beehives", "respawnanchors", "autotp", "autoclear", "minecarts", "mp44",
|
||||||
"landmines", "tossmob", "gravity");
|
"landmines", "tossmob", "gravity");
|
||||||
|
|
||||||
@ -193,15 +193,9 @@ public class Command_toggle extends FreedomCommand
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "structureblocks":
|
case "masterblocks":
|
||||||
{
|
{
|
||||||
toggle("Structure blocks are", ConfigEntry.ALLOW_STRUCTURE_BLOCKS);
|
toggle("Master blocks are", ConfigEntry.ALLOW_MASTERBLOCKS);
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "jigsaws":
|
|
||||||
{
|
|
||||||
toggle("Jigsaws are", ConfigEntry.ALLOW_JIGSAWS);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,8 +25,6 @@ public enum ConfigEntry
|
|||||||
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
ALLOW_BELLS(Boolean.class, "allow.bells"),
|
||||||
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
|
ALLOW_ARMOR_STANDS(Boolean.class, "allow.armorstands"),
|
||||||
ALLOW_MINECARTS(Boolean.class, "allow.minecarts"),
|
ALLOW_MINECARTS(Boolean.class, "allow.minecarts"),
|
||||||
ALLOW_STRUCTURE_BLOCKS(Boolean.class, "allow.structureblocks"),
|
|
||||||
ALLOW_JIGSAWS(Boolean.class, "allow.jigsaws"),
|
|
||||||
ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"),
|
ALLOW_GRINDSTONES(Boolean.class, "allow.grindstones"),
|
||||||
ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"),
|
ALLOW_JUKEBOXES(Boolean.class, "allow.jukeboxes"),
|
||||||
ALLOW_SPAWNERS(Boolean.class, "allow.spawners"),
|
ALLOW_SPAWNERS(Boolean.class, "allow.spawners"),
|
||||||
@ -35,6 +33,7 @@ public enum ConfigEntry
|
|||||||
AUTO_TP(Boolean.class, "allow.auto_tp"),
|
AUTO_TP(Boolean.class, "allow.auto_tp"),
|
||||||
AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
|
AUTO_CLEAR(Boolean.class, "allow.auto_clear"),
|
||||||
ALLOW_GRAVITY(Boolean.class, "allow.gravity"),
|
ALLOW_GRAVITY(Boolean.class, "allow.gravity"),
|
||||||
|
ALLOW_MASTERBLOCKS(Boolean.class, "allow.masterblocks"),
|
||||||
//
|
//
|
||||||
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
BLOCKED_CHATCODES(String.class, "blocked_chatcodes"),
|
||||||
//
|
//
|
||||||
|
@ -7,11 +7,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.SplittableRandom;
|
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
import javax.security.auth.login.LoginException;
|
import javax.security.auth.login.LoginException;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
@ -41,9 +38,7 @@ import net.dv8tion.jda.api.utils.ChunkingFilter;
|
|||||||
import net.dv8tion.jda.api.utils.MemberCachePolicy;
|
import net.dv8tion.jda.api.utils.MemberCachePolicy;
|
||||||
import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory;
|
import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
|
||||||
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
|
||||||
import org.apache.commons.lang.StringUtils;
|
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.apache.commons.lang3.RandomStringUtils;
|
import org.apache.commons.lang3.RandomStringUtils;
|
||||||
import org.bukkit.GameRule;
|
import org.bukkit.GameRule;
|
||||||
@ -66,7 +61,6 @@ public class Discord extends FreedomService
|
|||||||
public List<CompletableFuture<Message>> sentMessages = new ArrayList<>();
|
public List<CompletableFuture<Message>> sentMessages = new ArrayList<>();
|
||||||
public Boolean enabled = false;
|
public Boolean enabled = false;
|
||||||
private static final ImmutableList<String> DISCORD_SUBDOMAINS = ImmutableList.of("discordapp.com", "discord.com", "discord.gg");
|
private static final ImmutableList<String> DISCORD_SUBDOMAINS = ImmutableList.of("discordapp.com", "discord.com", "discord.gg");
|
||||||
private final Pattern DISCORD_MENTION_PATTERN = Pattern.compile("(<@!?([0-9]{16,20})>)");
|
|
||||||
|
|
||||||
public static String getCode(PlayerData playerData)
|
public static String getCode(PlayerData playerData)
|
||||||
{
|
{
|
||||||
@ -209,7 +203,7 @@ public class Discord extends FreedomService
|
|||||||
catch (NoClassDefFoundError e)
|
catch (NoClassDefFoundError e)
|
||||||
{
|
{
|
||||||
FLog.warning("The JDA plugin is not installed, therefore the discord bot cannot start.");
|
FLog.warning("The JDA plugin is not installed, therefore the discord bot cannot start.");
|
||||||
FLog.warning("To resolve this error, please download the latest JDA from: https://github.com/TFPatches/Minecraft-JDA/releases");
|
FLog.warning("To resolve this error, please download the latest JDA from: https://github.com/AtlasMediaGroup/Minecraft-JDA/releases");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -277,7 +271,7 @@ public class Discord extends FreedomService
|
|||||||
|
|
||||||
if (deathMessage != null)
|
if (deathMessage != null)
|
||||||
{
|
{
|
||||||
messageChatChannel("**" + PlainTextComponentSerializer.plainText().serialize(deathMessage) + "**", true);
|
messageChatChannel("**" + deformat(PlainTextComponentSerializer.plainText().serialize(deathMessage)) + "**", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -292,7 +286,7 @@ public class Discord extends FreedomService
|
|||||||
{
|
{
|
||||||
if (!plugin.al.isVanished(event.getPlayer().getName()))
|
if (!plugin.al.isVanished(event.getPlayer().getName()))
|
||||||
{
|
{
|
||||||
messageChatChannel("**" + event.getPlayer().getName() + " joined the server" + "**", true);
|
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -301,7 +295,7 @@ public class Discord extends FreedomService
|
|||||||
{
|
{
|
||||||
if (!plugin.al.isVanished(event.getPlayer().getName()))
|
if (!plugin.al.isVanished(event.getPlayer().getName()))
|
||||||
{
|
{
|
||||||
messageChatChannel("**" + event.getPlayer().getName() + " left the server" + "**", true);
|
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**", true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -437,13 +431,28 @@ public class Discord extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Guild server = bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString());
|
final Guild server = bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString());
|
||||||
|
|
||||||
|
if (server == null)
|
||||||
|
{
|
||||||
|
FLog.severe("The guild ID specified in the config is invalid.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TextChannel channel = server.getTextChannelById(ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString());
|
final TextChannel channel = server.getTextChannelById(ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString());
|
||||||
|
|
||||||
|
if (channel == null)
|
||||||
|
{
|
||||||
|
FLog.severe("The report channel ID specified in the config is invalid.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final EmbedBuilder embedBuilder = new EmbedBuilder();
|
final EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
embedBuilder.setTitle("Report for " + reported.getName() + " (offline)");
|
embedBuilder.setTitle("Report for " + reported.getName() + " (offline)");
|
||||||
embedBuilder.setDescription(reason);
|
embedBuilder.setDescription(reason);
|
||||||
embedBuilder.setFooter("Reported by " + reporter.getName(), "https://minotar.net/helm/" + reporter.getName() + ".png");
|
embedBuilder.setFooter("Reported by " + reporter.getName(), "https://minotar.net/helm/" + reporter.getName() + ".png");
|
||||||
embedBuilder.setTimestamp(Instant.from(ZonedDateTime.now()));
|
embedBuilder.setTimestamp(Instant.from(ZonedDateTime.now()));
|
||||||
|
if (plugin.esb.isEnabled())
|
||||||
|
{
|
||||||
com.earth2me.essentials.User user = plugin.esb.getEssentialsUser(reported.getName());
|
com.earth2me.essentials.User user = plugin.esb.getEssentialsUser(reported.getName());
|
||||||
String location = "World: " + Objects.requireNonNull(user.getLastLocation().getWorld()).getName() + ", X: " + user.getLastLocation().getBlockX() + ", Y: " + user.getLastLocation().getBlockY() + ", Z: " + user.getLastLocation().getBlockZ();
|
String location = "World: " + Objects.requireNonNull(user.getLastLocation().getWorld()).getName() + ", X: " + user.getLastLocation().getBlockX() + ", Y: " + user.getLastLocation().getBlockY() + ", Z: " + user.getLastLocation().getBlockZ();
|
||||||
embedBuilder.addField("Location", location, true);
|
embedBuilder.addField("Location", location, true);
|
||||||
@ -452,8 +461,9 @@ public class Discord extends FreedomService
|
|||||||
{
|
{
|
||||||
embedBuilder.addField("Nickname", user.getNickname(), true);
|
embedBuilder.addField("Nickname", user.getNickname(), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
MessageEmbed embed = embedBuilder.build();
|
MessageEmbed embed = embedBuilder.build();
|
||||||
Message message = channel.sendMessage(embed).complete();
|
Message message = channel.sendMessageEmbeds(embed).complete();
|
||||||
|
|
||||||
if (!ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
if (!ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
||||||
{
|
{
|
||||||
@ -471,8 +481,21 @@ public class Discord extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Guild server = bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString());
|
final Guild server = bot.getGuildById(ConfigEntry.DISCORD_SERVER_ID.getString());
|
||||||
|
|
||||||
|
if (server == null)
|
||||||
|
{
|
||||||
|
FLog.severe("The guild ID specified in the config is invalid.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final TextChannel channel = server.getTextChannelById(ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString());
|
final TextChannel channel = server.getTextChannelById(ConfigEntry.DISCORD_REPORT_CHANNEL_ID.getString());
|
||||||
|
|
||||||
|
if (channel == null)
|
||||||
|
{
|
||||||
|
FLog.severe("The report channel ID specified in the config is invalid.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
final EmbedBuilder embedBuilder = new EmbedBuilder();
|
final EmbedBuilder embedBuilder = new EmbedBuilder();
|
||||||
embedBuilder.setTitle("Report for " + reported.getName());
|
embedBuilder.setTitle("Report for " + reported.getName());
|
||||||
embedBuilder.setDescription(reason);
|
embedBuilder.setDescription(reason);
|
||||||
@ -481,14 +504,19 @@ public class Discord extends FreedomService
|
|||||||
String location = "World: " + Objects.requireNonNull(reported.getLocation().getWorld()).getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
|
String location = "World: " + Objects.requireNonNull(reported.getLocation().getWorld()).getName() + ", X: " + reported.getLocation().getBlockX() + ", Y: " + reported.getLocation().getBlockY() + ", Z: " + reported.getLocation().getBlockZ();
|
||||||
embedBuilder.addField("Location", location, true);
|
embedBuilder.addField("Location", location, true);
|
||||||
embedBuilder.addField("Game Mode", WordUtils.capitalizeFully(reported.getGameMode().name()), true);
|
embedBuilder.addField("Game Mode", WordUtils.capitalizeFully(reported.getGameMode().name()), true);
|
||||||
|
|
||||||
|
if (plugin.esb.isEnabled())
|
||||||
|
{
|
||||||
com.earth2me.essentials.User user = plugin.esb.getEssentialsUser(reported.getName());
|
com.earth2me.essentials.User user = plugin.esb.getEssentialsUser(reported.getName());
|
||||||
embedBuilder.addField("God Mode", WordUtils.capitalizeFully(String.valueOf(user.isGodModeEnabled())), true);
|
embedBuilder.addField("God Mode", WordUtils.capitalizeFully(String.valueOf(user.isGodModeEnabled())), true);
|
||||||
if (user.getNickname() != null)
|
if (user.getNickname() != null)
|
||||||
{
|
{
|
||||||
embedBuilder.addField("Nickname", user.getNickname(), true);
|
embedBuilder.addField("Nickname", user.getNickname(), true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
MessageEmbed embed = embedBuilder.build();
|
MessageEmbed embed = embedBuilder.build();
|
||||||
Message message = channel.sendMessage(embed).complete();
|
Message message = channel.sendMessageEmbeds(embed).complete();
|
||||||
|
|
||||||
if (!ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
if (!ConfigEntry.DISCORD_REPORT_ARCHIVE_CHANNEL_ID.getString().isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod.discord;
|
|||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommandManager;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Title;
|
import me.totalfreedom.totalfreedommod.rank.Title;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
@ -7,7 +7,7 @@ public abstract class DiscordCommandImpl implements DiscordCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean canExecute(Member member)
|
public boolean canExecute(Member member)
|
||||||
{
|
{
|
||||||
//return !isAdmin() || member.getRoles().stream().filter((role -> role.getName().toLowerCase().contains("admin") && !role.getName().toLowerCase().contains("discord"))).toList().size() > 0;
|
// TODO Implement administrator checks if/when any administrative Discord commands are added to the bot
|
||||||
return !isAdmin();
|
return !isAdmin();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -81,6 +81,6 @@ public class HelpCommand extends DiscordCommandImpl
|
|||||||
embedBuilder.addField(category, fieldValue.toString().trim(), false);
|
embedBuilder.addField(category, fieldValue.toString().trim(), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MessageBuilder().setEmbed(embedBuilder.build());
|
return new MessageBuilder().setEmbeds(embedBuilder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,16 +3,14 @@ package me.totalfreedom.totalfreedommod.discord.commands;
|
|||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommand;
|
import me.totalfreedom.totalfreedommod.discord.Discord;
|
||||||
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommandImpl;
|
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommandImpl;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import me.totalfreedom.totalfreedommod.rank.RankManager;
|
import me.totalfreedom.totalfreedommod.rank.RankManager;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.MessageBuilder;
|
import net.dv8tion.jda.api.MessageBuilder;
|
||||||
import net.dv8tion.jda.api.entities.Guild;
|
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import net.dv8tion.jda.api.entities.User;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -82,13 +80,14 @@ public class ListCommand extends DiscordCommandImpl
|
|||||||
|
|
||||||
Displayable displayable = rankManager.getDisplay(onlinePlayer);
|
Displayable displayable = rankManager.getDisplay(onlinePlayer);
|
||||||
|
|
||||||
|
final String name = Discord.deformat(onlinePlayer.getName());
|
||||||
|
|
||||||
if (displayables.containsKey(displayable))
|
if (displayables.containsKey(displayable))
|
||||||
{
|
{
|
||||||
displayables.get(displayable).add(onlinePlayer.getName());
|
displayables.get(displayable).add(name);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
{
|
{
|
||||||
displayables.put(displayable, new ArrayList<>(List.of(onlinePlayer.getName())));
|
displayables.put(displayable, new ArrayList<>(List.of(name)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,6 +100,6 @@ public class ListCommand extends DiscordCommandImpl
|
|||||||
String.join(", ", players), false);
|
String.join(", ", players), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new MessageBuilder().setEmbed(embedBuilder.build());
|
return new MessageBuilder().setEmbeds(embedBuilder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
package me.totalfreedom.totalfreedommod.discord.commands;
|
package me.totalfreedom.totalfreedommod.discord.commands;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommand;
|
|
||||||
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommandImpl;
|
import me.totalfreedom.totalfreedommod.discord.command.DiscordCommandImpl;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.dv8tion.jda.api.EmbedBuilder;
|
import net.dv8tion.jda.api.EmbedBuilder;
|
||||||
import net.dv8tion.jda.api.MessageBuilder;
|
import net.dv8tion.jda.api.MessageBuilder;
|
||||||
import net.dv8tion.jda.api.entities.Member;
|
import net.dv8tion.jda.api.entities.Member;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Server;
|
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -55,6 +53,6 @@ public class TPSCommand extends DiscordCommandImpl
|
|||||||
builder.addField("Allocated Memory", Math.ceil(FUtil.getTotalMem()) + " MB", false);
|
builder.addField("Allocated Memory", Math.ceil(FUtil.getTotalMem()) + " MB", false);
|
||||||
builder.addField("Free Memory", Math.ceil(FUtil.getFreeMem()) + " MB", false);
|
builder.addField("Free Memory", Math.ceil(FUtil.getFreeMem()) + " MB", false);
|
||||||
|
|
||||||
return new MessageBuilder().setEmbed(builder.build());
|
return new MessageBuilder().setEmbeds(builder.build());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ public class SQLite extends FreedomService
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Object[] data = {key, player.getName()};
|
Object[] data = {key, player.getUuid()};
|
||||||
PreparedStatement statement = connection.prepareStatement(MessageFormat.format("UPDATE players SET {0}=? WHERE uuid=''{1}''", data));
|
PreparedStatement statement = connection.prepareStatement(MessageFormat.format("UPDATE players SET {0}=? WHERE uuid=''{1}''", data));
|
||||||
statement = setUnknownType(statement, 1, value);
|
statement = setUnknownType(statement, 1, value);
|
||||||
statement.executeUpdate();
|
statement.executeUpdate();
|
||||||
|
@ -1,114 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.util;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.text.DateFormat;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.UUID;
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
|
||||||
|
|
||||||
public class History
|
|
||||||
{
|
|
||||||
|
|
||||||
public static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
|
|
||||||
public static void reportHistory(final CommandSender sender, final String username)
|
|
||||||
{
|
|
||||||
new BukkitRunnable()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
UUID uuid = UUIDFetcher.fetch(username);
|
|
||||||
if (uuid != null)
|
|
||||||
{
|
|
||||||
Gson gson = new GsonBuilder().create();
|
|
||||||
String compactUuid = uuid.toString().replace("-", "");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
//UUIDs or playernames actually work with this one
|
|
||||||
//TODO: fix the stupid api on how it's not working name histories
|
|
||||||
//URL url = new URL("https://api.ashcon.app/mojang/v2/user/" + compactUuid);
|
|
||||||
URL url = new URL("https://api.mojang.com/user/profiles/" + compactUuid + "/names");
|
|
||||||
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
|
||||||
//conn.setRequestProperty("User-Agent", "");
|
|
||||||
BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
|
|
||||||
FName[] oldNames = gson.fromJson(reader, FName[].class);
|
|
||||||
if (oldNames == null)
|
|
||||||
{
|
|
||||||
FSync.playerMsg(sender, ChatColor.RED + "Player not found!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
conn.disconnect();
|
|
||||||
Arrays.sort(oldNames);
|
|
||||||
printHistory(sender, oldNames);
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
FSync.playerMsg(sender, ChatColor.RED + "Error, see logs for more details.");
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
FSync.playerMsg(sender, ChatColor.RED + "Player not found!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}.runTaskAsynchronously(TotalFreedomMod.getPlugin());
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void printHistory(CommandSender sender, FName[] oldNames)
|
|
||||||
{
|
|
||||||
if (oldNames.length == 1)
|
|
||||||
{
|
|
||||||
FSync.playerMsg(sender, ChatColor.GREEN + oldNames[0].getName() + ChatColor.GOLD + " has never changed their name.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
FSync.playerMsg(sender, ChatColor.GOLD + "Original name: " + ChatColor.GREEN + oldNames[0].getName());
|
|
||||||
for (int i = 1; i < oldNames.length; i++)
|
|
||||||
{
|
|
||||||
Date date = new Date(oldNames[i].getChangedToAt());
|
|
||||||
String formattedDate = dateFormat.format(date);
|
|
||||||
FSync.playerMsg(sender, ChatColor.BLUE + formattedDate + ChatColor.GOLD + " changed to " + ChatColor.GREEN + oldNames[i].getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class FName implements Comparable<FName>
|
|
||||||
{
|
|
||||||
private final String name;
|
|
||||||
private final long changedToAt;
|
|
||||||
|
|
||||||
//Added constructor because otherwise there's no way name or changedToAt would have been anything other than null.
|
|
||||||
public FName(String name, long changedToAt)
|
|
||||||
{
|
|
||||||
this.name = name;
|
|
||||||
this.changedToAt = changedToAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int compareTo(FName other)
|
|
||||||
{
|
|
||||||
return Long.compare(this.changedToAt, other.changedToAt);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getChangedToAt()
|
|
||||||
{
|
|
||||||
return changedToAt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,68 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.util;
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStreamReader;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
// UUIDFetcher retrieves UUIDs from usernames via web requests to Mojang.
|
|
||||||
public class UUIDFetcher
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final String PROFILE_URL = "https://api.mojang.com/profiles/minecraft";
|
|
||||||
|
|
||||||
public static UUID fetch(String name)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Gson gson = new GsonBuilder().create();
|
|
||||||
UUID uuid;
|
|
||||||
String body = gson.toJson(name);
|
|
||||||
URL url = new URL(PROFILE_URL);
|
|
||||||
HttpURLConnection connection = (HttpURLConnection)url.openConnection();
|
|
||||||
connection.setRequestMethod("POST");
|
|
||||||
connection.setRequestProperty("Content-Type", "application/json");
|
|
||||||
connection.setUseCaches(false);
|
|
||||||
connection.setDoInput(true);
|
|
||||||
connection.setDoOutput(true);
|
|
||||||
OutputStream stream = connection.getOutputStream();
|
|
||||||
stream.write(body.getBytes());
|
|
||||||
stream.flush();
|
|
||||||
stream.close();
|
|
||||||
FetchedUuid[] id = gson.fromJson(
|
|
||||||
new InputStreamReader(connection.getInputStream()),
|
|
||||||
FetchedUuid[].class);
|
|
||||||
|
|
||||||
if (id.length == 0 || id[0].getID() == null)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
String idd = id[0].getID();
|
|
||||||
uuid = UUID.fromString(idd.substring(0, 8) + "-" + idd.substring(8, 12)
|
|
||||||
+ "-" + idd.substring(12, 16) + "-" + idd.substring(16, 20) + "-"
|
|
||||||
+ idd.substring(20, 32));
|
|
||||||
return uuid;
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static class FetchedUuid
|
|
||||||
{
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
public String getID()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -224,8 +224,6 @@ allow:
|
|||||||
minecarts: true
|
minecarts: true
|
||||||
clearonjoin: false
|
clearonjoin: false
|
||||||
tpronjoin: false
|
tpronjoin: false
|
||||||
structureblocks: false
|
|
||||||
jigsaws: false
|
|
||||||
grindstones: true
|
grindstones: true
|
||||||
jukeboxes: true
|
jukeboxes: true
|
||||||
spawners: false
|
spawners: false
|
||||||
@ -234,6 +232,7 @@ allow:
|
|||||||
auto_tp: false
|
auto_tp: false
|
||||||
auto_clear: false
|
auto_clear: false
|
||||||
gravity: false
|
gravity: false
|
||||||
|
masterblocks: false
|
||||||
|
|
||||||
blocked_commands:
|
blocked_commands:
|
||||||
#
|
#
|
||||||
|
Reference in New Issue
Block a user