Skip to content

Commit b74467e

Browse files
committed
Wrong op level for pardon-ip command fixed.
Localizaton for restricted messages added. Hover event with restricred message description added. Signed-off-by: Pavel Erokhin (MairwunNx) <MairwunNx@gmail.com>
1 parent 62c0c8e commit b74467e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+785
-74
lines changed

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/ExecuteCommand.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@
3737
import net.minecraft.util.CachedBlockInfo;
3838
import net.minecraft.util.math.BlockPos;
3939
import net.minecraft.util.math.MutableBoundingBox;
40+
import net.minecraft.util.text.Style;
4041
import net.minecraft.util.text.TranslationTextComponent;
42+
import net.minecraft.util.text.event.HoverEvent;
4143
import net.minecraft.world.server.ServerWorld;
4244
import org.apache.logging.log4j.LogManager;
4345
import org.apache.logging.log4j.Logger;
@@ -141,7 +143,16 @@ private static void checkPermissions(CommandSource source) {
141143
);
142144
throw new CommandException(
143145
new TranslationTextComponent(
144-
"native.execute.restricted"
146+
"native.command.restricted"
147+
).setStyle(
148+
new Style().setHoverEvent(
149+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
150+
new TranslationTextComponent(
151+
"native.command.restricted_hover",
152+
"native.execute", "2"
153+
)
154+
)
155+
)
145156
)
146157
);
147158
}

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/ForceLoadCommand.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
import net.minecraft.command.arguments.ColumnPosArgument;
1717
import net.minecraft.util.math.ChunkPos;
1818
import net.minecraft.util.math.ColumnPos;
19+
import net.minecraft.util.text.Style;
1920
import net.minecraft.util.text.TranslationTextComponent;
21+
import net.minecraft.util.text.event.HoverEvent;
2022
import net.minecraft.world.dimension.DimensionType;
2123
import net.minecraft.world.server.ServerWorld;
2224
import org.apache.logging.log4j.LogManager;
@@ -67,7 +69,16 @@ private static void checkPermissions(CommandSource source) {
6769
);
6870
throw new CommandException(
6971
new TranslationTextComponent(
70-
"native.forceload.restricted"
72+
"native.command.restricted"
73+
).setStyle(
74+
new Style().setHoverEvent(
75+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
76+
new TranslationTextComponent(
77+
"native.command.restricted_hover",
78+
"native.forceload", "2"
79+
)
80+
)
81+
)
7182
)
7283
);
7384
}

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/LootCommand.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@
3131
import net.minecraft.util.ResourceLocation;
3232
import net.minecraft.util.math.BlockPos;
3333
import net.minecraft.util.math.Vec3d;
34+
import net.minecraft.util.text.Style;
3435
import net.minecraft.util.text.TranslationTextComponent;
36+
import net.minecraft.util.text.event.HoverEvent;
3537
import net.minecraft.world.server.ServerWorld;
3638
import net.minecraft.world.storage.loot.*;
3739
import org.apache.logging.log4j.LogManager;
@@ -96,7 +98,16 @@ private static void checkPermissions(CommandSource source) {
9698
);
9799
throw new CommandException(
98100
new TranslationTextComponent(
99-
"native.loot.restricted"
101+
"native.command.restricted"
102+
).setStyle(
103+
new Style().setHoverEvent(
104+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
105+
new TranslationTextComponent(
106+
"native.command.restricted_hover",
107+
"native.loot", "2"
108+
)
109+
)
110+
)
100111
)
101112
);
102113
}

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/ScoreboardCommand.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,8 @@
2222
import net.minecraft.scoreboard.ScoreCriteria;
2323
import net.minecraft.scoreboard.ScoreObjective;
2424
import net.minecraft.scoreboard.Scoreboard;
25-
import net.minecraft.util.text.ITextComponent;
26-
import net.minecraft.util.text.StringTextComponent;
27-
import net.minecraft.util.text.TextComponentUtils;
28-
import net.minecraft.util.text.TranslationTextComponent;
25+
import net.minecraft.util.text.*;
26+
import net.minecraft.util.text.event.HoverEvent;
2927
import org.apache.logging.log4j.LogManager;
3028
import org.apache.logging.log4j.Logger;
3129

@@ -102,7 +100,16 @@ private static void checkPermissions(CommandSource source) {
102100
);
103101
throw new CommandException(
104102
new TranslationTextComponent(
105-
"native.scoreboard.restricted"
103+
"native.command.restricted"
104+
).setStyle(
105+
new Style().setHoverEvent(
106+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
107+
new TranslationTextComponent(
108+
"native.command.restricted_hover",
109+
"native.scoreboard", "2"
110+
)
111+
)
112+
)
106113
)
107114
);
108115
}

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/SpreadPlayersCommand.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
import net.minecraft.util.math.BlockPos;
2424
import net.minecraft.util.math.MathHelper;
2525
import net.minecraft.util.math.Vec2f;
26+
import net.minecraft.util.text.Style;
2627
import net.minecraft.util.text.TranslationTextComponent;
28+
import net.minecraft.util.text.event.HoverEvent;
2729
import net.minecraft.world.IBlockReader;
2830
import net.minecraft.world.server.ServerWorld;
2931
import org.apache.logging.log4j.LogManager;
@@ -62,7 +64,16 @@ private static void checkPermissions(CommandSource source) {
6264
);
6365
throw new CommandException(
6466
new TranslationTextComponent(
65-
"native.spreadplayers.restricted"
67+
"native.command.restricted"
68+
).setStyle(
69+
new Style().setHoverEvent(
70+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
71+
new TranslationTextComponent(
72+
"native.command.restricted_hover",
73+
"native.spreadplayers", "2"
74+
)
75+
)
76+
)
6677
)
6778
);
6879
}

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/TeamCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import net.minecraft.scoreboard.Scoreboard;
2222
import net.minecraft.scoreboard.Team;
2323
import net.minecraft.util.text.*;
24+
import net.minecraft.util.text.event.HoverEvent;
2425
import org.apache.logging.log4j.LogManager;
2526
import org.apache.logging.log4j.Logger;
2627

