mirror of
https://github.com/songoda/SongodaCore.git
synced 2024-11-27 12:35:12 +01:00
update doubleGui functions
This commit is contained in:
parent
a5dd9b74a9
commit
8e2befa2a4
@ -1,7 +1,6 @@
|
||||
package com.songoda.core;
|
||||
|
||||
import com.songoda.core.configuration.Config;
|
||||
import com.songoda.core.configuration.ConfigFileConfigurationAdapter;
|
||||
import com.songoda.core.locale.Locale;
|
||||
import com.songoda.core.utils.Metrics;
|
||||
import java.util.List;
|
||||
|
@ -47,6 +47,11 @@ public class DoubleGui extends Gui {
|
||||
allowDropItems = false;
|
||||
}
|
||||
|
||||
public DoubleGui(Gui parent) {
|
||||
super(parent);
|
||||
allowDropItems = false;
|
||||
}
|
||||
|
||||
public int getPlayerRows() {
|
||||
return playerRows;
|
||||
}
|
||||
@ -85,6 +90,38 @@ public class DoubleGui extends Gui {
|
||||
return this;
|
||||
}
|
||||
|
||||
public DoubleGui setPlayerUnlockedRange(int cellFirst, int cellLast) {
|
||||
final int last = invOffset(cellLast);
|
||||
for (int cell = invOffset(cellFirst); cell <= last; ++cell) {
|
||||
unlockedCells.put(cell, true);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public DoubleGui setPlayerUnlockedRange(int cellFirst, int cellLast, boolean open) {
|
||||
final int last = invOffset(cellLast);
|
||||
for (int cell = invOffset(cellFirst); cell <= last; ++cell) {
|
||||
unlockedCells.put(cell, open);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public DoubleGui setPlayerUnlockedRange(int cellRowFirst, int cellColFirst, int cellRowLast, int cellColLast) {
|
||||
final int last = invOffset(cellColLast + cellRowLast * 9);
|
||||
for (int cell = invOffset(cellColFirst + cellRowFirst * 9); cell <= last; ++cell) {
|
||||
unlockedCells.put(cell, true);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public DoubleGui setPlayerUnlockedRange(int cellRowFirst, int cellColFirst, int cellRowLast, int cellColLast, boolean open) {
|
||||
final int last = invOffset(cellColLast + cellRowLast * 9);
|
||||
for (int cell = invOffset(cellColFirst + cellRowFirst * 9); cell <= last; ++cell) {
|
||||
unlockedCells.put(cell, open);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public DoubleGui setPlayerItem(int cell, ItemStack item) {
|
||||
cellItems.put(invOffset(cell), item);
|
||||
if (open && cell >= 0 && cell < 36) {
|
||||
|
@ -181,6 +181,14 @@ public class Gui {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Gui setUnlockedRange(int cellFirst, int cellLast, boolean open) {
|
||||
for (int cell = cellFirst; cell <= cellLast; ++cell) {
|
||||
unlockedCells.put(cell, open);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Gui setUnlockedRange(int cellRowFirst, int cellColFirst, int cellRowLast, int cellColLast) {
|
||||
final int last = cellColLast + cellRowLast * 9;
|
||||
@ -190,6 +198,15 @@ public class Gui {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Gui setUnlockedRange(int cellRowFirst, int cellColFirst, int cellRowLast, int cellColLast, boolean open) {
|
||||
final int last = cellColLast + cellRowLast * 9;
|
||||
for (int cell = cellColFirst + cellRowFirst * 9; cell <= last; ++cell) {
|
||||
unlockedCells.put(cell, open);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Gui setUnlocked(int cell, boolean open) {
|
||||
unlockedCells.put(cell, open);
|
||||
|
@ -119,7 +119,7 @@ public class Message {
|
||||
*/
|
||||
public Message processPlaceholder(String placeholder, Object replacement) {
|
||||
final String place = Matcher.quoteReplacement(placeholder);
|
||||
this.message = message.replaceAll("%" + place + "%|\\{" + place +"\\}", Matcher.quoteReplacement(replacement.toString()));
|
||||
this.message = message.replaceAll("%" + place + "%|\\{" + place +"\\}", replacement == null ? "" : Matcher.quoteReplacement(replacement.toString()));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user