this codebase is a mess

This commit is contained in:
Telesphoreo 2022-02-05 14:43:49 -06:00
parent eebb34cd1c
commit d8a8f33425
5 changed files with 12 additions and 9 deletions

View File

@ -95,16 +95,14 @@ public abstract class PlexCommand extends Command implements PluginIdentifiableC
{
if (!plexPlayer.getRankFromString().isAtLeast(getLevel()))
{
send(sender, tl("noPermissionRank", ChatColor.stripColor(getLevel().getLoginMSG())));
return true;
throw new CommandFailException(PlexUtils.tl("noPermissionRank", ChatColor.stripColor(getLevel().getLoginMSG())));
}
}
else if (plugin.getSystem().equalsIgnoreCase("permissions"))
{
if (!player.hasPermission(perms.permission()))
{
send(sender, tl("noPermissionNode", perms.permission()));
return true;
throw new CommandFailException(PlexUtils.tl("noPermissionNode", perms.permission()));
}
}
else

View File

@ -37,7 +37,7 @@ public class FreezeCMD extends PlexCommand
Punishment punishment = new Punishment(UUID.fromString(punishedPlayer.getUuid()), getUUID(sender));
punishment.setCustomTime(false);
Date date = new Date();
punishment.setEndDate(DateUtils.addDays(date, 1));
punishment.setEndDate(DateUtils.addMinutes(date, 5));
punishment.setType(PunishmentType.FREEZE);
punishment.setPunishedUsername(player.getName());
punishment.setReason("");

View File

@ -21,8 +21,11 @@ public class RankCMD extends PlexCommand
@Override
protected Component execute(@NotNull CommandSender sender, @Nullable Player playerSender, String[] args)
{
PlexPlayer plexPlayer = getPlexPlayer(playerSender);
Rank rank = plugin.getRankManager().getRankFromString(plexPlayer.getRank());
return tl("yourRank", rank.getReadableString());
if (!(playerSender == null))
{
Rank rank = getPlexPlayer(playerSender).getRankFromString();
return tl("yourRank", rank.getReadableString());
}
return null;
}
}

View File

@ -1,9 +1,11 @@
package dev.plex.listener.impl;
import dev.plex.cache.DataUtils;
import dev.plex.cache.PlayerCache;
import dev.plex.listener.PlexListener;
import dev.plex.player.PunishedPlayer;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent;
public class FreezeListener extends PlexListener

View File

@ -8,6 +8,7 @@ import dev.plex.cache.SQLPlayerData;
import dev.plex.listener.PlexListener;
import dev.plex.player.PlexPlayer;
import dev.plex.player.PunishedPlayer;
import dev.plex.rank.enums.Rank;
import dev.plex.util.PlexLog;
import java.util.Collections;
import java.util.UUID;
@ -49,7 +50,6 @@ public class PlayerListener extends PlexListener
plexPlayer = new PlexPlayer(player.getUniqueId()); //it doesn't! okay so now create the object
plexPlayer.setName(player.getName()); //set the name of the player
plexPlayer.setIps(Collections.singletonList(player.getAddress().getAddress().getHostAddress().trim())); //set the arraylist of ips
DataUtils.insert(plexPlayer); // insert data in some wack db
}
else