mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 13:16:45 +01:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
921a0228db
@ -200,15 +200,19 @@ public class PartyCommand implements TabExecutor {
|
|||||||
|
|
||||||
if (matches.size() == 0) {
|
if (matches.size() == 0) {
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
|
final McMMOPlayer mcMMOPlayer = UserManager.getPlayer(player);
|
||||||
|
|
||||||
//Not Loaded
|
//Not Loaded
|
||||||
if(UserManager.getPlayer(player) == null)
|
if(mcMMOPlayer == null)
|
||||||
{
|
{
|
||||||
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
sender.sendMessage(LocaleLoader.getString("Profile.PendingLoad"));
|
||||||
return ImmutableList.of();
|
return ImmutableList.of();
|
||||||
}
|
}
|
||||||
|
|
||||||
Party party = UserManager.getPlayer(player).getParty();
|
if (mcMMOPlayer.getParty() == null)
|
||||||
|
return ImmutableList.of();
|
||||||
|
|
||||||
|
final Party party = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
playerNames = party.getOnlinePlayerNames(player);
|
playerNames = party.getOnlinePlayerNames(player);
|
||||||
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
return StringUtil.copyPartialMatches(args[1], playerNames, new ArrayList<>(playerNames.size()));
|
||||||
|
@ -25,7 +25,7 @@ public class PartyRenameCommand implements CommandExecutor {
|
|||||||
Party playerParty = mcMMOPlayer.getParty();
|
Party playerParty = mcMMOPlayer.getParty();
|
||||||
|
|
||||||
String oldPartyName = playerParty.getName();
|
String oldPartyName = playerParty.getName();
|
||||||
String newPartyName = args[1];
|
String newPartyName = args[1].replace(".", "");
|
||||||
|
|
||||||
// This is to prevent party leaders from spamming other players with the rename message
|
// This is to prevent party leaders from spamming other players with the rename message
|
||||||
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
|
if (oldPartyName.equalsIgnoreCase(newPartyName)) {
|
||||||
|
@ -450,6 +450,9 @@ public class PlayerListener implements Listener {
|
|||||||
case CAUGHT_FISH:
|
case CAUGHT_FISH:
|
||||||
if(caught instanceof Item) {
|
if(caught instanceof Item) {
|
||||||
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
if(ExperienceConfig.getInstance().isFishingExploitingPrevented()) {
|
||||||
|
|
||||||
|
fishingManager.processExploiting(event.getHook().getLocation().toVector());
|
||||||
|
|
||||||
if (fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) {
|
if (fishingManager.isExploitingFishing(event.getHook().getLocation().toVector())) {
|
||||||
player.sendMessage(LocaleLoader.getString("Fishing.ScarcityTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
player.sendMessage(LocaleLoader.getString("Fishing.ScarcityTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||||
event.setExpToDrop(0);
|
event.setExpToDrop(0);
|
||||||
|
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
public final class PartyManager {
|
public final class PartyManager {
|
||||||
private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
private static final String partiesFilePath = mcMMO.getFlatFileDirectory() + "parties.yml";
|
||||||
@ -609,6 +610,7 @@ public final class PartyManager {
|
|||||||
ArrayList<Party> hasAlly = new ArrayList<>();
|
ArrayList<Party> hasAlly = new ArrayList<>();
|
||||||
|
|
||||||
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
for (String partyName : partiesFile.getConfigurationSection("").getKeys(false)) {
|
||||||
|
try {
|
||||||
Party party = new Party(partyName);
|
Party party = new Party(partyName);
|
||||||
|
|
||||||
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
String[] leaderSplit = partiesFile.getString(partyName + ".Leader").split("[|]");
|
||||||
@ -637,6 +639,9 @@ public final class PartyManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
parties.add(party);
|
parties.add(party);
|
||||||
|
} catch (Exception e) {
|
||||||
|
mcMMO.p.getLogger().log(Level.WARNING, "An exception occurred while loading a party with name '" + partyName + "'. Skipped loading party.", e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
mcMMO.p.debug("Loaded (" + parties.size() + ") Parties...");
|
||||||
|
@ -51,6 +51,7 @@ public class FishingManager extends SkillManager {
|
|||||||
private long lastWarnedExhaust = 0L;
|
private long lastWarnedExhaust = 0L;
|
||||||
private FishHook fishHookReference;
|
private FishHook fishHookReference;
|
||||||
private BoundingBox lastFishingBoundingBox;
|
private BoundingBox lastFishingBoundingBox;
|
||||||
|
private boolean sameTarget;
|
||||||
private Item fishingCatch;
|
private Item fishingCatch;
|
||||||
private Location hookLocation;
|
private Location hookLocation;
|
||||||
private int fishCaughtCounter = 1;
|
private int fishCaughtCounter = 1;
|
||||||
@ -125,6 +126,25 @@ public class FishingManager extends SkillManager {
|
|||||||
return hasFished;
|
return hasFished;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void processExploiting(Vector centerOfCastVector) {
|
||||||
|
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
||||||
|
this.sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
||||||
|
|
||||||
|
if (this.sameTarget) {
|
||||||
|
fishCaughtCounter++;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
fishCaughtCounter = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
||||||
|
if (!this.sameTarget) lastFishingBoundingBox = newCastBoundingBox;
|
||||||
|
|
||||||
|
if (fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit()) {
|
||||||
|
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isExploitingFishing(Vector centerOfCastVector) {
|
public boolean isExploitingFishing(Vector centerOfCastVector) {
|
||||||
|
|
||||||
/*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
/*Block targetBlock = getPlayer().getTargetBlock(BlockUtils.getTransparentBlocks(), 100);
|
||||||
@ -133,25 +153,7 @@ public class FishingManager extends SkillManager {
|
|||||||
return false;
|
return false;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
BoundingBox newCastBoundingBox = makeBoundingBox(centerOfCastVector);
|
return this.sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
||||||
|
|
||||||
boolean sameTarget = lastFishingBoundingBox != null && lastFishingBoundingBox.overlaps(newCastBoundingBox);
|
|
||||||
|
|
||||||
if(sameTarget)
|
|
||||||
fishCaughtCounter++;
|
|
||||||
else
|
|
||||||
fishCaughtCounter = 1;
|
|
||||||
|
|
||||||
if(fishCaughtCounter + 1 == ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit())
|
|
||||||
{
|
|
||||||
getPlayer().sendMessage(LocaleLoader.getString("Fishing.LowResourcesTip", ExperienceConfig.getInstance().getFishingExploitingOptionMoveRange()));
|
|
||||||
}
|
|
||||||
|
|
||||||
//If the new bounding box does not intersect with the old one, then update our bounding box reference
|
|
||||||
if(!sameTarget)
|
|
||||||
lastFishingBoundingBox = newCastBoundingBox;
|
|
||||||
|
|
||||||
return sameTarget && fishCaughtCounter >= ExperienceConfig.getInstance().getFishingExploitingOptionOverFishLimit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
public static BoundingBox makeBoundingBox(Vector centerOfCastVector) {
|
||||||
|
Loading…
Reference in New Issue
Block a user