-
-
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.
- Loading branch information
Showing
25 changed files
with
645 additions
and
50 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
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
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
63 changes: 63 additions & 0 deletions
63
src/main/java/tk/pandadev/essentialsp/commands/SettingsCommand.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,63 @@ | ||
package tk.pandadev.essentialsp.commands; | ||
|
||
import org.bukkit.Sound; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
import org.bukkit.entity.Player; | ||
import tk.pandadev.essentialsp.Main; | ||
import tk.pandadev.essentialsp.guis.MainGui; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
public class SettingsCommand implements CommandExecutor, TabCompleter { | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { | ||
|
||
if (!(sender instanceof Player)) { | ||
sender.sendMessage(Main.getPrefix() + "§6Du musst diesen Command als Spieler ausführen!"); | ||
return false; | ||
} | ||
|
||
Player player = (Player) (sender); | ||
|
||
if (args.length == 0){ | ||
if (player.hasPermission("essentialsp.settings")){ | ||
try { | ||
player.openInventory(MainGui.getInventory(player)); | ||
} catch (IllegalAccessException | NoSuchFieldException e) { | ||
e.printStackTrace(); | ||
} | ||
player.playSound(player.getLocation(), Sound.BLOCK_BARREL_OPEN, 100, 1); | ||
} else { | ||
player.sendMessage(Main.getNoPerm()); | ||
} | ||
} else { | ||
player.sendMessage(Main.getPrefix() + "§c/settings"); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) { | ||
Player playert = (Player) (sender); | ||
ArrayList<String> list = new ArrayList<String>(); | ||
|
||
|
||
|
||
ArrayList<String> completerList = new ArrayList<String>(); | ||
String currentarg = args[args.length - 1].toLowerCase(); | ||
for (String s : list) { | ||
String s1 = s.toLowerCase(); | ||
if (!s1.startsWith(currentarg)) continue; | ||
completerList.add(s); | ||
} | ||
|
||
return completerList; | ||
} | ||
|
||
} |
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
Oops, something went wrong.