mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 12:09:07 +00:00
Obfuscation fixes
This commit is contained in:
@@ -11,13 +11,22 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
@DontObfuscate
|
||||
public class BoardManager
|
||||
{
|
||||
@DontObfuscate
|
||||
private final JavaPlugin plugin;
|
||||
|
||||
@DontObfuscate
|
||||
private BoardSettings boardSettings;
|
||||
|
||||
@DontObfuscate
|
||||
private Map<UUID, Board> scoreboards;
|
||||
|
||||
@DontObfuscate
|
||||
private BukkitTask updateTask;
|
||||
|
||||
@DontObfuscate
|
||||
public BoardManager(JavaPlugin plugin, BoardSettings boardSettings)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
@@ -27,22 +36,26 @@ public class BoardManager
|
||||
plugin.getServer().getOnlinePlayers().forEach(this::setup);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public void setBoardSettings(BoardSettings boardSettings)
|
||||
{
|
||||
this.boardSettings = boardSettings;
|
||||
scoreboards.values().forEach(board -> board.setBoardSettings(boardSettings));
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public boolean hasBoard(Player player)
|
||||
{
|
||||
return scoreboards.containsKey(player.getUniqueId());
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public Optional<Board> getBoard(Player player)
|
||||
{
|
||||
return Optional.ofNullable(scoreboards.get(player.getUniqueId()));
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public void setup(Player player)
|
||||
{
|
||||
Optional.ofNullable(scoreboards.remove(player.getUniqueId())).ifPresent(Board::resetScoreboard);
|
||||
@@ -53,16 +66,19 @@ public class BoardManager
|
||||
scoreboards.put(player.getUniqueId(), new Board(player, boardSettings));
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public void remove(Player player)
|
||||
{
|
||||
Optional.ofNullable(scoreboards.remove(player.getUniqueId())).ifPresent(Board::remove);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public Map<UUID, Board> getScoreboards()
|
||||
{
|
||||
return Collections.unmodifiableMap(scoreboards);
|
||||
}
|
||||
|
||||
@DontObfuscate
|
||||
public void onDisable()
|
||||
{
|
||||
updateTask.cancel();
|
||||
|
||||
@@ -4,9 +4,12 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@DontObfuscate
|
||||
public interface BoardProvider
|
||||
{
|
||||
@DontObfuscate
|
||||
String getTitle(Player player);
|
||||
|
||||
@DontObfuscate
|
||||
List<String> getLines(Player player);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,14 @@ package com.volmit.iris.util;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@DontObfuscate
|
||||
@Getter
|
||||
@Builder
|
||||
public class BoardSettings
|
||||
{
|
||||
@DontObfuscate
|
||||
private BoardProvider boardProvider;
|
||||
|
||||
|
||||
@DontObfuscate
|
||||
private ScoreDirection scoreDirection;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target({FIELD, TYPE, CONSTRUCTOR})
|
||||
@Target({FIELD, TYPE, CONSTRUCTOR, METHOD})
|
||||
public @interface DontObfuscate
|
||||
{
|
||||
|
||||
|
||||
@@ -160,14 +160,16 @@ public class ResourceLoader<T extends IrisRegistrant>
|
||||
{
|
||||
for(File i : folderCache.copy())
|
||||
{
|
||||
if(i.getParentFile().getName().equals(preferredFolder))
|
||||
if(i.getParentFile().getName().equals(preferredFolder) || i.getParentFile().getParentFile().getName().equals(preferredFolder))
|
||||
{
|
||||
folderCache.remove(i);
|
||||
folderCache.add(0, i);
|
||||
Iris.verbose("Prefering " + i.getPath() + " in the folder cache because we prefer " + preferredFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lock.unlock();
|
||||
|
||||
return folderCache;
|
||||
@@ -193,9 +195,11 @@ public class ResourceLoader<T extends IrisRegistrant>
|
||||
|
||||
public void clearCache()
|
||||
{
|
||||
lock.lock();
|
||||
possibleKeys = null;
|
||||
loadCache.clear();
|
||||
folderCache = null;
|
||||
lock.unlock();
|
||||
}
|
||||
|
||||
public File fileFor(T b)
|
||||
@@ -228,12 +232,15 @@ public class ResourceLoader<T extends IrisRegistrant>
|
||||
|
||||
public void preferFolder(String name)
|
||||
{
|
||||
clearList();
|
||||
preferredFolder = name;
|
||||
}
|
||||
|
||||
public void clearList()
|
||||
{
|
||||
lock.lock();
|
||||
folderCache = null;
|
||||
possibleKeys = null;
|
||||
lock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,12 @@ package com.volmit.iris.util;
|
||||
* @author Missionary (missionarymc@gmail.com)
|
||||
* @since 5/31/2018
|
||||
*/
|
||||
public enum ScoreDirection {
|
||||
UP,
|
||||
DOWN
|
||||
@DontObfuscate
|
||||
public enum ScoreDirection
|
||||
{
|
||||
@DontObfuscate
|
||||
UP,
|
||||
|
||||
@DontObfuscate
|
||||
DOWN
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user