-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from TWME-TW/dev
0.4.6 Update to Paper 1.20.6 & Java 21
- Loading branch information
Showing
6 changed files
with
178 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
72 changes: 72 additions & 0 deletions
72
src/main/java/dev/twme/debugstickpro/blockdatautil/subdata/VaultOminousData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package dev.twme.debugstickpro.blockdatautil.subdata; | ||
|
||
import dev.twme.debugstickpro.blockdatautil.SubBlockData; | ||
import dev.twme.debugstickpro.localization.Lang; | ||
import org.bukkit.block.data.BlockData; | ||
import org.bukkit.block.data.type.Vault; | ||
|
||
public class VaultOminousData implements SubBlockData { | ||
private final BlockData blockData; | ||
private boolean isUsing = false; | ||
private boolean ominous; | ||
|
||
public VaultOminousData(BlockData blockData) { | ||
this.blockData = blockData; | ||
this.ominous = ((Vault) blockData).isOminous(); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return getClass().getSimpleName(); | ||
} | ||
|
||
@Override | ||
public String dataName() { | ||
return Lang.DataKeyName.VaultOminousDataName; | ||
} | ||
|
||
@Override | ||
public BlockData getBlockData() { | ||
return blockData; | ||
} | ||
|
||
@Override | ||
public String getDataAsString() { | ||
return String.valueOf(ominous); | ||
} | ||
|
||
@Override | ||
public SubBlockData setIsUsing(boolean isUsing) { | ||
this.isUsing = isUsing; | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean isUsing() { | ||
return isUsing; | ||
} | ||
|
||
@Override | ||
public SubBlockData nextData() { | ||
Vault vault = ((Vault) blockData); | ||
vault.setOminous(!ominous); | ||
ominous = vault.isOminous(); | ||
return this; | ||
} | ||
|
||
@Override | ||
public SubBlockData previousData() { | ||
return nextData(); | ||
} | ||
|
||
@Override | ||
public BlockData copyTo(BlockData blockData) { | ||
((Vault) blockData).setOminous(ominous); | ||
return blockData; | ||
} | ||
|
||
@Override | ||
public SubBlockData fromBlockData(BlockData blockData) { | ||
return new VaultOminousData(blockData); | ||
} | ||
} |
90 changes: 90 additions & 0 deletions
90
src/main/java/dev/twme/debugstickpro/blockdatautil/subdata/VaultStateData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package dev.twme.debugstickpro.blockdatautil.subdata; | ||
|
||
import dev.twme.debugstickpro.blockdatautil.SubBlockData; | ||
import dev.twme.debugstickpro.localization.Lang; | ||
import org.bukkit.block.Block; | ||
import org.bukkit.block.data.BlockData; | ||
import org.bukkit.block.data.type.Vault; | ||
|
||
public class VaultStateData implements SubBlockData { | ||
private final BlockData blockData; | ||
private boolean isUsing = false; | ||
private Vault.State state; | ||
|
||
public VaultStateData(BlockData blockData) { | ||
this.blockData = blockData; | ||
this.state = ((Vault) blockData).getTrialSpawnerState(); | ||
} | ||
|
||
@Override | ||
public String name() { | ||
return this.getClass().getSimpleName(); | ||
} | ||
|
||
@Override | ||
public String dataName() { | ||
return Lang.DataKeyName.VaultStateDataName; | ||
} | ||
|
||
@Override | ||
public BlockData getBlockData() { | ||
return blockData; | ||
} | ||
|
||
@Override | ||
public String getDataAsString() { | ||
return state.name(); | ||
} | ||
|
||
@Override | ||
public SubBlockData setIsUsing(boolean isUsing) { | ||
this.isUsing = isUsing; | ||
return this; | ||
} | ||
|
||
@Override | ||
public boolean isUsing() { | ||
return isUsing; | ||
} | ||
|
||
@Override | ||
public SubBlockData nextData() { | ||
if (state == Vault.State.ACTIVE) { | ||
state = Vault.State.EJECTING; | ||
} else if (state == Vault.State.EJECTING) { | ||
state = Vault.State.INACTIVE; | ||
} else if (state == Vault.State.INACTIVE) { | ||
state = Vault.State.UNLOCKING; | ||
} else if (state == Vault.State.UNLOCKING) { | ||
state = Vault.State.ACTIVE; | ||
} | ||
((Vault) blockData).setTrialSpawnerState(state); | ||
return this; | ||
} | ||
|
||
@Override | ||
public SubBlockData previousData() { | ||
if (state == Vault.State.ACTIVE) { | ||
state = Vault.State.UNLOCKING; | ||
} else if (state == Vault.State.UNLOCKING) { | ||
state = Vault.State.INACTIVE; | ||
} else if (state == Vault.State.INACTIVE) { | ||
state = Vault.State.EJECTING; | ||
} else if (state == Vault.State.EJECTING) { | ||
state = Vault.State.ACTIVE; | ||
} | ||
((Vault) blockData).setTrialSpawnerState(state); | ||
return this; | ||
} | ||
|
||
@Override | ||
public BlockData copyTo(BlockData blockData) { | ||
((Vault) blockData).setTrialSpawnerState(state); | ||
return blockData; | ||
} | ||
|
||
@Override | ||
public SubBlockData fromBlockData(BlockData blockData) { | ||
return new VaultStateData(blockData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters