This repository was archived by the owner on Jul 7, 2023. It is now read-only.
File tree 3 files changed +27
-4
lines changed
java/com/massivecraft/factions
3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change 1
1
package com .massivecraft .factions .cmd ;
2
2
3
+ import com .massivecraft .factions .P ;
4
+ import com .massivecraft .factions .integration .Econ ;
3
5
import com .massivecraft .factions .struct .Permission ;
4
6
import com .massivecraft .factions .zcore .util .TL ;
7
+ import org .bukkit .Bukkit ;
5
8
6
9
public class CmdStealth extends FCommand {
7
10
public CmdStealth () {
@@ -20,9 +23,26 @@ public CmdStealth() {
20
23
21
24
public void perform () {
22
25
if (myFaction != null && !myFaction .isWilderness () && !myFaction .isSafeZone () && !myFaction .isWarZone () && myFaction .isNormal ()) {
23
- fme .setStealth (!fme .isStealthEnabled ());
26
+
27
+
24
28
// Sends Enable/Disable Message
25
- fme .msg (fme .isStealthEnabled () ? TL .COMMAND_STEALTH_ENABLE : TL .COMMAND_STEALTH_DISABLE );
29
+ if (fme .isStealthEnabled ()) {
30
+ fme .setStealth (false );
31
+ } else {
32
+ fme .setStealth (true );
33
+ Bukkit .getScheduler ().scheduleSyncDelayedTask (P .p , new Runnable () {
34
+ @ Override
35
+ public void run () {
36
+ if (fme .isStealthEnabled ()) {
37
+ fme .setStealth (false );
38
+ fme .msg (TL .COMMAND_STEALTH_DISABLE );
39
+ }
40
+ }
41
+ // We multiplied by 20 here because the value is in ticks.
42
+ }, P .p .getConfig ().getInt ("stealth-timeout" ) * 20 );
43
+ }
44
+
45
+ fme .sendMessage (fme .isStealthEnabled () ? TL .COMMAND_STEALTH_ENABLE .toString ().replace ("{timeout}" , P .p .getConfig ().getInt ("stealth-timeout" ) + "" ) : TL .COMMAND_STEALTH_DISABLE .toString ());
26
46
} else {
27
47
fme .msg (TL .COMMAND_STEALTH_MUSTBEMEMBER );
28
48
}
Original file line number Diff line number Diff line change @@ -637,8 +637,8 @@ public enum TL {
637
637
COMMAND_STATUS_DESCRIPTION ("Show the status of a player" ),
638
638
639
639
COMMAND_STEALTH_DESCRIPTION ("Enable and Disable Stealth Mode" ),
640
- COMMAND_STEALTH_ENABLE ( "&2Stealth &8 » &7You will no longer disable nearby players fly." ),
641
- COMMAND_STEALTH_DISABLE ("&2Stealth &8» &7You will now disable other nearby players fly." ),
640
+ COMMAND_STEALTH_ENABLE ( "&cStealth &7 » &7You will no longer disable nearby players in /f fly for {timeout} seconds ." ),
641
+ COMMAND_STEALTH_DISABLE ("&2Stealth &8» &7You will now disable other nearby players in /f fly." ),
642
642
COMMAND_STEALTH_MUSTBEMEMBER ("&2Stealth &8» &4You must be in a faction to use this command" ),
643
643
644
644
COMMAND_STUCK_TIMEFORMAT ("m 'minutes', s 'seconds.'" ),
Original file line number Diff line number Diff line change 72
72
73
73
74
74
75
+ # This will set the timeout for the stealth in seconds.
76
+ stealth-timeout : 300
77
+
75
78
# If a player leaves fly (out of territory or took damage)
76
79
# how long should they not take fall damage for?
77
80
# Set to 0 to have them always take fall damage.
You can’t perform that action at this time.
0 commit comments