mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-27 01:05:38 +00:00
Finalized lombok removal
Finally removed all lomboks, also reduced npath complexity for FreedomCommand.FCommand#execute and removed empty constructor from Discord
This commit is contained in:
parent
fd725ca6c5
commit
9352a48650
18
.idea/codeStyles/Project.xml
generated
18
.idea/codeStyles/Project.xml
generated
@ -9,24 +9,6 @@
|
|||||||
</value>
|
</value>
|
||||||
</option>
|
</option>
|
||||||
</JavaCodeStyleSettings>
|
</JavaCodeStyleSettings>
|
||||||
<JetCodeStyleSettings>
|
|
||||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
|
||||||
<value>
|
|
||||||
<package name="java.util" alias="false" withSubpackages="false" />
|
|
||||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
|
||||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
|
||||||
<value>
|
|
||||||
<package name="" alias="false" withSubpackages="true" />
|
|
||||||
<package name="java" alias="false" withSubpackages="true" />
|
|
||||||
<package name="javax" alias="false" withSubpackages="true" />
|
|
||||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
|
||||||
<package name="" alias="true" withSubpackages="true" />
|
|
||||||
</value>
|
|
||||||
</option>
|
|
||||||
</JetCodeStyleSettings>
|
|
||||||
<codeStyleSettings language="JAVA">
|
<codeStyleSettings language="JAVA">
|
||||||
<option name="BRACE_STYLE" value="2" />
|
<option name="BRACE_STYLE" value="2" />
|
||||||
<option name="CLASS_BRACE_STYLE" value="2" />
|
<option name="CLASS_BRACE_STYLE" value="2" />
|
||||||
|
@ -4,14 +4,12 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import lombok.Getter;
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
import org.reflections.Reflections;
|
import org.reflections.Reflections;
|
||||||
|
|
||||||
public class CommandLoader extends FreedomService
|
public class CommandLoader extends FreedomService
|
||||||
{
|
{
|
||||||
@Getter
|
|
||||||
private final List<FreedomCommand> commands;
|
private final List<FreedomCommand> commands;
|
||||||
|
|
||||||
public CommandLoader()
|
public CommandLoader()
|
||||||
@ -79,4 +77,9 @@ public class CommandLoader extends FreedomService
|
|||||||
|
|
||||||
FLog.info("Loaded " + commands.size() + " commands");
|
FLog.info("Loaded " + commands.size() + " commands");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<FreedomCommand> getCommands()
|
||||||
|
{
|
||||||
|
return commands;
|
||||||
|
}
|
||||||
}
|
}
|
@ -27,6 +27,7 @@ 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.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
||||||
{
|
{
|
||||||
@ -334,24 +335,20 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
{
|
{
|
||||||
cmd.sender = sender;
|
cmd.sender = sender;
|
||||||
|
|
||||||
if (COOLDOWN_TIMERS.containsKey(sender) && COOLDOWN_TIMERS.containsValue(cmd))
|
if (func4()) return true;
|
||||||
{
|
|
||||||
msg(ChatColor.RED + "You are on cooldown for this command.");
|
if (func1()) return true;
|
||||||
return true;
|
|
||||||
}
|
if (func2()) return true;
|
||||||
|
|
||||||
if (perms.blockHostConsole() && FUtil.isFromHostConsole(sender.getName()) && !FUtil.inDeveloperMode())
|
func3();
|
||||||
{
|
|
||||||
msg(ChatColor.RED + "Host console is not allowed to use this command!");
|
return cmd.onCommand(sender, this, commandLabel, args);
|
||||||
return true;
|
}
|
||||||
}
|
return false;
|
||||||
|
|
||||||
if (!plugin.rm.getRank(sender).isAtLeast(perms.level()))
|
|
||||||
{
|
|
||||||
msg(NO_PERMISSION);
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean func1() {
|
||||||
if (perms.source() == SourceType.ONLY_CONSOLE && sender instanceof Player)
|
if (perms.source() == SourceType.ONLY_CONSOLE && sender instanceof Player)
|
||||||
{
|
{
|
||||||
msg(ONLY_CONSOLE);
|
msg(ONLY_CONSOLE);
|
||||||
@ -364,6 +361,25 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean func2() {
|
||||||
|
if (!plugin.rm.getRank(sender).isAtLeast(perms.level()))
|
||||||
|
{
|
||||||
|
msg(NO_PERMISSION);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (perms.blockHostConsole() && FUtil.isFromHostConsole(sender.getName()) && !FUtil.inDeveloperMode())
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + "Host console is not allowed to use this command!");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void func3() {
|
||||||
if (perms.cooldown() != 0 && !isAdmin(sender))
|
if (perms.cooldown() != 0 && !isAdmin(sender))
|
||||||
{
|
{
|
||||||
COOLDOWN_TIMERS.put(sender, cmd);
|
COOLDOWN_TIMERS.put(sender, cmd);
|
||||||
@ -376,11 +392,18 @@ public abstract class FreedomCommand implements CommandExecutor, TabCompleter
|
|||||||
}
|
}
|
||||||
}, perms.cooldown() * 1000L);
|
}, perms.cooldown() * 1000L);
|
||||||
}
|
}
|
||||||
return cmd.onCommand(sender, this, commandLabel, args);
|
}
|
||||||
|
|
||||||
|
public boolean func4() {
|
||||||
|
if (COOLDOWN_TIMERS.containsKey(sender) && COOLDOWN_TIMERS.containsValue(cmd))
|
||||||
|
{
|
||||||
|
msg(ChatColor.RED + "You are on cooldown for this command.");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args)
|
public List<String> tabComplete(@NotNull CommandSender sender, @NotNull String alias, String[] args)
|
||||||
{
|
{
|
||||||
|
@ -503,10 +503,6 @@ public class Discord extends FreedomService
|
|||||||
// Do no ask why this is here. I spent two hours trying to make a simple thing work
|
// Do no ask why this is here. I spent two hours trying to make a simple thing work
|
||||||
public class StartEvent
|
public class StartEvent
|
||||||
{
|
{
|
||||||
public StartEvent()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start()
|
public void start()
|
||||||
{
|
{
|
||||||
messageChatChannel("**Server has started**");
|
messageChatChannel("**Server has started**");
|
||||||
|
@ -3,7 +3,6 @@ package me.totalfreedom.totalfreedommod.fun;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.Getter;
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
@ -101,12 +100,8 @@ public class Landminer extends FreedomService
|
|||||||
|
|
||||||
public static class Landmine
|
public static class Landmine
|
||||||
{
|
{
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final Location location;
|
private final Location location;
|
||||||
@Getter
|
|
||||||
private final Player planter;
|
private final Player planter;
|
||||||
@Getter
|
|
||||||
private final double radius;
|
private final double radius;
|
||||||
|
|
||||||
public Landmine(Location location, Player player, double radius)
|
public Landmine(Location location, Player player, double radius)
|
||||||
@ -121,5 +116,20 @@ public class Landminer extends FreedomService
|
|||||||
{
|
{
|
||||||
return this.location.toString() + ", " + this.radius + ", " + this.planter.getName();
|
return this.location.toString() + ", " + this.radius + ", " + this.planter.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Location getLocation()
|
||||||
|
{
|
||||||
|
return location;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Player getPlanter()
|
||||||
|
{
|
||||||
|
return planter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getRadius()
|
||||||
|
{
|
||||||
|
return radius;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -2,7 +2,6 @@ package me.totalfreedom.totalfreedommod.httpd;
|
|||||||
|
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.Getter;
|
|
||||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||||
import me.totalfreedom.totalfreedommod.httpd.module.HTTPDModule;
|
import me.totalfreedom.totalfreedommod.httpd.module.HTTPDModule;
|
||||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||||
@ -10,8 +9,6 @@ import org.bukkit.Bukkit;
|
|||||||
|
|
||||||
public abstract class ModuleExecutable
|
public abstract class ModuleExecutable
|
||||||
{
|
{
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final boolean async;
|
private final boolean async;
|
||||||
|
|
||||||
public ModuleExecutable(boolean async)
|
public ModuleExecutable(boolean async)
|
||||||
@ -71,4 +68,8 @@ public abstract class ModuleExecutable
|
|||||||
|
|
||||||
public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session);
|
public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session);
|
||||||
|
|
||||||
|
public boolean isAsync()
|
||||||
|
{
|
||||||
|
return async;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ import java.util.Date;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import lombok.Getter;
|
|
||||||
import me.totalfreedom.totalfreedommod.FreedomService;
|
import me.totalfreedom.totalfreedommod.FreedomService;
|
||||||
import me.totalfreedom.totalfreedommod.admin.Admin;
|
import me.totalfreedom.totalfreedommod.admin.Admin;
|
||||||
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
import me.totalfreedom.totalfreedommod.config.ConfigEntry;
|
||||||
@ -21,10 +20,7 @@ import org.bukkit.entity.Player;
|
|||||||
public class PlayerList extends FreedomService
|
public class PlayerList extends FreedomService
|
||||||
{
|
{
|
||||||
|
|
||||||
@Getter
|
|
||||||
public final Map<String, FPlayer> playerMap = Maps.newHashMap(); // ip,dataMap
|
public final Map<String, FPlayer> playerMap = Maps.newHashMap(); // ip,dataMap
|
||||||
|
|
||||||
@Getter
|
|
||||||
public final Map<String, PlayerData> dataMap = Maps.newHashMap(); // username, data
|
public final Map<String, PlayerData> dataMap = Maps.newHashMap(); // username, data
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -303,4 +299,14 @@ public class PlayerList extends FreedomService
|
|||||||
|
|
||||||
return player;
|
return player;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<String, FPlayer> getPlayerMap()
|
||||||
|
{
|
||||||
|
return playerMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, PlayerData> getDataMap()
|
||||||
|
{
|
||||||
|
return dataMap;
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user