use of com.github.vaerys.objects.ReplaceObject in project DiscordSailv2 by Vaerys-Dawn.
the class TagIfRoleReplace method execute.
@Override
public String execute(String from, CommandObject command, String args, List<ReplaceObject> toReplace) {
List<String> splitString = getSplit(from);
from = removeFirstTag(from);
boolean found = false;
for (IRole r : command.user.roles) {
if (StringUtils.containsIgnoreCase(r.getName(), splitString.get(0))) {
found = true;
}
}
if (found) {
toReplace.add(new ReplaceObject(splitString.get(1), splitString.get(2)));
} else {
toReplace.add(new ReplaceObject(splitString.get(1), splitString.get(3)));
}
return from;
}
use of com.github.vaerys.objects.ReplaceObject in project DiscordSailv2 by Vaerys-Dawn.
the class TagReplaceRandom method execute.
@Override
public String execute(String from, CommandObject command, String args, List<ReplaceObject> toReplace) {
List<String> splitArgs = getSplit(from);
Random random = new Random();
int randomNum = random.nextInt(splitArgs.size() - 1);
from = removeFirstTag(from);
toReplace.add(new ReplaceObject(splitArgs.get(0), splitArgs.get(randomNum + 1)));
return from;
}
use of com.github.vaerys.objects.ReplaceObject in project DiscordSailv2 by Vaerys-Dawn.
the class TagIfArgsReplace method execute.
@Override
public String execute(String from, CommandObject command, String args, List<ReplaceObject> toReplace) {
List<String> splitString = getSplit(from);
from = removeFirstTag(from);
if (StringUtils.containsIgnoreCase(args, splitString.get(0))) {
toReplace.add(new ReplaceObject(splitString.get(1), splitString.get(2)));
} else {
toReplace.add(new ReplaceObject(splitString.get(1), splitString.get(3)));
}
return from;
}
Aggregations