Created
December 24, 2020 18:52
-
-
Save encomjp/ad2ff18805e11168b6bb6b01a3da8a49 to your computer and use it in GitHub Desktop.
RTP
pprtp
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
package com.pepe.pprtp.peperandomteleport.commands; | |
import com.pepe.pprtp.peperandomteleport.PepeRandomTeleport; | |
import com.pepe.pprtp.peperandomteleport.events.timer; | |
import org.bukkit.Bukkit; | |
import org.bukkit.ChatColor; | |
import org.bukkit.Location; | |
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.scheduler.BukkitScheduler; | |
import java.util.concurrent.ThreadLocalRandom; | |
public class rtpCommand implements CommandExecutor { | |
@Override | |
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | |
if(sender instanceof Player) { | |
Player player = (Player) sender; | |
Boolean cooldown = player.hasPotionEffect(PotionEffectType.SLOW_FALLING); | |
if (cooldown == true) { | |
player.sendMessage(ChatColor.DARK_RED + "Teleport Cooldown, please try again in few seconds"); | |
} else{ | |
if (player.hasPermission("pprtp.rtp")) | |
{ | |
Location playerLoc = player.getLocation(); | |
Location PlayerSpawnLoc = playerLoc.getWorld().getSpawnLocation(); | |
int playerSpawnLocX = (int) PlayerSpawnLoc.getX(); | |
int playerSpawnLocY = (int) PlayerSpawnLoc.getZ(); | |
int randomNumX = ThreadLocalRandom.current().nextInt(playerSpawnLocX, playerSpawnLocX + 20000); | |
int randomNumZ = ThreadLocalRandom.current().nextInt(playerSpawnLocY, playerSpawnLocY + 20000); | |
player.teleport(player.getLocation().add(randomNumX, 75, randomNumZ)); | |
player.setVelocity(player.getVelocity().setY((-.5))); | |
player.sendMessage(ChatColor.AQUA + "Parachuting System Enabled"); | |
player.addPotionEffect(PotionEffectType.SLOW_FALLING.createEffect(900, 10)); | |
} | |
if (player.hasPotionEffect(PotionEffectType.SLOW_FALLING) == false) | |
{ | |
player.sendMessage("Parachuting System Disabled!"); | |
} | |
} | |
} | |
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
package com.pepe.pprtp.peperandomteleport.events; | |
import org.bukkit.scheduler.BukkitRunnable; | |
public class timer extends BukkitRunnable { | |
@Override | |
public void run() { | |
} | |
} |
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
package com.pepe.pprtp.peperandomteleport; | |
import com.pepe.pprtp.peperandomteleport.commands.rtpCommand; | |
import org.bukkit.plugin.java.JavaPlugin; | |
public final class PepeRandomTeleport extends JavaPlugin { | |
@Override | |
public void onEnable() { | |
System.out.println("[PEPE] PPRTP Enabled"); | |
getCommand("rtp").setExecutor(new rtpCommand()); | |
} | |
@Override | |
public void onDisable() { | |
// Plugin shutdown logic | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment