-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
140cad7
commit b194a9c
Showing
19 changed files
with
114 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
crypticlibVer=1.8.2 | ||
crypticlibVer=1.10.5 |
Binary file not shown.
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
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
30 changes: 30 additions & 0 deletions
30
src/main/java/com/github/yufiriamazenta/craftorithm/hook/impl/AzureFlowHooker.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,30 @@ | ||
package com.github.yufiriamazenta.craftorithm.hook.impl; | ||
|
||
import com.github.yufiriamazenta.craftorithm.hook.ItemPluginHooker; | ||
import com.github.yufiriamazenta.craftorithm.item.ItemProvider; | ||
import com.github.yufiriamazenta.craftorithm.item.impl.AzureFlowItemProvider; | ||
import crypticlib.lifecycle.AutoTask; | ||
import crypticlib.lifecycle.LifeCycle; | ||
import crypticlib.lifecycle.TaskRule; | ||
|
||
@AutoTask(rules = @TaskRule(lifeCycle = LifeCycle.ACTIVE)) | ||
public enum AzureFlowHooker implements ItemPluginHooker { | ||
|
||
INSTANCE; | ||
|
||
@Override | ||
public ItemProvider itemProvider() { | ||
return AzureFlowItemProvider.INSTANCE; | ||
} | ||
|
||
@Override | ||
public String pluginName() { | ||
return "AzureFlow"; | ||
} | ||
|
||
@Override | ||
public boolean hook() { | ||
return hookByEnabled(); | ||
} | ||
|
||
} |
59 changes: 59 additions & 0 deletions
59
src/main/java/com/github/yufiriamazenta/craftorithm/item/impl/AzureFlowItemProvider.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,59 @@ | ||
package com.github.yufiriamazenta.craftorithm.item.impl; | ||
|
||
import com.github.yufiriamazenta.craftorithm.item.ItemProvider; | ||
import io.rokuko.azureflow.api.AzureFlowAPI; | ||
import io.rokuko.azureflow.features.item.AzureFlowItem; | ||
import io.rokuko.azureflow.features.item.factory.AzureFlowItemFactory; | ||
import org.bukkit.OfflinePlayer; | ||
import org.bukkit.inventory.ItemStack; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
import java.util.Objects; | ||
|
||
public enum AzureFlowItemProvider implements ItemProvider { | ||
|
||
INSTANCE; | ||
|
||
@Override | ||
public @NotNull String namespace() { | ||
return "azureflow"; | ||
} | ||
|
||
@Override | ||
public @Nullable String getItemName(ItemStack itemStack, boolean ignoreAmount) { | ||
AzureFlowItem azureFlowItem = AzureFlowAPI.toItem(itemStack); | ||
if (azureFlowItem == null) { | ||
return null; | ||
} | ||
String itemId = azureFlowItem.getUuid(); | ||
if (ignoreAmount) { | ||
return itemId; | ||
} else { | ||
return itemId + itemStack.getAmount() / Objects.requireNonNull(getItem(itemId)).getAmount(); | ||
} | ||
} | ||
|
||
@Override | ||
public @Nullable ItemStack getItem(String itemName) { | ||
AzureFlowItemFactory factory = AzureFlowAPI.getFactory(itemName); | ||
if (factory == null) { | ||
return null; | ||
} | ||
AzureFlowItem azureFlowItem = factory.build(); | ||
return azureFlowItem.staticItemStack(); | ||
} | ||
|
||
@Override | ||
public @Nullable ItemStack getItem(String itemName, @Nullable OfflinePlayer player) { | ||
AzureFlowItemFactory factory = AzureFlowAPI.getFactory(itemName); | ||
if (factory == null) { | ||
return null; | ||
} | ||
AzureFlowItem azureFlowItem = factory.build(); | ||
if (player == null) { | ||
return azureFlowItem.staticItemStack(); | ||
} | ||
return azureFlowItem.virtualItemStack(player.getPlayer()); | ||
} | ||
} |
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
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
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
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
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
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