mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
removal of aero
This commit is contained in:
parent
9dad7c6d05
commit
9d71a7f4ae
@ -52,9 +52,8 @@
|
|||||||
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
|
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.9" level="project" />
|
||||||
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
|
<orderEntry type="library" name="Maven: commons-codec:commons-codec:1.9" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.spigotmc:spigot:1.16.1-R0.1-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.Pravian:Aero:5f82926" level="project" />
|
|
||||||
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12-R0.1-SNAPSHOT" level="project" />
|
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.github.TotalFreedom:BukkitTelnet:4.5-pre1" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.spigotmc:spigot-api:1.12-pre5-SNAPSHOT" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-core:2.5" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: org.apache.logging.log4j:log4j-api:2.5" level="project" />
|
||||||
<orderEntry type="library" name="Maven: com.github.libraryaddict:LibsDisguises:31672fce7b" level="project" />
|
<orderEntry type="library" name="Maven: com.github.libraryaddict:LibsDisguises:31672fce7b" level="project" />
|
||||||
@ -161,5 +160,8 @@
|
|||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.goldtreeservers:worldguardextraflags:4.0.0" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.goldtreeservers:worldguardextraflags:4.0.0" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: com.boydti:fawe-api:17.07.12-6b6f285-750-13.7.8" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: com.boydti:fawe-api:17.07.12-6b6f285-750-13.7.8" level="project" />
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13-SNAPSHOT" level="project" />
|
<orderEntry type="library" scope="PROVIDED" name="Maven: net.ess3:Essentials:2.13-SNAPSHOT" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.reflections:reflections:0.9.11" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: org.javassist:javassist:3.21.0-GA" level="project" />
|
||||||
|
<orderEntry type="library" name="Maven: javassist:javassist:3.12.1.GA" level="project" />
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
29
pom.xml
29
pom.xml
@ -142,13 +142,6 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.github.Pravian</groupId>
|
|
||||||
<artifactId>Aero</artifactId>
|
|
||||||
<version>5f82926</version>
|
|
||||||
<scope>provided</scope>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.TotalFreedom</groupId>
|
<groupId>com.github.TotalFreedom</groupId>
|
||||||
<artifactId>BukkitTelnet</artifactId>
|
<artifactId>BukkitTelnet</artifactId>
|
||||||
@ -238,6 +231,18 @@
|
|||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.reflections</groupId>
|
||||||
|
<artifactId>reflections</artifactId>
|
||||||
|
<version>0.9.11</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>javassist</groupId>
|
||||||
|
<artifactId>javassist</artifactId>
|
||||||
|
<version>3.12.1.GA</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
@ -396,12 +401,22 @@
|
|||||||
<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>javassist:javassist</include>
|
||||||
</includes>
|
</includes>
|
||||||
</artifactSet>
|
</artifactSet>
|
||||||
</configuration>
|
</configuration>
|
||||||
</execution>
|
</execution>
|
||||||
</executions>
|
</executions>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-jar-plugin</artifactId>
|
||||||
|
<version>2.3.1</version>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>C:\Users\Jax\Desktop\STUFF\ts116\plugins</outputDirectory>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
|
||||||
|
@ -21,13 +21,8 @@ public class Announcer extends FreedomService
|
|||||||
private String prefix;
|
private String prefix;
|
||||||
private BukkitTask announcer;
|
private BukkitTask announcer;
|
||||||
|
|
||||||
public Announcer(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
enabled = ConfigEntry.ANNOUNCER_ENABLED.getBoolean();
|
enabled = ConfigEntry.ANNOUNCER_ENABLED.getBoolean();
|
||||||
interval = ConfigEntry.ANNOUNCER_INTERVAL.getInteger() * 20L;
|
interval = ConfigEntry.ANNOUNCER_INTERVAL.getInteger() * 20L;
|
||||||
@ -64,7 +59,7 @@ public class Announcer extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
if (announcer == null)
|
if (announcer == null)
|
||||||
{
|
{
|
||||||
|
@ -12,19 +12,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||||||
|
|
||||||
public class AntiNuke extends FreedomService
|
public class AntiNuke extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public AntiNuke(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,13 +24,8 @@ public class AntiSpam extends FreedomService
|
|||||||
//
|
//
|
||||||
public BukkitTask cycleTask = null;
|
public BukkitTask cycleTask = null;
|
||||||
|
|
||||||
public AntiSpam(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
{
|
{
|
||||||
@ -44,7 +39,7 @@ public class AntiSpam extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
FUtil.cancel(cycleTask);
|
FUtil.cancel(cycleTask);
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import java.util.Map;
|
|||||||
import me.totalfreedom.totalfreedommod.banning.Ban;
|
import me.totalfreedom.totalfreedommod.banning.Ban;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -19,25 +18,20 @@ public class AutoEject extends FreedomService
|
|||||||
|
|
||||||
private final Map<String, Integer> ejects = new HashMap<>(); // ip -> amount
|
private final Map<String, Integer> ejects = new HashMap<>(); // ip -> amount
|
||||||
|
|
||||||
public AutoEject(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void autoEject(Player player, String kickMessage)
|
public void autoEject(Player player, String kickMessage)
|
||||||
{
|
{
|
||||||
EjectMethod method = EjectMethod.STRIKE_ONE;
|
EjectMethod method = EjectMethod.STRIKE_ONE;
|
||||||
final String ip = Ips.getIp(player);
|
final String ip = FUtil.getIp(player);
|
||||||
|
|
||||||
if (!ejects.containsKey(ip))
|
if (!ejects.containsKey(ip))
|
||||||
{
|
{
|
||||||
|
@ -15,13 +15,8 @@ public class AutoKick extends FreedomService
|
|||||||
private long autoKickTicks;
|
private long autoKickTicks;
|
||||||
private double autoKickThreshold;
|
private double autoKickThreshold;
|
||||||
|
|
||||||
public AutoKick(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
autoKickTicks = (long)ConfigEntry.AUTOKICK_TIME.getInteger() * 1000L;
|
autoKickTicks = (long)ConfigEntry.AUTOKICK_TIME.getInteger() * 1000L;
|
||||||
autoKickThreshold = ConfigEntry.AUTOKICK_THRESHOLD.getDouble();
|
autoKickThreshold = ConfigEntry.AUTOKICK_THRESHOLD.getDouble();
|
||||||
@ -43,7 +38,7 @@ public class AutoKick extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
FUtil.cancel(kickTask);
|
FUtil.cancel(kickTask);
|
||||||
kickTask = null;
|
kickTask = null;
|
||||||
|
@ -1,18 +1,21 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||||
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.pravian.aero.component.PluginComponent;
|
|
||||||
import net.pravian.aero.config.YamlConfig;
|
|
||||||
import org.bukkit.util.FileUtil;
|
import org.bukkit.util.FileUtil;
|
||||||
|
|
||||||
public class BackupManager extends PluginComponent<TotalFreedomMod>
|
public class BackupManager extends FreedomService
|
||||||
{
|
{
|
||||||
|
@Override
|
||||||
public BackupManager(TotalFreedomMod plugin)
|
public void onStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop()
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createBackups(String file)
|
public void createBackups(String file)
|
||||||
|
@ -23,19 +23,13 @@ import org.bukkit.SoundCategory;
|
|||||||
|
|
||||||
public class ChatManager extends FreedomService
|
public class ChatManager extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public ChatManager(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,19 +9,13 @@ import org.bukkit.ChatColor;
|
|||||||
|
|
||||||
public class CommandSpy extends FreedomService
|
public class CommandSpy extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public CommandSpy(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,11 +16,6 @@ public class EntityWiper extends FreedomService
|
|||||||
{
|
{
|
||||||
private BukkitTask wiper;
|
private BukkitTask wiper;
|
||||||
|
|
||||||
public EntityWiper(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<EntityType> BLACKLIST = Arrays.asList(
|
public List<EntityType> BLACKLIST = Arrays.asList(
|
||||||
EntityType.ARMOR_STAND,
|
EntityType.ARMOR_STAND,
|
||||||
EntityType.PAINTING,
|
EntityType.PAINTING,
|
||||||
@ -31,7 +26,7 @@ public class EntityWiper extends FreedomService
|
|||||||
);
|
);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
// Continuous Entity Wiper
|
// Continuous Entity Wiper
|
||||||
wiper = new BukkitRunnable()
|
wiper = new BukkitRunnable()
|
||||||
@ -45,7 +40,7 @@ public class EntityWiper extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
wiper.cancel();
|
wiper.cancel();
|
||||||
wiper = null;
|
wiper = null;
|
||||||
|
@ -1,13 +1,24 @@
|
|||||||
package me.totalfreedom.totalfreedommod;
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
import net.pravian.aero.component.service.AbstractService;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
|
import org.bukkit.Server;
|
||||||
|
import org.bukkit.event.Listener;
|
||||||
|
|
||||||
public abstract class FreedomService extends AbstractService<TotalFreedomMod>
|
public abstract class FreedomService implements Listener
|
||||||
{
|
{
|
||||||
|
protected final TotalFreedomMod plugin;
|
||||||
|
protected final Server server;
|
||||||
|
protected final FLog logger;
|
||||||
|
|
||||||
public FreedomService(TotalFreedomMod plugin)
|
public FreedomService()
|
||||||
{
|
{
|
||||||
super(plugin);
|
plugin = TotalFreedomMod.getPlugin();
|
||||||
|
server = plugin.getServer();
|
||||||
|
logger = new FLog();
|
||||||
|
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||||
|
plugin.fsh.add(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public abstract void onStart();
|
||||||
|
public abstract void onStop();
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,26 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
public class FreedomServiceHandler
|
||||||
|
{
|
||||||
|
@Getter
|
||||||
|
private List<FreedomService> services;
|
||||||
|
|
||||||
|
public FreedomServiceHandler()
|
||||||
|
{
|
||||||
|
this.services = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void add(FreedomService service)
|
||||||
|
{
|
||||||
|
services.add(service);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getServiceAmount()
|
||||||
|
{
|
||||||
|
return services.size();
|
||||||
|
}
|
||||||
|
}
|
@ -9,18 +9,13 @@ import org.bukkit.event.player.PlayerMoveEvent;
|
|||||||
|
|
||||||
public class Fuckoff extends FreedomService
|
public class Fuckoff extends FreedomService
|
||||||
{
|
{
|
||||||
public Fuckoff(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,10 +13,8 @@ public class GameRuleHandler extends FreedomService
|
|||||||
|
|
||||||
private final Map<GameRule, Boolean> rules = new EnumMap<>(GameRule.class);
|
private final Map<GameRule, Boolean> rules = new EnumMap<>(GameRule.class);
|
||||||
|
|
||||||
public GameRuleHandler(TotalFreedomMod plugin)
|
public GameRuleHandler()
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
|
|
||||||
for (GameRule gameRule : GameRule.values())
|
for (GameRule gameRule : GameRule.values())
|
||||||
{
|
{
|
||||||
rules.put(gameRule, gameRule.getDefaultValue());
|
rules.put(gameRule, gameRule.getDefaultValue());
|
||||||
@ -24,7 +22,7 @@ public class GameRuleHandler extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
setGameRule(GameRule.DO_DAYLIGHT_CYCLE, !ConfigEntry.DISABLE_NIGHT.getBoolean(), false);
|
setGameRule(GameRule.DO_DAYLIGHT_CYCLE, !ConfigEntry.DISABLE_NIGHT.getBoolean(), false);
|
||||||
setGameRule(GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean(), false);
|
setGameRule(GameRule.DO_FIRE_TICK, ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean(), false);
|
||||||
@ -41,7 +39,7 @@ public class GameRuleHandler extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,19 +23,13 @@ import org.bukkit.scheduler.BukkitRunnable;
|
|||||||
|
|
||||||
public class LogViewer extends FreedomService
|
public class LogViewer extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public LogViewer(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@ import me.totalfreedom.totalfreedommod.player.PlayerData;
|
|||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import me.totalfreedom.totalfreedommod.util.FSync;
|
import me.totalfreedom.totalfreedommod.util.FSync;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -37,18 +36,13 @@ public class LoginProcess extends FreedomService
|
|||||||
@Setter
|
@Setter
|
||||||
private static boolean lockdownEnabled = false;
|
private static boolean lockdownEnabled = false;
|
||||||
|
|
||||||
public LoginProcess(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,9 +203,9 @@ public class LoginProcess extends FreedomService
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!playerData.hasVerification() && !playerData.getIps().contains(Ips.getIp(player)))
|
if (!playerData.hasVerification() && !playerData.getIps().contains(FUtil.getIp(player)))
|
||||||
{
|
{
|
||||||
playerData.addIp(Ips.getIp(player));
|
playerData.addIp(FUtil.getIp(player));
|
||||||
plugin.pl.save(playerData);
|
plugin.pl.save(playerData);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -242,7 +236,11 @@ public class LoginProcess extends FreedomService
|
|||||||
|
|
||||||
if (!plugin.al.isAdmin(player))
|
if (!plugin.al.isAdmin(player))
|
||||||
{
|
{
|
||||||
fPlayer.setTag(FUtil.colorize(playerData.getTag()));
|
String tag = playerData.getTag();
|
||||||
|
if (tag != null)
|
||||||
|
{
|
||||||
|
fPlayer.setTag(FUtil.colorize(tag));
|
||||||
|
}
|
||||||
int noteCount = playerData.getNotes().size();
|
int noteCount = playerData.getNotes().size();
|
||||||
if (noteCount != 0)
|
if (noteCount != 0)
|
||||||
{
|
{
|
||||||
|
@ -18,18 +18,13 @@ public class Monitors extends FreedomService
|
|||||||
private final DecimalFormat decimalFormat = new DecimalFormat("#");
|
private final DecimalFormat decimalFormat = new DecimalFormat("#");
|
||||||
private String potionSpyPrefix = ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "PotionSpy" + ChatColor.DARK_GRAY + "] ";
|
private String potionSpyPrefix = ChatColor.DARK_GRAY + "[" + ChatColor.YELLOW + "PotionSpy" + ChatColor.DARK_GRAY + "] ";
|
||||||
|
|
||||||
public Monitors(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,18 +27,13 @@ public class MovementValidator extends FreedomService
|
|||||||
public static final int MAX_XYZ_COORD = 29999998;
|
public static final int MAX_XYZ_COORD = 29999998;
|
||||||
public static final int MAX_DISTANCE_TRAVELED = 100;
|
public static final int MAX_DISTANCE_TRAVELED = 100;
|
||||||
|
|
||||||
public MovementValidator(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,20 +21,15 @@ public class Muter extends FreedomService
|
|||||||
{
|
{
|
||||||
|
|
||||||
public static final List<String> MUTE_COMMANDS = Arrays.asList(StringUtils.split("say,me,msg,tell,reply,mail", ","));
|
public static final List<String> MUTE_COMMANDS = Arrays.asList(StringUtils.split("say,me,msg,tell,reply,mail", ","));
|
||||||
public final List<String> MUTED_PLAYERS = new ArrayList();
|
public final List<String> MUTED_PLAYERS = new ArrayList<>();
|
||||||
|
|
||||||
public Muter(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,19 +9,13 @@ import org.bukkit.util.Vector;
|
|||||||
|
|
||||||
public class Orbiter extends FreedomService
|
public class Orbiter extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public Orbiter(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,13 +32,8 @@ public class ProtectArea extends FreedomService
|
|||||||
//
|
//
|
||||||
private final Map<String, SerializableProtectedRegion> areas = Maps.newHashMap();
|
private final Map<String, SerializableProtectedRegion> areas = Maps.newHashMap();
|
||||||
|
|
||||||
public ProtectArea(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
if (!ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
@ -68,7 +63,7 @@ public class ProtectArea extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
|
@ -12,19 +12,13 @@ import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME;
|
|||||||
|
|
||||||
public class SavedFlags extends FreedomService
|
public class SavedFlags extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public SavedFlags(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,21 +11,15 @@ import org.bukkit.craftbukkit.v1_16_R1.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_R1";
|
||||||
|
|
||||||
public ServerInterface(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,19 +9,13 @@ import org.bukkit.event.server.ServerListPingEvent;
|
|||||||
|
|
||||||
public class ServerPing extends FreedomService
|
public class ServerPing extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public ServerPing(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package me.totalfreedom.totalfreedommod;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
import me.totalfreedom.totalfreedommod.admin.ActivityLog;
|
import me.totalfreedom.totalfreedommod.admin.ActivityLog;
|
||||||
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
import me.totalfreedom.totalfreedommod.admin.AdminList;
|
||||||
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
import me.totalfreedom.totalfreedommod.banning.BanManager;
|
||||||
@ -24,6 +25,7 @@ import me.totalfreedom.totalfreedommod.bridge.WorldEditBridge;
|
|||||||
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
import me.totalfreedom.totalfreedommod.bridge.WorldGuardBridge;
|
||||||
import me.totalfreedom.totalfreedommod.caging.Cager;
|
import me.totalfreedom.totalfreedommod.caging.Cager;
|
||||||
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
import me.totalfreedom.totalfreedommod.command.CommandLoader;
|
||||||
|
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
||||||
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
import me.totalfreedom.totalfreedommod.config.MainConfig;
|
||||||
import me.totalfreedom.totalfreedommod.discord.Discord;
|
import me.totalfreedom.totalfreedommod.discord.Discord;
|
||||||
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
import me.totalfreedom.totalfreedommod.freeze.Freezer;
|
||||||
@ -48,18 +50,23 @@ import me.totalfreedom.totalfreedommod.util.FUtil;
|
|||||||
import me.totalfreedom.totalfreedommod.util.MethodTimer;
|
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 net.pravian.aero.component.service.ServiceManager;
|
import net.coreprotect.command.CommandHandler;
|
||||||
import net.pravian.aero.plugin.AeroPlugin;
|
|
||||||
import org.bstats.Metrics;
|
import org.bstats.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;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.bukkit.scheduler.BukkitRunnable;
|
import org.bukkit.scheduler.BukkitRunnable;
|
||||||
|
import org.reflections.Reflections;
|
||||||
import org.spigotmc.SpigotConfig;
|
import org.spigotmc.SpigotConfig;
|
||||||
|
|
||||||
public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
public class TotalFreedomMod extends JavaPlugin
|
||||||
{
|
{
|
||||||
|
private static TotalFreedomMod plugin;
|
||||||
|
public static TotalFreedomMod getPlugin()
|
||||||
|
{
|
||||||
|
return plugin;
|
||||||
|
}
|
||||||
public static final String CONFIG_FILENAME = "config.yml";
|
public static final String CONFIG_FILENAME = "config.yml";
|
||||||
//
|
//
|
||||||
public static final BuildProperties build = new BuildProperties();
|
public static final BuildProperties build = new BuildProperties();
|
||||||
@ -70,8 +77,11 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
public MainConfig config;
|
public MainConfig config;
|
||||||
public PermissionConfig permissions;
|
public PermissionConfig permissions;
|
||||||
//
|
//
|
||||||
|
// Service Handler
|
||||||
|
public FreedomServiceHandler fsh;
|
||||||
|
// Command Loader
|
||||||
|
public CommandLoader cl;
|
||||||
// Services
|
// Services
|
||||||
public ServiceManager<TotalFreedomMod> services;
|
|
||||||
public ServerInterface si;
|
public ServerInterface si;
|
||||||
public SavedFlags sf;
|
public SavedFlags sf;
|
||||||
public WorldManager wm;
|
public WorldManager wm;
|
||||||
@ -79,7 +89,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
public AdminList al;
|
public AdminList al;
|
||||||
public ActivityLog acl;
|
public ActivityLog acl;
|
||||||
public RankManager rm;
|
public RankManager rm;
|
||||||
public CommandLoader cl;
|
|
||||||
public CommandBlocker cb;
|
public CommandBlocker cb;
|
||||||
public EventBlocker eb;
|
public EventBlocker eb;
|
||||||
public BlockBlocker bb;
|
public BlockBlocker bb;
|
||||||
@ -128,7 +137,6 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
//public HubWorldRestrictions hwr;
|
//public HubWorldRestrictions hwr;
|
||||||
//
|
//
|
||||||
// Bridges
|
// Bridges
|
||||||
public ServiceManager<TotalFreedomMod> bridges;
|
|
||||||
public BukkitTelnetBridge btb;
|
public BukkitTelnetBridge btb;
|
||||||
public EssentialsBridge esb;
|
public EssentialsBridge esb;
|
||||||
public LibsDisguisesBridge ldb;
|
public LibsDisguisesBridge ldb;
|
||||||
@ -137,19 +145,20 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
public WorldGuardBridge wgb;
|
public WorldGuardBridge wgb;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void load()
|
public void onLoad()
|
||||||
{
|
{
|
||||||
|
plugin = this;
|
||||||
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
TotalFreedomMod.pluginName = plugin.getDescription().getName();
|
||||||
TotalFreedomMod.pluginVersion = plugin.getDescription().getVersion();
|
TotalFreedomMod.pluginVersion = plugin.getDescription().getVersion();
|
||||||
|
|
||||||
FLog.setPluginLogger(plugin.getLogger());
|
FLog.setPluginLogger(plugin.getLogger());
|
||||||
FLog.setServerLogger(server.getLogger());
|
FLog.setServerLogger(getServer().getLogger());
|
||||||
|
|
||||||
build.load(plugin);
|
build.load(plugin);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void enable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
FLog.info("Created by Madgeek1450 and Prozza");
|
FLog.info("Created by Madgeek1450 and Prozza");
|
||||||
FLog.info("Version " + build.version);
|
FLog.info("Version " + build.version);
|
||||||
@ -165,7 +174,26 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
FUtil.deleteCoreDumps();
|
FUtil.deleteCoreDumps();
|
||||||
FUtil.deleteFolder(new File("./_deleteme"));
|
FUtil.deleteFolder(new File("./_deleteme"));
|
||||||
|
|
||||||
BackupManager backups = new BackupManager(this);
|
fsh = new FreedomServiceHandler();
|
||||||
|
cl = new CommandLoader();
|
||||||
|
|
||||||
|
Reflections commandDir = new Reflections("me.totalfreedom.totalfreedommod.command");
|
||||||
|
|
||||||
|
Set<Class<? extends FreedomCommand>> commandClasses = commandDir.getSubTypesOf(FreedomCommand.class);
|
||||||
|
|
||||||
|
for (Class<? extends FreedomCommand> commandClass : commandClasses)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cl.add(commandClass.newInstance());
|
||||||
|
}
|
||||||
|
catch (InstantiationException | IllegalAccessException | ExceptionInInitializerError ex)
|
||||||
|
{
|
||||||
|
FLog.warning("Failed to register command: /" + commandClass.getSimpleName().replace("Command_" , ""));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BackupManager backups = new BackupManager();
|
||||||
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
backups.createBackups(TotalFreedomMod.CONFIG_FILENAME, true);
|
||||||
backups.createBackups(PermbanList.CONFIG_FILENAME);
|
backups.createBackups(PermbanList.CONFIG_FILENAME);
|
||||||
backups.createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
|
backups.createBackups(PermissionConfig.PERMISSIONS_FILENAME, true);
|
||||||
@ -179,78 +207,78 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
permissions.load();
|
permissions.load();
|
||||||
|
|
||||||
// Start services
|
// Start services
|
||||||
services = new ServiceManager<>(plugin);
|
si = new ServerInterface();
|
||||||
si = services.registerService(ServerInterface.class);
|
sf = new SavedFlags();
|
||||||
sf = services.registerService(SavedFlags.class);
|
wm = new WorldManager();
|
||||||
wm = services.registerService(WorldManager.class);
|
lv = new LogViewer();
|
||||||
lv = services.registerService(LogViewer.class);
|
sql = new SQLite();
|
||||||
sql = services.registerService(SQLite.class);
|
al = new AdminList();
|
||||||
al = services.registerService(AdminList.class);
|
acl = new ActivityLog();
|
||||||
acl = services.registerService(ActivityLog.class);
|
rm = new RankManager();
|
||||||
rm = services.registerService(RankManager.class);
|
cb = new CommandBlocker();
|
||||||
cl = services.registerService(CommandLoader.class);
|
eb = new EventBlocker();
|
||||||
cb = services.registerService(CommandBlocker.class);
|
bb = new BlockBlocker();
|
||||||
eb = services.registerService(EventBlocker.class);
|
mb = new MobBlocker();
|
||||||
bb = services.registerService(BlockBlocker.class);
|
ib = new InteractBlocker();
|
||||||
mb = services.registerService(MobBlocker.class);
|
pb = new PotionBlocker();
|
||||||
ib = services.registerService(InteractBlocker.class);
|
lp = new LoginProcess();
|
||||||
pb = services.registerService(PotionBlocker.class);
|
nu = new AntiNuke();
|
||||||
lp = services.registerService(LoginProcess.class);
|
as = new AntiSpam();
|
||||||
nu = services.registerService(AntiNuke.class);
|
wr = new WorldRestrictions();
|
||||||
as = services.registerService(AntiSpam.class);
|
pl = new PlayerList();
|
||||||
wr = services.registerService(WorldRestrictions.class);
|
sh = new Shop();
|
||||||
pl = services.registerService(PlayerList.class);
|
an = new Announcer();
|
||||||
sh = services.registerService(Shop.class);
|
cm = new ChatManager();
|
||||||
an = services.registerService(Announcer.class);
|
dc = new Discord();
|
||||||
cm = services.registerService(ChatManager.class);
|
pul = new PunishmentList();
|
||||||
dc = services.registerService(Discord.class);
|
bm = new BanManager();
|
||||||
pul = services.registerService(PunishmentList.class);
|
pm = new PermbanList();
|
||||||
bm = services.registerService(BanManager.class);
|
pem = new PermissionManager();
|
||||||
pm = services.registerService(PermbanList.class);
|
pa = new ProtectArea();
|
||||||
pem = services.registerService(PermissionManager.class);
|
gr = new GameRuleHandler();
|
||||||
pa = services.registerService(ProtectArea.class);
|
snp = new SignBlocker();
|
||||||
gr = services.registerService(GameRuleHandler.class);
|
ew = new EntityWiper();
|
||||||
snp = services.registerService(SignBlocker.class);
|
|
||||||
ew = services.registerService(EntityWiper.class);
|
|
||||||
|
|
||||||
// Single admin utils
|
// Single admin utils
|
||||||
cs = services.registerService(CommandSpy.class);
|
cs = new CommandSpy();
|
||||||
ca = services.registerService(Cager.class);
|
ca = new Cager();
|
||||||
fm = services.registerService(Freezer.class);
|
fm = new Freezer();
|
||||||
or = services.registerService(Orbiter.class);
|
or = new Orbiter();
|
||||||
mu = services.registerService(Muter.class);
|
mu = new Muter();
|
||||||
ebl = services.registerService(EditBlocker.class);
|
ebl = new EditBlocker();
|
||||||
pbl = services.registerService(PVPBlocker.class);
|
pbl = new PVPBlocker();
|
||||||
fo = services.registerService(Fuckoff.class);
|
fo = new Fuckoff();
|
||||||
ak = services.registerService(AutoKick.class);
|
ak = new AutoKick();
|
||||||
ae = services.registerService(AutoEject.class);
|
ae = new AutoEject();
|
||||||
mo = services.registerService(Monitors.class);
|
mo = new Monitors();
|
||||||
|
|
||||||
|
|
||||||
mv = services.registerService(MovementValidator.class);
|
mv = new MovementValidator();
|
||||||
sp = services.registerService(ServerPing.class);
|
sp = new ServerPing();
|
||||||
|
|
||||||
// Fun
|
// Fun
|
||||||
cul = services.registerService(CurseListener.class);
|
cul = new CurseListener();
|
||||||
it = services.registerService(ItemFun.class);
|
it = new ItemFun();
|
||||||
lm = services.registerService(Landminer.class);
|
lm = new Landminer();
|
||||||
ms = services.registerService(MobStacker.class);
|
ms = new MobStacker();
|
||||||
mp = services.registerService(MP44.class);
|
mp = new MP44();
|
||||||
jp = services.registerService(Jumppads.class);
|
jp = new Jumppads();
|
||||||
tr = services.registerService(Trailer.class);
|
tr = new Trailer();
|
||||||
// HTTPD
|
// HTTPD
|
||||||
hd = services.registerService(HTTPDaemon.class);
|
hd = new HTTPDaemon();
|
||||||
services.start();
|
|
||||||
|
|
||||||
// Start bridges
|
// Start bridges
|
||||||
bridges = new ServiceManager<>(plugin);
|
btb = new BukkitTelnetBridge();
|
||||||
btb = bridges.registerService(BukkitTelnetBridge.class);
|
cpb = new CoreProtectBridge();
|
||||||
cpb = bridges.registerService(CoreProtectBridge.class);
|
esb = new EssentialsBridge();
|
||||||
esb = bridges.registerService(EssentialsBridge.class);
|
ldb = new LibsDisguisesBridge();
|
||||||
ldb = bridges.registerService(LibsDisguisesBridge.class);
|
web = new WorldEditBridge();
|
||||||
web = bridges.registerService(WorldEditBridge.class);
|
wgb = new WorldGuardBridge();
|
||||||
wgb = bridges.registerService(WorldGuardBridge.class);
|
|
||||||
bridges.start();
|
for (FreedomService service : fsh.getServices())
|
||||||
|
service.onStart();
|
||||||
|
|
||||||
|
FLog.info("Started " + fsh.getServiceAmount() + "services.");
|
||||||
|
|
||||||
timer.update();
|
timer.update();
|
||||||
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
FLog.info("Version " + pluginVersion + " for " + ServerInterface.COMPILE_NMS_VERSION + " enabled in " + timer.getTotal() + "ms");
|
||||||
@ -272,13 +300,15 @@ public class TotalFreedomMod extends AeroPlugin<TotalFreedomMod>
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
// Stop services and bridges
|
// Stop services and bridges
|
||||||
bridges.stop();
|
for (FreedomService service : fsh.getServices())
|
||||||
services.stop();
|
{
|
||||||
|
service.onStop();
|
||||||
|
}
|
||||||
|
|
||||||
server.getScheduler().cancelTasks(plugin);
|
getServer().getScheduler().cancelTasks(plugin);
|
||||||
|
|
||||||
FLog.info("Plugin disabled");
|
FLog.info("Plugin disabled");
|
||||||
}
|
}
|
||||||
|
@ -4,10 +4,9 @@ import com.google.common.collect.Maps;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import net.pravian.aero.config.YamlConfig;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -28,21 +27,19 @@ public class ActivityLog extends FreedomService
|
|||||||
|
|
||||||
private final YamlConfig config;
|
private final YamlConfig config;
|
||||||
|
|
||||||
public ActivityLog(TotalFreedomMod plugin)
|
public ActivityLog()
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
|
|
||||||
this.config = new YamlConfig(plugin, FILENAME, true);
|
this.config = new YamlConfig(plugin, FILENAME, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
save();
|
save();
|
||||||
}
|
}
|
||||||
@ -110,7 +107,7 @@ public class ActivityLog extends FreedomService
|
|||||||
ActivityLogEntry activityLog = getEntryByName(player.getName());
|
ActivityLogEntry activityLog = getEntryByName(player.getName());
|
||||||
if (activityLog == null)
|
if (activityLog == null)
|
||||||
{
|
{
|
||||||
String ip = Ips.getIp(player);
|
String ip = FUtil.getIp(player);
|
||||||
activityLog = getEntryByIp(ip);
|
activityLog = getEntryByIp(ip);
|
||||||
if (activityLog != null)
|
if (activityLog != null)
|
||||||
{
|
{
|
||||||
@ -129,7 +126,7 @@ public class ActivityLog extends FreedomService
|
|||||||
config.save();
|
config.save();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String ip = Ips.getIp(player);
|
String ip = FUtil.getIp(player);
|
||||||
if (!activityLog.getIps().contains(ip))
|
if (!activityLog.getIps().contains(ip))
|
||||||
{
|
{
|
||||||
activityLog.addIp(ip);
|
activityLog.addIp(ip);
|
||||||
|
@ -6,15 +6,13 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.IConfig;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.base.ConfigLoadable;
|
|
||||||
import net.pravian.aero.base.ConfigSavable;
|
|
||||||
import net.pravian.aero.base.Validatable;
|
|
||||||
import org.apache.commons.lang.Validate;
|
import org.apache.commons.lang.Validate;
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ActivityLogEntry implements ConfigLoadable, ConfigSavable, Validatable
|
public class ActivityLogEntry implements IConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
|
@ -15,7 +15,6 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -58,7 +57,7 @@ public class Admin
|
|||||||
public Admin(Player player)
|
public Admin(Player player)
|
||||||
{
|
{
|
||||||
this.name = player.getName();
|
this.name = player.getName();
|
||||||
this.ips.add(Ips.getIp(player));
|
this.ips.add(FUtil.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Admin(ResultSet resultSet)
|
public Admin(ResultSet resultSet)
|
||||||
@ -107,7 +106,7 @@ public class Admin
|
|||||||
{
|
{
|
||||||
name = player.getName();
|
name = player.getName();
|
||||||
ips.clear();
|
ips.clear();
|
||||||
ips.add(Ips.getIp(player));
|
ips.add(FUtil.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<String, Object> toSQLStorable()
|
public Map<String, Object> toSQLStorable()
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package me.totalfreedom.totalfreedommod.admin;
|
package me.totalfreedom.totalfreedommod.admin;
|
||||||
|
|
||||||
import com.google.common.base.Function;
|
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
@ -13,16 +12,13 @@ import java.util.Set;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.plugin.ServicePriority;
|
|
||||||
|
|
||||||
public class AdminList extends FreedomService
|
public class AdminList extends FreedomService
|
||||||
{
|
{
|
||||||
@ -37,20 +33,15 @@ public class AdminList extends FreedomService
|
|||||||
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
public final Map<String, List<String>> verifiedNoAdminIps = Maps.newHashMap();
|
||||||
public static ArrayList<Player> vanished = new ArrayList<>();
|
public static ArrayList<Player> vanished = new ArrayList<>();
|
||||||
|
|
||||||
public AdminList(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
load();
|
load();
|
||||||
deactivateOldEntries(false);
|
deactivateOldEntries(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +130,7 @@ public class AdminList extends FreedomService
|
|||||||
public Admin getAdmin(Player player)
|
public Admin getAdmin(Player player)
|
||||||
{
|
{
|
||||||
// Find admin
|
// Find admin
|
||||||
String ip = Ips.getIp(player);
|
String ip = FUtil.getIp(player);
|
||||||
Admin admin = getEntryByName(player.getName());
|
Admin admin = getEntryByName(player.getName());
|
||||||
|
|
||||||
// Admin by name
|
// Admin by name
|
||||||
@ -223,7 +214,7 @@ public class AdminList extends FreedomService
|
|||||||
|
|
||||||
public boolean isVerifiedAdmin(Player player)
|
public boolean isVerifiedAdmin(Player player)
|
||||||
{
|
{
|
||||||
return verifiedNoAdmins.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(Ips.getIp(player));
|
return verifiedNoAdmins.contains(player.getName()) && verifiedNoAdminIps.get(player.getName()).contains(FUtil.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isIdentityMatched(Player player)
|
public boolean isIdentityMatched(Player player)
|
||||||
|
@ -14,14 +14,14 @@ import java.util.Set;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.IConfig;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.base.Validatable;
|
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class Ban implements Validatable
|
public class Ban implements IConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||||
@ -81,7 +81,7 @@ public class Ban implements Validatable
|
|||||||
|
|
||||||
public static Ban forPlayerIp(Player player, CommandSender by, Date expiry, String reason)
|
public static Ban forPlayerIp(Player player, CommandSender by, Date expiry, String reason)
|
||||||
{
|
{
|
||||||
return new Ban(null, Arrays.asList(Ips.getIp(player)), by.getName(), Date.from(Instant.now()), expiry, reason);
|
return new Ban(null, Arrays.asList(FUtil.getIp(player)), by.getName(), Date.from(Instant.now()), expiry, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Ban forPlayerIp(String ip, CommandSender by, Date expiry, String reason)
|
public static Ban forPlayerIp(String ip, CommandSender by, Date expiry, String reason)
|
||||||
@ -116,7 +116,7 @@ public class Ban implements Validatable
|
|||||||
public static Ban forPlayer(Player player, CommandSender by, Date expiry, String reason)
|
public static Ban forPlayer(Player player, CommandSender by, Date expiry, String reason)
|
||||||
{
|
{
|
||||||
return new Ban(player.getName(),
|
return new Ban(player.getName(),
|
||||||
Ips.getIp(player),
|
FUtil.getIp(player),
|
||||||
by.getName(),
|
by.getName(),
|
||||||
Date.from(Instant.now()),
|
Date.from(Instant.now()),
|
||||||
expiry,
|
expiry,
|
||||||
@ -126,7 +126,7 @@ public class Ban implements Validatable
|
|||||||
public static Ban forPlayerFuzzy(Player player, CommandSender by, Date expiry, String reason)
|
public static Ban forPlayerFuzzy(Player player, CommandSender by, Date expiry, String reason)
|
||||||
{
|
{
|
||||||
return new Ban(player.getName(),
|
return new Ban(player.getName(),
|
||||||
FUtil.getFuzzyIp(Ips.getIp(player)),
|
FUtil.getFuzzyIp(FUtil.getIp(player)),
|
||||||
by.getName(),
|
by.getName(),
|
||||||
Date.from(Instant.now()),
|
Date.from(Instant.now()),
|
||||||
expiry,
|
expiry,
|
||||||
@ -235,6 +235,16 @@ public class Ban implements Validatable
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void loadFrom(ConfigurationSection cs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveTo(ConfigurationSection cs)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isValid()
|
public boolean isValid()
|
||||||
{
|
{
|
||||||
|
@ -13,12 +13,10 @@ import java.util.List;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
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,13 +33,8 @@ public class BanManager extends FreedomService
|
|||||||
|
|
||||||
//
|
//
|
||||||
|
|
||||||
public BanManager(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
bans.clear();
|
bans.clear();
|
||||||
try
|
try
|
||||||
@ -78,7 +71,7 @@ public class BanManager extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +113,7 @@ public class BanManager extends FreedomService
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Ips.fuzzyIpMatch(ip, loopIp, 4))
|
if (FUtil.fuzzyIpMatch(ip, loopIp, 4))
|
||||||
{
|
{
|
||||||
return loopBan;
|
return loopBan;
|
||||||
}
|
}
|
||||||
@ -231,7 +224,7 @@ public class BanManager extends FreedomService
|
|||||||
public void onPlayerLogin(PlayerLoginEvent event)
|
public void onPlayerLogin(PlayerLoginEvent event)
|
||||||
{
|
{
|
||||||
final String username = event.getPlayer().getName();
|
final String username = event.getPlayer().getName();
|
||||||
final String ip = Ips.getIp(event);
|
final String ip = FUtil.getIp(event);
|
||||||
|
|
||||||
// Regular ban
|
// Regular ban
|
||||||
Ban ban = getByUsername(username);
|
Ban ban = getByUsername(username);
|
||||||
@ -265,7 +258,7 @@ public class BanManager extends FreedomService
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ban = getByIp(Ips.getIp(player));
|
ban = getByIp(FUtil.getIp(player));
|
||||||
if (ban != null)
|
if (ban != null)
|
||||||
{
|
{
|
||||||
removeBan(ban);
|
removeBan(ban);
|
||||||
|
@ -4,12 +4,10 @@ import com.google.common.collect.Sets;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
|
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||||
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.pravian.aero.config.YamlConfig;
|
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.event.EventPriority;
|
import org.bukkit.event.EventPriority;
|
||||||
@ -25,13 +23,8 @@ public class PermbanList extends FreedomService
|
|||||||
@Getter
|
@Getter
|
||||||
private final Set<String> permbannedIps = Sets.newHashSet();
|
private final Set<String> permbannedIps = Sets.newHashSet();
|
||||||
|
|
||||||
public PermbanList(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
permbannedNames.clear();
|
permbannedNames.clear();
|
||||||
permbannedIps.clear();
|
permbannedIps.clear();
|
||||||
@ -49,7 +42,7 @@ public class PermbanList extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +50,7 @@ public class PermbanList extends FreedomService
|
|||||||
public void onPlayerLogin(PlayerLoginEvent event)
|
public void onPlayerLogin(PlayerLoginEvent event)
|
||||||
{
|
{
|
||||||
final String username = event.getPlayer().getName();
|
final String username = event.getPlayer().getName();
|
||||||
final String ip = Ips.getIp(event);
|
final String ip = FUtil.getIp(event);
|
||||||
|
|
||||||
// Permbanned IPs
|
// Permbanned IPs
|
||||||
for (String testIp : getPermbannedIps())
|
for (String testIp : getPermbannedIps())
|
||||||
|
@ -23,19 +23,13 @@ import org.bukkit.inventory.meta.SkullMeta;
|
|||||||
|
|
||||||
public class BlockBlocker extends FreedomService
|
public class BlockBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public BlockBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,19 +12,13 @@ import org.bukkit.event.block.BlockPlaceEvent;
|
|||||||
|
|
||||||
public class EditBlocker extends FreedomService
|
public class EditBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public EditBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,19 +35,13 @@ import org.bukkit.event.player.PlayerRespawnEvent;
|
|||||||
|
|
||||||
public class EventBlocker extends FreedomService
|
public class EventBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public EventBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,19 +16,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class InteractBlocker extends FreedomService
|
public class InteractBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public InteractBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,19 +22,13 @@ import org.bukkit.event.entity.EntitySpawnEvent;
|
|||||||
|
|
||||||
public class MobBlocker extends FreedomService
|
public class MobBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public MobBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,19 +14,13 @@ import org.bukkit.event.entity.EntityDamageByEntityEvent;
|
|||||||
|
|
||||||
public class PVPBlocker extends FreedomService
|
public class PVPBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public PVPBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,18 +19,13 @@ public class PotionBlocker extends FreedomService
|
|||||||
|
|
||||||
public static final int POTION_BLOCK_RADIUS_SQUARED = 20 * 20;
|
public static final int POTION_BLOCK_RADIUS_SQUARED = 20 * 20;
|
||||||
|
|
||||||
public PotionBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,19 +19,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class SignBlocker extends FreedomService
|
public class SignBlocker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public SignBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,11 +7,10 @@ import java.util.Map;
|
|||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
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.pravian.aero.command.CommandReflection;
|
|
||||||
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;
|
||||||
@ -29,19 +28,14 @@ public class CommandBlocker extends FreedomService
|
|||||||
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
private final Map<String, CommandBlockerEntry> entryList = Maps.newHashMap();
|
||||||
private final List<String> unknownCommands = Lists.newArrayList();
|
private final List<String> unknownCommands = Lists.newArrayList();
|
||||||
|
|
||||||
public CommandBlocker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
entryList.clear();
|
entryList.clear();
|
||||||
}
|
}
|
||||||
@ -51,13 +45,6 @@ public class CommandBlocker extends FreedomService
|
|||||||
entryList.clear();
|
entryList.clear();
|
||||||
unknownCommands.clear();
|
unknownCommands.clear();
|
||||||
|
|
||||||
final CommandMap commandMap = CommandReflection.getCommandMap();
|
|
||||||
if (commandMap == null)
|
|
||||||
{
|
|
||||||
FLog.severe("Error loading commandMap.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
|
List<String> blockedCommands = (List<String>)ConfigEntry.BLOCKED_COMMANDS.getList();
|
||||||
for (String rawEntry : blockedCommands)
|
for (String rawEntry : blockedCommands)
|
||||||
@ -88,7 +75,7 @@ public class CommandBlocker extends FreedomService
|
|||||||
subCommand = StringUtils.join(commandParts, " ", 1, commandParts.length).trim().toLowerCase();
|
subCommand = StringUtils.join(commandParts, " ", 1, commandParts.length).trim().toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
final Command command = commandMap.getCommand(commandName);
|
final FreedomCommand command = plugin.cl.getByName(commandName);
|
||||||
|
|
||||||
// Obtain command from alias
|
// Obtain command from alias
|
||||||
if (command == null)
|
if (command == null)
|
||||||
@ -111,7 +98,7 @@ public class CommandBlocker extends FreedomService
|
|||||||
|
|
||||||
if (command != null)
|
if (command != null)
|
||||||
{
|
{
|
||||||
for (String alias : command.getAliases())
|
for (String alias : command.getAliases().split(","))
|
||||||
{
|
{
|
||||||
entryList.put(alias.toLowerCase(), blockedCommandEntry);
|
entryList.put(alias.toLowerCase(), blockedCommandEntry);
|
||||||
}
|
}
|
||||||
|
@ -24,18 +24,13 @@ public class BukkitTelnetBridge extends FreedomService
|
|||||||
|
|
||||||
private BukkitTelnet bukkitTelnetPlugin = null;
|
private BukkitTelnet bukkitTelnetPlugin = null;
|
||||||
|
|
||||||
public BukkitTelnetBridge(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,18 +28,13 @@ public class CoreProtectBridge extends FreedomService
|
|||||||
|
|
||||||
private BukkitTask wiper;
|
private BukkitTask wiper;
|
||||||
|
|
||||||
public CoreProtectBridge(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,18 +26,13 @@ public class EssentialsBridge extends FreedomService
|
|||||||
|
|
||||||
private Essentials essentialsPlugin = null;
|
private Essentials essentialsPlugin = null;
|
||||||
|
|
||||||
public EssentialsBridge(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,18 +13,13 @@ public class LibsDisguisesBridge extends FreedomService
|
|||||||
|
|
||||||
private LibsDisguises libsDisguisesPlugin = null;
|
private LibsDisguises libsDisguisesPlugin = null;
|
||||||
|
|
||||||
public LibsDisguisesBridge(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,18 +15,13 @@ public class WorldEditBridge extends FreedomService
|
|||||||
//
|
//
|
||||||
private WorldEditPlugin worldeditPlugin = null;
|
private WorldEditPlugin worldeditPlugin = null;
|
||||||
|
|
||||||
public WorldEditBridge(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,21 +13,15 @@ import org.bukkit.plugin.Plugin;
|
|||||||
|
|
||||||
public class WorldGuardBridge extends FreedomService
|
public class WorldGuardBridge extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public WorldGuardBridge(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
plugin.wr.protectWorld(plugin.wm.hubworld.getWorld());
|
plugin.wr.protectWorld(plugin.wm.hubworld.getWorld());
|
||||||
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
|
plugin.wr.protectWorld(plugin.wm.masterBuilderWorld.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,19 +17,13 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
public class Cager extends FreedomService
|
public class Cager extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public Cager(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,45 +1,48 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import net.pravian.aero.command.handler.SimpleCommandHandler;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
|
|
||||||
public class CommandLoader extends FreedomService
|
public class CommandLoader extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final SimpleCommandHandler<TotalFreedomMod> handler;
|
private final List<FreedomCommand> commands;
|
||||||
|
|
||||||
public CommandLoader(TotalFreedomMod plugin)
|
public CommandLoader()
|
||||||
{
|
{
|
||||||
super(plugin);
|
commands = new ArrayList<>();
|
||||||
|
|
||||||
handler = new SimpleCommandHandler<>(plugin);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
handler.clearCommands();
|
|
||||||
handler.setExecutorFactory(new FreedomCommandExecutor.FreedomExecutorFactory(plugin));
|
|
||||||
handler.setCommandClassPrefix("Command_");
|
|
||||||
handler.setPermissionMessage(ChatColor.RED + "You do not have permission to use this command.");
|
|
||||||
handler.setOnlyConsoleMessage(ChatColor.RED + "This command can only be used from the console.");
|
|
||||||
handler.setOnlyPlayerMessage(ChatColor.RED + "This command can only be used by players.");
|
|
||||||
|
|
||||||
handler.loadFrom(FreedomCommand.class.getPackage());
|
|
||||||
handler.registerAll(plugin.getDescription().getName(), true);
|
|
||||||
|
|
||||||
FLog.info("Loaded " + handler.getExecutors().size() + " commands.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
handler.clearCommands();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void add(FreedomCommand command)
|
||||||
|
{
|
||||||
|
commands.add(command);
|
||||||
|
command.register();
|
||||||
|
}
|
||||||
|
|
||||||
|
public FreedomCommand getByName(String name)
|
||||||
|
{
|
||||||
|
for (FreedomCommand command : commands)
|
||||||
|
{
|
||||||
|
if (name.equals(command.getName()))
|
||||||
|
return command;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCommandAmount()
|
||||||
|
{
|
||||||
|
return commands.size();
|
||||||
|
}
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ public class Command_announce extends FreedomCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected 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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
|
@ -8,7 +8,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
|||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -82,7 +81,7 @@ public class Command_ban extends FreedomCommand
|
|||||||
final PlayerData entry = plugin.pl.getData(player);
|
final PlayerData entry = plugin.pl.getData(player);
|
||||||
username = player.getName();
|
username = player.getName();
|
||||||
//ips.addAll(entry.getIps());/
|
//ips.addAll(entry.getIps());/
|
||||||
ips.add(Ips.getIp(player));
|
ips.add(FUtil.getIp(player));
|
||||||
|
|
||||||
// Deop
|
// Deop
|
||||||
player.setOp(false);
|
player.setOp(false);
|
||||||
@ -152,7 +151,7 @@ public class Command_ban extends FreedomCommand
|
|||||||
player.kickPlayer(ban.bakeKickMessage());
|
player.kickPlayer(ban.bakeKickMessage());
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (Ips.getIp(p).equals(Ips.getIp(player)))
|
if (FUtil.getIp(p).equals(FUtil.getIp(player)))
|
||||||
{
|
{
|
||||||
p.kickPlayer(ChatColor.RED + "You've been kicked because someone on your IP has been banned.");
|
p.kickPlayer(ChatColor.RED + "You've been kicked because someone on your IP has been banned.");
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ public class Command_clearinventory 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 && plugin.al.isAdmin(playerSender))
|
if (args.length == 1 && plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
List<String> players = FUtil.getPlayerList();
|
List<String> players = FUtil.getPlayerList();
|
||||||
players.add("-a");
|
players.add("-a");
|
||||||
|
@ -7,8 +7,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
|||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
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 static me.totalfreedom.totalfreedommod.util.FUtil.playerMsg;
|
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -100,7 +98,7 @@ public class Command_doom extends FreedomCommand
|
|||||||
final String kickReason = (reason == null ? "FUCKOFF, and get your shit together!" : reason);
|
final String kickReason = (reason == null ? "FUCKOFF, and get your shit together!" : reason);
|
||||||
|
|
||||||
// Log doom
|
// Log doom
|
||||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.DOOM, reason));
|
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.DOOM, reason));
|
||||||
|
|
||||||
new BukkitRunnable()
|
new BukkitRunnable()
|
||||||
{
|
{
|
||||||
|
@ -4,7 +4,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
|||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
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;
|
||||||
@ -16,7 +15,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class Command_kick extends FreedomCommand
|
public class Command_kick extends FreedomCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected 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 == 0)
|
if (args.length == 0)
|
||||||
{
|
{
|
||||||
@ -53,7 +52,7 @@ public class Command_kick extends FreedomCommand
|
|||||||
|
|
||||||
player.kickPlayer(builder.toString());
|
player.kickPlayer(builder.toString());
|
||||||
|
|
||||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.KICK, reason));
|
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.KICK, reason));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class Command_links extends FreedomCommand
|
public class Command_links extends FreedomCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected 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)
|
||||||
{
|
{
|
||||||
YamlConfiguration config = plugin.config.configuration;
|
YamlConfiguration config = plugin.config.configuration;
|
||||||
ConfigurationSection section = config.getConfigurationSection("social_links");
|
ConfigurationSection section = config.getConfigurationSection("social_links");
|
||||||
|
@ -7,7 +7,6 @@ import me.totalfreedom.totalfreedommod.admin.AdminList;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
@ -7,7 +7,7 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
@CommandPermissions(level = Rank.SENIOR_ADMIN, source = SourceType.BOTH)
|
||||||
@CommandParameters(description = "seth's personal command", usage = "/<command> <players>")
|
@CommandParameters(description = "seth's personal command", usage = "/<command> <players>", aliases = "genocide")
|
||||||
public class Command_massmurder extends FreedomCommand
|
public class Command_massmurder extends FreedomCommand
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
|||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.apache.commons.lang3.ArrayUtils;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -153,7 +152,7 @@ public class Command_mute extends FreedomCommand
|
|||||||
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
msg(player, "You have been muted by " + ChatColor.YELLOW + sender.getName(), ChatColor.RED);
|
||||||
msg("Muted " + player.getName());
|
msg("Muted " + player.getName());
|
||||||
|
|
||||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.MUTE, reason));
|
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.MUTE, reason));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,6 @@ 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.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
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;
|
||||||
@ -22,7 +21,7 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected 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)
|
if (args.length < 1)
|
||||||
{
|
{
|
||||||
@ -60,7 +59,7 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
final String targetIp = Ips.getIp(targetPlayer);
|
final String targetIp = FUtil.getIp(targetPlayer);
|
||||||
|
|
||||||
switch (args[0])
|
switch (args[0])
|
||||||
{
|
{
|
||||||
@ -285,7 +284,7 @@ public class Command_myadmin extends FreedomCommand
|
|||||||
if (args[0].equals("clearip"))
|
if (args[0].equals("clearip"))
|
||||||
{
|
{
|
||||||
List<String> ips = plugin.al.getAdmin(sender).getIps();
|
List<String> ips = plugin.al.getAdmin(sender).getIps();
|
||||||
ips.remove(Ips.getIp(playerSender));
|
ips.remove(FUtil.getIp((Player) sender));
|
||||||
return ips;
|
return ips;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ public class Command_permban extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
msg("Reloading permban list...", ChatColor.RED);
|
msg("Reloading permban list...", ChatColor.RED);
|
||||||
plugin.pm.stop();
|
plugin.pm.onStop();
|
||||||
plugin.pm.start();
|
plugin.pm.onStart();
|
||||||
msg("Reloaded permban list.");
|
msg("Reloaded permban list.");
|
||||||
msg(plugin.pm.getPermbannedIps().size() + " IPs and "
|
msg(plugin.pm.getPermbannedIps().size() + " IPs and "
|
||||||
+ plugin.pm.getPermbannedNames().size() + " usernames loaded.");
|
+ plugin.pm.getPermbannedNames().size() + " usernames loaded.");
|
||||||
|
@ -6,7 +6,7 @@ import java.util.Collections;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
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 net.pravian.aero.util.Ips;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
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;
|
||||||
@ -17,7 +17,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class Command_playerverification extends FreedomCommand
|
public class Command_playerverification extends FreedomCommand
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
protected 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)
|
||||||
{
|
{
|
||||||
PlayerData target = plugin.pl.getData(playerSender);
|
PlayerData target = plugin.pl.getData(playerSender);
|
||||||
|
|
||||||
@ -31,14 +31,14 @@ public class Command_playerverification extends FreedomCommand
|
|||||||
int cleared = 0;
|
int cleared = 0;
|
||||||
for (String ip : ips)
|
for (String ip : ips)
|
||||||
{
|
{
|
||||||
if (!ip.equals(Ips.getIp(playerSender)))
|
if (!ip.equals(FUtil.getIp(playerSender)))
|
||||||
{
|
{
|
||||||
target.removeIp(ip);
|
target.removeIp(ip);
|
||||||
cleared++;
|
cleared++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
msg("Cleared all IP's except your current IP \"" + Ips.getIp(playerSender) + "\"");
|
msg("Cleared all IP's except your current IP \"" + FUtil.getIp(playerSender) + "\"");
|
||||||
msg("Cleared " + cleared + " IP's.");
|
msg("Cleared " + cleared + " IP's.");
|
||||||
plugin.pl.save(target);
|
plugin.pl.save(target);
|
||||||
plugin.pl.syncIps(target);
|
plugin.pl.syncIps(target);
|
||||||
|
@ -106,12 +106,6 @@ public class Command_ride extends FreedomCommand
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player.getName().equals("Catholic_Mario"))
|
|
||||||
{
|
|
||||||
msg("no", ChatColor.RED);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (playerData.getRideMode().equals("ask") && !FUtil.isExecutive(playerSender.getName()))
|
if (playerData.getRideMode().equals("ask") && !FUtil.isExecutive(playerSender.getName()))
|
||||||
{
|
{
|
||||||
msg("Sent a request to the player.", ChatColor.GREEN);
|
msg("Sent a request to the player.", ChatColor.GREEN);
|
||||||
@ -120,7 +114,7 @@ public class Command_ride extends FreedomCommand
|
|||||||
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 after 30 seconds.");
|
||||||
RIDE_REQUESTS.put(player, playerSender);
|
RIDE_REQUESTS.put(player, playerSender);
|
||||||
FreedomCommandExecutor.timer.schedule(new TimerTask()
|
timer.schedule(new TimerTask()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void run()
|
public void run()
|
||||||
|
@ -10,7 +10,6 @@ import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
|||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
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;
|
||||||
@ -175,7 +174,7 @@ public class Command_saconfig extends FreedomCommand
|
|||||||
Admin admin = null;
|
Admin admin = null;
|
||||||
for (Admin loopAdmin : plugin.al.getAllAdmins())
|
for (Admin loopAdmin : plugin.al.getAllAdmins())
|
||||||
{
|
{
|
||||||
if (loopAdmin.getName().equalsIgnoreCase(name) || loopAdmin.getIps().contains(Ips.getIp(player)))
|
if (loopAdmin.getName().equalsIgnoreCase(name) || loopAdmin.getIps().contains(FUtil.getIp(player)))
|
||||||
{
|
{
|
||||||
admin = loopAdmin;
|
admin = loopAdmin;
|
||||||
break;
|
break;
|
||||||
@ -212,7 +211,7 @@ public class Command_saconfig extends FreedomCommand
|
|||||||
if (oldName != player.getName())
|
if (oldName != player.getName())
|
||||||
admin.setName(player.getName());
|
admin.setName(player.getName());
|
||||||
plugin.sql.updateAdminName(oldName, admin.getName());
|
plugin.sql.updateAdminName(oldName, admin.getName());
|
||||||
admin.addIp(Ips.getIp(player));
|
admin.addIp(FUtil.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
admin.setActive(true);
|
admin.setActive(true);
|
||||||
|
@ -4,7 +4,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
|||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -60,7 +59,7 @@ public class Command_smite extends FreedomCommand
|
|||||||
|
|
||||||
smite(sender, player, reason, silent);
|
smite(sender, player, reason, silent);
|
||||||
|
|
||||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.SMITE, reason));
|
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.SMITE, reason));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ public class Command_spawnmob extends FreedomCommand
|
|||||||
{
|
{
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected 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 > 0 && args[0].equalsIgnoreCase("list"))
|
if (args.length > 0 && args[0].equalsIgnoreCase("list"))
|
||||||
{
|
{
|
||||||
|
@ -10,7 +10,6 @@ import me.totalfreedom.totalfreedommod.punishments.Punishment;
|
|||||||
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
import me.totalfreedom.totalfreedommod.punishments.PunishmentType;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
import org.apache.commons.lang.ArrayUtils;
|
import org.apache.commons.lang.ArrayUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
@ -97,7 +96,7 @@ public class Command_tempban extends FreedomCommand
|
|||||||
plugin.bm.addBan(ban);
|
plugin.bm.addBan(ban);
|
||||||
player.kickPlayer(ban.bakeKickMessage());
|
player.kickPlayer(ban.bakeKickMessage());
|
||||||
|
|
||||||
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.TEMPBAN, reason));
|
plugin.pul.logPunishment(new Punishment(player.getName(), FUtil.getIp(player), sender.getName(), PunishmentType.TEMPBAN, reason));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
@ -34,8 +35,11 @@ public class Command_totalfreedommod extends FreedomCommand
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugin.config.load();
|
plugin.config.load();
|
||||||
plugin.services.stop();
|
for (FreedomService service : plugin.fsh.getServices())
|
||||||
plugin.services.start();
|
{
|
||||||
|
service.onStop();
|
||||||
|
service.onStart();
|
||||||
|
}
|
||||||
|
|
||||||
final String message = String.format("%s v%s reloaded.",
|
final String message = String.format("%s v%s reloaded.",
|
||||||
TotalFreedomMod.pluginName,
|
TotalFreedomMod.pluginName,
|
||||||
|
@ -4,7 +4,6 @@ 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;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
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;
|
||||||
@ -50,7 +49,7 @@ public class Command_verify extends FreedomCommand
|
|||||||
{
|
{
|
||||||
String code = plugin.dc.generateCode(10);
|
String code = plugin.dc.generateCode(10);
|
||||||
plugin.dc.addVerificationCode(code, playerData);
|
plugin.dc.addVerificationCode(code, playerData);
|
||||||
plugin.dc.bot.getUserById(discordId).openPrivateChannel().complete().sendMessage("A user with the IP `" + Ips.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete();
|
plugin.dc.bot.getUserById(discordId).openPrivateChannel().complete().sendMessage("A user with the IP `" + FUtil.getIp(playerSender) + "` has sent a verification request. Please run the following in-game command: `/verify " + code + "`").complete();
|
||||||
msg("A verification code has been sent to your account, please copy the code and run /verify <code>", ChatColor.GREEN);
|
msg("A verification code has been sent to your account, please copy the code and run /verify <code>", ChatColor.GREEN);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -6,7 +6,6 @@ import java.util.List;
|
|||||||
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
import me.totalfreedom.totalfreedommod.player.FPlayer;
|
||||||
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.pravian.aero.util.Ips;
|
|
||||||
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;
|
||||||
@ -39,7 +38,7 @@ public class Command_verifynoadmin extends FreedomCommand
|
|||||||
{
|
{
|
||||||
plugin.al.verifiedNoAdmins.add(player.getName());
|
plugin.al.verifiedNoAdmins.add(player.getName());
|
||||||
}
|
}
|
||||||
String ip = Ips.getIp(player);
|
String ip = FUtil.getIp(player);
|
||||||
if (!plugin.al.verifiedNoAdminIps.containsKey(player.getName()))
|
if (!plugin.al.verifiedNoAdminIps.containsKey(player.getName()))
|
||||||
{
|
{
|
||||||
List<String> ips = new ArrayList<>();
|
List<String> ips = new ArrayList<>();
|
||||||
|
@ -30,17 +30,20 @@ public class Command_wildcard extends FreedomCommand
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Command runCmd = server.getPluginCommand(args[0]);
|
FreedomCommand command = plugin.cl.getByName(args[0]);
|
||||||
if (runCmd == null)
|
if (command == null)
|
||||||
{
|
{
|
||||||
msg("Unknown command: " + args[0], ChatColor.RED);
|
msg("Unknown command: " + args[0], ChatColor.RED);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (BLOCKED_COMMANDS.contains(runCmd.getName()))
|
for (String blockedCommand : BLOCKED_COMMANDS)
|
||||||
{
|
{
|
||||||
msg("Did you really think that was going to work?", ChatColor.RED);
|
if (blockedCommand.equals(command.getName()) || command.getAliases().contains(blockedCommand))
|
||||||
return true;
|
{
|
||||||
|
msg("Did you really think that was going to work?", ChatColor.RED);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String baseCommand = StringUtils.join(args, " ");
|
String baseCommand = StringUtils.join(args, " ");
|
||||||
|
@ -1,7 +1,13 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
package me.totalfreedom.totalfreedommod.command;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Timer;
|
||||||
|
import java.util.TimerTask;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
@ -9,90 +15,225 @@ import me.totalfreedom.totalfreedommod.player.PlayerData;
|
|||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
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.pravian.aero.command.AbstractCommandBase;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import net.pravian.aero.util.Players;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Server;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
|
import org.bukkit.command.CommandExecutor;
|
||||||
|
import org.bukkit.command.CommandMap;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
import org.bukkit.command.ConsoleCommandSender;
|
||||||
import org.bukkit.command.PluginCommand;
|
import org.bukkit.command.PluginCommand;
|
||||||
|
import org.bukkit.command.TabCompleter;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.util.StringUtil;
|
import org.bukkit.util.StringUtil;
|
||||||
import org.spigotmc.SpigotConfig;
|
import org.spigotmc.SpigotConfig;
|
||||||
|
|
||||||
public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod>
|
public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
||||||
{
|
{
|
||||||
|
public static final String COMMAND_PREFIX = "Command_";
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private static CommandMap commandMap;
|
||||||
|
@Getter
|
||||||
|
private final String name;
|
||||||
|
private final String description;
|
||||||
|
private final String usage;
|
||||||
|
@Getter
|
||||||
|
private final String aliases;
|
||||||
|
private final Rank level;
|
||||||
|
private final SourceType source;
|
||||||
|
private final boolean blockHostConsole;
|
||||||
|
private final int cooldown;
|
||||||
|
private final CommandParameters params;
|
||||||
|
@Getter
|
||||||
|
private final CommandPermissions perms;
|
||||||
|
|
||||||
|
protected CommandSender sender;
|
||||||
|
|
||||||
|
protected final TotalFreedomMod plugin = TotalFreedomMod.getPlugin();
|
||||||
|
protected final Server server = plugin.getServer();
|
||||||
|
|
||||||
public static final String UNKNOWN_COMMAND = ChatColor.WHITE + SpigotConfig.unknownCommandMessage;
|
public static final String UNKNOWN_COMMAND = ChatColor.WHITE + SpigotConfig.unknownCommandMessage;
|
||||||
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
public static final String YOU_ARE_OP = ChatColor.YELLOW + "You are now op!";
|
||||||
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
public static final String YOU_ARE_NOT_OP = ChatColor.YELLOW + "You are no longer op!";
|
||||||
public static final String PLAYER_NOT_FOUND = ChatColor.GRAY + "Player not found!";
|
public static final String PLAYER_NOT_FOUND = ChatColor.GRAY + "Player not found!";
|
||||||
//
|
public static final String ONLY_CONSOLE = ChatColor.RED + "Only console senders may execute this command!";
|
||||||
@Getter
|
public static final String ONLY_IN_GAME = ChatColor.RED + "Only in-game players may execute this command!";
|
||||||
private final CommandParameters params;
|
public static final String NO_PERMISSION = ChatColor.RED + "You do not have permission to execute this command.";
|
||||||
@Getter
|
|
||||||
private final CommandPermissions perms;
|
|
||||||
//
|
|
||||||
|
|
||||||
public FreedomCommand()
|
public static final Timer timer = new Timer();
|
||||||
|
public static final Map<CommandSender, FreedomCommand> COOLDOWN_TIMERS = new HashMap<>();
|
||||||
|
|
||||||
|
FreedomCommand()
|
||||||
{
|
{
|
||||||
this.params = getClass().getAnnotation(CommandParameters.class);
|
params = getClass().getAnnotation(CommandParameters.class);
|
||||||
if (params == null)
|
perms = getClass().getAnnotation(CommandPermissions.class);
|
||||||
{
|
this.name = getClass().getSimpleName().replace(COMMAND_PREFIX, "").toLowerCase();
|
||||||
FLog.warning("Ignoring command usage for command " + getClass().getSimpleName() + ". Command is not annotated!");
|
this.description = params.description();
|
||||||
}
|
this.usage = params.usage();
|
||||||
|
this.aliases = params.aliases();
|
||||||
this.perms = getClass().getAnnotation(CommandPermissions.class);
|
this.level = perms.level();
|
||||||
if (perms == null)
|
this.source = perms.source();
|
||||||
{
|
this.blockHostConsole = perms.blockHostConsole();
|
||||||
FLog.warning("Ignoring permissions for command " + getClass().getSimpleName() + ". Command is not annotated!");
|
this.cooldown = perms.cooldown();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
public void register()
|
||||||
public final boolean runCommand(final CommandSender sender, final Command command, final String label, final String[] args)
|
|
||||||
{
|
{
|
||||||
setVariables(sender, command, label, args);
|
FCommand cmd = new FCommand(this.name);
|
||||||
|
if (this.aliases != null) cmd.setAliases(Arrays.asList(StringUtils.split(this.aliases, ",")));
|
||||||
try
|
if (this.description != null) cmd.setDescription(this.description);
|
||||||
{
|
if (this.usage != null) cmd.setUsage(this.usage);
|
||||||
return run(sender, playerSender, command, label, args, isConsole());
|
getCommandMap().register("", cmd);
|
||||||
}
|
cmd.setExecutor(this);
|
||||||
catch (CommandFailException ex)
|
|
||||||
{
|
|
||||||
msg(ex.getMessage());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
FLog.severe("Uncaught exception executing command: " + command.getName());
|
|
||||||
FLog.severe(ex);
|
|
||||||
sender.sendMessage(ChatColor.RED + "Command error: " + (ex.getMessage() == null ? "Unknown cause" : ex.getMessage()));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args) {
|
public static final CommandMap getCommandMap()
|
||||||
return null;
|
{
|
||||||
|
if (commandMap == null)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
final Field f = Bukkit.getServer().getClass().getDeclaredField("commandMap");
|
||||||
|
f.setAccessible(true);
|
||||||
|
commandMap = (CommandMap) f.get(Bukkit.getServer());
|
||||||
|
return getCommandMap();
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (commandMap != null)
|
||||||
|
{
|
||||||
|
return commandMap;
|
||||||
|
}
|
||||||
|
return getCommandMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private final class FCommand extends Command
|
||||||
public List<String> tabComplete(CommandSender sender, Command command, String alias, String[] args)
|
|
||||||
{
|
{
|
||||||
List<String> options = getTabCompleteOptions(sender, command, alias, args);
|
private FreedomCommand cmd = null;
|
||||||
if (options == null)
|
private FCommand(String command)
|
||||||
{
|
{
|
||||||
|
super(command);
|
||||||
|
}
|
||||||
|
public void setExecutor(FreedomCommand cmd)
|
||||||
|
{
|
||||||
|
this.cmd = cmd;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean execute(CommandSender sender, String commandLabel, String[] args)
|
||||||
|
{
|
||||||
|
if (cmd != null)
|
||||||
|
{
|
||||||
|
cmd.sender = sender;
|
||||||
|
|
||||||
|
if (COOLDOWN_TIMERS.containsKey(sender) && COOLDOWN_TIMERS.containsValue(cmd))
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + "You are on cooldown for this command.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perms.blockHostConsole() && FUtil.isFromHostConsole(sender.getName()))
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + "Host console is not allowed to use this command!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!plugin.rm.getRank(sender).isAtLeast(perms.level()))
|
||||||
|
{
|
||||||
|
msg(NO_PERMISSION);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perms.source() == SourceType.ONLY_CONSOLE && sender instanceof Player)
|
||||||
|
{
|
||||||
|
msg(ONLY_CONSOLE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perms.source() == SourceType.ONLY_IN_GAME && sender instanceof ConsoleCommandSender)
|
||||||
|
{
|
||||||
|
msg(ONLY_IN_GAME);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perms.cooldown() != 0 && !isAdmin(sender))
|
||||||
|
{
|
||||||
|
COOLDOWN_TIMERS.put(sender, cmd);
|
||||||
|
timer.schedule(new TimerTask()
|
||||||
|
{
|
||||||
|
@Override
|
||||||
|
public void run()
|
||||||
|
{
|
||||||
|
COOLDOWN_TIMERS.remove(sender);
|
||||||
|
}
|
||||||
|
}, perms.cooldown() * 1000);
|
||||||
|
}
|
||||||
|
return cmd.onCommand(sender, this, commandLabel, args);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> tabComplete(CommandSender sender, String alias, String[] args)
|
||||||
|
{
|
||||||
|
if (cmd != null)
|
||||||
|
{
|
||||||
|
return cmd.onTabComplete(sender, this, alias, args);
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return StringUtil.copyPartialMatches(args[args.length - 1], options, Lists.<String>newArrayList());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract boolean run(final CommandSender sender, final Player playerSender, final Command cmd, final String commandLabel, final String[] args, final boolean senderIsConsole);
|
protected void msg(CommandSender sender, String message)
|
||||||
|
{
|
||||||
|
sender.sendMessage(ChatColor.GRAY + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void msg(Player player, String message)
|
||||||
|
{
|
||||||
|
player.sendMessage(ChatColor.GRAY + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void msg(Player player, String message, ChatColor color)
|
||||||
|
{
|
||||||
|
player.sendMessage(color + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void msg(String message)
|
||||||
|
{
|
||||||
|
msg(sender, message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void msg(String message, ChatColor color)
|
||||||
|
{
|
||||||
|
msg(color + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void msg(String message, net.md_5.bungee.api.ChatColor color)
|
||||||
|
{
|
||||||
|
msg(color + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isAdmin(Player player)
|
||||||
|
{
|
||||||
|
return plugin.al.isAdmin(player);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected boolean isAdmin(CommandSender sender)
|
||||||
|
{
|
||||||
|
return plugin.al.isAdmin(sender);
|
||||||
|
}
|
||||||
|
|
||||||
protected void checkConsole()
|
protected void checkConsole()
|
||||||
{
|
{
|
||||||
if (!isConsole())
|
if (!isConsole())
|
||||||
{
|
{
|
||||||
throw new CommandFailException(getHandler().getOnlyConsoleMessage());
|
throw new CommandFailException(ONLY_CONSOLE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,15 +241,7 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
|||||||
{
|
{
|
||||||
if (isConsole())
|
if (isConsole())
|
||||||
{
|
{
|
||||||
throw new CommandFailException(getHandler().getOnlyPlayerMessage());
|
throw new CommandFailException(ONLY_IN_GAME);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void checkNotHostConsole()
|
|
||||||
{
|
|
||||||
if (isConsole() && FUtil.isFromHostConsole(sender.getName()))
|
|
||||||
{
|
|
||||||
throw new CommandFailException("This command can not be used from the host console.");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,72 +253,67 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean noPerms()
|
protected void checkNotHostConsole()
|
||||||
{
|
{
|
||||||
throw new CommandFailException(getHandler().getPermissionMessage());
|
if (isConsole() && FUtil.isFromHostConsole(sender.getName()))
|
||||||
|
{
|
||||||
|
throw new CommandFailException("This command can not be used from the host console.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
boolean run = run(sender, sender instanceof ConsoleCommandSender ? null : (Player) sender, cmd, commandLabel, args, sender instanceof ConsoleCommandSender);
|
||||||
|
if (!run)
|
||||||
|
{
|
||||||
|
msg(ChatColor.WHITE + cmd.getUsage().replace("<command>", cmd.getLabel()));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (CommandFailException ex)
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + ex.getMessage());
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args)
|
||||||
|
{
|
||||||
|
List<String> options = getTabCompleteOptions(sender, command, alias, args);
|
||||||
|
if (options == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return StringUtil.copyPartialMatches(args[args.length - 1], options, Lists.newArrayList());
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole);
|
||||||
|
|
||||||
|
protected List<String> getTabCompleteOptions(CommandSender sender, Command command, String alias, String[] args)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean isConsole()
|
protected boolean isConsole()
|
||||||
{
|
{
|
||||||
return !(sender instanceof Player);
|
return sender instanceof ConsoleCommandSender;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Player getPlayer(String name)
|
protected Player getPlayer(String name)
|
||||||
{
|
{
|
||||||
return Players.getPlayer(name);
|
return Bukkit.getPlayer(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Player getPlayer(String name, Boolean nullVanished)
|
protected Player getPlayer(String name, Boolean nullVanished)
|
||||||
{
|
{
|
||||||
Player player = Players.getPlayer(name);
|
Player player = Bukkit.getPlayer(name);
|
||||||
if (nullVanished && plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
if (nullVanished && plugin.al.vanished.contains(player) && !plugin.al.isAdmin(sender))
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return Players.getPlayer(name);
|
return player;
|
||||||
}
|
|
||||||
|
|
||||||
protected void msg(final CommandSender sender, final String message, final ChatColor color)
|
|
||||||
{
|
|
||||||
if (sender == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(color + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void msg(final CommandSender sender, final String message, final net.md_5.bungee.api.ChatColor color)
|
|
||||||
{
|
|
||||||
if (sender == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
sender.sendMessage(color + message);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void msg(final String message, final net.md_5.bungee.api.ChatColor color)
|
|
||||||
{
|
|
||||||
msg(sender, message, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void msg(final String message, final ChatColor color)
|
|
||||||
{
|
|
||||||
msg(sender, message, color);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void msg(final CommandSender sender, final String message)
|
|
||||||
{
|
|
||||||
msg(sender, message, ChatColor.GRAY);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void msg(final String message)
|
|
||||||
{
|
|
||||||
msg(sender, message);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isAdmin(CommandSender sender)
|
|
||||||
{
|
|
||||||
return plugin.al.isAdmin(sender);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Admin getAdmin(CommandSender sender)
|
protected Admin getAdmin(CommandSender sender)
|
||||||
@ -203,12 +331,16 @@ public abstract class FreedomCommand extends AbstractCommandBase<TotalFreedomMod
|
|||||||
return plugin.pl.getData(player);
|
return plugin.pl.getData(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean noPerms()
|
||||||
|
{
|
||||||
|
throw new CommandFailException(NO_PERMISSION);
|
||||||
|
}
|
||||||
|
|
||||||
public static FreedomCommand getFrom(Command command)
|
public static FreedomCommand getFrom(Command command)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
return (FreedomCommand)((FreedomCommandExecutor)(((PluginCommand)command).getExecutor())).getCommandBase();
|
return (FreedomCommand) (((PluginCommand) command).getExecutor());
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -1,221 +0,0 @@
|
|||||||
package me.totalfreedom.totalfreedommod.command;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Timer;
|
|
||||||
import java.util.TimerTask;
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
|
||||||
import net.pravian.aero.command.AeroCommandBase;
|
|
||||||
import net.pravian.aero.command.executor.AbstractCommandExecutor;
|
|
||||||
import net.pravian.aero.command.executor.AeroCommandExecutor;
|
|
||||||
import net.pravian.aero.command.executor.AeroCommandExecutorFactory;
|
|
||||||
import net.pravian.aero.command.handler.AeroCommandHandler;
|
|
||||||
import org.bukkit.ChatColor;
|
|
||||||
import org.bukkit.command.Command;
|
|
||||||
import org.bukkit.command.CommandSender;
|
|
||||||
import org.bukkit.command.PluginCommand;
|
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
|
|
||||||
public class FreedomCommandExecutor<C extends AeroCommandBase<?>> extends AbstractCommandExecutor<C>
|
|
||||||
{
|
|
||||||
|
|
||||||
private final TotalFreedomMod plugin;
|
|
||||||
//
|
|
||||||
public static Map<CommandSender, FreedomCommand> commandCooldown = new HashMap<>();
|
|
||||||
public static final Timer timer = new Timer();
|
|
||||||
|
|
||||||
public FreedomCommandExecutor(TotalFreedomMod plugin, AeroCommandHandler<?> handler, String name, C command)
|
|
||||||
{
|
|
||||||
super(handler, name, command);
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected FreedomCommand getCommand()
|
|
||||||
{
|
|
||||||
return commandBase instanceof FreedomCommand ? (FreedomCommand)commandBase : null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setupCommand(PluginCommand pluginCommand)
|
|
||||||
{
|
|
||||||
final FreedomCommand command = getCommand();
|
|
||||||
if (command == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final CommandParameters params = command.getParams();
|
|
||||||
if (params == null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
String aliasString = params.aliases();
|
|
||||||
|
|
||||||
if (aliasString.length() > 0)
|
|
||||||
{
|
|
||||||
pluginCommand.setAliases(Arrays.asList(params.aliases().split(",")));
|
|
||||||
}
|
|
||||||
pluginCommand.setDescription(params.description());
|
|
||||||
pluginCommand.setUsage(params.usage());
|
|
||||||
|
|
||||||
// Check if permisions are correctly set up
|
|
||||||
CommandPermissions perms = command.getPerms();
|
|
||||||
if (perms != null)
|
|
||||||
{
|
|
||||||
if (perms.level().isConsole())
|
|
||||||
{
|
|
||||||
FLog.warning("[Command] " + pluginCommand.getName() + " - permission is set to a console rank, "
|
|
||||||
+ "should be set to player variant with 'source = SourceType.ONLY_CONSOLE'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args)
|
|
||||||
{
|
|
||||||
if (!hasPermission(sender, true))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isOnCooldown(sender))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
boolean run = commandBase.runCommand(sender, command, label, args);
|
|
||||||
FreedomCommand c = getCommand();
|
|
||||||
CommandPermissions perms = c.getPerms();
|
|
||||||
if (perms.cooldown() > 0 && !plugin.al.isAdmin(sender))
|
|
||||||
{
|
|
||||||
commandCooldown.put(sender, c);
|
|
||||||
timer.schedule(new TimerTask()
|
|
||||||
{
|
|
||||||
@Override
|
|
||||||
public void run()
|
|
||||||
{
|
|
||||||
commandCooldown.remove(sender);
|
|
||||||
}
|
|
||||||
}, perms.cooldown() * 1000);
|
|
||||||
}
|
|
||||||
return run;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// If this is ever ran, TFM failed :
|
|
||||||
FLog.severe("Unhandled command exception: " + command.getName());
|
|
||||||
FLog.severe(ex);
|
|
||||||
sender.sendMessage(ChatColor.RED + "Unhandled Command Error: " + command.getName());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean hasPermission(CommandSender sender, boolean sendMsg)
|
|
||||||
{
|
|
||||||
final FreedomCommand command = getCommand();
|
|
||||||
if (command == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
final CommandPermissions perms = command.getPerms();
|
|
||||||
if (perms == null)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Block host console
|
|
||||||
if (FUtil.isFromHostConsole(sender.getName())
|
|
||||||
&& perms.blockHostConsole())
|
|
||||||
{
|
|
||||||
if (sendMsg)
|
|
||||||
{
|
|
||||||
sender.sendMessage(handler.getPermissionMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
final Player player = sender instanceof Player ? (Player)sender : null;
|
|
||||||
|
|
||||||
// Only console
|
|
||||||
if (perms.source() == SourceType.ONLY_CONSOLE
|
|
||||||
&& player != null)
|
|
||||||
{
|
|
||||||
if (sendMsg)
|
|
||||||
{
|
|
||||||
sender.sendMessage(handler.getOnlyConsoleMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Only in game
|
|
||||||
if (perms.source() == SourceType.ONLY_IN_GAME
|
|
||||||
&& player == null)
|
|
||||||
{
|
|
||||||
if (sendMsg)
|
|
||||||
{
|
|
||||||
sender.sendMessage(handler.getOnlyPlayerMessage());
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Player permissions
|
|
||||||
if (player != null)
|
|
||||||
{
|
|
||||||
Rank rank = plugin.rm.getRank(player);
|
|
||||||
boolean result = rank.isAtLeast(perms.level());
|
|
||||||
if (!result && sendMsg)
|
|
||||||
{
|
|
||||||
sender.sendMessage(handler.getPermissionMessage());
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Console permissions
|
|
||||||
Rank rank = plugin.rm.getRank(sender);
|
|
||||||
boolean result = rank.isAtLeast(perms.level());
|
|
||||||
if (!result && sendMsg)
|
|
||||||
{
|
|
||||||
sender.sendMessage(handler.getPermissionMessage());
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isOnCooldown(CommandSender sender)
|
|
||||||
{
|
|
||||||
final FreedomCommand command = getCommand();
|
|
||||||
if (commandCooldown.containsKey(sender) && commandCooldown.containsValue(command))
|
|
||||||
{
|
|
||||||
sender.sendMessage(ChatColor.RED + "You're on cooldown for this command.");
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class FreedomExecutorFactory implements AeroCommandExecutorFactory
|
|
||||||
{
|
|
||||||
|
|
||||||
private final TotalFreedomMod plugin;
|
|
||||||
|
|
||||||
public FreedomExecutorFactory(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
this.plugin = plugin;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public AeroCommandExecutor<? extends AeroCommandBase<?>> newExecutor(AeroCommandHandler<?> handler, String name, AeroCommandBase<?> command)
|
|
||||||
{
|
|
||||||
return new FreedomCommandExecutor<>(plugin, handler, name, command);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -0,0 +1,10 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.config;
|
||||||
|
|
||||||
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
|
public interface IConfig
|
||||||
|
{
|
||||||
|
void loadFrom(ConfigurationSection cs);
|
||||||
|
void saveTo(ConfigurationSection cs);
|
||||||
|
boolean isValid();
|
||||||
|
}
|
@ -6,14 +6,14 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import net.pravian.aero.component.PluginComponent;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
public class MainConfig extends PluginComponent<TotalFreedomMod>
|
public class MainConfig extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final String CONFIG_FILENAME = "config.yml";
|
public static final String CONFIG_FILENAME = "config.yml";
|
||||||
@ -22,10 +22,20 @@ public class MainConfig extends PluginComponent<TotalFreedomMod>
|
|||||||
private final ConfigDefaults defaults;
|
private final ConfigDefaults defaults;
|
||||||
public YamlConfiguration configuration;
|
public YamlConfiguration configuration;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public MainConfig(TotalFreedomMod plugin)
|
public MainConfig(TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
|
|
||||||
entries = new EnumMap<>(ConfigEntry.class);
|
entries = new EnumMap<>(ConfigEntry.class);
|
||||||
|
|
||||||
ConfigDefaults tempDefaults = null;
|
ConfigDefaults tempDefaults = null;
|
||||||
|
@ -0,0 +1,67 @@
|
|||||||
|
package me.totalfreedom.totalfreedommod.config;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
|
public class YamlConfig extends YamlConfiguration
|
||||||
|
{
|
||||||
|
private final TotalFreedomMod plugin;
|
||||||
|
private final File file;
|
||||||
|
private final boolean copyDefaults;
|
||||||
|
|
||||||
|
public YamlConfig(TotalFreedomMod plugin, String name, boolean copyDefaults)
|
||||||
|
{
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.file = new File(plugin.getDataFolder(), name);
|
||||||
|
this.copyDefaults = copyDefaults;
|
||||||
|
|
||||||
|
if (copyDefaults)
|
||||||
|
{
|
||||||
|
options().copyDefaults(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!file.exists())
|
||||||
|
{
|
||||||
|
plugin.saveResource(name, false);
|
||||||
|
}
|
||||||
|
load();
|
||||||
|
}
|
||||||
|
|
||||||
|
public YamlConfig(TotalFreedomMod plugin, String name)
|
||||||
|
{
|
||||||
|
this(plugin, name, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void load()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
super.load(file);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void save()
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
super.save(file);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void clear()
|
||||||
|
{
|
||||||
|
for (String key : super.getKeys(false))
|
||||||
|
{
|
||||||
|
super.set(key, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -16,7 +16,6 @@ import java.util.concurrent.CompletableFuture;
|
|||||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||||
import javax.security.auth.login.LoginException;
|
import javax.security.auth.login.LoginException;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
import me.totalfreedom.totalfreedommod.player.PlayerData;
|
||||||
@ -37,8 +36,8 @@ import net.dv8tion.jda.api.entities.SelfUser;
|
|||||||
import net.dv8tion.jda.api.events.ReadyEvent;
|
import net.dv8tion.jda.api.events.ReadyEvent;
|
||||||
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
import net.dv8tion.jda.api.hooks.ListenerAdapter;
|
||||||
import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory;
|
import net.dv8tion.jda.internal.utils.concurrent.CountingThreadFactory;
|
||||||
import net.pravian.aero.util.StringUtils;
|
|
||||||
import org.apache.commons.codec.digest.DigestUtils;
|
import org.apache.commons.codec.digest.DigestUtils;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.apache.commons.lang.WordUtils;
|
import org.apache.commons.lang.WordUtils;
|
||||||
import org.bukkit.GameRule;
|
import org.bukkit.GameRule;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -60,11 +59,6 @@ public class Discord extends FreedomService
|
|||||||
|
|
||||||
Random random = new Random();
|
Random random = new Random();
|
||||||
|
|
||||||
public Discord(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void startBot()
|
public void startBot()
|
||||||
{
|
{
|
||||||
enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString());
|
enabled = !Strings.isNullOrEmpty(ConfigEntry.DISCORD_TOKEN.getString());
|
||||||
@ -285,7 +279,7 @@ public class Discord extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
startBot();
|
startBot();
|
||||||
}
|
}
|
||||||
@ -323,7 +317,7 @@ public class Discord extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
if (bot != null)
|
if (bot != null)
|
||||||
{
|
{
|
||||||
|
@ -16,19 +16,14 @@ public class Freezer extends FreedomService
|
|||||||
@Getter
|
@Getter
|
||||||
private boolean globalFreeze = false;
|
private boolean globalFreeze = false;
|
||||||
|
|
||||||
public Freezer(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
globalFreeze = false;
|
globalFreeze = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,18 +16,13 @@ public class CurseListener extends FreedomService
|
|||||||
|
|
||||||
public HashMap<Player, Player> cursedPlayers = new HashMap<Player, Player>();
|
public HashMap<Player, Player> cursedPlayers = new HashMap<Player, Player>();
|
||||||
|
|
||||||
public CurseListener(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,18 +89,13 @@ public class ItemFun extends FreedomService
|
|||||||
return cooldownTracker.get(player.getName()).contains(item.getDataName());
|
return cooldownTracker.get(player.getName()).contains(item.getDataName());
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemFun(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -27,11 +27,6 @@ public class Jumppads extends FreedomService
|
|||||||
private double strength = 1 + 0.1F;
|
private double strength = 1 + 0.1F;
|
||||||
public HashMap<Player, JumpPadMode> players = new HashMap<>();
|
public HashMap<Player, JumpPadMode> players = new HashMap<>();
|
||||||
|
|
||||||
public Jumppads(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
|
@ -23,19 +23,14 @@ public class Landminer extends FreedomService
|
|||||||
@Getter
|
@Getter
|
||||||
private final List<Landmine> landmines = new ArrayList<>();
|
private final List<Landmine> landmines = new ArrayList<>();
|
||||||
|
|
||||||
public Landminer(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
landmines.clear();
|
landmines.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,19 +8,13 @@ import org.bukkit.event.player.PlayerQuitEvent;
|
|||||||
|
|
||||||
public class MP44 extends FreedomService
|
public class MP44 extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public MP44(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11,19 +11,13 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
|
|
||||||
public class MobStacker extends FreedomService
|
public class MobStacker extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public MobStacker(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,18 +20,13 @@ public class Trailer extends FreedomService
|
|||||||
private final Random random = new Random();
|
private final Random random = new Random();
|
||||||
private final Set<String> trailPlayers = new HashSet<>(); // player name
|
private final Set<String> trailPlayers = new HashSet<>(); // player name
|
||||||
|
|
||||||
public Trailer(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,11 +39,6 @@ public class HTTPDaemon extends FreedomService
|
|||||||
private HTTPD httpd;
|
private HTTPD httpd;
|
||||||
public Map<String, ModuleExecutable> modules = new HashMap<>();
|
public Map<String, ModuleExecutable> modules = new HashMap<>();
|
||||||
|
|
||||||
public HTTPDaemon(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
|
@ -3,15 +3,15 @@ package me.totalfreedom.totalfreedommod.httpd.module;
|
|||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.HTTPDPageBuilder;
|
import me.totalfreedom.totalfreedommod.httpd.HTTPDPageBuilder;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.HTTPSession;
|
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.HTTPSession;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Method;
|
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Method;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response;
|
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import net.pravian.aero.component.PluginComponent;
|
|
||||||
|
|
||||||
public abstract class HTTPDModule extends PluginComponent<TotalFreedomMod>
|
public abstract class HTTPDModule extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
protected final String uri;
|
protected final String uri;
|
||||||
@ -23,7 +23,6 @@ public abstract class HTTPDModule extends PluginComponent<TotalFreedomMod>
|
|||||||
|
|
||||||
public HTTPDModule(TotalFreedomMod plugin, HTTPSession session)
|
public HTTPDModule(TotalFreedomMod plugin, HTTPSession session)
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
this.uri = session.getUri();
|
this.uri = session.getUri();
|
||||||
this.method = session.getMethod();
|
this.method = session.getMethod();
|
||||||
this.headers = session.getHeaders();
|
this.headers = session.getHeaders();
|
||||||
@ -32,6 +31,16 @@ public abstract class HTTPDModule extends PluginComponent<TotalFreedomMod>
|
|||||||
this.session = session;
|
this.session = session;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
public String getBody()
|
public String getBody()
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
package me.totalfreedom.totalfreedommod.httpd.module;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
|
||||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
||||||
|
|
||||||
public class Module_admins extends HTTPDModule
|
public class Module_admins extends HTTPDModule
|
||||||
|
@ -12,7 +12,6 @@ import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
|||||||
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
import me.totalfreedom.totalfreedommod.command.FreedomCommand;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
import me.totalfreedom.totalfreedommod.rank.Displayable;
|
||||||
import net.pravian.aero.command.CommandReflection;
|
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
import org.bukkit.command.CommandMap;
|
import org.bukkit.command.CommandMap;
|
||||||
@ -33,7 +32,7 @@ public class Module_help extends HTTPDModule
|
|||||||
@Override
|
@Override
|
||||||
public String getBody()
|
public String getBody()
|
||||||
{
|
{
|
||||||
final CommandMap map = CommandReflection.getCommandMap();
|
final CommandMap map = FreedomCommand.getCommandMap();
|
||||||
if (map == null || !(map instanceof SimpleCommandMap))
|
if (map == null || !(map instanceof SimpleCommandMap))
|
||||||
{
|
{
|
||||||
return paragraph("Error loading commands.");
|
return paragraph("Error loading commands.");
|
||||||
|
@ -6,14 +6,14 @@ import java.io.InputStream;
|
|||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import net.pravian.aero.component.PluginComponent;
|
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
|
|
||||||
public class PermissionConfig extends PluginComponent<TotalFreedomMod>
|
public class PermissionConfig extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final String PERMISSIONS_FILENAME = "permissions.yml";
|
public static final String PERMISSIONS_FILENAME = "permissions.yml";
|
||||||
@ -24,8 +24,6 @@ public class PermissionConfig extends PluginComponent<TotalFreedomMod>
|
|||||||
|
|
||||||
public PermissionConfig(TotalFreedomMod plugin)
|
public PermissionConfig(TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
|
|
||||||
entries = new EnumMap<>(PermissionEntry.class);
|
entries = new EnumMap<>(PermissionEntry.class);
|
||||||
|
|
||||||
PermissionDefaults tempDefaults = null;
|
PermissionDefaults tempDefaults = null;
|
||||||
@ -59,6 +57,18 @@ public class PermissionConfig extends PluginComponent<TotalFreedomMod>
|
|||||||
defaults = tempDefaults;
|
defaults = tempDefaults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStart()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onStop()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public void load()
|
public void load()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -23,19 +23,14 @@ public class PermissionManager extends FreedomService
|
|||||||
|
|
||||||
public Map<Player, PermissionAttachment> attachments = Maps.newHashMap();
|
public Map<Player, PermissionAttachment> attachments = Maps.newHashMap();
|
||||||
|
|
||||||
public PermissionManager(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
loadPermissionNodes();
|
loadPermissionNodes();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,6 @@ import me.totalfreedom.totalfreedommod.caging.CageData;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
|
import me.totalfreedom.totalfreedommod.freeze.FreezeData;
|
||||||
import me.totalfreedom.totalfreedommod.util.FUtil;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import net.pravian.aero.util.Ips;
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.entity.Arrow;
|
import org.bukkit.entity.Arrow;
|
||||||
@ -79,7 +78,7 @@ public class FPlayer
|
|||||||
|
|
||||||
public FPlayer(TotalFreedomMod plugin, Player player)
|
public FPlayer(TotalFreedomMod plugin, Player player)
|
||||||
{
|
{
|
||||||
this(plugin, player.getName(), Ips.getIp(player));
|
this(plugin, player.getName(), FUtil.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
private FPlayer(TotalFreedomMod plugin, String name, String ip)
|
private FPlayer(TotalFreedomMod plugin, String name, String ip)
|
||||||
@ -100,7 +99,7 @@ public class FPlayer
|
|||||||
{
|
{
|
||||||
for (Player onlinePlayer : Bukkit.getOnlinePlayers())
|
for (Player onlinePlayer : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
if (Ips.getIp(onlinePlayer).equals(ip))
|
if (FUtil.getIp(onlinePlayer).equals(ip))
|
||||||
{
|
{
|
||||||
player = onlinePlayer;
|
player = onlinePlayer;
|
||||||
break;
|
break;
|
||||||
|
@ -14,7 +14,7 @@ import me.totalfreedom.totalfreedommod.admin.Admin;
|
|||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import me.totalfreedom.totalfreedommod.rank.Rank;
|
import me.totalfreedom.totalfreedommod.rank.Rank;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import net.pravian.aero.util.Ips;
|
import me.totalfreedom.totalfreedommod.util.FUtil;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
@ -27,20 +27,15 @@ public class PlayerList extends FreedomService
|
|||||||
@Getter
|
@Getter
|
||||||
public final Map<String, PlayerData> dataMap = Maps.newHashMap(); // username, data
|
public final Map<String, PlayerData> dataMap = Maps.newHashMap(); // username, data
|
||||||
|
|
||||||
public PlayerList(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
dataMap.clear();
|
dataMap.clear();
|
||||||
loadMasterBuilders();
|
loadMasterBuilders();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -79,7 +74,7 @@ public class PlayerList extends FreedomService
|
|||||||
{
|
{
|
||||||
if (player.isOnline())
|
if (player.isOnline())
|
||||||
{
|
{
|
||||||
return Ips.getIp(player.getPlayer());
|
return FUtil.getIp(player.getPlayer());
|
||||||
}
|
}
|
||||||
|
|
||||||
final PlayerData entry = getData(player.getName());
|
final PlayerData entry = getData(player.getName());
|
||||||
@ -128,14 +123,14 @@ public class PlayerList extends FreedomService
|
|||||||
// May not return null
|
// May not return null
|
||||||
public FPlayer getPlayer(Player player)
|
public FPlayer getPlayer(Player player)
|
||||||
{
|
{
|
||||||
FPlayer tPlayer = playerMap.get(Ips.getIp(player));
|
FPlayer tPlayer = playerMap.get(FUtil.getIp(player));
|
||||||
if (tPlayer != null)
|
if (tPlayer != null)
|
||||||
{
|
{
|
||||||
return tPlayer;
|
return tPlayer;
|
||||||
}
|
}
|
||||||
|
|
||||||
tPlayer = new FPlayer(plugin, player);
|
tPlayer = new FPlayer(plugin, player);
|
||||||
playerMap.put(Ips.getIp(player), tPlayer);
|
playerMap.put(FUtil.getIp(player), tPlayer);
|
||||||
|
|
||||||
return tPlayer;
|
return tPlayer;
|
||||||
}
|
}
|
||||||
@ -164,7 +159,7 @@ public class PlayerList extends FreedomService
|
|||||||
PlayerData playerData = getData(player);
|
PlayerData playerData = getData(player);
|
||||||
return !plugin.al.isAdmin(player)
|
return !plugin.al.isAdmin(player)
|
||||||
&& (playerData.hasVerification())
|
&& (playerData.hasVerification())
|
||||||
&& !playerData.getIps().contains(Ips.getIp(player));
|
&& !playerData.getIps().contains(FUtil.getIp(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isImposter(Player player)
|
public boolean isImposter(Player player)
|
||||||
@ -179,7 +174,7 @@ public class PlayerList extends FreedomService
|
|||||||
{
|
{
|
||||||
playerData.removeBackupCode(backupCode);
|
playerData.removeBackupCode(backupCode);
|
||||||
}
|
}
|
||||||
playerData.addIp(Ips.getIp(player));
|
playerData.addIp(FUtil.getIp(player));
|
||||||
save(playerData);
|
save(playerData);
|
||||||
|
|
||||||
if (plugin.al.isAdminImpostor(player))
|
if (plugin.al.isAdminImpostor(player))
|
||||||
@ -194,7 +189,7 @@ public class PlayerList extends FreedomService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
admin.setLastLogin(new Date());
|
admin.setLastLogin(new Date());
|
||||||
admin.addIp(Ips.getIp(player));
|
admin.addIp(FUtil.getIp(player));
|
||||||
plugin.al.updateTables();
|
plugin.al.updateTables();
|
||||||
plugin.al.save(admin);
|
plugin.al.save(admin);
|
||||||
}
|
}
|
||||||
@ -257,7 +252,7 @@ public class PlayerList extends FreedomService
|
|||||||
|
|
||||||
if (playerData == null)
|
if (playerData == null)
|
||||||
{
|
{
|
||||||
playerData = loadByIp(Ips.getIp(player));
|
playerData = loadByIp(FUtil.getIp(player));
|
||||||
if (playerData != null)
|
if (playerData != null)
|
||||||
{
|
{
|
||||||
plugin.sql.updatePlayerName(playerData.getName(),player.getName());
|
plugin.sql.updatePlayerName(playerData.getName(),player.getName());
|
||||||
@ -279,7 +274,7 @@ public class PlayerList extends FreedomService
|
|||||||
|
|
||||||
// Create new player
|
// Create new player
|
||||||
playerData = new PlayerData(player);
|
playerData = new PlayerData(player);
|
||||||
playerData.addIp(Ips.getIp(player));
|
playerData.addIp(FUtil.getIp(player));
|
||||||
|
|
||||||
// Store player
|
// Store player
|
||||||
dataMap.put(player.getName(), playerData);
|
dataMap.put(player.getName(), playerData);
|
||||||
|
@ -5,12 +5,10 @@ import java.text.SimpleDateFormat;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import net.pravian.aero.base.ConfigLoadable;
|
import me.totalfreedom.totalfreedommod.config.IConfig;
|
||||||
import net.pravian.aero.base.ConfigSavable;
|
|
||||||
import net.pravian.aero.base.Validatable;
|
|
||||||
import org.bukkit.configuration.ConfigurationSection;
|
import org.bukkit.configuration.ConfigurationSection;
|
||||||
|
|
||||||
public class Punishment implements ConfigLoadable, ConfigSavable, Validatable
|
public class Punishment implements IConfig
|
||||||
{
|
{
|
||||||
|
|
||||||
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||||
|
@ -5,9 +5,8 @@ import java.util.ArrayList;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.config.YamlConfig;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import net.pravian.aero.config.YamlConfig;
|
|
||||||
|
|
||||||
public class PunishmentList extends FreedomService
|
public class PunishmentList extends FreedomService
|
||||||
{
|
{
|
||||||
@ -18,14 +17,13 @@ public class PunishmentList extends FreedomService
|
|||||||
//
|
//
|
||||||
private final YamlConfig config;
|
private final YamlConfig config;
|
||||||
|
|
||||||
public PunishmentList(TotalFreedomMod plugin)
|
public PunishmentList()
|
||||||
{
|
{
|
||||||
super(plugin);
|
|
||||||
this.config = new YamlConfig(plugin, CONFIG_FILENAME);
|
this.config = new YamlConfig(plugin, CONFIG_FILENAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
config.load();
|
config.load();
|
||||||
|
|
||||||
@ -54,7 +52,7 @@ public class PunishmentList extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
saveAll();
|
saveAll();
|
||||||
logger.info("Saved " + punishments.size() + " player bans");
|
logger.info("Saved " + punishments.size() + " player bans");
|
||||||
|
@ -20,19 +20,13 @@ import org.bukkit.scoreboard.Team;
|
|||||||
|
|
||||||
public class RankManager extends FreedomService
|
public class RankManager extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
public RankManager(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -32,13 +32,8 @@ public class Shop extends FreedomService
|
|||||||
public Date reactionStartTime;
|
public Date reactionStartTime;
|
||||||
public final int coinsPerReactionWin = ConfigEntry.SHOP_REACTIONS_COINS_PER_WIN.getInteger();
|
public final int coinsPerReactionWin = ConfigEntry.SHOP_REACTIONS_COINS_PER_WIN.getInteger();
|
||||||
|
|
||||||
public Shop(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean())
|
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
@ -68,7 +63,7 @@ public class Shop extends FreedomService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean())
|
if (ConfigEntry.SHOP_REACTIONS_ENABLED.getBoolean())
|
||||||
{
|
{
|
||||||
|
@ -21,20 +21,15 @@ public class SQLite extends FreedomService
|
|||||||
|
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
|
||||||
public SQLite(TotalFreedomMod plugin)
|
|
||||||
{
|
|
||||||
super(plugin);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStart()
|
public void onStart()
|
||||||
{
|
{
|
||||||
connect();
|
connect();
|
||||||
checkTables();
|
checkTables();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onStop()
|
public void onStop()
|
||||||
{
|
{
|
||||||
disconnect();
|
disconnect();
|
||||||
}
|
}
|
||||||
|
@ -10,10 +10,6 @@ public class FLog
|
|||||||
private static Logger serverLogger = null;
|
private static Logger serverLogger = null;
|
||||||
private static Logger pluginLogger = null;
|
private static Logger pluginLogger = null;
|
||||||
|
|
||||||
private FLog()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
// Level.INFO:
|
// Level.INFO:
|
||||||
public static void info(String message)
|
public static void info(String message)
|
||||||
{
|
{
|
||||||
|
@ -40,6 +40,7 @@ import org.bukkit.OfflinePlayer;
|
|||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.event.player.PlayerLoginEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.inventory.meta.ItemMeta;
|
import org.bukkit.inventory.meta.ItemMeta;
|
||||||
import org.bukkit.scheduler.BukkitTask;
|
import org.bukkit.scheduler.BukkitTask;
|
||||||
@ -704,6 +705,16 @@ public class FUtil
|
|||||||
return tz < -12 || tz > 12;
|
return tz < -12 || tz > 12;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String getIp(Player player)
|
||||||
|
{
|
||||||
|
return player.getAddress().getAddress().getHostAddress().trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getIp(PlayerLoginEvent event)
|
||||||
|
{
|
||||||
|
return event.getAddress().getHostAddress().trim();
|
||||||
|
}
|
||||||
|
|
||||||
private static class MojangResponse
|
private static class MojangResponse
|
||||||
{
|
{
|
||||||
String id;
|
String id;
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user