Update to v2.1 (Closes #31)

This commit is contained in:
GeorgH93 2020-01-07 02:58:31 +01:00
parent e469f1a16d
commit 8d69d725bc
No known key found for this signature in database
GPG Key ID: D1630D37F9E4B3C8
8 changed files with 26 additions and 13 deletions

View File

@ -14,8 +14,8 @@
[licenseImg]: https://img.shields.io/github/license/GeorgH93/Minepacks.svg
[ci]: https://ci.pcgamingfreaks.at/job/Minepacks/
[ciImg]: https://ci.pcgamingfreaks.at/job/Minepacks/badge/icon
[ciDev]: https://ci.pcgamingfreaks.at/job/Minepacks%20V2/
[ciDevImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20V2/badge/icon
[ciDev]: https://ci.pcgamingfreaks.at/job/Minepacks%20Dev/
[ciDevImg]: https://ci.pcgamingfreaks.at/job/Minepacks%20Dev/badge/icon
[apiVersionImg]: https://img.shields.io/badge/dynamic/xml.svg?label=api-version&query=%2F%2Frelease[1]&url=https%3A%2F%2Frepo.pcgamingfreaks.at%2Frepository%2Fmaven-releases%2Fat%2Fpcgamingfreaks%2FMinepacks-API%2Fmaven-metadata.xml
[api]: https://github.com/GeorgH93/Minepacks/tree/API
[apiJavaDoc]: https://ci.pcgamingfreaks.at/job/Minepacks%20API/javadoc/

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>at.pcgamingfreaks</groupId>
<artifactId>Minepacks</artifactId>
<version>2.1-RC3</version>
<version>2.1</version>
<scm>
<connection>scm:git:git@github.com:GeorgH93/Minepacks.git</connection>

View File

@ -13,6 +13,8 @@ Language:
PlayerBackpackClose_SendMethod: "action_bar"
InvalidBackpack: "Rucksack fehlerhaft."
NotAllowedInBackpack: "&c{ItemName} ist im Rucksack nicht erlaubt."
DontRemoveShortcut: "&cDu darfst den Rucksack nicht aus deinem Inventar entfernen!"
DontRemoveShortcut_SendMethod: "action_bar"
Clean:
BackpackCleaned: "Rucksack gelehrt."
Open:
@ -110,4 +112,4 @@ LanguageName: "german"
Author: "GeorgH93"
# Language file version. Don't touch it!
Version: 16
Version: 17

View File

@ -13,6 +13,9 @@ Language:
PlayerBackpackClose_SendMethod: "action_bar"
InvalidBackpack: "Invalid backpack."
NotAllowedInBackpack: "&c{ItemName} is not allowed in the backpack."
NotAllowedInBackpack_SendMethod: "action_bar"
DontRemoveShortcut: "&cYou must not remove the backpack shortcut from your inventory!"
DontRemoveShortcut_SendMethod: "action_bar"
Open:
#Parameter: {TimeLeft} time in seconds till the backpack can be reopened, {TimeSpanLeft} time formatted as string till the backpack can be reopened
Cooldown: "[{\"text\":\"Please wait \",\"color\":\"dark_green\"},{\"text\":\"{TimeSpanLeft}\",\"hoverEvent\":{\"action\":\"show_text\",\"value\":\"{TimeLeft} seconds\"}},{\"text\":\" till you reopen your backpack.\"}]"
@ -96,4 +99,4 @@ LanguageName: "english"
Author: "GeorgH93"
# Language file version. Don't touch it!
Version: 16
Version: 17

View File

@ -317,7 +317,7 @@ public WorldBlacklistMode getWorldBlacklistMode()
//region ItemShortcut settings
public boolean isItemShortcutEnabled()
{
return MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) && getConfigE().getBoolean("ItemShortcut.Enabled", true);
return MCVersion.isNewerOrEqualThan(MCVersion.MC_1_8) && getConfigE().getBoolean("ItemShortcut.Enabled", true);
}
public String getItemShortcutItemName()
@ -332,11 +332,11 @@ public String getItemShortcutHeadValue()
//endregion
//region Sound settings
private Sound getSound(String option, Sound autoValue)
private Sound getSound(String option, String autoValue)
{
if(!getConfigE().getBoolean("Sound.Enabled", true)) return null;
String soundName = getConfigE().getString("Sound." + option, "auto").toUpperCase(Locale.ENGLISH);
if(soundName.equals("AUTO")) return autoValue;
if(soundName.equals("AUTO")) soundName = autoValue;
if(soundName.equals("DISABLED") || soundName.equals("FALSE")) return null;
try
{
@ -351,12 +351,12 @@ private Sound getSound(String option, Sound autoValue)
public Sound getOpenSound()
{
return getSound("OpenSound", MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) ? Sound.valueOf("BLOCK_SHULKER_BOX_OPEN") : (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9_2) ? Sound.BLOCK_CHEST_OPEN : Sound.valueOf("CHEST_OPEN")));
return getSound("OpenSound", MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) ? "BLOCK_SHULKER_BOX_OPEN" : (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9_2) ? "BLOCK_CHEST_OPEN" : "CHEST_OPEN"));
}
public Sound getCloseSound()
{
return getSound("CloseSound", MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) ? Sound.valueOf("BLOCK_SHULKER_BOX_CLOSE") : (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9_2) ? Sound.BLOCK_CHEST_CLOSE : Sound.valueOf("CHEST_CLOSE")));
return getSound("CloseSound", MCVersion.isNewerOrEqualThan(MCVersion.MC_1_11) ? "BLOCK_SHULKER_BOX_CLOSE" : (MCVersion.isNewerOrEqualThan(MCVersion.MC_1_9_2) ? "BLOCK_CHEST_CLOSE" : "CHEST_CLOSE"));
}
//endregion
//endregion

