This commit is contained in:
Paldiu 2021-01-07 13:29:47 -06:00
parent 323fd1a031
commit 260368585e
14 changed files with 35 additions and 42 deletions

View File

@ -7,7 +7,6 @@ import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;
import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME; import static me.totalfreedom.totalfreedommod.util.FUtil.SAVED_FLAGS_FILENAME;

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.blocking.command; package me.totalfreedom.totalfreedommod.blocking.command;
import java.util.Objects;
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.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;

View File

@ -2,8 +2,8 @@ package me.totalfreedom.totalfreedommod.command;
import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.rank.Rank;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.bukkit.command.Command;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -33,8 +33,8 @@ public class Command_gcmd extends FreedomCommand
{ {
return true; return true;
} }
if (plugin.al.isAdmin(player)) if (plugin.al.isAdmin(player))
{ {
msg(ChatColor.RED + "You can not use gcmd on admins"); msg(ChatColor.RED + "You can not use gcmd on admins");
return true; return true;

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.config; package me.totalfreedom.totalfreedommod.config;
import java.util.List; import java.util.List;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;

View File

@ -24,6 +24,11 @@ public class DiscordToAdminChatListener extends ListenerAdapter
{ {
DiscordToMinecraftListener dtml = new DiscordToMinecraftListener(); DiscordToMinecraftListener dtml = new DiscordToMinecraftListener();
public static net.md_5.bungee.api.ChatColor getColor(Displayable display)
{
return display.getColor();
}
public void onMessageReceived(MessageReceivedEvent event) public void onMessageReceived(MessageReceivedEvent event)
{ {
String chat_channel_id = ConfigEntry.DISCORD_ADMINCHAT_CHANNEL_ID.getString(); String chat_channel_id = ConfigEntry.DISCORD_ADMINCHAT_CHANNEL_ID.getString();
@ -87,11 +92,6 @@ public class DiscordToAdminChatListener extends ListenerAdapter
} }
} }
public static net.md_5.bungee.api.ChatColor getColor(Displayable display)
{
return display.getColor();
}
// Needed to display tags in custom AC messages // Needed to display tags in custom AC messages
public String getDisplay(Member member) public String getDisplay(Member member)
{ {

View File

@ -1,6 +1,5 @@
package me.totalfreedom.totalfreedommod.discord; package me.totalfreedom.totalfreedommod.discord;
import java.util.Objects;
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.player.PlayerData; import me.totalfreedom.totalfreedommod.player.PlayerData;

View File

@ -327,7 +327,7 @@ public class ItemFun extends FreedomService
//Redundant Player cast is required to avoid suspicious method calls. //Redundant Player cast is required to avoid suspicious method calls.
if (arrow != null if (arrow != null
&& (arrow.getShooter() instanceof Player) && (arrow.getShooter() instanceof Player)
&& explosivePlayers.contains((Player)arrow.getShooter())) && explosivePlayers.contains(arrow.getShooter()))
{ {
Objects.requireNonNull(arrow.getLocation().getWorld()).createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()); Objects.requireNonNull(arrow.getLocation().getWorld()).createExplosion(arrow.getLocation().getX(), arrow.getLocation().getY(), arrow.getLocation().getZ(), ConfigEntry.EXPLOSIVE_RADIUS.getDouble().floatValue(), false, ConfigEntry.ALLOW_EXPLOSIONS.getBoolean());
arrow.remove(); arrow.remove();

View File

@ -19,9 +19,9 @@ public class Jumppads extends FreedomService
public static final double DAMPING_COEFFICIENT = 0.8; public static final double DAMPING_COEFFICIENT = 0.8;
// //
private final Map<Player, Boolean> pushMap = Maps.newHashMap(); private final Map<Player, Boolean> pushMap = Maps.newHashMap();
public HashMap<Player, JumpPadMode> players = new HashMap<>();
// //
private final double strength = 1 + 0.1F; private final double strength = 1 + 0.1F;
public HashMap<Player, JumpPadMode> players = new HashMap<>();
public static double getDampingCoefficient() public static double getDampingCoefficient()
{ {

View File

@ -2,8 +2,8 @@ package me.totalfreedom.totalfreedommod.fun;
import java.util.HashSet; import java.util.HashSet;
import java.util.Objects; import java.util.Objects;
import java.util.SplittableRandom;
import java.util.Set; import java.util.Set;
import java.util.SplittableRandom;
import me.totalfreedom.totalfreedommod.FreedomService; import me.totalfreedom.totalfreedommod.FreedomService;
import me.totalfreedom.totalfreedommod.util.Groups; import me.totalfreedom.totalfreedommod.util.Groups;
import org.bukkit.Location; import org.bukkit.Location;

View File

@ -15,28 +15,6 @@ public abstract class ModuleExecutable
this.async = async; this.async = async;
} }
public NanoHTTPD.Response execute(final NanoHTTPD.HTTPSession session)
{
try
{
if (async)
{
return getResponse(session);
}
// Sync to server thread
return Bukkit.getScheduler().callSyncMethod(TotalFreedomMod.getPlugin(), () -> getResponse(session)).get();
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}
public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session);
public static ModuleExecutable forClass(final TotalFreedomMod plugin, Class<? extends HTTPDModule> clazz, boolean async) public static ModuleExecutable forClass(final TotalFreedomMod plugin, Class<? extends HTTPDModule> clazz, boolean async)
{ {
final Constructor<? extends HTTPDModule> cons; final Constructor<? extends HTTPDModule> cons;
@ -67,6 +45,28 @@ public abstract class ModuleExecutable
}; };
} }
public NanoHTTPD.Response execute(final NanoHTTPD.HTTPSession session)
{
try
{
if (async)
{
return getResponse(session);
}
// Sync to server thread
return Bukkit.getScheduler().callSyncMethod(TotalFreedomMod.getPlugin(), () -> getResponse(session)).get();
}
catch (Exception ex)
{
FLog.severe(ex);
}
return null;
}
public abstract NanoHTTPD.Response getResponse(NanoHTTPD.HTTPSession session);
public boolean isAsync() public boolean isAsync()
{ {
return async; return async;

View File

@ -1,7 +1,6 @@
package me.totalfreedom.totalfreedommod.permissions; package me.totalfreedom.totalfreedommod.permissions;
import java.util.List; import java.util.List;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
public enum PermissionEntry public enum PermissionEntry

View File

@ -7,7 +7,6 @@ import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import me.totalfreedom.totalfreedommod.shop.ShopItem; import me.totalfreedom.totalfreedommod.shop.ShopItem;
import me.totalfreedom.totalfreedommod.util.FLog; import me.totalfreedom.totalfreedommod.util.FLog;

View File

@ -21,8 +21,8 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.Objects; import java.util.Objects;
import java.util.SplittableRandom;
import java.util.Set; import java.util.Set;
import java.util.SplittableRandom;
import java.util.TimeZone; import java.util.TimeZone;
import java.util.UUID; import java.util.UUID;
import java.util.regex.Matcher; import java.util.regex.Matcher;
@ -148,7 +148,7 @@ public class FUtil
return DEVELOPER_NAMES.contains(player.getName()); return DEVELOPER_NAMES.contains(player.getName());
} }
} }
public static boolean inDeveloperMode() public static boolean inDeveloperMode()
{ {
return ConfigEntry.DEVELOPER_MODE.getBoolean(); return ConfigEntry.DEVELOPER_MODE.getBoolean();

View File

@ -10,7 +10,6 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.Objects;
import java.util.UUID; import java.util.UUID;
import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;