Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New API events #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CoinsEngine.iml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="FacetManager">
<facet type="minecraft" name="Minecraft">
<configuration>
<autoDetectTypes>
<platformType>SPIGOT</platformType>
<platformType>BUKKIT</platformType>
</autoDetectTypes>
<projectReimportVersion>1</projectReimportVersion>
</configuration>
</facet>
</component>
</module>
Binary file added libs/nightcore.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@
</plugins>
</build>

</project>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
package su.nightexpress.coinsengine.api.event;

import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import su.nightexpress.coinsengine.api.currency.Currency;
import org.jetbrains.annotations.NotNull;

public class CoinsExchangeEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final Player user;
private final Currency fromCurrency;
private final Currency toCurrency;
private double fromAmount;
private double toAmount;

public CoinsExchangeEvent(@NotNull Player user, @NotNull Currency fromCurrency, @NotNull Currency toCurrency, double fromAmount, double toAmount) {
this.user = user;
this.fromCurrency = fromCurrency;
this.toCurrency = toCurrency;
this.fromAmount = fromAmount;
this.toAmount = toAmount;
}

@NotNull
public Player getUser() {
return user;
}

@NotNull
public Currency getFromCurrency() {
return fromCurrency;
}

@NotNull
public Currency getToCurrency() {
return toCurrency;
}

public double getFromAmount() {
return fromAmount;
}

public void setFromAmount(double fromAmount) {
this.fromAmount = fromAmount;
}

public double getToAmount() {
return toAmount;
}

public void setToAmount(double toAmount) {
this.toAmount = toAmount;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package su.nightexpress.coinsengine.api.event;

import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import su.nightexpress.coinsengine.api.currency.Currency;
import su.nightexpress.coinsengine.data.impl.CoinsUser;
import org.jetbrains.annotations.NotNull;

public class CoinsGiveEvent extends Event{
private static final HandlerList handlers = new HandlerList();
private final OfflinePlayer user;
private final CommandSender from;
private final Currency currency;
private final String currencyName;
private double amount;

public CoinsGiveEvent(@NotNull OfflinePlayer user, @NotNull Currency currency, double amount, @NotNull CommandSender from) {
this.user = user;
this.currency = currency;
this.currencyName = currency.getName();
this.amount = amount;
this.from = from;
}

@NotNull
public OfflinePlayer getUser() {
return user;
}

@NotNull
public CommandSender getFrom() {
return from;
}

public String getCurrencyName() {
return currencyName;
}

@NotNull
public Currency getCurrency() {
return currency;
}

public double getAmount() {
return amount;
}

public void setAmount(double amount) {
this.amount = amount;
}


@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package su.nightexpress.coinsengine.api.event;

import org.bukkit.OfflinePlayer;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import su.nightexpress.coinsengine.api.currency.Currency;
import su.nightexpress.coinsengine.data.impl.CoinsUser;
import org.jetbrains.annotations.NotNull;

public class CoinsSendEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final Currency currency;
private final String currencyName;
private double amount;
private final OfflinePlayer target;
private final CommandSender from;

public CoinsSendEvent(@NotNull OfflinePlayer target, @NotNull Currency currency, double amount, @NotNull CommandSender from) {
this.target = target;
this.currency = currency;
this.currencyName = currency.getName();
this.amount = amount;
this.from = from;
}

@NotNull
public OfflinePlayer getTarget() {
return target;
}

@NotNull
public Currency getCurrency() {
return currency;
}

public double getAmount() {
return amount;
}

public String getCurrencyName() {
return currencyName;
}

public void setAmount(double amount) {
this.amount = amount;
}

@NotNull
public CommandSender getFrom() {
return from;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package su.nightexpress.coinsengine.api.event;

import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import su.nightexpress.coinsengine.api.currency.Currency;
import su.nightexpress.coinsengine.data.impl.CoinsUser;
import org.jetbrains.annotations.NotNull;

public class CoinsSetEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final CoinsUser user;
private final Currency currency;
private double amount;
private final CommandSender from;

public CoinsSetEvent(@NotNull CoinsUser user, @NotNull Currency currency, double amount, @NotNull CommandSender from) {
this.user = user;
this.currency = currency;
this.amount = amount;
this.from = from;
}

@NotNull
public CoinsUser getUser() {
return user;
}

@NotNull
public Currency getCurrency() {
return currency;
}

public double getAmount() {
return amount;
}

public void setAmount(double amount) {
this.amount = amount;
}

@NotNull
public CommandSender getFrom() {
return from;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
package su.nightexpress.coinsengine.api.event;

import org.bukkit.command.CommandSender;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
import su.nightexpress.coinsengine.api.currency.Currency;
import su.nightexpress.coinsengine.data.impl.CoinsUser;
import org.jetbrains.annotations.NotNull;

public class CoinsTakeEvent extends Event implements Cancellable {
private static final HandlerList handlers = new HandlerList();
private boolean cancelled;
private final CoinsUser user;
private final Currency currency;
private double amount;
private final CommandSender from;

public CoinsTakeEvent(@NotNull CoinsUser user, @NotNull Currency currency, double amount, @NotNull CommandSender from) {
this.user = user;
this.currency = currency;
this.amount = amount;
this.from = from;
}

@NotNull
public CoinsUser getUser() {
return user;
}

@NotNull
public Currency getCurrency() {
return currency;
}

public double getAmount() {
return amount;
}

public void setAmount(double amount) {
this.amount = amount;
}

@NotNull
public CommandSender getFrom() {
return from;
}

@Override
public boolean isCancelled() {
return cancelled;
}

@Override
public void setCancelled(boolean cancel) {
this.cancelled = cancel;
}

@NotNull
@Override
public HandlerList getHandlers() {
return handlers;
}

public static HandlerList getHandlerList() {
return handlers;
}
}
Loading