View File

@ -1,5 +1,5 @@
/*
* Copyright (C) 2019 GeorgH93
* Copyright (C) 2020 GeorgH93
*
* 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
@ -28,7 +28,7 @@
public class Language extends at.pcgamingfreaks.Bukkit.Language
{
private static final int LANG_VERSION = 16, UPGRADE_THRESHOLD = 16;
private static final int LANG_VERSION = 17, UPGRADE_THRESHOLD = 17;
public Language(JavaPlugin plugin)
{

View File

@ -18,6 +18,7 @@
package at.pcgamingfreaks.Minepacks.Bukkit.Listener;
import at.pcgamingfreaks.Bukkit.HeadUtils;
import at.pcgamingfreaks.Bukkit.Message.Message;
import at.pcgamingfreaks.Minepacks.Bukkit.Minepacks;
import org.bukkit.ChatColor;
@ -46,11 +47,13 @@ public class ItemShortcut implements Listener
{
private static final UUID MINEPACKS_UUID = UUID.nameUUIDFromBytes("Minepacks".getBytes());
private final String itemName, value;
private final Message messageDoNotRemoveItem;
public ItemShortcut(Minepacks plugin)
{
itemName = ChatColor.translateAlternateColorCodes('&', plugin.getConfiguration().getItemShortcutItemName());
value = plugin.getConfiguration().getItemShortcutHeadValue();
messageDoNotRemoveItem = plugin.getLanguage().getMessage("Ingame.DontRemoveShortcut");
}
private boolean isItemShortcut(@Nullable ItemStack stack)
@ -109,11 +112,13 @@ public void onItemClick(InventoryClickEvent event)
else if(event.getAction() == InventoryAction.MOVE_TO_OTHER_INVENTORY)
{
event.setCancelled(true);
messageDoNotRemoveItem.send(event.getWhoClicked());
}
}
else if(isItemShortcut(event.getCursor()) && !event.getWhoClicked().getInventory().equals(event.getClickedInventory()))
{
event.setCancelled(true);
messageDoNotRemoveItem.send(event.getWhoClicked());
}
}
}
@ -126,10 +131,12 @@ public void onItemDrag(InventoryDragEvent event)
if(isItemShortcut(event.getCursor()))
{
event.setCancelled(true);
messageDoNotRemoveItem.send(event.getWhoClicked());
}
else if(isItemShortcut(event.getOldCursor()))
{
event.setCancelled(true);
messageDoNotRemoveItem.send(event.getWhoClicked());
}
}
}
@ -154,6 +161,7 @@ public void onSpawn(PlayerDropItemEvent event)
if(isItemShortcut(event.getItemDrop().getItemStack()))
{
event.setCancelled(true);
messageDoNotRemoveItem.send(event.getPlayer());
}
}

View File

@ -57,7 +57,7 @@ public class Minepacks extends JavaPlugin implements MinepacksPlugin
{
private static final int BUKKIT_PROJECT_ID = 83445;
@SuppressWarnings("unused")
private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB_DEV = "Minepacks V2", JENKINS_JOB_MASTER = "Minepacks", MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.15-SNAPSHOT";
private static final String JENKINS_URL = "https://ci.pcgamingfreaks.at", JENKINS_JOB_DEV = "Minepacks Dev", JENKINS_JOB_MASTER = "Minepacks", MIN_PCGF_PLUGIN_LIB_VERSION = "1.0.19-SNAPSHOT";
private static Minepacks instance = null;
private Config config;