mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-07-01 04:26:42 +00:00
Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
fadcb9ad5d | |||
49f7c6e8c3 | |||
9bcdb2bcdc | |||
ca4670ed89 | |||
adf71cb020 | |||
6e84fdad23 | |||
2ecfd9610f | |||
bb33778fc9 | |||
d4d1000c16 | |||
5a96204f1b | |||
3bd72dacda | |||
a4c8dad865 | |||
82e7a3b659 | |||
586fa98c32 | |||
a8f95bcb19 | |||
82d92565e7 | |||
533e4fe369 | |||
f8304aecd7 | |||
ac6e58ff9e | |||
4be2a1e05b | |||
59831ef1f3 | |||
54e6e2f9b1 | |||
d203772a9a | |||
55522e8191 | |||
ac3d0fca88 | |||
eb6514332e | |||
098d3e4cf1 | |||
81eb333b6a | |||
3057421d6d | |||
9cb96e81ac | |||
d67189e170 | |||
451ef8f009 | |||
7af53448be | |||
2072c89f77 | |||
43b266f17d | |||
c61f7e78fd | |||
14ab1e95b5 | |||
44fe8f6f94 | |||
1c487a6a60 | |||
6f4cc8d4b5 | |||
f98f6990ea | |||
4c81c94702 |
18
.idea/codeStyles/Project.xml
generated
18
.idea/codeStyles/Project.xml
generated
@ -9,6 +9,24 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
|
<JetCodeStyleSettings>
|
||||||
|
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||||
|
<value>
|
||||||
|
<package name="java.util" alias="false" withSubpackages="false" />
|
||||||
|
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||||
|
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||||
|
<value>
|
||||||
|
<package name="" alias="false" withSubpackages="true" />
|
||||||
|
<package name="java" alias="false" withSubpackages="true" />
|
||||||
|
<package name="javax" alias="false" withSubpackages="true" />
|
||||||
|
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||||
|
<package name="" alias="true" withSubpackages="true" />
|
||||||
|
</value>
|
||||||
|
</option>
|
||||||
|
</JetCodeStyleSettings>
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="BRACE_STYLE" value="2" />
|
<option name="BRACE_STYLE" value="2" />
|
||||||
<option name="CLASS_BRACE_STYLE" value="2" />
|
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||||
|
99
pom.xml
99
pom.xml
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
<groupId>me.totalfreedom</groupId>
|
<groupId>me.totalfreedom</groupId>
|
||||||
<artifactId>TotalFreedomMod</artifactId>
|
<artifactId>TotalFreedomMod</artifactId>
|
||||||
<version>2020.9</version>
|
<version>2020.11</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<properties>
|
<properties>
|
||||||
@ -46,7 +46,12 @@
|
|||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
<id>CodeMC</id>
|
<id>CodeMC</id>
|
||||||
<url>https://repo.codemc.org/repository/maven-public</url>
|
<url>https://repo.codemc.org/repository/maven-public/</url>
|
||||||
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>nms-repo</id>
|
||||||
|
<url>https://repo.codemc.org/repository/nms/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
<repository>
|
<repository>
|
||||||
@ -109,20 +114,25 @@
|
|||||||
<id>ess-repo</id>
|
<id>ess-repo</id>
|
||||||
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
<url>https://ci.ender.zone/plugin/repository/everything/</url>
|
||||||
</repository>
|
</repository>
|
||||||
|
|
||||||
|
<repository>
|
||||||
|
<id>telesphoreo-repo</id>
|
||||||
|
<url>https://telesphoreo.me/repo/maven/</url>
|
||||||
|
</repository>
|
||||||
</repositories>
|
</repositories>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.12</version>
|
<version>1.18.16</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-io</groupId>
|
<groupId>commons-io</groupId>
|
||||||
<artifactId>commons-io</artifactId>
|
<artifactId>commons-io</artifactId>
|
||||||
<version>2.7</version>
|
<version>2.8.0</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -136,42 +146,56 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>commons-codec</groupId>
|
<groupId>commons-codec</groupId>
|
||||||
<artifactId>commons-codec</artifactId>
|
<artifactId>commons-codec</artifactId>
|
||||||
<version>1.9</version>
|
<version>1.15</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>me.telesphoreo</groupId>
|
||||||
|
<artifactId>mojangson</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.bstats</groupId>
|
||||||
|
<artifactId>bstats-bukkit</artifactId>
|
||||||
|
<version>1.7</version>
|
||||||
<scope>compile</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.spigotmc</groupId>
|
<groupId>org.spigotmc</groupId>
|
||||||
<artifactId>spigot</artifactId>
|
<artifactId>spigot</artifactId>
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
<version>1.16.3-R0.1-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TotalFreedom</groupId>
|
<groupId>com.github.TotalFreedomMC</groupId>
|
||||||
<artifactId>BukkitTelnet</artifactId>
|
<artifactId>BukkitTelnet</artifactId>
|
||||||
<version>4.5-pre1</version>
|
<version>541e9fdb84</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TFPatches</groupId>
|
<groupId>com.github.TotalFreedomMC</groupId>
|
||||||
<artifactId>TF-LibsDisguises</artifactId>
|
<artifactId>TF-LibsDisguises</artifactId>
|
||||||
<version>0cfa32159a</version>
|
<version>48f01cf2fe</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q.worldedit</groupId>
|
<groupId>com.sk89q.worldedit</groupId>
|
||||||
<artifactId>worldedit-bukkit</artifactId>
|
<artifactId>worldedit-bukkit</artifactId>
|
||||||
<version>7.1.0</version>
|
<version>7.2.0-SNAPSHOT</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.ess3</groupId>
|
<groupId>net.ess3</groupId>
|
||||||
<artifactId>EssentialsX</artifactId>
|
<artifactId>EssentialsX</artifactId>
|
||||||
<version>2.18.0</version>
|
<version>2.18.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -185,22 +209,22 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.coreprotect</groupId>
|
<groupId>net.coreprotect</groupId>
|
||||||
<artifactId>coreprotect</artifactId>
|
<artifactId>coreprotect</artifactId>
|
||||||
<version>2.18.2</version>
|
<version>19.1</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.sk89q.worldguard</groupId>
|
<groupId>com.sk89q.worldguard</groupId>
|
||||||
<artifactId>worldguard-bukkit</artifactId>
|
<artifactId>worldguard-bukkit</artifactId>
|
||||||
<version>7.0.3</version>
|
<version>7.0.4</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.destroystokyo.paper</groupId>
|
<groupId>io.papermc</groupId>
|
||||||
<artifactId>paper-api</artifactId>
|
<artifactId>paperlib</artifactId>
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
<version>1.0.5</version>
|
||||||
<scope>provided</scope>
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -217,13 +241,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bukkit</groupId>
|
|
||||||
<artifactId>bukkit</artifactId>
|
|
||||||
<version>1.16.1-R0.1-SNAPSHOT</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>net.goldtreeservers</groupId>
|
<groupId>net.goldtreeservers</groupId>
|
||||||
<artifactId>worldguardextraflags</artifactId>
|
<artifactId>worldguardextraflags</artifactId>
|
||||||
@ -234,19 +251,21 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.reflections</groupId>
|
<groupId>org.reflections</groupId>
|
||||||
<artifactId>reflections</artifactId>
|
<artifactId>reflections</artifactId>
|
||||||
<version>0.9.11</version>
|
<version>0.9.12</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>javassist</groupId>
|
<groupId>org.javassist</groupId>
|
||||||
<artifactId>javassist</artifactId>
|
<artifactId>javassist</artifactId>
|
||||||
<version>3.12.1.GA</version>
|
<version>3.27.0-GA</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TFPatches</groupId>
|
<groupId>com.github.TotalFreedomMC</groupId>
|
||||||
<artifactId>TFGuilds</artifactId>
|
<artifactId>TFGuilds</artifactId>
|
||||||
<version>ad93b9ed00</version>
|
<version>db036fb187</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
@ -254,6 +273,7 @@
|
|||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
<version>3.1.1</version>
|
<version>3.1.1</version>
|
||||||
|
<scope>compile</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
@ -291,7 +311,7 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>pl.project13.maven</groupId>
|
<groupId>pl.project13.maven</groupId>
|
||||||
<artifactId>git-commit-id-plugin</artifactId>
|
<artifactId>git-commit-id-plugin</artifactId>
|
||||||
<version>4.0.1</version>
|
<version>4.0.2</version>
|
||||||
<executions>
|
<executions>
|
||||||
<execution>
|
<execution>
|
||||||
<id>get-the-git-infos</id>
|
<id>get-the-git-infos</id>
|
||||||
@ -416,14 +436,27 @@
|
|||||||
</goals>
|
</goals>
|
||||||
<configuration>
|
<configuration>
|
||||||
<minimizeJar>true</minimizeJar>
|
<minimizeJar>true</minimizeJar>
|
||||||
|
<relocations>
|
||||||
|
<relocation>
|
||||||
|
<pattern>io.papermc.lib</pattern>
|
||||||
|
<shadedPattern>me.totalfreedom.totalfreedommod.paperlib</shadedPattern> <!-- Replace this -->
|
||||||
|
</relocation>
|
||||||
|
<relocation>
|
||||||
|
<pattern>org.bstats</pattern>
|
||||||
|
<shadedPattern>me.totalfreedom.totalfreedommod</shadedPattern>
|
||||||
|
</relocation>
|
||||||
|
</relocations>
|
||||||
<artifactSet>
|
<artifactSet>
|
||||||
<includes>
|
<includes>
|
||||||
<include>commons-io:commons-io</include>
|
<include>commons-io:commons-io</include>
|
||||||
<include>org.apache.commons:commons-lang3</include>
|
<include>org.apache.commons:commons-lang3</include>
|
||||||
<include>commons-codec:commons-codec</include>
|
<include>commons-codec:commons-codec</include>
|
||||||
<include>org.reflections:reflections</include>
|
<include>org.reflections:reflections</include>
|
||||||
<include>javassist:javassist</include>
|
<include>org.javassist:javassist</include>
|
||||||
<include>me.rayzr522:jsonmessage</include>
|
<include>me.rayzr522:jsonmessage</include>
|
||||||
|
<include>io.papermc:paperlib</include>
|
||||||
|
<include>me.telesphoreo:mojangson</include>
|
||||||
|
<include>org.bstats:bstats-bukkit</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
@ -439,8 +472,8 @@
|
|||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<version>3.1.1</version>
|
|
||||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||||
|
<version>3.1.1</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<configLocation>checkstyle.xml</configLocation>
|
<configLocation>checkstyle.xml</configLocation>
|
||||||
<failOnViolation>true</failOnViolation>
|
<failOnViolation>true</failOnViolation>
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
package ca.momothereal.mojangson;
|
|
||||||
|
|
||||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
|
||||||
import ca.momothereal.mojangson.value.MojangsonString;
|
|
||||||
import ca.momothereal.mojangson.value.MojangsonValue;
|
|
||||||
|
|
||||||
public class MojangsonFinder
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Automatically detects the appropriate MojangsonValue from the given value.
|
|
||||||
*
|
|
||||||
* @param value The value to parse
|
|
||||||
* @return The resulting MojangsonValue. If the type couldn't be found, it falls back to MojangsonString
|
|
||||||
* @throws MojangsonParseException if the given value could not be parsed
|
|
||||||
*/
|
|
||||||
public static MojangsonValue readFromValue(String value) throws MojangsonParseException
|
|
||||||
{
|
|
||||||
MojangsonValue val = new MojangsonString();
|
|
||||||
val.read(value);
|
|
||||||
return val;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,53 +0,0 @@
|
|||||||
package ca.momothereal.mojangson;
|
|
||||||
|
|
||||||
public enum MojangsonToken
|
|
||||||
{
|
|
||||||
|
|
||||||
COMPOUND_START(0, "Compound_Start", '{'),
|
|
||||||
COMPOUND_END(1, "Compound_End", '}'),
|
|
||||||
ELEMENT_SEPERATOR(2, "Element_Seperator", ','),
|
|
||||||
ARRAY_START(3, "Array_Start", '['),
|
|
||||||
ARRAY_END(4, "Array_End", ']'),
|
|
||||||
ELEMENT_PAIR_SEPERATOR(5, "Pair_Seperator", ':'),
|
|
||||||
|
|
||||||
STRING_QUOTES(6, "String_Quotes", '\"'),
|
|
||||||
DOUBLE_SUFFIX(8, "Double_Suffix", 'd'),
|
|
||||||
BYTE_SUFFIX(9, "Byte_Suffix", 'b'),
|
|
||||||
FLOAT_SUFFIX(10, "Float_Suffix", 'f'),
|
|
||||||
SHORT_SUFFIX(11, "Short_Suffix", 's'),
|
|
||||||
LONG_SUFFIX(12, "Long_Suffix", 'l'),
|
|
||||||
|
|
||||||
WHITE_SPACE(13, "WhiteSpace", ' ');
|
|
||||||
|
|
||||||
private int id;
|
|
||||||
private String name;
|
|
||||||
private char symbol;
|
|
||||||
|
|
||||||
MojangsonToken(int id, String name, char symbol)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
this.name = name;
|
|
||||||
this.symbol = symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
|
||||||
{
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public char getSymbol()
|
|
||||||
{
|
|
||||||
return symbol;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString()
|
|
||||||
{
|
|
||||||
return String.valueOf(symbol);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package ca.momothereal.mojangson.ex;
|
|
||||||
|
|
||||||
public class MojangsonParseException extends Exception
|
|
||||||
{
|
|
||||||
|
|
||||||
private ParseExceptionReason reason;
|
|
||||||
|
|
||||||
public MojangsonParseException(String message, ParseExceptionReason reason)
|
|
||||||
{
|
|
||||||
super(message);
|
|
||||||
this.reason = reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ParseExceptionReason getReason()
|
|
||||||
{
|
|
||||||
return reason;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMessage()
|
|
||||||
{
|
|
||||||
return reason.getMessage() + ": " + super.getMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public enum ParseExceptionReason
|
|
||||||
{
|
|
||||||
INVALID_FORMAT_NUM("Given value is not numerical"),
|
|
||||||
UNEXPECTED_SYMBOL("Unexpected symbol in Mojangson string");
|
|
||||||
|
|
||||||
private String message;
|
|
||||||
|
|
||||||
ParseExceptionReason(String message)
|
|
||||||
{
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage()
|
|
||||||
{
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,144 +0,0 @@
|
|||||||
package ca.momothereal.mojangson.value;
|
|
||||||
|
|
||||||
import ca.momothereal.mojangson.MojangsonFinder;
|
|
||||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import static ca.momothereal.mojangson.MojangsonToken.*;
|
|
||||||
|
|
||||||
public class MojangsonCompound extends HashMap<String, List<MojangsonValue>> implements MojangsonValue<Map<String, MojangsonValue>>
|
|
||||||
{
|
|
||||||
|
|
||||||
private final int C_COMPOUND_START = 0; // Parsing context
|
|
||||||
private final int C_COMPOUND_PAIR_KEY = 1; // Parsing context
|
|
||||||
private final int C_COMPOUND_PAIR_VALUE = 2; // Parsing context
|
|
||||||
|
|
||||||
public MojangsonCompound()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MojangsonCompound(Map map)
|
|
||||||
{
|
|
||||||
super(map);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(StringBuilder builder)
|
|
||||||
{
|
|
||||||
builder.append(COMPOUND_START);
|
|
||||||
boolean start = true;
|
|
||||||
|
|
||||||
for (String key : keySet())
|
|
||||||
{
|
|
||||||
if (start)
|
|
||||||
{
|
|
||||||
start = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
builder.append(ELEMENT_SEPERATOR);
|
|
||||||
}
|
|
||||||
|
|
||||||
builder.append(key).append(ELEMENT_PAIR_SEPERATOR);
|
|
||||||
List<MojangsonValue> value = get(key);
|
|
||||||
for (MojangsonValue val : value)
|
|
||||||
{
|
|
||||||
val.write(builder);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
builder.append(COMPOUND_END);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(String string) throws MojangsonParseException
|
|
||||||
{
|
|
||||||
int context = C_COMPOUND_START;
|
|
||||||
String tmp_key = "", tmp_val = "";
|
|
||||||
int scope = 0;
|
|
||||||
boolean inString = false;
|
|
||||||
|
|
||||||
for (int index = 0; index < string.length(); index++)
|
|
||||||
{
|
|
||||||
Character character = string.charAt(index);
|
|
||||||
|
|
||||||
if (character == STRING_QUOTES.getSymbol())
|
|
||||||
{
|
|
||||||
inString = !inString;
|
|
||||||
}
|
|
||||||
if (character == WHITE_SPACE.getSymbol())
|
|
||||||
{
|
|
||||||
if (!inString)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ((character == COMPOUND_START.getSymbol() || character == ARRAY_START.getSymbol()) && !inString)
|
|
||||||
{
|
|
||||||
scope++;
|
|
||||||
}
|
|
||||||
if ((character == COMPOUND_END.getSymbol() || character == ARRAY_END.getSymbol()) && !inString)
|
|
||||||
{
|
|
||||||
scope--;
|
|
||||||
}
|
|
||||||
if (context == C_COMPOUND_START)
|
|
||||||
{
|
|
||||||
if (character != COMPOUND_START.getSymbol())
|
|
||||||
{
|
|
||||||
parseException(index, character);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
context++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (context == C_COMPOUND_PAIR_KEY)
|
|
||||||
{
|
|
||||||
if (character == ELEMENT_PAIR_SEPERATOR.getSymbol() && scope <= 1)
|
|
||||||
{
|
|
||||||
context++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
tmp_key += character;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (context == C_COMPOUND_PAIR_VALUE)
|
|
||||||
{
|
|
||||||
if ((character == ELEMENT_SEPERATOR.getSymbol() || character == COMPOUND_END.getSymbol()) && scope <= 1 && !inString)
|
|
||||||
{
|
|
||||||
context = C_COMPOUND_PAIR_KEY;
|
|
||||||
computeIfAbsent(tmp_key, k -> new ArrayList<>()).add(MojangsonFinder.readFromValue(tmp_val));
|
|
||||||
tmp_key = tmp_val = "";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
tmp_val += character;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, MojangsonValue> getValue()
|
|
||||||
{
|
|
||||||
HashMap<String, MojangsonValue> hack = new HashMap<>();
|
|
||||||
for (String string : keySet())
|
|
||||||
{
|
|
||||||
for (MojangsonValue value : get(string))
|
|
||||||
{
|
|
||||||
hack.put(string, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return hack;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class getValueClass()
|
|
||||||
{
|
|
||||||
return Map.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void parseException(int index, char symbol) throws MojangsonParseException
|
|
||||||
{
|
|
||||||
throw new MojangsonParseException("Index: " + index + ", symbol: \'" + symbol + "\'", MojangsonParseException.ParseExceptionReason.UNEXPECTED_SYMBOL);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,57 +0,0 @@
|
|||||||
package ca.momothereal.mojangson.value;
|
|
||||||
|
|
||||||
import ca.momothereal.mojangson.MojangsonToken;
|
|
||||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
|
||||||
|
|
||||||
public class MojangsonString implements MojangsonValue<String>
|
|
||||||
{
|
|
||||||
private String value;
|
|
||||||
|
|
||||||
public MojangsonString()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public MojangsonString(String value)
|
|
||||||
{
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getValue()
|
|
||||||
{
|
|
||||||
return value;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setValue(String value)
|
|
||||||
{
|
|
||||||
this.value = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void write(StringBuilder builder)
|
|
||||||
{
|
|
||||||
builder.append(MojangsonToken.STRING_QUOTES).append(value).append(MojangsonToken.STRING_QUOTES);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Class getValueClass()
|
|
||||||
{
|
|
||||||
return String.class;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void read(String string) throws MojangsonParseException
|
|
||||||
{
|
|
||||||
Character lastChar = string.charAt(string.length() - 1);
|
|
||||||
Character firstChar = string.charAt(0);
|
|
||||||
|
|
||||||
if (firstChar == MojangsonToken.STRING_QUOTES.getSymbol() && lastChar == MojangsonToken.STRING_QUOTES.getSymbol())
|
|
||||||
{
|
|
||||||
value = string.substring(1, string.length() - 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
value = string;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,42 +0,0 @@
|
|||||||
package ca.momothereal.mojangson.value;
|
|
||||||
|
|
||||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Represents a value inside a compound or array.
|
|
||||||
*
|
|
||||||
* @param <T> The type of value this MojangsonValue holds
|
|
||||||
*/
|
|
||||||
public interface MojangsonValue<T>
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the value to a StringBuilder buffer.
|
|
||||||
*
|
|
||||||
* @param builder The buffer to write to
|
|
||||||
*/
|
|
||||||
void write(StringBuilder builder);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Parses and updates the current value to the given string representation
|
|
||||||
*
|
|
||||||
* @param string The string representation of the value
|
|
||||||
* @throws MojangsonParseException if the given value cannot be parsed
|
|
||||||
*/
|
|
||||||
void read(String string) throws MojangsonParseException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the current literal value
|
|
||||||
*
|
|
||||||
* @return The current literal value of the MojangsonValue
|
|
||||||
*/
|
|
||||||
T getValue();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the literal value's class
|
|
||||||
*
|
|
||||||
* @return The literal value's class
|
|
||||||
*/
|
|
||||||
Class getValueClass();
|
|
||||||
|
|
||||||
}
|
|
@ -1,187 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import joptsimple.internal.Strings;
|
|
||||||
import lombok.Getter;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.json.simple.JSONObject;
|
|
||||||
import org.json.simple.parser.JSONParser;
|
|
||||||
import org.json.simple.parser.ParseException;
|
|
||||||
|
|
||||||
public class AMP extends FreedomService
|
|
||||||
{
|
|
||||||
|
|
||||||
public String URL = ConfigEntry.AMP_URL.getString();
|
|
||||||
private String API_URL = URL + "/API/Core";
|
|
||||||
private String USERNAME = ConfigEntry.AMP_USERNAME.getString();
|
|
||||||
private String PASSWORD = ConfigEntry.AMP_PASSWORD.getString();
|
|
||||||
private String SESSION_ID;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private boolean enabled = !Strings.isNullOrEmpty(URL);
|
|
||||||
|
|
||||||
private final List<String> headers = Arrays.asList("Accept:application/json");
|
|
||||||
|
|
||||||
public void onStart()
|
|
||||||
{
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
login();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onStop()
|
|
||||||
{
|
|
||||||
if (enabled)
|
|
||||||
{
|
|
||||||
logout();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void login()
|
|
||||||
{
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("username", USERNAME);
|
|
||||||
json.put("password", PASSWORD);
|
|
||||||
json.put("token", "");
|
|
||||||
json.put("rememberMe", false);
|
|
||||||
|
|
||||||
String response;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
response = FUtil.sendRequest(API_URL + "/Login", "POST", headers, json.toJSONString());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
JSONObject jsonResponse;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
jsonResponse = (JSONObject)new JSONParser().parse(response);
|
|
||||||
}
|
|
||||||
catch (ParseException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Object sessionID = jsonResponse.get("sessionID");
|
|
||||||
if (sessionID == null)
|
|
||||||
{
|
|
||||||
FLog.warning("Invalid AMP credentials have been specified in the config");
|
|
||||||
enabled = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
SESSION_ID = sessionID.toString();
|
|
||||||
FLog.info("Logged into AMP");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void logout()
|
|
||||||
{
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("SESSIONID", SESSION_ID);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FUtil.sendRequest(API_URL + "/Logout", "POST", headers, json.toJSONString());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLog.info("Logged out of AMP");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateAccountStatus(StaffMember staffMember)
|
|
||||||
{
|
|
||||||
String username = staffMember.getAmpUsername();
|
|
||||||
|
|
||||||
if (username == null || !enabled)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!staffMember.isActive() || staffMember.getRank() != Rank.ADMIN)
|
|
||||||
{
|
|
||||||
FLog.debug("Disabling amp acc");
|
|
||||||
setAccountEnabled(username, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
FLog.debug("Enabling amp acc");
|
|
||||||
setAccountEnabled(username, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void createAccount(String username, String password)
|
|
||||||
{
|
|
||||||
makeAccount(username);
|
|
||||||
setPassword(username, password);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setAccountEnabled(String username, boolean enable)
|
|
||||||
{
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("Username", username);
|
|
||||||
json.put("Disabled", !enable);
|
|
||||||
json.put("PasswordExpires", false);
|
|
||||||
json.put("CannotChangePassword", false);
|
|
||||||
json.put("MustChangePassword", false);
|
|
||||||
json.put("SESSIONID", SESSION_ID);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FUtil.sendRequest(API_URL + "/UpdateUserInfo", "POST", headers, json.toJSONString());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void makeAccount(String username)
|
|
||||||
{
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("Username", username);
|
|
||||||
json.put("SESSIONID", SESSION_ID);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FUtil.sendRequest(API_URL + "/CreateUser", "POST", headers, json.toJSONString());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String username, String password)
|
|
||||||
{
|
|
||||||
JSONObject json = new JSONObject();
|
|
||||||
json.put("Username", username);
|
|
||||||
json.put("NewPassword", password);
|
|
||||||
json.put("SESSIONID", SESSION_ID);
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FUtil.sendRequest(API_URL + "/ResetUserPassword", "POST", headers, json.toJSONString());
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
e.printStackTrace();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
@ -197,7 +198,7 @@ public class LoginProcess extends FreedomService
|
|||||||
int z = FUtil.randomInteger(-10000, 10000);
|
int z = FUtil.randomInteger(-10000, 10000);
|
||||||
int y = player.getWorld().getHighestBlockYAt(x, z);
|
int y = player.getWorld().getHighestBlockYAt(x, z);
|
||||||
Location location = new Location(player.getLocation().getWorld(), x, y, z);
|
Location location = new Location(player.getLocation().getWorld(), x, y, z);
|
||||||
player.teleport(location);
|
PaperLib.teleportAsync(player, location);
|
||||||
player.sendMessage(ChatColor.AQUA + "You have been teleported to a random location automatically.");
|
player.sendMessage(ChatColor.AQUA + "You have been teleported to a random location automatically.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,6 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -47,7 +46,7 @@ public class Monitors extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.sl.messageAllStaff(ChatColor.translateAlternateColorCodes('&', String.format("&8[&ePotionSpy&8] &r%s splashed %s %s at X: %s Y: %s Z: %s in the world '%s'%s.",
|
plugin.sl.potionSpyMessage(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(),
|
player.getName(), potionsThrown, potionsThrown == 1 ? "potion" : "potions", latestThrownPotion.getLocation().getBlockX(), latestThrownPotion.getLocation().getBlockY(), latestThrownPotion.getLocation().getBlockZ(),
|
||||||
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
latestThrownPotion.getWorld().getName(), trollPotions > 0 ? String.format(" &c(most likely troll %s)", trollPotions == 1 ? "potion" : "potions") : "")));
|
||||||
}
|
}
|
||||||
|
@ -3,14 +3,15 @@ package me.totalfreedom.totalfreedommod;
|
|||||||
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
import ca.momothereal.mojangson.ex.MojangsonParseException;
|
||||||
import ca.momothereal.mojangson.value.MojangsonCompound;
|
import ca.momothereal.mojangson.value.MojangsonCompound;
|
||||||
import ca.momothereal.mojangson.value.MojangsonValue;
|
import ca.momothereal.mojangson.value.MojangsonValue;
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
import net.minecraft.server.v1_16_R2.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagList;
|
import net.minecraft.server.v1_16_R2.NBTTagList;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -61,7 +62,7 @@ public class MovementValidator extends FreedomService
|
|||||||
if (Math.abs(event.getTo().getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD)
|
if (Math.abs(event.getTo().getX()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getZ()) >= MAX_XYZ_COORD || Math.abs(event.getTo().getY()) >= MAX_XYZ_COORD)
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
player.teleport(player.getWorld().getSpawnLocation());
|
PaperLib.teleportAsync(player, player.getWorld().getSpawnLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exploitItem(event.getPlayer().getInventory().getHelmet()))
|
if (exploitItem(event.getPlayer().getInventory().getHelmet()))
|
||||||
@ -110,7 +111,7 @@ public class MovementValidator extends FreedomService
|
|||||||
// Validate position
|
// Validate position
|
||||||
if (Math.abs(player.getLocation().getX()) >= MAX_XYZ_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XYZ_COORD || Math.abs(player.getLocation().getY()) >= MAX_XYZ_COORD)
|
if (Math.abs(player.getLocation().getX()) >= MAX_XYZ_COORD || Math.abs(player.getLocation().getZ()) >= MAX_XYZ_COORD || Math.abs(player.getLocation().getY()) >= MAX_XYZ_COORD)
|
||||||
{
|
{
|
||||||
player.teleport(player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn
|
PaperLib.teleportAsync(player, player.getWorld().getSpawnLocation()); // Illegal position, teleport to spawn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,7 +132,7 @@ public class MovementValidator extends FreedomService
|
|||||||
|
|
||||||
private Boolean exploitItem(ItemStack item)
|
private Boolean exploitItem(ItemStack item)
|
||||||
{
|
{
|
||||||
net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.v1_16_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||||
NBTTagList modifiers = getAttributeList(nmsStack);
|
NBTTagList modifiers = getAttributeList(nmsStack);
|
||||||
MojangsonCompound compound = new MojangsonCompound();
|
MojangsonCompound compound = new MojangsonCompound();
|
||||||
boolean foundNegative = false;
|
boolean foundNegative = false;
|
||||||
@ -168,7 +169,7 @@ public class MovementValidator extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R1.ItemStack stack)
|
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R2.ItemStack stack)
|
||||||
{
|
{
|
||||||
if (stack.getTag() == null)
|
if (stack.getTag() == null)
|
||||||
{
|
{
|
||||||
|
178
src/main/java/me/totalfreedom/totalfreedommod/Pterodactyl.java
Normal file
178
src/main/java/me/totalfreedom/totalfreedommod/Pterodactyl.java
Normal file
@ -0,0 +1,178 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import joptsimple.internal.Strings;
|
||||||
|
import lombok.Getter;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.Response;
|
||||||
|
import org.json.simple.JSONObject;
|
||||||
|
import org.json.simple.parser.ParseException;
|
||||||
|
|
||||||
|
public class Pterodactyl extends FreedomService
|
||||||
|
{
|
||||||
|
|
||||||
|
public final String URL = ConfigEntry.PTERO_URL.getString();
|
||||||
|
private final String SERVER_KEY = ConfigEntry.PTERO_SERVER_KEY.getString();
|
||||||
|
private final String ADMIN_KEY = ConfigEntry.PTERO_ADMIN_KEY.getString();
|
||||||
|
private final List<String> SERVER_HEADERS = Arrays.asList("Accept:Application/vnd.pterodactyl.v1+json", "Content-Type:application/json", "Authorization:Bearer " + SERVER_KEY);
|
||||||
|
private final List<String> ADMIN_HEADERS = Arrays.asList("Accept:Application/vnd.pterodactyl.v1+json", "Content-Type:application/json", "Authorization:Bearer " + ADMIN_KEY);
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private boolean enabled = !Strings.isNullOrEmpty(URL);
|
||||||
|
|
||||||
|
public void onStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public void updateAccountStatus(StaffMember staffMember)
|
||||||
|
{
|
||||||
|
String id = staffMember.getPteroID();
|
||||||
|
|
||||||
|
if (Strings.isNullOrEmpty(id) || !enabled)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!staffMember.isActive() || staffMember.getRank() != Rank.SENIOR_ADMIN)
|
||||||
|
{
|
||||||
|
FLog.debug("Disabling ptero acc");
|
||||||
|
removeAccountFromServer(id);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
FLog.debug("Enabling aptero acc");
|
||||||
|
addAccountToServer(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String createAccount(String username, String password)
|
||||||
|
{
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("username", username);
|
||||||
|
json.put("password", password);
|
||||||
|
json.put("email", username.toLowerCase() + "@" + ConfigEntry.PTERO_DEFAULT_EMAIL_DOMAIN.getString());
|
||||||
|
json.put("first_name", username);
|
||||||
|
json.put("last_name", "\u200E"); // required, so I made it appear empty
|
||||||
|
|
||||||
|
Response response;
|
||||||
|
JSONObject jsonResponse;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = FUtil.sendRequest(URL + "/api/application/users", "POST", ADMIN_HEADERS, json.toJSONString());
|
||||||
|
jsonResponse = response.getJSONMessage();
|
||||||
|
}
|
||||||
|
catch (IOException | ParseException e)
|
||||||
|
{
|
||||||
|
FLog.severe(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ((JSONObject)jsonResponse.get("attributes")).get("id").toString();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean deleteAccount(String id)
|
||||||
|
{
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
try
|
||||||
|
{
|
||||||
|
return FUtil.sendRequest(URL + "/api/application/users/" + id, "DELETE", ADMIN_HEADERS, json.toJSONString()).getCode() == 204;
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FLog.severe(e);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addAccountToServer(String id)
|
||||||
|
{
|
||||||
|
String url = URL + "/api/client/servers/" + ConfigEntry.PTERO_SERVER_UUID.getString() + "/users";
|
||||||
|
|
||||||
|
JSONObject userData = getUserData(id);
|
||||||
|
if (userData == null)
|
||||||
|
{
|
||||||
|
FLog.severe("The Pterodactyl user with the ID of " + id + " was not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("email", userData.get("email").toString());
|
||||||
|
json.put("permissions", Arrays.asList("control.console", "control.start", "control.restart", "control.stop", "control.kill"));
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FUtil.sendRequest(url, "POST", SERVER_HEADERS, json.toJSONString());
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FLog.severe(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void removeAccountFromServer(String id)
|
||||||
|
{
|
||||||
|
JSONObject userData = getUserData(id);
|
||||||
|
if (userData == null)
|
||||||
|
{
|
||||||
|
FLog.severe("The Pterodactyl user with the ID of " + id + " was not found");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
String url = URL + "/api/client/servers/" + ConfigEntry.PTERO_SERVER_UUID.getString() + "/users/" + userData.get("uuid");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FUtil.sendRequest(url, "DELETE", SERVER_HEADERS, null);
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FLog.severe(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public JSONObject getUserData(String id)
|
||||||
|
{
|
||||||
|
Response response;
|
||||||
|
JSONObject jsonResponse;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
response = FUtil.sendRequest(URL + "/api/application/users/" + id, "GET", ADMIN_HEADERS, null);
|
||||||
|
jsonResponse = response.getJSONMessage();
|
||||||
|
|
||||||
|
}
|
||||||
|
catch (IOException | ParseException e)
|
||||||
|
{
|
||||||
|
FLog.severe(e);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (JSONObject)jsonResponse.get("attributes");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// API patch function on users doesnt work rn, it throws 500 errors, so it's probably not written yet
|
||||||
|
public void setPassword(String id, String password)
|
||||||
|
{
|
||||||
|
JSONObject json = new JSONObject();
|
||||||
|
json.put("password", password);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FUtil.sendRequest(URL + "/api/application/users/" + id, "PATCH", ADMIN_HEADERS, json.toJSONString());
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
FLog.severe(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -31,7 +31,7 @@ public class Reddit extends FreedomService
|
|||||||
private final String CLIENT_ID = ConfigEntry.REDDIT_CLIENT_ID.getString();
|
private final String CLIENT_ID = ConfigEntry.REDDIT_CLIENT_ID.getString();
|
||||||
private final String CLIENT_SECRET = ConfigEntry.REDDIT_CLIENT_SECRET.getString();
|
private final String CLIENT_SECRET = ConfigEntry.REDDIT_CLIENT_SECRET.getString();
|
||||||
|
|
||||||
private final UserAgent userAgent = new UserAgent("bot", "me.totalfreedom.reddit", plugin.build.version, USERNAME);
|
private final UserAgent userAgent = new UserAgent("bot", "me.totalfreedom.reddit", TotalFreedomMod.build.version, USERNAME);
|
||||||
private final Credentials credentials = Credentials.script(USERNAME, PASSWORD, CLIENT_ID, CLIENT_SECRET);
|
private final Credentials credentials = Credentials.script(USERNAME, PASSWORD, CLIENT_ID, CLIENT_SECRET);
|
||||||
|
|
||||||
private RedditClient reddit = null;
|
private RedditClient reddit = null;
|
||||||
@ -201,23 +201,17 @@ public class Reddit extends FreedomService
|
|||||||
{
|
{
|
||||||
flairList.put(Title.OWNER, ConfigEntry.REDDIT_SERVER_OWNER_FLAIR_ID.getString());
|
flairList.put(Title.OWNER, ConfigEntry.REDDIT_SERVER_OWNER_FLAIR_ID.getString());
|
||||||
flairList.put(Title.EXECUTIVE, ConfigEntry.REDDIT_EXECUTIVE_FLAIR_ID.getString());
|
flairList.put(Title.EXECUTIVE, ConfigEntry.REDDIT_EXECUTIVE_FLAIR_ID.getString());
|
||||||
flairList.put(Title.ASSISTANT_EXECUTIVE, ConfigEntry.REDDIT_ASSISTANT_EXECUTIVE_FLAIR_ID.getString());
|
|
||||||
flairList.put(Title.DEVELOPER, ConfigEntry.REDDIT_DEVELOPER_FLAIR_ID.getString());
|
flairList.put(Title.DEVELOPER, ConfigEntry.REDDIT_DEVELOPER_FLAIR_ID.getString());
|
||||||
flairList.put(Rank.ADMIN, ConfigEntry.REDDIT_ADMIN_FLAIR_ID.getString());
|
flairList.put(Rank.SENIOR_ADMIN, ConfigEntry.REDDIT_SENIOR_ADMIN_FLAIR_ID.getString());
|
||||||
flairList.put(Rank.MOD, ConfigEntry.REDDIT_MOD_FLAIR_ID.getString());
|
flairList.put(Rank.ADMIN, ConfigEntry.REDDIT_NEW_ADMIN_FLAIR_ID.getString());
|
||||||
flairList.put(Rank.TRIAL_MOD, ConfigEntry.REDDIT_TRIAL_MOD_FLAIR_ID.getString());
|
|
||||||
flairList.put(Title.MASTER_BUILDER, ConfigEntry.REDDIT_MASTER_BUILDER_FLAIR_ID.getString());
|
flairList.put(Title.MASTER_BUILDER, ConfigEntry.REDDIT_MASTER_BUILDER_FLAIR_ID.getString());
|
||||||
flairList.put(Title.DONATOR, ConfigEntry.REDDIT_DONATOR_FLAIR_ID.getString());
|
|
||||||
|
|
||||||
// Work around because the current flair id keeps returning null, either a JRAW bug or a reddit bug
|
// Work around because the current flair ID keeps returning null, either a JRAW bug or a Reddit bug
|
||||||
flairNameList.put(Title.OWNER, "Server Owner");
|
flairNameList.put(Title.OWNER, "Server Owner");
|
||||||
flairNameList.put(Title.EXECUTIVE, "Executive");
|
flairNameList.put(Title.EXECUTIVE, "Executive");
|
||||||
flairNameList.put(Title.ASSISTANT_EXECUTIVE, "Assistant Executive");
|
|
||||||
flairNameList.put(Title.DEVELOPER, "Developer");
|
flairNameList.put(Title.DEVELOPER, "Developer");
|
||||||
|
flairNameList.put(Rank.SENIOR_ADMIN, "Senior Admin");
|
||||||
flairNameList.put(Rank.ADMIN, "Admin");
|
flairNameList.put(Rank.ADMIN, "Admin");
|
||||||
flairNameList.put(Rank.MOD, "Mod");
|
|
||||||
flairNameList.put(Rank.TRIAL_MOD, "Trial Mod");
|
|
||||||
flairNameList.put(Title.MASTER_BUILDER, "Master Builder");
|
flairNameList.put(Title.MASTER_BUILDER, "Master Builder");
|
||||||
flairNameList.put(Title.DONATOR, "Premium");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@ import java.util.Arrays;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.minecraft.server.v1_16_R1.EntityPlayer;
|
import net.minecraft.server.v1_16_R2.EntityPlayer;
|
||||||
import net.minecraft.server.v1_16_R1.MinecraftServer;
|
import net.minecraft.server.v1_16_R2.MinecraftServer;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.CraftServer;
|
import org.bukkit.craftbukkit.v1_16_R2.CraftServer;
|
||||||
|
|
||||||
public class ServerInterface extends FreedomService
|
public class ServerInterface extends FreedomService
|
||||||
{
|
{
|
||||||
public static final String COMPILE_NMS_VERSION = "v1_16_R1";
|
public static final String COMPILE_NMS_VERSION = "v1_16_R2";
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
|
@ -50,7 +50,7 @@ import me.totalfreedom.totalfreedommod.util.MethodTimer;
|
|||||||
import me.totalfreedom.totalfreedommod.world.CleanroomChunkGenerator;
|
import me.totalfreedom.totalfreedommod.world.CleanroomChunkGenerator;
|
||||||
import me.totalfreedom.totalfreedommod.world.WorldManager;
|
import me.totalfreedom.totalfreedommod.world.WorldManager;
|
||||||
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
|
import me.totalfreedom.totalfreedommod.world.WorldRestrictions;
|
||||||
import org.bstats.Metrics;
|
import org.bstats.bukkit.Metrics;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.generator.ChunkGenerator;
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
@ -135,7 +135,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public EntityWiper ew;
|
public EntityWiper ew;
|
||||||
public Sitter st;
|
public Sitter st;
|
||||||
public VanishHandler vh;
|
public VanishHandler vh;
|
||||||
public AMP amp;
|
public Pterodactyl ptero;
|
||||||
|
|
||||||
//public HubWorldRestrictions hwr;
|
//public HubWorldRestrictions hwr;
|
||||||
//
|
//
|
||||||
@ -233,7 +233,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
ew = new EntityWiper();
|
ew = new EntityWiper();
|
||||||
st = new Sitter();
|
st = new Sitter();
|
||||||
vh = new VanishHandler();
|
vh = new VanishHandler();
|
||||||
amp = new AMP();
|
ptero = new Pterodactyl();
|
||||||
|
|
||||||
// Single admin utils
|
// Single admin utils
|
||||||
cs = new CommandSpy();
|
cs = new CommandSpy();
|
||||||
|
@ -71,6 +71,10 @@ public class Ban
|
|||||||
dedupeIps();
|
dedupeIps();
|
||||||
this.by = by;
|
this.by = by;
|
||||||
this.at = at;
|
this.at = at;
|
||||||
|
if (expire == null)
|
||||||
|
{
|
||||||
|
expire = FUtil.parseDateOffset("24h");
|
||||||
|
}
|
||||||
this.expiryUnix = FUtil.getUnixTime(expire);
|
this.expiryUnix = FUtil.getUnixTime(expire);
|
||||||
this.reason = reason;
|
this.reason = reason;
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import org.bukkit.GameMode;
|
|||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
import org.bukkit.entity.FishHook;
|
import org.bukkit.entity.FishHook;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.entity.SpectralArrow;
|
||||||
import org.bukkit.entity.Trident;
|
import org.bukkit.entity.Trident;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -43,6 +44,14 @@ public class PVPBlocker extends FreedomService
|
|||||||
player = (Player)arrow.getShooter();
|
player = (Player)arrow.getShooter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (event.getDamager() instanceof SpectralArrow)
|
||||||
|
{
|
||||||
|
SpectralArrow spectralArrow = (SpectralArrow)event.getDamager();
|
||||||
|
if (spectralArrow.getShooter() instanceof Player)
|
||||||
|
{
|
||||||
|
player = (Player)spectralArrow.getShooter();
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (event.getDamager() instanceof Trident)
|
else if (event.getDamager() instanceof Trident)
|
||||||
{
|
{
|
||||||
Trident trident = (Trident)event.getDamager();
|
Trident trident = (Trident)event.getDamager();
|
||||||
@ -84,7 +93,5 @@ public class PVPBlocker extends FreedomService
|
|||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
@ -1,10 +1,10 @@
|
|||||||
package me.totalfreedom.totalfreedommod.blocking;
|
package me.totalfreedom.totalfreedommod.blocking;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
import net.minecraft.server.v1_16_R2.NBTTagCompound;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Tag;
|
import org.bukkit.Tag;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -35,7 +35,7 @@ public class SignBlocker extends FreedomService
|
|||||||
if (Tag.SIGNS.getValues().contains(event.getBlock().getType()))
|
if (Tag.SIGNS.getValues().contains(event.getBlock().getType()))
|
||||||
{
|
{
|
||||||
ItemStack sign = event.getItemInHand();
|
ItemStack sign = event.getItemInHand();
|
||||||
net.minecraft.server.v1_16_R1.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
|
net.minecraft.server.v1_16_R2.ItemStack nmsSign = CraftItemStack.asNMSCopy(sign);
|
||||||
NBTTagCompound compound = (nmsSign.hasTag()) ? nmsSign.getTag() : new NBTTagCompound();
|
NBTTagCompound compound = (nmsSign.hasTag()) ? nmsSign.getTag() : new NBTTagCompound();
|
||||||
NBTTagCompound bet = compound.getCompound("BlockEntityTag");
|
NBTTagCompound bet = compound.getCompound("BlockEntityTag");
|
||||||
String line1 = bet.getString("Text1");
|
String line1 = bet.getString("Text1");
|
||||||
|
@ -43,7 +43,7 @@ public enum CommandBlockerRank
|
|||||||
StaffMember staffMember = TotalFreedomMod.plugin().sl.getAdmin(sender);
|
StaffMember staffMember = TotalFreedomMod.plugin().sl.getAdmin(sender);
|
||||||
if (staffMember != null)
|
if (staffMember != null)
|
||||||
{
|
{
|
||||||
if (staffMember.getRank() == Rank.ADMIN)
|
if (staffMember.getRank() == Rank.SENIOR_ADMIN)
|
||||||
{
|
{
|
||||||
return SENIOR;
|
return SENIOR;
|
||||||
}
|
}
|
||||||
|
@ -83,8 +83,8 @@ public class BukkitTelnetBridge extends FreedomService
|
|||||||
boolean active = staffMember.isActive();
|
boolean active = staffMember.isActive();
|
||||||
|
|
||||||
isAdmin = active;
|
isAdmin = active;
|
||||||
isSeniorAdmin = active && staffMember.getRank() == Rank.ADMIN;
|
isSeniorAdmin = active && staffMember.getRank() == Rank.SENIOR_ADMIN;
|
||||||
isTelnetAdmin = active && (isSeniorAdmin || staffMember.getRank() == Rank.MOD);
|
isTelnetAdmin = active && (isSeniorAdmin || staffMember.getRank() == Rank.ADMIN);
|
||||||
}
|
}
|
||||||
|
|
||||||
playerTags.put("tfm.admin.isAdmin", isAdmin);
|
playerTags.put("tfm.admin.isAdmin", isAdmin);
|
||||||
|
@ -7,6 +7,7 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
@ -103,7 +104,7 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
coreProtect.performRollback(86400, Arrays.asList(name), null, null, null, null, 0, null);
|
coreProtect.performRollback(86400, Collections.singletonList(name), null, null, null, null, 0, null);
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(plugin);
|
}.runTaskAsynchronously(plugin);
|
||||||
}
|
}
|
||||||
@ -123,7 +124,7 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
coreProtect.performRestore(86400, Arrays.asList(name), null, null, null, null, 0, null);
|
coreProtect.performRestore(86400, Collections.singletonList(name), null, null, null, null, 0, null);
|
||||||
}
|
}
|
||||||
}.runTaskAsynchronously(plugin);
|
}.runTaskAsynchronously(plugin);
|
||||||
}
|
}
|
||||||
|
@ -12,16 +12,18 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
|
import net.coreprotect.CoreProtect;
|
||||||
import net.coreprotect.CoreProtectAPI;
|
import net.coreprotect.CoreProtectAPI;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.block.data.BlockData;
|
import org.bukkit.block.data.BlockData;
|
||||||
|
|
||||||
public class FAWEBridge extends FreedomService
|
public class FAWEBridge extends FreedomService
|
||||||
{
|
{
|
||||||
private CoreProtectAPI api;
|
private final CoreProtectAPI api = plugin.cpb.getCoreProtectAPI();;
|
||||||
private World world = null;
|
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<BlockVector3, String>> blocksBroken = new HashMap<>();
|
||||||
private final Map<Map.Entry<String, EditSession>, Map.Entry<Pattern, List<BlockVector3>>> blocksPlaced = new HashMap<>();
|
private final Map<Map.Entry<String, EditSession>, Map.Entry<Pattern, List<BlockVector3>>> blocksPlaced = new HashMap<>();
|
||||||
@ -29,68 +31,62 @@ public class FAWEBridge extends FreedomService
|
|||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
api = plugin.cpb.getCoreProtectAPI();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Iterates over blocks placed by GenerationCommands (in the EditSession) and adds them to the CoreProtect logs.
|
* Iterates over blocks placed by GenerationCommands (in the EditSession) and adds them to the CoreProtect logs.
|
||||||
*/
|
*/
|
||||||
server.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable()
|
server.getScheduler().scheduleSyncRepeatingTask(plugin, () ->
|
||||||
{
|
{
|
||||||
@Override
|
if (!(blocksBroken.isEmpty() && blocksPlaced.isEmpty()))
|
||||||
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())
|
||||||
{
|
{
|
||||||
// Send all broken blocks from the last ticks to the CoreProtect API.
|
playerAndSessionEntry = entry.getKey();
|
||||||
Map.Entry<String, EditSession> playerAndSessionEntry = null;
|
Map<BlockVector3, String> dataAndVectorEntry = entry.getValue();
|
||||||
for (Map.Entry<Map.Entry<String, EditSession>, Map<BlockVector3, String>> entry : blocksBroken.entrySet())
|
List<BlockVector3> blockVector3List = new ArrayList<>();
|
||||||
{
|
blockVector3List.addAll(dataAndVectorEntry.keySet()); // Deep clone the block vector to avoid a change later in the code.
|
||||||
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)
|
for (BlockVector3 blockVector3 : blockVector3List)
|
||||||
|
{
|
||||||
|
if (blockVector3 != null)
|
||||||
{
|
{
|
||||||
if (blockVector3 != null)
|
EditSession editSession = playerAndSessionEntry.getValue();
|
||||||
{
|
World world = server.getWorld(editSession.getWorld().getName());
|
||||||
EditSession editSession = playerAndSessionEntry.getValue();
|
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
||||||
World world = server.getWorld(editSession.getWorld().getName());
|
BlockData blockData = server.createBlockData(dataAndVectorEntry.get(blockVector3));
|
||||||
Location location = new Location(world, blockVector3.getX(), blockVector3.getY(), blockVector3.getZ());
|
api.logRemoval(playerAndSessionEntry.getKey(), location, blockData.getMaterial(), blockData);
|
||||||
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());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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);
|
}, 0L, 40L);
|
||||||
}
|
}
|
||||||
@ -98,10 +94,8 @@ public class FAWEBridge extends FreedomService
|
|||||||
@Override
|
@Override
|
||||||
public void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, BlockVector3 blockVector3)
|
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, BlockVector3 blockVector3)
|
||||||
{
|
{
|
||||||
// Cache the world used for the next iterations to come.
|
// Cache the world used for the next iterations to come.
|
||||||
@ -127,7 +121,12 @@ public class FAWEBridge extends FreedomService
|
|||||||
if (!pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
if (!pattern.apply(blockVector3).getBlockType().getMaterial().isAir())
|
||||||
{
|
{
|
||||||
blocksPlaced.putIfAbsent(playerAndSessionEntry, new AbstractMap.SimpleEntry<>(pattern, new ArrayList<>()));
|
blocksPlaced.putIfAbsent(playerAndSessionEntry, new AbstractMap.SimpleEntry<>(pattern, new ArrayList<>()));
|
||||||
blocksPlaced.get(playerAndSessionEntry).getValue().add(new Gson().fromJson(new Gson().toJson(blockVector3), blockVector3.getClass()));
|
BlockVector3 vectorClone = new Gson().fromJson(new Gson().toJson(blockVector3), blockVector3.getClass());
|
||||||
|
|
||||||
|
if (!blocksPlaced.get(playerAndSessionEntry).getValue().contains(vectorClone))
|
||||||
|
{
|
||||||
|
blocksPlaced.get(playerAndSessionEntry).getValue().add(vectorClone);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,23 +137,23 @@ public class FAWEBridge extends FreedomService
|
|||||||
{
|
{
|
||||||
world = server.getWorld(editSession.getWorld().getName());
|
world = server.getWorld(editSession.getWorld().getName());
|
||||||
}
|
}
|
||||||
List<Block> blocks = new ArrayList<>();
|
List<BlockState> blocks = new ArrayList<>();
|
||||||
|
|
||||||
for (BlockVector3 blockVector3 : region)
|
for (BlockVector3 blockVector3 : region)
|
||||||
{
|
{
|
||||||
blocks.add(world.getBlockAt(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()));
|
blocks.add(world.getBlockAt(blockVector3.getBlockX(), blockVector3.getBlockY(), blockVector3.getBlockZ()).getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
logBlockEdit(playerName, editSession, pattern, blocks);
|
logBlockEdit(playerName, editSession, pattern, blocks);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, List<Block> blocks)
|
public void logBlockEdit(String playerName, EditSession editSession, Pattern pattern, List<BlockState> blocks)
|
||||||
{
|
{
|
||||||
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
Map.Entry<String, EditSession> playerAndSessionEntry = new AbstractMap.SimpleEntry(playerName, editSession);
|
||||||
|
|
||||||
server.getScheduler().scheduleSyncDelayedTask(plugin, () ->
|
server.getScheduler().scheduleAsyncDelayedTask(plugin, () ->
|
||||||
{
|
{
|
||||||
for (Block block : blocks)
|
for (BlockState block : blocks)
|
||||||
{
|
{
|
||||||
BlockVector3 blockVector3 = BlockVector3.at(block.getX(), block.getY(), block.getZ());
|
BlockVector3 blockVector3 = BlockVector3.at(block.getX(), block.getY(), block.getZ());
|
||||||
|
|
||||||
|
@ -46,23 +46,6 @@ public class LibsDisguisesBridge extends FreedomService
|
|||||||
return libsDisguisesPlugin;
|
return libsDisguisesPlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean isDisguised(Player player)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
final LibsDisguises libsDisguises = getLibsDisguisesPlugin();
|
|
||||||
if (libsDisguises != null)
|
|
||||||
{
|
|
||||||
return DisguiseAPI.isDisguised(player);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
FLog.severe(ex);
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void undisguiseAll(boolean staff)
|
public void undisguiseAll(boolean staff)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -60,7 +60,7 @@ public class WorldEditBridge extends FreedomService
|
|||||||
{
|
{
|
||||||
for (int i = 0; i < count; i++)
|
for (int i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
com.sk89q.worldedit.entity.Player fuckyou = (com.sk89q.worldedit.entity.Player)bukkitPlayer;
|
com.sk89q.worldedit.entity.Player fuckyou = bukkitPlayer;
|
||||||
session.undo(session.getBlockBag(fuckyou), fuckyou);
|
session.undo(session.getBlockBag(fuckyou), fuckyou);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.caging;
|
package me.totalfreedom.totalfreedommod.caging;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
@ -71,7 +72,7 @@ public class Cager extends FreedomService
|
|||||||
|
|
||||||
if (outOfCage)
|
if (outOfCage)
|
||||||
{
|
{
|
||||||
player.getPlayer().teleport(cageLoc.subtract(0, 0.1, 0));
|
PaperLib.teleportAsync(player.getPlayer(), cageLoc.subtract(0, 0.1, 0));
|
||||||
FUtil.playerMsg(player.getPlayer(), "You may not leave your cage.", ChatColor.RED);
|
FUtil.playerMsg(player.getPlayer(), "You may not leave your cage.", ChatColor.RED);
|
||||||
cage.regenerate();
|
cage.regenerate();
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ public class Command_adventure extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkRank(Rank.TRIAL_MOD);
|
checkRank(Rank.ADMIN);
|
||||||
|
|
||||||
if (args[0].equals("-a"))
|
if (args[0].equals("-a"))
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.AreaEffectCloud;
|
|||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/<command>", aliases = "aec")
|
@CommandParameters(description = "Clears lingering potion area effect clouds.", usage = "/<command>", aliases = "aec")
|
||||||
public class Command_aeclear extends FreedomCommand
|
public class Command_aeclear extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
|
||||||
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.ADMIN, source = SourceType.ONLY_IN_GAME)
|
|
||||||
@CommandParameters(description = "Manage your AMP account", usage = "/<command> <create | resetpassword>")
|
|
||||||
public class Command_amp extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
|
|
||||||
if (!plugin.amp.isEnabled())
|
|
||||||
{
|
|
||||||
msg("AMP integration is currently disabled.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerData playerData = getData(playerSender);
|
|
||||||
|
|
||||||
if (playerData.getDiscordID() == null)
|
|
||||||
{
|
|
||||||
msg("You must have a linked discord account.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args.length == 0)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (args[0].equals("create"))
|
|
||||||
{
|
|
||||||
msg("Creating your AMP account...", ChatColor.GREEN);
|
|
||||||
StaffMember staffMember = getAdmin(playerSender);
|
|
||||||
|
|
||||||
if (staffMember.getAmpUsername() != null)
|
|
||||||
{
|
|
||||||
msg("You already have an AMP account.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
String username = sender.getName();
|
|
||||||
String password = FUtil.randomString(30);
|
|
||||||
|
|
||||||
staffMember.setAmpUsername(username);
|
|
||||||
plugin.sl.save(staffMember);
|
|
||||||
plugin.sl.updateTables();
|
|
||||||
|
|
||||||
plugin.amp.createAccount(username, password);
|
|
||||||
plugin.dc.sendAMPInfo(playerData, username, password);
|
|
||||||
msg("Successfully created your AMP account. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else if (args[0].equals("resetpassword"))
|
|
||||||
{
|
|
||||||
StaffMember staffMember = getAdmin(playerSender);
|
|
||||||
|
|
||||||
if (staffMember.getAmpUsername() == null)
|
|
||||||
{
|
|
||||||
msg("You do not have an AMP account.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
msg("Resetting your password...", ChatColor.GREEN);
|
|
||||||
|
|
||||||
String username = staffMember.getAmpUsername();
|
|
||||||
String password = FUtil.randomString(30);
|
|
||||||
plugin.amp.setPassword(username,password);
|
|
||||||
plugin.dc.sendAMPInfo(playerData, username, password);
|
|
||||||
|
|
||||||
msg("Successfully reset your AMP account password. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
|
||||||
{
|
|
||||||
if (args.length == 1 && plugin.sl.isAdmin(sender))
|
|
||||||
{
|
|
||||||
return Arrays.asList("create", "resetpassword");
|
|
||||||
}
|
|
||||||
|
|
||||||
return Collections.emptyList();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Make an announcement anonymously to operators.", usage = "/<command> <message>")
|
@CommandParameters(description = "Make an announcement anonymously to operators.", usage = "/<command> <message>")
|
||||||
public class Command_announce extends FreedomCommand
|
public class Command_announce extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/<command> <player>")
|
@CommandParameters(description = "Toggle whether or not a player has their inventory automatically cleared when they join", usage = "/<command> <player>")
|
||||||
public class Command_autoclear extends FreedomCommand
|
public class Command_autoclear extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Toggle whether or not a player is automatically teleported when they join", usage = "/<command> <player>")
|
@CommandParameters(description = "Toggle whether or not a player is automatically teleported when they join", usage = "/<command> <player>")
|
||||||
public class Command_autotp extends FreedomCommand
|
public class Command_autotp extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb | -q]", aliases = "gtfo")
|
@CommandParameters(description = "Bans the specified player.", usage = "/<command> <username> [reason] [-nrb | -q]", aliases = "gtfo")
|
||||||
public class Command_ban extends FreedomCommand
|
public class Command_ban extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Bans the specified ip.", usage = "/<command> <ip> [reason] [-q]")
|
@CommandParameters(description = "Bans the specified ip.", usage = "/<command> <ip> [reason] [-q]")
|
||||||
public class Command_banip extends FreedomCommand
|
public class Command_banip extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,7 @@ public class Command_banlist extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("purge"))
|
if (args[0].equalsIgnoreCase("purge"))
|
||||||
{
|
{
|
||||||
checkRank(Rank.ADMIN);
|
checkRank(Rank.SENIOR_ADMIN);
|
||||||
|
|
||||||
FUtil.staffAction(sender.getName(), "Purging the ban list", true);
|
FUtil.staffAction(sender.getName(), "Purging the ban list", true);
|
||||||
int amount = plugin.bm.purge();
|
int amount = plugin.bm.purge();
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Bans the specified name.", usage = "/<command> <name> [reason] [-q]")
|
@CommandParameters(description = "Bans the specified name.", usage = "/<command> <name> [reason] [-q]")
|
||||||
public class Command_banname extends FreedomCommand
|
public class Command_banname extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Block all commands for everyone on the server, or a specific player.", usage = "/<command> <-a | purge | <player>>", aliases = "blockcommands,blockcommand,bc,bcmd")
|
@CommandParameters(description = "Block all commands for everyone on the server, or a specific player.", usage = "/<command> <-a | purge | <player>>", aliases = "blockcommands,blockcommand,bc,bcmd")
|
||||||
public class Command_blockcmd extends FreedomCommand
|
public class Command_blockcmd extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Restricts/unrestricts block modification abilities for everyone on the server or a certain player.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]")
|
@CommandParameters(description = "Restricts/unrestricts block modification abilities for everyone on the server or a certain player.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]")
|
||||||
public class Command_blockedit extends FreedomCommand
|
public class Command_blockedit extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Toggle PVP mode for everyone or a certain player.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "pvpblock,pvpmode")
|
@CommandParameters(description = "Toggle PVP mode for everyone or a certain player.", usage = "/<command> [[-s] <player> [reason] | list | purge | all]", aliases = "pvpblock,pvpmode")
|
||||||
public class Command_blockpvp extends FreedomCommand
|
public class Command_blockpvp extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Blocks redstone on the server.", usage = "/<command>", aliases = "bre")
|
@CommandParameters(description = "Blocks redstone on the server.", usage = "/<command>", aliases = "bre")
|
||||||
public class Command_blockredstone extends FreedomCommand
|
public class Command_blockredstone extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Place a cage around someone with certain blocks, or someone's player head.", usage = "/<command> <purge | <partialname> [head | block] [playername | blockname]")
|
@CommandParameters(description = "Place a cage around someone with certain blocks, or someone's player head.", usage = "/<command> <purge | <partialname> [head | block] [playername | blockname]")
|
||||||
public class Command_cage extends FreedomCommand
|
public class Command_cage extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "For the people that are still alive - gives a cake to everyone on the server.", usage = "/<command>")
|
@CommandParameters(description = "For the people that are still alive - gives a cake to everyone on the server.", usage = "/<command>")
|
||||||
public class Command_cake extends FreedomCommand
|
public class Command_cake extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Clears the chat.", usage = "/<command>", aliases = "cc")
|
@CommandParameters(description = "Clears the chat.", usage = "/<command>", aliases = "cc")
|
||||||
public class Command_clearchat extends FreedomCommand
|
public class Command_clearchat extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||||
@CommandParameters(description = "Clear the discord message queue.", usage = "/<command>")
|
@CommandParameters(description = "Clear the discord message queue.", usage = "/<command>")
|
||||||
public class Command_cleardiscordqueue extends FreedomCommand
|
public class Command_cleardiscordqueue extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Spy on commands", usage = "/<command>", aliases = "commandspy")
|
@CommandParameters(description = "Spy on commands", usage = "/<command>", aliases = "commandspy")
|
||||||
public class Command_cmdspy extends FreedomCommand
|
public class Command_cmdspy extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,6 @@ import org.bukkit.entity.Player;
|
|||||||
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/<command> [playername]")
|
@CommandParameters(description = "Shows the amount of coins you have or another player has", usage = "/<command> [playername]")
|
||||||
public class Command_coins extends FreedomCommand
|
public class Command_coins extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.ONLY_CONSOLE)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||||
@CommandParameters(description = "Telnet/Console command - Send a chat message with chat formatting over telnet.", usage = "/<command> <message>", aliases = "csay")
|
@CommandParameters(description = "Telnet/Console command - Send a chat message with chat formatting over telnet.", usage = "/<command> <message>", aliases = "csay")
|
||||||
public class Command_consolesay extends FreedomCommand
|
public class Command_consolesay extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "For those who have no friends - gives a cookie to everyone on the server.", usage = "/<command>")
|
@CommandParameters(description = "For those who have no friends - gives a cookie to everyone on the server.", usage = "/<command>")
|
||||||
public class Command_cookie extends FreedomCommand
|
public class Command_cookie extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -28,7 +28,7 @@ public class Command_creative extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
checkRank(Rank.TRIAL_MOD);
|
checkRank(Rank.ADMIN);
|
||||||
|
|
||||||
if (args[0].equals("-a"))
|
if (args[0].equals("-a"))
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Curse someone - sends a cursed texture pack to the specified player.", usage = "/<command> <player>")
|
@CommandParameters(description = "Curse someone - sends a cursed texture pack to the specified player.", usage = "/<command> <player>")
|
||||||
public class Command_curse extends FreedomCommand
|
public class Command_curse extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Essentials Interface Command - Remove the nickname of all players on the server.", usage = "/<command>")
|
@CommandParameters(description = "Essentials Interface Command - Remove the nickname of all players on the server.", usage = "/<command>")
|
||||||
public class Command_denick extends FreedomCommand
|
public class Command_denick extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Deop a player", usage = "/<command> <partialname>")
|
@CommandParameters(description = "Deop a player", usage = "/<command> <partialname>")
|
||||||
public class Command_deop extends FreedomCommand
|
public class Command_deop extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
|
@CommandParameters(description = "Deop everyone on the server.", usage = "/<command>")
|
||||||
public class Command_deopall extends FreedomCommand
|
public class Command_deopall extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Toggle LibsDisguises for everyone online.", usage = "/<command>", aliases = "dtoggle")
|
@CommandParameters(description = "Toggle LibsDisguises for everyone online.", usage = "/<command>", aliases = "dtoggle")
|
||||||
public class Command_disguisetoggle extends FreedomCommand
|
public class Command_disguisetoggle extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,91 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
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.ADMIN, source = SourceType.ONLY_CONSOLE)
|
|
||||||
@CommandParameters(description = "Adds or removes donators", usage = "/<command> <mode> <name> <ip> <package> [forum_user]")
|
|
||||||
public class Command_donator extends FreedomCommand
|
|
||||||
{
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
|
||||||
{
|
|
||||||
if (!FUtil.isFromHostConsole(sender.getName()) && !ConfigEntry.SERVER_OWNERS.getStringList().contains(sender.getName()))
|
|
||||||
{
|
|
||||||
return noPerms();
|
|
||||||
}
|
|
||||||
|
|
||||||
Boolean mode = args[0].equals("add");
|
|
||||||
String name = args[1];
|
|
||||||
String ip = args[2];
|
|
||||||
String pkg = args[3];
|
|
||||||
String forum_id = null;
|
|
||||||
|
|
||||||
if (args.length > 4)
|
|
||||||
{
|
|
||||||
forum_id = args[4];
|
|
||||||
}
|
|
||||||
|
|
||||||
PlayerData data = plugin.pl.getData(name);
|
|
||||||
|
|
||||||
if (data == null)
|
|
||||||
{
|
|
||||||
data = plugin.pl.getDataByIp(ip);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data != null)
|
|
||||||
{
|
|
||||||
data.setDonator(mode);
|
|
||||||
plugin.pl.save(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mode)
|
|
||||||
{
|
|
||||||
FUtil.bcastMsg(ChatColor.AQUA + name + ChatColor.GREEN + " has donated to the server!");
|
|
||||||
}
|
|
||||||
Player player = getPlayer(name);
|
|
||||||
|
|
||||||
if (player != null)
|
|
||||||
{
|
|
||||||
plugin.rm.updateDisplay(player);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (forum_id != null && !forum_id.equals("0"))
|
|
||||||
{
|
|
||||||
String baseurl = ConfigEntry.DONATION_PROBOARDS_URL.getString();
|
|
||||||
String group_id = ConfigEntry.DONATION_GROUP_ID.getString();
|
|
||||||
String session_id = ConfigEntry.DONATION_SESSION_ID.getString();
|
|
||||||
String csrf_token = ConfigEntry.DONATION_CSRF_TOKEN.getString();
|
|
||||||
if (baseurl == null || group_id == null || session_id == null || csrf_token == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
String url = baseurl + "/user/group_members/" + (mode ? "adding" : "remove");
|
|
||||||
List<String> headers = Arrays.asList("Cookie:session_id=" + session_id, "X-Requested-With:XMLHttpRequest");
|
|
||||||
String payload = "group_id=" + group_id + "&user_ids[]=" + forum_id + "&csrf_token=" + csrf_token;
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
FUtil.sendRequest(url, "POST", headers, payload);
|
|
||||||
}
|
|
||||||
catch (IOException e)
|
|
||||||
{
|
|
||||||
FLog.severe(e.getMessage());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
@ -17,7 +17,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE, blockHostConsole = true)
|
||||||
@CommandParameters(description = "Sends the specified player to their doom.", usage = "/<command> <playername> [reason]")
|
@CommandParameters(description = "Sends the specified player to their doom.", usage = "/<command> <playername> [reason]")
|
||||||
public class Command_doom extends FreedomCommand
|
public class Command_doom extends FreedomCommand
|
||||||
{
|
{
|
||||||
@ -44,14 +44,14 @@ public class Command_doom extends FreedomCommand
|
|||||||
final String ip = player.getAddress().getAddress().getHostAddress().trim();
|
final String ip = player.getAddress().getAddress().getHostAddress().trim();
|
||||||
|
|
||||||
// Remove from admin
|
// Remove from admin
|
||||||
StaffMember staffMember = getAdmin(player);
|
StaffMember staffMember = getStaffMember(player);
|
||||||
if (staffMember != null)
|
if (staffMember != null)
|
||||||
{
|
{
|
||||||
FUtil.staffAction(sender.getName(), "Removing " + player.getName() + " from the staff list", true);
|
FUtil.staffAction(sender.getName(), "Removing " + player.getName() + " from the staff list", true);
|
||||||
staffMember.setActive(false);
|
staffMember.setActive(false);
|
||||||
plugin.sl.save(staffMember);
|
plugin.sl.save(staffMember);
|
||||||
plugin.sl.updateTables();
|
plugin.sl.updateTables();
|
||||||
plugin.amp.updateAccountStatus(staffMember);
|
plugin.ptero.updateAccountStatus(staffMember);
|
||||||
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
if (plugin.dc.enabled && ConfigEntry.DISCORD_ROLE_SYNC.getBoolean())
|
||||||
{
|
{
|
||||||
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
|
plugin.dc.syncRoles(staffMember, plugin.pl.getData(staffMember.getName()).getDiscordID());
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> [name | -a]", aliases = "ew,rd")
|
@CommandParameters(description = "Remove various server entities that may cause lag, such as dropped items, minecarts, and boats.", usage = "/<command> [name | -a]", aliases = "ew,rd")
|
||||||
public class Command_entitywipe extends FreedomCommand
|
public class Command_entitywipe extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
|
@CommandParameters(description = "Push people away from you.", usage = "/<command> [radius] [strength]")
|
||||||
public class Command_expel extends FreedomCommand
|
public class Command_expel extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Surprise someone.", usage = "/<command> <player>")
|
@CommandParameters(description = "Surprise someone.", usage = "/<command> <player>")
|
||||||
public class Command_explode extends FreedomCommand
|
public class Command_explode extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Make arrows explode", usage = "/<command>", aliases = "ea")
|
@CommandParameters(description = "Make arrows explode", usage = "/<command>", aliases = "ea")
|
||||||
public class Command_explosivearrows extends FreedomCommand
|
public class Command_explosivearrows extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Shows all IPs registered to a player", usage = "/<command> <player>", aliases = "showip,listip")
|
@CommandParameters(description = "Shows all IPs registered to a player", usage = "/<command> <player>", aliases = "showip,listip")
|
||||||
public class Command_findip extends FreedomCommand
|
public class Command_findip extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Freeze/Unfreeze a specified player, or all non-staff on the server.", usage = "/<command> [target | purge]", aliases = "fr")
|
@CommandParameters(description = "Freeze/Unfreeze a specified player, or all non-staff on the server.", usage = "/<command> [target | purge]", aliases = "fr")
|
||||||
public class Command_freeze extends FreedomCommand
|
public class Command_freeze extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "You'll never even see it coming - repeatedly push players away from you until command is untoggled.", usage = "/<command> <on [radius (default=25)] | off>")
|
@CommandParameters(description = "You'll never even see it coming - repeatedly push players away from you until command is untoggled.", usage = "/<command> <on [radius (default=25)] | off>")
|
||||||
public class Command_fuckoff extends FreedomCommand
|
public class Command_fuckoff extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "View server health, such as ticks-per-second, memory, etc.", usage = "/<command>")
|
@CommandParameters(description = "View server health, such as ticks-per-second, memory, etc.", usage = "/<command>")
|
||||||
public class Command_health extends FreedomCommand
|
public class Command_health extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -72,7 +73,7 @@ public class Command_hubworld extends FreedomCommand
|
|||||||
if (hubWorld == null || playerSender.getWorld() == hubWorld)
|
if (hubWorld == null || playerSender.getWorld() == hubWorld)
|
||||||
{
|
{
|
||||||
msg("Going to the main world.");
|
msg("Going to the main world.");
|
||||||
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
|
PaperLib.teleportAsync(playerSender, server.getWorlds().get(0).getSpawnLocation());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -5,7 +5,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||||
@CommandParameters(description = "Reload the indefinite ban list.", usage = "/<command> reload", aliases = "ib")
|
@CommandParameters(description = "Reload the indefinite ban list.", usage = "/<command> reload", aliases = "ib")
|
||||||
public class Command_indefban extends FreedomCommand
|
public class Command_indefban extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Kick the specified player.", usage = "/<command> <player> [reason] [-q]")
|
@CommandParameters(description = "Kick the specified player.", usage = "/<command> <player> [reason] [-q]")
|
||||||
public class Command_kick extends FreedomCommand
|
public class Command_kick extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Kick all non-staff on server.", usage = "/<command>", aliases = "kickall")
|
@CommandParameters(description = "Kick all non-staff on server.", usage = "/<command>", aliases = "kickall")
|
||||||
public class Command_kicknoob extends FreedomCommand
|
public class Command_kicknoob extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Show the last command the specified player used.", usage = "/<command> <player>")
|
@CommandParameters(description = "Show the last command the specified player used.", usage = "/<command> <player>")
|
||||||
public class Command_lastcmd extends FreedomCommand
|
public class Command_lastcmd extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -47,13 +47,13 @@ public class Command_list extends FreedomCommand
|
|||||||
}
|
}
|
||||||
case "-v":
|
case "-v":
|
||||||
{
|
{
|
||||||
checkRank(Rank.TRIAL_MOD);
|
checkRank(Rank.ADMIN);
|
||||||
listFilter = ListFilter.VANISHED_STAFF;
|
listFilter = ListFilter.VANISHED_STAFF;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "-t":
|
case "-t":
|
||||||
{
|
{
|
||||||
checkRank(Rank.MOD);
|
checkRank(Rank.ADMIN);
|
||||||
listFilter = ListFilter.TELNET_SESSIONS;
|
listFilter = ListFilter.TELNET_SESSIONS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -82,15 +82,15 @@ public class Command_list extends FreedomCommand
|
|||||||
|
|
||||||
List<String> n = new ArrayList<>();
|
List<String> n = new ArrayList<>();
|
||||||
|
|
||||||
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(sender).getRank().isAtLeast(Rank.MOD))
|
if (listFilter == ListFilter.TELNET_SESSIONS && plugin.sl.isStaff(sender) && plugin.sl.getAdmin(playerSender).getRank().isAtLeast(Rank.ADMIN))
|
||||||
{
|
{
|
||||||
List<StaffMember> connectedStaffMembers = plugin.btb.getConnectedAdmins();
|
List<StaffMember> connectedStaffMembers = plugin.btb.getConnectedAdmins();
|
||||||
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
|
onlineStats.append(ChatColor.BLUE).append("There are ").append(ChatColor.RED).append(connectedStaffMembers.size())
|
||||||
.append(ChatColor.BLUE)
|
.append(ChatColor.BLUE)
|
||||||
.append(" staff connected to telnet.");
|
.append(" staff members connected to telnet.");
|
||||||
for (StaffMember staffMember : connectedStaffMembers)
|
for (StaffMember staffMember : connectedStaffMembers)
|
||||||
{
|
{
|
||||||
n.add(plugin.rm.getDisplay(staffMember).getColoredTag() + staffMember.getName());
|
n.add(staffMember.getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -139,13 +139,11 @@ public class Command_list extends FreedomCommand
|
|||||||
.append(": ")
|
.append(": ")
|
||||||
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
|
.append(StringUtils.join(n, ChatColor.WHITE + ", "));
|
||||||
if (senderIsConsole)
|
if (senderIsConsole)
|
||||||
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
sender.sendMessage(ChatColor.stripColor(onlineStats.toString()));
|
||||||
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
sender.sendMessage(ChatColor.stripColor(onlineUsers.toString()));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
||||||
{
|
{
|
||||||
sender.sendMessage(onlineStats.toString());
|
sender.sendMessage(onlineStats.toString());
|
||||||
sender.sendMessage(onlineUsers.toString());
|
sender.sendMessage(onlineUsers.toString());
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -12,7 +13,7 @@ public class Command_localspawn extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
playerSender.teleport(playerSender.getWorld().getSpawnLocation());
|
PaperLib.teleportAsync(playerSender, playerSender.getWorld().getSpawnLocation());
|
||||||
msg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\".");
|
msg("Teleported to spawnpoint for world \"" + playerSender.getWorld().getName() + "\".");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH, blockHostConsole = true)
|
||||||
@CommandParameters(description = "This is evil, and I never should have wrote it - blocks specified player's input.", usage = "/<command> <all | purge | <<partialname> on | off> [-q]>")
|
@CommandParameters(description = "This is evil, and I never should have wrote it - blocks specified player's input.", usage = "/<command> <all | purge | <<partialname> on | off> [-q]>")
|
||||||
public class Command_lockup extends FreedomCommand
|
public class Command_lockup extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,52 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
||||||
|
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.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
|
@CommandParameters(description = "Change your login message", usage = "/<command> [message]")
|
||||||
|
public class Command_loginmessage extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
if (!plugin.pl.getData(playerSender).hasItem(ShopItem.LOGIN_MESSAGES) && !isStaff(playerSender))
|
||||||
|
{
|
||||||
|
msg("You did not purchase the ability to use login messages! Purchase the ability from the shop.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
playerSender.openInventory(plugin.sh.generateLoginMessageGUI(playerSender));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
checkRank(Rank.ADMIN);
|
||||||
|
|
||||||
|
String message = StringUtils.join(args, " ");
|
||||||
|
if (!message.contains("%rank%") && !message.contains("%coloredrank%"))
|
||||||
|
{
|
||||||
|
msg("Your login message must contain your rank. Use either %rank% or %coloredrank% to specify where you want the rank", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
int length = message.replace("%name%", "").replace("%rank%", "").replace("%coloredrank%", "").replace("%art%", "").length();
|
||||||
|
if (length > 100)
|
||||||
|
{
|
||||||
|
msg("Your login message cannot be more than 100 characters (excluding your rank and your name)", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
PlayerData data = getData(playerSender);
|
||||||
|
data.setLoginMessage(message);
|
||||||
|
plugin.pl.save(data);
|
||||||
|
msg("Your login message is now the following:\n" + plugin.rm.craftLoginMessage(playerSender, message), ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
@CommandParameters(description = "Register your connection with the TFM logviewer.", usage = "/<command> [off]")
|
||||||
public class Command_logs extends FreedomCommand
|
public class Command_logs extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -19,7 +19,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Make a WorldGuard region for an OP.", usage = "/<command> <playername> <name>", aliases = "mor")
|
@CommandParameters(description = "Make a WorldGuard region for an OP.", usage = "/<command> <playername> <name>", aliases = "mor")
|
||||||
public class Command_makeopregion extends FreedomCommand
|
public class Command_makeopregion extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
import me.totalfreedom.totalfreedommod.shop.ShopItem;
|
||||||
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_CONSOLE)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.ONLY_CONSOLE)
|
||||||
@CommandParameters(description = "Manage the shop", usage = "/<command> <coins: <add | set | remove> <amount> <player | all> | items: <give | take> <item> <player>", aliases = "ms")
|
@CommandParameters(description = "Manage the shop", usage = "/<command> <coins: <add | set | remove> <amount> <player | all> | items: <give | take> <item> <player>", aliases = "ms")
|
||||||
public class Command_manageshop extends FreedomCommand
|
public class Command_manageshop extends FreedomCommand
|
||||||
{
|
{
|
||||||
@ -18,7 +18,7 @@ public class Command_manageshop extends FreedomCommand
|
|||||||
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(final CommandSender sender, final Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!ConfigEntry.SERVER_OWNERS.getStringList().contains(sender.getName()))
|
if (!FUtil.isExecutive(sender.getName()))
|
||||||
{
|
{
|
||||||
return noPerms();
|
return noPerms();
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ public class Command_manageshop extends FreedomCommand
|
|||||||
msg(PLAYER_NOT_FOUND);
|
msg(PLAYER_NOT_FOUND);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
playerData.setCoins(playerData.getCoins() + amount);
|
playerData.setCoins(playerData.getCoins() - amount);
|
||||||
if (playerData.getCoins() < 0)
|
if (playerData.getCoins() < 0)
|
||||||
{
|
{
|
||||||
playerData.setCoins(0);
|
playerData.setCoins(0);
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Manually verify someone", usage = "/<command> <playername>", aliases="mv")
|
@CommandParameters(description = "Manually verify someone", usage = "/<command> <playername>", aliases="mv")
|
||||||
public class Command_manuallyverify extends FreedomCommand
|
public class Command_manuallyverify extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "seth's personal command", usage = "/<command> <players>", aliases = "genocide")
|
@CommandParameters(description = "seth's personal command", usage = "/<command> <players>", aliases = "genocide")
|
||||||
public class Command_massmurder extends FreedomCommand
|
public class Command_massmurder extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -72,7 +73,7 @@ public class Command_masterbuilderworld extends FreedomCommand
|
|||||||
if (masterBuilderWorld == null || playerSender.getWorld() == masterBuilderWorld)
|
if (masterBuilderWorld == null || playerSender.getWorld() == masterBuilderWorld)
|
||||||
{
|
{
|
||||||
msg("Going to the main world.");
|
msg("Going to the main world.");
|
||||||
playerSender.teleport(server.getWorlds().get(0).getSpawnLocation());
|
PaperLib.teleportAsync(playerSender, server.getWorlds().get(0).getSpawnLocation());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Control mob limiting parameters.", usage = "/<command> <on|off|setmax <count>|dragon|giant|ghast|slime>")
|
@CommandParameters(description = "Control mob limiting parameters.", usage = "/<command> <on|off|setmax <count>|dragon|giant|ghast|slime>")
|
||||||
public class Command_moblimiter extends FreedomCommand
|
public class Command_moblimiter extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -12,7 +12,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command> [name]", aliases = "mp")
|
@CommandParameters(description = "Purge all mobs in all worlds.", usage = "/<command> [name]", aliases = "mp")
|
||||||
public class Command_mobpurge extends FreedomCommand
|
public class Command_mobpurge extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -5,13 +5,13 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
import net.minecraft.server.v1_16_R2.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagList;
|
import net.minecraft.server.v1_16_R2.NBTTagList;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.craftbukkit.v1_16_R1.inventory.CraftItemStack;
|
import org.bukkit.craftbukkit.v1_16_R2.inventory.CraftItemStack;
|
||||||
import org.bukkit.enchantments.Enchantment;
|
import org.bukkit.enchantments.Enchantment;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
@ -149,7 +149,7 @@ public class Command_modifyitem extends FreedomCommand
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
net.minecraft.server.v1_16_R1.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
net.minecraft.server.v1_16_R2.ItemStack nmsStack = CraftItemStack.asNMSCopy(item);
|
||||||
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
|
NBTTagCompound compound = (nmsStack.hasTag()) ? nmsStack.getTag() : new NBTTagCompound();
|
||||||
NBTTagList modifiers = getAttributeList(nmsStack);
|
NBTTagList modifiers = getAttributeList(nmsStack);
|
||||||
NBTTagCompound cmpnd = new NBTTagCompound();
|
NBTTagCompound cmpnd = new NBTTagCompound();
|
||||||
@ -199,7 +199,7 @@ public class Command_modifyitem extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R1.ItemStack stack)
|
private NBTTagList getAttributeList(net.minecraft.server.v1_16_R2.ItemStack stack)
|
||||||
{
|
{
|
||||||
if (stack.getTag() == null)
|
if (stack.getTag() == null)
|
||||||
{
|
{
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> <[-s | -q] <player> [reason] | list | purge | all>", aliases = "stfu")
|
@CommandParameters(description = "Mutes a player with brute force.", usage = "/<command> <[-s | -q] <player> [reason] | list | purge | all>", aliases = "stfu")
|
||||||
public class Command_mute extends FreedomCommand
|
public class Command_mute extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -15,9 +15,9 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Manage your staff entry.", usage = "/<command> [-o <staff member>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setscformat <format> | clearscformat> | oldtags | logstick | syncroles>")
|
@CommandParameters(description = "Manage your staff entry.", usage = "/<command> [-o <staff member>] <clearips | clearip <ip> | setlogin <message> | clearlogin | setscformat <format> | clearscformat> | oldtags | logstick | syncroles>")
|
||||||
public class Command_mystaff extends FreedomCommand
|
public class Command_myadmin extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -29,13 +29,13 @@ public class Command_mystaff extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
Player init = null;
|
Player init = null;
|
||||||
StaffMember target = getAdmin(playerSender);
|
StaffMember target = getStaffMember(playerSender);
|
||||||
Player targetPlayer = playerSender;
|
Player targetPlayer = playerSender;
|
||||||
|
|
||||||
// -o switch
|
// -o switch
|
||||||
if (args[0].equals("-o"))
|
if (args[0].equals("-o"))
|
||||||
{
|
{
|
||||||
checkRank(Rank.ADMIN);
|
checkRank(Rank.SENIOR_ADMIN);
|
||||||
init = playerSender;
|
init = playerSender;
|
||||||
targetPlayer = getPlayer(args[1]);
|
targetPlayer = getPlayer(args[1]);
|
||||||
if (targetPlayer == null)
|
if (targetPlayer == null)
|
||||||
@ -44,7 +44,7 @@ public class Command_mystaff extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
target = getAdmin(targetPlayer);
|
target = getStaffMember(targetPlayer);
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
msg("That player is not a staff member", ChatColor.RED);
|
msg("That player is not a staff member", ChatColor.RED);
|
||||||
@ -139,46 +139,6 @@ public class Command_mystaff extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "setlogin":
|
|
||||||
{
|
|
||||||
checkRank(Rank.MOD);
|
|
||||||
if (args.length < 2)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
String message = StringUtils.join(args, " ", 1, args.length);
|
|
||||||
if (!message.contains("%rank%") && !message.contains("%coloredrank%"))
|
|
||||||
{
|
|
||||||
msg("Your login message must contain your rank. Use either %rank% or %coloredrank% to specify where you want the rank", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
int length = message.replace("%name%", "").replace("%rank%", "").replace("%coloredrank%", "").length();
|
|
||||||
if (length > 100)
|
|
||||||
{
|
|
||||||
msg("Your login message cannot be more than 100 characters (excluding your rank and your name)", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
FUtil.staffAction(sender.getName(), "Setting personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
|
||||||
target.setLoginMessage(message);
|
|
||||||
String previewMessage = plugin.rm.craftLoginMessage(targetPlayer, message);
|
|
||||||
msg((init == null ? "Your" : targetPlayer.getName() + "'s") + " login message is now: ");
|
|
||||||
msg("> " + previewMessage);
|
|
||||||
plugin.sl.save(target);
|
|
||||||
plugin.sl.updateTables();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "clearlogin":
|
|
||||||
{
|
|
||||||
checkRank(Rank.MOD);
|
|
||||||
FUtil.staffAction(sender.getName(), "Clearing personal login message" + (init == null ? "" : " for " + targetPlayer.getName()), false);
|
|
||||||
target.setLoginMessage(null);
|
|
||||||
plugin.sl.save(target);
|
|
||||||
plugin.sl.updateTables();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
case "setscformat":
|
case "setscformat":
|
||||||
{
|
{
|
||||||
String format = StringUtils.join(args, " ", 1, args.length);
|
String format = StringUtils.join(args, " ", 1, args.length);
|
||||||
@ -186,7 +146,7 @@ public class Command_mystaff extends FreedomCommand
|
|||||||
plugin.sl.save(target);
|
plugin.sl.save(target);
|
||||||
plugin.sl.updateTables();
|
plugin.sl.updateTables();
|
||||||
msg("Set staff chat format to \"" + format + "\".", ChatColor.GRAY);
|
msg("Set staff chat format to \"" + format + "\".", ChatColor.GRAY);
|
||||||
String example = format.replace("%name%", "ExampleStaff").replace("%rank%", Rank.MOD.getAbbr()).replace("%rankcolor%", Rank.MOD.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
|
String example = format.replace("%name%", "ExampleStaff").replace("%rank%", Rank.ADMIN.getAbbr()).replace("%rankcolor%", Rank.ADMIN.getColor().toString()).replace("%msg%", "The quick brown fox jumps over the lazy dog.");
|
||||||
msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example));
|
msg(ChatColor.GRAY + "Example: " + FUtil.colorize(example));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -229,10 +189,6 @@ public class Command_mystaff extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "genbackupcodes":
|
|
||||||
msg("Moved to /pv genbackupcodes", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@ -248,8 +204,8 @@ public class Command_mystaff extends FreedomCommand
|
|||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
List<String> singleArguments = Arrays.asList("clearips", "setlogin", "setscformat");
|
List<String> singleArguments = Arrays.asList("clearips", "setscformat");
|
||||||
List<String> doubleArguments = Arrays.asList("clearip", "clearlogin", "clearscformat", "oldtags", "syncroles");
|
List<String> doubleArguments = Arrays.asList("clearip", "clearscformat", "syncroles");
|
||||||
if (args.length == 1)
|
if (args.length == 1)
|
||||||
{
|
{
|
||||||
List<String> options = new ArrayList<>();
|
List<String> options = new ArrayList<>();
|
@ -16,7 +16,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Essentials Interface Command - Remove illegal chatcodes from nicknames of one or all players on server.", usage = "/<command> [player]", aliases = "nc")
|
@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
|
public class Command_nickclean extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Manage notes for a player", usage = "/<command> <name> <list | add <note> | remove <id> | clear>")
|
@CommandParameters(description = "Manage notes for a player", usage = "/<command> <name> <list | add <note> | remove <id> | clear>")
|
||||||
public class Command_notes extends FreedomCommand
|
public class Command_notes extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.Vector;
|
import org.bukkit.util.Vector;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon - Sends the specified player into orbit.",
|
@CommandParameters(description = "POW!!! Right in the kisser! One of these days Alice, straight to the Moon - Sends the specified player into orbit.",
|
||||||
usage = "/<command> <target> [<<power> | stop>]")
|
usage = "/<command> <target> [<<power> | stop>]")
|
||||||
public class Command_orbit extends FreedomCommand
|
public class Command_orbit extends FreedomCommand
|
||||||
|
@ -0,0 +1,136 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import com.google.common.base.Strings;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
|
import me.totalfreedom.totalfreedommod.staff.StaffMember;
|
||||||
|
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.SENIOR_ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
|
@CommandParameters(description = "Manage your Pterodactyl panel account", usage = "/<command> <create | delete>")
|
||||||
|
public class Command_panel extends FreedomCommand
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
|
{
|
||||||
|
|
||||||
|
if (!plugin.ptero.isEnabled())
|
||||||
|
{
|
||||||
|
msg("Pterodactyl integration is currently disabled.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
PlayerData playerData = getData(playerSender);
|
||||||
|
|
||||||
|
if (playerData.getDiscordID() == null)
|
||||||
|
{
|
||||||
|
msg("You must have a linked discord account.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args.length == 0)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (args[0].equals("create"))
|
||||||
|
{
|
||||||
|
msg("Creating your Pterodactyl account...", ChatColor.GREEN);
|
||||||
|
StaffMember staffMember = getStaffMember(playerSender);
|
||||||
|
|
||||||
|
if (staffMember.getPteroID() != null)
|
||||||
|
{
|
||||||
|
msg("You already have a Pterodactyl account.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
String username = sender.getName();
|
||||||
|
String password = FUtil.randomString(30);
|
||||||
|
|
||||||
|
String id = plugin.ptero.createAccount(username, password);
|
||||||
|
if (Strings.isNullOrEmpty(id))
|
||||||
|
{
|
||||||
|
msg("Failed to create your Pterodactyl account.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
plugin.ptero.addAccountToServer(id);
|
||||||
|
|
||||||
|
staffMember.setPteroID(id);
|
||||||
|
plugin.sl.save(staffMember);
|
||||||
|
plugin.sl.updateTables();
|
||||||
|
|
||||||
|
plugin.dc.sendPteroInfo(playerData, username, password);
|
||||||
|
msg("Successfully created your Pterodactyl account. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (args[0].equals("delete"))
|
||||||
|
{
|
||||||
|
msg("Deleting your Pterodactyl account...", ChatColor.GREEN);
|
||||||
|
StaffMember staffMember = getStaffMember(playerSender);
|
||||||
|
|
||||||
|
if (staffMember.getPteroID() == null)
|
||||||
|
{
|
||||||
|
msg("You do not have a Pterodactyl account.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean deleted = plugin.ptero.deleteAccount(staffMember.getPteroID());
|
||||||
|
|
||||||
|
if (!deleted)
|
||||||
|
{
|
||||||
|
msg("Failed to delete your Pterodactyl account.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
staffMember.setPteroID(null);
|
||||||
|
plugin.sl.save(staffMember);
|
||||||
|
plugin.sl.updateTables();
|
||||||
|
|
||||||
|
msg("Successfully deleted your Pterodactyl account.", ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
/*else if (args[0].equals("resetpassword"))
|
||||||
|
{
|
||||||
|
StaffMember staffMember = getAdmin(playerSender);
|
||||||
|
|
||||||
|
if (staffMember.getAmpUsername() == null)
|
||||||
|
{
|
||||||
|
msg("You do not have a Pterodactyl account.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
msg("Resetting your password...", ChatColor.GREEN);
|
||||||
|
|
||||||
|
String id = staffMember.getPteroID();
|
||||||
|
String password = FUtil.randomString(30);
|
||||||
|
plugin.ptero.setPassword(id, password);
|
||||||
|
plugin.dc.sendPteroInfo(playerData, null, password);
|
||||||
|
|
||||||
|
msg("Successfully reset your AMP account password. Check your DMs from " + plugin.dc.formatBotTag() + " on discord to get your credentials.", ChatColor.GREEN);
|
||||||
|
return true;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||||
|
{
|
||||||
|
if (args.length == 1 && plugin.sl.isAdmin(sender))
|
||||||
|
{
|
||||||
|
return Arrays.asList("create", "delete");
|
||||||
|
}
|
||||||
|
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,7 +10,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Gets your playtime statistics.", usage = "/<command>")
|
@CommandParameters(description = "Gets your playtime statistics.", usage = "/<command>")
|
||||||
public class Command_playtime extends FreedomCommand
|
public class Command_playtime extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -10,14 +11,13 @@ import org.bukkit.entity.Player;
|
|||||||
@CommandParameters(description = "Go to the PlotWorld.", usage = "/<command>", aliases = "pw")
|
@CommandParameters(description = "Go to the PlotWorld.", usage = "/<command>", aliases = "pw")
|
||||||
public class Command_plotworld extends FreedomCommand
|
public class Command_plotworld extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
World plotworld = server.getWorld("plotworld");
|
World plotworld = server.getWorld("plotworld");
|
||||||
if (plotworld != null)
|
if (plotworld != null)
|
||||||
{
|
{
|
||||||
playerSender.teleport(plotworld.getSpawnLocation());
|
PaperLib.teleportAsync(playerSender, plotworld.getSpawnLocation());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -13,7 +13,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.PluginManager;
|
import org.bukkit.plugin.PluginManager;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Enable, disable, or reload a specified plugin, as well as list all plugins on the server.", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
@CommandParameters(description = "Enable, disable, or reload a specified plugin, as well as list all plugins on the server.", usage = "/<command> <<enable | disable | reload> <pluginname>> | list>", aliases = "plc")
|
||||||
public class Command_plugincontrol extends FreedomCommand
|
public class Command_plugincontrol extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -17,7 +17,7 @@ import org.bukkit.potion.PotionEffectType;
|
|||||||
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.OP, source = SourceType.BOTH)
|
||||||
@CommandParameters(
|
@CommandParameters(
|
||||||
description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
description = "Manipulate your potion effects. Duration is measured in server ticks (~20 ticks per second).",
|
||||||
usage = "/<command> <list | clear [target name] | add <type> <duration> <amplifier> [target name]>",
|
usage = "/<command> <list | clearall | clear [target name] | add <type> <duration> <amplifier> [target name]>",
|
||||||
aliases="effect")
|
aliases="effect")
|
||||||
public class Command_potion extends FreedomCommand
|
public class Command_potion extends FreedomCommand
|
||||||
{
|
{
|
||||||
@ -25,153 +25,149 @@ public class Command_potion extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
|
||||||
{
|
{
|
||||||
if (args.length == 1 || args.length == 2)
|
switch (args.length)
|
||||||
{
|
{
|
||||||
if (args[0].equalsIgnoreCase("list"))
|
case 1:
|
||||||
{
|
if (args[0].equalsIgnoreCase("list"))
|
||||||
List<String> potionEffectTypeNames = new ArrayList<>();
|
|
||||||
for (PotionEffectType potion_effect_type : PotionEffectType.values())
|
|
||||||
{
|
{
|
||||||
if (potion_effect_type != null)
|
List<String> potionEffectTypeNames = new ArrayList<>();
|
||||||
|
for (PotionEffectType potion_effect_type : PotionEffectType.values())
|
||||||
{
|
{
|
||||||
potionEffectTypeNames.add(potion_effect_type.getName());
|
if (potion_effect_type != null)
|
||||||
|
{
|
||||||
|
potionEffectTypeNames.add(potion_effect_type.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
msg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
|
||||||
}
|
}
|
||||||
msg("Potion effect types: " + StringUtils.join(potionEffectTypeNames, ", "), ChatColor.AQUA);
|
else if (args[0].equalsIgnoreCase("clearall"))
|
||||||
}
|
|
||||||
else if (args[0].equalsIgnoreCase("clearall"))
|
|
||||||
{
|
|
||||||
if (!(plugin.sl.isStaff(sender) || senderIsConsole))
|
|
||||||
{
|
{
|
||||||
noPerms();
|
if (!(plugin.sl.isStaff(sender) || senderIsConsole))
|
||||||
return true;
|
|
||||||
}
|
|
||||||
FUtil.staffAction(sender.getName(), "Cleared all potion effects from all players", true);
|
|
||||||
for (Player target : server.getOnlinePlayers())
|
|
||||||
{
|
|
||||||
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
|
||||||
{
|
{
|
||||||
target.removePotionEffect(potion_effect.getType());
|
noPerms();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (args[0].equalsIgnoreCase("clear"))
|
|
||||||
{
|
|
||||||
Player target = playerSender;
|
|
||||||
|
|
||||||
if (args.length == 2)
|
FUtil.staffAction(sender.getName(), "Cleared all potion effects from all players", true);
|
||||||
|
for (Player target : server.getOnlinePlayers())
|
||||||
|
{
|
||||||
|
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
||||||
|
{
|
||||||
|
target.removePotionEffect(potion_effect.getType());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
if (args[0].equalsIgnoreCase("clear"))
|
||||||
{
|
{
|
||||||
target = getPlayer(args[1], true);
|
Player target = playerSender;
|
||||||
|
if(args.length == 2)
|
||||||
|
{
|
||||||
|
if (!plugin.sl.isStaff(sender) && !target.equals(getPlayer(sender.getName())))
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + "Only staff can clear potion effects from other players.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
target = getPlayer(args[1], true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (senderIsConsole)
|
||||||
|
{
|
||||||
|
msg("You must specify a target player when using this command from the console.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (target == null)
|
if (target == null)
|
||||||
{
|
{
|
||||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (senderIsConsole)
|
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
||||||
{
|
|
||||||
msg("You must specify a target player when using this command from the console.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!plugin.sl.isStaff(sender))
|
|
||||||
{
|
|
||||||
msg(ChatColor.RED + "Only staff can clear potion effects from other players.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (PotionEffect potion_effect : target.getActivePotionEffects())
|
|
||||||
{
|
|
||||||
target.removePotionEffect(potion_effect.getType());
|
|
||||||
}
|
|
||||||
|
|
||||||
msg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (args.length == 4 || args.length == 5)
|
|
||||||
{
|
|
||||||
if (args[0].equalsIgnoreCase("add"))
|
|
||||||
{
|
|
||||||
Player target = playerSender;
|
|
||||||
|
|
||||||
if (args.length == 5)
|
|
||||||
{
|
|
||||||
target = getPlayer(args[4]);
|
|
||||||
|
|
||||||
if (target == null || plugin.sl.isVanished(target.getName()) && !plugin.sl.isStaff(sender))
|
|
||||||
{
|
{
|
||||||
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
target.removePotionEffect(potion_effect.getType());
|
||||||
|
}
|
||||||
|
|
||||||
|
msg("Cleared all active potion effects " + (!target.equals(playerSender) ? "from player " + target.getName() + "." : "from yourself."), ChatColor.AQUA);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 4:
|
||||||
|
case 5:
|
||||||
|
if (args[0].equalsIgnoreCase("add"))
|
||||||
|
{
|
||||||
|
Player target = playerSender;
|
||||||
|
|
||||||
|
if (args.length == 5)
|
||||||
|
{
|
||||||
|
if (!plugin.sl.isStaff(sender) && !getPlayer(args[4]).equals(getPlayer(sender.getName())))
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.RED + "Only staff can apply potion effects to other players.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
target = getPlayer(args[4]);
|
||||||
|
|
||||||
|
if (target == null || plugin.sl.isVanished(target.getName()) && !plugin.sl.isStaff(sender))
|
||||||
|
{
|
||||||
|
msg(FreedomCommand.PLAYER_NOT_FOUND, ChatColor.RED);
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.AQUA + "Invalid potion effect type.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (senderIsConsole)
|
int duration;
|
||||||
{
|
try
|
||||||
sender.sendMessage("You must specify a target player when using this command from the console.");
|
{
|
||||||
return true;
|
duration = Integer.parseInt(args[2]);
|
||||||
}
|
duration = Math.min(duration, 100000);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
msg("Invalid potion duration.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!plugin.sl.isStaff(sender))
|
int amplifier;
|
||||||
{
|
try
|
||||||
sender.sendMessage(ChatColor.RED + "Only staff can apply potion effects to other players.");
|
{
|
||||||
return true;
|
amplifier = Integer.parseInt(args[3]);
|
||||||
}
|
amplifier = Math.min(amplifier, 100000);
|
||||||
|
}
|
||||||
|
catch (NumberFormatException ex)
|
||||||
|
{
|
||||||
|
msg("Invalid potion amplifier.", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
PotionEffectType potion_effect_type = PotionEffectType.getByName(args[1]);
|
PotionEffect new_effect = potion_effect_type.createEffect(duration, amplifier);
|
||||||
if (potion_effect_type == null)
|
target.addPotionEffect(new_effect, true);
|
||||||
{
|
msg(
|
||||||
sender.sendMessage(ChatColor.AQUA + "Invalid potion effect type.");
|
"Added potion effect: " + new_effect.getType().getName()
|
||||||
return true;
|
+ ", Duration: " + new_effect.getDuration()
|
||||||
|
+ ", Amplifier: " + new_effect.getAmplifier()
|
||||||
|
+ (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
int duration;
|
default:
|
||||||
try
|
|
||||||
{
|
|
||||||
duration = Integer.parseInt(args[2]);
|
|
||||||
duration = Math.min(duration, 100000);
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ex)
|
|
||||||
{
|
|
||||||
msg("Invalid potion duration.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
int amplifier;
|
|
||||||
try
|
|
||||||
{
|
|
||||||
amplifier = Integer.parseInt(args[3]);
|
|
||||||
amplifier = Math.min(amplifier, 100000);
|
|
||||||
}
|
|
||||||
catch (NumberFormatException ex)
|
|
||||||
{
|
|
||||||
msg("Invalid potion amplifier.", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
PotionEffect new_effect = potion_effect_type.createEffect(duration, amplifier);
|
|
||||||
target.addPotionEffect(new_effect, true);
|
|
||||||
msg(
|
|
||||||
"Added potion effect: " + new_effect.getType().getName()
|
|
||||||
+ ", Duration: " + new_effect.getDuration()
|
|
||||||
+ ", Amplifier: " + new_effect.getAmplifier()
|
|
||||||
+ (!target.equals(playerSender) ? " to player " + target.getName() + "." : " to yourself."), ChatColor.AQUA);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -179,50 +175,54 @@ public class Command_potion extends FreedomCommand
|
|||||||
@Override
|
@Override
|
||||||
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
public List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||||
{
|
{
|
||||||
if (args.length == 1)
|
switch (args.length)
|
||||||
{
|
{
|
||||||
List<String> arguments = new ArrayList<>();
|
case 1:
|
||||||
arguments.addAll(Arrays.asList("list", "clear", "add"));
|
List<String> arguments = new ArrayList<>();
|
||||||
if (plugin.sl.isStaff(sender))
|
arguments.addAll(Arrays.asList("list", "clear", "add"));
|
||||||
{
|
|
||||||
arguments.add("clearall");
|
|
||||||
}
|
|
||||||
return arguments;
|
|
||||||
}
|
|
||||||
else if (args.length == 2)
|
|
||||||
{
|
|
||||||
if (args[0].equals("clear"))
|
|
||||||
{
|
|
||||||
if (plugin.sl.isStaff(sender))
|
if (plugin.sl.isStaff(sender))
|
||||||
{
|
{
|
||||||
return FUtil.getPlayerList();
|
arguments.add("clearall");
|
||||||
}
|
}
|
||||||
}
|
return arguments;
|
||||||
else if (args[0].equals("add"))
|
|
||||||
{
|
case 2:
|
||||||
return getAllPotionTypes();
|
if (args[0].equals("clear"))
|
||||||
}
|
{
|
||||||
}
|
if (plugin.sl.isStaff(sender))
|
||||||
else if (args.length == 3)
|
{
|
||||||
{
|
return FUtil.getPlayerList();
|
||||||
if (args[0].equals("add"))
|
}
|
||||||
{
|
}
|
||||||
return Arrays.asList("<duration>");
|
else if (args[0].equals("add"))
|
||||||
}
|
{
|
||||||
}
|
return getAllPotionTypes();
|
||||||
else if (args.length == 4)
|
}
|
||||||
{
|
break;
|
||||||
if (args[0].equals("add"))
|
|
||||||
{
|
case 3:
|
||||||
return Arrays.asList("<amplifier>");
|
if (args[0].equals("add"))
|
||||||
}
|
{
|
||||||
}
|
return Arrays.asList("<duration>");
|
||||||
else if (args.length == 5 && plugin.sl.isStaff(sender))
|
}
|
||||||
{
|
break;
|
||||||
if (args[0].equals("add"))
|
|
||||||
{
|
case 4:
|
||||||
return FUtil.getPlayerList();
|
if (args[0].equals("add"))
|
||||||
}
|
{
|
||||||
|
return Arrays.asList("<amplifier>");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 5:
|
||||||
|
if (plugin.sl.isStaff(sender))
|
||||||
|
{
|
||||||
|
if (args[0].equals("add"))
|
||||||
|
{
|
||||||
|
return FUtil.getPlayerList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Collections.emptyList();
|
return Collections.emptyList();
|
||||||
|
@ -15,7 +15,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.ThrownPotion;
|
import org.bukkit.entity.ThrownPotion;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Allows staff to see potions that are thrown.", usage = "/<command> <enable | on | disable | off> | history [player] <page>", aliases = "potspy")
|
@CommandParameters(description = "Allows staff to see potions that are thrown.", usage = "/<command> <enable | on | disable | off> | history [player] <page>", aliases = "potspy")
|
||||||
public class Command_potionspy extends FreedomCommand
|
public class Command_potionspy extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -11,7 +11,7 @@ import org.bukkit.entity.Entity;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.potion.PotionEffect;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Purge current mutes, command blocks, orbits, freezes, potion effects, cages, and entities.", usage = "/<command>")
|
@CommandParameters(description = "Purge current mutes, command blocks, orbits, freezes, potion effects, cages, and entities.", usage = "/<command>")
|
||||||
public class Command_purgeall extends FreedomCommand
|
public class Command_purgeall extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
|
@CommandParameters(description = "Broadcasts the given message. Supports colors.", usage = "/<command> <message>")
|
||||||
public class Command_rawsay extends FreedomCommand
|
public class Command_rawsay extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Forcefully start a reaction", usage = "/<command>")
|
@CommandParameters(description = "Forcefully start a reaction", usage = "/<command>")
|
||||||
public class Command_reactionbar extends FreedomCommand
|
public class Command_reactionbar extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import io.papermc.lib.PaperLib;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TimerTask;
|
|
||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
@ -11,6 +11,7 @@ import org.bukkit.ChatColor;
|
|||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
@CommandPermissions(level = Rank.OP, source = SourceType.ONLY_IN_GAME)
|
||||||
@CommandParameters(description = "Ride on the top of the specified player.", usage = "/<command> <playername | mode <normal | off | ask>>")
|
@CommandParameters(description = "Ride on the top of the specified player.", usage = "/<command> <playername | mode <normal | off | ask>>")
|
||||||
@ -38,7 +39,7 @@ public class Command_ride extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (!RIDE_REQUESTS.containsKey(playerSender))
|
if (!RIDE_REQUESTS.containsKey(playerSender))
|
||||||
{
|
{
|
||||||
msg("You don't have a request currently.");
|
msg("You don't have any pending requests.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,9 +56,10 @@ public class Command_ride extends FreedomCommand
|
|||||||
|
|
||||||
if (requester.getWorld() != playerSender.getWorld())
|
if (requester.getWorld() != playerSender.getWorld())
|
||||||
{
|
{
|
||||||
requester.teleport(playerSender);
|
PaperLib.teleportAsync(requester, playerSender.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RIDE_REQUESTS.remove(playerSender);
|
||||||
playerSender.addPassenger(requester);
|
playerSender.addPassenger(requester);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -66,7 +68,7 @@ public class Command_ride extends FreedomCommand
|
|||||||
{
|
{
|
||||||
if (!RIDE_REQUESTS.containsKey(playerSender))
|
if (!RIDE_REQUESTS.containsKey(playerSender))
|
||||||
{
|
{
|
||||||
msg("You don't have a request currently.");
|
msg("You don't have any pending requests.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Player requester = RIDE_REQUESTS.get(playerSender);
|
Player requester = RIDE_REQUESTS.get(playerSender);
|
||||||
@ -124,28 +126,29 @@ public class Command_ride extends FreedomCommand
|
|||||||
player.sendMessage(ChatColor.AQUA + sender.getName() + " has requested to ride you.");
|
player.sendMessage(ChatColor.AQUA + sender.getName() + " has requested to ride you.");
|
||||||
player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.GREEN + "/ride accept" + ChatColor.AQUA + " to allow the player to ride you.");
|
player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.GREEN + "/ride accept" + ChatColor.AQUA + " to allow the player to ride you.");
|
||||||
player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.RED + "/ride deny" + ChatColor.AQUA + " to deny the player permission.");
|
player.sendMessage(ChatColor.AQUA + "Type " + ChatColor.RED + "/ride deny" + ChatColor.AQUA + " to deny the player permission.");
|
||||||
player.sendMessage(ChatColor.AQUA + "Request will expire after 30 seconds.");
|
player.sendMessage(ChatColor.AQUA + "Request will expire in 30 seconds.");
|
||||||
RIDE_REQUESTS.put(player, playerSender);
|
RIDE_REQUESTS.put(player, playerSender);
|
||||||
timer.schedule(new TimerTask()
|
|
||||||
|
new BukkitRunnable()
|
||||||
{
|
{
|
||||||
@Override
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (!RIDE_REQUESTS.containsKey(player))
|
if (!RIDE_REQUESTS.containsKey(player))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
RIDE_REQUESTS.remove(player);
|
RIDE_REQUESTS.remove(player);
|
||||||
msg("Request expired.", ChatColor.RED);
|
playerSender.sendMessage(ChatColor.RED + "It has been 30 seconds and " + player.getName() + " has not accepted your request.");
|
||||||
player.sendMessage(ChatColor.RED + "Request expired.");
|
player.sendMessage(ChatColor.RED + "Request expired.");
|
||||||
}
|
}
|
||||||
}, 30000);
|
}.runTaskLater(plugin, 20 * 30);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getWorld() != playerSender.getWorld())
|
if (player.getWorld() != playerSender.getWorld())
|
||||||
{
|
{
|
||||||
playerSender.teleport(player);
|
PaperLib.teleportAsync(playerSender, player.getLocation());
|
||||||
}
|
}
|
||||||
|
|
||||||
player.addPassenger(playerSender);
|
player.addPassenger(playerSender);
|
||||||
|
@ -17,7 +17,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.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]")
|
@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
|
public class Command_ro extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,7 @@ import org.bukkit.entity.Player;
|
|||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "You have thrown a rock, but you have also summoned a meteor!", usage = "/<command>")
|
@CommandParameters(description = "You have thrown a rock, but you have also summoned a meteor!", usage = "/<command>")
|
||||||
public class Command_rock extends FreedomCommand
|
public class Command_rock extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,7 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.TRIAL_MOD, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "Broadcasts the given message as the server, includes sender name.", usage = "/<command> <message>")
|
@CommandParameters(description = "Broadcasts the given message as the server, includes sender name.", usage = "/<command> <message>")
|
||||||
public class Command_say extends FreedomCommand
|
public class Command_say extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user