-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ready to start testing for release 3.12
- Loading branch information
Showing
7 changed files
with
330 additions
and
2 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
49 changes: 49 additions & 0 deletions
49
src/com/gmail/justbru00/epic/rename/tabcompleters/EpicRenameTabCompleter.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,49 @@ | ||
package com.gmail.justbru00.epic.rename.tabcompleters; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
public class EpicRenameTabCompleter implements TabCompleter { | ||
|
||
private ArrayList<String> epicrenameFirstArgumentList = new ArrayList<String>(); | ||
private ArrayList<String> empty = new ArrayList<String>(); | ||
|
||
public EpicRenameTabCompleter() { | ||
epicrenameFirstArgumentList.add("help"); | ||
epicrenameFirstArgumentList.add("license"); | ||
epicrenameFirstArgumentList.add("reload"); | ||
epicrenameFirstArgumentList.add("debug"); | ||
epicrenameFirstArgumentList.add("version"); | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
|
||
if (!command.getName().equalsIgnoreCase("epicrename")) { | ||
return null; | ||
} | ||
|
||
if (args.length == 1) { | ||
if (!args[0].equals("")) { | ||
ArrayList<String> completion = new ArrayList<String>(); | ||
|
||
for (String first : epicrenameFirstArgumentList) { | ||
if (first.toLowerCase().startsWith(args[0].toLowerCase())) { | ||
completion.add(first); | ||
} | ||
} | ||
|
||
return completion; | ||
} else { | ||
return epicrenameFirstArgumentList; | ||
} | ||
} | ||
|
||
return empty; | ||
} | ||
|
||
} |
45 changes: 45 additions & 0 deletions
45
src/com/gmail/justbru00/epic/rename/tabcompleters/ExportTabCompleter.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,45 @@ | ||
package com.gmail.justbru00.epic.rename.tabcompleters; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
public class ExportTabCompleter implements TabCompleter { | ||
|
||
private ArrayList<String> exportFirstArgumentList = new ArrayList<String>(); | ||
private ArrayList<String> empty = new ArrayList<String>(); | ||
|
||
public ExportTabCompleter() { | ||
exportFirstArgumentList.add("hand"); | ||
exportFirstArgumentList.add("inventory"); | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
if (!command.getName().equalsIgnoreCase("export")) { | ||
return null; | ||
} | ||
|
||
if (args.length == 1) { | ||
if (!args[0].equals("")) { | ||
ArrayList<String> completion = new ArrayList<String>(); | ||
|
||
for (String first : exportFirstArgumentList) { | ||
if (first.toLowerCase().startsWith(args[0].toLowerCase())) { | ||
completion.add(first); | ||
} | ||
} | ||
|
||
return completion; | ||
} else { | ||
return exportFirstArgumentList; | ||
} | ||
} | ||
|
||
return empty; | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
src/com/gmail/justbru00/epic/rename/tabcompleters/GenericNoArgsTabCompleter.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,28 @@ | ||
package com.gmail.justbru00.epic.rename.tabcompleters; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
public class GenericNoArgsTabCompleter implements TabCompleter { | ||
|
||
private ArrayList<String> empty = new ArrayList<String>(); | ||
private String commandName; | ||
|
||
public GenericNoArgsTabCompleter(String _commandName) { | ||
commandName = _commandName; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
if (!command.getName().equalsIgnoreCase(commandName)) { | ||
return null; | ||
} | ||
|
||
return empty; | ||
} | ||
|
||
} |
36 changes: 36 additions & 0 deletions
36
src/com/gmail/justbru00/epic/rename/tabcompleters/GenericOneArgTabCompleter.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 com.gmail.justbru00.epic.rename.tabcompleters; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
public class GenericOneArgTabCompleter implements TabCompleter { | ||
|
||
private ArrayList<String> empty = new ArrayList<String>(); | ||
private ArrayList<String> firstArgument = new ArrayList<String>(); | ||
private String commandName; | ||
|
||
public GenericOneArgTabCompleter(String _commandName, String _firstArgument) { | ||
firstArgument.add(_firstArgument); | ||
commandName = _commandName; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
if (!command.getName().equalsIgnoreCase(commandName)) { | ||
return null; | ||
} | ||
|
||
if (args.length == 1) { | ||
if (args[0].equals("")) { | ||
return firstArgument; | ||
} | ||
} | ||
|
||
return empty; | ||
} | ||
|
||
} |
44 changes: 44 additions & 0 deletions
44
src/com/gmail/justbru00/epic/rename/tabcompleters/GenericTwoArgTabCompleter.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,44 @@ | ||
package com.gmail.justbru00.epic.rename.tabcompleters; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
public class GenericTwoArgTabCompleter implements TabCompleter { | ||
|
||
private ArrayList<String> empty = new ArrayList<String>(); | ||
private ArrayList<String> firstArgument = new ArrayList<String>(); | ||
private ArrayList<String> secondArgument = new ArrayList<String>(); | ||
private String commandName; | ||
|
||
public GenericTwoArgTabCompleter(String _commandName, String _firstArgument, String _secondArgument) { | ||
firstArgument.add(_firstArgument); | ||
secondArgument.add(_secondArgument); | ||
commandName = _commandName; | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
if (!command.getName().equalsIgnoreCase(commandName)) { | ||
return null; | ||
} | ||
|
||
if (args.length == 1) { | ||
if (args[0].equals("")) { | ||
return firstArgument; | ||
} | ||
} | ||
|
||
if (args.length == 2) { | ||
if (args[1].equals("")) { | ||
return secondArgument; | ||
} | ||
} | ||
|
||
return empty; | ||
} | ||
|
||
} |
87 changes: 87 additions & 0 deletions
87
src/com/gmail/justbru00/epic/rename/tabcompleters/ImportTabCompleter.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,87 @@ | ||
package com.gmail.justbru00.epic.rename.tabcompleters; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.command.TabCompleter; | ||
|
||
public class ImportTabCompleter implements TabCompleter { | ||
|
||
private ArrayList<String> importFirstArgumentList = new ArrayList<String>(); | ||
private ArrayList<String> importHandInventorySecondArgumentList = new ArrayList<String>(); | ||
private ArrayList<String> importRawSecondArgumentList = new ArrayList<String>(); | ||
private ArrayList<String> empty = new ArrayList<String>(); | ||
|
||
public ImportTabCompleter() { | ||
importFirstArgumentList.add("hand"); | ||
importFirstArgumentList.add("inventory"); | ||
importFirstArgumentList.add("raw"); | ||
|
||
importHandInventorySecondArgumentList.add("<webUrl>"); | ||
|
||
importRawSecondArgumentList.add("<rawYAML>"); | ||
} | ||
|
||
@Override | ||
public List<String> onTabComplete(CommandSender sender, Command command, String alias, String[] args) { | ||
if (!command.getName().equalsIgnoreCase("import")) { | ||
return null; | ||
} | ||
|
||
if (args.length == 1) { | ||
if (!args[0].equals("")) { | ||
ArrayList<String> completion = new ArrayList<String>(); | ||
|
||
for (String first : importFirstArgumentList) { | ||
if (first.toLowerCase().startsWith(args[0].toLowerCase())) { | ||
completion.add(first); | ||
} | ||
} | ||
|
||
return completion; | ||
} else { | ||
return importFirstArgumentList; | ||
} | ||
} else if (args.length == 2) { | ||
if (!args[1].equals("")) { | ||
if (args[0].toLowerCase().equals("hand") || args[0].toLowerCase().equals("inventory")) { | ||
ArrayList<String> completion = new ArrayList<String>(); | ||
|
||
for (String second : importHandInventorySecondArgumentList) { | ||
if (second.toLowerCase().startsWith(args[1].toLowerCase())) { | ||
completion.add(second); | ||
} | ||
} | ||
|
||
return completion; | ||
} else if (args[0].toLowerCase().equals("raw")) { | ||
ArrayList<String> completion = new ArrayList<String>(); | ||
|
||
for (String second : importRawSecondArgumentList) { | ||
if (second.toLowerCase().startsWith(args[1].toLowerCase())) { | ||
completion.add(second); | ||
} | ||
} | ||
|
||
return completion; | ||
} else { | ||
return empty; | ||
} | ||
} else { | ||
// No text in second argument yet | ||
if (args[0].toLowerCase().equals("hand") || args[0].toLowerCase().equals("inventory")) { | ||
return importHandInventorySecondArgumentList; | ||
} else if (args[0].toLowerCase().equals("raw")) { | ||
return importRawSecondArgumentList; | ||
} else { | ||
return empty; | ||
} | ||
} | ||
} | ||
|
||
return empty; | ||
} | ||
|
||
} |