Skip to content

Commit

Permalink
Updated to a7c1b3a
Browse files Browse the repository at this point in the history
  • Loading branch information
StarWishsama committed Feb 1, 2020
1 parent ef32215 commit 1e48893
Show file tree
Hide file tree
Showing 161 changed files with 7,262 additions and 3,803 deletions.
8 changes: 4 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>me.mrCookieSlime</groupId>
<artifactId>Slimefun</artifactId>
<version>4.2-UNOFFCIAL-200128</version>
<version>4.2-git-20200201</version>

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -41,7 +41,7 @@

<build>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<finalName>${project.name}-v${project.version}</finalName>
<finalName>${project.name} v${project.version}</finalName>

<plugins>
<plugin>
Expand Down Expand Up @@ -109,13 +109,13 @@
<dependency>
<groupId>com.github.TheBusyBiscuit</groupId>
<artifactId>CS-CoreLib</artifactId>
<version>ebba7c0096</version>
<version>8081bb4fe4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.thebusybiscuit</groupId>
<artifactId>CS-CoreLib2</artifactId>
<version>0.8.8</version>
<version>0.9.1</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public ErrorReport(Throwable throwable, Consumer<PrintStream> printer) {
Slimefun.getLogger().log(Level.WARNING, "You can put the file on Pastebin and then post it here: https://github.com/TheBusyBiscuit/Slimefun4/issues");
Slimefun.getLogger().log(Level.WARNING, "");
} catch (FileNotFoundException x) {
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while saving an Error-Report for Slimefun " + Slimefun.getVersion(), x);
Slimefun.getLogger().log(Level.SEVERE, "An Error occured while saving an Error-Report for Slimefun " + SlimefunPlugin.getVersion(), x);
}
});
}
Expand Down Expand Up @@ -146,15 +146,17 @@ private void scanPlugins(List<String> plugins, List<String> addons) {
for (Plugin plugin : Bukkit.getPluginManager().getPlugins()) {
if (Bukkit.getPluginManager().isPluginEnabled(plugin)) {
plugins.add(" + " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency)) {
addons.add(" + " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
}

if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency)) {
addons.add(" + " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
}
}
else {
plugins.add(" - " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency)) {
addons.add(" - " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
}

if (plugin.getDescription().getDepend().contains(dependency) || plugin.getDescription().getSoftDepend().contains(dependency)) {
addons.add(" - " + plugin.getName() + ' ' + plugin.getDescription().getVersion());
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
package io.github.thebusybiscuit.slimefun4.api.events;

import java.util.Optional;

import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.inventory.ItemStack;

import io.github.thebusybiscuit.cscorelib2.data.ComputedOptional;
import me.mrCookieSlime.Slimefun.Objects.SlimefunItem.SlimefunItem;
import me.mrCookieSlime.Slimefun.api.BlockStorage;

public class PlayerRightClickEvent extends Event {

private static final HandlerList handlers = new HandlerList();

private final PlayerInteractEvent event;
private final Player player;

private final Optional<ItemStack> itemStack;
private final Optional<Block> clickedBlock;

private final EquipmentSlot hand;
private final BlockFace face;

private ComputedOptional<SlimefunItem> slimefunItem = ComputedOptional.createNew();
private ComputedOptional<SlimefunItem> slimefunBlock = ComputedOptional.createNew();

private Result itemResult = Result.DEFAULT;
private Result blockResult = Result.DEFAULT;

public PlayerRightClickEvent(PlayerInteractEvent e) {
event = e;
player = e.getPlayer();
clickedBlock = Optional.ofNullable(e.getClickedBlock());
face = e.getBlockFace();
hand = e.getHand();

if (e.getItem() == null || e.getItem().getType() == Material.AIR || e.getItem().getAmount() == 0) {
itemStack = Optional.empty();
}
else {
itemStack = Optional.of(e.getItem());
}
}

public static HandlerList getHandlerList() {
return handlers;
}

public HandlerList getHandlers() {
return handlers;
}

public PlayerInteractEvent getInteractEvent() {
return event;
}

public Player getPlayer() {
return player;
}

public ItemStack getItem() {
return itemStack.orElse(new ItemStack(Material.AIR));
}

public EquipmentSlot getHand() {
return hand;
}

public Optional<Block> getClickedBlock() {
return clickedBlock;
}

public BlockFace getClickedFace() {
return face;
}

public Optional<SlimefunItem> getSlimefunItem() {

if (!slimefunItem.isComputed()) {
if (itemStack.isPresent()) {
slimefunItem.compute(SlimefunItem.getByItem(itemStack.get()));
}
else {
slimefunItem = ComputedOptional.empty();
}
}

return slimefunItem.getAsOptional();
}

public Optional<SlimefunItem> getSlimefunBlock() {

if (!slimefunBlock.isComputed()) {
if (clickedBlock.isPresent()) {
slimefunBlock.compute(BlockStorage.check(clickedBlock.get()));
}
else {
slimefunBlock = ComputedOptional.empty();
}
}

return slimefunBlock.getAsOptional();
}

public void cancel() {
itemResult = Result.DENY;
blockResult = Result.DENY;
}

public Result useItem() {
return itemResult;
}

public Result useBlock() {
return blockResult;
}

public void setUseItem(Result result) {
itemResult = result;
}

public void setUseBlock(Result result) {
blockResult = result;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -30,17 +30,18 @@ public interface GEOResource {

/**
* Measurement Unit e.g. "Bucket" / "Buckets".
* Use the amount parameter to determine whether to use singular or plural.
* Use the amount parameter to determine whether to use singular or plural.
*
* @return The Measurement Unit for this resource, will be treated like a suffix.
*/
String getMeasurementUnit(int amount);
String getMeasurementUnit(int amount);

/**
* Returns whether this Resource is considered a liquid.
* Returns whether this Resource can be obtained using a GEO Miner.
* This will automatically add it to the GEO - Miner.
*
* @return Whether you can get obtain this resource using a GEO Miner.
*/
boolean isObtainableFromGEOMiner();
boolean isObtainableFromGEOMiner();

}
Loading

0 comments on commit 1e48893

Please sign in to comment.