ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 22, 2019 18:07:36 GMT
|
|
StevenNL2000
Forum Admin
Posts: 6,415
| Likes: 6,936
IGN: StevenNL2000
Timezone: UTC+01:00
Member is Staff. Need immediate assistance? Send a PM
|
Post by StevenNL2000 on Jun 22, 2019 18:52:06 GMT
You are callingFUtil.bcastMsg(bcast.toString()); but you never set bcast to anything, so it throws a NullPointerException.
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 22, 2019 20:11:18 GMT
When I take that out, it still throws shit at my console. Can try again though, thanks for the advice, StevenNL2000 . EDIT: Threw a Command Error: Unknown Cause
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 22, 2019 20:16:59 GMT
You are calling FUtil.bcastMsg(bcast.toString()); but you never set bcast to anything, so it throws a NullPointerException. I've also been wanting to code a silent /tempban but when I tamper with the code in the slightest way it fucks up the whole thing. Hastebin was being a dick so the code can be found in the spoiler below this message. package me.totalfreedom.totalfreedommod.command;
import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import net.pravian.aero.util.Ips; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player;
@commandpermissions(level = Rank.MODERATOR, source = SourceType.BOTH) @commandparameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]") public class Command_tempban extends FreedomCommand { private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
@override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; }
final String username; final List<String> ips = new ArrayList<>();
final Player player = getPlayer(args[0]); final PlayerData entry = plugin.pl.getData(args[0]);
if (player == null) { msg(FreedomCommand.PLAYER_NOT_FOUND); return true; }
username = entry.getUsername(); ips.addAll(entry.getIps()); final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName());
Date expires = FUtil.parseDateOffset("30m"); if (args.length >= 2) { Date parsed_offset = FUtil.parseDateOffset(args[1]); if (parsed_offset != null) { expires = parsed_offset; } } message.append(" until ").append(date_format.format(expires));
String reason = "Banned by " + sender.getName(); if (args.length >= 3) { reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")"; message.append(", Reason: \"").append(reason).append("\""); }
// strike with lightning effect: final Location targetPos = player.getLocation(); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); targetPos.getWorld().strikeLightningEffect(strike_pos); } }
FUtil.adminAction(sender.getName(), message.toString(), true);
Ban ban = Ban.forPlayerName(username, sender, expires, reason); for (String ip : ips) { ban.addIp(ip); } plugin.bm.addBan(ban); player.kickPlayer(sender.getName() + " - " + message.toString());
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.TEMPBAN, reason));
return true; } }
|
|
StevenNL2000
Forum Admin
Posts: 6,415
| Likes: 6,936
IGN: StevenNL2000
Timezone: UTC+01:00
Member is Staff. Need immediate assistance? Send a PM
|
Post by StevenNL2000 on Jun 22, 2019 21:14:54 GMT
You are calling FUtil.bcastMsg(bcast.toString()); but you never set bcast to anything, so it throws a NullPointerException. I've also been wanting to code a silent /tempban but when I tamper with the code in the slightest way it fucks up the whole thing. Hastebin was being a dick so the code can be found in the spoiler below this message. package me.totalfreedom.totalfreedommod.command;
import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import net.pravian.aero.util.Ips; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player;
@commandpermissions(level = Rank.MODERATOR, source = SourceType.BOTH) @commandparameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]") public class Command_tempban extends FreedomCommand { private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
@override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; }
final String username; final List<String> ips = new ArrayList<>();
final Player player = getPlayer(args[0]); final PlayerData entry = plugin.pl.getData(args[0]);
if (player == null) { msg(FreedomCommand.PLAYER_NOT_FOUND); return true; }
username = entry.getUsername(); ips.addAll(entry.getIps()); final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName());
Date expires = FUtil.parseDateOffset("30m"); if (args.length >= 2) { Date parsed_offset = FUtil.parseDateOffset(args[1]); if (parsed_offset != null) { expires = parsed_offset; } } message.append(" until ").append(date_format.format(expires));
String reason = "Banned by " + sender.getName(); if (args.length >= 3) { reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")"; message.append(", Reason: \"").append(reason).append("\""); }
// strike with lightning effect: final Location targetPos = player.getLocation(); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); targetPos.getWorld().strikeLightningEffect(strike_pos); } }
FUtil.adminAction(sender.getName(), message.toString(), true);
Ban ban = Ban.forPlayerName(username, sender, expires, reason); for (String ip : ips) { ban.addIp(ip); } plugin.bm.addBan(ban); player.kickPlayer(sender.getName() + " - " + message.toString());
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.TEMPBAN, reason));
return true; } }
Well, the annotations (the things starting with @) lost their capitals for no particular reason. Are you using an IDE to edit the code?
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 22, 2019 21:34:15 GMT
I've also been wanting to code a silent /tempban but when I tamper with the code in the slightest way it fucks up the whole thing. Hastebin was being a dick so the code can be found in the spoiler below this message. package me.totalfreedom.totalfreedommod.command;
import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import me.totalfreedom.totalfreedommod.banning.Ban; import me.totalfreedom.totalfreedommod.player.PlayerData; import me.totalfreedom.totalfreedommod.punishments.Punishment; import me.totalfreedom.totalfreedommod.punishments.PunishmentType; import me.totalfreedom.totalfreedommod.rank.Rank; import me.totalfreedom.totalfreedommod.util.FUtil; import net.pravian.aero.util.Ips; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player;
@commandpermissions(level = Rank.MODERATOR, source = SourceType.BOTH) @commandparameters(description = "Temporarily ban someone.", usage = "/<command> [playername] [duration] [reason]") public class Command_tempban extends FreedomCommand { private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
@override public boolean run(CommandSender sender, Player playerSender, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) { if (args.length < 1) { return false; }
final String username; final List<String> ips = new ArrayList<>();
final Player player = getPlayer(args[0]); final PlayerData entry = plugin.pl.getData(args[0]);
if (player == null) { msg(FreedomCommand.PLAYER_NOT_FOUND); return true; }
username = entry.getUsername(); ips.addAll(entry.getIps()); final StringBuilder message = new StringBuilder("Temporarily banned " + player.getName());
Date expires = FUtil.parseDateOffset("30m"); if (args.length >= 2) { Date parsed_offset = FUtil.parseDateOffset(args[1]); if (parsed_offset != null) { expires = parsed_offset; } } message.append(" until ").append(date_format.format(expires));
String reason = "Banned by " + sender.getName(); if (args.length >= 3) { reason = StringUtils.join(ArrayUtils.subarray(args, 2, args.length), " ") + " (" + sender.getName() + ")"; message.append(", Reason: \"").append(reason).append("\""); }
// strike with lightning effect: final Location targetPos = player.getLocation(); for (int x = -1; x <= 1; x++) { for (int z = -1; z <= 1; z++) { final Location strike_pos = new Location(targetPos.getWorld(), targetPos.getBlockX() + x, targetPos.getBlockY(), targetPos.getBlockZ() + z); targetPos.getWorld().strikeLightningEffect(strike_pos); } }
FUtil.adminAction(sender.getName(), message.toString(), true);
Ban ban = Ban.forPlayerName(username, sender, expires, reason); for (String ip : ips) { ban.addIp(ip); } plugin.bm.addBan(ban); player.kickPlayer(sender.getName() + " - " + message.toString());
plugin.pul.logPunishment(new Punishment(player.getName(), Ips.getIp(player), sender.getName(), PunishmentType.TEMPBAN, reason));
return true; } }
Well, the annotations (the things starting with @) lost their capitals for no particular reason. Are you using an IDE to edit the code? I'm using netbeans ide
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 23, 2019 10:28:05 GMT
(This isn't related to silent punishments but) Whilst we're on the topic of needing help with plugins, OPs bypass literally every WorldGuard flag, is there a way to fix this
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 23, 2019 16:32:50 GMT
(This isn't related to silent punishments but) Whilst we're on the topic of needing help with plugins, OPs bypass literally every WorldGuard flag, is there a way to fix this use TF-WorldGuard
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 23, 2019 19:44:10 GMT
(This isn't related to silent punishments but) Whilst we're on the topic of needing help with plugins, OPs bypass literally every WorldGuard flag, is there a way to fix this use TF-WorldGuard Then it doesn't work because of worldedit I believe
|
|
Deleted
Deleted Member
Posts: 0
|
Post by Deleted on Jun 23, 2019 20:52:59 GMT
Then it doesn't work because of worldedit I believe use TF-WorldEdit then kekkk
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 24, 2019 13:48:30 GMT
Then it doesn't work because of worldedit I believe use TF-WorldEdit then kekkk Then asyncworldedit crashes my server mega kek
|
|
ginlang
Veteran Member
Posts: 1,204
| Likes: 1,465
|
Post by ginlang on Jun 24, 2019 16:03:17 GMT
Fixed the WG issue, can we get back on topic to silent punishments?
|
|