Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .idea/checkstyle-idea.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions .idea/jarRepositories.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

158 changes: 97 additions & 61 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,67 +1,103 @@
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.justbru00</groupId>
<artifactId>epicrename</artifactId>
<version>3.12.2</version>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.gmail.justbru00</groupId>
<artifactId>EpicRename</artifactId>
<version>3.12.2</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.14.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<artifactSet>
<includes>
<include>com.tcoded:FoliaLib</include>
</includes>
</artifactSet>
<relocations>
<relocation>
<pattern>com.tcoded.folialib</pattern>
<shadedPattern>com.gmail.justbru00.libs.folialib</shadedPattern>
</relocation>
</relocations>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
<repository>
<id>tcoded-releases</id>
<url>https://repo.tcoded.com/releases</url>
</repository>
</repositories>

<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
<dependencies>
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.bukkit</groupId>
<artifactId>bukkit</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17.1-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.tcoded</groupId>
<artifactId>FoliaLib</artifactId>
<version>0.5.1</version>
<scope>compile</scope>
</dependency>
</dependencies>

</project>
</project>
57 changes: 28 additions & 29 deletions src/com/gmail/justbru00/epic/rename/commands/v3/AddLoreLine.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,92 +34,92 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
if (!command.getName().equalsIgnoreCase("addloreline")) {
return false;
}

if (!sender.hasPermission("epicrename.addloreline")) {
Messager.msgSenderWithConfigMsg("addloreline.no_permission", sender);
return true;
}

if (!(sender instanceof Player)) {
Messager.msgSenderWithConfigMsg("addloreline.wrong_sender", sender);
return true;
}

Player player = (Player) sender;
if (!WorldChecker.checkWorld(player)) {
Messager.msgSenderWithConfigMsg("addloreline.disabled_world", sender);
return true;
}

ItemStack inHand = RenameUtil.getInHand(player);
Material m = inHand.getType();

if (!Blacklists.checkTextBlacklist(args, player)) {
Messager.msgPlayer(Main.getMsgFromConfig("setloreline.blacklisted_word_found"), player);
return true;
}

if (!Blacklists.checkMaterialBlacklist(RenameUtil.getInHand(player).getType(), player)) {
Messager.msgPlayer(Main.getMsgFromConfig("addloreline.blacklisted_material_found"), player);
return true;
}

if (!Blacklists.checkExistingName(player)) {
Messager.msgPlayer(Main.getMsgFromConfig("addloreline.blacklisted_existing_name_found"), player);
return true;
}

if (!Blacklists.checkExistingLore(player)) {
Messager.msgPlayer(Main.getMsgFromConfig("addloreline.blacklisted_existing_lore_found"), player);
return true;
}

if (!MaterialPermManager.checkPerms(EpicRenameCommands.ADDLORELINE, inHand, player)) {
Messager.msgPlayer(Main.getMsgFromConfig("addloreline.no_permission_for_material"), player);
return true;
}
if ((m == Material.AIR || m == null)) {

if (m == Material.AIR) {
Messager.msgPlayer(Main.getMsgFromConfig("addloreline.cannot_edit_air"), player);
return true;
}

if (!FormattingPermManager.checkPerms(EpicRenameCommands.ADDLORELINE, args, player)) {
// FormattingPermManager handles the message.
return true;
}

if (args.length == 0) {
Messager.msgPlayer(Main.getMsgFromConfig("addloreline.wrong_args"), player);
return true;
}

StringBuilder builder = new StringBuilder();
for (int i = 0; i < args.length; i++) {
builder.append(args[i] + " ");
}

for (String arg : args) {
builder.append(arg).append(" ");
}

String loreToBeSet = builder.toString().trim();

if (!FormattingCodeCounter.checkMinColorCodes(player, loreToBeSet, EpicRenameCommands.ADDLORELINE, true)) {
FormattingCodeCounter.sendMinNotReachedMsg(player, EpicRenameCommands.ADDLORELINE);
return true;
}

if (!FormattingCodeCounter.checkMaxColorCodes(player, loreToBeSet, EpicRenameCommands.ADDLORELINE, true)) {
FormattingCodeCounter.sendMaxReachedMsg(player, EpicRenameCommands.ADDLORELINE);
return true;
}

ItemMeta im = inHand.getItemMeta();
List<String> newLore = new ArrayList<String>();

List<String> newLore = new ArrayList<>();

if (im.hasLore()) {
newLore = im.getLore();
}

newLore.add(Messager.color(loreToBeSet));
im.setLore(newLore);
inHand.setItemMeta(im);
Expand All @@ -128,10 +128,9 @@ public boolean onCommand(CommandSender sender, Command command, String label, St
} else {
player.setItemInHand(inHand);
}

Messager.msgPlayer(Main.getMsgFromConfig("addloreline.success"), player);

return true;
}

}
Loading