Skip to content

Commit

Permalink
Added permission node tbteleport.player.shop - default True
Browse files Browse the repository at this point in the history
Added permission node tbteleport.admin.setshop - default OP
Added permission node tbteleport.admin.cooldowns - default OP
Added /shop - sends player to shop for current world
Added /setshop - Sets current world /shop location to current location
Added /setTTeleCooldown - Enables, disables and sets the timer for /wild cooldowns.

Modified /setworldspawn to also save to config.yml for use with send to spawn on join.
Modified /tp <player> <player> - Should no longer error if run from console.`
  • Loading branch information
ShakeforProtein committed Jun 5, 2019
1 parent d0d2018 commit dcba808
Show file tree
Hide file tree
Showing 17 changed files with 258 additions and 152 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__junit_junit_4_10.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/libraries/Maven__org_hamcrest_hamcrest_core_1_1.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 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>0.1.2</version>
<version>0.1.4</version>
<packaging>jar</packaging>

<name>TreeboTeleport</name>
Expand Down Expand Up @@ -69,6 +69,10 @@
<id>sonatype</id>
<url>https://oss.sonatype.org/content/groups/public/</url>
</repository>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
</repository>
</repositories>

<dependencies>
Expand All @@ -83,5 +87,10 @@
<artifactId>bungeechannelapi</artifactId>
<version>1.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public SaveConfig(TreeboTeleport main){
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {

pl.saveConfig();
sender.sendMessage("Saved Config");
sender.sendMessage(pl.badge + "Saved Config");
return true;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package me.shakeforprotein.treeboteleport.Commands;

import me.shakeforprotein.treeboteleport.TreeboTeleport;
import org.bukkit.Location;
import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
Expand All @@ -21,8 +22,13 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String

String world = p.getWorld().getName();

Location pLoc = p.getLocation();
pl.getConfig().set("shop." + p.getWorld().getName() + ".world", world);
pl.getConfig().set("shop." + p.getWorld().getName() + ".location", p.getLocation());
pl.getConfig().set("shop." + p.getWorld().getName() + ".x", pLoc.getX());
pl.getConfig().set("shop." + p.getWorld().getName() + ".y", pLoc.getY());
pl.getConfig().set("shop." + p.getWorld().getName() + ".z", pLoc.getZ());
pl.getConfig().set("shop." + p.getWorld().getName() + ".pitch", pLoc.getPitch());
pl.getConfig().set("shop." + p.getWorld().getName() + ".yaw", pLoc.getYaw());

sender.sendMessage(pl.badge + p.getWorld().getName() + "Shop set successfully, don't forget to run /ttelesaveconfig");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,19 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
spawns.set("spawns." + name + ".yaw", yaw);

pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".world", world);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".location", p.getLocation());
sender.sendMessage(pl.badge + "onJoinSpawn set successfully, don't forget to run /ttelesaveconfig");
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".x", x);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".y", y);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".z", z);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".pitch", pitch);
pl.getConfig().set("onJoinSpawn." + p.getWorld().getName() + ".yaw", yaw);

pl.saveConfig();
sender.sendMessage(pl.badge + "onJoinSpawn set successfully");


try {
spawns.save(spawnsYml);
p.sendMessage(pl.badge + "World spawn saved for world: " + ChatColor.YELLOW + "[" + ChatColor.GOLD + name + ChatColor.YELLOW + " + ]");
p.sendMessage(pl.badge + "World spawn saved for world: " + ChatColor.YELLOW + "[" + ChatColor.GOLD + name + ChatColor.YELLOW + "]");
} catch (IOException e) {
pl.makeLog(e);
p.sendMessage(pl.err + "Saving spawns file Unsuccessful");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
Player p = (Player) sender;

if (pl.getConfig().isSet("shop." + p.getWorld().getName() + ".world")) {
Location shopLoc = (Location) pl.getConfig().get("shop." + p.getWorld().getName() + ".location");
String world = pl.getConfig().getString("shop." + p.getWorld().getName() + ".world");
double x = pl.getConfig().getDouble("shop." + p.getWorld().getName() + ".x");
double y = pl.getConfig().getDouble("shop." + p.getWorld().getName() + ".y");
double z = pl.getConfig().getDouble("shop." + p.getWorld().getName() + ".z");
float pitch = (float) pl.getConfig().getDouble("shop." + p.getWorld().getName() + ".pitch");
float yaw = (float) pl.getConfig().getDouble("shop." + p.getWorld().getName() + ".yaw");
Location shopLoc = new Location(Bukkit.getWorld(world), x, y, z, pitch, yaw);
pl.shakeTP(p, shopLoc);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,19 @@ public boolean onCommand(CommandSender sender, Command cmd, String label, String
for (Player p : Bukkit.getOnlinePlayers()) {
if (p.getName().equalsIgnoreCase(args[0])) {
foundPlayer = true;
String command = "";
if (pl.getConfig().get("tptoggle." + p.getName()) == null || pl.getConfig().getInt("tptoggle." + p.getName()) == 0) {
sender.sendMessage(pl.badge + "Request to teleport " + p.getName() + " to your location sent.");
p.sendMessage("Player " + ChatColor.GOLD + sender.getName() + ChatColor.RESET + " would like you to teleport " + ChatColor.GOLD + "TO THEM");
//p.sendMessage("Please type " + ChatColor.GREEN + "/tpok " + ChatColor.RESET + "in the next " + ChatColor.GREEN + " 30 Seconds" + ChatColor.RESET + " to Accept" );
String command = "tellraw " + p.getName() + " [\"\",{\"text\":\"Please type \"},{\"text\":\"/tpok\",\"color\":\"green\"},{\"text\":\" or click \"},{\"text\":\"[HERE]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tpok\"}},{\"text\":\" in the next \"},{\"text\":\"30 Seconds\",\"color\":\"green\"},{\"text\":\" to Accept\"}]";
if(!sender.getName().equalsIgnoreCase("Joeynator")) {
p.sendMessage("Player " + ChatColor.GOLD + sender.getName() + ChatColor.RESET + " would like you to teleport " + ChatColor.GOLD + "TO THEM");
//p.sendMessage("Please type " + ChatColor.GREEN + "/tpok " + ChatColor.RESET + "in the next " + ChatColor.GREEN + " 30 Seconds" + ChatColor.RESET + " to Accept" );
command = "tellraw " + p.getName() + " [\"\",{\"text\":\"Please type \"},{\"text\":\"/tpok\",\"color\":\"green\"},{\"text\":\" or click \"},{\"text\":\"[HERE]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tpok\"}},{\"text\":\" in the next \"},{\"text\":\"30 Seconds\",\"color\":\"green\"},{\"text\":\" to Accept\"}]";
}
else{
p.sendMessage("Player " + ChatColor.GOLD + sender.getName() + ChatColor.RED + " would like you to teleport " + ChatColor.GOLD + "TO THEM so they can drop you into the void or fuck you over some other way");
//p.sendMessage("Please type " + ChatColor.GREEN + "/tpok " + ChatColor.RESET + "in the next " + ChatColor.GREEN + " 30 Seconds" + ChatColor.RESET + " to Accept" );
command = "tellraw " + p.getName() + " [\"\",{\"text\":\"Please DON'T type \"},{\"text\":\"/tpok\",\"color\":\"green\"},{\"text\":\" or click \"},{\"text\":\"[HERE]\",\"color\":\"gold\",\"clickEvent\":{\"action\":\"run_command\",\"value\":\"/tpok\"}},{\"text\":\" in the next \"},{\"text\":\"30 Seconds\",\"color\":\"green\"},{\"text\":\" unless you Accept that you do this at your own risk\"}]";
}
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
pl.getConfig().set("tpRequest." + p.getName() + ".type", "toSender");
pl.getConfig().set("tpRequest." + p.getName() + ".requestTime", System.currentTimeMillis());
Expand Down
25 changes: 14 additions & 11 deletions src/main/java/me/shakeforprotein/treeboteleport/Commands/Wild.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,22 @@ public Wild(TreeboTeleport main) {

@Override
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (pl.getCD((Player) sender)) {
sender.sendMessage(pl.badge + "Checking for safe location. This may take a moment.");
if (args.length == 1 && sender.hasPermission("tbteleport.staff.wild.other")) {
String command = "wild";
OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[0]);
if (targetPlayer instanceof Player) {
Bukkit.dispatchCommand((Player) targetPlayer, command);
} else {
sender.sendMessage(pl.err + "Player not found");
}
} else if (sender instanceof Player) {

if (args.length == 1 && sender.hasPermission("tbteleport.staff.wild.other")) {
OfflinePlayer targetPlayer = Bukkit.getOfflinePlayer(args[0]);
World w = ((Player) targetPlayer).getWorld();
if (targetPlayer instanceof Player) {
pl.shakeTP(((Player)targetPlayer), (findSafeBlock(w, ((Player) targetPlayer))));
} else {
sender.sendMessage(pl.err + "Player not found");
}
}
else if (sender instanceof Player) {
if (!pl.getCD((Player) sender)) {
sender.sendMessage(pl.badge + "Checking for safe location. This may take a moment.");
Player player = (Player) sender;
World w = player.getWorld();

if (args.length == 0) {

pl.shakeTP(((Player) sender), (findSafeBlock(w, (Player) sender)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bukkit.inventory.InventoryView;

import java.io.File;
import java.util.ConcurrentModificationException;


public class HomeMenuInventoryListener implements Listener {
Expand Down Expand Up @@ -48,7 +49,7 @@ public void invClickEvent(InventoryClickEvent e) {
} else {
for (String item : homesMenu.getConfigurationSection("homes").getKeys(false)) {
if (ChatColor.stripColor(inv.getItem(slot).getItemMeta().getDisplayName()).equalsIgnoreCase(homesMenu.getString("homes." + item + ".name"))) {
Bukkit.dispatchCommand(p, "home " + ChatColor.stripColor(inv.getItem(slot).getItemMeta().getDisplayName()));
Bukkit.dispatchCommand(p, "home " + inv.getItem(slot).getItemMeta().getDisplayName());
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
package me.shakeforprotein.treeboteleport.Listeners;

import me.shakeforprotein.treeboteleport.TreeboTeleport;
import org.bukkit.entity.*;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;

public class KillZombies implements Listener {

private TreeboTeleport pl;

public KillZombies(TreeboTeleport main) {
this.pl = main;
}

@EventHandler
public void onMobSpawn(EntitySpawnEvent e) {
if (pl.getConfig().getBoolean("KillZombies")) {
if ((e.getEntity() instanceof Zombie || e.getEntity() instanceof Drowned || e.getEntity() instanceof ZombieVillager) && !(e.getEntity() instanceof PigZombie)) {
if (e.getEntity() instanceof Drowned) {
((Drowned) e.getEntity()).setAI(false);
} else if (e.getEntity() instanceof ZombieVillager) {
((ZombieVillager) e.getEntity()).setAI(false);
} else if (e.getEntity() instanceof Zombie) {
((Zombie) e.getEntity()).setAI(false);
}
}
}
if (pl.getConfig().getBoolean("ReplacePhantomsWithPissedOffWolves")) {
if (e.getEntity() instanceof Phantom) {
e.setCancelled(true);
}
}
}

@EventHandler
public void onChunkLoad(ChunkLoadEvent e) {
for (Entity ent : e.getChunk().getEntities()) {
if ((ent instanceof Zombie) || (ent instanceof Spider) || (ent instanceof Bat) || (ent instanceof Skeleton) || (ent instanceof Enderman) || (ent instanceof Illager) || ((ent instanceof Fish) && !(ent instanceof PufferFish)) || (ent instanceof Silverfish) || (ent instanceof Slime) || (ent instanceof Blaze) || (ent instanceof Guardian) || (ent instanceof Ghast) || (ent instanceof Vex) || (ent instanceof Phantom) || (ent instanceof SkeletonHorse) || (ent instanceof Rabbit) || (ent instanceof Squid)){
ent.remove();
}
}
}
}
Loading

0 comments on commit dcba808

Please sign in to comment.