Skip to content

Commit

Permalink
Merge pull request #34 from TreeboMC/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
ShakeforProtein authored Feb 13, 2022
2 parents ae6ef42 + 37da3a6 commit 8a516b3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>me.ShakeforProtein</groupId>
<artifactId>TreeboTeleport</artifactId>
<version>2.0.4</version>
<version>2.0.8</version>
<packaging>jar</packaging>

<name>TreeboTeleport</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.bukkit.util.Vector;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.ThreadLocalRandom;

Expand All @@ -24,6 +25,7 @@ public class Wild2 implements CommandExecutor {
private Random random = new Random();
private int Y = 0;
private int limit = 10;
private List<Player> cooldownList = new ArrayList<>();


public Wild2(TreeboTeleport main) {
Expand All @@ -49,10 +51,18 @@ public boolean execute(CommandSender sender, String label, String[] args) {
maxZ = (pl.getConfig().getString("wild.maxZ") != null) ? pl.getConfig().getInt("wild.maxZ") : 50000;



if (sender instanceof Player) {
Player player = (Player) sender;
if (player.getWorld().getName().toLowerCase().contains("grid")) {
limit = 10;
if(!cooldownList.contains(player) && !player.hasPermission("treebo.staff")){
cooldownList.add(player);
Bukkit.getScheduler().runTaskLater(pl, ()->{}, 600L);
} else if(cooldownList.contains(player)){
player.sendMessage(pl.badge + " Sorry, as Skygrid is very server intensive a 30 Second cooldown has been added to the /wild command.");
return true;
}
}
if (args.length == 0) {
doWild(player);
Expand Down Expand Up @@ -111,6 +121,7 @@ public void doWild(Player targetPlayer) {


Chunk chunk = w.getBlockAt(randX, 120, randZ).getChunk();

String sending = "Was unable to find a safe block.";
boolean teleported = false;
for (int c = 150; c > 50; c--) {
Expand All @@ -130,6 +141,8 @@ public void doWild(Player targetPlayer) {
targetPlayer.setFallDistance(0);
sending = "Safe block located at " + block.getX() + " " + block.getY() + " " + block.getZ();
break;
} else {
cooldownList.remove(targetPlayer);
}
}
}
Expand Down Expand Up @@ -407,7 +420,7 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
doStaffWild(player, args[0]);
}
}

//remove this line
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import me.shakeforprotein.treeboteleport.TreeboTeleport;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
Expand All @@ -27,7 +28,7 @@ private void onBedInteract(PlayerInteractEvent e) {
//File homesYml = new File(pl.getDataFolder() + File.separator + "homes", File.separator + p.getUniqueId().toString() + ".yml");
File homesYml = new File(pl.getPlayerDataFolder() + File.separator + p.getUniqueId().toString(), File.separator + "homes.yml");
FileConfiguration homes = YamlConfiguration.loadConfiguration(homesYml);
if (e.getAction() == Action.RIGHT_CLICK_BLOCK) {
if (p.getWorld().getEnvironment() == World.Environment.NORMAL && !p.getWorld().getName().toLowerCase().contains("resource") && e.getAction() == Action.RIGHT_CLICK_BLOCK) {
Material b = e.getClickedBlock().getType();

if (b.toString().contains("_BED")) {
Expand All @@ -51,6 +52,7 @@ private void onBedInteract(PlayerInteractEvent e) {
catch (IOException err){
p.sendMessage(pl.err + "Failed to save home");
}
//remove this line
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class OpenHubMenu {

private TreeboTeleport pl;
private BungeeRecieve bungeeRecieve;

//remove this line
public OpenHubMenu(TreeboTeleport main){
this.pl = main;
this.bungeeRecieve = new BungeeRecieve(pl);
Expand Down Expand Up @@ -75,7 +75,7 @@ public boolean openHubMenu(Player p){

if(hubMenu.getConfigurationSection("hubmenu.menuItems." + item + ".lore") != null){
for(String newLore: hubMenu.getConfigurationSection("hubmenu.menuItems." + item + ".lore").getKeys(false)){
itemLore.add(hubMenu.getString("hubmenu.menuItems." + item + ".lore." + newLore));
itemLore.add(ChatColor.translateAlternateColorCodes('&', hubMenu.getString("hubmenu.menuItems." + item + ".lore." + newLore)));
}
}

Expand Down

0 comments on commit 8a516b3

Please sign in to comment.