mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
Merge branch 'v5' into backups
This commit is contained in:
commit
7a6909dab1
@ -68,6 +68,7 @@ import com.plotsquared.core.plot.flag.implementations.IceMeltFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.InstabreakFlag;
|
import com.plotsquared.core.plot.flag.implementations.InstabreakFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ItemDropFlag;
|
import com.plotsquared.core.plot.flag.implementations.ItemDropFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.KeepInventoryFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.KelpGrowFlag;
|
import com.plotsquared.core.plot.flag.implementations.KelpGrowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag;
|
import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.MiscBreakFlag;
|
import com.plotsquared.core.plot.flag.implementations.MiscBreakFlag;
|
||||||
@ -166,6 +167,7 @@ import org.bukkit.event.entity.EntityExplodeEvent;
|
|||||||
import org.bukkit.event.entity.EntityPickupItemEvent;
|
import org.bukkit.event.entity.EntityPickupItemEvent;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
import org.bukkit.event.entity.LingeringPotionSplashEvent;
|
||||||
|
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||||
import org.bukkit.event.entity.PotionSplashEvent;
|
import org.bukkit.event.entity.PotionSplashEvent;
|
||||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||||
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
import org.bukkit.event.entity.ProjectileLaunchEvent;
|
||||||
@ -2991,4 +2993,12 @@ public class PlayerEvents extends PlotListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler public void onDeath(final PlayerDeathEvent event) {
|
||||||
|
final Plot plot = BukkitUtil.getPlayer(event.getEntity()).getCurrentPlot();
|
||||||
|
if (plot != null && plot.getFlag(KeepInventoryFlag.class)) {
|
||||||
|
event.setKeepInventory(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -672,6 +672,7 @@ public enum Captions implements Caption {
|
|||||||
FLAG_DESCRIPTION_GUEST_GAMEMODE("Determines the guest gamemode in the plot.", "Flags"),
|
FLAG_DESCRIPTION_GUEST_GAMEMODE("Determines the guest gamemode in the plot.", "Flags"),
|
||||||
FLAG_DESCRIPTION_BLOCKED_CMDS("A list of commands that are blocked in the plot.", "Flags"),
|
FLAG_DESCRIPTION_BLOCKED_CMDS("A list of commands that are blocked in the plot.", "Flags"),
|
||||||
FLAG_DESCRIPTION_KEEP("Prevents the plot from expiring. Can be set to: true, false, the number of milliseconds to keep the plot for or a timestamp (3w 2d 5h).", "Flags"),
|
FLAG_DESCRIPTION_KEEP("Prevents the plot from expiring. Can be set to: true, false, the number of milliseconds to keep the plot for or a timestamp (3w 2d 5h).", "Flags"),
|
||||||
|
FLAG_DESCRIPTION_KEEP_INVENTORY("Prevents players from dropping their items when they die inside of the plot.", "Flags"),
|
||||||
//</editor-fold>
|
//</editor-fold>
|
||||||
//<editor-fold desc="Flag category errors">
|
//<editor-fold desc="Flag category errors">
|
||||||
FLAG_ERROR_BOOLEAN("Flag value must be a boolean (true|false)", false, "Flags"),
|
FLAG_ERROR_BOOLEAN("Flag value must be a boolean (true|false)", false, "Flags"),
|
||||||
|
@ -65,6 +65,7 @@ import com.plotsquared.core.plot.flag.implementations.InstabreakFlag;
|
|||||||
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
import com.plotsquared.core.plot.flag.implementations.InvincibleFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.ItemDropFlag;
|
import com.plotsquared.core.plot.flag.implementations.ItemDropFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.KeepFlag;
|
import com.plotsquared.core.plot.flag.implementations.KeepFlag;
|
||||||
|
import com.plotsquared.core.plot.flag.implementations.KeepInventoryFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.KelpGrowFlag;
|
import com.plotsquared.core.plot.flag.implementations.KelpGrowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag;
|
import com.plotsquared.core.plot.flag.implementations.LiquidFlowFlag;
|
||||||
import com.plotsquared.core.plot.flag.implementations.MiscBreakFlag;
|
import com.plotsquared.core.plot.flag.implementations.MiscBreakFlag;
|
||||||
@ -176,6 +177,7 @@ public final class GlobalFlagContainer extends FlagContainer {
|
|||||||
this.addFlag(ChatFlag.CHAT_FLAG_TRUE);
|
this.addFlag(ChatFlag.CHAT_FLAG_TRUE);
|
||||||
this.addFlag(MiscPlaceFlag.MISC_PLACE_FALSE);
|
this.addFlag(MiscPlaceFlag.MISC_PLACE_FALSE);
|
||||||
this.addFlag(MiscInteractFlag.MISC_INTERACT_FALSE);
|
this.addFlag(MiscInteractFlag.MISC_INTERACT_FALSE);
|
||||||
|
this.addFlag(KeepInventoryFlag.KEEP_INVENTORY_FALSE);
|
||||||
|
|
||||||
// Enum Flags
|
// Enum Flags
|
||||||
this.addFlag(WeatherFlag.PLOT_WEATHER_FLAG_OFF);
|
this.addFlag(WeatherFlag.PLOT_WEATHER_FLAG_OFF);
|
||||||
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* _____ _ _ _____ _
|
||||||
|
* | __ \| | | | / ____| | |
|
||||||
|
* | |__) | | ___ | |_| (___ __ _ _ _ __ _ _ __ ___ __| |
|
||||||
|
* | ___/| |/ _ \| __|\___ \ / _` | | | |/ _` | '__/ _ \/ _` |
|
||||||
|
* | | | | (_) | |_ ____) | (_| | |_| | (_| | | | __/ (_| |
|
||||||
|
* |_| |_|\___/ \__|_____/ \__, |\__,_|\__,_|_| \___|\__,_|
|
||||||
|
* | |
|
||||||
|
* |_|
|
||||||
|
* PlotSquared plot management system for Minecraft
|
||||||
|
* Copyright (C) 2020 IntellectualSites
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package com.plotsquared.core.plot.flag.implementations;
|
||||||
|
|
||||||
|
import com.plotsquared.core.configuration.Captions;
|
||||||
|
import com.plotsquared.core.plot.flag.types.BooleanFlag;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
public class KeepInventoryFlag extends BooleanFlag<KeepInventoryFlag> {
|
||||||
|
|
||||||
|
public static final KeepInventoryFlag KEEP_INVENTORY_TRUE = new KeepInventoryFlag(true);
|
||||||
|
public static final KeepInventoryFlag KEEP_INVENTORY_FALSE = new KeepInventoryFlag(false);
|
||||||
|
|
||||||
|
private KeepInventoryFlag(final boolean value) {
|
||||||
|
super(value, Captions.FLAG_DESCRIPTION_KEEP_INVENTORY);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override protected KeepInventoryFlag flagOf(@NotNull final Boolean value) {
|
||||||
|
return value ? KEEP_INVENTORY_TRUE : KEEP_INVENTORY_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -63,7 +63,11 @@ public class DefaultPlotAreaManager implements PlotAreaManager {
|
|||||||
case 0:
|
case 0:
|
||||||
return null;
|
return null;
|
||||||
case 1:
|
case 1:
|
||||||
return this.plotAreas[0];
|
return this.plotAreas[0].getWorldHash() == location.getWorld().hashCode()
|
||||||
|
&& this.plotAreas[0].contains(location) && (!this.plotAreaHasCollision
|
||||||
|
|| location.getWorld().equals(this.plotAreas[0].getWorldName())) ?
|
||||||
|
this.plotAreas[0] :
|
||||||
|
null;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
case 4:
|
case 4:
|
||||||
|
Loading…
Reference in New Issue
Block a user