Development Milestone:
Finished and ready for testing.
This commit is contained in:
1 parent
d8e99a10d1
commit
698aceafc0
14 files changed
+321
-260
No files matched your search
@@ -1,11 +1,9 @@
|
||||
package com.rsscripting.rsauger.config;
|
||||
|
||||
import com.rsscripting.rsauger.RSAuger;
|
||||
import org.bukkit.configuration.file.FileConfiguration;
|
||||
|
||||
public class ConfigManager {
|
||||
|
||||
private static FileConfiguration config;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@@ -18,10 +16,6 @@ public class ConfigManager {
|
||||
RSAuger.getInstance()
|
||||
.saveDefaultConfig();
|
||||
|
||||
config =
|
||||
RSAuger.getInstance()
|
||||
.getConfig();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -35,22 +29,6 @@ public class ConfigManager {
|
||||
RSAuger.getInstance()
|
||||
.reloadConfig();
|
||||
|
||||
config =
|
||||
RSAuger.getInstance()
|
||||
.getConfig();
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| GET CONFIG
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static FileConfiguration get() {
|
||||
|
||||
return config;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -161,14 +161,12 @@ public class DatabaseManager {
|
||||
|
||||
ensureColumnExists(
|
||||
connection,
|
||||
"machines",
|
||||
"state",
|
||||
"TEXT DEFAULT 'ACTIVE'"
|
||||
);
|
||||
|
||||
ensureColumnExists(
|
||||
connection,
|
||||
"machines",
|
||||
"error_reason",
|
||||
"TEXT"
|
||||
);
|
||||
@@ -189,7 +187,6 @@ public class DatabaseManager {
|
||||
|
||||
private static void ensureColumnExists(
|
||||
Connection connection,
|
||||
String table,
|
||||
String column,
|
||||
String definition
|
||||
) {
|
||||
@@ -202,7 +199,7 @@ public class DatabaseManager {
|
||||
.getColumns(
|
||||
null,
|
||||
null,
|
||||
table,
|
||||
"machines",
|
||||
column
|
||||
)
|
||||
|
||||
@@ -211,9 +208,7 @@ public class DatabaseManager {
|
||||
if (!columns.next()) {
|
||||
|
||||
connection.createStatement().execute(
|
||||
"ALTER TABLE "
|
||||
+ table
|
||||
+ " ADD COLUMN "
|
||||
"ALTER TABLE machines ADD COLUMN "
|
||||
+ column
|
||||
+ " "
|
||||
+ definition
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.rsscripting.rsauger.gui;
|
||||
|
||||
import com.rsscripting.rsauger.machine.MachineError;
|
||||
import com.rsscripting.rsauger.utils.RSConstants;
|
||||
import com.rsscripting.rsauger.utils.RSMenuUtils;
|
||||
import com.rsscripting.rsauger.managers.MachineManager;
|
||||
import com.rsscripting.rsauger.utils.RSMessageUtils;
|
||||
import net.kyori.adventure.text.Component;
|
||||
import net.kyori.adventure.text.format.NamedTextColor;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -77,45 +77,77 @@ public class RSMainMenu {
|
||||
block
|
||||
);
|
||||
|
||||
menu.setItem(
|
||||
6,
|
||||
RSMenuUtils.createMenuItem(
|
||||
|
||||
paused
|
||||
? Material.RED_DYE
|
||||
: Material.GREEN_DYE,
|
||||
|
||||
paused
|
||||
? "§cPaused"
|
||||
: "§aRunning"
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| RECALIBRATE
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
menu.setItem(
|
||||
11,
|
||||
RSMenuUtils.createMenuItem(
|
||||
|
||||
Material.LIGHTNING_ROD,
|
||||
|
||||
"§bRecalibrate",
|
||||
|
||||
List.of(
|
||||
"§7Rescan the lightning rod shaft.",
|
||||
"§7",
|
||||
"§7Rediscover the source and",
|
||||
"§7destination containers."
|
||||
)
|
||||
|
||||
)
|
||||
MachineError error =
|
||||
MachineManager.getMachineError(
|
||||
block
|
||||
);
|
||||
|
||||
if (error != MachineError.NONE) {
|
||||
|
||||
String errorMessage =
|
||||
switch (error) {
|
||||
|
||||
case MISSING_TARGET ->
|
||||
"§7Missing target container.";
|
||||
|
||||
case MISSING_SOURCE ->
|
||||
"§7Missing source container.";
|
||||
|
||||
case INVALID_TARGET ->
|
||||
"§7Target container is invalid.";
|
||||
|
||||
case INVALID_SOURCE ->
|
||||
"§7Source container is invalid.";
|
||||
|
||||
case INVALID_CONFIGURATION ->
|
||||
"§7Machine configuration is invalid.";
|
||||
|
||||
case SHAFT_BROKEN ->
|
||||
"§7Lightning rod shaft is broken.";
|
||||
|
||||
default ->
|
||||
"§7Unknown error.";
|
||||
|
||||
};
|
||||
|
||||
menu.setItem(
|
||||
6,
|
||||
RSMenuUtils.createMenuItem(
|
||||
|
||||
Material.RED_DYE,
|
||||
|
||||
"§cError",
|
||||
|
||||
List.of(
|
||||
errorMessage,
|
||||
"§7",
|
||||
"§7Machine is paused.",
|
||||
"§7Repair and recalibrate."
|
||||
)
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
menu.setItem(
|
||||
6,
|
||||
RSMenuUtils.createMenuItem(
|
||||
|
||||
paused
|
||||
? Material.RED_DYE
|
||||
: Material.GREEN_DYE,
|
||||
|
||||
paused
|
||||
? "§cPaused"
|
||||
: "§aRunning"
|
||||
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| FILTER
|
||||
@@ -123,7 +155,7 @@ public class RSMainMenu {
|
||||
*/
|
||||
|
||||
menu.setItem(
|
||||
15,
|
||||
13,
|
||||
RSMenuUtils.createMenuItem(
|
||||
|
||||
Material.HOPPER,
|
||||
|
||||
@@ -2,20 +2,12 @@ package com.rsscripting.rsauger.gui.session;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
public class GuiSession {
|
||||
|
||||
private final UUID playerUuid;
|
||||
|
||||
private Block selectedBlock;
|
||||
|
||||
public GuiSession(UUID playerUuid) {
|
||||
this.playerUuid = playerUuid;
|
||||
}
|
||||
public GuiSession() {
|
||||
|
||||
public UUID getPlayerUuid() {
|
||||
return playerUuid;
|
||||
}
|
||||
|
||||
public Block getSelectedBlock() {
|
||||
|
||||
@@ -17,17 +17,7 @@ public class GuiSessionManager {
|
||||
|
||||
return sessions.computeIfAbsent(
|
||||
player.getUniqueId(),
|
||||
GuiSession::new
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
public static void removeSession(
|
||||
Player player
|
||||
) {
|
||||
|
||||
sessions.remove(
|
||||
player.getUniqueId()
|
||||
uuid -> new GuiSession()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import com.rsscripting.rsauger.gui.session.GuiSession;
|
||||
import com.rsscripting.rsauger.gui.session.GuiSessionManager;
|
||||
|
||||
import com.rsscripting.rsauger.utils.RSMessageUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
@@ -17,11 +17,6 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class RSFilterListener
|
||||
implements Listener {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private final RSConvertListener
|
||||
conversionListener;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.rsscripting.rsauger.listeners;
|
||||
|
||||
import com.rsscripting.rsauger.config.ConfigManager;
|
||||
import com.rsscripting.rsauger.machine.AugerEndpoints;
|
||||
import com.rsscripting.rsauger.machine.MachineError;
|
||||
import com.rsscripting.rsauger.managers.MachineManager;
|
||||
import com.rsscripting.rsauger.gui.*;
|
||||
import com.rsscripting.rsauger.utils.RSConstants;
|
||||
@@ -193,15 +193,64 @@ public class RSMenuListener
|
||||
|
||||
if (event.getRawSlot() == 6) {
|
||||
|
||||
boolean paused =
|
||||
MachineManager.isPaused(
|
||||
if (
|
||||
|
||||
MachineManager.getMachineError(
|
||||
block
|
||||
) != MachineError.NONE
|
||||
|
||||
) {
|
||||
|
||||
AugerValidationResult result =
|
||||
AugerValidator.validate(
|
||||
block
|
||||
);
|
||||
|
||||
if (!result.isValid()) {
|
||||
|
||||
RSMessageUtils.error(
|
||||
player,
|
||||
"Cannot restart machine until the error is repaired."
|
||||
);
|
||||
|
||||
RSMainMenu.open(
|
||||
player,
|
||||
block
|
||||
);
|
||||
|
||||
MachineManager.setPaused(
|
||||
block,
|
||||
!paused
|
||||
);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
MachineManager.setEndpoints(
|
||||
block,
|
||||
result.getEndpoints()
|
||||
);
|
||||
|
||||
MachineManager.clearMachineError(
|
||||
block
|
||||
);
|
||||
|
||||
MachineManager.setPaused(
|
||||
block,
|
||||
false
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
else {
|
||||
|
||||
boolean paused =
|
||||
MachineManager.isPaused(
|
||||
block
|
||||
);
|
||||
|
||||
MachineManager.setPaused(
|
||||
block,
|
||||
!paused
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
RSMainMenu.open(
|
||||
player,
|
||||
@@ -218,7 +267,7 @@ public class RSMenuListener
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
if (event.getRawSlot() == 15) {
|
||||
if (event.getRawSlot() == 13) {
|
||||
|
||||
RSFilterMenu.open(
|
||||
player,
|
||||
|
||||
@@ -28,18 +28,9 @@ public class AugerValidator {
|
||||
Block machine
|
||||
) {
|
||||
|
||||
BlockFace sourceDirection =
|
||||
getSourceDirection(
|
||||
machine
|
||||
);
|
||||
|
||||
if (sourceDirection == null) {
|
||||
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
return sourceDirection;
|
||||
return getSourceDirection(
|
||||
machine
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -119,6 +110,21 @@ public class AugerValidator {
|
||||
machine
|
||||
);
|
||||
|
||||
if (destinationDirection == null) {
|
||||
|
||||
messages.add(
|
||||
"Could not determine destination direction."
|
||||
);
|
||||
|
||||
return new AugerValidationResult(
|
||||
false,
|
||||
null,
|
||||
messages,
|
||||
MachineError.INVALID_CONFIGURATION
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
Block current =
|
||||
machine.getRelative(
|
||||
destinationDirection
|
||||
|
||||
@@ -2,23 +2,20 @@ package com.rsscripting.rsauger.managers;
|
||||
|
||||
import com.rsscripting.rsauger.database.DatabaseManager;
|
||||
import com.rsscripting.rsauger.machine.AugerEndpoints;
|
||||
import com.rsscripting.rsauger.RSAuger;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.UUID;
|
||||
import java.util.Base64;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.bukkit.util.io.BukkitObjectInputStream;
|
||||
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.io.BukkitObjectOutputStream;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
|
||||
@@ -81,7 +78,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -142,7 +141,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -246,7 +247,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -336,7 +339,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -403,7 +408,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -484,7 +491,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
return false;
|
||||
|
||||
@@ -599,7 +608,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -739,7 +750,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -824,7 +837,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -836,7 +851,7 @@ public class MachineManager {
|
||||
|
||||
return getMachineState(
|
||||
block
|
||||
) == MachineState.PAUSED;
|
||||
) != MachineState.ACTIVE;
|
||||
|
||||
}
|
||||
|
||||
@@ -895,7 +910,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -960,7 +977,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1027,7 +1046,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1090,7 +1111,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1102,30 +1125,18 @@ public class MachineManager {
|
||||
|
||||
try {
|
||||
|
||||
ByteArrayOutputStream outputStream =
|
||||
new ByteArrayOutputStream();
|
||||
|
||||
BukkitObjectOutputStream dataOutput =
|
||||
new BukkitObjectOutputStream(
|
||||
outputStream
|
||||
);
|
||||
|
||||
dataOutput.writeObject(
|
||||
itemStack
|
||||
);
|
||||
|
||||
dataOutput.close();
|
||||
|
||||
return Base64.getEncoder()
|
||||
.encodeToString(
|
||||
outputStream.toByteArray()
|
||||
itemStack.serializeAsBytes()
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
catch (IOException e) {
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1218,7 +1229,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1230,31 +1243,20 @@ public class MachineManager {
|
||||
|
||||
try {
|
||||
|
||||
byte[] data =
|
||||
return ItemStack.deserializeBytes(
|
||||
Base64.getDecoder()
|
||||
.decode(
|
||||
serializedItem
|
||||
);
|
||||
|
||||
BukkitObjectInputStream inputStream =
|
||||
new BukkitObjectInputStream(
|
||||
new ByteArrayInputStream(
|
||||
data
|
||||
)
|
||||
);
|
||||
|
||||
ItemStack itemStack =
|
||||
(ItemStack) inputStream.readObject();
|
||||
|
||||
inputStream.close();
|
||||
|
||||
return itemStack;
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1333,7 +1335,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1415,7 +1419,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1480,7 +1486,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1543,7 +1551,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1610,7 +1620,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1682,7 +1694,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1759,7 +1773,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1829,7 +1845,9 @@ public class MachineManager {
|
||||
|
||||
catch (Exception e) {
|
||||
|
||||
e.printStackTrace();
|
||||
logException(
|
||||
e
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
@@ -1837,6 +1855,20 @@ public class MachineManager {
|
||||
|
||||
}
|
||||
|
||||
private static void logException(
|
||||
Exception e
|
||||
) {
|
||||
|
||||
RSAuger.getInstance()
|
||||
.getLogger()
|
||||
.severe(
|
||||
e.getMessage()
|
||||
);
|
||||
|
||||
e.printStackTrace();
|
||||
|
||||
}
|
||||
|
||||
public static void clearMachineError(
|
||||
Block block
|
||||
) {
|
||||
|
||||
@@ -2,14 +2,20 @@ package com.rsscripting.rsauger.tasks;
|
||||
|
||||
import com.rsscripting.rsauger.machine.AugerValidationResult;
|
||||
import com.rsscripting.rsauger.machine.AugerValidator;
|
||||
import com.rsscripting.rsauger.machine.MachineState;
|
||||
import com.rsscripting.rsauger.managers.MachineManager;
|
||||
import com.rsscripting.rsauger.machine.AugerEndpoints;
|
||||
|
||||
import com.rsscripting.rsauger.managers.RSConversionManager;
|
||||
import com.rsscripting.rsauger.utils.RSKeys;
|
||||
import org.bukkit.block.Container;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.scheduler.BukkitRunnable;
|
||||
import org.bukkit.Particle;
|
||||
import org.bukkit.block.data.type.LightningRod;
|
||||
import org.bukkit.block.BlockFace;
|
||||
|
||||
public class AugerTask extends BukkitRunnable {
|
||||
|
||||
@@ -19,6 +25,43 @@ public class AugerTask extends BukkitRunnable {
|
||||
for (Block machine :
|
||||
MachineManager.getAllMachines()) {
|
||||
|
||||
if (
|
||||
|
||||
MachineManager.getMachineState(
|
||||
machine
|
||||
) == MachineState.ERROR
|
||||
|
||||
) {
|
||||
|
||||
LightningRod rod =
|
||||
(LightningRod) machine.getBlockData();
|
||||
|
||||
BlockFace facing =
|
||||
rod.getFacing();
|
||||
|
||||
double yOffset = 0.35;
|
||||
|
||||
if (facing == BlockFace.UP
|
||||
|| facing == BlockFace.DOWN) {
|
||||
|
||||
yOffset = 0.2;
|
||||
|
||||
}
|
||||
|
||||
machine.getWorld().spawnParticle(
|
||||
Particle.ANGRY_VILLAGER,
|
||||
machine.getLocation().add(
|
||||
0.5,
|
||||
yOffset,
|
||||
0.5
|
||||
),
|
||||
3
|
||||
);
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
if (MachineManager.isPaused(
|
||||
machine
|
||||
)) {
|
||||
@@ -99,6 +142,41 @@ public class AugerTask extends BukkitRunnable {
|
||||
|
||||
}
|
||||
|
||||
String filterMode =
|
||||
MachineManager.getFilterMode(
|
||||
machine
|
||||
);
|
||||
|
||||
boolean matchesFilter =
|
||||
RSConversionManager.containsFilterItem(
|
||||
machine,
|
||||
item
|
||||
);
|
||||
|
||||
if (filterMode.equals(
|
||||
RSKeys.FILTER_WHITELIST
|
||||
)) {
|
||||
|
||||
if (!matchesFilter) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
else if (filterMode.equals(
|
||||
RSKeys.FILTER_BLACKLIST
|
||||
)) {
|
||||
|
||||
if (matchesFilter) {
|
||||
|
||||
continue;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ItemStack transfer =
|
||||
item.clone();
|
||||
|
||||
|
||||
@@ -52,16 +52,6 @@ public class RSConstants {
|
||||
public static final Material REQUIRED_HELD_ITEM =
|
||||
Material.STICK;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| REQUIRED TARGET ENTITY
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static final Material
|
||||
REQUIRED_TARGET_BLOCK =
|
||||
Material.LIGHTNING_ROD;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| MENU SETTINGS
|
||||
|
||||
@@ -59,33 +59,6 @@ public class RSMessageUtils {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| WARNING
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static void warning(
|
||||
Player player,
|
||||
String message
|
||||
) {
|
||||
|
||||
player.sendMessage(
|
||||
|
||||
PREFIX.append(
|
||||
|
||||
Component.text(
|
||||
message
|
||||
).color(
|
||||
NamedTextColor.YELLOW
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ERROR
|
||||
@@ -140,31 +113,4 @@ public class RSMessageUtils {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| ADMIN
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
|
||||
public static void admin(
|
||||
Player player,
|
||||
String message
|
||||
) {
|
||||
|
||||
player.sendMessage(
|
||||
|
||||
PREFIX.append(
|
||||
|
||||
Component.text(
|
||||
message
|
||||
).color(
|
||||
NamedTextColor.GOLD
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
#### To Do list
|
||||
|
||||
# Plugin Specific (RS-ItemMagnet)
|
||||
- Refactor to RS-ItemMagnet.
|
||||
- Set plugin name/version/permissions
|
||||
- set up GitHub version for version checker.
|
||||
- add in target assigned hopper on convert
|
||||
- add in magnet logic
|
||||
- add in filter logic
|
||||
|
||||
# Optional (Needs discussion with partner)
|
||||
|
||||
- identifier when RS-ItemMagnet inoperable. (Sparkles?)
|
||||
|
||||
|
||||
# Additional menu options
|
||||
|
||||
- Select new hopper target.
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user