Fix compile errors

This commit is contained in:
zontreck 2024-04-07 16:01:28 -07:00
parent d86dace503
commit ed9d9bd249
4 changed files with 15 additions and 7 deletions

View file

@ -142,7 +142,7 @@ public class ChestGUIButton
*/ */
public boolean matchesSlot(Vector2i slot) public boolean matchesSlot(Vector2i slot)
{ {
return position.same(slot); return position.Same(slot);
} }
/** /**

View file

@ -16,8 +16,10 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.server.MinecraftServer;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.server.ServerLifecycleHooks;
import java.io.IOException; import java.io.IOException;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
@ -139,6 +141,9 @@ public class Bank
protected static boolean postTx(Transaction tx) throws InvalidSideException, InvocationTargetException, IllegalAccessException { protected static boolean postTx(Transaction tx) throws InvalidSideException, InvocationTargetException, IllegalAccessException {
if(ServerUtilities.isClient())return false; if(ServerUtilities.isClient())return false;
TransactionEvent ev = new TransactionEvent(tx); TransactionEvent ev = new TransactionEvent(tx);
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
if(MinecraftForge.EVENT_BUS.post(ev)) if(MinecraftForge.EVENT_BUS.post(ev))
{ {
// Send the list of reasons to the user // Send the list of reasons to the user
@ -147,13 +152,14 @@ public class Bank
Account from = ev.tx.from.get(); Account from = ev.tx.from.get();
Account to = ev.tx.to.get(); Account to = ev.tx.to.get();
if(from.isValidPlayer()) if(from.isValidPlayer())
{ {
ChatHelpers.broadcastTo(from.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] !Dark_Red!The transaction could not be completed because of the following reasons: " + reasonStr), LibZontreck.THE_SERVER); ChatHelpers.broadcastTo(from.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] !Dark_Red!The transaction could not be completed because of the following reasons: " + reasonStr), server);
} }
if(to.isValidPlayer()) if(to.isValidPlayer())
{ {
ChatHelpers.broadcastTo(to.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] !Dark_Red!The transaction could not be completed because of the following reasons: " + reasonStr), LibZontreck.THE_SERVER); ChatHelpers.broadcastTo(to.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] !Dark_Red!The transaction could not be completed because of the following reasons: " + reasonStr), server);
} }
return false; return false;
@ -194,10 +200,10 @@ public class Bank
} }
if(from.isValidPlayer()) if(from.isValidPlayer())
ChatHelpers.broadcastTo(from.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] !Dark_Green!You sent !White!${0} !Dark_green!to {1}", String.valueOf(tx.amount), toProf.name_color+toProf.nickname), LibZontreck.THE_SERVER); ChatHelpers.broadcastTo(from.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] !Dark_Green!You sent !White!${0} !Dark_green!to {1}", String.valueOf(tx.amount), toProf.name_color+toProf.nickname), server);
if(to.isValidPlayer()) if(to.isValidPlayer())
ChatHelpers.broadcastTo(from.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] {0} !Dark_Green!paid you ${1}", String.valueOf(tx.amount), toProf.name_color+toProf.nickname), LibZontreck.THE_SERVER); ChatHelpers.broadcastTo(from.player_id, ChatHelpers.macro("!Dark_Gray![!Dark_Blue!Bank!Dark_Gray!] {0} !Dark_Green!paid you ${1}", String.valueOf(tx.amount), toProf.name_color+toProf.nickname), server);
if(to.isValidPlayer() && ServerUtilities.playerIsOffline(to.player_id)) Profile.unload(toProf); if(to.isValidPlayer() && ServerUtilities.playerIsOffline(to.player_id)) Profile.unload(toProf);
if(from.isValidPlayer() && ServerUtilities.playerIsOffline(from.player_id)) if(from.isValidPlayer() && ServerUtilities.playerIsOffline(from.player_id))

View file

@ -7,6 +7,7 @@ import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
import dev.zontreck.libzontreck.vectors.WorldPosition; import dev.zontreck.libzontreck.vectors.WorldPosition;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.server.ServerLifecycleHooks;
public class PlayerComponent public class PlayerComponent
{ {
@ -34,7 +35,7 @@ public class PlayerComponent
public static PlayerComponent fromID(UUID ID) public static PlayerComponent fromID(UUID ID)
{ {
return new PlayerComponent(LibZontreck.THE_SERVER.getPlayerList().getPlayer(ID)); return new PlayerComponent(ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayer(ID));
} }
public CompoundTag serialize() public CompoundTag serialize()

View file

@ -5,6 +5,7 @@ import java.util.UUID;
import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.LibZontreck;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.server.ServerLifecycleHooks;
public class PlayerContainer { public class PlayerContainer {
public UUID ID; public UUID ID;
@ -13,7 +14,7 @@ public class PlayerContainer {
public PlayerContainer(UUID ID) public PlayerContainer(UUID ID)
{ {
this(LibZontreck.THE_SERVER.getPlayerList().getPlayer(ID)); this(ServerLifecycleHooks.getCurrentServer().getPlayerList().getPlayer(ID));
} }
public PlayerContainer(ServerPlayer player) public PlayerContainer(ServerPlayer player)
{ {