Skip to content

Commit b1d9db8

Browse files
committed
Pardon command from web support
1 parent be51a0f commit b1d9db8

16 files changed

Lines changed: 45 additions & 27 deletions

File tree

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ allprojects {
1919
maven { url 'https://repo.enonic.com/public/' }
2020
maven { url "https://oss.sonatype.org/content/groups/public/" }
2121
maven { url "https://repo.aikar.co/content/groups/aikar/" }
22-
maven { url 'https://papermc.io/repo/repository/maven-public/' }
22+
maven { url 'https://repo.papermc.io/repository/maven-public/' }
2323
maven { url 'https://hub.spigotmc.org/nexus/content/groups/public/' }
2424

2525
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }

bukkit/build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ dependencies {
66
compileOnly 'org.spigotmc:spigot-api:1.18.1-R0.1-SNAPSHOT'
77
compileOnly 'com.github.MilkBowl:VaultAPI:1.7'
88
compileOnly 'org.apache.logging.log4j:log4j-core:2.17.2'
9-
compileOnly 'me.clip:placeholderapi:2.11.3'
9+
compileOnly 'me.clip:placeholderapi:2.11.6'
1010
compileOnly 'com.viaversion:viaversion-api:4.7.0'
11-
compileOnly files('D:/Wurky/MineTrax/Plugin Development/Plugins/VentureChat-2.23.2.jar')
12-
compileOnly files('D:/Wurky/MineTrax/Plugin Development/Plugins/EpicCore-1.6.jar')
11+
compileOnly files('W:/Wurky/MineTrax/Plugin Development/Plugins/VentureChat-2.23.2.jar')
12+
compileOnly files('W:/Wurky/MineTrax/Plugin Development/Plugins/EpicCore-1.6.jar')
1313
}
1414

1515
java {
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.xinecraft.minetrax.bukkit.commander;
22

3+
import com.xinecraft.minetrax.common.MinetraxCommon;
34
import com.xinecraft.minetrax.common.interfaces.commander.CommonCommander;
45
import org.bukkit.Bukkit;
56

67
public class BukkitCommander implements CommonCommander {
78
@Override
89
public void dispatchCommand(String command) {
9-
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
10+
MinetraxCommon.getInstance().getScheduler().run(() -> Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command));
1011
}
1112
}

bukkit/src/main/java/com/xinecraft/minetrax/bukkit/webquery/BukkitWebQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,8 @@ public String handleCheckPlayerOnline(String playerUuid) throws Exception {
169169
}
170170

171171
@Override
172-
public String handleBanwardenPardon(BanWardenPunishmentType type, String victim, String reason) throws Exception {
173-
boolean status = this.plugin.getCommon().getBanWarden().pardon(type, victim, reason);
172+
public String handleBanwardenPardon(BanWardenPunishmentType type, String victim, String reason, String admin) throws Exception {
173+
boolean status = this.plugin.getCommon().getBanWarden().pardon(type, victim, reason, admin);
174174
return status ? "true" : "false";
175175
}
176176
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
package com.xinecraft.minetrax.bungee.commander;
22

3+
import com.xinecraft.minetrax.common.MinetraxCommon;
34
import com.xinecraft.minetrax.common.interfaces.commander.CommonCommander;
45
import net.md_5.bungee.api.ProxyServer;
56

67
public class BungeeCommander implements CommonCommander {
78
@Override
89
public void dispatchCommand(String command) {
9-
ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), command);
10+
MinetraxCommon.getInstance().getScheduler().run(() -> ProxyServer.getInstance().getPluginManager().dispatchCommand(ProxyServer.getInstance().getConsole(), command));
1011
}
1112
}

bungee/src/main/java/com/xinecraft/minetrax/bungee/webquery/BungeeWebQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ public String handleCheckPlayerOnline(String playerUuid) throws Exception {
149149
}
150150

151151
@Override
152-
public String handleBanwardenPardon(BanWardenPunishmentType type, String victim, String reason) throws Exception {
153-
boolean status = this.plugin.getCommon().getBanWarden().pardon(type, victim, reason);
152+
public String handleBanwardenPardon(BanWardenPunishmentType type, String victim, String reason, String admin) throws Exception {
153+
boolean status = this.plugin.getCommon().getBanWarden().pardon(type, victim, reason, admin);
154154
return status ? "true" : "false";
155155
}
156156
}

common/src/main/java/com/xinecraft/minetrax/common/banwarden/BanWarden.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public void sync(BanWardenSyncType type) {
1515
hook.sync(type);
1616
}
1717

18-
public boolean pardon(BanWardenPunishmentType type, String victim, String reason) {
19-
return hook.pardon(type, victim, reason);
18+
public boolean pardon(BanWardenPunishmentType type, String victim, String reason, String admin) {
19+
return hook.pardon(type, victim, reason, admin);
2020
}
2121
}

common/src/main/java/com/xinecraft/minetrax/common/banwarden/hooks/AdvancedbanHook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ public String punish(BanWardenPunishmentType type, String punishmentString) {
1313
}
1414

1515
@Override
16-
public boolean pardon(BanWardenPunishmentType type, String victim, String reason) {
16+
public boolean pardon(BanWardenPunishmentType type, String victim, String reason, String admin) {
1717
return false;
1818
}
1919

common/src/main/java/com/xinecraft/minetrax/common/banwarden/hooks/LibertybansHook.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public String punish(BanWardenPunishmentType type, String punishmentString) {
4646
}
4747

4848
@Override
49-
public boolean pardon(BanWardenPunishmentType type, String victim, String reason) {
49+
public boolean pardon(BanWardenPunishmentType type, String victim, String reason, String admin) {
5050
switch (type) {
5151
case BAN -> common.getCommander().dispatchCommand("libertybans:unban " + victim);
5252
case MUTE -> common.getCommander().dispatchCommand("libertybans:unmute " + victim);

common/src/main/java/com/xinecraft/minetrax/common/banwarden/hooks/LitebansHook.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,15 @@ public String punish(BanWardenPunishmentType type, String punishmentString) {
4040
}
4141

4242
@Override
43-
public boolean pardon(BanWardenPunishmentType type, String victim, String reason) {
44-
if (reason.isBlank()) {
43+
public boolean pardon(BanWardenPunishmentType type, String victim, String reason, String admin) {
44+
if (reason == null || reason.isBlank()) {
4545
reason = "-";
4646
}
47+
String parsedAdmin = admin == null || admin.isBlank() ? "--sender=BanWarden" : "--sender=" + admin;
4748
switch (type) {
48-
case BAN -> common.getCommander().dispatchCommand("litebans:unban " + victim + " " + reason);
49-
case MUTE -> common.getCommander().dispatchCommand("litebans:unmute " + victim + " " + reason);
50-
case WARN -> common.getCommander().dispatchCommand("litebans:unwarn " + victim + " " + reason);
49+
case BAN -> common.getCommander().dispatchCommand("litebans:unban " + victim + " " + reason + " " + parsedAdmin);
50+
case MUTE -> common.getCommander().dispatchCommand("litebans:unmute " + victim + " " + reason + " " + parsedAdmin);
51+
case WARN -> common.getCommander().dispatchCommand("litebans:unwarn " + victim + " " + reason + " " + parsedAdmin);
5152
default -> LoggingUtil.error("[LitebansHook] Pardon -> Unknown punishment type: " + type);
5253
}
5354
return true;

0 commit comments

Comments
 (0)