@@ -118,7 +119,16 @@ private static void checkPermissions(CommandSource source) {
118119
);
119120
throw new CommandException(
120121
new TranslationTextComponent(
121-
"native.team.restricted"
122+
"native.command.restricted"
123+
).setStyle(
124+
new Style().setHoverEvent(
125+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
126+
new TranslationTextComponent(
127+
"native.command.restricted_hover",
128+
"native.team", "2"
129+
)
130+
)
131+
)
122132
)
123133
);
124134
}

src/main/java/com/mairwunnx/projectessentials/core/vanilla/commands/TeleportCommand.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
import net.minecraft.entity.player.ServerPlayerEntity;
1616
import net.minecraft.network.play.server.SPlayerPositionLookPacket;
1717
import net.minecraft.util.math.*;
18+
import net.minecraft.util.text.Style;
1819
import net.minecraft.util.text.TranslationTextComponent;
20+
import net.minecraft.util.text.event.HoverEvent;
1921
import net.minecraft.world.server.ServerWorld;
2022
import net.minecraft.world.server.TicketType;
2123
import org.apache.logging.log4j.LogManager;
@@ -69,7 +71,16 @@ private static void checkPermissions(CommandSource source) {
6971
);
7072
throw new CommandException(
7173
new TranslationTextComponent(
72-
"native.teleport.restricted"
74+
"native.command.restricted"
75+
).setStyle(
76+
new Style().setHoverEvent(
77+
new HoverEvent(HoverEvent.Action.SHOW_TEXT,
78+
new TranslationTextComponent(
79+
"native.command.restricted_hover",
80+
"native.teleport", "2"
81+
)
82+
)
83+
)
7384
)
7485
);
7586
}

src/main/kotlin/com/mairwunnx/projectessentials/core/vanilla/commands/AdvancementCommand.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import net.minecraft.command.ISuggestionProvider
2626
import net.minecraft.command.arguments.EntityArgument
2727
import net.minecraft.command.arguments.ResourceLocationArgument
2828
import net.minecraft.entity.player.ServerPlayerEntity
29+
import net.minecraft.util.text.Style
2930
import net.minecraft.util.text.TranslationTextComponent
31+
import net.minecraft.util.text.event.HoverEvent
3032
import org.apache.logging.log4j.LogManager
3133

3234

@@ -302,7 +304,16 @@ internal object AdvancementCommand {
302304
)
303305
throw CommandException(
304306
TranslationTextComponent(
305-
"native.advancement.restricted"
307+
"native.command.restricted"
308+
).setStyle(
309+
Style().setHoverEvent(
310+
HoverEvent(
311+
HoverEvent.Action.SHOW_TEXT, TranslationTextComponent(
312+
"native.command.restricted_hover",
313+
"native.advancement", "2"
314+
)
315+
)
316+
)
306317
)
307318
)
308319
}

src/main/kotlin/com/mairwunnx/projectessentials/core/vanilla/commands/BanCommand.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ import net.minecraft.command.arguments.GameProfileArgument
2222
import net.minecraft.command.arguments.MessageArgument
2323
import net.minecraft.server.management.ProfileBanEntry
2424
import net.minecraft.util.text.ITextComponent
25+
import net.minecraft.util.text.Style
2526
import net.minecraft.util.text.TextComponentUtils
2627
import net.minecraft.util.text.TranslationTextComponent
28+
import net.minecraft.util.text.event.HoverEvent
2729
import org.apache.logging.log4j.LogManager
2830
import java.util.*
2931

@@ -87,7 +89,16 @@ internal object BanCommand {
8789
)
8890
throw CommandException(
8991
TranslationTextComponent(
90-
"native.ban.restricted"
92+
"native.command.restricted"
93+
).setStyle(
94+
Style().setHoverEvent(
95+
HoverEvent(
96+
HoverEvent.Action.SHOW_TEXT, TranslationTextComponent(
97+
"native.command.restricted_hover",
98+
"native.ban", "3"
99+
)
100+
)
101+
)
91102
)
92103
)
93104
}

src/main/kotlin/com/mairwunnx/projectessentials/core/vanilla/commands/BanIpCommand.kt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ import net.minecraft.command.arguments.EntitySelector
2222
import net.minecraft.command.arguments.MessageArgument
2323
import net.minecraft.server.management.IPBanEntry
2424
import net.minecraft.util.text.ITextComponent
25+
import net.minecraft.util.text.Style
2526
import net.minecraft.util.text.TranslationTextComponent
27+
import net.minecraft.util.text.event.HoverEvent
2628
import org.apache.logging.log4j.LogManager
2729
import java.util.*
2830
import java.util.regex.Pattern
@@ -114,7 +116,16 @@ internal object BanIpCommand {
114116
)
115117
throw CommandException(
116118
TranslationTextComponent(
117-
"native.banip.restricted"
119+
"native.command.restricted"
120+
).setStyle(
121+
Style().setHoverEvent(
122+
HoverEvent(
123+
HoverEvent.Action.SHOW_TEXT, TranslationTextComponent(
124+
"native.command.restricted_hover",
125+
"native.banip", "3"
126+
)
127+
)
128+
)
118129
)
119130
)
120131
}

0 commit comments

Comments
 (0)