Skip to content

Commit

Permalink
Merge pull request #2 from GreenSurvivors/dev
Browse files Browse the repository at this point in the history
Fix timer/access type using wrong translation key
  • Loading branch information
FireInstall authored Dec 3, 2023
2 parents 1b72080 + e7c1903 commit 8209e35
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}
// Suppiled by Jenkins
ext.majorVersion = 2
ext.minorVersion = 0
ext.minorVersion = 1
ext.minecraftVersion = "1.20.1"

ext.buildNumber = System.env.BUILD_NUMBER == null ? "x" : "build" + "$System.env.BUILD_NUMBER"
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/de/greensurvivors/padlock/PadlockAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,12 @@ public static void setInvalid(@NotNull Sign sign) {
* get the lock sign of a simple single block
*/
public static @Nullable Sign getLockSignSingleBlock(Block block, @Nullable BlockFace exempt) {
Padlock.getPlugin().getLogger().info("single block ");
for (BlockFace blockface : cardinalFaces) {
if (blockface != exempt) {
Sign sign = MiscUtils.getFacingSign(block, blockface);

// Find [Private] sign?
if (isValidLockSign(sign)) {
Padlock.getPlugin().getLogger().info("valid?");
return sign;
}
} // exempted blockface
Expand Down Expand Up @@ -557,8 +555,6 @@ public static boolean isInterfering(@NotNull Block block, @NotNull Player player
}
}


Padlock.getPlugin().getLogger().info("no.");
return false;
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/de/greensurvivors/padlock/impl/MiscUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,6 @@ public static void setBedrockPrefix(@NotNull String bedrockPrefix) {
* @return the duration in milliseconds, or zero if not possible
*/
public static long parsePeriod(@NotNull String period) {
Padlock.getPlugin().getLogger().info(period);

try { //try Iso
return Duration.parse(period).toMillis();
Expand All @@ -156,8 +155,6 @@ public static long parsePeriod(@NotNull String period) {

while (matcher.find()) {
try {
Padlock.getPlugin().getLogger().info("num: " + matcher.group(1) + ", type: " + matcher.group(2));
Padlock.getPlugin().getLogger().info(period);
long num = Long.parseLong(matcher.group(1));
String typ = matcher.group(2);
millis += switch (typ) { // from periodPattern
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public static AccessType getAccessTypeFromComp(@NotNull Component line) {
* will start an update process, if the sign is a legacy sign
*/
public static @Nullable AccessType getAccessType(@NotNull Sign sign, boolean ignoreCache) {
Padlock.getPlugin().getLogger().info("get access-type " + ignoreCache);
if (!ignoreCache && Padlock.getPlugin().getConfigManager().isCacheEnabled()) {
return Padlock.getPlugin().getLockCacheManager().getProtectedFromCache(sign.getLocation()).getAccessType();
} else {
Expand All @@ -84,7 +83,6 @@ public static AccessType getAccessTypeFromComp(@NotNull Component line) {

}

Padlock.getPlugin().getLogger().info("returned");
return accessType;
}
}
Expand Down Expand Up @@ -122,7 +120,7 @@ public static boolean isLegacyEveryOneComp(@NotNull Component component) {
@Deprecated(forRemoval = true)
private static @Nullable AccessType getLegacySetting(@NotNull Sign sign) {
for (Component line : sign.getSide(Side.FRONT).lines()) {
if (Padlock.getPlugin().getMessageManager().isLegacySignComp(line, MessageManager.LangPath.PRIVATE_SIGN)) {
if (Padlock.getPlugin().getMessageManager().isLegacySignComp(line, MessageManager.LangPath.LEGACY_PRIVATE_SIGN)) {
return AccessType.PRIVATE;
} else if (Padlock.getPlugin().getMessageManager().isLegacySignComp(line, MessageManager.LangPath.LEGACY_EVERYONE_SIGN)) {
return AccessType.PUBLIC;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public static void setInvalid(@NotNull Sign sign) {
* Check if the sign is a lock sign by checking it's first line against the line configured in the lang file.
*/
public static boolean isLockSign(@NotNull Sign sign) {
//todo second part is deprecated
return SignAccessType.getAccessType(sign, true) != null || (SignAccessType.getAccessTypeFromComp(sign.getSide(Side.FRONT).line(0)) != null);
//todo first part is deprecated
return (SignAccessType.getAccessTypeFromComp(sign.getSide(Side.FRONT).line(0)) != null) || SignAccessType.getAccessType(sign, true) != null;
}

/**
Expand Down Expand Up @@ -146,18 +146,15 @@ public static boolean isMember(@NotNull final Sign sign, UUID uuid) {
*/
@Deprecated(forRemoval = true)
public static void updateSignFromAdditional(@NotNull Sign main, @NotNull Sign additional) {
Padlock.getPlugin().getLogger().info("updating additional sign at " + additional.getLocation());
Padlock.getPlugin().getLogger().fine("updating additional sign at " + additional.getLocation());
PlainTextComponentSerializer plainedText = PlainTextComponentSerializer.plainText();
for (int i = 1; i <= 3; i++) {
String line = plainedText.serialize(additional.getSide(Side.FRONT).line(i));

Padlock.getPlugin().getLogger().info("line: " + i + ", txt " + line);

if (line.contains("#")) {
String[] splitted = line.split("#", 2);

if (splitted[1].length() == 36) { // uuid valid check
Padlock.getPlugin().getLogger().info("member uuid");
try {
addPlayer(main, false, Bukkit.getOfflinePlayer(UUID.fromString(splitted[1])));
} catch (IllegalArgumentException ignored) {
Expand All @@ -167,7 +164,6 @@ public static void updateSignFromAdditional(@NotNull Sign main, @NotNull Sign ad
OfflinePlayer maybePlayer = tryGetPlayerJustFromNameComp(additional.getSide(Side.FRONT).line(i));

if (maybePlayer != null) {
Padlock.getPlugin().getLogger().info("member");
addPlayer(main, false, maybePlayer);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SignTimer {
*/
@Deprecated(forRemoval = true)
private final static Set<Pattern> legacyPatterns = Padlock.getPlugin().getMessageManager().
getNakedLegacyText(MessageManager.LangPath.TIMER_SIGN).stream().
getNakedLegacyText(MessageManager.LangPath.LEGACY_TIMER_SIGN).stream().
map(s -> Pattern.compile(s.replace("[", "\\[(?i)").
replace("<time>", "(-?[0-9]+)"))).collect(Collectors.toSet());
// pretty complex stuff [timer:<timer>] and timer can be any number of digits with their timeunit (t, s, h, d, w or M)
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,8 @@ lock:
hopper-minecart: REMOVE
exemptions:
-
expire:
days: 999
cache:
seconds: 0
lock-default-create-time-unix: -1
bedrock-prefix: "."


Expand Down

0 comments on commit 8209e35

Please sign in to comment.