mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
commit
5401cc5dc7
1
.gitignore
vendored
1
.gitignore
vendored
@ -23,6 +23,7 @@ manifest.mf
|
||||
/.idea/discord.xml
|
||||
/.idea/jarRepositories.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/uiDesigner.xml
|
||||
/.idea/libraries
|
||||
*.iml
|
||||
|
||||
|
124
.idea/uiDesigner.xml
generated
Normal file
124
.idea/uiDesigner.xml
generated
Normal file
@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
26
pom.xml
26
pom.xml
@ -18,7 +18,7 @@
|
||||
|
||||
<name>TotalFreedomMod</name>
|
||||
<description>Server modification for the TotalFreedom server</description>
|
||||
<url>https://github.com/TotalFreedom/TotalFreedomMod</url>
|
||||
<url>https://github.com/TFPatches/TotalFreedomMod</url>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
@ -44,6 +44,11 @@
|
||||
<url>https://jitpack.io</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>CodeMC</id>
|
||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<id>spigot-repo</id>
|
||||
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
|
||||
@ -105,7 +110,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.0</version>
|
||||
<version>1.18.12</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
@ -232,11 +237,16 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.10</version>
|
||||
<groupId>com.github.speedxx</groupId>
|
||||
<artifactId>TFGuilds</artifactId>
|
||||
<version>master</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>3.1.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
@ -253,7 +263,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.7.0</version>
|
||||
<version>3.8.1</version>
|
||||
<configuration>
|
||||
<outputFileName>TotalFreedomMod.jar</outputFileName>
|
||||
<compilerVersion>1.8</compilerVersion>
|
||||
@ -266,7 +276,7 @@
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>2.2.5</version>
|
||||
<version>4.0.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>get-the-git-infos</id>
|
||||
@ -412,7 +422,7 @@
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<version>2.17</version>
|
||||
<version>3.1.1</version>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<configuration>
|
||||
<configLocation>checkstyle.xml</configLocation>
|
||||
|
@ -2,7 +2,10 @@ package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.sk89q.worldedit.bukkit.BukkitConfiguration;
|
||||
import java.io.File;
|
||||
import me.totalfreedom.totalfreedommod.banning.PermbanList;
|
||||
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||
import me.totalfreedom.totalfreedommod.permissions.PermissionConfig;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentList;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.util.FileUtil;
|
||||
@ -25,6 +28,15 @@ public class BackupManager extends FreedomService
|
||||
createBackups(file, false);
|
||||
}
|
||||
|
||||
public void createAllBackups()
|
||||
{
|
||||
createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
||||
createBackups(PermbanList.CONFIG_FILENAME);
|
||||
createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
|
||||
createBackups(PunishmentList.CONFIG_FILENAME);
|
||||
createBackups("database.db");
|
||||
}
|
||||
|
||||
public void createBackups(String file, boolean onlyWeekly)
|
||||
{
|
||||
final String save = file.split("\\.")[0];
|
||||
|
@ -1,7 +1,6 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import java.util.Date;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
@ -55,7 +54,7 @@ public class ChatManager extends FreedomService
|
||||
message = FUtil.colorize(message);
|
||||
message = message.replaceAll(ChatColor.MAGIC.toString(), "&k");
|
||||
|
||||
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean() && !plugin.sh.reactionString.isEmpty() && message.equals(plugin.sh.reactionString))
|
||||
if (ConfigEntry.SHOP_ENABLED.getBoolean() && ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean() && !plugin.sh.reactionString.isEmpty() && message.equals(plugin.sh.reactionString))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
PlayerData data = plugin.pl.getData(player);
|
||||
@ -73,12 +72,6 @@ public class ChatManager extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
if (message.startsWith("Connected using PickaxeChat for "))
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
// Truncate messages that are too long - 256 characters is vanilla client max
|
||||
if (message.length() > 256)
|
||||
{
|
||||
@ -86,7 +79,6 @@ public class ChatManager extends FreedomService
|
||||
FSync.playerMsg(player, "Message was shortened because it was too long to send.");
|
||||
}
|
||||
|
||||
|
||||
final FPlayer fPlayer = plugin.pl.getPlayerSync(player);
|
||||
if (fPlayer.isLockedUp())
|
||||
{
|
||||
@ -144,7 +136,7 @@ public class ChatManager extends FreedomService
|
||||
event.setFormat(format);
|
||||
|
||||
// Send to discord
|
||||
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist())
|
||||
if (!ConfigEntry.ADMIN_ONLY_MODE.getBoolean() && !Bukkit.hasWhitelist() && !plugin.pl.getPlayer(player).isMuted() && !plugin.tfg.inGuildChat(player))
|
||||
{
|
||||
plugin.dc.messageChatChannel(plugin.dc.deformat(player.getName()) + " \u00BB " + ChatColor.stripColor(message));
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class LoginProcess extends FreedomService
|
||||
public static final Pattern USERNAME_REGEX = Pattern.compile("^[\\w\\d_]{3,20}$");
|
||||
public List<String> TELEPORT_ON_JOIN = new ArrayList<>();
|
||||
public List<String> CLEAR_ON_JOIN = new ArrayList<>();
|
||||
//
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private static boolean lockdownEnabled = false;
|
||||
@ -226,14 +226,6 @@ public class LoginProcess extends FreedomService
|
||||
player.setPlayerListFooter(FUtil.colorize(ConfigEntry.SERVER_TABLIST_FOOTER.getString()).replace("\\n", "\n"));
|
||||
}
|
||||
|
||||
for (Player p : plugin.al.vanished)
|
||||
{
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
player.hidePlayer(plugin, p);
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
String tag = playerData.getTag();
|
||||
@ -241,6 +233,7 @@ public class LoginProcess extends FreedomService
|
||||
{
|
||||
fPlayer.setTag(FUtil.colorize(tag));
|
||||
}
|
||||
|
||||
int noteCount = playerData.getNotes().size();
|
||||
if (noteCount != 0)
|
||||
{
|
||||
@ -274,7 +267,6 @@ public class LoginProcess extends FreedomService
|
||||
FUtil.playerMsg(player, "Warning: Server is currenty in lockdown-mode, new players will not be able to join!", ChatColor.RED);
|
||||
}
|
||||
}
|
||||
}.runTaskLater(plugin, 20L * 1L);
|
||||
}.runTaskLater(plugin, 20L);
|
||||
}
|
||||
|
||||
}
|
@ -1,26 +1,61 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
||||
import org.bukkit.event.entity.PotionSplashEvent;
|
||||
import org.bukkit.projectiles.ProjectileSource;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class Monitors extends FreedomService
|
||||
{
|
||||
|
||||
private final DecimalFormat decimalFormat = new DecimalFormat("#");
|
||||
private String potionSpyPrefix = ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "PotionSpy" + ChatColor.DARK_GRAY + "] ";
|
||||
@Getter
|
||||
private List<Map.Entry<ThrownPotion, Long>> allThrownPotions = new ArrayList<>();
|
||||
private Map<Player, List<ThrownPotion>> recentlyThrownPotions = new HashMap<>();
|
||||
private final List<PotionEffectType> badPotionEffects = new ArrayList<>(Arrays.asList(PotionEffectType.BLINDNESS,
|
||||
PotionEffectType.LEVITATION, PotionEffectType.CONFUSION, PotionEffectType.SLOW, PotionEffectType.SLOW_DIGGING, PotionEffectType.HUNGER)); // A list of all effects that count as "troll".
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, () ->
|
||||
{
|
||||
for (Player player : recentlyThrownPotions.keySet())
|
||||
{
|
||||
if (plugin.al.isAdmin(player) && plugin.al.getAdmin(player).getPotionSpy())
|
||||
{
|
||||
List<ThrownPotion> playerThrownPotions = recentlyThrownPotions.get(player);
|
||||
ThrownPotion latestThrownPotion = playerThrownPotions.get(playerThrownPotions.size() - 1); // Get most recently thrown potion for the position.
|
||||
int potionsThrown = playerThrownPotions.size();
|
||||
boolean trollPotions = false;
|
||||
|
||||
for (ThrownPotion potion : playerThrownPotions)
|
||||
{
|
||||
if (isTrollPotion(potion))
|
||||
{
|
||||
trollPotions = true;
|
||||
}
|
||||
}
|
||||
|
||||
FUtil.playerMsg(player, ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
||||
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
||||
latestThrownPotion.getWorld().getName(), trollPotions ? " &c(most likely troll potion/potions)" : "")));
|
||||
}
|
||||
}
|
||||
recentlyThrownPotions.clear();
|
||||
}, 0L, 40L);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -31,26 +66,25 @@ public class Monitors extends FreedomService
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onLingeringPotionSplash(LingeringPotionSplashEvent event)
|
||||
{
|
||||
ProjectileSource source = event.getEntity().getShooter();
|
||||
|
||||
if (!(source instanceof Player))
|
||||
if (event.getEntity().getShooter() instanceof Player)
|
||||
{
|
||||
return;
|
||||
ThrownPotion potion = event.getEntity();
|
||||
if (potion.getShooter() instanceof Player)
|
||||
{
|
||||
Player player = (Player)potion.getShooter();
|
||||
|
||||
recentlyThrownPotions.putIfAbsent(player, new ArrayList<>());
|
||||
recentlyThrownPotions.get(player).add(potion);
|
||||
allThrownPotions.add(new AbstractMap.SimpleEntry<>(potion, System.currentTimeMillis()));
|
||||
|
||||
if (recentlyThrownPotions.get(player).size() > 128)
|
||||
{
|
||||
recentlyThrownPotions.get(player).remove(0);
|
||||
}
|
||||
Player player = (Player)source;
|
||||
|
||||
if (plugin.al.isAdmin((Player)event.getEntity().getShooter()))
|
||||
if (allThrownPotions.size() > 1024)
|
||||
{
|
||||
return;
|
||||
allThrownPotions.remove(0); // Remove the first element in the set.
|
||||
}
|
||||
final Material droppedItem = event.getEntity().getItem().getType();
|
||||
final Location location = player.getLocation();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy())
|
||||
{
|
||||
FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + droppedItem + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -58,27 +92,57 @@ public class Monitors extends FreedomService
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPotionSplash(PotionSplashEvent event)
|
||||
{
|
||||
ProjectileSource source = event.getEntity().getShooter();
|
||||
if (event.getEntity().getShooter() instanceof Player)
|
||||
{
|
||||
ThrownPotion potion = event.getEntity();
|
||||
if (potion.getShooter() instanceof Player)
|
||||
{
|
||||
Player player = (Player)potion.getShooter();
|
||||
|
||||
if (!(source instanceof Player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
Player player = (Player)source;
|
||||
recentlyThrownPotions.putIfAbsent(player, new ArrayList<>());
|
||||
recentlyThrownPotions.get(player).add(potion);
|
||||
allThrownPotions.add(new AbstractMap.SimpleEntry<>(potion, System.currentTimeMillis()));
|
||||
|
||||
if (plugin.al.isAdmin((Player)event.getEntity().getShooter()))
|
||||
if (recentlyThrownPotions.get(player).size() > 128)
|
||||
{
|
||||
return;
|
||||
recentlyThrownPotions.get(player).remove(0);
|
||||
}
|
||||
if (allThrownPotions.size() > 1024)
|
||||
{
|
||||
allThrownPotions.remove(0); // Remove the first element in the set.
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
final Material droppedItem = event.getPotion().getItem().getType();
|
||||
final Location location = player.getLocation();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
public List<Map.Entry<ThrownPotion, Long>> getPlayerThrownPotions(Player player)
|
||||
{
|
||||
if (plugin.al.isAdmin(p) && plugin.al.getAdmin(p).getPotionSpy())
|
||||
List<Map.Entry<ThrownPotion, Long>> thrownPotions = new ArrayList<>();
|
||||
|
||||
for (Map.Entry<ThrownPotion, Long> potionEntry : allThrownPotions)
|
||||
{
|
||||
FUtil.playerMsg(p, potionSpyPrefix + ChatColor.WHITE + player.getName() + " splashed " + event.getEntity().getItem().getAmount() + " " + droppedItem + " at X: " + decimalFormat.format(location.getX()) + ", Y: " + decimalFormat.format(location.getY()) + ", Z: " + decimalFormat.format(location.getZ()) + ", in the world '" + location.getWorld().getName() + "'.");
|
||||
ThrownPotion potion = potionEntry.getKey();
|
||||
if (potion.getShooter() != null && potion.getShooter().equals(player))
|
||||
{
|
||||
thrownPotions.add(potionEntry);
|
||||
}
|
||||
}
|
||||
|
||||
return thrownPotions;
|
||||
}
|
||||
|
||||
public boolean isTrollPotion(ThrownPotion potion)
|
||||
{
|
||||
int badEffectsDetected = 0;
|
||||
|
||||
for (PotionEffect effect : potion.getEffects())
|
||||
{
|
||||
if (badPotionEffects.contains(effect.getType()) && effect.getAmplifier() > 2 && effect.getDuration() > 200)
|
||||
{
|
||||
badEffectsDetected++;
|
||||
}
|
||||
}
|
||||
|
||||
return badEffectsDetected > 0;
|
||||
}
|
||||
}
|
34
src/main/java/me/totalfreedom/totalfreedommod/Sitter.java
Normal file
34
src/main/java/me/totalfreedom/totalfreedommod/Sitter.java
Normal file
@ -0,0 +1,34 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -20,7 +20,9 @@ import me.totalfreedom.totalfreedommod.blocking.command.CommandBlocker;
|
||||
import me.totalfreedom.totalfreedommod.bridge.BukkitTelnetBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.CoreProtectBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.EssentialsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.FAWEBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.LibsDisguisesBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.TFGuildsBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
||||
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||
@ -133,6 +135,9 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public WorldRestrictions wr;
|
||||
public SignBlocker snp;
|
||||
public EntityWiper ew;
|
||||
public Sitter st;
|
||||
public VanishHandler vh;
|
||||
|
||||
//public HubWorldRestrictions hwr;
|
||||
//
|
||||
// Bridges
|
||||
@ -140,7 +145,9 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
public EssentialsBridge esb;
|
||||
public LibsDisguisesBridge ldb;
|
||||
public CoreProtectBridge cpb;
|
||||
public TFGuildsBridge tfg;
|
||||
public WorldEditBridge web;
|
||||
public FAWEBridge fab;
|
||||
public WorldGuardBridge wgb;
|
||||
|
||||
@Override
|
||||
@ -174,33 +181,20 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
FUtil.deleteFolder(new File("./_deleteme"));
|
||||
|
||||
fsh = new FreedomServiceHandler();
|
||||
|
||||
config = new MainConfig();
|
||||
config.load();
|
||||
|
||||
cl = new CommandLoader();
|
||||
|
||||
Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command");
|
||||
|
||||
Set<Class<? extends FreedomCommand>> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class);
|
||||
|
||||
for (Class<? extends FreedomCommand> commandClass : commandClasses)
|
||||
{
|
||||
try
|
||||
{
|
||||
cl.add(commandClass.newInstance());
|
||||
}
|
||||
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
|
||||
{
|
||||
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_" , ""));
|
||||
}
|
||||
}
|
||||
cl.loadCommands();
|
||||
|
||||
BackupManager backups = new BackupManager();
|
||||
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
||||
backups.createBackups(PermbanList.CONFIG_FILENAME);
|
||||
backups.createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
|
||||
backups.createBackups(PunishmentList.CONFIG_FILENAME);
|
||||
backups.createBackups("database.db");
|
||||
backups.createAllBackups();
|
||||
|
||||
config = new MainConfig(this);
|
||||
config.load();
|
||||
if (FUtil.inDeveloperMode())
|
||||
{
|
||||
FLog.debug("Developer mode enabled.");
|
||||
}
|
||||
|
||||
permissions = new PermissionConfig(this);
|
||||
permissions.load();
|
||||
@ -238,6 +232,8 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
gr = new GameRuleHandler();
|
||||
snp = new SignBlocker();
|
||||
ew = new EntityWiper();
|
||||
st = new Sitter();
|
||||
vh = new VanishHandler();
|
||||
|
||||
// Single admin utils
|
||||
cs = new CommandSpy();
|
||||
@ -252,7 +248,6 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
ae = new AutoEject();
|
||||
mo = new Monitors();
|
||||
|
||||
|
||||
mv = new MovementValidator();
|
||||
sp = new ServerPing();
|
||||
|
||||
@ -271,11 +266,15 @@ public class TotalFreedomMod extends JavaPlugin
|
||||
cpb = new CoreProtectBridge();
|
||||
esb = new EssentialsBridge();
|
||||
ldb = new LibsDisguisesBridge();
|
||||
tfg = new TFGuildsBridge();
|
||||
web = new WorldEditBridge();
|
||||
fab = new FAWEBridge();
|
||||
wgb = new WorldGuardBridge();
|
||||
|
||||
for (FreedomService service : fsh.getServices())
|
||||
{
|
||||
service.onStart();
|
||||
}
|
||||
|
||||
FLog.info("Started " + fsh.getServiceAmount() + "services.");
|
||||
|
||||
|
@ -0,0 +1,83 @@
|
||||
package me.totalfreedom.totalfreedommod;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
public class VanishHandler extends FreedomService
|
||||
{
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(player) && plugin.al.isVanished(p.getName()))
|
||||
{
|
||||
player.hidePlayer(plugin, p);
|
||||
}
|
||||
}
|
||||
|
||||
for (Player p : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(p) && plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
p.hidePlayer(plugin, player);
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
plugin.esb.setVanished(player.getName(), true);
|
||||
FLog.info(player.getName() + " joined while still vanished.");
|
||||
plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has joined silently.");
|
||||
event.setJoinMessage(null);
|
||||
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
this.cancel();
|
||||
}
|
||||
|
||||
player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD + "You are hidden from other players."));
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 4L);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerLeave(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
event.setQuitMessage(null);
|
||||
FLog.info(player.getName() + " left while still vanished.");
|
||||
plugin.al.messageAllAdmins(ChatColor.YELLOW + player.getName() + " has left silently.");
|
||||
}
|
||||
}
|
||||
}
|
@ -119,6 +119,19 @@ public class ActivityLogEntry implements IConfig
|
||||
ips.clear();
|
||||
}
|
||||
|
||||
public int getTotalSecondsPlayed()
|
||||
{
|
||||
int result = 0;
|
||||
for (String duration : durations)
|
||||
{
|
||||
String[] spl = duration.split(" ");
|
||||
result += Integer.parseInt(spl[0]) * 60 * 60;
|
||||
result += Integer.parseInt(spl[2]) * 60;
|
||||
result += Integer.parseInt(spl[5]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid()
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ public class AdminList extends FreedomService
|
||||
private final Map<String, Admin> ipTable = Maps.newHashMap();
|
||||
public final List<String> verifiedNoAdmins = new ArrayList<>();
|
||||
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
||||
public static ArrayList<Player> vanished = new ArrayList<>();
|
||||
public static List<String> vanished = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
@ -302,8 +302,6 @@ public class AdminList extends FreedomService
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
plugin.wm.adminworld.wipeAccessCache();
|
||||
}
|
||||
|
||||
public Set<String> getAdminNames()
|
||||
@ -364,4 +362,9 @@ public class AdminList extends FreedomService
|
||||
|
||||
updateTables();
|
||||
}
|
||||
|
||||
public boolean isVanished(String player)
|
||||
{
|
||||
return vanished.contains(player);
|
||||
}
|
||||
}
|
@ -166,7 +166,20 @@ public class Ban implements IConfig
|
||||
{
|
||||
final StringBuilder message = new StringBuilder(ChatColor.GOLD + "You");
|
||||
|
||||
message.append(!hasUsername() ? "r IP address is" : " are").append(" temporarily banned from this server.");
|
||||
if (!hasUsername())
|
||||
{
|
||||
message.append("r IP address is");
|
||||
}
|
||||
else if (!hasIps())
|
||||
{
|
||||
message.append("r username is");
|
||||
}
|
||||
else
|
||||
{
|
||||
message.append(" are");
|
||||
}
|
||||
|
||||
message.append(" temporarily banned from this server.");
|
||||
message.append("\nAppeal at ").append(ChatColor.BLUE)
|
||||
.append(ConfigEntry.SERVER_BAN_URL.getString());
|
||||
|
||||
|
@ -208,7 +208,8 @@ public class EventBlocker extends FreedomService
|
||||
// TODO: Revert back to old redstone block system when (or if) it is fixed in Bukkit, Spigot or Paper.
|
||||
private ArrayList<Material> redstoneBlocks = new ArrayList<>(Arrays.asList(Material.REDSTONE, Material.DISPENSER, Material.DROPPER, Material.REDSTONE_LAMP));
|
||||
@EventHandler
|
||||
public void onBlockPhysics(BlockPhysicsEvent event) {
|
||||
public void onBlockPhysics(BlockPhysicsEvent event)
|
||||
{
|
||||
if (!ConfigEntry.ALLOW_REDSTONE.getBoolean())
|
||||
{
|
||||
// Check if the block is involved with redstone.
|
||||
|
@ -5,9 +5,11 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.Groups;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.player.PlayerBedEnterEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@ -53,13 +55,24 @@ public class InteractBlocker extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onBedEnter(PlayerBedEnterEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
if (Groups.EXPLOSIVE_BED_BIOMES.contains(event.getBed().getBiome()))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You may not sleep here.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
private void handleRightClick(PlayerInteractEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (event.getClickedBlock() != null)
|
||||
{
|
||||
if (event.getClickedBlock().getType().equals(Material.STRUCTURE_BLOCK) || event.getClickedBlock().getType().equals(Material.JIGSAW))
|
||||
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.getPlayer().closeInventory();
|
||||
@ -74,15 +87,6 @@ public class InteractBlocker extends FreedomService
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: lookup new biomes that have bed explosions in 1.16
|
||||
|
||||
/*if (Groups.BED_COLORS.contains(event.getMaterial()) && event.getClickedBlock().getBiome().equals(Biome.NETHER))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You can't sleep in hell.");
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}*/
|
||||
|
||||
switch (event.getMaterial())
|
||||
{
|
||||
case WATER_BUCKET:
|
||||
|
@ -0,0 +1,174 @@
|
||||
package me.totalfreedom.totalfreedommod.bridge;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.sk89q.worldedit.EditSession;
|
||||
import com.sk89q.worldedit.function.pattern.Pattern;
|
||||
import com.sk89q.worldedit.math.BlockVector3;
|
||||
import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.world.block.BaseBlock;
|
||||
import java.util.AbstractMap;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import net.coreprotect.CoreProtectAPI;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
public class FAWEBridge extends FreedomService
|
||||
{
|
||||
private CoreProtectAPI api;
|
||||
private World world = null;
|
||||
private final Map<Map.Entry<String, EditSession>, Map<BlockVector3, String>> blocksBroken = new HashMap<>();
|
||||
private final Map<Map.Entry<String, EditSession>, Map.Entry<Pattern, List<BlockVector3>>> blocksPlaced = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void onStart()
|
||||
{
|
||||
api = plugin.cpb.getCoreProtectAPI();
|
||||
|
||||
/*
|
||||
* Iterates over blocks placed by GenerationCommands (in the EditSession) and adds them to the CoreProtect logs.
|
||||
*/
|
||||
server.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (!(blocksBroken.isEmpty() && blocksPlaced.isEmpty()))
|
||||
{
|
||||
// Send all broken blocks from the last ticks to the CoreProtect API.
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = null;
|
||||
for (Map.Entry<Map.Entry<String, EditSession>, Map<BlockVector3, String>> entry : blocksBroken.entrySet())
|
||||
{
|
||||
playerAndSessionEntry = entry.getKey();
|
||||
Map<BlockVector3, String> dataAndVectorEntry = entry.getValue();
|
||||
List<BlockVector3> blockVector3List = new ArrayList<>();
|
||||
blockVector3List.addAll(dataAndVectorEntry.keySet()); // Deep clone the block vector to avoid a change later in the code.
|
||||
|
||||
for (BlockVector3 blockVector3 : blockVector3List)
|
||||
{
|
||||
if (blockVector3 != null)
|
||||
{
|
||||
EditSession editSession = playerAndSessionEntry.getValue();
|
||||
World world = server.getWorld(editSession.getWorld().getName());
|
||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
BlockData blockData = server.createBlockData(dataAndVectorEntry.get(blockVector3));
|
||||
api.logRemoval(playerAndSessionEntry.getKey(), location, blockData.getMaterial(), blockData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Clear after broken blocks have been updated.
|
||||
blocksBroken.values().clear();
|
||||
blocksBroken.putIfAbsent(playerAndSessionEntry, new HashMap<>());
|
||||
|
||||
// Send all blocks placed to the CoreProtect API (except from the air as it's only a broken block).
|
||||
for (Map.Entry<Map.Entry<String, EditSession>, Map.Entry<Pattern, List<BlockVector3>>> entry : blocksPlaced.entrySet())
|
||||
{
|
||||
playerAndSessionEntry = entry.getKey();
|
||||
Map.Entry<Pattern, List<BlockVector3>> patternAndListEntry = entry.getValue();
|
||||
Pattern pattern = patternAndListEntry.getKey();
|
||||
List<BlockVector3> blockVector3List = new ArrayList<>();
|
||||
blockVector3List.addAll(patternAndListEntry.getValue()); // Deep clone the block vector to avoid a change later in the code.
|
||||
|
||||
for (BlockVector3 blockVector3 : blockVector3List)
|
||||
{
|
||||
if (blockVector3 != null && !pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
||||
{
|
||||
World world = server.getWorld(playerAndSessionEntry.getValue().getWorld().getName());
|
||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||
BaseBlock block = pattern.apply(blockVector3);
|
||||
Material material = Material.getMaterial(block.getBlockType().getId().replaceFirst("minecraft:", "").toUpperCase());
|
||||
api.logPlacement(playerAndSessionEntry.getKey(), location, material, material.createBlockData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
blocksPlaced.values().forEach(collection -> collection.getValue().clear());
|
||||
}
|
||||
}
|
||||
}, 0L, 40L);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, BlockVector3 blockVector3)
|
||||
{
|
||||
// Cache the world used for the next iterations to come.
|
||||
if (world == null || !world.getName().equals(editSession.getWorld().getName()))
|
||||
{
|
||||
world = server.getWorld(editSession.getWorld().getName());
|
||||
}
|
||||
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||
Block block = world.getBlockAt(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ());
|
||||
|
||||
// Add the broken block to CoreProtect if it's not air.
|
||||
if (!block.getType().isAir())
|
||||
{
|
||||
String blockData = block.getBlockData().getAsString();
|
||||
blockData = new Gson().fromJson(new Gson().toJson(blockData), blockData.getClass()); // Overwrite original with deep clones.
|
||||
blockVector3 = new Gson().fromJson(new Gson().toJson(blockVector3), blockVector3.getClass()); // Overwrite original with deep clones.
|
||||
blocksBroken.putIfAbsent(playerAndSessionEntry, new HashMap<>());
|
||||
blocksBroken.get(playerAndSessionEntry).put(blockVector3, blockData);
|
||||
}
|
||||
|
||||
// Add the placed block to CoreProtect if it's not air.
|
||||
if (!pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
||||
{
|
||||
blocksPlaced.putIfAbsent(playerAndSessionEntry, new AbstractMap.SimpleEntry<>(pattern, new ArrayList<>()));
|
||||
blocksPlaced.get(playerAndSessionEntry).getValue().add(new Gson().fromJson(new Gson().toJson(blockVector3), blockVector3.getClass()));
|
||||
}
|
||||
}
|
||||
|
||||
public void logBlockEdits(String playerName, EditSession editSession, Region region, Pattern pattern)
|
||||
{
|
||||
// Add the broken blocks to CoreProtect.
|
||||
World world = server.getWorld(region.getWorld().getName());
|
||||
List<Block> blocks = new ArrayList<>();
|
||||
|
||||
for (BlockVector3 blockVector3 : region)
|
||||
{
|
||||
blocks.add(world.getBlockAt(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()));
|
||||
}
|
||||
|
||||
logBlockEdit(playerName, editSession, pattern, blocks);
|
||||
}
|
||||
|
||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, List<Block> blocks)
|
||||
{
|
||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||
|
||||
server.getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
||||
{
|
||||
for (Block block : blocks)
|
||||
{
|
||||
BlockVector3 blockVector3 = BlockVector3.at(block.getX(), block.getY(), block.getZ());
|
||||
|
||||
// Add the broken block to CoreProtect if it's not air.
|
||||
if (!block.getType().isAir())
|
||||
{
|
||||
api.logRemoval(playerAndSessionEntry.getKey(), block.getLocation(), block.getType(), block.getBlockData());
|
||||
}
|
||||
|
||||
// Add the placed block to CoreProtect if it's not air.
|
||||
BaseBlock baseBlock = pattern.apply(blockVector3);
|
||||
if (!baseBlock.getBlockType().getMaterial().isAir())
|
||||
{
|
||||
Material material = Material.getMaterial(baseBlock.getBlockType().getId().replaceFirst("minecraft:", "").toUpperCase());
|
||||
api.logPlacement(playerAndSessionEntry.getKey(), block.getLocation(), material, material.createBlockData());
|
||||
}
|
||||
}
|
||||
}, 0L);
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
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.IN_GUILD_CHAT.contains(player);
|
||||
}
|
||||
}
|
@ -3,8 +3,11 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import lombok.Getter;
|
||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
public class CommandLoader extends FreedomService
|
||||
{
|
||||
@ -52,6 +55,26 @@ public class CommandLoader extends FreedomService
|
||||
return false;
|
||||
}
|
||||
|
||||
public void loadCommands()
|
||||
{
|
||||
Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command");
|
||||
|
||||
Set<Class<? extends FreedomCommand>> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class);
|
||||
|
||||
for (Class<? extends FreedomCommand> commandClass : commandClasses)
|
||||
{
|
||||
try
|
||||
{
|
||||
FLog.debug("Loading command class " + commandClass.getSimpleName());
|
||||
add(commandClass.newInstance());
|
||||
}
|
||||
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
|
||||
{
|
||||
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_" , ""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public int getCommandAmount()
|
||||
{
|
||||
return commands.size();
|
||||
|
@ -8,9 +8,9 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
public @interface CommandPermissions
|
||||
{
|
||||
|
||||
Rank level();
|
||||
Rank level() default Rank.IMPOSTOR;
|
||||
|
||||
SourceType source();
|
||||
SourceType source() default SourceType.BOTH;
|
||||
|
||||
boolean blockHostConsole() default false;
|
||||
|
||||
|
@ -4,7 +4,6 @@ import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.world.WorldTime;
|
||||
import me.totalfreedom.totalfreedommod.world.WorldWeather;
|
||||
import org.bukkit.World;
|
||||
@ -13,15 +12,15 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Allows for admins to configure guests, time, and weather of the AdminWorld, and allows for admins and guests to go to the AdminWorld.",
|
||||
usage = "/<command> [guest < list | purge | add <player> | remove <player> > | time <morning | noon | evening | night> | weather <off | rain | storm>]",
|
||||
@CommandParameters(description = "Allows for admins to configure time, and weather of the AdminWorld, and allows for admins and ops to go to the AdminWorld.",
|
||||
usage = "/<command> [time <morning | noon | evening | night> | weather <off | rain | storm>]",
|
||||
aliases = "aw")
|
||||
public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
|
||||
private enum CommandMode
|
||||
{
|
||||
TELEPORT, GUEST, TIME, WEATHER
|
||||
TELEPORT, TIME, WEATHER
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -35,11 +34,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
else if (args.length >= 2)
|
||||
{
|
||||
if ("guest".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
commandMode = CommandMode.GUEST;
|
||||
}
|
||||
else if ("time".equalsIgnoreCase(args[0]))
|
||||
if ("time".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
commandMode = CommandMode.TIME;
|
||||
}
|
||||
@ -62,7 +57,7 @@ public class Command_adminworld extends FreedomCommand
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
World adminWorld = null;
|
||||
@ -80,79 +75,10 @@ public class Command_adminworld extends FreedomCommand
|
||||
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (plugin.wm.adminworld.canAccessWorld(playerSender))
|
||||
{
|
||||
msg("Going to the AdminWorld.");
|
||||
plugin.wm.adminworld.sendToWorld(playerSender);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You don't have permission to access the AdminWorld.");
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
case GUEST:
|
||||
{
|
||||
if (args.length == 2)
|
||||
{
|
||||
if ("list".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
msg("AdminWorld guest list: " + plugin.wm.adminworld.guestListToString());
|
||||
}
|
||||
else if ("purge".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
assertCommandPerms(sender, playerSender);
|
||||
plugin.wm.adminworld.purgeGuestList();
|
||||
FUtil.adminAction(sender.getName(), "AdminWorld guest list purged.", false);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (args.length == 3)
|
||||
{
|
||||
assertCommandPerms(sender, playerSender);
|
||||
|
||||
if ("add".equalsIgnoreCase(args[1]))
|
||||
{
|
||||
final Player player = getPlayer(args[2]);
|
||||
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.wm.adminworld.addGuest(player, playerSender))
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "AdminWorld guest added: " + player.getName(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Could not add player to guest list.");
|
||||
}
|
||||
}
|
||||
else if ("remove".equals(args[1]))
|
||||
{
|
||||
final Player player = plugin.wm.adminworld.removeGuest(args[2]);
|
||||
if (player != null)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "AdminWorld guest removed: " + player.getName(), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("Can't find guest entry for: " + args[2]);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
@ -257,15 +183,11 @@ public class Command_adminworld extends FreedomCommand
|
||||
}
|
||||
if (args.length == 1)
|
||||
{
|
||||
return Arrays.asList("guest", "time", "weather");
|
||||
return Arrays.asList("time", "weather");
|
||||
}
|
||||
else if (args.length == 2)
|
||||
{
|
||||
if (args[0].equals("guest"))
|
||||
{
|
||||
return Arrays.asList("add", "remove", "list", "purge");
|
||||
}
|
||||
else if (args[0].equals("time"))
|
||||
if (args[0].equals("time"))
|
||||
{
|
||||
return Arrays.asList("morning", "noon", "evening", "night");
|
||||
}
|
||||
@ -274,21 +196,6 @@ public class Command_adminworld extends FreedomCommand
|
||||
return Arrays.asList("off", "rain", "storm");
|
||||
}
|
||||
}
|
||||
else if (args.length == 3)
|
||||
{
|
||||
if (args[0].equals("guest"))
|
||||
{
|
||||
if (args[1].equals("add"))
|
||||
{
|
||||
return FUtil.getPlayerList();
|
||||
}
|
||||
else if (args[1].equals("remove"))
|
||||
{
|
||||
return plugin.wm.adminworld.getGuestList();
|
||||
}
|
||||
}
|
||||
}
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,82 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Bans the specified ip.", usage = "/<command> <ip> [reason] [-q]")
|
||||
public class Command_banip extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
|
||||
String reason = null;
|
||||
|
||||
String ip = args[0];
|
||||
|
||||
if (!FUtil.isValidIPv4(ip))
|
||||
{
|
||||
msg(ip + " is not a valid IP address", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (plugin.bm.getByIp(ip) != null)
|
||||
{
|
||||
msg("The IP " + ip + " is already banned", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
silent = true;
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
|
||||
// Ban player
|
||||
Ban ban = Ban.forPlayerIp(ip, sender, null, reason);
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
// Kick player and handle others on IP
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (FUtil.getIp(player).equals(ip))
|
||||
{
|
||||
player.kickPlayer(ban.bakeKickMessage());
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
// Broadcast
|
||||
FLog.info(ChatColor.RED + sender.getName() + " - Banned the IP " + ip);
|
||||
String message = ChatColor.RED + sender.getName() + " - Banned " + (plugin.al.isAdmin(player) ? "the IP " + ip : "an IP");
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Bans the specified name.", usage = "/<command> <name> [reason] [-q]")
|
||||
public class Command_banname extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
|
||||
String reason = null;
|
||||
|
||||
String name = args[0];;
|
||||
|
||||
if (plugin.bm.getByUsername(name) != null)
|
||||
{
|
||||
msg("The name " + name + " is already banned", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
silent = true;
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
|
||||
// Ban player
|
||||
Ban ban = Ban.forPlayerName(name, sender, null, reason);
|
||||
plugin.bm.addBan(ban);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Banned the name " + name, true);
|
||||
}
|
||||
|
||||
Player player = getPlayer(name);
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(ban.bakeKickMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -73,12 +73,16 @@ public class Command_blockcmd extends FreedomCommand
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
|
||||
playerdata.setCommandsBlocked(!playerdata.allCommandsBlocked());
|
||||
|
||||
FUtil.adminAction(sender.getName(), (playerdata.allCommandsBlocked() ? "B" : "Unb") + "locking all commands for " + player.getName(), true);
|
||||
msg((playerdata.allCommandsBlocked() ? "B" : "Unb") + "locked all commands.");
|
||||
|
||||
if (!playerdata.allCommandsBlocked())
|
||||
{
|
||||
playerdata.setCommandsBlocked(true);
|
||||
FUtil.adminAction(sender.getName(), "Blocking all commands for " + player.getName(), true);
|
||||
msg("Blocked commands for " + player.getName() + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That players commands are already blocked.", ChatColor.RED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -47,6 +47,11 @@ public class Command_cage extends FreedomCommand
|
||||
}
|
||||
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
if (fPlayer.getCageData().isCaged())
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "That player is already caged.");
|
||||
return true;
|
||||
}
|
||||
|
||||
Material outerMaterial = Material.GLASS;
|
||||
Material innerMaterial = Material.AIR;
|
||||
|
@ -1,28 +1,30 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.stream.IntStream;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Clears the chat for players who are not opt-out.", usage = "/<command>", aliases = "cc")
|
||||
@CommandParameters(description = "Clears the chat.", usage = "/<command>", aliases = "cc")
|
||||
public class Command_clearchat extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
IntStream.range(0, 100).mapToObj(i -> "").forEach(player::sendMessage);
|
||||
for (int i = 0; i < 100; i++)
|
||||
{
|
||||
player.sendMessage("");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Cleared chat", true);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -14,12 +14,11 @@ public class Command_cmdspy extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
admin.setCommandSpy(!admin.getCommandSpy());
|
||||
msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled."));
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
msg("CommandSpy " + (admin.getCommandSpy() ? "enabled." : "disabled."));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Makes random sounds to everyone online.", usage = "/<command>")
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Makes random sounds.", usage = "/<command>")
|
||||
public class Command_deafen extends FreedomCommand
|
||||
{
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class Command_deop extends FreedomCommand
|
||||
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|
||||
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
|
||||
{
|
||||
if (player.isOp() && !AdminList.vanished.contains(player))
|
||||
if (player.isOp() && !AdminList.vanished.contains(player.getName()))
|
||||
{
|
||||
matchedPlayerNames.add(player.getName());
|
||||
player.setOp(false);
|
||||
|
@ -63,9 +63,16 @@ public class Command_doom extends FreedomCommand
|
||||
// Deop
|
||||
player.setOp(false);
|
||||
|
||||
String reason = null;
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
|
||||
// Ban player
|
||||
Ban ban = Ban.forPlayer(player, sender);
|
||||
ban.setReason("&cFUCKOFF");
|
||||
ban.setReason((reason == null ? "FUCKOFF" : reason));
|
||||
for (String playerIp : plugin.pl.getData(player).getIps())
|
||||
{
|
||||
ban.addIp(playerIp);
|
||||
@ -88,13 +95,6 @@ public class Command_doom extends FreedomCommand
|
||||
// Shoot the player in the sky
|
||||
player.setVelocity(player.getVelocity().clone().add(new Vector(0, 20, 0)));
|
||||
|
||||
String reason = null;
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
|
||||
final String kickReason = (reason == null ? "FUCKOFF, and get your shit together!" : reason);
|
||||
|
||||
// Log doom
|
||||
|
@ -64,7 +64,14 @@ public class Command_entitywipe extends FreedomCommand
|
||||
{
|
||||
count = plugin.ew.wipeEntities(bypassBlacklist);
|
||||
}
|
||||
msg(count + " " + (type != null ? entityName : "entities") + FUtil.showS(count) + " removed.");
|
||||
if (count == 1)
|
||||
{
|
||||
msg(count + " " + (type != null ? entityName : "entity") + " removed.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(count + " " + (type != null ? entityName : "entitie") + FUtil.showS(count) + " removed.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1,188 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
||||
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||
@CommandParameters(description = "Bans or unbans any player, including those offline.", usage = "/<command> <ban <username> [reason] | unban <username> | banip <ip> <reason> | unbanip <ip> | nameban <name> | unbanname <name>>")
|
||||
public class Command_glist extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
String username = null;
|
||||
final List<String> ips = new ArrayList<>();
|
||||
boolean usingIp = false;
|
||||
String banIp = null;
|
||||
if (args[1].matches("^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$") || args[1].matches("^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([*])\\.([*])$"))
|
||||
{
|
||||
usingIp = true;
|
||||
banIp = args[1];
|
||||
}
|
||||
final Player player = getPlayer(args[1]);
|
||||
if (!usingIp)
|
||||
{
|
||||
if (player == null)
|
||||
{
|
||||
final PlayerData entry = plugin.pl.getData(args[1]);
|
||||
|
||||
if (entry == null)
|
||||
{
|
||||
msg("Can't find that user. If target is not logged in, make sure that you spelled the name exactly.");
|
||||
return true;
|
||||
}
|
||||
|
||||
username = entry.getName();
|
||||
ips.addAll(entry.getIps());
|
||||
}
|
||||
else
|
||||
{
|
||||
final PlayerData entry = plugin.pl.getData(player);
|
||||
username = entry.getName();
|
||||
ips.addAll(entry.getIps());
|
||||
}
|
||||
}
|
||||
switch (args[0])
|
||||
{
|
||||
case "ban":
|
||||
case "gtfo":
|
||||
if (usingIp)
|
||||
{
|
||||
msg("Please specify a player, not an ip.");
|
||||
return true;
|
||||
}
|
||||
final String playerBanReason = args.length > 2 ? StringUtils.join(args, " ", 2, args.length) : null;
|
||||
Ban playerBan = Ban.forPlayerName(username, sender, null, playerBanReason);
|
||||
for (String ip : ips)
|
||||
{
|
||||
playerBan.addIp(ip);
|
||||
playerBan.addIp(FUtil.getFuzzyIp(ip));
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Banning " + username, true);
|
||||
playerMsg(sender, ChatColor.GRAY + username + " has been banned and IP is: " + StringUtils.join(ips, ", "));
|
||||
|
||||
plugin.bm.addBan(playerBan);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(playerBan.bakeKickMessage());
|
||||
}
|
||||
|
||||
plugin.pul.logPunishment(new Punishment(username, ips.get(0), sender.getName(), PunishmentType.BAN, null));
|
||||
|
||||
return true;
|
||||
case "unban":
|
||||
case "pardon":
|
||||
if (usingIp)
|
||||
{
|
||||
msg("Please specify a player, not an ip.");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Unbanning " + username, true);
|
||||
playerMsg(sender, ChatColor.GRAY + username + " has been unbanned and IP is: " + StringUtils.join(ips, ", "));
|
||||
plugin.bm.removeBan(plugin.bm.getByUsername(username));
|
||||
|
||||
for (String ip : ips)
|
||||
{
|
||||
Ban playerUnban = plugin.bm.getByIp(ip);
|
||||
if (playerUnban != null)
|
||||
{
|
||||
plugin.bm.removeBan(playerUnban);
|
||||
}
|
||||
playerUnban = plugin.bm.getByIp(FUtil.getFuzzyIp(ip));
|
||||
if (playerUnban != null)
|
||||
{
|
||||
plugin.bm.removeBan(playerUnban);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case "nameban":
|
||||
case "banname":
|
||||
if (usingIp)
|
||||
{
|
||||
msg("Please specify a name, not an ip.");
|
||||
return true;
|
||||
}
|
||||
final String nameBanReason = args.length > 2 ? StringUtils.join(args, " ", 2, args.length) : null;
|
||||
Ban nameBan = Ban.forPlayerName(username, sender, null, nameBanReason);
|
||||
FUtil.adminAction(sender.getName(), "Banning IGN: " + username, true);
|
||||
plugin.bm.addBan(nameBan);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
player.kickPlayer(nameBan.bakeKickMessage());
|
||||
}
|
||||
|
||||
return true;
|
||||
case "unbanname":
|
||||
case "nameunban":
|
||||
if (usingIp)
|
||||
{
|
||||
msg("Please specify a name, not an ip.");
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Unbanning IGN: " + username, true);
|
||||
plugin.bm.removeBan(plugin.bm.getByUsername(username));
|
||||
return true;
|
||||
case "banip":
|
||||
case "ipban":
|
||||
if (!usingIp)
|
||||
{
|
||||
msg("Please specify an IP.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final String ipBanReason = args.length > 2 ? StringUtils.join(args, " ", 2, args.length) : null;
|
||||
Ban ipBan = Ban.forPlayerIp(banIp, sender, null, ipBanReason);
|
||||
plugin.bm.addBan(ipBan);
|
||||
FUtil.adminAction(sender.getName(), "Banned an IP", true);
|
||||
playerMsg(sender, ChatColor.GRAY + "Banned IP: " + banIp);
|
||||
return true;
|
||||
case "unbanip":
|
||||
case "pardonip":
|
||||
if (!usingIp)
|
||||
{
|
||||
msg("Please specify an IP.");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Unbanned an IP", true);
|
||||
playerMsg(sender, ChatColor.GRAY + "Unbanned IP: " + banIp);
|
||||
Ban ipUnban = plugin.bm.getByIp(banIp);
|
||||
if (ipUnban != null)
|
||||
{
|
||||
plugin.bm.removeBan(ipUnban);
|
||||
plugin.bm.unbanIp(banIp);
|
||||
}
|
||||
ipUnban = plugin.bm.getByIp(FUtil.getFuzzyIp(banIp));
|
||||
if (ipUnban != null)
|
||||
{
|
||||
plugin.bm.removeBan(ipUnban);
|
||||
plugin.bm.unbanIp(banIp);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,7 @@ public class Command_hubworld extends FreedomCommand
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
World hubWorld = null;
|
||||
@ -198,5 +198,4 @@ public class Command_hubworld extends FreedomCommand
|
||||
super(string);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -16,6 +16,7 @@ import org.bukkit.potion.PotionEffectType;
|
||||
@CommandParameters(description = "Shows (optionally clears) invisible players", usage = "/<command> [clear]")
|
||||
public class Command_invis extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -42,7 +43,7 @@ public class Command_invis extends FreedomCommand
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.vanished.contains(player))
|
||||
if (player.hasPotionEffect(PotionEffectType.INVISIBILITY) && !plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (clear && !plugin.al.isAdmin(player))
|
||||
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Toggles jumppads on/off, view the status of jumppads, or make them sideways.", usage = "/<command> <on | off | info | sideways <on | off>>", aliases = "launchpads,jp")
|
||||
public class Command_jumppads extends FreedomCommand
|
||||
{
|
||||
|
@ -3,7 +3,9 @@ package me.totalfreedom.totalfreedommod.command;
|
||||
import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
@ -11,7 +13,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Kick the specified player.", usage = "/<command> <player> [reason]", aliases = "k")
|
||||
@CommandParameters(description = "Kick the specified player.", usage = "/<command> <player> [reason] [-q]")
|
||||
public class Command_kick extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
@ -30,10 +32,24 @@ public class Command_kick extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
|
||||
String reason = null;
|
||||
if (args.length > 1)
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
{
|
||||
reason = StringUtils.join(args, " ", 1, args.length);
|
||||
silent = true;
|
||||
FLog.debug("silent");
|
||||
|
||||
if (args.length >= 2)
|
||||
{
|
||||
FLog.debug("set reason (silent)");
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length - 1), " ");
|
||||
}
|
||||
}
|
||||
else if (args.length > 1)
|
||||
{
|
||||
FLog.debug("set reason");
|
||||
reason = StringUtils.join(ArrayUtils.subarray(args, 1, args.length), " ");
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder()
|
||||
@ -43,12 +59,19 @@ public class Command_kick extends FreedomCommand
|
||||
if (reason != null)
|
||||
{
|
||||
builder.append("\n").append(ChatColor.RED).append("Reason: ").append(ChatColor.GOLD).append(reason);
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
if (reason != null)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Kicking " + player.getName() + " - Reason: " + reason, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Kicking " + player.getName(), true);
|
||||
}
|
||||
}
|
||||
|
||||
player.kickPlayer(builder.toString());
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class Command_linkdiscord extends FreedomCommand
|
||||
|
||||
if (Discord.LINK_CODES.containsValue(data))
|
||||
{
|
||||
code = Discord.getCode(data);
|
||||
code = plugin.dc.getCode(data);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -18,6 +18,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Lists the real names of all online players.", usage = "/<command> [-a | -i | -f | -v]", aliases = "who,lsit")
|
||||
public class Command_list extends FreedomCommand
|
||||
{
|
||||
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
if (args.length > 1)
|
||||
@ -108,11 +109,11 @@ public class Command_list extends FreedomCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.ADMINS && AdminList.vanished.contains(p))
|
||||
if (listFilter == ListFilter.ADMINS && AdminList.vanished.contains(p.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !AdminList.vanished.contains(p))
|
||||
if (listFilter == ListFilter.VANISHED_ADMINS && !AdminList.vanished.contains(p.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -124,7 +125,7 @@ public class Command_list extends FreedomCommand
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (listFilter == ListFilter.PLAYERS && AdminList.vanished.contains(p))
|
||||
if (listFilter == ListFilter.PLAYERS && AdminList.vanished.contains(p.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -0,0 +1,29 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Obtain a magical saddle.", usage = "/<command>")
|
||||
public class Command_magicalsaddle extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (plugin.pl.getData(playerSender).hasItem(ShopItem.MAGICAL_SADDLE))
|
||||
{
|
||||
playerSender.getInventory().addItem(plugin.sh.getMagicalSaddle());
|
||||
msg("You have been given a Magical Saddle", ChatColor.GREEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You do not own a Magical Saddle! Purchase one from the shop.", ChatColor.RED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -57,7 +57,7 @@ public class Command_masterbuilderworld extends FreedomCommand
|
||||
{
|
||||
if (!(sender instanceof Player) || playerSender == null)
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
World masterBuilderWorld = null;
|
||||
|
@ -142,8 +142,6 @@ public class Command_mute extends FreedomCommand
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Muting " + player.getName(), true);
|
||||
|
||||
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||
|
||||
if (smite)
|
||||
{
|
||||
Command_smite.smite(sender, player, reason);
|
||||
|
@ -153,9 +153,9 @@ public class Command_myadmin extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
int length = message.replace("%name%", "").replace("%rank%", "").replace("%coloredrank%", "").length();
|
||||
if (length > 64)
|
||||
if (length > 100)
|
||||
{
|
||||
msg("Your login message cannot be more than 64 characters (excluding your rank and your name)", ChatColor.RED);
|
||||
msg("Your login message cannot be more than 100 characters (excluding your rank and your name)", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
FUtil.adminAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
||||
|
@ -1,5 +1,9 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
@ -7,6 +11,7 @@ import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -15,16 +20,29 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "Essentials Interface Command - Remove illegal chatcodes from nicknames of one or all players on server.", usage = "/<command> [player]", aliases = "nc")
|
||||
public class Command_nickclean extends FreedomCommand
|
||||
{
|
||||
|
||||
private static final String[] BLOCK = ConfigEntry.BLOCKED_CHATCODES.getString().split(",");
|
||||
|
||||
private static final Pattern REGEX = Pattern.compile(FUtil.colorize(ChatColor.COLOR_CHAR + "[" + StringUtils.join(BLOCK, "") + "]"), Pattern.CASE_INSENSITIVE);
|
||||
private Map<String, Color> colorCodes = new HashMap<String, Color>()
|
||||
{{
|
||||
put("&0", Color.BLACK);
|
||||
put("&1", Color.BLUE);
|
||||
put("&2", Color.GREEN);
|
||||
put("&3", Color.TEAL);
|
||||
put("&4", Color.MAROON);
|
||||
put("&5", Color.FUCHSIA);
|
||||
put("&6", Color.OLIVE);
|
||||
put("&7", Color.SILVER);
|
||||
put("&8", Color.GRAY);
|
||||
put("&9", Color.NAVY);
|
||||
put("&a", Color.LIME);
|
||||
put("&b", Color.AQUA);
|
||||
put("&c", Color.RED);
|
||||
put("&d", Color.PURPLE);
|
||||
put("&e", Color.YELLOW);
|
||||
put("&f", Color.WHITE);
|
||||
}};
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
|
||||
|
||||
if (args.length > 1)
|
||||
{
|
||||
Player player = getPlayer(args[0]);
|
||||
@ -40,7 +58,6 @@ public class Command_nickclean extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Cleaning all nicknames", false);
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
@ -53,15 +70,81 @@ public class Command_nickclean extends FreedomCommand
|
||||
{
|
||||
final String playerName = player.getName();
|
||||
final String nickName = plugin.esb.getNickname(playerName);
|
||||
if (nickName != null && !nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName))
|
||||
StringBuilder newNick = new StringBuilder();
|
||||
boolean nickChanged = false;
|
||||
|
||||
if(nickName.contains("§x"))
|
||||
{
|
||||
// Detects colors that are similar to blocked codes.
|
||||
spliterator:
|
||||
for (String split : nickName.split("§x"))
|
||||
{
|
||||
List<Color> colors = new ArrayList<>();
|
||||
String hexColorSub = null;
|
||||
if (split.length() >= 12 && split.contains("§"))
|
||||
{
|
||||
hexColorSub = split.substring(0, 12);
|
||||
split = String.valueOf(split.charAt(12));
|
||||
String hexColorString = "#" + hexColorSub.replaceAll("§", "");
|
||||
java.awt.Color hexColor = java.awt.Color.decode(hexColorString);
|
||||
|
||||
// Get a range of nearby colors that are alike to the color blocked.
|
||||
Color colorFirst;
|
||||
Color colorSecond;
|
||||
|
||||
colorFirst = Color.fromRGB(Math.min(hexColor.getRed() + 20, 255), Math.min(hexColor.getGreen() + 20, 255), Math.min(hexColor.getBlue() + 20, 255));
|
||||
colorSecond = Color.fromRGB(Math.max(hexColor.getRed() - 20, 0), Math.max(hexColor.getGreen() - 20, 0), Math.max(hexColor.getBlue() - 20, 0));
|
||||
colors.addAll(FUtil.createColorGradient(colorFirst, colorSecond, 40));
|
||||
|
||||
colorFirst = Color.fromRGB(Math.min(hexColor.getRed() + 20, 255), Math.min(hexColor.getGreen(), 255), Math.min(hexColor.getBlue(), 255));
|
||||
colorSecond = Color.fromRGB(Math.max(hexColor.getRed() - 20, 0), Math.max(hexColor.getGreen(), 0), Math.max(hexColor.getBlue(), 0));
|
||||
colors.addAll(FUtil.createColorGradient(colorFirst, colorSecond, 40));
|
||||
|
||||
colorFirst = Color.fromRGB(Math.min(hexColor.getRed(), 255), Math.min(hexColor.getGreen() + 20, 255), Math.min(hexColor.getBlue(), 255));
|
||||
colorSecond = Color.fromRGB(Math.max(hexColor.getRed(), 0), Math.max(hexColor.getGreen() - 20, 0), Math.max(hexColor.getBlue(), 0));
|
||||
colors.addAll(FUtil.createColorGradient(colorFirst, colorSecond, 40));
|
||||
|
||||
colorFirst = Color.fromRGB(Math.min(hexColor.getRed(), 255), Math.min(hexColor.getGreen(), 255), Math.min(hexColor.getBlue() + 20, 255));
|
||||
colorSecond = Color.fromRGB(Math.max(hexColor.getRed(), 0), Math.max(hexColor.getGreen(), 0), Math.max(hexColor.getBlue() - 20, 0));
|
||||
colors.addAll(FUtil.createColorGradient(colorFirst, colorSecond, 40));
|
||||
|
||||
for (String colorCode : ConfigEntry.BLOCKED_CHATCODES.getString().split(","))
|
||||
{
|
||||
// Makes sure that there's hex colors in the split.
|
||||
for (Color color : colors)
|
||||
{
|
||||
if (colorCodes.get(colorCode) != null && FUtil.colorClose(color, colorCodes.get(colorCode), 40))
|
||||
{
|
||||
nickChanged = true;
|
||||
newNick.append(split);
|
||||
continue spliterator;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
newNick.append("§x").append(hexColorSub).append(split);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Falls back on old code if hex isn't used.
|
||||
final Pattern REGEX = Pattern.compile(FUtil.colorize(ChatColor.COLOR_CHAR + "[" + StringUtils.join(ConfigEntry.BLOCKED_CHATCODES.getString().split(","), "") + "]"), Pattern.CASE_INSENSITIVE);
|
||||
if (!nickName.isEmpty() && !nickName.equalsIgnoreCase(playerName))
|
||||
{
|
||||
final Matcher matcher = REGEX.matcher(nickName);
|
||||
if (matcher.find())
|
||||
{
|
||||
final String newNickName = matcher.replaceAll("");
|
||||
msg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNickName + ChatColor.RESET + "\".");
|
||||
plugin.esb.setNickname(playerName, newNickName);
|
||||
nickChanged = true;
|
||||
newNick.append(matcher.replaceAll(""));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(nickChanged)
|
||||
{
|
||||
msg(ChatColor.RESET + playerName + ": \"" + nickName + ChatColor.RESET + "\" -> \"" + newNick.toString() + ChatColor.RESET + "\".");
|
||||
}
|
||||
plugin.esb.setNickname(playerName, newNick.toString());
|
||||
}
|
||||
}
|
@ -41,11 +41,11 @@ public class Command_nickfilter extends FreedomCommand
|
||||
|
||||
player = getPlayerByDisplayName(displayName);
|
||||
|
||||
if (player == null || plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (player == null || plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
player = getPlayerByDisplayNameAlt(displayName);
|
||||
|
||||
if (player == null || !plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (player == null || !plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Can't find player by nickname: " + displayName);
|
||||
return true;
|
||||
|
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Essentials Interface Command - Rainbowify your nickname.", usage = "/<command> <hex> <hex> <nick>")
|
||||
@CommandParameters(description = "Essentials Interface Command - Rainbowify your nickname.", usage = "/<command> <hex> <hex> <nick>", aliases = "nickgr")
|
||||
public class Command_nickgradient extends FreedomCommand
|
||||
{
|
||||
|
||||
@ -45,10 +45,25 @@ public class Command_nickgradient extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
String from = "", to = "";
|
||||
java.awt.Color awt1, awt2;
|
||||
try
|
||||
{
|
||||
if (args[0].equalsIgnoreCase("random") ||
|
||||
args[0].equalsIgnoreCase("r"))
|
||||
{
|
||||
awt1 = FUtil.getRandomAWTColor();
|
||||
from = " (From: " + FUtil.getHexStringOfAWTColor(awt1) + ")";
|
||||
}
|
||||
else
|
||||
awt1 = java.awt.Color.decode(args[0]);
|
||||
if (args[1].equalsIgnoreCase("random") ||
|
||||
args[1].equalsIgnoreCase("r"))
|
||||
{
|
||||
awt2 = FUtil.getRandomAWTColor();
|
||||
to = " (To: " + FUtil.getHexStringOfAWTColor(awt2) + ")";
|
||||
}
|
||||
else
|
||||
awt2 = java.awt.Color.decode(args[1]);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
@ -69,7 +84,7 @@ public class Command_nickgradient extends FreedomCommand
|
||||
|
||||
plugin.esb.setNickname(sender.getName(), outputNick);
|
||||
|
||||
msg("Your nickname is now: " + outputNick);
|
||||
msg("Your nickname is now: '" + outputNick + ChatColor.GRAY + "'" + from + to);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -14,6 +14,7 @@ import org.bukkit.entity.Player;
|
||||
@CommandParameters(description = "OP a player", usage = "/<command> <partialname>")
|
||||
public class Command_op extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
@ -36,7 +37,7 @@ public class Command_op extends FreedomCommand
|
||||
if (player.getName().toLowerCase().contains(targetName) || player.getDisplayName().toLowerCase().contains(targetName)
|
||||
|| player.getName().contains(targetName) || player.getDisplayName().contains(targetName))
|
||||
{
|
||||
if (!player.isOp() && !AdminList.vanished.contains(player))
|
||||
if (!player.isOp() && !AdminList.vanished.contains(player.getName()))
|
||||
{
|
||||
matchedPlayerNames.add(player.getName());
|
||||
player.setOp(true);
|
||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandPermissions(level = Rank.NON_OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "OPs the command sender.", usage = "/<command>")
|
||||
public class Command_opme extends FreedomCommand
|
||||
{
|
||||
@ -17,7 +17,6 @@ public class Command_opme extends FreedomCommand
|
||||
FUtil.adminAction(sender.getName(), "Opping " + sender.getName(), false);
|
||||
sender.setOp(true);
|
||||
sender.sendMessage(FreedomCommand.YOU_ARE_OP);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import me.totalfreedom.totalfreedommod.admin.ActivityLogEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Gets your playtime statistics.", usage = "/<command>")
|
||||
public class Command_playtime extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole)
|
||||
{
|
||||
ActivityLogEntry entry = plugin.acl.getActivityLog(playerSender);
|
||||
int seconds = entry.getTotalSecondsPlayed();
|
||||
int minutes = 0;
|
||||
int hours = 0;
|
||||
while (seconds >= 60)
|
||||
{
|
||||
seconds -= 60;
|
||||
minutes += 1;
|
||||
}
|
||||
while (minutes >= 60)
|
||||
{
|
||||
minutes -= 60;
|
||||
hours += 1;
|
||||
}
|
||||
if (entry.getTimestamps().size() == 0)
|
||||
{
|
||||
entry.addLogin();
|
||||
}
|
||||
String lastLoginString = entry.getTimestamps().get(entry.getTimestamps().size() - 1);
|
||||
Date currentTime = Date.from(Instant.now());
|
||||
lastLoginString = lastLoginString.replace("Login: ", "");
|
||||
Date lastLogin = FUtil.stringToDate(lastLoginString);
|
||||
|
||||
long duration = currentTime.getTime() - lastLogin.getTime();
|
||||
long cseconds = duration / 1000 % 60;
|
||||
long cminutes = duration / (60 * 1000) % 60;
|
||||
long chours = duration / (60 * 60 * 1000);
|
||||
StringBuilder sb = new StringBuilder()
|
||||
.append("Playtime - " + sender.getName() + "\n")
|
||||
.append("Current Session: " + chours + " hours, " + cminutes + " minutes, and " + cseconds + " seconds" + "\n")
|
||||
.append("Overall: " + hours + " hours, " + minutes + " minutes, and " + seconds + " seconds" + "\n");
|
||||
List<String> durations = entry.getDurations();
|
||||
if (durations.size() >= 3)
|
||||
{
|
||||
sb.append("Recent Sessions:");
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
sb.append("\n" + " - " + durations.get((durations.size() - 1) - i));
|
||||
}
|
||||
}
|
||||
msg(sb.toString());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -70,19 +70,17 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(playerSender))
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
msg(ChatColor.RED + "Only admins can clear potion effects from other players.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (senderIsConsole)
|
||||
{
|
||||
msg("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
||||
{
|
||||
@ -106,26 +104,24 @@ public class Command_potion extends FreedomCommand
|
||||
{
|
||||
target = getPlayer(args[4]);
|
||||
|
||||
if (target == null || plugin.al.vanished.contains(target) && !plugin.al.isAdmin(sender))
|
||||
if (target == null || plugin.al.isVanished(target.getName()) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!target.equals(playerSender))
|
||||
if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(sender))
|
||||
{
|
||||
sender.sendMessage(ChatColor.RED + "Only admins can apply potion effects to other players.");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (senderIsConsole)
|
||||
{
|
||||
sender.sendMessage("You must specify a target player when using this command from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]);
|
||||
if (potion_effect_type == null)
|
||||
@ -244,5 +240,4 @@ public class Command_potion extends FreedomCommand
|
||||
}
|
||||
return types;
|
||||
}
|
||||
|
||||
}
|
@ -1,24 +1,222 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.apache.commons.lang.math.NumberUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Allows admins to see every time a potion is splashed.", usage = "/<command>", aliases = "potspy")
|
||||
@CommandParameters(description = "Allows admins to see potions that are thrown.", usage = "/<command> <enable | on | disable | off> | history [player] <page>", aliases = "potspy")
|
||||
public class Command_potionspy extends FreedomCommand
|
||||
{
|
||||
private String titleText = "&8&m------------------&r &ePotionSpy &8&m------------------&r";
|
||||
private String validPageText = "Please specify a valid page number between 1 and %s.";
|
||||
private String noPlayerRecord = "That player has not thrown any potions yet.";
|
||||
private String splashedText = "&r%s splashed a potion at &eX: %s Y: %s Z: %s&r\nin the world '&e%s&r' about &e%s &rago%s.";
|
||||
private String bottomText = "&8&m--------------------&r &e%s / %s &8&m--------------------&r";
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
admin.setPotionSpy(!admin.getPotionSpy());
|
||||
|
||||
if (args.length <= 0)
|
||||
{
|
||||
setPotionSpyState(admin, !admin.getPotionSpy());
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (args[0].toLowerCase())
|
||||
{
|
||||
case "enable":
|
||||
case "on":
|
||||
setPotionSpyState(admin, true);
|
||||
break;
|
||||
|
||||
case "disable":
|
||||
case "off":
|
||||
setPotionSpyState(admin, false);
|
||||
break;
|
||||
|
||||
case "history":
|
||||
if (args.length == 3)
|
||||
{
|
||||
Player player = Bukkit.getPlayer(args[1]);
|
||||
if (player == null)
|
||||
{
|
||||
msg(sender, "Please specify a valid player name.");
|
||||
return true;
|
||||
}
|
||||
|
||||
List<Map.Entry<ThrownPotion, Long>> thrownPotions = new ArrayList<>();
|
||||
thrownPotions.addAll(plugin.mo.getPlayerThrownPotions(player)); // Make a copy of the list to avoid modifying the original.
|
||||
|
||||
List<String> potionThrowNotifications = new ArrayList<>();
|
||||
int lastPage = (int)Math.ceil(thrownPotions.size() / 5.0);
|
||||
|
||||
if (thrownPotions.isEmpty())
|
||||
{
|
||||
msg(sender, noPlayerRecord);
|
||||
return true;
|
||||
}
|
||||
if (!NumberUtils.isNumber(args[2]))
|
||||
{
|
||||
msg(sender, String.format(validPageText, lastPage));
|
||||
return true;
|
||||
}
|
||||
|
||||
Collections.reverse(thrownPotions);
|
||||
int pageIndex = Integer.parseInt(args[2]);
|
||||
|
||||
for (Map.Entry<ThrownPotion, Long> potionEntry : thrownPotions)
|
||||
{
|
||||
ThrownPotion potion = potionEntry.getKey();
|
||||
boolean trollPotions = plugin.mo.isTrollPotion(potion);
|
||||
|
||||
potionThrowNotifications.add(ChatColor.translateAlternateColorCodes('&', String.format(splashedText, player.getName(), potion.getLocation().getBlockX(),
|
||||
potion.getLocation().getBlockY(), potion.getLocation().getBlockZ(), potion.getWorld().getName(), getUnixTimeDifference(potionEntry.getValue(), System.currentTimeMillis()), trollPotions ? " &c(most likely troll potion/potions)" : "")));
|
||||
}
|
||||
|
||||
List<String> page = FUtil.getPageFromList(potionThrowNotifications, 5, pageIndex - 1);
|
||||
if (!page.isEmpty())
|
||||
{
|
||||
msg(sender, ChatColor.translateAlternateColorCodes('&', titleText));
|
||||
for (String potionThrowNotification : page)
|
||||
{
|
||||
msg(sender, potionThrowNotification);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(sender, String.format(validPageText, lastPage));
|
||||
return true;
|
||||
}
|
||||
|
||||
msg(sender, ChatColor.translateAlternateColorCodes('&', String.format(bottomText, pageIndex, lastPage)));
|
||||
}
|
||||
else if (args.length == 2)
|
||||
{
|
||||
List<Map.Entry<ThrownPotion, Long>> thrownPotions = new ArrayList<>();
|
||||
thrownPotions.addAll(plugin.mo.getAllThrownPotions()); // Make a copy of the list to avoid modifying the original.
|
||||
|
||||
List<String> potionThrowNotifications = new ArrayList<>();
|
||||
int lastPage = (int)Math.ceil(thrownPotions.size() / 5.0);
|
||||
|
||||
if (thrownPotions.isEmpty())
|
||||
{
|
||||
if(Bukkit.getPlayer(args[1]) != null)
|
||||
{
|
||||
msg(sender, noPlayerRecord);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(sender, "No potions have been thrown yet.");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!NumberUtils.isNumber(args[1]))
|
||||
{
|
||||
msg(sender, String.format(validPageText, lastPage));
|
||||
return true;
|
||||
}
|
||||
|
||||
Collections.reverse(thrownPotions);
|
||||
int pageIndex = Integer.parseInt(args[1]);
|
||||
|
||||
for (Map.Entry<ThrownPotion, Long> potionEntry : thrownPotions)
|
||||
{
|
||||
ThrownPotion potion = potionEntry.getKey();
|
||||
Player player = (Player)potion.getShooter();
|
||||
boolean trollPotions = plugin.mo.isTrollPotion(potion);
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
potionThrowNotifications.add(ChatColor.translateAlternateColorCodes('&', String.format(splashedText, player.getName(), potion.getLocation().getBlockX(),
|
||||
potion.getLocation().getBlockY(), potion.getLocation().getBlockZ(), potion.getWorld().getName(), getUnixTimeDifference(potionEntry.getValue(), System.currentTimeMillis()), trollPotions ? " &c(most likely troll potion/potions)" : "")));
|
||||
}
|
||||
}
|
||||
|
||||
List<String> page = FUtil.getPageFromList(potionThrowNotifications, 5, pageIndex - 1);
|
||||
if (!page.isEmpty())
|
||||
{
|
||||
msg(sender, ChatColor.translateAlternateColorCodes('&', titleText));
|
||||
for (String potionThrowNotification : page)
|
||||
{
|
||||
msg(sender, potionThrowNotification);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(sender, String.format(validPageText, lastPage));
|
||||
return true;
|
||||
}
|
||||
|
||||
msg(sender, ChatColor.translateAlternateColorCodes('&', String.format(bottomText, pageIndex, lastPage)));
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private void setPotionSpyState(Admin admin, boolean state)
|
||||
{
|
||||
admin.setPotionSpy(state);
|
||||
plugin.al.save(admin);
|
||||
plugin.al.updateTables();
|
||||
msg("PotionSpy is now " + (admin.getPotionSpy() ? "enabled." : "disabled."));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unix time difference in string format (1h, 30m, 15s).
|
||||
* @param past The unix time at the start.
|
||||
* @param now The current unix time.
|
||||
* @return A string that displays the time difference between the two unix time values.
|
||||
*/
|
||||
private String getUnixTimeDifference(long past, long now)
|
||||
{
|
||||
long unix = now - past;
|
||||
long seconds = Math.round(unix / 1000.0);
|
||||
if (seconds < 60)
|
||||
{
|
||||
return seconds + "s";
|
||||
}
|
||||
else
|
||||
{
|
||||
long minutes = Math.round(seconds / 60.0);
|
||||
if (minutes < 60)
|
||||
{
|
||||
return minutes + "m";
|
||||
}
|
||||
else
|
||||
{
|
||||
long hours = Math.round(minutes / 60.0);
|
||||
if (hours < 24)
|
||||
{
|
||||
return hours + "h";
|
||||
}
|
||||
else
|
||||
{
|
||||
return Math.round(hours / 24.0) + "d";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ public class Command_rank extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (isConsole() && args.length == 0)
|
||||
if (senderIsConsole && args.length == 0)
|
||||
{
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
|
@ -17,7 +17,7 @@ import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH, blockHostConsole = false)
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Remove all blocks of a certain type in the radius of certain players.", usage = "/<command> <block> [radius (default=50)] [player]")
|
||||
public class Command_ro extends FreedomCommand
|
||||
{
|
||||
@ -58,7 +58,7 @@ public class Command_ro extends FreedomCommand
|
||||
}
|
||||
}
|
||||
|
||||
int radius = 20;
|
||||
int radius = 50;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
try
|
||||
|
@ -39,6 +39,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
case "clean":
|
||||
{
|
||||
checkConsole();
|
||||
checkRank(Rank.SENIOR_ADMIN);
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Cleaning admin list", true);
|
||||
@ -60,6 +61,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
|
||||
case "setrank":
|
||||
{
|
||||
checkConsole();
|
||||
checkRank(Rank.SENIOR_ADMIN);
|
||||
|
||||
if (args.length < 3)
|
||||
@ -70,7 +72,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
Rank rank = Rank.findRank(args[2]);
|
||||
if (rank == null)
|
||||
{
|
||||
msg("Unknown rank: " + rank);
|
||||
msg("Unknown rank: " + args[2]);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -152,6 +154,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
checkConsole();
|
||||
checkRank(Rank.TELNET_ADMIN);
|
||||
|
||||
// Player already an admin?
|
||||
@ -209,8 +212,10 @@ public class Command_saconfig extends FreedomCommand
|
||||
{
|
||||
String oldName = admin.getName();
|
||||
if (oldName != player.getName())
|
||||
{
|
||||
admin.setName(player.getName());
|
||||
plugin.sql.updateAdminName(oldName, admin.getName());
|
||||
}
|
||||
admin.addIp(FUtil.getIp(player));
|
||||
}
|
||||
|
||||
@ -242,7 +247,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
if (fPlayer.getFreezeData().isFrozen())
|
||||
{
|
||||
fPlayer.getFreezeData().setFrozen(false);
|
||||
msg(player.getPlayer(), "You have been unfrozen.");
|
||||
msg(player, "You have been unfrozen.");
|
||||
}
|
||||
|
||||
if (!player.isOp())
|
||||
@ -261,6 +266,7 @@ public class Command_saconfig extends FreedomCommand
|
||||
return false;
|
||||
}
|
||||
|
||||
checkConsole();
|
||||
checkRank(Rank.TELNET_ADMIN);
|
||||
|
||||
Player player = getPlayer(args[1]);
|
||||
|
@ -46,6 +46,8 @@ public class Command_settotalvotes extends FreedomCommand
|
||||
return true;
|
||||
}
|
||||
|
||||
msg("Set " + args[1] + "'s votes to " + args[0]);
|
||||
|
||||
playerData.setTotalVotes(votes);
|
||||
plugin.pl.save(playerData);
|
||||
|
||||
|
@ -0,0 +1,34 @@
|
||||
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;
|
||||
}
|
||||
}
|
@ -28,7 +28,7 @@ public class Command_smite extends FreedomCommand
|
||||
}
|
||||
|
||||
String reason = null;
|
||||
Boolean silent = false;
|
||||
boolean silent = false;
|
||||
if (args.length >= 2)
|
||||
{
|
||||
if (args[args.length - 1].equalsIgnoreCase("-q"))
|
||||
@ -76,18 +76,21 @@ public class Command_smite extends FreedomCommand
|
||||
|
||||
public static void smite(CommandSender sender, Player player, String reason, Boolean silent)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||
player.sendTitle(ChatColor.RED + "You've been smitten.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.bcastMsg(player.getName() + " has been a naughty, naughty boy.", ChatColor.RED);
|
||||
if (reason != null)
|
||||
{
|
||||
FUtil.bcastMsg(" Reason: " + ChatColor.YELLOW + reason, ChatColor.RED);
|
||||
}
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.bcastMsg(" Smitten by: " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
sender.sendMessage(ChatColor.GRAY + "Smitten " + player.getName() + " quietly.");
|
||||
}
|
||||
|
||||
// Deop
|
||||
player.setOp(false);
|
||||
|
@ -15,7 +15,6 @@ public class Command_spectate extends FreedomCommand
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
@ -39,8 +38,12 @@ public class Command_spectate extends FreedomCommand
|
||||
playerSender.setGameMode(GameMode.SPECTATOR);
|
||||
}
|
||||
|
||||
playerSender.setSpectatorTarget(player);
|
||||
if (playerSender.getWorld() != player.getWorld())
|
||||
{
|
||||
playerSender.teleport(player);
|
||||
}
|
||||
|
||||
playerSender.setSpectatorTarget(player);
|
||||
return true;
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ public class Command_tag extends FreedomCommand
|
||||
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -138,6 +138,12 @@ public class Command_tag extends FreedomCommand
|
||||
}
|
||||
else if ("set".equalsIgnoreCase(args[0]))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("\"/tag set\" can't be used from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
final String inputTag = StringUtils.join(args, " ", 1, args.length);
|
||||
final String strippedTag = StringUtils.replaceEachRepeatedly(StringUtils.strip(inputTag),
|
||||
new String[]
|
||||
@ -183,10 +189,31 @@ public class Command_tag extends FreedomCommand
|
||||
}
|
||||
else if (args[0].equalsIgnoreCase("gradient"))
|
||||
{
|
||||
if (senderIsConsole)
|
||||
{
|
||||
msg("\"/tag gradient\" can't be used from the console.");
|
||||
return true;
|
||||
}
|
||||
|
||||
String from = "", to = "";
|
||||
java.awt.Color awt1, awt2;
|
||||
try
|
||||
{
|
||||
if (args[1].equalsIgnoreCase("random") ||
|
||||
args[1].equalsIgnoreCase("r"))
|
||||
{
|
||||
awt1 = FUtil.getRandomAWTColor();
|
||||
from = " (From: " + FUtil.getHexStringOfAWTColor(awt1) + ")";
|
||||
}
|
||||
else
|
||||
awt1 = java.awt.Color.decode(args[1]);
|
||||
if (args[2].equalsIgnoreCase("random") ||
|
||||
args[2].equalsIgnoreCase("r"))
|
||||
{
|
||||
awt2 = FUtil.getRandomAWTColor();
|
||||
to = " (To: " + FUtil.getHexStringOfAWTColor(awt2) + ")";
|
||||
}
|
||||
else
|
||||
awt2 = java.awt.Color.decode(args[2]);
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
@ -233,7 +260,7 @@ public class Command_tag extends FreedomCommand
|
||||
{
|
||||
save(playerSender, tag);
|
||||
}
|
||||
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : ""));
|
||||
msg("Tag set to '" + outputTag + ChatColor.GRAY + "'." + (save ? " (Saved)" : "") + from + to);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -0,0 +1,22 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||
@CommandParameters(description = "Toggle the display of Discord messages in-game.", usage = "/<command>", aliases = "tdiscord,tdisc")
|
||||
public class Command_togglediscord extends FreedomCommand
|
||||
{
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
PlayerData data = plugin.pl.getData(playerSender);
|
||||
data.setDisplayDiscord(!data.doesDisplayDiscord());
|
||||
plugin.pl.save(data);
|
||||
msg("Discord messages will " + (data.doesDisplayDiscord() ? "now" : "no longer") + " be shown.");
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unbans the specified ip.", usage = "/<command> <ip> [-q]")
|
||||
public class Command_unbanip extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
|
||||
String ip = args[0];
|
||||
|
||||
if (!FUtil.isValidIPv4(ip))
|
||||
{
|
||||
msg(ip + " is not a valid IP address", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
Ban ban = plugin.bm.getByIp(ip);
|
||||
|
||||
if (ban == null)
|
||||
{
|
||||
msg("The ip " + ip + " is not banned", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ban.hasUsername())
|
||||
{
|
||||
msg("This ban is not an ip-only ban.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 1 && args[1].equals("-q"))
|
||||
{
|
||||
silent = true;
|
||||
}
|
||||
|
||||
plugin.bm.removeBan(ban);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unbanned the ip " + ip, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unbans the specified name.", usage = "/<command> <name> [-q]")
|
||||
public class Command_unbanname extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean silent = false;
|
||||
|
||||
String name = args[0];
|
||||
|
||||
Ban ban = plugin.bm.getByUsername(name);
|
||||
|
||||
if (ban == null)
|
||||
{
|
||||
msg("The name " + name + " is not banned", ChatColor.RED);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ban.hasIps())
|
||||
{
|
||||
msg("This ban is not a name-only ban.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args.length > 1 && args[1].equals("-q"))
|
||||
{
|
||||
silent = true;
|
||||
}
|
||||
|
||||
plugin.bm.removeBan(ban);
|
||||
|
||||
if (!silent)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unbanned the name " + name, true);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.BOTH)
|
||||
@CommandParameters(description = "Unblocks commands for a player.", usage = "/<command> <player>", aliases = "unblockcommand,unblockcommands,ubcmds,unblockcmds,ubc")
|
||||
public class Command_unblockcmd extends FreedomCommand
|
||||
{
|
||||
|
||||
@Override
|
||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||
{
|
||||
if (args.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Player player = getPlayer(args[0]);
|
||||
if (player == null)
|
||||
{
|
||||
sender.sendMessage(FreedomCommand.PLAYER_NOT_FOUND);
|
||||
return true;
|
||||
}
|
||||
|
||||
FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
if (fPlayer.allCommandsBlocked())
|
||||
{
|
||||
fPlayer.setCommandsBlocked(false);
|
||||
FUtil.adminAction(sender.getName(), "Unblocking all commands for " + player.getName(), true);
|
||||
msg("Unblocked commands for " + player.getName() + ".");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That players commands aren't blocked.", ChatColor.RED);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
@ -30,18 +30,15 @@ public class Command_uncage extends FreedomCommand
|
||||
}
|
||||
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
|
||||
if (fPlayer.getCageData().isCaged())
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + sender.getName(), true);
|
||||
final FPlayer playerdata = plugin.pl.getPlayer(playerSender);
|
||||
playerdata.getCageData().setCaged(false);
|
||||
FUtil.adminAction(sender.getName(), "Uncaging " + player.getName(), true);
|
||||
fPlayer.getCageData().setCaged(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("That player is not caged!", ChatColor.RED);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -42,28 +42,25 @@ public class Command_unmute extends FreedomCommand
|
||||
}
|
||||
|
||||
FPlayer playerdata = plugin.pl.getPlayer(player);
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
msg(player.getName() + " is an admin, and can't be muted.");
|
||||
return true;
|
||||
}
|
||||
|
||||
if (playerdata.isMuted())
|
||||
{
|
||||
playerdata.setMuted(false);
|
||||
msg(player, "You have been unmuted.", ChatColor.RED);
|
||||
player.sendTitle(ChatColor.RED + "You've been unmuted.", ChatColor.YELLOW + "Be sure to follow the rules!", 20, 100, 60);
|
||||
if (!quiet)
|
||||
|
||||
if (quiet)
|
||||
{
|
||||
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
|
||||
}
|
||||
msg("Unmuted " + player.getName() + " quietly");
|
||||
return true;
|
||||
}
|
||||
|
||||
FUtil.adminAction(sender.getName(), "Unmuting " + player.getName(), true);
|
||||
msg("Unmuted " + player.getName());
|
||||
msg(player, "You have been unmuted.", ChatColor.RED);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg(ChatColor.RED + "That player is not muted.");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
@ -1,16 +1,18 @@
|
||||
package me.totalfreedom.totalfreedommod.command;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import net.md_5.bungee.api.ChatMessageType;
|
||||
import net.md_5.bungee.api.chat.TextComponent;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.Command;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
||||
|
||||
@CommandPermissions(level = Rank.SUPER_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||
@ -23,7 +25,6 @@ public class Command_vanish extends FreedomCommand
|
||||
Displayable display = plugin.rm.getDisplay(playerSender);
|
||||
String displayName = display.getColor() + playerSender.getName();
|
||||
String tag = display.getColoredTag();
|
||||
Admin admin = plugin.al.getAdmin(playerSender);
|
||||
boolean silent = false;
|
||||
if (args.length > 0)
|
||||
{
|
||||
@ -32,42 +33,70 @@ public class Command_vanish extends FreedomCommand
|
||||
silent = true;
|
||||
}
|
||||
}
|
||||
if (plugin.al.vanished.contains(playerSender))
|
||||
|
||||
if (plugin.al.isVanished(playerSender.getName()))
|
||||
{
|
||||
msg(ChatColor.GOLD + "You have been unvanished.");
|
||||
if (!silent)
|
||||
if (silent)
|
||||
{
|
||||
msg(ChatColor.GOLD + "Silently unvanished.");
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You have unvanished.", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(plugin.rm.craftLoginMessage(playerSender, null));
|
||||
FUtil.bcastMsg(playerSender.getName() + " joined the game.", ChatColor.YELLOW);
|
||||
plugin.dc.messageChatChannel("**" + playerSender.getName() + " joined the server" + "**");
|
||||
}
|
||||
|
||||
PlayerData playerData = plugin.pl.getData(playerSender);
|
||||
if (playerData.getTag() != null)
|
||||
{
|
||||
tag = FUtil.colorize(playerData.getTag());
|
||||
}
|
||||
|
||||
plugin.pl.getData(playerSender).setTag(tag);
|
||||
FLog.info(playerSender.getName() + " is no longer vanished.");
|
||||
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (plugin.al.isAdmin(player))
|
||||
{
|
||||
playerMsg(player, ChatColor.YELLOW + sender.getName() + " has unvanished and is now visible to everyone.");
|
||||
}
|
||||
if (!plugin.al.isAdmin(player))
|
||||
{
|
||||
player.showPlayer(plugin, playerSender);
|
||||
}
|
||||
}
|
||||
plugin.esb.setVanished(playerSender.getName(), false);
|
||||
playerSender.setPlayerListName(StringUtils.substring(displayName, 0, 16));
|
||||
plugin.al.vanished.remove(playerSender);
|
||||
plugin.al.vanished.remove(playerSender.getName());
|
||||
}
|
||||
else
|
||||
{
|
||||
msg("You have been vanished.", ChatColor.GOLD);
|
||||
if (!silent)
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (plugin.al.isVanished(playerSender.getName()))
|
||||
{
|
||||
playerSender.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(ChatColor.GOLD + "You are hidden from other players."));
|
||||
}
|
||||
}
|
||||
}.runTaskTimer(plugin, 0L, 4L);
|
||||
|
||||
if (silent)
|
||||
{
|
||||
msg("Silently vanished.", ChatColor.GOLD);
|
||||
}
|
||||
else
|
||||
{
|
||||
msg ("You have vanished.", ChatColor.GOLD);
|
||||
FUtil.bcastMsg(playerSender.getName() + " left the game.", ChatColor.YELLOW);
|
||||
plugin.dc.messageChatChannel("**" + playerSender.getName() + " left the server" + "**");
|
||||
}
|
||||
|
||||
FLog.info(playerSender.getName() + " is now vanished.");
|
||||
for (Player player : server.getOnlinePlayers())
|
||||
{
|
||||
@ -82,8 +111,9 @@ public class Command_vanish extends FreedomCommand
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
plugin.esb.setVanished(playerSender.getName(), true);
|
||||
plugin.al.vanished.add(playerSender);
|
||||
plugin.al.vanished.add(playerSender.getName());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ public class Command_whohas extends FreedomCommand
|
||||
|
||||
for (final Player player : server.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.isAdmin(sender) && plugin.al.vanished.contains(player))
|
||||
if (!plugin.al.isAdmin(sender) && plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -131,7 +131,7 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
||||
return true;
|
||||
}
|
||||
|
||||
if (perms.blockHostConsole() && FUtil.isFromHostConsole(sender.getName()))
|
||||
if (perms.blockHostConsole() && FUtil.isFromHostConsole(sender.getName()) && !FUtil.inDeveloperMode())
|
||||
{
|
||||
msg(ChatColor.RED + "Host console is not allowed to use this command!");
|
||||
return true;
|
||||
@ -303,10 +303,13 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
||||
protected Player getPlayer(String name, Boolean nullVanished)
|
||||
{
|
||||
Player player = Bukkit.getPlayer(name);
|
||||
if (nullVanished && plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||
if (player != null)
|
||||
{
|
||||
if (nullVanished && plugin.al.isVanished(player.getName()) && !plugin.al.isAdmin(sender))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return player;
|
||||
}
|
||||
|
||||
|
@ -103,6 +103,7 @@ public enum ConfigEntry
|
||||
SHOP_PRICES_RIDEABLE_PEARL(Integer.class, "shop.prices.rideable_pearl"),
|
||||
SHOP_PRICES_STACKING_POTATO(Integer.class, "shop.prices.stacking_potato"),
|
||||
SHOP_PRICES_CLOWN_FISH(Integer.class, "shop.prices.clown_fish"),
|
||||
SHOP_PRICES_MAGICAL_SADDLE(Integer.class, "shop.prices.magical_saddle"),
|
||||
//
|
||||
ADMINLIST_CLEAN_THESHOLD_HOURS(Integer.class, "adminlist.clean_threshold_hours"),
|
||||
ADMINLIST_CONSOLE_IS_SENIOR(Boolean.class, "adminlist.console_is_senior"),
|
||||
@ -160,7 +161,8 @@ public enum ConfigEntry
|
||||
VOTING_INFO(List.class, "votinginfo"),
|
||||
MASTER_BUILDER_INFO(List.class, "masterbuilderinfo"),
|
||||
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
|
||||
TOGGLE_CHAT(Boolean.class, "toggle_chat");
|
||||
TOGGLE_CHAT(Boolean.class, "toggle_chat"),
|
||||
DEVELOPER_MODE(Boolean.class, "developer_mode");
|
||||
//
|
||||
private final Class<?> type;
|
||||
private final String configName;
|
||||
|
@ -34,7 +34,7 @@ public class MainConfig extends FreedomService
|
||||
|
||||
}
|
||||
|
||||
public MainConfig(TotalFreedomMod plugin)
|
||||
public MainConfig()
|
||||
{
|
||||
entries = new EnumMap<>(ConfigEntry.class);
|
||||
|
||||
|
@ -49,6 +49,7 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
public class Discord extends FreedomService
|
||||
{
|
||||
|
||||
public static HashMap<String, PlayerData> LINK_CODES = new HashMap<>();
|
||||
public static HashMap<String, PlayerData> VERIFICATION_CODES = new HashMap<>();
|
||||
public ScheduledThreadPoolExecutor RATELIMIT_EXECUTOR;
|
||||
@ -252,15 +253,21 @@ public class Discord extends FreedomService
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (!plugin.al.isVanished(event.getPlayer().getName()))
|
||||
{
|
||||
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " joined the server" + "**");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerLeave(PlayerQuitEvent event)
|
||||
{
|
||||
if (!plugin.al.isVanished(event.getPlayer().getName()))
|
||||
{
|
||||
messageChatChannel("**" + deformat(event.getPlayer().getName()) + " left the server" + "**");
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerDeath(PlayerDeathEvent event)
|
||||
@ -292,6 +299,12 @@ public class Discord extends FreedomService
|
||||
{
|
||||
message = StringUtils.remove(message, "@");
|
||||
}
|
||||
|
||||
if (message.toLowerCase().contains("discord.gg"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (enabled && !chat_channel_id.isEmpty())
|
||||
{
|
||||
CompletableFuture<Message> sentMessage = bot.getTextChannelById(chat_channel_id).sendMessage(message).submit(true);
|
||||
|
@ -1,14 +1,17 @@
|
||||
package me.totalfreedom.totalfreedommod.discord;
|
||||
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||
import me.totalfreedom.totalfreedommod.rank.Title;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import net.dv8tion.jda.api.entities.Guild;
|
||||
import net.dv8tion.jda.api.entities.Member;
|
||||
import net.dv8tion.jda.api.events.message.MessageReceivedEvent;
|
||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DiscordToMinecraftListener extends ListenerAdapter
|
||||
{
|
||||
@ -27,7 +30,14 @@ public class DiscordToMinecraftListener extends ListenerAdapter
|
||||
message += " " + tag;
|
||||
}
|
||||
message += " " + ChatColor.RED + ChatColor.stripColor(member.getEffectiveName()) + ChatColor.DARK_GRAY + ": " + ChatColor.RESET + ChatColor.stripColor(event.getMessage().getContentDisplay());
|
||||
FUtil.bcastMsg(message);
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (TotalFreedomMod.getPlugin().pl.getData(player).doesDisplayDiscord())
|
||||
{
|
||||
player.sendMessage(message);
|
||||
}
|
||||
}
|
||||
FLog.info(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -11,7 +11,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
@ -43,13 +42,12 @@ import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class ItemFun extends FreedomService
|
||||
{
|
||||
|
||||
public List<Player> explosivePlayers = new ArrayList<Player>();
|
||||
public List<Player> explosivePlayers = new ArrayList<>();
|
||||
|
||||
private final Random random = new Random();
|
||||
|
||||
@ -71,7 +69,7 @@ public class ItemFun extends FreedomService
|
||||
{
|
||||
cooldownTracker.get(player.getName()).add(item.getDataName());
|
||||
}
|
||||
BukkitTask thing = new BukkitRunnable()
|
||||
new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
@ -105,22 +103,36 @@ public class ItemFun extends FreedomService
|
||||
{
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Entity entity = event.getRightClicked();
|
||||
|
||||
if (!player.getInventory().getItemInMainHand().getType().equals(Material.POTATO) || entity.getType().equals(EntityType.PLAYER))
|
||||
if (player.getInventory().getItemInMainHand().getType().equals(Material.POTATO) || entity.getType().equals(EntityType.PLAYER))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory().getItemInMainHand(), plugin.sh.getStackingPotato()))
|
||||
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.STACKING_POTATO, player.getInventory().getItemInMainHand(), plugin.sh.getStackingPotato()))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
player.addPassenger(entity);
|
||||
player.sendMessage("Stacked " + entity.getName());
|
||||
}
|
||||
}
|
||||
|
||||
if (onCooldown(player, ShopItem.MAGICAL_SADDLE))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 15 seconds.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getInventory().getItemInMainHand().getType().equals(Material.SADDLE) || player.getInventory().getItemInOffHand().getType().equals(Material.SADDLE) || entity.getType().equals(EntityType.PLAYER))
|
||||
{
|
||||
if (plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.MAGICAL_SADDLE, player.getInventory().getItemInMainHand(), plugin.sh.getMagicalSaddle()) || plugin.sh.isRealItem(plugin.pl.getData(player), ShopItem.MAGICAL_SADDLE, player.getInventory().getItemInOffHand(), plugin.sh.getMagicalSaddle()))
|
||||
{
|
||||
entity.addPassenger(player);
|
||||
cooldown(player, ShopItem.MAGICAL_SADDLE, 15);
|
||||
if (entity instanceof Player)
|
||||
{
|
||||
entity.sendMessage(ChatColor.GRAY + player.getName() + " is now riding you, run /eject to eject them.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEntityDamage(EntityDamageByEntityEvent event)
|
||||
@ -210,7 +222,7 @@ public class ItemFun extends FreedomService
|
||||
|
||||
if (onCooldown(player, ShopItem.LIGHTNING_ROD))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You're are currently on a cooldown for 10 seconds.");
|
||||
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 10 seconds.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -234,7 +246,7 @@ public class ItemFun extends FreedomService
|
||||
|
||||
if (onCooldown(player, ShopItem.FIRE_BALL))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You're are currently on a cool-down for 5 seconds.");
|
||||
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 5 seconds.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -245,6 +257,7 @@ public class ItemFun extends FreedomService
|
||||
cooldown(player, ShopItem.FIRE_BALL, 5);
|
||||
break;
|
||||
}
|
||||
|
||||
case TROPICAL_FISH:
|
||||
{
|
||||
final int RADIUS_HIT = 5;
|
||||
@ -257,7 +270,7 @@ public class ItemFun extends FreedomService
|
||||
|
||||
if (onCooldown(player, ShopItem.CLOWN_FISH))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "You're are currently on a cool-down for 30 seconds.");
|
||||
player.sendMessage(ChatColor.RED + "You're currently on a cool-down for 30 seconds.");
|
||||
break;
|
||||
}
|
||||
|
||||
@ -451,5 +464,4 @@ public class ItemFun extends FreedomService
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -40,7 +40,7 @@ public class Module_list extends HTTPDModule
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
|
||||
if (plugin.al.vanished.contains(player))
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -128,7 +128,7 @@ public class Module_list extends HTTPDModule
|
||||
|
||||
for (Player player : onlinePlayers)
|
||||
{
|
||||
if (plugin.al.vanished.contains(player))
|
||||
if (plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class Module_players extends HTTPDModule
|
||||
// All online players
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!plugin.al.vanished.contains(player))
|
||||
if (!plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
players.add(player.getName());
|
||||
if (plugin.al.isAdmin(player) && !plugin.al.isAdminImpostor(player))
|
||||
|
@ -48,6 +48,8 @@ public class PlayerData
|
||||
@Getter
|
||||
@Setter
|
||||
private int totalVotes;
|
||||
@Setter
|
||||
private boolean displayDiscord = true;
|
||||
|
||||
public PlayerData(ResultSet resultSet)
|
||||
{
|
||||
@ -70,6 +72,7 @@ public class PlayerData
|
||||
items.clear();
|
||||
items.addAll(FUtil.stringToList(resultSet.getString("items")));
|
||||
totalVotes = resultSet.getInt("total_votes");
|
||||
displayDiscord = resultSet.getBoolean("display_discord");
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@ -102,6 +105,7 @@ public class PlayerData
|
||||
.append("- Has Verification: ").append(verification).append("\n")
|
||||
.append("- Coins: ").append(coins).append("\n")
|
||||
.append("- Total Votes: ").append(totalVotes).append("\n")
|
||||
.append("- Display Discord: ").append(displayDiscord).append("\n")
|
||||
.append("- Tag: ").append(FUtil.colorize(tag)).append(ChatColor.GRAY).append("\n")
|
||||
.append("- Ride Mode: ").append(rideMode).append("\n")
|
||||
.append("- Backup Codes: ").append(backupCodes.size()).append("/10").append("\n");
|
||||
@ -239,7 +243,13 @@ public class PlayerData
|
||||
put("coins", coins);
|
||||
put("items", FUtil.listToString(items));
|
||||
put("total_votes", totalVotes);
|
||||
put("display_discord", displayDiscord);
|
||||
}};
|
||||
return map;
|
||||
}
|
||||
|
||||
public boolean doesDisplayDiscord()
|
||||
{
|
||||
return displayDiscord;
|
||||
}
|
||||
}
|
||||
|
@ -249,9 +249,12 @@ public class RankManager extends FreedomService
|
||||
|
||||
// Broadcast login message
|
||||
if (isAdmin || FUtil.isDeveloper(player.getName()) || plugin.pl.getData(player).isMasterBuilder() || plugin.pl.getData(player).isDonator())
|
||||
{
|
||||
if (!plugin.al.isVanished(player.getName()))
|
||||
{
|
||||
FUtil.bcastMsg(craftLoginMessage(player, null));
|
||||
}
|
||||
}
|
||||
|
||||
// Set display
|
||||
updateDisplay(player);
|
||||
|
@ -1,7 +1,5 @@
|
||||
package me.totalfreedom.totalfreedommod.shop;
|
||||
|
||||
import com.vexsoftware.votifier.model.Vote;
|
||||
import com.vexsoftware.votifier.model.VotifierEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
@ -21,6 +19,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemFlag;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
@ -28,6 +27,7 @@ import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
public class Shop extends FreedomService
|
||||
{
|
||||
|
||||
private BukkitTask reactions;
|
||||
public String reactionString = "";
|
||||
public Date reactionStartTime;
|
||||
@ -116,6 +116,7 @@ public class Shop extends FreedomService
|
||||
Date currentTime = new Date();
|
||||
long seconds = (currentTime.getTime() - reactionStartTime.getTime()) / 1000;
|
||||
FUtil.bcastMsg(prefix + ChatColor.GREEN + winner + ChatColor.AQUA + " won in " + seconds + " seconds!", false);
|
||||
startReactionTimer();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -247,6 +248,18 @@ public class Shop extends FreedomService
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public ItemStack getMagicalSaddle()
|
||||
{
|
||||
ItemStack itemStack = new ItemStack(Material.SADDLE);
|
||||
ItemMeta itemMeta = itemStack.getItemMeta();
|
||||
itemMeta.setDisplayName(ChatColor.DARK_GREEN + "Magical Saddle");
|
||||
itemMeta.setLore(Arrays.asList(ChatColor.GREEN + "Ride anything you want..."));
|
||||
itemMeta.addEnchant(Enchantment.DURABILITY, 1, true);
|
||||
itemMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
|
||||
itemStack.setItemMeta(itemMeta);
|
||||
return itemStack;
|
||||
}
|
||||
|
||||
public boolean canAfford(int price, int coins)
|
||||
{
|
||||
if (coins >= price)
|
||||
|
@ -12,17 +12,18 @@ public enum ShopItem
|
||||
FIRE_BALL("Fire Ball", Material.FIRE_CHARGE, 14, ConfigEntry.SHOP_PRICES_FIRE_BALL, ChatColor.RED, "fireBall", "/fireball"),
|
||||
RIDEABLE_PEARL("Rideable Ender Pearl", Material.ENDER_PEARL, 16, ConfigEntry.SHOP_PRICES_RIDEABLE_PEARL, ChatColor.DARK_PURPLE, "rideablePearl", "/rideablepearl"),
|
||||
STACKING_POTATO("Stacking Potato", Material.POTATO, 20, ConfigEntry.SHOP_PRICES_STACKING_POTATO, ChatColor.YELLOW, "stackingPotato", "/stackingpotato"),
|
||||
MAGICAL_SADDLE("Magical Saddle", Material.SADDLE, 22, ConfigEntry.SHOP_PRICES_MAGICAL_SADDLE, ChatColor.DARK_GREEN, "magicalSaddle", "/magicalsaddle"),
|
||||
CLOWN_FISH("Clown Fish", Material.TROPICAL_FISH, 24, ConfigEntry.SHOP_PRICES_CLOWN_FISH, ChatColor.GOLD, "clownFish", "/clownfish");
|
||||
|
||||
/*
|
||||
Shop GUI Layout:
|
||||
|
||||
Dimensions: 9x4 = 36
|
||||
Key: g = Grappling Hook, l = Lightning Rod, f = Fire Ball, r = Rideable Ender Pearl, s = Stacking Potato, c = Clown Fish, $ = Coins}
|
||||
Key: g = Grappling Hook, l = Lightning Rod, f = Fire Ball, r = Rideable Ender Pearl, s = Stacking Potato, c = Clown Fish, m = Magical Saddle $ = Coins}
|
||||
|
||||
---------
|
||||
-g-l-f-r-
|
||||
--s---c--
|
||||
--s-m-c--
|
||||
--------$
|
||||
*/
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class SQLite extends FreedomService
|
||||
{
|
||||
try
|
||||
{
|
||||
connection.createStatement().execute("CREATE TABLE `admins` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `old_tags` BOOLEAN NOT NULL, `log_stick` BOOLEAN NOT NULL);");
|
||||
connection.createStatement().execute("CREATE TABLE `admins` (`username` VARCHAR NOT NULL, `ips` VARCHAR NOT NULL, `rank` VARCHAR NOT NULL, `active` BOOLEAN NOT NULL, `last_login` LONG NOT NULL, `login_message` VARCHAR, `command_spy` BOOLEAN NOT NULL, `potion_spy` BOOLEAN NOT NULL, `ac_format` VARCHAR, `old_tags` BOOLEAN NOT NULL, `log_stick` BOOLEAN NOT NULL, `display_discord` BOOLEAN NOT NULL,);");
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@ -272,7 +272,7 @@ public class SQLite extends FreedomService
|
||||
{
|
||||
try
|
||||
{
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
PreparedStatement statement = connection.prepareStatement("INSERT INTO players VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
|
||||
statement.setString(1, player.getName());
|
||||
statement.setString(2, FUtil.listToString(player.getIps()));
|
||||
statement.setString(3, FUtil.listToString(player.getNotes()));
|
||||
@ -286,6 +286,7 @@ public class SQLite extends FreedomService
|
||||
statement.setInt(11, player.getCoins());
|
||||
statement.setString(12, FUtil.listToString(player.getItems()));
|
||||
statement.setInt(13, player.getTotalVotes());
|
||||
statement.setBoolean(14, player.doesDisplayDiscord());
|
||||
statement.executeUpdate();
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@ -26,6 +26,15 @@ public class FLog
|
||||
log(Level.INFO, ex);
|
||||
}
|
||||
|
||||
// Fuck spigot for not using log4j, we would of had a debug log level if they did
|
||||
public static void debug(String message)
|
||||
{
|
||||
if (FUtil.inDeveloperMode())
|
||||
{
|
||||
log(Level.INFO, "\u001B[35m[TotalFreedomMod | DEBUG] " + message + "\u001B[0m", true);
|
||||
}
|
||||
}
|
||||
|
||||
// Level.WARNING:
|
||||
public static void warning(String message)
|
||||
{
|
||||
|
@ -52,10 +52,9 @@ public class FUtil
|
||||
{
|
||||
|
||||
private static final Random RANDOM = new Random();
|
||||
//
|
||||
public static final String SAVED_FLAGS_FILENAME = "savedflags.dat";
|
||||
// See https://github.com/TotalFreedom/License - None of the listed names may be removed.
|
||||
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "supernt");
|
||||
public static final List<String> DEVELOPERS = Arrays.asList("Madgeek1450", "Prozza", "WickedGamingUK", "Wild1145", "aggelosQQ", "scripthead", "supernt", "Telesphoreo", "CoolJWB");
|
||||
public static String DATE_STORAGE_FORMAT = "EEE, d MMM yyyy HH:mm:ss Z";
|
||||
public static final Map<String, ChatColor> CHAT_COLOR_NAMES = new HashMap<>();
|
||||
public static final List<ChatColor> CHAT_COLOR_POOL = Arrays.asList(
|
||||
@ -127,6 +126,11 @@ public class FUtil
|
||||
return FUtil.DEVELOPERS.contains(name);
|
||||
}
|
||||
|
||||
public static boolean inDeveloperMode()
|
||||
{
|
||||
return ConfigEntry.DEVELOPER_MODE.getBoolean();
|
||||
}
|
||||
|
||||
public static String formatName(String name)
|
||||
{
|
||||
return WordUtils.capitalizeFully(name.replace("_", " "));
|
||||
@ -134,11 +138,7 @@ public class FUtil
|
||||
|
||||
public static String showS(int count)
|
||||
{
|
||||
if (count == 1)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return "s";
|
||||
return (count == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
public static List<String> getPlayerList()
|
||||
@ -146,7 +146,7 @@ public class FUtil
|
||||
List<String> names = new ArrayList<>();
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
if (!TotalFreedomMod.plugin().al.vanished.contains(player))
|
||||
if (!TotalFreedomMod.plugin().al.isVanished(player.getName()))
|
||||
{
|
||||
names.add(player.getName());
|
||||
}
|
||||
@ -173,6 +173,37 @@ public class FUtil
|
||||
|
||||
return Arrays.asList(string.split(", "));
|
||||
}
|
||||
|
||||
/**
|
||||
* A way to get a sublist with a page index and a page size.
|
||||
* @param list A list of objects that should be split into pages.
|
||||
* @param size The size of the pages.
|
||||
* @param index The page index, if outside of bounds error will be thrown. The page index starts at 0 as with all lists.
|
||||
* @return A list of objects that is the page that has been selected from the previous last parameter.
|
||||
*/
|
||||
public static List<String> getPageFromList(List<String> list, int size, int index)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (size >= list.size())
|
||||
{
|
||||
return list;
|
||||
}
|
||||
else if (size * (index + 1) <= list.size())
|
||||
{
|
||||
return list.subList(size * index, size * (index + 1));
|
||||
}
|
||||
else
|
||||
{
|
||||
return list.subList(size * index, (size * index) + (list.size() % size));
|
||||
}
|
||||
}
|
||||
catch (IndexOutOfBoundsException e)
|
||||
{
|
||||
return new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
public static List<String> getAllMaterialNames()
|
||||
{
|
||||
List<String> names = new ArrayList<>();
|
||||
@ -559,6 +590,8 @@ public class FUtil
|
||||
}
|
||||
|
||||
public static String colorize(String string)
|
||||
{
|
||||
if (string != null)
|
||||
{
|
||||
Matcher matcher = Pattern.compile("&#[a-f0-9A-F]{6}").matcher(string);
|
||||
while (matcher.find())
|
||||
@ -568,6 +601,7 @@ public class FUtil
|
||||
}
|
||||
|
||||
string = ChatColor.translateAlternateColorCodes('&', string);
|
||||
}
|
||||
return string;
|
||||
}
|
||||
|
||||
@ -727,6 +761,16 @@ public class FUtil
|
||||
return Color.fromRGB((int) c1values[0], (int) c1values[1], (int) c1values[2]);
|
||||
}
|
||||
|
||||
public static boolean isValidIPv4(String ip)
|
||||
{
|
||||
if (ip.matches("^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))$")
|
||||
|| ip.matches("^([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([0-9]|[1-9][0-9]|1([0-9][0-9])|2([0-4][0-9]|5[0-5]))\\.([*])\\.([*])$"))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static List<Color> createColorGradient(Color c1, Color c2, int steps)
|
||||
{
|
||||
double factor = 1.0 / (steps - 1.0);
|
||||
@ -738,6 +782,14 @@ public class FUtil
|
||||
return colors;
|
||||
}
|
||||
|
||||
public static boolean colorClose(Color first, Color second, int tresHold)
|
||||
{
|
||||
int redDelta = Math.abs(first.getRed() - second.getRed());
|
||||
int greenDelta = Math.abs(first.getGreen() - second.getGreen());
|
||||
int blueDelta = Math.abs(first.getBlue() - second.getBlue());
|
||||
return (redDelta + greenDelta + blueDelta) < tresHold;
|
||||
}
|
||||
|
||||
public static Color fromAWT(java.awt.Color color)
|
||||
{
|
||||
return Color.fromRGB(color.getRed(), color.getGreen(), color.getBlue());
|
||||
@ -748,6 +800,21 @@ public class FUtil
|
||||
return new java.awt.Color(color.getRed(), color.getGreen(), color.getBlue());
|
||||
}
|
||||
|
||||
public static java.awt.Color getRandomAWTColor()
|
||||
{
|
||||
return new java.awt.Color(randomInteger(0, 255), randomInteger(0, 255), randomInteger(0, 255));
|
||||
}
|
||||
|
||||
public static String getHexStringOfAWTColor(java.awt.Color color)
|
||||
{
|
||||
String hex = Integer.toHexString(color.getRGB() & 0xFFFFFF);
|
||||
if (hex.length() < 6)
|
||||
{
|
||||
hex = "0" + hex;
|
||||
}
|
||||
return "#" + hex;
|
||||
}
|
||||
|
||||
public static void createExplosionOnDelay(Location location, float power, int delay)
|
||||
{
|
||||
new BukkitRunnable()
|
||||
|
@ -3,10 +3,12 @@ package me.totalfreedom.totalfreedommod.util;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class Groups
|
||||
{
|
||||
|
||||
public static final List<Material> WOOL_COLORS = Arrays.asList(
|
||||
Material.WHITE_WOOL,
|
||||
Material.RED_WOOL,
|
||||
@ -24,6 +26,7 @@ public class Groups
|
||||
Material.GRAY_WOOL,
|
||||
Material.LIGHT_GRAY_WOOL,
|
||||
Material.BLACK_WOOL);
|
||||
|
||||
public static final List<Material> SHULKER_BOXES = Arrays.asList(
|
||||
Material.SHULKER_BOX,
|
||||
Material.WHITE_SHULKER_BOX,
|
||||
@ -101,6 +104,7 @@ public class Groups
|
||||
EntityType.WITCH,
|
||||
EntityType.WITHER_SKELETON,
|
||||
EntityType.WOLF,
|
||||
EntityType.ZOGLIN,
|
||||
EntityType.ZOMBIE,
|
||||
EntityType.ZOMBIE_HORSE,
|
||||
EntityType.ZOMBIFIED_PIGLIN,
|
||||
@ -138,6 +142,7 @@ public class Groups
|
||||
Material.PARROT_SPAWN_EGG,
|
||||
Material.PHANTOM_SPAWN_EGG,
|
||||
Material.PIG_SPAWN_EGG,
|
||||
Material.PIGLIN_SPAWN_EGG,
|
||||
Material.PILLAGER_SPAWN_EGG,
|
||||
Material.POLAR_BEAR_SPAWN_EGG,
|
||||
Material.PUFFERFISH_SPAWN_EGG,
|
||||
@ -164,6 +169,7 @@ public class Groups
|
||||
Material.WITCH_SPAWN_EGG,
|
||||
Material.WITHER_SKELETON_SPAWN_EGG,
|
||||
Material.WOLF_SPAWN_EGG,
|
||||
Material.ZOGLIN_SPAWN_EGG,
|
||||
Material.ZOMBIE_SPAWN_EGG,
|
||||
Material.ZOMBIE_HORSE_SPAWN_EGG,
|
||||
Material.ZOMBIFIED_PIGLIN_SPAWN_EGG,
|
||||
@ -203,21 +209,15 @@ public class Groups
|
||||
Material.YELLOW_BANNER,
|
||||
Material.YELLOW_WALL_BANNER);
|
||||
|
||||
public static final List<Material> BED_COLORS = Arrays.asList(
|
||||
Material.WHITE_BED,
|
||||
Material.RED_BED,
|
||||
Material.ORANGE_BED,
|
||||
Material.YELLOW_BED,
|
||||
Material.GREEN_BED,
|
||||
Material.LIME_BED,
|
||||
Material.LIGHT_BLUE_BED,
|
||||
Material.CYAN_BED,
|
||||
Material.BLUE_BED,
|
||||
Material.PURPLE_BED,
|
||||
Material.MAGENTA_BED,
|
||||
Material.PINK_BED,
|
||||
Material.BROWN_BED,
|
||||
Material.GRAY_BED,
|
||||
Material.LIGHT_GRAY_BED,
|
||||
Material.BLACK_BED);
|
||||
public static final List<Biome> EXPLOSIVE_BED_BIOMES = Arrays.asList(
|
||||
Biome.NETHER_WASTES,
|
||||
Biome.CRIMSON_FOREST,
|
||||
Biome.SOUL_SAND_VALLEY,
|
||||
Biome.WARPED_FOREST,
|
||||
Biome.BASALT_DELTAS,
|
||||
Biome.END_BARRENS,
|
||||
Biome.END_HIGHLANDS,
|
||||
Biome.END_MIDLANDS,
|
||||
Biome.THE_END,
|
||||
Biome.SMALL_END_ISLANDS);
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
package me.totalfreedom.totalfreedommod.world;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -17,7 +12,6 @@ import org.bukkit.WorldCreator;
|
||||
import org.bukkit.WorldType;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
@ -29,10 +23,7 @@ public final class AdminWorld extends CustomWorld
|
||||
private static final String GENERATION_PARAMETERS = ConfigEntry.FLATLANDS_GENERATE_PARAMS.getString();
|
||||
//
|
||||
private final Map<Player, Long> teleportCooldown = new HashMap<>();
|
||||
private final Map<CommandSender, Boolean> accessCache = new HashMap<>();
|
||||
//
|
||||
private Long cacheLastCleared = null;
|
||||
private Map<Player, Player> guestList = new HashMap<>(); // Guest, Supervisor
|
||||
private WorldWeather weather = WorldWeather.OFF;
|
||||
private WorldTime time = WorldTime.INHERIT;
|
||||
|
||||
@ -44,11 +35,6 @@ public final class AdminWorld extends CustomWorld
|
||||
@Override
|
||||
public void sendToWorld(Player player)
|
||||
{
|
||||
if (!canAccessWorld(player))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
super.sendToWorld(player);
|
||||
}
|
||||
|
||||
@ -83,78 +69,6 @@ public final class AdminWorld extends CustomWorld
|
||||
return world;
|
||||
}
|
||||
|
||||
public boolean addGuest(Player guest, Player supervisor)
|
||||
{
|
||||
if (guest == supervisor || plugin.al.isAdmin(guest))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (plugin.al.isAdmin(supervisor))
|
||||
{
|
||||
guestList.put(guest, supervisor);
|
||||
wipeAccessCache();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public Player removeGuest(Player guest)
|
||||
{
|
||||
final Player player = guestList.remove(guest);
|
||||
wipeAccessCache();
|
||||
return player;
|
||||
}
|
||||
|
||||
public List<String> getGuestList()
|
||||
{
|
||||
List<String> guests = new ArrayList<>();
|
||||
for (Player guest : guestList.keySet())
|
||||
{
|
||||
guests.add(guest.getName());
|
||||
}
|
||||
return guests;
|
||||
}
|
||||
|
||||
public Player removeGuest(String partialName)
|
||||
{
|
||||
partialName = partialName.toLowerCase();
|
||||
final Iterator<Player> it = guestList.keySet().iterator();
|
||||
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Player player = it.next();
|
||||
if (player.getName().toLowerCase().contains(partialName))
|
||||
{
|
||||
removeGuest(player);
|
||||
return player;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String guestListToString()
|
||||
{
|
||||
final List<String> output = new ArrayList<>();
|
||||
final Iterator<Map.Entry<Player, Player>> it = guestList.entrySet().iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
final Entry<Player, Player> entry = it.next();
|
||||
final Player player = entry.getKey();
|
||||
final Player supervisor = entry.getValue();
|
||||
output.add(player.getName() + " (Supervisor: " + supervisor.getName() + ")");
|
||||
}
|
||||
return StringUtils.join(output, ", ");
|
||||
}
|
||||
|
||||
public void purgeGuestList()
|
||||
{
|
||||
guestList.clear();
|
||||
wipeAccessCache();
|
||||
}
|
||||
|
||||
public boolean validateMovement(PlayerMoveEvent event)
|
||||
{
|
||||
World world;
|
||||
@ -173,10 +87,6 @@ public final class AdminWorld extends CustomWorld
|
||||
}
|
||||
|
||||
final Player player = event.getPlayer();
|
||||
if (canAccessWorld(player))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
Long lastTP = teleportCooldown.get(player);
|
||||
|
||||
@ -190,40 +100,6 @@ public final class AdminWorld extends CustomWorld
|
||||
return false;
|
||||
}
|
||||
|
||||
public void wipeAccessCache()
|
||||
{
|
||||
cacheLastCleared = System.currentTimeMillis();
|
||||
accessCache.clear();
|
||||
}
|
||||
|
||||
public boolean canAccessWorld(final Player player)
|
||||
{
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (cacheLastCleared == null || cacheLastCleared.longValue() + CACHE_CLEAR_FREQUENCY <= currentTimeMillis)
|
||||
{
|
||||
cacheLastCleared = currentTimeMillis;
|
||||
accessCache.clear();
|
||||
}
|
||||
|
||||
Boolean cached = accessCache.get(player);
|
||||
if (cached == null)
|
||||
{
|
||||
boolean canAccess = plugin.al.isAdmin(player);
|
||||
if (!canAccess)
|
||||
{
|
||||
Player supervisor = guestList.get(player);
|
||||
canAccess = supervisor != null && supervisor.isOnline() && plugin.al.isAdmin(supervisor);
|
||||
if (!canAccess)
|
||||
{
|
||||
guestList.remove(player);
|
||||
}
|
||||
}
|
||||
cached = canAccess;
|
||||
accessCache.put(player, cached);
|
||||
}
|
||||
return cached;
|
||||
}
|
||||
|
||||
public WorldWeather getWeatherMode()
|
||||
{
|
||||
return weather;
|
||||
|
@ -63,40 +63,6 @@ public class WorldManager extends FreedomService
|
||||
hubworld.getWorld().save();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerTeleport(PlayerTeleportEvent event)
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
final FPlayer fPlayer = plugin.pl.getPlayer(player);
|
||||
if (!plugin.al.isAdmin(player) && fPlayer.getFreezeData().isFrozen())
|
||||
{
|
||||
return; // Don't process adminworld validation
|
||||
}
|
||||
|
||||
adminworld.validateMovement(event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
|
||||
public void onPlayerMove(PlayerMoveEvent event)
|
||||
{
|
||||
final Location from = event.getFrom();
|
||||
final Location to = event.getTo();
|
||||
|
||||
try
|
||||
{
|
||||
if (from.getWorld() == to.getWorld() && from.distanceSquared(to) < (0.0002 * 0.0002))
|
||||
{
|
||||
// If player just rotated, but didn't move, don't process this event.
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException ex)
|
||||
{
|
||||
}
|
||||
|
||||
adminworld.validateMovement(event);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onThunderChange(ThunderChangeEvent event)
|
||||
{
|
||||
|
@ -60,6 +60,11 @@ public class WorldRestrictions extends FreedomService
|
||||
}
|
||||
}
|
||||
|
||||
if (!plugin.al.isAdmin(player) && player.getWorld().equals(plugin.wm.adminworld.getWorld()))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -131,15 +136,17 @@ public class WorldRestrictions extends FreedomService
|
||||
for obtaining a list of a plugin's commands are returning null for world edit. */
|
||||
String command = event.getMessage().split("\\s+")[0].substring(1, event.getMessage().split("\\s+")[0].length()).toLowerCase();
|
||||
|
||||
String allowed = player.getWorld().equals(plugin.wm.adminworld.getWorld()) ? "Admins" : "Master Builders";
|
||||
|
||||
if (command.startsWith("/") || BLOCKED_WORLDEDIT_COMMANDS.contains(command))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Only Master Builders are allowed to use WorldEdit here.");
|
||||
player.sendMessage(ChatColor.RED + "Only " + allowed + " are allowed to use WorldEdit here.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
if (command.equals("coreprotect") || command.equals("core") || command.equals("co"))
|
||||
{
|
||||
player.sendMessage(ChatColor.RED + "Only Master Builders are allowed to use CoreProtect here.");
|
||||
player.sendMessage(ChatColor.RED + "Only " + allowed + " are allowed to use CoreProtect here.");
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +124,7 @@ shop:
|
||||
rideable_pearl: 700
|
||||
stacking_potato: 300
|
||||
clown_fish: 1500
|
||||
magical_saddle: 250
|
||||
|
||||
# Admin list
|
||||
adminlist:
|
||||
@ -485,3 +486,6 @@ autokick:
|
||||
|
||||
# Blocked Chat Codes - Use &code,&code2,&code3 (No spaces)
|
||||
blocked_chatcodes: '&0,&k,&m,&n'
|
||||
|
||||
# Enables certain things like debug logs and console bypasses
|
||||
developer_mode: false
|
||||
|
@ -2,6 +2,6 @@ name: TotalFreedomMod
|
||||
main: me.totalfreedom.totalfreedommod.TotalFreedomMod
|
||||
version: ${project.version}
|
||||
description: Plugin for the Total Freedom server.
|
||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit]
|
||||
softdepend: [BukkitTelnet, Essentials, LibsDisguises, WorldEdit, WorldGuard, WorldGuardExtraFlags, TFGuilds]
|
||||
authors: [Madgeek1450, Prozza]
|
||||
api-version: 1.15
|
||||
api-version: 1.16
|
Loading…
Reference in New Issue
Block a user