-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1dce53e
commit f8b349f
Showing
9 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/me/tomster09090/staffutil/commands/nvCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
package me.tomster09090.staffutil.commands; | ||
|
||
import me.tomster09090.staffutil.util.CC; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.bukkit.potion.Potion; | ||
import org.bukkit.potion.PotionEffect; | ||
import org.bukkit.potion.PotionEffectType; | ||
import org.bukkit.potion.PotionType; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class nvCommand implements CommandExecutor { | ||
List<Player> playersWithNV = new ArrayList<>(); | ||
|
||
@Override | ||
public boolean onCommand(@NotNull CommandSender commandSender, @NotNull Command command, @NotNull String s, @NotNull String[] args) { | ||
if (commandSender.hasPermission("staff.nv")) { | ||
Player player = (Player) commandSender; | ||
if (args.length == 0) { | ||
if (!playersWithNV.contains(player)) { | ||
playersWithNV.add(player); | ||
player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 999999, 255, false, false)); | ||
player.sendMessage(CC.GREEN + "You now have night vision!"); | ||
} else { | ||
playersWithNV.remove(player); | ||
player.removePotionEffect(PotionEffectType.NIGHT_VISION); | ||
player.sendMessage(CC.RED + "You no longer have night vision!"); | ||
} | ||
}else{ | ||
String targetName = args[0]; | ||
Player target = Bukkit.getServer().getPlayerExact(targetName); | ||
if (target == null){ | ||
player.sendMessage(CC.RED + "Player " + targetName + " isn't online."); | ||
}else if (!playersWithNV.contains(target)){ | ||
playersWithNV.add(target); | ||
player.sendMessage(CC.GREEN + "Forcefully given nightvision to " + targetName + "!"); | ||
|
||
target.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 999999, 255, false, false)); | ||
target.sendMessage(CC.GREEN + "You have forcefully been given night vision!"); | ||
}else{ | ||
playersWithNV.remove(target); | ||
player.sendMessage(CC.RED + "Forcefully removed nightvision from " + targetName + "!"); | ||
|
||
target.removePotionEffect(PotionEffectType.NIGHT_VISION); | ||
target.sendMessage(CC.RED + "Your nightvision has been forcefully taken away!"); | ||
} | ||
} | ||
} | ||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file modified
BIN
-248 Bytes
(93%)
target/classes/me/tomster09090/staffutil/commands/rsp/onPackLoad.class
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters