Skip to content

Commit

Permalink
Added /whereami
Browse files Browse the repository at this point in the history
  • Loading branch information
Swofty-Developments committed Jan 17, 2024
1 parent 951d9f3 commit 8aa2870
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import ninja.leaping.configurate.objectmapping.ObjectMappingException;
import org.bukkit.*;
import org.bukkit.command.CommandMap;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.plugin.java.JavaPlugin;
import org.reflections.Reflections;
Expand Down Expand Up @@ -67,6 +68,7 @@ public void onLoad() {
ex.printStackTrace();
return;
}

LoaderUtils.registerLoaders();

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.bukkit.ChatColor;
import org.bukkit.World;
import org.bukkit.command.CommandSender;
import org.spigotmc.event.player.PlayerSpawnLocationEvent;

import java.util.Collections;
import java.util.LinkedList;
Expand All @@ -36,6 +37,8 @@ public void run(CommandSource sender, String[] args) {
worldData.setSpawn(sender.getPlayer().getLocation().getBlockX() + ", " + sender.getPlayer().getLocation().getBlockY() + ", " + sender.getPlayer().getLocation().getBlockZ());
config.save();

world.setSpawnLocation(sender.getPlayer().getLocation().getBlockX(), sender.getPlayer().getLocation().getBlockY(), sender.getPlayer().getLocation().getBlockZ());

sender.send(Logging.COMMAND_PREFIX + ChatColor.GREEN + "Set world spawn for world " + world.getName() + " to " + sender.getPlayer().getLocation().getBlockX() + ", " + sender.getPlayer().getLocation().getBlockY() + ", " + sender.getPlayer().getLocation().getBlockZ() + "!");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package net.swofty.swm.plugin.commands.subtypes;

import net.swofty.swm.plugin.commands.CommandParameters;
import net.swofty.swm.plugin.commands.CommandSource;
import net.swofty.swm.plugin.commands.SWMCommand;
import net.swofty.swm.plugin.log.Logging;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

import java.util.List;

@CommandParameters(description = "Prints to the player where they are", inGameOnly = true)
public class subCommand_whereami extends SWMCommand {
@Override
public void run(CommandSource sender, String[] args) {
sender.send(Logging.COMMAND_PREFIX + ChatColor.GRAY + " You are currently in " +
ChatColor.GREEN + sender.getPlayer().getWorld().getName() + ChatColor.GRAY + "!");
}

@Override
public List<String> tabCompleters(CommandSender sender, String alias, String[] args) {
return null;
}
}

0 comments on commit 8aa2870

Please sign in to comment.