-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
20 changed files
with
402 additions
and
175 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
39 changes: 39 additions & 0 deletions
39
src/main/java/me/shakeforprotein/treeboteleport/Commands/Back.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,39 @@ | ||
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; | ||
import org.bukkit.configuration.file.FileConfiguration; | ||
import org.bukkit.configuration.file.YamlConfiguration; | ||
import org.bukkit.entity.Player; | ||
|
||
import java.io.File; | ||
|
||
public class Back implements CommandExecutor { | ||
|
||
private TreeboTeleport pl; | ||
|
||
public Back(TreeboTeleport main) { | ||
this.pl = main; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
Player p = (Player) sender; | ||
String pUUID = "player_" + p.getUniqueId(); | ||
|
||
File lastLocFile = new File(pl.getDataFolder(), "lastLocation.yml"); | ||
FileConfiguration lastLocConf = YamlConfiguration.loadConfiguration(lastLocFile); | ||
|
||
if(lastLocConf.isSet(pUUID + ".location")){ | ||
p.sendMessage(pl.badge + "Sending you to your previous location"); | ||
p.teleport((Location) lastLocConf.get(pUUID + ".location")); | ||
} | ||
else{ | ||
p.sendMessage(pl.err + "Could not find previous location"); | ||
} | ||
return true; | ||
} | ||
} |
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
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
36 changes: 36 additions & 0 deletions
36
src/main/java/me/shakeforprotein/treeboteleport/Commands/TpNo.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,36 @@ | ||
package me.shakeforprotein.treeboteleport.Commands; | ||
|
||
import me.shakeforprotein.treeboteleport.TreeboTeleport; | ||
import org.bukkit.Bukkit; | ||
import org.bukkit.OfflinePlayer; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
|
||
|
||
public class TpNo implements CommandExecutor { | ||
|
||
private TreeboTeleport pl; | ||
|
||
public TpNo(TreeboTeleport main){ | ||
this.pl = main; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
Player p = (Player) sender; | ||
pl.getConfig().set("tpRequest." + p.getName() + ".type", "toSender"); | ||
pl.getConfig().set("tpRequest." + p.getName() + ".requestTime", 0); | ||
pl.getConfig().set("tpRequest." + p.getName() + ".requester", sender.getName()); | ||
sender.sendMessage("Teleport request has been denied."); | ||
for(OfflinePlayer offPlayer : Bukkit.getOfflinePlayers()){ | ||
if(offPlayer.getName().equalsIgnoreCase(pl.getConfig().getString("tpRequest." + p.getName() + ".requester"))){ | ||
if(offPlayer instanceof Player){ | ||
((Player) offPlayer).sendMessage(pl.badge + p.getName() + "has denied your teleport request."); | ||
} | ||
} | ||
} | ||
return true; | ||
} | ||
} |
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
33 changes: 33 additions & 0 deletions
33
src/main/java/me/shakeforprotein/treeboteleport/Commands/TpToggle.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,33 @@ | ||
package me.shakeforprotein.treeboteleport.Commands; | ||
|
||
import me.shakeforprotein.treeboteleport.TreeboTeleport; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
|
||
public class TpToggle implements CommandExecutor{ | ||
|
||
private TreeboTeleport pl; | ||
|
||
public TpToggle(TreeboTeleport main) { | ||
this.pl = main; | ||
} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
if(pl.getConfig().get("tptoggle." + pl.getName()) == null){ | ||
pl.getConfig().set("tptoggle." + pl.getName(), 1); | ||
sender.sendMessage(pl.badge + "Teleport requests have been toggled OFF"); | ||
} | ||
else if(pl.getConfig().getInt("tptoggle." + sender.getName()) == 1){ | ||
pl.getConfig().set("tptoggle." + sender.getName(), 0); | ||
sender.sendMessage(pl.badge + "Teleport requests have been toggled ON"); | ||
} | ||
else if(pl.getConfig().getInt("tptoggle." + sender.getName()) == 0){ | ||
pl.getConfig().set("tptoggle." + sender.getName(), 1); | ||
sender.sendMessage(pl.badge + "Teleport requests have been toggled OFF"); | ||
} | ||
return true; | ||
|
||
} | ||
} |
Oops, something went wrong.