Skip to content

Commit

Permalink
code cleanup, add todos, logs
Browse files Browse the repository at this point in the history
  • Loading branch information
UsainSrht committed Jan 9, 2024
1 parent c864607 commit 5444d3b
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 9 deletions.
10 changes: 4 additions & 6 deletions src/main/java/me/usainsrht/uhomes/UHomes.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ public void onEnable() {

this.homeManager = new HomeManager(this);
this.teleportManager = new TeleportManager(this);
//Bukkit.getScheduler().runTaskLater(this, () -> {
Object claimAPI = null;
if (getServer().getPluginManager().isPluginEnabled("Lands")) claimAPI = LandsIntegration.of(this);
else if (getServer().getPluginManager().isPluginEnabled("GriefPrevention")) claimAPI = GriefPrevention.instance;
this.claimManager = new ClaimManager(this, claimAPI);
//}, 1L);
Object claimAPI = null;
if (getServer().getPluginManager().isPluginEnabled("Lands")) claimAPI = LandsIntegration.of(this);
else if (getServer().getPluginManager().isPluginEnabled("GriefPrevention")) claimAPI = GriefPrevention.instance;
this.claimManager = new ClaimManager(this, claimAPI);

loadConfig();

Expand Down
2 changes: 2 additions & 0 deletions src/main/java/me/usainsrht/uhomes/command/HomeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.kyori.adventure.text.Component;
import net.kyori.adventure.text.minimessage.MiniMessage;
import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder;
import org.bukkit.Bukkit;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
Expand Down Expand Up @@ -88,6 +89,7 @@ public boolean execute(CommandSender sender, String command, String[] args) {
homesFuture.thenAccept(homes -> {
for (Home home : homes) {
if (home.getName() != null && home.getName().equalsIgnoreCase(name)) {
Bukkit.broadcastMessage("tp call from cmd");
homeManager.teleport(player, home);
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import me.usainsrht.uhomes.command.SetHomeCommand;
import me.usainsrht.uhomes.gui.HomeButtonAction;
import me.usainsrht.uhomes.gui.HomesGUI;
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
Expand Down Expand Up @@ -55,8 +56,12 @@ public void onClick(InventoryClickEvent e) {
HomeButtonAction action = HomeButtonAction.getFromClick(e.getClick());
if (action == null) return;
player.closeInventory();
Bukkit.broadcastMessage("tp call from click " + action);
switch (action) {
case TELEPORT -> homeManager.teleport(player, home);
case TELEPORT -> {
Bukkit.broadcastMessage("case teleport");
homeManager.teleport(player, home);
}
case RELOCATE -> {
homeManager.relocate(player, home);
HomesGUI.open(home.getOwner(), player);
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/me/usainsrht/uhomes/manager/ClaimManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ public Object getClaimAPI() {
}

public boolean canEnter(Player player, Location location) {
if (claimAPI instanceof LandsIntegration api) {
if (claimAPI == null) return true;
//todo stops code silently when class is undefined
else if (claimAPI instanceof LandsIntegration api) {
Area area = api.getArea(location);
if (area == null) return true;
return (area.isTrusted(player.getUniqueId()));
Expand Down
1 change: 0 additions & 1 deletion src/main/java/me/usainsrht/uhomes/manager/HomeManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ public void teleport(Entity entity, Home home) {
SoundUtil.play(entity, MainConfig.getSound("teleport_start"));
})
;

plugin.getTeleportManager().start(timedTeleport);
}

Expand Down

0 comments on commit 5444d3b

Please sign in to comment.