mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-29 12:09:07 +00:00
More fix
This commit is contained in:
@@ -7,7 +7,6 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
@@ -21,111 +20,128 @@ import lombok.Setter;
|
||||
* @author Missionary (missionarymc@gmail.com)
|
||||
* @since 3/23/2018
|
||||
*/
|
||||
public class Board {
|
||||
public class Board
|
||||
{
|
||||
|
||||
private static final String[] CACHED_ENTRIES = new String[ChatColor.values().length];
|
||||
private static final String[] CACHED_ENTRIES = new String[C.values().length];
|
||||
|
||||
private static final Function<String, String> APPLY_COLOR_TRANSLATION = s -> ChatColor.translateAlternateColorCodes('&', s);
|
||||
private static final Function<String, String> APPLY_COLOR_TRANSLATION = s -> C.translateAlternateColorCodes('&', s);
|
||||
|
||||
static {
|
||||
IntStream.range(0, 15).forEach(i -> CACHED_ENTRIES[i] = ChatColor.values()[i].toString() + ChatColor.RESET);
|
||||
}
|
||||
static
|
||||
{
|
||||
IntStream.range(0, 15).forEach(i -> CACHED_ENTRIES[i] = C.values()[i].toString() + C.RESET);
|
||||
}
|
||||
|
||||
private final Player player;
|
||||
private final Objective objective;
|
||||
private final Team team;
|
||||
@Setter private BoardSettings boardSettings;
|
||||
private boolean ready;
|
||||
private final Player player;
|
||||
private final Objective objective;
|
||||
private final Team team;
|
||||
@Setter
|
||||
private BoardSettings boardSettings;
|
||||
private boolean ready;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public Board(@NonNull final Player player, final BoardSettings boardSettings) {
|
||||
this.player = player;
|
||||
this.boardSettings = boardSettings;
|
||||
this.objective = this.getScoreboard().getObjective("board") == null ? this.getScoreboard().registerNewObjective("board", "dummy") : this.getScoreboard().getObjective("board");
|
||||
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
this.team = this.getScoreboard().getTeam("board") == null ? this.getScoreboard().registerNewTeam("board") : this.getScoreboard().getTeam("board");
|
||||
this.team.setAllowFriendlyFire(true);
|
||||
this.team.setCanSeeFriendlyInvisibles(false);
|
||||
this.team.setPrefix("");
|
||||
this.team.setSuffix("");
|
||||
this.ready = true;
|
||||
}
|
||||
@SuppressWarnings("deprecation")
|
||||
public Board(@NonNull final Player player, final BoardSettings boardSettings)
|
||||
{
|
||||
this.player = player;
|
||||
this.boardSettings = boardSettings;
|
||||
this.objective = this.getScoreboard().getObjective("board") == null ? this.getScoreboard().registerNewObjective("board", "dummy") : this.getScoreboard().getObjective("board");
|
||||
this.objective.setDisplaySlot(DisplaySlot.SIDEBAR);
|
||||
this.team = this.getScoreboard().getTeam("board") == null ? this.getScoreboard().registerNewTeam("board") : this.getScoreboard().getTeam("board");
|
||||
this.team.setAllowFriendlyFire(true);
|
||||
this.team.setCanSeeFriendlyInvisibles(false);
|
||||
this.team.setPrefix("");
|
||||
this.team.setSuffix("");
|
||||
this.ready = true;
|
||||
}
|
||||
|
||||
public Scoreboard getScoreboard() {
|
||||
return (player != null) ? player.getScoreboard() : null;
|
||||
}
|
||||
public Scoreboard getScoreboard()
|
||||
{
|
||||
return (player != null) ? player.getScoreboard() : null;
|
||||
}
|
||||
|
||||
public void remove() {
|
||||
this.resetScoreboard();
|
||||
}
|
||||
public void remove()
|
||||
{
|
||||
this.resetScoreboard();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
// Checking if we are ready to start updating the Scoreboard.
|
||||
if (!ready) {
|
||||
return;
|
||||
}
|
||||
public void update()
|
||||
{
|
||||
// Checking if we are ready to start updating the Scoreboard.
|
||||
if(!ready)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Making sure the player is connected.
|
||||
if (!player.isOnline()) {
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
// Making sure the player is connected.
|
||||
if(!player.isOnline())
|
||||
{
|
||||
remove();
|
||||
return;
|
||||
}
|
||||
|
||||
// Making sure the Scoreboard Provider is set.
|
||||
if (boardSettings == null) {
|
||||
return;
|
||||
}
|
||||
// Making sure the Scoreboard Provider is set.
|
||||
if(boardSettings == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Getting their Scoreboard display from the Scoreboard Provider.
|
||||
final List<String> entries = boardSettings.getBoardProvider().getLines(player).stream().map(APPLY_COLOR_TRANSLATION).collect(Collectors.toList());
|
||||
// Getting their Scoreboard display from the Scoreboard Provider.
|
||||
final List<String> entries = boardSettings.getBoardProvider().getLines(player).stream().map(APPLY_COLOR_TRANSLATION).collect(Collectors.toList());
|
||||
|
||||
if (boardSettings.getScoreDirection() == ScoreDirection.UP) {
|
||||
Collections.reverse(entries);
|
||||
}
|
||||
if(boardSettings.getScoreDirection() == ScoreDirection.UP)
|
||||
{
|
||||
Collections.reverse(entries);
|
||||
}
|
||||
|
||||
// Setting the Scoreboard title
|
||||
String title = boardSettings.getBoardProvider().getTitle(player);
|
||||
if (title.length() > 32) {
|
||||
Bukkit.getLogger().warning("The title " + title + " is over 32 characters in length, substringing to prevent errors.");
|
||||
title = title.substring(0, 32);
|
||||
}
|
||||
objective.setDisplayName(ChatColor.translateAlternateColorCodes('&', title));
|
||||
// Setting the Scoreboard title
|
||||
String title = boardSettings.getBoardProvider().getTitle(player);
|
||||
if(title.length() > 32)
|
||||
{
|
||||
Bukkit.getLogger().warning("The title " + title + " is over 32 characters in length, substringing to prevent errors.");
|
||||
title = title.substring(0, 32);
|
||||
}
|
||||
objective.setDisplayName(C.translateAlternateColorCodes('&', title));
|
||||
|
||||
// Clearing previous Scoreboard values if entry sizes don't match.
|
||||
if (this.getScoreboard().getEntries().size() != entries.size())
|
||||
this.getScoreboard().getEntries().forEach(this::removeEntry);
|
||||
// Clearing previous Scoreboard values if entry sizes don't match.
|
||||
if(this.getScoreboard().getEntries().size() != entries.size())
|
||||
this.getScoreboard().getEntries().forEach(this::removeEntry);
|
||||
|
||||
// Setting Scoreboard lines.
|
||||
for (int i = 0; i < entries.size(); i++) {
|
||||
String str = entries.get(i);
|
||||
BoardEntry entry = BoardEntry.translateToEntry(str);
|
||||
Team team = getScoreboard().getTeam(CACHED_ENTRIES[i]);
|
||||
// Setting Scoreboard lines.
|
||||
for(int i = 0; i < entries.size(); i++)
|
||||
{
|
||||
String str = entries.get(i);
|
||||
BoardEntry entry = BoardEntry.translateToEntry(str);
|
||||
Team team = getScoreboard().getTeam(CACHED_ENTRIES[i]);
|
||||
|
||||
if (team == null) {
|
||||
team = this.getScoreboard().registerNewTeam(CACHED_ENTRIES[i]);
|
||||
team.addEntry(team.getName());
|
||||
}
|
||||
if(team == null)
|
||||
{
|
||||
team = this.getScoreboard().registerNewTeam(CACHED_ENTRIES[i]);
|
||||
team.addEntry(team.getName());
|
||||
}
|
||||
|
||||
team.setPrefix(entry.getPrefix());
|
||||
team.setSuffix(entry.getSuffix());
|
||||
team.setPrefix(entry.getPrefix());
|
||||
team.setSuffix(entry.getSuffix());
|
||||
|
||||
switch (boardSettings.getScoreDirection()) {
|
||||
case UP:
|
||||
objective.getScore(team.getName()).setScore(1 + i);
|
||||
break;
|
||||
case DOWN:
|
||||
objective.getScore(team.getName()).setScore(15 - i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch(boardSettings.getScoreDirection())
|
||||
{
|
||||
case UP:
|
||||
objective.getScore(team.getName()).setScore(1 + i);
|
||||
break;
|
||||
case DOWN:
|
||||
objective.getScore(team.getName()).setScore(15 - i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeEntry(String id) {
|
||||
this.getScoreboard().resetScores(id);
|
||||
}
|
||||
public void removeEntry(String id)
|
||||
{
|
||||
this.getScoreboard().resetScores(id);
|
||||
}
|
||||
|
||||
public void resetScoreboard() {
|
||||
ready = false;
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
|
||||
}
|
||||
public void resetScoreboard()
|
||||
{
|
||||
ready = false;
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getMainScoreboard());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,40 +1,48 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import lombok.Getter;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author Missionary (missionarymc@gmail.com)
|
||||
* @since 3/29/2018
|
||||
*/
|
||||
public class BoardEntry {
|
||||
public class BoardEntry
|
||||
{
|
||||
|
||||
@Getter
|
||||
private final String prefix, suffix;
|
||||
@Getter
|
||||
private final String prefix, suffix;
|
||||
|
||||
private BoardEntry(final String prefix, final String suffix) {
|
||||
this.prefix = prefix;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
private BoardEntry(final String prefix, final String suffix)
|
||||
{
|
||||
this.prefix = prefix;
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public static BoardEntry translateToEntry(String input) {
|
||||
if (input.isEmpty()) {
|
||||
return new BoardEntry("", "");
|
||||
}
|
||||
if (input.length() <= 16) {
|
||||
return new BoardEntry(input, "");
|
||||
} else {
|
||||
String prefix = input.substring(0, 16);
|
||||
String suffix = "";
|
||||
public static BoardEntry translateToEntry(String input)
|
||||
{
|
||||
if(input.isEmpty())
|
||||
{
|
||||
return new BoardEntry("", "");
|
||||
}
|
||||
if(input.length() <= 16)
|
||||
{
|
||||
return new BoardEntry(input, "");
|
||||
}
|
||||
else
|
||||
{
|
||||
String prefix = input.substring(0, 16);
|
||||
String suffix = "";
|
||||
|
||||
if (prefix.endsWith("\u00a7")) {
|
||||
prefix = prefix.substring(0, prefix.length() - 1);
|
||||
suffix = "\u00a7" + suffix;
|
||||
}
|
||||
if(prefix.endsWith("\u00a7"))
|
||||
{
|
||||
prefix = prefix.substring(0, prefix.length() - 1);
|
||||
suffix = "\u00a7" + suffix;
|
||||
}
|
||||
|
||||
suffix = StringUtils.left(ChatColor.getLastColors(prefix) + suffix + input.substring(16), 16);
|
||||
return new BoardEntry(prefix, suffix);
|
||||
}
|
||||
}
|
||||
suffix = StringUtils.left(C.getLastColors(prefix) + suffix + input.substring(16), 16);
|
||||
return new BoardEntry(prefix, suffix);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,86 +1,72 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author Missionary (missionarymc@gmail.com)
|
||||
* @since 3/23/2018
|
||||
*/
|
||||
public class BoardManager implements Listener {
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.scheduler.BukkitTask;
|
||||
|
||||
private final JavaPlugin plugin;
|
||||
private BoardSettings boardSettings;
|
||||
private Map<UUID, Board> scoreboards;
|
||||
private BukkitTask updateTask;
|
||||
public class BoardManager
|
||||
{
|
||||
private final JavaPlugin plugin;
|
||||
private BoardSettings boardSettings;
|
||||
private Map<UUID, Board> scoreboards;
|
||||
private BukkitTask updateTask;
|
||||
|
||||
public BoardManager(JavaPlugin plugin, BoardSettings boardSettings) {
|
||||
this.plugin = plugin;
|
||||
this.boardSettings = boardSettings;
|
||||
this.scoreboards = new ConcurrentHashMap<>();
|
||||
this.updateTask = new BoardUpdateTask(this).runTaskTimer(plugin, 2L, 2L);
|
||||
plugin.getServer().getPluginManager().registerEvents(this, plugin);
|
||||
plugin.getServer().getOnlinePlayers().forEach(this::setup);
|
||||
}
|
||||
public BoardManager(JavaPlugin plugin, BoardSettings boardSettings)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.boardSettings = boardSettings;
|
||||
this.scoreboards = new ConcurrentHashMap<>();
|
||||
this.updateTask = new BoardUpdateTask(this).runTaskTimer(plugin, 2L, 2L);
|
||||
plugin.getServer().getOnlinePlayers().forEach(this::setup);
|
||||
}
|
||||
|
||||
public void setBoardSettings(BoardSettings boardSettings) {
|
||||
this.boardSettings = boardSettings;
|
||||
scoreboards.values().forEach(board -> board.setBoardSettings(boardSettings));
|
||||
}
|
||||
public void setBoardSettings(BoardSettings boardSettings)
|
||||
{
|
||||
this.boardSettings = boardSettings;
|
||||
scoreboards.values().forEach(board -> board.setBoardSettings(boardSettings));
|
||||
}
|
||||
|
||||
public boolean hasBoard(Player player) {
|
||||
return scoreboards.containsKey(player.getUniqueId());
|
||||
}
|
||||
public boolean hasBoard(Player player)
|
||||
{
|
||||
return scoreboards.containsKey(player.getUniqueId());
|
||||
}
|
||||
|
||||
public Optional<Board> getBoard(Player player) {
|
||||
return Optional.ofNullable(scoreboards.get(player.getUniqueId()));
|
||||
}
|
||||
public Optional<Board> getBoard(Player player)
|
||||
{
|
||||
return Optional.ofNullable(scoreboards.get(player.getUniqueId()));
|
||||
}
|
||||
|
||||
private void setup(Player player) {
|
||||
Optional.ofNullable(scoreboards.remove(player.getUniqueId())).ifPresent(Board::resetScoreboard);
|
||||
if (player.getScoreboard() == Bukkit.getScoreboardManager().getMainScoreboard()) {
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
scoreboards.put(player.getUniqueId(), new Board(player, boardSettings));
|
||||
}
|
||||
public void setup(Player player)
|
||||
{
|
||||
Optional.ofNullable(scoreboards.remove(player.getUniqueId())).ifPresent(Board::resetScoreboard);
|
||||
if(player.getScoreboard().equals(Bukkit.getScoreboardManager().getMainScoreboard()))
|
||||
{
|
||||
player.setScoreboard(Bukkit.getScoreboardManager().getNewScoreboard());
|
||||
}
|
||||
scoreboards.put(player.getUniqueId(), new Board(player, boardSettings));
|
||||
}
|
||||
|
||||
private void remove(Player player) {
|
||||
Optional.ofNullable(scoreboards.remove(player.getUniqueId())).ifPresent(Board::remove);
|
||||
}
|
||||
public void remove(Player player)
|
||||
{
|
||||
Optional.ofNullable(scoreboards.remove(player.getUniqueId())).ifPresent(Board::remove);
|
||||
}
|
||||
|
||||
public Map<UUID, Board> getScoreboards() {
|
||||
return Collections.unmodifiableMap(scoreboards);
|
||||
}
|
||||
public Map<UUID, Board> getScoreboards()
|
||||
{
|
||||
return Collections.unmodifiableMap(scoreboards);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onJoin(final PlayerJoinEvent e) {
|
||||
plugin.getServer().getScheduler().runTaskLater(plugin, () -> {
|
||||
if (e.getPlayer().isOnline()) { // Set this up 2 ticks later.
|
||||
setup(e.getPlayer());
|
||||
}
|
||||
}, 2L);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onQuit(final PlayerQuitEvent e) {
|
||||
this.remove(e.getPlayer());
|
||||
}
|
||||
|
||||
public void onDisable() {
|
||||
updateTask.cancel();
|
||||
plugin.getServer().getOnlinePlayers().forEach(this::remove);
|
||||
scoreboards.clear();
|
||||
}
|
||||
public void onDisable()
|
||||
{
|
||||
updateTask.cancel();
|
||||
plugin.getServer().getOnlinePlayers().forEach(this::remove);
|
||||
scoreboards.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,12 @@
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BoardProvider {
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
/**
|
||||
* Gets the title for {@link Objective#getDisplayName()}
|
||||
*
|
||||
* @param player The {@link Player} to supply
|
||||
* @return The title for the objective
|
||||
*/
|
||||
String getTitle(Player player);
|
||||
public interface BoardProvider
|
||||
{
|
||||
String getTitle(Player player);
|
||||
|
||||
/**
|
||||
* Gets the contents to be displayed on the {@link Board}
|
||||
*
|
||||
* @param player The {@link Player} to supply
|
||||
* @return The {@link List} of contents
|
||||
*/
|
||||
List<String> getLines(Player player);
|
||||
List<String> getLines(Player player);
|
||||
}
|
||||
|
||||
@@ -3,16 +3,11 @@ package com.volmit.iris.util;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author Missionary (missionarymc@gmail.com)
|
||||
* @since 5/31/2018
|
||||
*/
|
||||
@Getter
|
||||
@Builder
|
||||
public class BoardSettings {
|
||||
|
||||
private BoardProvider boardProvider;
|
||||
|
||||
private ScoreDirection scoreDirection;
|
||||
public class BoardSettings
|
||||
{
|
||||
private BoardProvider boardProvider;
|
||||
|
||||
private ScoreDirection scoreDirection;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
/**
|
||||
* Callback for async workers
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
public interface Element
|
||||
{
|
||||
public MaterialBlock getMaterial();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
/**
|
||||
* Element Event.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
|
||||
@@ -3,8 +3,6 @@ package com.volmit.iris.util;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
|
||||
/**
|
||||
* Represents a pawn command
|
||||
*
|
||||
@@ -53,7 +51,7 @@ public abstract class MortarCommand implements ICommand
|
||||
}
|
||||
}
|
||||
b = true;
|
||||
sender.sendMessage(ChatColor.GREEN + i.getNode() + " " + ChatColor.WHITE + i.getArgsUsage() + ChatColor.GRAY + " - " + i.getDescription());
|
||||
sender.sendMessage(C.GREEN + i.getNode() + " " + C.WHITE + i.getArgsUsage() + C.GRAY + " - " + i.getDescription());
|
||||
}
|
||||
|
||||
if(!b)
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.volmit.iris.util;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -20,7 +19,8 @@ import lombok.Setter;
|
||||
* @author cyberpwn
|
||||
*
|
||||
*/
|
||||
public class MortarSender implements CommandSender {
|
||||
public class MortarSender implements CommandSender
|
||||
{
|
||||
private CommandSender s;
|
||||
private String tag;
|
||||
|
||||
@@ -31,14 +31,17 @@ public class MortarSender implements CommandSender {
|
||||
/**
|
||||
* Wrap a command sender
|
||||
*
|
||||
* @param s the command sender
|
||||
* @param s
|
||||
* the command sender
|
||||
*/
|
||||
public MortarSender(CommandSender s) {
|
||||
public MortarSender(CommandSender s)
|
||||
{
|
||||
tag = "";
|
||||
this.s = s;
|
||||
}
|
||||
|
||||
public MortarSender(CommandSender s, String tag) {
|
||||
public MortarSender(CommandSender s, String tag)
|
||||
{
|
||||
this.tag = tag;
|
||||
this.s = s;
|
||||
}
|
||||
@@ -46,9 +49,11 @@ public class MortarSender implements CommandSender {
|
||||
/**
|
||||
* Set a command tag (prefix for sendMessage)
|
||||
*
|
||||
* @param tag the tag
|
||||
* @param tag
|
||||
* the tag
|
||||
*/
|
||||
public void setTag(String tag) {
|
||||
public void setTag(String tag)
|
||||
{
|
||||
this.tag = tag;
|
||||
}
|
||||
|
||||
@@ -57,7 +62,8 @@ public class MortarSender implements CommandSender {
|
||||
*
|
||||
* @return the command tag
|
||||
*/
|
||||
public String getTag() {
|
||||
public String getTag()
|
||||
{
|
||||
return tag;
|
||||
}
|
||||
|
||||
@@ -66,7 +72,8 @@ public class MortarSender implements CommandSender {
|
||||
*
|
||||
* @return true if it is
|
||||
*/
|
||||
public boolean isPlayer() {
|
||||
public boolean isPlayer()
|
||||
{
|
||||
return getS() instanceof Player;
|
||||
}
|
||||
|
||||
@@ -75,7 +82,8 @@ public class MortarSender implements CommandSender {
|
||||
*
|
||||
* @return a casted player
|
||||
*/
|
||||
public Player player() {
|
||||
public Player player()
|
||||
{
|
||||
return (Player) getS();
|
||||
}
|
||||
|
||||
@@ -84,102 +92,122 @@ public class MortarSender implements CommandSender {
|
||||
*
|
||||
* @return the command sender
|
||||
*/
|
||||
public CommandSender getS() {
|
||||
public CommandSender getS()
|
||||
{
|
||||
return s;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(String name) {
|
||||
public boolean isPermissionSet(String name)
|
||||
{
|
||||
return s.isPermissionSet(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPermissionSet(Permission perm) {
|
||||
public boolean isPermissionSet(Permission perm)
|
||||
{
|
||||
return s.isPermissionSet(perm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(String name) {
|
||||
public boolean hasPermission(String name)
|
||||
{
|
||||
return s.hasPermission(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPermission(Permission perm) {
|
||||
public boolean hasPermission(Permission perm)
|
||||
{
|
||||
return s.hasPermission(perm);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value) {
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value)
|
||||
{
|
||||
return s.addAttachment(plugin, name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin) {
|
||||
public PermissionAttachment addAttachment(Plugin plugin)
|
||||
{
|
||||
return s.addAttachment(plugin);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks) {
|
||||
public PermissionAttachment addAttachment(Plugin plugin, String name, boolean value, int ticks)
|
||||
{
|
||||
return s.addAttachment(plugin, name, value, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks) {
|
||||
public PermissionAttachment addAttachment(Plugin plugin, int ticks)
|
||||
{
|
||||
return s.addAttachment(plugin, ticks);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeAttachment(PermissionAttachment attachment) {
|
||||
public void removeAttachment(PermissionAttachment attachment)
|
||||
{
|
||||
s.removeAttachment(attachment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recalculatePermissions() {
|
||||
public void recalculatePermissions()
|
||||
{
|
||||
s.recalculatePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions() {
|
||||
public Set<PermissionAttachmentInfo> getEffectivePermissions()
|
||||
{
|
||||
return s.getEffectivePermissions();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOp() {
|
||||
public boolean isOp()
|
||||
{
|
||||
return s.isOp();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOp(boolean value) {
|
||||
public void setOp(boolean value)
|
||||
{
|
||||
s.setOp(value);
|
||||
}
|
||||
|
||||
public void hr() {
|
||||
public void hr()
|
||||
{
|
||||
s.sendMessage("========================================================");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String message) {
|
||||
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag()) + message);
|
||||
public void sendMessage(String message)
|
||||
{
|
||||
s.sendMessage(C.translateAlternateColorCodes('&', getTag()) + message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMessage(String[] messages) {
|
||||
for (String str : messages)
|
||||
s.sendMessage(ChatColor.translateAlternateColorCodes('&', getTag() + str));
|
||||
public void sendMessage(String[] messages)
|
||||
{
|
||||
for(String str : messages)
|
||||
s.sendMessage(C.translateAlternateColorCodes('&', getTag() + str));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Server getServer() {
|
||||
public Server getServer()
|
||||
{
|
||||
return s.getServer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
public String getName()
|
||||
{
|
||||
return s.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Spigot spigot() {
|
||||
public Spigot spigot()
|
||||
{
|
||||
return s.spigot();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.gen.parallax;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -10,7 +10,6 @@ import org.bukkit.generator.ChunkGenerator.ChunkData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.gen.atomics.AtomicSliver;
|
||||
import com.volmit.iris.util.Writable;
|
||||
|
||||
public class ParallaxChunk implements Writable
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.gen.parallax;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -11,9 +11,6 @@ import java.util.zip.GZIPInputStream;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.IrisSettings;
|
||||
import com.volmit.iris.util.CustomOutputStream;
|
||||
import com.volmit.iris.util.M;
|
||||
import com.volmit.iris.util.Writable;
|
||||
|
||||
public class ParallaxRegion implements Writable
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.gen.parallax;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
@@ -6,11 +6,6 @@ import java.io.IOException;
|
||||
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.util.B;
|
||||
import com.volmit.iris.util.DataPalette;
|
||||
import com.volmit.iris.util.KSet;
|
||||
import com.volmit.iris.util.Writable;
|
||||
|
||||
public class ParallaxSection implements Writable
|
||||
{
|
||||
private final DataPalette<BlockData> block;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.gen.parallax;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
@@ -6,7 +6,6 @@ import java.io.IOException;
|
||||
import org.bukkit.block.data.BlockData;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.KMap;
|
||||
|
||||
public class ParallaxWorld
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -38,13 +38,6 @@ import com.volmit.iris.object.IrisStructureTile;
|
||||
import com.volmit.iris.object.NoiseStyle;
|
||||
import com.volmit.iris.object.StructureTileCondition;
|
||||
import com.volmit.iris.object.TileResult;
|
||||
import com.volmit.iris.util.inventory.C;
|
||||
import com.volmit.iris.util.inventory.MaterialBlock;
|
||||
import com.volmit.iris.util.inventory.UIElement;
|
||||
import com.volmit.iris.util.inventory.UIStaticDecorator;
|
||||
import com.volmit.iris.util.inventory.UIWindow;
|
||||
import com.volmit.iris.util.inventory.Window;
|
||||
import com.volmit.iris.util.inventory.WindowResolution;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.volmit.iris.util.KList;
|
||||
|
||||
public class UIElement implements Element
|
||||
{
|
||||
private MaterialBlock material;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Material;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
public class UIVoidDecorator implements WindowDecorator
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
@@ -12,9 +12,6 @@ import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.util.J;
|
||||
import com.volmit.iris.util.KMap;
|
||||
import com.volmit.iris.util.KSet;
|
||||
|
||||
public class UIWindow implements Window, Listener
|
||||
{
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
/**
|
||||
* Utility vecmath class used when computing the hash code for vecmath
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
* $State$
|
||||
*/
|
||||
|
||||
package com.volmit.iris.util.vec;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.volmit.iris.util;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
@@ -128,7 +127,7 @@ public class VirtualCommand
|
||||
if(!sender.hasPermission(i))
|
||||
{
|
||||
failed = true;
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> sender.sendMessage("- " + ChatColor.WHITE + i), 0);
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Iris.instance, () -> sender.sendMessage("- " + C.WHITE + i), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
public interface WindowDecorator
|
||||
{
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.volmit.iris.util.inventory;
|
||||
package com.volmit.iris.util;
|
||||
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user