Skip to content

Commit

Permalink
2.6.8 Update
Browse files Browse the repository at this point in the history
  • Loading branch information
LOOHP committed Jul 23, 2020
1 parent 14a6dc9 commit a3d8c21
Show file tree
Hide file tree
Showing 8 changed files with 1,454 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/com/loohp/interactivechat/ConfigManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ public static void loadConfig() {
e.printStackTrace();
}

if (InteractiveChat.plugin.getConfig().contains("Secret.t")) {
InteractiveChat.t = InteractiveChat.plugin.getConfig().getBoolean("Secret.t");
}

InteractiveChat.usePlayerName = getConfig().getBoolean("Player.UsePlayerNameInteraction");
InteractiveChat.usePlayerNameHoverEnable = getConfig().getBoolean("Player.Hover.Enable");
List<String> stringList = getConfig().getStringList("Player.Hover.Text");
Expand Down
2 changes: 2 additions & 0 deletions src/com/loohp/interactivechat/InteractiveChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ public class InteractiveChat extends JavaPlugin {
public static boolean EssentialsHook = false;
public static boolean ChatManagerHook = false;

public static boolean t = true;

public static boolean useItem = true;
public static boolean useInventory = true;
public static boolean useEnder = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,11 @@ public static BaseComponent process(BaseComponent basecomponent, Optional<Player
basecomponent = processCustomPlaceholder(parseplayer, casesensitive, placeholder, cooldown, hoverEnabled, hoverText, clickEnabled, clickAction, clickValue, replaceEnabled, replaceText, basecomponent, optplayer, messageKey, unix);
}

String henry = random.nextInt(100) < 80 ? "§7\"§fTerraria is love, Terraria is life§7\"\n §7~§a§oHenry §e§o(IC Icon Artist)" : "§fShow §a§oHenry §e§o(IC Icon Artist) §fsome §cLOVE§f!\n§bClick me!\n §a~From the IC author";
basecomponent = processCustomPlaceholder(reciever, false, "Terraria", 0, true, henry, true, Action.OPEN_URL, "https://www.reddit.com/user/henryauyong", true, "§2Terraria", basecomponent, optplayer, messageKey, unix);

if (InteractiveChat.t) {
String henry = random.nextInt(100) < 80 ? "§7\"§fTerraria is love, Terraria is life§7\"\n §7~§a§oHenry §e§o(IC Icon Artist)" : "§fShow §a§oHenry §e§o(IC Icon Artist) §fsome §cLOVE§f!\n§bClick me!\n §a~From the IC author";
basecomponent = processCustomPlaceholder(reciever, false, "Terraria", 0, true, henry, true, Action.OPEN_URL, "https://www.reddit.com/user/henryauyong", true, "§2Terraria", basecomponent, optplayer, messageKey, unix);
}

return basecomponent;
}

Expand Down
13 changes: 13 additions & 0 deletions src/com/loohp/interactivechat/Modules/ItemDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import com.loohp.interactivechat.Utils.CustomStringUtils;
import com.loohp.interactivechat.Utils.ItemNBTUtils;
import com.loohp.interactivechat.Utils.MaterialUtils;
import com.loohp.interactivechat.Utils.NBTUtils;
import com.loohp.interactivechat.Utils.RarityUtils;

import me.clip.placeholderapi.PlaceholderAPI;
Expand Down Expand Up @@ -235,6 +236,12 @@ public static BaseComponent process(BaseComponent basecomponent, Optional<Player
if (useTranslatable) {
if (!InteractiveChat.version.isLegacy()) {
TranslatableComponent transItem = new TranslatableComponent(itemString);
if (item.getType().equals(Material.PLAYER_HEAD)) {
String owner = NBTUtils.getString(item, "SkullOwner", "Name");
if (owner != null) {
transItem.addWith(owner);
}
}
transItem.setColor(RarityUtils.getRarityColor(item));
if (!isAir) {
transItem.setHoverEvent(hoverItem);
Expand Down Expand Up @@ -286,6 +293,12 @@ public static BaseComponent process(BaseComponent basecomponent, Optional<Player
if (!InteractiveChat.version.isLegacy()) {
TranslatableComponent transItem = new TranslatableComponent(itemString);
transItem.setColor(RarityUtils.getRarityColor(item));
if (item.getType().equals(Material.PLAYER_HEAD)) {
String owner = NBTUtils.getString(item, "SkullOwner", "Name");
if (owner != null) {
transItem.addWith(owner);
}
}
if (!isAir) {
transItem.setHoverEvent(hoverItem);
}
Expand Down
4 changes: 2 additions & 2 deletions src/com/loohp/interactivechat/Modules/MentionDisplay.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ public static BaseComponent processPlayer(String placeholder, Player reciever, P
} else {
TextComponent textcomponent = (TextComponent) base;
String text = textcomponent.getText();
String regex = CustomStringUtils.getIgnoreColorCodeRegex(CustomStringUtils.escapeMetaCharacters(placeholder));
String regex = "(?i)" + CustomStringUtils.getIgnoreColorCodeRegex(CustomStringUtils.escapeMetaCharacters(placeholder));

if (!text.matches("(?i).*" + regex + ".*")) {
if (!text.matches(".*" + regex + ".*")) {
newlist.add(textcomponent);
continue;
}
Expand Down
7 changes: 7 additions & 0 deletions src/com/loohp/interactivechat/Utils/MaterialUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ public static String getMinecraftLangName(ItemStack item) {
String namespace = PotionUtils.getVanillaPotionName(meta.getBasePotionData().getType());
path = new StringBuilder().append(path).append(".effect.").append(namespace).toString();
}

if (item.getType().equals(Material.PLAYER_HEAD)) {
String owner = NBTUtils.getString(item, "SkullOwner", "Name");
if (owner != null) {
path += ".named";
}
}

return path;
}
Expand Down
Loading

0 comments on commit a3d8c21

Please sign in to comment.